function onTopMenu(id){
	document.getElementById('top'+id).className='sel';
	if(document.getElementById('topSub'+id))document.getElementById('topSub'+id).style.display='block';
}
function offTopMenu(id,c){
	document.getElementById('top'+id).className=c;
	if(document.getElementById('topSub'+id))document.getElementById('topSub'+id).style.display='none';
}
var screenWidth=980,screenHeight=400;
function getScreenSize(){
	if(typeof(window.innerWidth)=='number'){
		//Non-IE
		//screenWidth=window.innerWidth;
		var d=document.getElementById("dummy-width");
		screenWidth=d.offsetWidth;
		screenHeight=window.innerHeight;
	}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		screenWidth=document.documentElement.clientWidth;
		screenHeight=document.documentElement.clientHeight;
	}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)) {
		//IE 4 compatible
		screenWidth=document.body.clientWidth;
		screenHeight=document.body.clientHeight;
	}
}
function onReadyInternalPage(){
	if(!(document.getElementById("leftMenu")!=undefined&&readCookie("isLeftMenuHidden")==1)){
		onWindowResize();
	}
	window.onresize=onWindowResize;
}
function onOver(e){
	var d=null;
	if(e.target)d=e.currentTarget;
	else d=e.srcElement;
	d=d.parentNode.parentNode.parentNode;
	if(d.className.indexOf("menuBtnGlowSel")!=-1)d.className="menuBtnGlowOver menuBtnGlowSel";
	else d.className="menuBtnGlowOver";
}
function onOut(e){
	var d=null;
	if(e.target)d=e.currentTarget;
	else d=e.srcElement;
	d=d.parentNode.parentNode.parentNode;
	if(d.className.indexOf("menuBtnGlowSel")!=-1)d.className="menuBtnGlowSel";
	else d.className="menuBtnGlow";
}
function onWindowResize(){
	getScreenSize();
	//place background and top menu:
	var l=document.getElementById("left");
	var d=document.body;
	var t=document.getElementById("bg-top");
	var bpOffset=0;
	if(l.style.width=="1%"){
		var bgX=-714+screenWidth*.15;
		d.style.backgroundPosition=bgX.toString()+" top";
		t.style.left="15%";
		t.style.width="85%";
		bpOffset=714-screenWidth*.15;
	}
	else{
		if(screenWidth>=1586){
			d.style.backgroundPosition="top left";
			t.style.left=714;
			var w=screenWidth-714;
			t.style.width=w.toString();
			bpOffset=0;
		}
		else{
			var bgX=-714+screenWidth*.45;
			d.style.backgroundPosition=bgX.toString()+" top";
			t.style.left="45%";
			t.style.width="55%";
			bpOffset=714-screenWidth*.45;
		}
	}
	t.style.visibility="visible";
	for(i=1;i<=5;i++){
		var m=document.getElementById("menu"+i);
		var x=screenWidth-screenWidth*.05-131*(6-i);
		m.style.left=x;
		var bp=screenWidth-screenWidth*.05-131*(6-i)+bpOffset;
		document.getElementById("out").innerHTML=bpOffset;
		if(x+bpOffset>1397){
			bp-=683;
		}
		m.style.backgroundPosition="-"+bp.toString()+" 0";
		m.style.display="block";
		m=document.getElementById("menu-img"+i);
		if(m.addEventListener){
			m.addEventListener("mouseover",onOver,false);
			m.addEventListener("mouseout",onOut,false);
		}
		else {
			m.attachEvent("onmouseover",onOver);
			m.attachEvent("onmouseout",onOut);
		}
	}
	var l=document.getElementById("menu-left");
	var x=screenWidth-screenWidth*.05-131*5-16;
	l.style.left=x;
	l.style.display="block";
	var r=document.getElementById("menu-right");
	x=screenWidth-screenWidth*.05;
	r.style.left=x;
	r.style.display="block";

	// make layout visible:
	document.getElementById("layout").style.visibility="visible";
	
	// place left menu:
	var m=document.getElementById("leftMenu");
	if(!m)return;
	if(screenHeight>400)m.style.height=screenHeight-220;
	else m.style.height=180;
}

onReadys.push(onReadyInternalPage);

