var leftP = true;


function closeAll(){
	var i;
	for(i=1;i<6;i++){
		if(document.getElementById('menu'+i) != null){
		document.getElementById('menu'+i).style.visibility = "hidden";
		}
	}
}


function picSize() {
    return document.documentElement.clientWidth||document.body.clientWidth;
} 



function mousePageXY(e){
	var x = 0, y = 0;
	if (!e) e = window.event;
		if (e.pageX || e.pageY){
			x = e.pageX;
			//y = e.pageY;
		}else if (e.clientX || e.clientY){
			x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
			//y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
		}
	//return {"x":x, "y":y};
	return x;
}

document.onmousemove = function(e){
	var mCur = mousePageXY(e);
	//alert("mCur="+mCur);
	for(i=1;i<6;i++){
		 var widthM = picSize();
		if(mCur > (widthM/2)-415 &&  mCur < (widthM/2)+415){
		if(leftP){
			if(document.getElementById('menu'+i) != null){
			document.getElementById("menu"+i).style.left = (mCur-75)  + "px";
			document.getElementById("menu"+i).style.top = 287 + "px"
			}
		}
		}else if(mCur < (widthM/2)-415){
		if(leftP){
			if(document.getElementById('menu'+i) != null){
			document.getElementById("menu"+i).style.left = (widthM/2)-415 -75  + "px";
			document.getElementById("menu"+i).style.top = 287 + "px"
			}
		}
		}else if(mCur > (widthM/2)+415){
		if(leftP){
			if(document.getElementById('menu'+i) != null){
			document.getElementById("menu"+i).style.left = (widthM/2)+415 -75  + "px";
			document.getElementById("menu"+i).style.top = 287 + "px"
			}
		}
		}
		
		
	}
}

function ShowLayer(ttt){
	var i;
	document.getElementById(ttt).style.visibility = "visible";
	//alert(ttt+' on');
	for(i=1;i<6;i++){
		if('menu'+i != ttt){
			if(document.getElementById('menu'+i) != null){
			document.getElementById('menu'+i).style.visibility = "hidden";
			}
		}
	}
}


function onColor(ttt){
  var i;
  for(i=1;i<6;i++)
	if(document.getElementById('menu'+i) != null){
	document.getElementById(ttt).style.color = '#f1f1f1' 
	}
}

function offColor(ttt){
  var i;
  for(i=1;i<6;i++)
	if(document.getElementById('menu'+i) != null){
	document.getElementById(ttt).style.color = '#fe0000'
	}
}

	
	
