﻿

var la=0;

function setUserWH(){
	var w=Element.getWidth("hiwebTab")
	var h=Element.getHeight("hiwebTab")
	//alert(h)
	w=w-157;
	var obj=$("rightDIV");
	obj.style.width=w+"px";
	obj=$("mainDiv");
	obj.style.height=(h-75)+"px";
	
	obj=$("copyRight");
	obj.style.top=(h-35) + "px";
	if (la==0){
	    jsLoad();
	    //alert(h)
	    la=1;
	}
}



function jsLoad(){
	
		setTimeout("jsOnLoad()",1000);
	
}

function jsOnLoad(){
	
	 var objCookMan=new JHttpCookieManager(); 
	var isNew="0";
	 if (objCookMan.getCookieValue("isNewUser")!="1"){
		 var objCookie=new JHttpCookie("isNewUser","1","","","",false);  //创建一个cookie
		 objCookMan.addCookie(objCookie);
		 isNew="1";
		
	 }
	  
	var objs =document.getElementsByTagName("input");
	for (var i=0;i<objs.length;i++){
	    var t=objs[i].type;
	    t=t.toLowerCase();
	    if (t=="text"){
	        objs[i].className="inputText";
	    }
	    
	}
	  
	url=location.href;
	var objAjax=new JAjax();
	var objResponse=new JHttpResponse();
	objResponse.write("url",url);
	objResponse.write("menuid",menuid);
	objResponse.write("tab",tabname);
	objResponse.write("tabid",tabid);
	objResponse.write("title",document.title);
	objResponse.write("isNew",isNew);
	var out=objAjax.getText("post",sysPath+"webserver.aspx?type=upData",objResponse,null);
	//alert(out);
}


function menuClass(){
     var menuList =new Array();
	 this.thisObj=null;
	 var menuindex=parseInt(readPar(location.href,"menuindex"));
	
	this.addMain=function(menuText){ /*菜单名字,  菜单点击后执行的URL, 说明*/
		var i=menuList.length;
		menuList[i]=new Array();
		menuList[i][0]=menuText;
		
		
	}
	
	this.addMenu=function(num,menuText,menuURL){ /*添加子菜单,菜单的主序号,菜单的名字, 运行的URL*/
		if (!isArray(menuList[num])){
			alert("主菜单["+num+"]没有定义");
			return null;
		}
		var i=menuList[num].length;
		menuList[num][i]=new Array();
		menuList[num][i][0]=menuText;
		menuList[num][i][1]=menuURL;
	}
	
	this.create=function(obj){
		if (!isArray(menuList)){
			alert("主菜单没有定义");
			return null;
		}
		//if (!isArray(menuList[0][0])){
//			alert("没有发现子菜单定义");
//			return null;
//		}


		if (obj==null){
			
			alert("错误:菜单放到哪对象里?");
			
			return null;
		}
		
		for (var i=0;i<menuList.length;i++){
			
			
		
  	     	
			var tempObj=$c("div");
			var newObj=obj.appendChild(tempObj);
			newObj.style.cssText="cursor:hand;padding-top:10px;padding-left:47px;width:157px;height:32px;background-image:url('images/uMain.gif');color:#003366;font-size:14px;font-weight:bold;"
			newObj.innerText=menuList[i][0];
			newObj.onclick=function(){  //被点击选项
				var obj;
				if (menu.thisObj!=this){
					if (menu.thisObj!=null){
						menu.thisObj.style.backgroundImage="url('images/uMain.gif')";
						menu.thisObj.style.color="#003366";
						obj=menu.thisObj.nextSibling;
						obj.style.display="none";
					}
				}
				this.style.backgroundImage="url('images/uMain-1.gif')";
				this.style.color="#a43b07";
				menu.thisObj=this;
				
				obj=this.nextSibling;
				if (obj==null){return;}
				if (obj.style.display!="none"){
					obj.style.display="none";
				}else{
					obj.style.display="";
				}
			
			}
			if (menuindex==i){
				this.thisObj=newObj;	
				newObj.style.backgroundImage="url('images/uMain-1.gif')";
				newObj.style.color="#a43b07";
			}
			
			

			
			tempObj=$c("div");
			newObj=obj.appendChild(tempObj);
			if (menuindex!=i){
				newObj.style.cssText="display:none;";
			}
			tempObj=$c("div");
			downObj=newObj.appendChild(tempObj);
			downObj.style.cssText="width:157px;height:8px;background-image:url('images/uTitlebg1.gif');overflow: hidden;";
			for (var x=1;x<menuList[i].length;x++){
				tempObj=$c("div");
				downObj=newObj.appendChild(tempObj);
				downObj.style.cssText="cursor:hand;padding-top:4px;padding-left:53px;font-size:12px;width:157px;height:22px;background-image:url('images/uTitlebg.gif');color:#003366;"
				if (menuList[i][x][1].indexOf("?")==-1){
					menuList[i][x][1]=menuList[i][x][1]+"?menuindex="+i
				}else{
						menuList[i][x][1]=menuList[i][x][1]+"&menuindex="+i
				}
				downObj.innerHTML="<a style='color:#000000;' href='"+menuList[i][x][1]+"'>"+menuList[i][x][0]+"</a>";
			}
			
			tempObj=$c("div");
			downObj=newObj.appendChild(tempObj);
			downObj.style.cssText="width:157px;height:15px;background-image:url('images/uTitlebg2.gif');overflow: hidden;";
			
			 tempObj=$c("div");
			 newObj=obj.appendChild(tempObj);
  	     	newObj.style.cssText="width:157px;height:4px;overflow: hidden;";
		}
	}
}


function selectAll(){
	var objs=	document.getElementsByTagName("input");
	for (var i=0;i<objs.length;i++){
		if (objs[i].type=="checkbox"){
			objs[i].checked=true;
		}
	}
}

function selectReverse(){
	var objs=	document.getElementsByTagName("input");
	for (var i=0;i<objs.length;i++){
		if (objs[i].type=="checkbox"){
			if (objs[i].checked==true){
				objs[i].checked=false;
			}else{
				objs[i].checked=true;
			}
		}
	}
}
