/* ===================================================== */
/* ======        JNID Global JavaScript          ======= */
/* ======          Version A09.07.11             ======= */
/* ===================================================== */

/* ================================================================================================================= */
/* ==== navbar functions ============================= */
function toggleSubNav(divID) {
	for (var i = nav_mainSum - 1; i >= 0; i--){ document.getElementById('navSub'+i).style.display = "none"; }
	document.getElementById(divID).style.display = "block";
}
var navMainZ_top = 7;
function setNavMainZ(divID, thisZ) {
	// if mouse-over: increment the z-index of the top-most main nav button and then apply it
	// (this ensures that the mouse-over main nav button always appears with the highest z-index
	if (thisZ >= 7) {
		navMainZ_top++;
		thisZ = navMainZ_top;
	}
	document.getElementById(divID + "_img").style.zIndex = thisZ;
	document.getElementById(divID + "_link").style.zIndex = thisZ + 1;
}
function setNavbar() {
	// set the sub navbar
	toggleSubNav(nav_subHere);
	// set the z-indices for each main nav buttons
	if (document.getElementById('navMain0')) { setNavMainZ('navMain0', 5); }
	if (document.getElementById('navMain1')) { setNavMainZ('navMain1', 4); }
	if (document.getElementById('navMain2')) { setNavMainZ('navMain2', 3); }
	if (document.getElementById('navMain3')) { setNavMainZ('navMain3', 2); }
	// set the z-index for the current main nav button
	setNavMainZ(nav_mainHere, 6);
}
/* ================================================================================================================= */
/* ==== Toggle Display of Element ================================================================================== */
function toggleDisplay(id){
	if(document.getElementById(id).style.display == 'none'){
		  document.getElementById(id).style.display = 'block';
	}else{
		  document.getElementById(id).style.display = 'none';
	}
}
/* ================================================================================================================= */
/* ==== AJAX  ================================================================================================ */
function GetXmlHttpObject() {
	
	// code for IE7+, Firefox, Chrome, Opera, Safari
	if (window.XMLHttpRequest) { return new XMLHttpRequest(); }
	// code for IE6, IE5
	if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); }
	
	return null;
}
/* ================================================================================================================= */
/* ==== Browser Compatibility Checker ============================================================================== */
if (!document.cookie){
	document.cookie = 'browseralert=true;';	
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (ieversion<8) {
		var upgrade = confirm("You're using an old version of Internet Explorer that might not display this website properly."+"\n\n"+"Press OK to visit the Microsoft website and upgrade to a newer version, or press cancel to view this website.")
		if (upgrade){
			window.location = "http://www.microsoft.com/windows/internet-explorer/";
			}
		}
	} else if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox x.x;
	 var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (ffversion<3) {
		var upgrade = confirm("You're using an old version of Firefox that might not display this website properly."+"\n\n"+"Press OK to visit the Mozilla website and upgrade to a newer version, or press cancel to view this website.")
		if (upgrade){
			window.location = "http://www.mozilla.com/en-US/";
			}
		}
	} else if (/Chrome[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox x.x;
	 var chromeversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (chromeversion<2) {
		var upgrade = confirm("You're using an old version of Google Chrome that might not display this website properly."+"\n\n"+"Press OK to visit the Microsoft website and upgrade to a newer version, or press cancel to view this website.")
		if (upgrade){
			window.location = "http://www.google.com/chrome";
			}
		}
	} else { alert("You're using a browser that is not tested to display this website properly.  We recommend using Internet Explorer, Mozilla Firefox, or Google Chrome when viewing this website.") }
}
/* ================================================================================================================= */
/* ==== Show/Hide Footers ========================================================================================== */
function showFooterBox(div,speed) {
	var i = -500;
	var timer = window.setInterval(function() {
		if (i < -1) {
			i /= speed;
			document.getElementById(div).style.bottom = i+"px";
		} else {
			document.getElementById(div).style.bottom = "0px";
			clearTimeout(timer); 
			}
		}, 70);
}
function hideFooterBox(div,speed) {
	var i = -1;
	var timer = window.setInterval(function() {
		if (i > -500) {
			i -= speed;
			speed *= .8;
			document.getElementById(div).style.bottom = i+"px";
		} else {
			document.getElementById(div).style.bottom = "-500px";
			clearTimeout(timer); 
			}
		}, 70);
}