//水平下拉菜单   
//pMenuIdArray:父菜单ID数组
//sMenuIdArray:子菜单ID数组
//N为序号从0开始连的连续正整数
//父菜单ID为pMenuIdArray
//子菜单ID为sMenuIdArray
//注:要用到jsExtend.js

var Jack;
if(!Jack) Jack={};
Jack.hMenu=function(pMenuIdArray,sMenuIdArray){
	var SELF=this;
	SELF.openClass="";
	SELF.closeClass="";
	SELF.defaultMenuId=null;
	SELF.GetDefaultMenuId=function(){
		var i=0;
		var obj=null;
	    while(obj=document.getElementById(pMenuIdArray[i])){
		    if(obj.className==SELF.openClass){
			    SELF.defaultMenuId=i;
			    break;
		    }
		    i++;
	    }
	}
	SELF.InMenu=function(id){
		var r=false;
		var obj=event.toElement;
		while(obj){
			if(obj==document.getElementById(pMenuIdArray[id]) || obj==document.getElementById(sMenuIdArray[id])){
				r=true;
				break;
			}
			obj=obj.parentElement;
		}
		return r;
	}
	SELF.ShowMenu=function(id){
		var obj;
		if(SELF.defaultMenuId!=null && SELF.defaultMenuId!=id){
			obj=document.getElementById(pMenuIdArray[SELF.defaultMenuId]);
			if(obj){
				if(obj.className!=SELF.closeClass){
				    obj.className=SELF.closeClass;
				}
			}
			obj=document.getElementById(sMenuIdArray[SELF.defaultMenuId]);
			if(obj){
				if(obj.style.display!="none"){
				    obj.style.display="none";
					clearTimeout(ActionTimer)
				}
			}
		}
	    obj=document.getElementById(pMenuIdArray[id]);
		if(obj){
			if(obj.className!=SELF.openClass){
			    obj.className=SELF.openClass;
			}
		}
		obj=document.getElementById(sMenuIdArray[id]);
		if(obj){
			
			if(obj.style.display=="none"){
				switch(parseInt(id,10)){
					case 1:
				    case 2:
					   LShow(id,true);
					   break;
					case 3:
					case 4:
					case 5:
					   MShow(id,true);
					   break;
					case 6:
					case 7:
					case 8:
					case 9:
					   RShow(id,true);
					   break;
				}
				//obj.style.display="";
			}
		}
	}
	SELF.HideMenu=function(id){
		var obj;
		if(!SELF.InMenu(id)){
			obj=document.getElementById(pMenuIdArray[id]);
			if(obj){
				if(obj.className!=SELF.closeClass){
				    obj.className=SELF.closeClass;
				}
			}
			obj=document.getElementById(sMenuIdArray[id]);
			if(obj){
				if(obj.style.display!="none"){
				    obj.style.display="none";
					clearTimeout(ActionTimer)
				}
			}
			if(SELF.defaultMenuId!=null){
			    obj=document.getElementById(pMenuIdArray[SELF.defaultMenuId]);
			    if(obj){
				    if(obj.className!=SELF.openClass){
				        obj.className=SELF.openClass;
				    }
			    }
		    }
		}
	}
	SELF.Init=function(){
		var obj=null;
	    var i=0;
		SELF.GetDefaultMenuId()
	    while(obj=document.getElementById(pMenuIdArray[i])){
		    obj.setAttribute("menuIndex",i)
		    obj.onmouseover=function(){
			    SELF.ShowMenu(this.getAttribute("menuIndex"))
		    }
		    obj.onmouseout=function(){
			    SELF.HideMenu(this.getAttribute("menuIndex"))
		    }
		    if(obj=document.getElementById(sMenuIdArray[i])){
			    obj.setAttribute("menuIndex",i)
			    obj.onmouseover=function(){
			        SELF.ShowMenu(this.getAttribute("menuIndex"))
		        }
		        obj.onmouseout=function(){
			        SELF.HideMenu(this.getAttribute("menuIndex"))
		        }
		    }
		    i++
	    }	
	}
}



var Menu1
var ActionTimer=null
var PM=new Array();
var SM=new Array();
var Marea=new Array();
var obj=null;
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_HomeMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_AboutMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_NewsMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_ProductMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_SolutionsMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_CaseMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_ServiceMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_JobMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_MessageMenu"
PM[PM.length]="_ctl0_ContentPlaceHolder1_MainMenu1_ContactMenu"

