if (typeof(pushOnload)=="undefined"){
	function pushOnload(method){
		if (window.addEventListener){
			window.addEventListener("load",method,false);
		}else if (window.attachEvent){
			window.attachEvent("onload",method);
		}else if (document.getElementById){
			if (typeof(window.winonload)=="undefined"){
				window.winonload=new Array();
			}
			window.winonload[window.winonload.length]=method;
			window.onload=function(){
				for (var i=0;i<this.winonload.length;i++){
					this.winonload[i]();
				}
			}
		}
	}
}
function img(img,state){
	if (document.getElementById){
		if (document.getElementById(img)){
			img=document.getElementById(img);
			if (state && img.src.indexOf("off.")!=-1){
				img.src=img.src.substring(0,img.src.indexOf("off."))+"on.gif";
			}else if (!state && img.src.indexOf("on.")!=-1){
				img.src=img.src.substring(0,img.src.indexOf("on."))+"off.gif";
			}
		}
	}
	return false;
}
function gnavsearchsubmit(){
	if (document.getElementById("gnavsearchform")){
		document.getElementById("gnavsearchform").submit();
	}
}
var gnavactive;
function gnavtoggle(section,state){
	if (document.getElementById && gnavdims){
		if (typeof(state)=="undefined"){
			state=false;
		}
		if (!state && gnavactive!=null && (typeof(section)=="undefined" || typeof(section)=="object")){
			section=gnavactive;
			gnavactive=null;
		}
		if (state){
			if (gnavactive!=null && gnavactive!=section){
				gnavtoggle(gnavactive);
			}
			gnavactive=section;
		}
		return gnavsetstate(section,state);
	}
	return true;
}
function gnavsetstate(section,state){
	if (document.getElementById && gnavdims){
		if (document.getElementById("gnav"+section)){
			document.getElementById("gnav"+section).className=state?"on":"";
			if (document.getElementById("gnavtop")){
				document.getElementById("gnavtop").style.display=(state && document.getElementById("gnavsub"+section))?"none":"block";
			}
			if (document.getElementById("gnavsub"+section)){
				if (ismacie){
					if (state){
						document.getElementById("gnavsub"+section).style.display="block";
						document.getElementById("gnavsub"+section).style.visibility="visible";
						document.getElementById("gnavsub"+section).style.width=document.getElementById("gnavsub"+section).offsetWidth+"px";
					}else{
						document.getElementById("gnavsub"+section).style.visibility="hidden";
					}
				}else{
					document.getElementById("gnavsub"+section).style.display=state?"block":"none";
				}
			}
		}
	}
	return true;
}
var gnavdims;
function gnavcapturedims(){
	gnavdims={nav:null,sections:null};
	if (document.getElementById("globalbranding") && document.getElementById("gnav") && document.getElementById("gnavsections")){
		gnavdims.nav={left:document.getElementById("gnav").offsetLeft,
							right:document.getElementById("gnav").offsetLeft+document.getElementById("gnav").offsetWidth,
							top:document.getElementById("gnav").offsetTop,
							bottom:document.getElementById("gnav").offsetTop+document.getElementById("gnavsections").offsetTop+1};
		gnavdims.sections={left:document.getElementById("gnav").offsetLeft-2,
							right:document.getElementById("gnav").offsetLeft+document.getElementById("gnavsections").offsetWidth,
							top:document.getElementById("gnav").offsetTop,
							bottom:document.getElementById("gnav").offsetTop+document.getElementById("gnavsections").offsetTop+document.getElementById("gnavsections").offsetHeight+2};
		if (document.getElementById("globalbranding").offsetTop>document.getElementById("gnav").offsetTop){
			gnavdims.nav.top+=document.getElementById("globalbranding").offsetTop;
			gnavdims.nav.bottom+=document.getElementById("globalbranding").offsetTop;
			gnavdims.sections.top+=document.getElementById("globalbranding").offsetTop;
			gnavdims.sections.bottom+=document.getElementById("globalbranding").offsetTop;
		}
		if (document.getElementById("globalbranding").offsetLeft>0){
			if (navigator.userAgent.toLowerCase().indexOf("msie")!=-1){
				gnavdims.nav.left+=16;
				gnavdims.nav.right+=16;
				gnavdims.sections.left+=16;
				gnavdims.sections.right+=16;
				if (navigator.userAgent.toLowerCase().indexOf("msie 5")!=-1){
					gnavdims.nav.left+=document.getElementById("globalbranding").offsetLeft+document.body.scrollLeft;
					gnavdims.nav.right+=document.getElementById("globalbranding").offsetLeft+document.body.scrollLeft;
					gnavdims.sections.left+=document.getElementById("globalbranding").offsetLeft+document.body.scrollLeft;
					gnavdims.sections.right+=document.getElementById("globalbranding").offsetLeft+document.body.scrollLeft;
				}
			}
		}
	}
}
function gnavhover(e){
	e=e?e:event;
	if (typeof(gnavdims)!="undefined"){
		var eventClientX=e.clientX;
		var eventClientY=e.clientY;
		if (navigator.userAgent.toLowerCase().indexOf("safari")==-1){
			eventClientX+=(typeof(window.pageXOffset)!="undefined"?window.pageXOffset:document.body.scrollLeft);
			eventClientY+=(typeof(window.pageYOffset)!="undefined"?window.pageYOffset:document.body.scrollTop);
		}
		if ((eventClientX > gnavdims.nav.left && eventClientX < gnavdims.nav.right) && (eventClientY > gnavdims.nav.top && eventClientY < gnavdims.nav.bottom) ||
			(eventClientX > gnavdims.sections.left && eventClientX < gnavdims.sections.right) && (eventClientY > gnavdims.sections.top && eventClientY < gnavdims.sections.bottom)){
			return true;
		}else if (gnavactive!=null){
			gnavtoggle();
		}
	}
	return true;
}
var ismacie;
function gnavinit(){
	gnavcapturedims();
	ismacie=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1 && navigator.userAgent.toLowerCase().indexOf("mac")!=-1);
	if (document.getElementById("gnav")){
		if (document.getElementById("gnav").addEventListener){
			document.getElementById("gnav").addEventListener("mouseover",gnavhover,false);
			document.body.addEventListener("mousemove",gnavhover,false);
		}else{
			document.getElementById("gnav").onmouseover=gnavhover;
			document.body.onmousemove=gnavhover;
		}
	}
}
pushOnload(gnavinit);
