if(window.attachEvent){
 window.attachEvent("onload",init);
}
if(window.addEventListener){
 window.addEventListener("load",init,false);
}
function init(){
	document.onmousedown = function(){
		if(document.getElementById("search_menu").rel=="on") 
			document.getElementById("search_menu").style.display = "none";
		hideup();
	}
}
function displaySubMenu() {
	if(document.getElementById("search_menu").style.display == "block")
	{
		document.getElementById("search_menu").style.display = "none";
	}else{
		document.getElementById("search_menu").style.display = "block";    
	}
	hidedown();
}

function changeSearchType(x)
{
	document.getElementById("search_form").stype.value=x.toLowerCase();
	document.getElementById("search_menu_text").innerHTML=x;
	document.getElementById("search_menu").style.display = "none";
	hideup();
}
function displaySubMenu2()
{
	document.getElementById("search_menu").style.display = "block";
}
function hideSubMenu() {
	setTimeout("hideSubMenu3();",500);             
}

function hideSubMenu3()
{	
	document.getElementById("search_menu").style.display = "none";
}

function dosubmit(){
	if(document.getElementById("search_form").keyword.value=='')
		document.getElementById("search_form").keyword.value = 'Search Games';
	document.search_form.submit();
}

function hidedown(){
	document.getElementById("down").style.display = "none";
	document.getElementById("up").style.display = "block";
}
function hideup(){
	document.getElementById("down").style.display = "block";
	document.getElementById("up").style.display = "none";
}