var menuImgOut=new Array();
var menuImgOvr=new Array();

function preloadMenu(lang,sel){
	if(!document.images) return true;
	var type,btn;
	for(i=0;i<4;i++){
		type=(sel==i)?'sel':'out';
		menuImgOut[i]=new Image();
		menuImgOut[i].src='/i/menu/'+lang+'/btn'+i+'_'+type+'.png';
		menuImgOvr[i]=new Image();
		menuImgOvr[i].src='/i/menu/'+lang+'/btn'+i+'_ovr.png';
		btn=document.getElementById('menu_btn'+i);
		btn.setAttribute("onmouseover","roMenu("+i+",true)");
		btn.setAttribute("onmouseout","roMenu("+i+",false)");
	}
}

function roMenu(n,ovr){
	if(!document.images) return true;
	document.getElementById('menu_btn'+n).src=(ovr)?menuImgOvr[n].src:menuImgOut[n].src;
}

function resizeHeader(){
	if(!document.getElementById('header')) return true;
	var w;
	if(document.body.clientWidth) w=document.body.clientWidth;
	else if(document.body.offsetWidth) w=document.body.offsetWidth;
	else if(document.width) w=document.width;
	else return true;
	document.getElementById('header').style.width=(w-100)+'px';
}

window.onresize=resizeHeader;

function credits(show,flash){
	if(!document.getElementById('credits')) return true;
	var display_credits=show?'block':'none';
	var display_flash=show?'none':'block';
	if(flash.length>0){
		flash=flash.split(',');
		for(i=0;i<flash.length;i++){
			if(document.getElementById(flash[i])) document.getElementById(flash[i]).style.display=display_flash;
		}
	}
	document.getElementById('credits').style.display=display_credits;
}