SM[SM.length]="sHomeMenu"
SM[SM.length]="sAboutMenu"
SM[SM.length]="sNewsMenu"
SM[SM.length]="sProductMenu"
SM[SM.length]="sSolutionsMenu"
SM[SM.length]="sCaseMenu"
SM[SM.length]="sServiceMenu"
SM[SM.length]="sJobMenu"
SM[SM.length]="sMessageMenu"
SM[SM.length]="sContactMenu"

Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu0Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu1Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu2Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu3Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu4Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu5Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu6Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu7Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu8Area"
Marea[Marea.length]="_ctl0_ContentPlaceHolder1_MainMenu1_Menu9Area"
function InitMenu(){
	var i=0;
	for(i=0;i<SM.length;i++){
		obj=document.getElementById(SM[i])
		if(obj){
		   obj.style.visibility="hidden"
		   obj.style.display=""
		   obj.style.width=obj.offsetWidth+"px"
		   obj.style.overflow="hidden"
		   obj.setAttribute("MyWidth",obj.offsetWidth);	
		   obj.setAttribute("MyMarginLeft",obj.style.marginLeft.replace(/px/ig,""));	
		   obj.style.display="none"
		   obj.style.visibility="visible"
		}
	}
	Menu1=new Jack.hMenu(PM,SM)
	Menu1.openClass="hover navlist"
	Menu1.closeClass="navlist"
	Menu1.Init()
}

function LShow(id,start){
    var obj1,obj2,testn,p=40
	obj1=document.getElementById(SM[id])
	obj2=document.getElementById(Marea[id])
	if(obj1 && obj2){
	   clearTimeout(ActionTimer)
	   if(start){
	      obj2.style.marginLeft="0px";
		  obj1.style.width="1px";
		  obj1.style.display=""
	   }
	   if(obj1.offsetWidth<parseInt(obj1.getAttribute("MyWidth"),10)){
		  testn=obj1.offsetWidth+p
		  if(testn>parseInt(obj1.getAttribute("MyWidth"),10)){
		     testn=parseInt(obj1.getAttribute("MyWidth"),10)
		  }
	      obj1.style.width=testn + "px"
		  ActionTimer=setTimeout("LShow("+id+",false)",1)
	   }
	}
}
function RShow(id,start){
    var obj1,obj2,testn,p=40
	obj1=document.getElementById(SM[id])
	obj2=document.getElementById(Marea[id])
	if(obj1 && obj2){
	   clearTimeout(ActionTimer)
	   if(start){
	      obj2.style.marginLeft="-"+obj1.getAttribute("MyWidth")+"px";
		  obj1.style.marginLeft=(parseInt(obj1.getAttribute("MyMarginLeft"),10)+parseInt(obj1.getAttribute("MyWidth"),10))+"px"
		  obj1.style.width="1px";
		  obj1.style.display=""
	   }
	   if(obj1.offsetWidth<parseInt(obj1.getAttribute("MyWidth"),10)){
		  testn=obj1.offsetWidth+p
		  if(testn>parseInt(obj1.getAttribute("MyWidth"),10)){
		     testn=parseInt(obj1.getAttribute("MyWidth"),10)
		  }
	      obj1.style.width=testn + "px"
		  obj1.style.marginLeft=(parseInt(obj1.getAttribute("MyMarginLeft"),10)+parseInt(obj1.getAttribute("MyWidth"),10)-testn)+"px"
		  obj2.style.marginLeft="-"+(parseInt(obj1.getAttribute("MyWidth"),10)-obj1.offsetWidth)+"px";
		  ActionTimer=setTimeout("RShow("+id+",false)",1)
	   }
	}
}

function MShow(id,start){
    var obj1,obj2,testn,p=40,testn1
	obj1=document.getElementById(SM[id])
	obj2=document.getElementById(Marea[id])
	if(obj1 && obj2){
	   clearTimeout(ActionTimer)
	   if(start){
	      obj2.style.marginLeft="-"+obj1.getAttribute("MyWidth")+"px";
		  obj1.style.marginLeft=(parseInt(obj1.getAttribute("MyMarginLeft"),10)+parseInt(obj1.getAttribute("MyWidth"),10)/2)+"px"
		  obj1.style.width="1px";
		  obj1.style.display=""
	   }
	   if(obj1.offsetWidth<parseInt(obj1.getAttribute("MyWidth"),10)){
		  testn=obj1.offsetWidth+p*2
		  if(testn>parseInt(obj1.getAttribute("MyWidth"),10)){
		     testn=parseInt(obj1.getAttribute("MyWidth"),10)
		  }
		  testn1=parseInt(obj1.getAttribute("MyMarginLeft"),10)+parseInt(obj1.getAttribute("MyWidth"),10)/2
		  testn1-=testn/2
	      obj1.style.width=testn + "px"
		  obj1.style.marginLeft=testn1 + "px"
		  obj2.style.marginLeft=((obj1.offsetWidth-parseInt(obj1.getAttribute("MyWidth"),10))/2)+"px";
		  ActionTimer=setTimeout("MShow("+id+",false)",1)
	   }
	}
}
AddEvent("window.onload","InitMenu()")


