window.onload = function(){
	if (document.images) {
		var myImages = new Array();
		for(i=0;i<=document.images.length;i++)
		{
			if(document.images[i]){
				//loop through all the images on the page
				//determine if the image ends with _btn_off.
				//preload the corresponding _btn_on image
				if(document.images[i].src.indexOf("_btn_off.")>-1)
				{	
					var newImg = new Image();
					newImg.src = document.images[i].src.replace("_btn_off.","_btn_on.");	
					myImages[myImages.length] = newImg;
				}
			}
		}
	}
}
function switchTo(objId,newSrc)
{
    if (document.images) {
	   var obj = document.getElementById(objId);
	   if(obj){
       	 obj.src = newSrc;
	   }
    }
}
//-------submenu scripts-------
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	}
	else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX;
		tempY = e.pageY;
	}  
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
	return true;
}
var menu = "off";
function showSubMenu(){
	menu = "on";
	var obj = document.getElementById("news_and_stuff_submenu");
	if(obj){			
		obj.style.left = (tempX-160)+"px";
		obj.style.top = "150px";
		obj.style.display="inline";
	}
}
function keepSubMenu(){
	menu = "on";
}	
function tryHideSubMenu(){
	menu = "hide";
	//if after 2 seconds menu state is still hide
	//then hide it, otherwise keep it open
	setTimeout("hideSubMenu()",2000);
}
function hideSubMenu(){
	if(menu=="hide"){
		var obj = document.getElementById("news_and_stuff_submenu");
		if(obj){
			obj.style.display="none";
		}
	}
}

