var isSetTimerOut = null;
function getScrollX() {
	if (window.innerHeight) {
		// NS & Mozila
		return window.pageXOffset;
	} else {
		// IE & Opera
		return document.body.scrollLeft;
	}
}

function getWindowWidth(){
   	if (window.innerHeight) {
		// NS & Mozila
		return window.innerWidth-17
		;
	} else {
		// IE & Opera
		return document.body.clientWidth; 
	}
}

function ShowMenu(){
 var popPosX;
 var pos = getLayer("popupMenu");
 var leftMark = getLayer("leftMark");
 popPosX = getScrollX()+getWindowWidth()-getWidth(pos);
 moveLayerTo(pos, popPosX,17);
 showLayer(pos);
};

function onPopupAOver(){
  ShowMenu();
  isSetTimerOut = setTimeout("HideMenu()",1000); 
};

function onPopupDivOver () {
  if (isSetTimerOut) clearTimeout(isSetTimerOut);
}

function onPopupMainMenuOut(){
  if (isSetTimerOut) clearTimeout(isSetTimerOut);
  isSetTimerOut = setTimeout("HideMenu()",1000); 
};


function HideMenu(){
 var pos = getLayer("popupMenu");
 if (isVisible(pos)) {
	    moveLayerTo(pos, 0, 0);
 		hideLayer(pos);
 } 
};

function initPopupDivEvents () {
 var pos = getLayer("popupMenu");
 eval("pos.onmouseover=onPopupDivOver");
  eval("pos.onmouseout=onPopupMainMenuOut");
}




