var currPhoto = 1;
var timer;

$(document).ready(function() {
   timer = setInterval("loopHomepage()", 10000);
});

function homepagePhotoSwitch(photo) {
	if (photo == 1) {
		$("#homephoto1").removeClass("hidePhoto");
	} else {
		$("#homephoto1").addClass("hidePhoto");
	}
	if (photo == 2) {
		$("#homephoto2").removeClass("hidePhoto");
	} else {
		$("#homephoto2").addClass("hidePhoto");
	}
	if (photo == 3) {
		$("#homephoto3").removeClass("hidePhoto");
	} else {
		$("#homephoto3").addClass("hidePhoto");
	}
	if (photo == 4) {
		$("#homephoto4").removeClass("hidePhoto");
	} else {
		$("#homephoto4").addClass("hidePhoto");
	}
	
}

function homepagePhotoClick(photo) {
   homepagePhotoSwitch(photo);
   clearInterval(timer);
}

function loopHomepage() {
    currPhoto = (currPhoto % 4) + 1;
    homepagePhotoSwitch(currPhoto);
}


var translatemenudone = findmenudone = 0;

$(document).ready(function() {
	$('div').pngFix( );
	activatemenu("#findlink","findmenudone", "#quicklinkscontent", "#findlink", "over");
	$('.collapsiblelist li>ul').each(function(i) {
		var parent = $(this).parent('li');
		parent.addClass('closed');
		var children = $(this).remove();
		parent.prepend('<span class="toggle">-</span>').find('span').toggle(
			function() {
				parent.removeClass('closed');
				parent.addClass('open');
				children.show();
			},
			function() {
				parent.removeClass('open');
				parent.addClass('closed');
				children.hide();
			}
		);
		parent.append(children);
	});
	$('.collapsiblelist ul ul').hide();
	$(".striped tr:even").addClass("alt");
    $("#cse-search-box").append('<input type="hidden" name="id" value="728" />');
    $("#cse-search-box").append('<input type="hidden" name="cof" value="FORID:11" />');
});

function activatemenu(id, storedlocation, menu, linkover, classover) {
	var trackerID;
	$(id).mouseover(function() {				 	
		if(eval(storedlocation) == 0) {
			trackerID = window.setTimeout('showMenu("' + storedlocation + '","' + menu + '","' + linkover + '","' + classover + '")',250);
		} else { 
			window.clearTimeout(trackerID); }
	   });
		$(id).mouseout(function() {
			window.clearTimeout(trackerID);
			trackerID = window.setTimeout('clearMenu("' + storedlocation + '","' + menu + '","' + linkover + '","' + classover + '")',250);
	   }); 
		$(menu).mouseover(function() {
			window.clearTimeout(trackerID);
			$(menu).show("");
			$(linkover).addClass(classover);
	   }); 
		$(menu).mouseout(function() {
			window.clearTimeout(trackerID);
			trackerID = window.setTimeout('clearMenu("' + storedlocation + '","' + menu + '","' + linkover + '","' + classover + '")',250);
	   });	
}

function showMenu(storedlocation, menu, linkover, classover) {
		eval(storedlocation+"=1;");
    	$(menu).slideDown("fast"); 
		$(linkover).addClass(classover);
}
 function clearMenu(storedlocation, menu, linkover, classover) {
		eval(storedlocation+"=0;");
		$(menu).stop();
		$(menu).hide("");
		$(linkover).removeClass(classover);
}



OAS_url = 'http://ads.digitalhealthcare.com/RealMedia/ads/';
OAS_sitepage = window.location.hostname + window.location.pathname;
if(OAS_sitepage.substring(0,7) == "http://") {
	OAS_sitepage = OAS_sitepage.substring(7);
}
if((OAS_sitepage.substring(0,8) == "www-iis-")||(OAS_sitepage.substring(0,10) == "d-www-iis-")) {
	OAS_sitepage = "onsmaster.ons.org"+window.location.pathname;
} else if(OAS_sitepage.substring(0,4) != "www.") {
	OAS_sitepage = "www." + OAS_sitepage;
}
OAS_listpos = 'Top3,Right_combo,Left_combo';
OAS_query = '';
OAS_target = '_top';
OAS_version = 10;
OAS_rn = '001234567890'; OAS_rns = '1234567890';
OAS_rn = new String (Math.random()); OAS_rns = OAS_rn.substring (2, 11);
function OAS_NORMAL(pos) {
	document.write('<A HREF="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '" TARGET=' + OAS_target + '>');
	document.write('<IMG SRC="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '" BORDER=0></A>');
}
OAS_version = 11;
if ((navigator.userAgent.indexOf('Mozilla/3') != -1) || (navigator.userAgent.indexOf('Mozilla/4.0 WebTV') != -1))
	OAS_version = 10;
if (OAS_version >= 11)
	document.write('<SCR' + 'IPT LANGUAGE=JavaScript1.1 SRC="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '"><\/SCRIPT>');
document.write('');
function OAS_AD(pos) {
	if (OAS_version >= 11)
		OAS_RICH(pos);
	else
		OAS_NORMAL(pos);
}




