var menu_o={
submenuIsOver1:false,
submenuIsOver2:false,
categoryIsClick:false,
isLoginPopup:false,
menuOver:function(id, obj){
	if(menu_o.categoryIsClick) return;
	var oMenu=document.getElementById(id);
	var rec =comm_o.getElementRect(obj);
	if (oMenu) {
		if(id=="apDiv1"){
			oMenu.style.top=(rec.y+rec.h+document.body.scrollTop-7)+'px';
			oMenu.style.left=(rec.x+document.body.scrollLeft+25)+'px';
			menu_o.submenuIsOver1 = true;
		}
		else if(id=="apDiv2") {
			oMenu.style.top=(rec.y+rec.h+document.body.scrollTop-7)+'px';
			oMenu.style.left=(rec.x+document.body.scrollLeft-120)+'px';
			menu_o.submenuIsOver2 = true;
		}	
		oMenu.style.display="";
	}
},
menuOut:function(id){
	if(id=="apDiv1") menu_o.submenuIsOver1 = false;
	else if(id=="apDiv2") menu_o.submenuIsOver2 = false;

	var oMenu=document.getElementById(id);
	if (oMenu) setTimeout("menu_o.hideDelay('"+id+"',0 );",40);
},
menuAllOut:function(){
	if(menu_o.submenuIsOver1) {
		var oMenu1=document.getElementById("apDiv1");
		if (oMenu1) setTimeout("menu_o.hideDelay('"+id+"',0 );",40);
	}	
	if(menu_o.submenuIsOver2) {
		var oMenu2=document.getElementById("apDiv2");
		if (oMenu2) setTimeout("menu_o.hideDelay('"+id+"',0 );",40);
	}	
},
hideDelay:function(id, cnt){
	if(id=="apDiv1" && menu_o.submenuIsOver1) return;
	else if(id=="apDiv2" && menu_o.submenuIsOver2) return;

	var oMenu=document.getElementById(id)
	if(cnt==5) oMenu.style.display="none";
	else setTimeout("menu_o.hideDelay('"+id+"',"+(cnt+1)+");",40);	
},
submenuOver:function(id){
	if(id=="apDiv1") menu_o.submenuIsOver1 = true;
	else if(id=="apDiv2") menu_o.submenuIsOver2 = true;
},
submenuOut:function(id){
	if(id=="apDiv1") menu_o.submenuIsOver1 = false;
	else if(id=="apDiv2") menu_o.submenuIsOver2 = false;

	var oMenu=document.getElementById(id);
	if (oMenu) setTimeout("menu_o.hideDelay('"+id+"',0 );",40);
},
categoryView:function(){
	menu_o.categoryIsClick = true;

	var oCateOpenBtn=document.getElementById("tr_cate_open")
	if (oCateOpenBtn) oCateOpenBtn.style.display="none";
	
	var oSubMenu2=document.getElementById("tr_catmenu");
	if (oSubMenu2){ 
		oSubMenu2.style.display="";
		var rec =comm_o.getElementRect(oSubMenu2);
		var open_table=document.getElementById("open_table");
		if (open_table) {
			open_table.style.display="";
			open_table.style.top=(rec.y+rec.h+document.body.scrollTop-30)+'px';
			open_table.style.left=(rec.x+document.body.scrollLeft+2)+'px';
		}	
	}	
},
categoryHide:function(){
	menu_o.categoryIsClick = false;

	var oCateOpenBtn=document.getElementById("tr_cate_open")
	if (oCateOpenBtn) oCateOpenBtn.style.display="";
	
	var oSubMenu2=document.getElementById("tr_catmenu");
	if (oSubMenu2){
		oSubMenu2.style.display="none";
		var open_table=document.getElementById("open_table");
		if (open_table) open_table.style.display="none";
	}
},
openLoginPop:function(pos,retURL){
	var lay_out = document.getElementById("lay_out")
	var login = document.getElementById("login")

	menu_o.isLoginPopup=true;
	menu_o.setDisable(true,"lay_out");
	login.style.display="";

	if(window.innerHeight){
		maxW=parseInt(window.innerWidth);				
	}else{
		maxW=parseInt(document.body.clientWidth);				
	}
	
	var x=(Math.round((maxW-691)/2))+'px';
	if(pos)
		var y=(pos)+'px';
	else
		var y=120+'px';

	login.style.left=x;
	login.style.top=y;
	
	if (retURL) document.loginForm.ReturnUrl.value = retURL;
},
closeLoginPop:function(){
	var lay_out = document.getElementById("lay_out")
	var login = document.getElementById("login")

	menu_o.isLoginPopup=false;
	menu_o.setDisable(false,"lay_out");
	login.style.display="none";
},
setDisable:function(mode,id){
	var grayObj=document.getElementById("div_gray");
	if(mode){
		if(grayObj) return;		
		grayObj=document.createElement("div");
		grayObj.id="div_gray";
		grayObj.style.position="absolute";
		grayObj.style.backgroundColor="#000000";
		grayObj.style.opacity=0.3;
		grayObj.style.filter = "Alpha(Opacity=30)"; 
		grayObj.style.left=(document.body.scrollLeft)+'px';
		grayObj.style.top=(document.body.scrollTop)+'px';
		
		grayObj.oncontextmenu=function(){return false;}
		
		var tbl=document.getElementById(id);
		if(tbl) {
			tbl.style.left=(document.body.scrollLeft)+'px';
			tbl.style.top=(document.body.scrollTop)+'px';
			document.body.insertBefore(grayObj, tbl);
		}else
			document.body.appendChild(grayObj);
		if(window.addEventListener)
			window.addEventListener("resize",  this.graySizeHandler, true);
		else
			window.attachEvent("onresize",  this.graySizeHandler);
		 this.graySizeHandler();
	}else if(grayObj){
		document.body.removeChild(grayObj);
		if(window.removeEventListener)
			window.removeEventListener("resize", this.graySizeHandler, true);
		else
			window.detachEvent("onresize", this.graySizeHandler);
	}
},
graySizeHandler:function(){
	var grayObj=document.getElementById("div_gray");
	if(!grayObj) return;
	var maxW, maxH;
	if(window.innerHeight){
		maxW=parseInt(window.innerWidth);				
		maxH=parseInt(window.innerHeight);				
	}else{
		maxW=parseInt(document.body.clientWidth);				
		maxH=parseInt(document.body.clientHeight);
	}

	grayObj.style.width="100%";
	grayObj.style.height="3000px";
},
resetDisable:function(){
	if(menu_o.isLoginPopup) return;
	
	var grayObj=document.getElementById("div_gray");
	if(!grayObj) return;	

	grayObj.style.left=document.body.scrollLeft;
	grayObj.style.top=document.body.scrollTop;
	
	grayObj.oncontextmenu=function(){return false;}
	
	var tbl=document.getElementById(exe_o.curSetDisableID);
	if(tbl){
		tbl.style.left=(document.body.scrollLeft)+'px';
		tbl.style.top=(document.body.scrollTop)+'px';
		document.body.insertBefore(grayObj, tbl);
	}else
		document.body.appendChild(grayObj);
	if(window.addEventListener)
		window.addEventListener("resize",  this.graySizeHandler, true);
	else
		window.attachEvent("onresize",  this.graySizeHandler);
	this.graySizeHandler();
}
}

