
document.write('<script src="global/_js_source/events.js" type="text/javascript"></script>');
document.write('<script src="global/_js_source/swfobject.js" type="text/javascript"></script>');
document.write('<link href="global/_css_source/app_nav_noscript.css" rel="stylesheet" type="text/css">');

document.write('<script type="text/javascript" src="global/_js_source/prototype.js"></script>');
document.write('<script type="text/javascript" src="global/_js_source/scriptaculous.js?load=effects,builder"></script>');
document.write('<script type="text/javascript" src="global/_js_source/lightbox.js"></script>');
document.write('<link href="global/_css_source/lightbox.css" rel="stylesheet" type="text/css" media="screen">');
document.write('<script src="global/_js_source/mdawin.js" type="text/javascript"></script>');


function showActiveNav(){	
var strCurrentElementID = document.getElementsByTagName("body")[0].id.replace(/page/i, "nav")
var arrActiveElementIDs = new Array();
var count=0;

if(document.getElementById(strCurrentElementID)!=null){
	while (strCurrentElementID != 'nav')
	{
		if (document.getElementById(strCurrentElementID).nodeName == "LI") {
			arrActiveElementIDs[count] = strCurrentElementID;
			document.getElementById(strCurrentElementID).className='activeListItem'
			count++;
		}
		strCurrentElementID = document.getElementById(strCurrentElementID).parentNode.id;
	}
	document.getElementById(arrActiveElementIDs[0]).getElementsByTagName("a")[0].className='activeLink';
	}
	if(arrActiveElementIDs.length>0)showActiveNavGlobal(arrActiveElementIDs);
}

function showActiveNavGlobal(arrActiveElementIDs){	
	var strGlobalPageId = arrActiveElementIDs[arrActiveElementIDs.length-1].replace(/nav/i, "page");
	document.getElementsByTagName("body")[0].className=strGlobalPageId;
}


/* --- FItcheck Form --- */

function showMsg(result){
	if(document.getElementById("formFitCheck"))document.getElementById("formFitCheck").style.display = 'none';
	if(document.getElementById("pageTopAnchor"))document.getElementById("pageTopAnchor").style.display = 'none';
	if(document.getElementById("msg" + result))document.getElementById("msg" + result).style.display = 'block';
}

function getQuestionCount(mylist){
	if(document.getElementById(mylist)){
	    var arrListItems = document.getElementById(mylist).getElementsByTagName("li");
	    return(arrListItems.length);
	}
}

function validate(myform){
	var count = 0;
	var score = 0;
	var elem = myform.elements;
	var intQuestionCount = getQuestionCount("formlist");
	for(var i = 0; i < elem.length; i++){
		if (elem[i].type=='radio'){
			if(elem[i].checked){
				score=score+parseInt(elem[i].value);
				count++;
			}
		}
	}
	if(count==intQuestionCount){
		if(score>1){
			showMsg("Pass");
		}else{
			showMsg("Fail");
		}
	}else{
		alert('please complete all questions');	
	}
	//alert('count:' + count + ' --- score:' + score);
	return false;
}

/* --- / FItcheck Form --- */


function emailObf(myElementID){
	if(document.getElementById){  
		addEvent2(document.getElementById(myElementID),"click", function(){doMail(document.getElementById(myElementID), 'REMOVETHISTEXT')});
	}
}

function doMail(theLink, key){

    //Get the HREF tag. This includes the anti-spam 'key'
    var before = theLink.getAttribute('href');

    //If the anti-spam key is not found in the link, exit the function without doing anything
    //If the link is clicked more than once, this prevents the Javascript from throwing an error
    if(before.indexOf(key) == -1) return false;

    //Our new variable "addy" is a combination of the text that
    //comes BEFORE the key [0] and AFTER the key [1]
    var addy = before.split(key)[0] + before.split(key)[1];

    //Substitute the original link with the new link ("addy")
    theLink.href = addy;

}

function clearSearch(myForm) {if (myForm.defaultValue==myForm.value) myForm.value = "";}
function showSearch(myForm) {if (myForm.value=="") myForm.value = myForm.defaultValue;}

function showSearchFormText(myElementID){
	if(document.getElementById){  
		addEvent2(document.getElementById(myElementID),"blur", function(){showSearch(document.getElementById(myElementID))});
		addEvent2(document.getElementById(myElementID),"focus", function(){clearSearch(document.getElementById(myElementID))});
	}
}

function addListClass(myElementID){
	if(document.getElementById){
		if(document.getElementById(myElementID)){
			arrListItems = document.getElementById(myElementID).getElementsByTagName("li");
			arrListItems[arrListItems.length-1].className='lastItem';
		}
	}
}


function getX(obj){
  if(document.layers){
  	//return eval(obj).x;
	return eval(obj).pageX;    // ************* x for image pos, pageX for layer pos
  } else {
  	return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
  }
}

function getY(obj) {
	if(document.layers){
  		//return eval(obj).y;    // ************* y for image pos, pageY for layer pos
		return eval(obj).pageY;
	} else {
  		return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
	}
}


function hideTopLink(){
	if(document.all) {
		if(document.all.contentBot){
		    if ((getY(document.all.contentBot)) < 610) document.all.contentBot.style.display = 'none';
		}	
	} else if(document.getElementById) {
		    if (document.getElementById("contentBot")){
		        if ((getY(document.getElementById("contentBot"))) < 610) document.getElementById("contentBot").style.display = 'none';
		    }
	}
	//alert(getY(document.getElementById("contentBot")));
}


