userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function findElement(n,ly) {
	if (browserVers < 4)		return document[n];
	var curDoc = ly ? ly.document : document;
	var elem = curDoc[n];
	if (!elem) {
		for (var i=0;i<curDoc.layers.length;i++) {
			elem = findElement(n,curDoc.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		var img;
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			img = null;
			if (document.layers) {
				img = findElement(changeImages.arguments[i],0);
			}
			else {
				img = document.images[changeImages.arguments[i]];
			}
			if (img) {
				img.src = changeImages.arguments[i+1];
			}
		}
	}
}

function preloadImages(sub) {
	var imgdir = '';
	if (sub) { imgdir = '../' }
	if (document.images) {
		home_nav_previous_over = newImage(imgdir+"images/home_nav_previous-over.gif");
		home_nav_next_over = newImage(imgdir+"images/home_nav_next-over.gif");
		home_nav_chal_submit_over = newImage(imgdir+"images/home_nav_chal_submit-over.gif");
		home_nav_learnmore_over = newImage(imgdir+"images/home_nav_learnmore-over.gif");
		home_nav_readmore_over = newImage(imgdir+"images/home_nav_readmore-over.gif");
		yourlife_addec_return_over = newImage(imgdir+"images/yourlife_addec_return-over.gif");
		yourlife_addecoder_play_1_over = newImage(imgdir+"images/yourlife_addecoder_play_1-over.gif");
		yourlife_addecoder_play_2_over = newImage(imgdir+"images/yourlife_addecoder_play_2-over.gif");
		yourlife_menu_learnmore_over = newImage(imgdir+"images/yourlife_menu_learnmore-over.gif");
		preloadFlag = true;
	}
}

function correctPNG() {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<div " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></div>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
}

function fixPNG(myImage) {
	if (window.ie55up) {
		var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
		var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
		var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' "
		var imgStyle = "display:inline-block;" + myImage.style.cssText 
		var strNewHTML = "<span " + imgID + imgClass + imgTitle
		strNewHTML += " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";"
		strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		strNewHTML += "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>" 
		myImage.outerHTML = strNewHTML
	 }
}


function getValue(varname) {

	var url = window.location.href;
	var qparts = url.split("?");
	if (qparts.length == 0) { return ""; }
	var query = qparts[1];
	var value = "";
	if (query != null) {
		var vars = query.split("&");

		for (i=0;i<vars.length;i++) {
			var parts = vars[i].split("=");
			if (parts[0] == varname) {
				value = parts[1];
				break;
			}
		}
  
		value = unescape(value);
		value.replace(/\+/g," ");
	}
	return value;

}

function getObj(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

function invi(flag,ID) {
	if (!DHTML) return;
	var x = new getObj(ID);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
	if (flag) {
		if(document.getElementById("Pop1")) {
			Pop1.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop2")) {
			Pop2.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop3")) {
			Pop3.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop4")) {
			Pop4.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop5")) {
			Pop5.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop6")) {
			Pop6.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop7")) {
			Pop7.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop8")) {
			Pop8.style.visibility = 'hidden';
		}
		if(document.getElementById("Pop9")) {
			Pop9.style.visibility = 'hidden';
		}
	}
}

//function invis(flag) {
//	if (!DHTML) return;
//	var x = new getObj('Pop1');
//	x.style.visibility = (flag) ? 'hidden' : 'visible'
//}

function JumpToUrl(selObj) { 
	eval("this.location='"+selObj.options[selObj.selectedIndex].value+"'");
}

function IncCDCHeader(sub) {
	var imgdir = '';
	if (sub) { imgdir = '../' }
	document.write('			<table width="770" cellspacing="0" cellpadding="0" border="0">');
	document.write('				<tr>');
	document.write('					<td class="cdc_bgglobalNav"><img src="'+imgdir+'images_cdc/s.gif" height="4" width="1" border="0" alt=" " /></td>');
	document.write('				</tr>');
	document.write('				<tr>');
	document.write('					<td class="cdc_bgglobalNav" nowrap="nowrap">');
	document.write('					<table border="0" cellpadding="0" cellspacing="0">');
	document.write('						<tr>');
	document.write('							<td class="cdc_txtglobalNav" align="center" width="12">&nbsp;</td>');
	document.write('							<td class="cdc_txtglobalNav" align="center">');
	document.write('								<a href="http://www.cdc.gov/page.do/id/0900f3ec80112422" class="cdc_globalNavLink" style="white-space: nowrap">CDC</a></td>');
	document.write('							<td class="cdc_txtglobalNav" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtglobalNav" align="center">');
	document.write('								<a href="http://www.cdc.gov/aboutcdc.htm" class="cdc_globalNavLink" style="white-space: nowrap">About CDC</a></td>');
	document.write('							<td class="cdc_txtglobalNav" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtglobalNav" align="center">');
	document.write('								<a href="http://www.cdc.gov/od/oc/media/" class="cdc_globalNavLink" style="white-space: nowrap">Press Room</a></td>');
	document.write('							<td class="cdc_txtglobalNav" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtglobalNav" align="center">');
	document.write('								<a href="http://www.cdc.gov/az.do" class="cdc_globalNavLink" style="white-space: nowrap">Topics A-Z</a></td>');
	document.write('							<td class="cdc_txtglobalNav" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtglobalNav" align="center">');
	document.write('								<a href="http://www.cdc.gov/doc.do/id/0900f3ec80093d70" class="cdc_globalNavLink">Contact Us</a></td>');
	document.write('						</tr>');
	document.write('					</table>');
	document.write('					</td>');
	document.write('				</tr>');
	document.write('				<tr>');
	document.write('					<td class="cdc_bgglobalNav"><img src="'+imgdir+'images_cdc/s.gif" height="6" width="1" border="0" alt=" " /></td>');
	document.write('				</tr>');
	document.write('			</table>');
	document.write('			<table width="770" border="0" cellspacing="0" cellpadding="0">');
	document.write('				<tr>');
	document.write('					<td class="cdc_bgHdr"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="1" border="0" alt=" " /></td>');
	document.write('					<td class="cdc_bgHdr">');
	document.write('						<a href="http://www.cdc.gov/"><img src="'+imgdir+'images_cdc/logo.gif" height="55" width="541" border="0" vspace="8" alt="CDC Centers for Disease Control and Prevention" /></a></td>');
	document.write('					<td class="cdc_bgHdr"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="2" border="0" alt=" " /></td>');
	document.write('					<td class="cdc_bgHdr" valign="top">');
	document.write('					<table border="0" cellpadding="0" cellspacing="0">');
	document.write('						<tr>');
	document.write('							<td align="right"><img src="'+imgdir+'images_cdc/hr_search.gif" height="1" width="189" border="0" vspace="7" alt="Search" /></td>');
	document.write('						</tr>');
	document.write('						<tr>');
	document.write('							<td class="cdc_txtglobalHdr" align="right">');
	document.write('							<form name="searchForm" method="get" action="http://www.cdc.gov/search.do">');
	document.write('							<input type="hidden" name="action" value="search">');
    document.write('							<input type="hidden" name="subset" value="bam">');
	document.write('									Search:&nbsp;<input type="text" name="queryText" maxlength="160" size="13" value="" />&nbsp; ');
	document.write('									<input type="image" name="" src="'+imgdir+'images_cdc/btn_Go.gif" class="cdc_searchButton" alt="Go" />  ');
	document.write('							</form>');
	document.write('							</td>');
	document.write('						</tr>');
	document.write('					</table>');
	document.write('					</td>');
	document.write('					<td class="cdc_bgHdr"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="9" border="0" alt=" " /></td>');
	document.write('				</tr>');
	document.write('			</table>');
}

function IncFooter(sub) {
	var imgdir = '';
	if (sub) { imgdir = '../' }
	document.write('		    <table width="770" border="0" cellpadding="0" cellspacing="0">');
	document.write('		        <tr>');
	document.write('					<td><img src="'+imgdir+'images_cdc/s.gif" height="20" width="1" border="0" alt=" " /></td>');
	document.write('		        </tr>');
	document.write('		        <tr>');
	document.write('					<td class="cdc_ftrBar"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="760" border="0" alt=" " /></td>');
	document.write('		        </tr>');
	document.write('		        <tr>');
	document.write('					<td class="cdc_bgftrTop"><img src="'+imgdir+'images_cdc/s.gif" height="3" width="1" border="0" alt=" " /></td>');
	document.write('		        </tr>');
	document.write('		        <tr>');
	document.write('					<td class="cdc_bgftrTop" align="left">');
	document.write('					<table border="0" cellpadding="0" cellspacing="0">');
	document.write('						<tr>');
	document.write('							<td class="cdc_txtFtr" align="center" width="12">&nbsp;</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/page.do/id/0900f3ec80112422" class="cdc_txtftrLink">CDC</a></td>');
	document.write('							<td class="cdc_txtFtr" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/doc.do/id/0900f3ec800cb856" class="cdc_txtftrLink">Policies and Regulations</a></td>');
	document.write('							<td class="cdc_txtFtr" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/disclaimer.htm" class="cdc_txtftrLink">Disclaimer</a></td>');
	document.write('							<td class="cdc_txtFtr" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/doc.do/id/0900f3ec801153ff" class="cdc_txtftrLink">e-Government</a></td>');
	document.write('							<td class="cdc_txtFtr" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/od/foia/foi.htm" class="cdc_txtftrLink">FOIA</a></td>');
	document.write('							<td class="cdc_txtFtr" align="center" width="20">|</td>');
	document.write('							<td class="cdc_txtFtr" align="center">');
	document.write('								<a href="http://www.cdc.gov/doc.do/id/0900f3ec80093d70" class="cdc_txtftrLink">Contact Us</a></td>');
	document.write('						</tr>');
	document.write('					</table>');
	document.write('					</td>');
	document.write('		        </tr>');
	document.write('		        <tr> ');
	document.write('					<td class="cdc_bgftrTop"><img src="'+imgdir+'images_cdc/s.gif" height="3" width="1" border="0" alt=" " /></td>');
	document.write('		        </tr>');
	document.write('		        <tr>');
	document.write('					<td class="cdc_ftrBar"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="760" border="0" alt=" " /></td>');
	document.write('		        </tr>');
	document.write('		        <tr>');
	document.write('					<td valign="top" class="cdc_bgftrBottom">');
	document.write('					<table border="0" cellpadding="0" cellspacing="0">');
	document.write('						<tr>');
	document.write('							<td class="cdc_bgftrBottom"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="12" border="0" alt=" " /></td>');
	document.write('							<td class="cdc_bgftrBottom"><img src="'+imgdir+'images_cdc/ftr_SaferHealthier.gif" height="7" width="150" border="0" alt="Safer, Healthier People" /><br /><img src="'+imgdir+'images_cdc/s.gif" height="5" width="1" border="0" alt=" " /><br /><span ');
	document.write('								class="cdc_txtftrBottom">Centers for Disease Control and Prevention, 1600 Clifton Rd, Atlanta, GA 30333, U.S.A<br />');
	document.write('								Tel: (404) 639-3311 / Public Inquiries: (404) 639-3534 / (800) 311-3435</span></td>');
	document.write('							<td class="cdc_bgftrBottom"><img src="'+imgdir+'images_cdc/s.gif" height="1" width="20" border="0" alt=" " /></td>	');
	document.write('							<td class="cdc_bgftrBottom" align="right" valign="middle"><a href="http://firstgov.gov/"><img src="'+imgdir+'images_cdc/logo_FirstGov.gif" height="52" width="147" border="0" alt="FirstGov" /></a><a href="http://www.hhs.gov/"><img src="'+imgdir+'images_cdc/logo_dhhs.gif" height="52" width="58" border="0" alt="DHHS" /></a></td>');
	document.write('							<td class="cdc_bgftrBottom"><span class="cdc_txtFtr"><a class="cdc_txtftrLink" href="http://www.hhs.gov/">Department of Health<br />and Human Services</a></span></td>');
	document.write('						</tr>');
	document.write('					</table>');
	document.write('					</td>');
	document.write('		        </tr>');
	document.write('		    </table>');
	document.write('		<div style="position: absolute; text-align: right; width: 765px; top:2px;">');
	document.write('			<div class="bodyTextWhiteBold">');
	document.write('			<a href="'+imgdir+'index.html" class="white">BAM! Home</a> | <a href="'+imgdir+'site_privacy.html" class="white">Privacy Policy</a> | <a href="'+imgdir+'site_contact.html" class="white">Contact Us</a> | <a href="'+imgdir+'site_terms.html" class="white">About BAM!</a> | <a href="'+imgdir+'site_map.html" class="white">Site Map</a>');
	document.write('			</div>');
	document.write('		</div>');

}

function displayMenu(sub,section,hook) {
	var imgdir = '';
	if (sub) { imgdir = '../' }
	var addhook = '';
	if (hook) { addhook = '&hook=1' }
	if ((navigator.appName == "Microsoft Internet Explorer" &&
    navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) ||

    (navigator.plugins && navigator.plugins["Shockwave Flash"])
                       || navigator.plugins["Shockwave Flash 2.0"]) {

		document.write('	<img src="'+imgdir+'images/spacer.gif" width="467" height="110" alt=" " />');
		document.write('	<div style="position: absolute; left: 0px; top: -40px;">');
		document.write('		<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
		document.write('			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
		document.write('			width="770" height="150" id="menu" align="top">');
		document.write(' 			<param name="movie" value="'+imgdir+'images/menu.swf" />');
		document.write(' 			<param name="FlashVars" value="section='+section+addhook+'" />');
		document.write(' 			<param name="quality" value="high" />');
		document.write(' 			<param name="scale" value="exactfit" />');
		document.write(' 			<param name="wmode" value="transparent" />');
		document.write(' 			<param name="bgcolor" value="#FFFFFF" /> ');
		document.write(' 			<embed src="'+imgdir+'images/menu.swf"');
		document.write(' 				FlashVars="section='+section+addhook+'"');
		document.write(' 				quality="high" scale="exactfit"');
		document.write(' 				wmode="transparent" bgcolor="#FFFFFF"');
		document.write(' 				width="770"');
		document.write(' 				height="150"');
		document.write(' 				name="menu"');
		document.write(' 				align=""');
		document.write('				type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
		document.write('			</embed>');
		document.write('		</object>');
		document.write('	</div>');

	} else {

		document.write('	<img src="'+imgdir+'images/menu_'+section+'.gif" width="770" height="110" usemap="#menu" border="0" />');
		document.write('	<map name="menu">');
		document.write('		<area coords="681,49,756,149" href="'+imgdir+'sub_yourbody/index.html">');
		document.write('		<area coords="9,41,218,146" href="'+imgdir+'index.html">');
		document.write('		<area coords="600,39,677,148" href="'+imgdir+'sub_yourlife/index.html">');
		document.write('		<area coords="521,49,598,148" href="'+imgdir+'sub_yoursafety/index.html">');
		document.write('		<area coords="418,38,515,148" href="'+imgdir+'sub_physicalactivity/index.html">');
		document.write('		<area coords="313,45,410,148" href="'+imgdir+'sub_foodnutrition/index.html">');
		document.write('		<area coords="224,46,309,147" href="'+imgdir+'sub_diseases/index.html">');
		document.write('	</map>');

	}
}

function InsertCSS(sub) {

	var imgdir = '';
	if (sub) { imgdir = '../' }

	if (prnt == 1) {
		document.write('<link rel="stylesheet" type="text/css" href="'+imgdir+'css/print.css" />');
	} else {
		document.write('<link rel="stylesheet" type="text/css" media="all" href="'+imgdir+'css/style.css" />');
		document.write('<link rel="stylesheet" type="text/css" media="print" href="'+imgdir+'css/print.css" />');
	}

	temp = window.name;
	if (temp == "ActivityCardFrame") {
		document.write('');
		document.write('<style type="text/css">');
		document.write('#ACardMenu1 {display: none; }');
		document.write('#CDCHeader { display: none; }');
		document.write('#CDCFooter { display: none; }');
		document.write('#MainMenu { display: none; }');
		document.write('#SectionMenu { display: none; }');
		document.write('#NavReturn { display: none; }');
		document.write('#NavBG { display: none; }');
		document.write('</style>');
	}

}

function InsertCSS2(sub) {

	var imgdir = '';
	if (sub) { imgdir = '../' }

	if (prnt == 1) {
		document.write('<link rel="stylesheet" type="text/css" href="'+imgdir+'css/print.css" />');
	} else {
		document.write('<link rel="stylesheet" type="text/css" href="'+imgdir+'css/style_reformat.css" />');
	}

}

function CheckWindowMod(sub) {
	temp = window.name;
	if (temp == "ActivityCardFrame") {
		document.write('');
		document.write('<style>');
		document.write('#ACardMenu1 {display: none; }');
		document.write('#CDCHeader { display: none; }');
		document.write('#CDCFooter { display: none; }');
		document.write('#MainMenu { display: none; }');
		document.write('#SectionMenu { display: none; }');
		document.write('#NavReturn { display: none; }');
		document.write('#NavBG { display: none; }');
		document.write('</style>');
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow2(theURL) { 
	window.open(theURL,'Popup','toolbar=0,location=0,status=0,menubar=1,scrollbars=1,screenX=0,screenY=0,left=0,top=0,resizable=0,width=640,height=515');
}

function MM_openBrWindow3(theURL) { 
	window.open(theURL,'Popup','toolbar=0,location=0,status=0,menubar=1,scrollbars=1,screenX=10,screenY=10,left=10,top=10,resizable=0,width=540,height=450');
}

//Popup window for non-governmental web sites
function externalLink (url,dirLevel) {

	var newURL = "";

	newURL = "../leaveWarn.html?urlStr=" + url;
	window.open (newURL,'Message','location=0,toolbar=0,menubar=0,width=320,height=270,scrollbars=1,resizable=0,screenX=240,screenY=180,left=250,top=185');
}

if (navigator.appName == "Microsoft Internet Explorer") {
	if (window.attachEvent) {
		window.attachEvent("onload", correctPNG);
	}
}

var preloadFlag = false;

var DHTML = (document.getElementById || document.all || document.layers);

var prnt = getValue("print");

