//========================= standard rollover =========================function rollover(imgName, active) {	if (document.images && document.images[imgName]) {		active? document[imgName].src = self[imgName + '_on'].src : document[imgName].src = self[imgName + '_off'].src;	}}//========================= nav rollover =========================function rolloverNav(imgName, active) {	if (document.images && document.images[imgName]) {		active? document[imgName].src = nav_arrow_on.src : document[imgName].src = nav_arrow_off.src;	}}// ==================== interactive story photo rotation script ====================// using a cookie, loop through a different image associated with an interactive// story with each visit to the home pagefunction rotateInteractiveStory(MAX_PHOTOS) {    if (isNaN(num = getCookie('interactiveStory')) || num >= MAX_PHOTOS) num = 0;    num++;    setCookie('interactiveStory', (num % MAX_PHOTOS));    return num-1;}function rotatecarousel(MAX_DIVs) {    if (isNaN(num = getCookie('carouselIndex')) || num >= MAX_DIVs) num = 0;    num++;    setCookie('carouselIndex', (num % MAX_DIVs));    return num-1;}function setCookie(name, value) {	var date = new Date();	var exp = date.getTime() + (90 * 60 * 60 * 1000);	// expires in 90 days	date.setTime(exp);	document.cookie = name + "=" + value + "; expires=" + date.toGMTString();}function getCookie(name) {	name = name + '=';			// MacIE includes the equals sign	var nameLen = name.length;	var cookie = document.cookie;    var cookieLen = cookie.length;	var end;	var start;	var i = 0;	while (i < cookieLen) {		start = i + nameLen;        if (cookie.substring(i, start) == name) {			end = cookie.indexOf(";", start);			if (end == -1) {				end = cookie.length;			}			return unescape(cookie.substring(start, end));		}		i = cookie.indexOf(" ", i) + 1;		if (i == 0) break;	}	return ""	// cookie not found}// ==================== set left margin ==================== //// Content is centered in window using CSS, but if the window is smaller than the size of the content// the CSS will push the content too far left, causing it to partially disappear from the browser window.// This function resets the left margin if the browser window is too small to hold the content.function setLeft() {	if (document.body.clientWidth) { //MacIE, Safari, WinIE		if (document.body.clientWidth < 778) {			if (document.getElementById) {				document.getElementById('body').style.left = '388px';			} else if (document.all) {				document.all('body').style.left = '388px';			}		} else {			//alert(document.getElementById('body').style.left);			if (document.getElementById) {				document.getElementById('body').style.left = '50%';			} else if (document.all) {				document.all('body').style.left = '50%';			}		}	}}// ==================== pop-up window script ====================var popUpWin = null;function popUp(theURL,winName,features) {	popUpWin = window.open(theURL,winName,features);	if(popUpWin.focus) popUpWin.focus();}// ==================== photo essay script ====================//loops through the photo essay photos from 1 to var photos// var photos and var photoName are initialized on the calling pagefunction swap(img) {	for (var i = 1; i <= photos; ++i) {		var imgName = 'photoessay_' + photoName + '_' + i;		document.images[imgName].src = self[imgName + '_' + img].src;	}}function openPrintFriendly(url) {	tempUrl = url;	winLeft = (screen.width) ? (screen.width-500)/2 : 0;    winTop = (screen.height) ? (screen.height-500)/2 : 0;    var params = "location=no,menubar=yes,resizable=yes,scrollbars=yes,status=no,toolbar=yes,directories=no,width=650,height=500,top=" + winTop + ",left=" + winLeft;    if (url.indexOf(".jhtml") > -1) {        url = "/common/getprintfriendly.jsp?resource="+url;    } else {    if (url.indexOf("#")>-1) url = url.substring(0,url.indexOf("#"));    if (url.indexOf("?")>-1) url += "&print=true";    else url += "?print=true";    }	url+="&referer="+escape(tempUrl);	popUpWin = window.open(url,"PFpanel",params);}function openEmailFriend(url, title) {    winLeft = (screen.width) ? (screen.width-500)/2 : 0;    winTop = (screen.height) ? (screen.height-500)/2 : 0;    var params = "location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,directories=no,width=600,height=400,top=" + winTop + ",left=" + winLeft;    if (url.indexOf("#")>-1) url = url.substring(0,url.indexOf("#"));    var urlParams = "?emailLink="+escape(url)+"&title="+title;	popUpWin = window.open("http://www.hispanichealth.org/js/emailAFriend.jsp"+urlParams,"EAFpanel",params);}String.prototype.endsWith = function(test) {    return (this.indexOf(test) > -1 && (this.indexOf(test) + test.length) == this.length);}String.prototype.atLocation = function(test) {    return (this.indexOf(test) > -1 && this.endsWith(test)) || (this + "/").indexOf(test) > 01;}// <![CDATA[//==================== create rollover menus ====================//var OFFSETLEFT = 0;var OFFSETTOP = 0;var LENGTHOFFSET = 3var WIDTH = 172;var MENU6OFFSET = -77;//========== trap for NS4 ==========//if (document.layers) {    OFFSETTOP += 20;    LENGTHOFFSET += 20;    MENU6OFFSET = -77;}//========== trap for Win IE ==========//if (document.all && !window.opera) {    OFFSETTOP += 1;}//========== trap for Win IE5 ==========//if (document.all && !document.fireEvent && document.mimeType && !window.opera) {    LENGTHOFFSET += 31;}//========== trap for Win IE5x ==========//if (document.all && !document.createComment) {    MENU6OFFSET = -77;}//========== trap for Mac IE5 ==========//if (navigator.userAgent.indexOf('Mac') != -1 && navigator.userAgent.indexOf('MSIE') != -1) {    OFFSETTOP += -1;    LENGTHOFFSET += 20;}//========== trap for Safari ==========//if (navigator.userAgent.toLowerCase().indexOf('safari') != -1) {    LENGTHOFFSET += 25;}function openiWindow(url, parameters, newWindow) {    //LeftPosition = (screen.width) ? (screen.width-700)/2 : 0;    //TopPosition = (screen.height) ? (screen.height-500)/2 : 0;    //settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll;    if(newWindow) windowname = newWindow;    else windowname = "interactives";    win = window.open(url, windowname, parameters);    if (win.window.focus) {        win.window.focus();    }}// external_script.jsfunction embedFlash(movie, id, width, height, bgcolor, flashvars, base, quality, wmode, menu){    if(!quality) quality="high";    if(!wmode) wmode="opaque";    if(!menu) menu="false";    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="' + id + '" align="middle">');    document.write('<param name="allowScriptAccess" value="sameDomain" />');    document.write('<param name="movie" value="' + movie + '" />');    document.write('<param name="quality" value="' + quality + '" />');    document.write('<param name="bgcolor" value="' + bgcolor + '" />');    document.write('<param name="wmode" value="' + wmode + '">');    document.write('<param name="menu" value="' + menu + '" />');    if(flashvars) document.write('<param name="flashvars" value="' + flashvars + '" />');    if(base) document.write('<param name="base" value="' + base + '">');    document.write('<embed src="' + movie + '"' + ((flashvars)?' flashVars="' + flashvars + '"':'') + ' quality="' + quality + '" bgcolor="' + bgcolor + '" wmode="' + wmode + '" width="' + width + '" height="' + height + '" name="' + id + '"' + ((base)?' base="' + base + '"':"") + ' align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');    document.write('</object>');}// Removes website from being embedded on any frames based website    if (window.self != window.top) {		//top.location.replace(window.location.pathname);	}// ]]>
