function deskTopClass(){
	
	this.className="deskTopClass";
	this.width=null;
	this.height=null;
	var objAjax=new JAjax();
	this.winList=new Array();
	this.taskWidth=null;
	this.pList=null;  //应用程序列表 数组
	//var c1="|";  //第一级分隔符
	//var c2=",";  //第二级分隔符
	this.icoList=null;  //桌面上的图标列表
	this.deskTopSet=null; //桌面的配置
	var sMenuHeight=null;
	JBrowser.agent=JBrowser.InternetExplorer;
	this.ieVer=JBrowser.version;
	
	
	this.loadDesktop=function(){
		/*初始化系统  加载桌面*/
		var out=objAjax.getText("get","html/task.htm?"+create_id(),null,null); 
		document.getElementById("task").innerHTML=out;
		var jobObj=document.getElementById("job")
		
		out=objAjax.getText("get","html/start.htm?"+create_id(),null,null)
		document.getElementById("deskTop_StartMenu").innerHTML=out;
		this.pList=this.readServer("deskTopServer.aspx?type=2")
		var p=this.pList;
		for (var i=0;i<p.length;i++){
			p[i][20]=0;
		}
		this.pList=p;

		this.icoList=this.readServer("deskTopServer.aspx?type=1")
//		var out=objAjax.getText("post","deskTopServer.aspx?type=readDeskTopPar",null,null);
		this.deskTopSet=this.readServer("deskTopServer.aspx?type=readDeskTopPar")
		//alert(this.deskTopSet);
		
		setTimeout("deskTop.useDesktopPar()",100);
		
		document.body.onmousemove=function(){
		
			move.move();
			zoom.zoom()
		}
		document.body.onmouseup=function(){
			sMenu.close();
			move.moveEnd();
			zoom.end();
		}
		
       document.getElementById("job").onmouseup=function(){
			var button=event.button 
			if (button!=1){
			   rmenu.clear();
			   rmenu.add("排列图标","deskTop.arrangeIco()");
			   rmenu.add("注销登录","");
			   rmenu.add("管理我的网站","win.pCreate('p-myWeb')");
			   rmenu.add("|","");
			   rmenu.add("属性","win.pCreate('p-diskTopSetup')");
			   rmenu.add("刷新","location.reload()");
			   rmenu.create();
			}else{
				rmenu.clear();
			}
      }
		
		fullScreen.onclick=function(){
			
			if (this.title=="全屏"){
				this.title="取消全屏"
			}else{
				this.title="全屏"
			}
			WALL_web()
		}
		//alert(this.height)
		if (this.height<570){
			alert("您的窗口可用高度为:"+this.height+",\n\n系统要求可用高度最小达到570象素, 建议您使用全屏方式运行\n\n另外, 您还可以关闭菜单栏,工具条,以增加浏览器窗口的可用面积");
			WALL_web()
		}
		
		$("taskStart").onmouseover=function(){
			this.style.backgroundImage="url(\"img/start1.gif\")";
		}
		
		$("taskStart").onmouseout=function(){
			this.style.backgroundImage="url(\"img/start.gif\")";
		}
		
		
	}
	
	this.useDesktopPar=function(){ //应用桌面设置参数
		var obj=document.getElementById("deskTop_1");
		if (this.deskTopSet[2][1]!=""){
			obj.style.backgroundColor=this.deskTopSet[2][1];
		}
		
		if (this.deskTopSet[0][1]=="no" |this.deskTopSet[0][1]==""){
			obj.style.backgroundImage="none";
		}else{
			obj.style.backgroundImage="url('"+this.deskTopSet[0][1]+"')";
			if (this.deskTopSet[1][1]=="0"){
				obj.style.backgroundPositionX="center";
				obj.style.backgroundPositionY="center";
				obj.style.backgroundRepeat="no-repeat";
			}
		}
	}
	
	this.readServer=function(url){ // 从服务器取出参数, 并分割为二维数组.
		var out=objAjax.getText("post",url,null,null);
		//return comminute(out,c1,c2);
		//out=out.split("<!--end-->");
		//alert(out);
		out=out.split(c1);
		var r=new Array();
		for (var i=0;i<out.length-1;i++){
			r[i]=new Array();
			var o=out[i].split(c2);
			for (var x=0;x<o.length;x++){
				r[i][x]=o[x];
			}			
		}
		if (out.length<1){
			alert(erStr(out.toString()));
		}
	   return r
	}
	
	this.writeIco=function(){ //写桌面图标
		var il=this.icoList;
		for (var i=0;i<il.length;i++){
			
			var p=this.readProgram(il[i][1])
 			//alert(p);
			if (p!=null){
				var tempObj=document.createElement("div");
				tempObj.id="icoIframe";
				tempObj.name="icoIframe";
				var obj=document.getElementById("job").appendChild(tempObj);
				tempObj=document.createElement("div");
				tempObj.id="icoImg";
				var objImg=obj.appendChild(tempObj);
				tempObj=document.createElement("div");
				tempObj.id="icoText";
				var objText=obj.appendChild(tempObj);
				
				obj.style.left=il[i][2]+"px";
				obj.style.top=il[i][3]+"px";
				obj.style.zIndex="0";
				obj.w=p[5];
				obj.h=p[6];
				obj.ul=p[8];
				obj.title=p[2];
				obj.pid=p[1];
				obj.mode=p[3];
				objText.innerText=p[2];
				//ID,pName,pAsName,windowType,upWindow,Width,Height,ICO,Path,MID,isdeskTop
				
				objImg.innerHTML=icoHTML(p[7])
				
				obj.onmouseover=function(){
					
					this.className="icoIframe_1";
				}
				
				obj.onmouseout=function(){
					this.className="";
				}
				
				obj.ondblclick=function(){ //点击桌面图标
					win.pCreate(this.pid,null,this.title);
				}
				
				obj.onmousedown=function(){
					this.style.zIndex=win.wIndex+2;
					rmenu.isStop=0;
					move.isMove=1;
					move.obj=this;
					move.moveSize=1;
					move.star();					
				}
				
				obj.onmouseup=function(){
					this.style.zIndex="0";
					rmenu.isStop=1;
				}
			}
		}
		//alert(this.icoList);
	}
	
	
	this.arrangeIco=function(){ //排列图标
		var objs=document.getElementsByName("icoIframe");
		var maxX=this.width;
		var maxY=this.height;
		x=10;
		y=5;
		for (var i=0;i<objs.length;i++){
			objs[i].style.left=x+"px";
			objs[i].style.top=y+"px";
			y=y+90;
			if (y>maxY-100){
				y=5;
				x=x+100;
			}
		}
		
	}
	
	this.saveIco=function(){  //把桌面参数保存回服务器
		var pName="";
		var pX="";
		var pY="";
    //alert(pX+"|"+pY);
		var iList=document.getElementsByName("icoIframe")
		if (iList.length==0){
			return;
		}
		for (var i=0;i<iList.length;i++){
			pName=pName+iList[i].pid+",";
			pX=pX+delpx(iList[i].style.left)+",";
			pY=pY+delpx(iList[i].style.top)+",";
		}
		
		var p=this.pList;
		pidlist="";
		pcountlist="";
		for (var i=0;i<p.length;i++){
			if (p[i][20]!=0&p[i][20]!=null){
				pidlist=pidlist+p[i][0]+","	;
				pcountlist=pcountlist+p[i][20]+",";
			}
		}
		
		var objResponse=new JHttpResponse();
		objResponse.write("pName",pName);
		objResponse.write("pX",pX);
		objResponse.write("pY",pY);
		objResponse.write("pidList",pidlist);
		objResponse.write("pcountList",pcountlist);
		
		
	
		var out=objAjax.getText("post","deskTopServer.aspx?type=4",objResponse,null);
		if (out!="OK"){
			alert(out)
		}
	}
	
	this.readProgram=function(pName){
		var pl=this.pList;
		for (var i=0;i<pl.length;i++){
			if(pl[i][1]==pName){
				return pl[i];
				break;
			}
		}
		return null;
	}
	
	this.setDesktop=function(){ /*初始化桌面*/
		if (this.width==null|this.height==null){
			alert("请先选择桌面的高度和宽度");
			return null;
		}
		document.getElementById("job").style.height=(this.height-Element.getHeight(document.getElementById("task")))+"px";
		document.getElementById("job").style.width=this.width+"px";
		document.getElementById("task").style.width=this.width+"px";
		document.getElementById("taskMain").style.width=(this.width-Element.getWidth(document.getElementById("taskStart"))-Element.getWidth(document.getElementById("taskRight")))+"px";
		this.taskWidth=Element.getWidth(document.getElementById("taskMain"))
		move.Xmax=this.width;
		move.Ymax=this.height-35;
		var startObj=document.getElementById("deskTop_StartMenu");
		var y1=Element.getHeight(document.getElementById("task"));
		var y2=Element.getHeight(startObj);
		if (y2!=0){sMenuHeight=y2}else{y2=sMenuHeight}
		startObj.style.top=(this.height-y1-y2+4)+"px";
		sMenu.clearMenu();
		
		
	}
	
}

function startMenuClass(){ //开始菜单
	var objAjax=new JAjax();
	this.menuList="";
	
	

	
	this.loadOften=function(){ //加载常用程序.
		
		if (ieVer()==6){
			var obj=document.getElementById("webOs_StartMenu");
			obj.style.backgroundImage="url('img/sMenuBG1.gif')";
		}
		var out=objAjax.getText("post","deskTopServer.aspx?type=readStart&t="+create_id(),null,null);
		this.menuList=comminute(out,c1,c2);
		var p=deskTop.pList;
		var menuObj=document.getElementById("startMenu_topLeft");
		var x=0;
		for (var i=0;i<p.length&x<8;i++){
			if (p[i][10]!="0"){
				x++;
				var tempObj=document.createElement("div");
				var obj=menuObj.appendChild(tempObj);
				obj.title=p[i][2];
				obj.pid=p[i][1];
				obj.className="startMenu_Often";
				
				tempObj=document.createElement("div");
				var newObj=obj.appendChild(tempObj);
				
				newObj.innerHTML= icoHTML(p[i][7]);
				
				newObj.className="startMenu_OftenIco";
				
				tempObj=document.createElement("div");
				newObj=obj.appendChild(tempObj);
				newObj.innerHTML=p[i][2];
				newObj.className="startMenu_OftenText";
				
				obj.onmouseover=function(){
					this.oldclass=this.className;
					this.className=this.className+"_1";
				}
				
				obj.onmouseout=function(){
					this.className=this.oldclass;
				}
				
				obj.onclick=function(){ //点击桌面图标
					sMenu.close();
					win.pCreate(this.pid,null,this.title);
				}
			
			}
		}
		
		obj=document.getElementById("startMenu_userName");
		obj.innerText=userInfo[0];
		
		obj=$("startMenuClose");
		obj.onmouseover=function(){
			this.src="img/starClose1.gif";
		}
		obj.onmouseout=function(){
			this.src="img/starClose.gif";
		}
		obj.onmousedown=function(){
			sMenu.isClear=0;
			window.close();
			sMenu.isClear=1;
		}
		
		obj=$("starMenuLogout");
		obj.onmouseover=function(){
			this.src="img/startLogout1.gif";
		}
		obj.onmouseout=function(){
			this.src="img/startLogout.gif";
		}
		obj.onmousedown=function(){
			sMenu.isClear=0;
			  if (window.confirm("你真的要注销吗?")){
				var out=objAjax.getText("post","../user/userLogin.aspx?type=logout",null,null);
				location.href="login.htm";
			  }
			sMenu.isClear=1;
		}
		
		
		
	}
	
	this.loadProgram=function(){  //加载应用程序,开始菜单
		this.isClear=1;
		var mList=this.menuList;
		//mid,mName,layer,upListid,isdown
		var menuObj=document.getElementById("startMenu_tr2");
		
		for (var i=0;i<mList.length-1;i++){
			//alert(mList[i][2])
			if (mList[i][2]=="1"){
				var tempObj=document.createElement("div");
				var obj=menuObj.appendChild(tempObj);
				
				tempObj=document.createElement("div");
				var newObj=obj.appendChild(tempObj);
				newObj.innerText=mList[i][1];
				newObj.className="startMenu_pText";
				
				tempObj=document.createElement("div");
				var newObj=obj.appendChild(tempObj);
				if (mList[i][4]=="1"){
					newObj.innerHTML="<img src='img/sMenuPmore.gif'>";
				}
				newObj.className="startMenu_pImg";
				
				obj.className="startMenu_p";
				obj.mid=mList[i][0];
				obj.upidlist=mList[i][3];
				obj.isdown=mList[i][4];
				obj.layer=mList[i][2];
				obj.onmouseover=function(){
					
					this.oleClass=this.className;
					this.className=this.className+"_1";
					sMenu.loadDownMenu(this);
				}
				obj.onmouseout=function(){
					this.className=this.oleClass;
					//document.getElementById("deskTop_startDownMenu").style.display="none";
					
				}
			}

		}
		
	}
	
	this.loadDownMenu=function(thisObj){
		var mList=this.menuList;
		var pList=deskTop.pList;
		var isDown=thisObj.isdown;
		var mid=thisObj.mid;
		var upidList=thisObj.upidlist;
		for (var i=0;i<mList.length-1;i++){
			var temp=document.getElementById("deskTop_startDownMenu_"+mList[i][0])
			if (temp!=null){
				if (thisObj.upidlist.search(temp.mid)==-1){
					temp.style.display="none";
				}
			}
		}
		var obj=document.getElementById("deskTop_startDownMenu");
		var mObj=document.getElementById("deskTop_startDownMenu_"+thisObj.mid)
		if (mObj==null){
				var objCopy=obj.cloneNode(true); //复制行
				mObj=obj.parentNode.insertBefore(objCopy,obj);//放置新行
		}else{
			if (mObj.innerHTML!==""){
				mObj.style.display="";
			}
			return ;
		}
		
		mObj.className=mObj.id;
		mObj.name=mObj.id;
		mObj.id="deskTop_startDownMenu_"+thisObj.mid;
		mObj.layer=thisObj.layer;
		mObj.mid=thisObj.mid;
		mObj.upidlist=thisObj.upidlist;
		mObj.innerHTML="";
		//alert(isDown)
		if (isDown=="1"){ //添加子栏目
		   	for (i=0;i<mList.length-1;i++){
				
				//mid,mName,layer,upListid,isdown
				if (mList[i][3]==upidList+","+mList[i][0]){
					var tempObj=document.createElement("div");
					obj=mObj.appendChild(tempObj);
					
					tempObj=document.createElement("div");
					var newObj=obj.appendChild(tempObj);
					newObj.className="startMenu_downmenuImg";
					
					tempObj=document.createElement("div");
					newObj=obj.appendChild(tempObj);
					newObj.className="startMenu_downmenuText";
					newObj.innerText=mList[i][1];
					obj.className="deskTop_downMenuOption";
					obj.mid=mList[i][0];
					obj.upidlist=mList[i][3];
					obj.isdown=mList[i][4];
					obj.layer=mList[i][2];
					
					
					obj.onmouseover=function(){
						this.className="deskTop_downMenuOption_1";
						sMenu.loadDownMenu(this);
					}
					
					obj.onmouseout=function(){
						this.className="deskTop_downMenuOption";
					}
				}
			}
			
		}
		
		
		for (var i=0;i<pList.length;i++){ //添加应用程序.
			if (pList[i][9]==thisObj.mid){
					var tempObj=document.createElement("div");
					obj=mObj.appendChild(tempObj);
					
					tempObj=document.createElement("div");
					var newObj=obj.appendChild(tempObj);
					newObj.className="startMenu_downmenuImg";
					newObj.style.backgroundImage="none";
					
					tempObj=document.createElement("div");
					newObj=obj.appendChild(tempObj);
					newObj.className="startMenu_downmenuText";
					newObj.innerText=pList[i][2];
					obj.className="deskTop_downMenuOption";
					obj.pid=pList[i][1];
					
					obj.onclick=function(){
						win.pCreate(this.pid,null,null)
					}
					
					obj.onmouseover=function(){
						this.className="deskTop_downMenuOption_1";
					}
					obj.onmouseout=function(){
						this.className="deskTop_downMenuOption";
					}
			
			}
		}
		
		if (mObj.innerHTML!=""){
			var x=getLeft(thisObj);
			var y=getTop(thisObj);
			mObj.style.left=(x+Element.getWidth(thisObj)+2)+"px";
			mObj.style.top=y+"px";
			mObj.style.display="";
		}else{
			mObj.style.display="none";
		}
			//ID,pName,pAsName,windowType,upWindow,Width,Height,ICO,Path,MID,isdeskTop
		
	}
	
	this.close=function(){
		if (this.isClear==1){
			document.getElementById("deskTop_StartMenu").style.display="none";
			document.getElementById("deskTop_startDownMenu").style.display="none";
			var mList=this.menuList;
		    for (var i=0;i<mList.length-1;i++){
				var temp=document.getElementById("deskTop_startDownMenu_"+mList[i][0])
				if (temp!=null){
						temp.style.display="none";
				}
			
			}
		}
		this.isClear=1;
	}
	
	this.clearMenu=function(){
			var mList=this.menuList;
		    for (var i=0;i<mList.length-1;i++){
				var temp=document.getElementById("deskTop_startDownMenu_"+mList[i][0])
				if (temp!=null){
						temp.removeNode(true);
				}
			
			}
	}
	
	this.open=function(){
		var sObj=document.getElementById("deskTop_StartMenu");
		sObj.style.display="block";
		
		//alert(sObj.outerHTML)
	}
}



function windowClass(){
	this.id=null;
	
	this.mode=1; //1 可缩放的窗口    0 不可缩放的窗口
	this.src=null;  //用于创建窗口
	this.wIndex=1;  //窗口层叠索引
	
	var objAjax=new JAjax();
	var out=objAjax.getText("get","html/window_dode1.htm?"+create_id(),null,null); 
	this.objHTML=out;
	
	var out=objAjax.getText("get","html/task_button.htm?"+create_id(),null,null); 
	this.buttonHTML=out;
	
	this.winMode=null;
	this.winNum=0;
	
	this.objNum=null;
	this.obj=null;
	this.title=null;
	this.titleLeft=null;
	this.titleMain=null;
	this.bMin=null;
	this.bMax=null;
	this.bClose=null;
	this.job=null;
	this.frame=null;
	this.fettleLeft=null;
	this.fettleRight=null;
	this.wUP=null;
	this.wUP1=null;
	this.winBotton=null;
	this.winBotton_left=null;
	this.winBotton_main=null;
	this.winBotton_right=null;
	this.tempClass="";
	
	
	var x=10;
	var y=10;
	var thisClass=null;
	var winCount=1;  //有效窗口数量 
	
	this.isPower=function(mUser,isPop){ //判断用户有没有权限启动某应用程序
//	ID,pName,pAsName,windowType,upWindow,Width,Height,ICO,Path,MID,isDeskTop,mUser,isPop
//   0   1     2          3         4       5      6    7    8   9   10        11   
		
		if (mUser=="ALL"){
			return true;
		}
		if (isPop=="0"){
			return true;
		}
		if (userInfo[3]=="2"){
			return true;
		}
		mUser=","+mUser+",";
		if (mUser.indexOf(","+userInfo[0]+",")!=-1){
			return true;
		}
		return false;
	}
	
	this.pCreate=function(pName,Par,title,mode){ //根据程序的ID即pName创建窗口 mode 如果窗口已存在,是否更新其内容
		var p=deskTop.pList;
		for (var i=0;i<p.length;i++){
			if (pName==p[i][1]){
				if (!this.isPower(p[i][11],p[i][12])){
					//alert(p[i][11]);
					alert("您没有权限使用这个功能");
					return;
				}
				
				if (title==""|title==null){
					title=p[i][2];
				}
				//ID,pName,pAsName,windowType,upWindow,Width,Height,ICO,Path,MID,runCount
				
				p[i][20]=p[i][20]+1; //统计程序运行次数
				this.create(p[i][5],p[i][6],title,p[i][1],p[i][8],p[i][3],Par,mode)
				break;	
			}
		}
		deskTop.pList=p;
	}
	
	this.create=function(width,height,pName,pid,url,mode,Par,mode1){  //根据输入的参数创建一个窗口  mode 如果窗口已存在,是否更新其内容
	// par 要向窗口传入的参数  参数前不能有? 或 &  可以用  a=11&b=2的格式
		if (url.search(/\?/g)>0){
			url=url+"&temp="+create_id();
		}else{
			url=url+"?temp="+create_id();
		}

		if (Par!=null&Par!=""){
			url=url+"&"+Par
		}
		
		for (var i=0;i<deskTop.winList.length;i++){  //如果窗口已存在, 则设置为最上层窗口
			if (deskTop.winList[i]!=-1){
				var obj=document.getElementById("wUP_"+deskTop.winList[i]);
				if (obj.pid==pid){
					obj.style.zIndex=this.wIndex;
					obj.style.display="";
					this.wIndex++;
					this.findUpWin();
					if (mode1!=null ){
						this.frame.location.href=url;
					}
					return null;
				}
			}
		}

		if (mode=="0"){
			mode=1;
		}else{
			mode=0;
		}
		var objHTML=this.objHTML;
		objHTML=objHTML.replace(/(id=\")([^\"]*)(\")/g,"$1$2_"+this.winNum+"$3");
		var tempObj=document.createElement("div");
		tempObj.id="wUP_"+this.winNum;
		obj=document.getElementById("job").appendChild(tempObj);
		obj.innerHTML=objHTML;
		obj.className="wUP";
		
		objHTML=this.buttonHTML.replace(/(id=\")([^\"]*)(\")/g,"$1$2_"+this.winNum+"$3");
		tempObj=document.createElement("div");
		tempObj.id="winBotton_"+this.winNum;
		var tobj=document.getElementById("taskMain").appendChild(tempObj);
		tobj.innerHTML=objHTML;
		tobj.className="winBotton_2"

		deskTop.winList[deskTop.winList.length]=this.winNum;
		this.readObj(this.winNum);
		
		this.obj.style.width=width+"px";
		this.job.style.height=(height-27-24)+"px";
		
		obj.style.width=Element.getWidth(this.obj);
		obj.style.height=Element.getHeight(this.obj);
		obj.style.left=x+"px";
		obj.style.top=y+"px";
		obj.style.zIndex=this.wIndex;
		obj.pid=pid;
		
		this.wUP1.style.width=obj.style.width;
		this.wUP1.style.height=obj.style.height;
		this.titleMain.style.width=(Element.getWidth(this.obj)-Element.getWidth(this.titleLeft)-110)+"px";
		this.titleMain.innerText=pName;
		this.winBotton_main.innerText=pName;
		
		
		
		this.frame.location.href=url;
	    //alert(this.iframe.outerHTML);
		
		this.addAffair(this.winNum,mode);   //为窗口绑定事件
		this.setUpwin();  //设置当前窗口
		x=x+20;
		y=y+20;
		if (x>deskTop.width-800){x=10;y=10}
		if (y>deskTop.height-600){x=10;y=10}
		this.winNum++;
		this.wIndex++;
		this.setButtonWidth();
		//this.iframe.location.href="http://www.sina.com.cn/"

	}
	
	this.addAffair=function(num,mode){  //为当对象窗口绑定事件
	
	    var _bClose=document.getElementById("bClose_"+num); //关闭按钮
		_bClose.onclick=function(){
			var thisid=this.id
			thisid=thisid.split("_")
			var thist=document.getElementById("winBotton_"+thisid[1]);
			thist.removeNode(true);
			var thisWinUP=document.getElementById("wUP_"+thisid[1]);
			thisWinUP.removeNode(true);
			for (var i=0;i<deskTop.winList.length;i++){
				if (deskTop.winList[i]==parseInt(thisid[1])){
					deskTop.winList[i]=-1;
				}
			}
			win.findUpWin();
		}
		_bClose.onmouseover=function(){
			win.tempClass=this.className;
			this.className=this.className+"_1";
		}
		_bClose.onmouseout=function(){
			this.className=win.tempClass;
		}
		

		
	    var _bMin=document.getElementById("bMin_"+num); //最小化按钮
		_bMin.onclick=function(){
			var obj=document.getElementById("wUP_"+id2num(this.id));
			obj.style.display="none";
			win.findUpWin();
		}
		_bMin.onmouseover=function(){
			win.tempClass=this.className;
			this.className=this.className+"_1";
			
		}
		_bMin.onmouseout=function(){
			this.className=win.tempClass;
		}
		
		
		
	    var _bMax=document.getElementById("bMax_"+num); //最大化按钮
		if (mode==1){
			_bMax.onclick=function(){
				if (this.maxType=="0"){
					this.maxType="1";
					this.w=Element.getWidth(win.obj);
					this.h=Element.getHeight(win.job);
					this.w1=Element.getWidth(win.wUP);
					this.h1=Element.getHeight(win.wUP);
					this.l=win.wUP.style.left;
					this.t=win.wUP.style.top;
					win.obj.style.width=deskTop.width-5;
					win.job.style.height=deskTop.height-27-24-15-35;
					win.wUP.style.width=deskTop.width;
					win.wUP.style.height=deskTop.height;
					win.wUP1.style.width=deskTop.width;
					win.wUP1.style.height=deskTop.height;
					win.wUP.style.left="0px";
					win.wUP.style.top="0px";
				}else{
					this.maxType="0";
					win.obj.style.width=this.w;
					win.wUP.style.left=this.l;
					win.wUP.style.top=this.t;
					//alert(this.l+"|"+this.t)
					win.job.style.height=this.h;
					win.wUP.style.width=this.w1+3;
					win.wUP.style.height=this.h1;
					win.wUP1.style.width=this.w1;
					win.wUP1.style.height=this.h1;
				}
				try{  //处理内部窗口的大小
					win.frame.setWH();
				}catch(e){
				}
			}
		}else{
			//_bMax.style.visibility="hidden";
			_bMax.style.display="none";           //无最大化的窗口
		}
		
		_bMax.onmouseover=function(){
			win.tempClass=this.className;
			this.className=this.className+"_1";
		}
		_bMax.onmouseout=function(){
			this.className=win.tempClass;
		}
		
		var _wUP1=document.getElementById("wUP1_"+num) //屏蔽层
		_wUP1.onclick=function(){
			var obj=document.getElementById("wUP_"+id2num(this.id));
			obj.style.zIndex=win.wIndex;
			win.wIndex++;
			win.findUpWin();
		}
		
		var _wButton=document.getElementById("winBotton_"+num)//任务栏按钮
		_wButton.onclick=function(){
			
			var obj=document.getElementById("wUP_"+id2num(this.id));
			if (parseInt(obj.style.zIndex)==win.wIndex-1 & obj.style.display!="none"){
				
				_bMin.click();
				
			}else{
				obj.style.zIndex=win.wIndex;
				obj.style.display="";
				win.wIndex++;
				win.findUpWin();
			}
		}
		
		var _wTitleMain=document.getElementById("wTitleMain_"+num)//窗口标题栏
		_wTitleMain.onmousedown=function(){
			if (win.bMax.maxType=="1"){return}
			move.obj=document.getElementById("wUP_"+id2num(this.id));
			move.isMove=1;
//			alert(win.winCount)
			var mSize=(win.winCount-1)*2+1;
			if (mSize>30){mSize=30}
			move.moveSize=mSize;
			move.star();
		}
		
		_wTitleMain.ondblclick=function(){
			_bMax.click();
		}
		
		_wTitleMain.onmouseup=function(){
			//move.isMove=0;
		}
		
		var _fettleRight=document.getElementById("fettleRight_"+num) //状态栏之右
		if (mode==1){
			_fettleRight.onmousedown=function(){
				if (win.bMax.maxType=="1"){return}
				zoom.objNum=id2num(this.id);	
				zoom.start();
			}
		}else{
			_fettleRight.style.display="none";
		}
		
	}
	
	
	this.findUpWin=function(){ //寻找最上层窗口
		var n=deskTop.winList.length
		var index=-1;
		var objNum=0;
		this.winCount=1;
		for (var i=0;i<n;i++){
			if (deskTop.winList[i]!=-1  ){
				this.winCount++;
				var obj=document.getElementById("wUP_"+deskTop.winList[i])
				if (parseInt(obj.style.zIndex)>index&obj.style.display!="none"){
					index=parseInt(obj.style.zIndex);
					objNum=obj.id.split("_")[1]
				}
			}
		}
		
		if (index!=-1){
			this.setButtonWidth();
			this.readObj(objNum);
			this.setUpwin();
		}
	}
    
	this.setButtonWidth=function(){  //设置任务栏按钮宽度
		this.winCount=1;
		var n=deskTop.winList.length
		for (var i=0;i<n;i++){
			if (deskTop.winList[i]!=-1){this.winCount++;}
		}

		var buttonWidth=parseInt(deskTop.taskWidth/this.winCount);
		if (buttonWidth>150){buttonWidth=150}
		var buttonMainWidth=buttonWidth-20;
		for (var i=0;i<n;i++){
			if (deskTop.winList[i]!=-1 ){
				obj=document.getElementById("winBotton_"+deskTop.winList[i]);
				obj.style.width=buttonWidth+"px";
				obj=document.getElementById("winBotton_main_"+deskTop.winList[i]);
				obj.style.width=buttonMainWidth+"px";
			}
		}
	}

	this.readObj=function(num){ /*依据编号把窗口恢复为当前窗口*/
		this.objNum=num;
		this.obj=document.getElementById("window_p_"+num);
		this.title=document.getElementById("wTitle_"+num);
		this.titleLeft=document.getElementById("wTitleLeft_"+num);
		this.titleMain=document.getElementById("wTitleMain_"+num)
		this.bMin=document.getElementById("bMin_"+num);
		this.bMax=document.getElementById("bMax_"+num);
		this.bClose=document.getElementById("bClose_"+num);
		this.job=document.getElementById("wJob_"+num);
		this.frame=eval("wIframe_"+num);
		this.fettleLeft=document.getElementById("fettleLeft_"+num);
		this.fettleRight=document.getElementById("fettleRight_"+num);	
		this.wUP=document.getElementById("wUP_"+num);	
		this.wUP1=document.getElementById("wUP1_"+num);	
		this.winBotton=document.getElementById("winBotton_"+num);
		this.winBotton_left=document.getElementById("winBotton_left_"+num);
		this.winBotton_main=document.getElementById("winBotton_main_"+num);
		this.winBotton_right=document.getElementById("winBotton_right_"+num);
	}
	
	
	this.setUpwin=function(){  //设置当前窗口
		var n=deskTop.winList.length
		//alert(this.objNum);
		for (var i=0;i<n;i++){
			if (deskTop.winList[i]!=-1){
				var obj=document.getElementById("wUP1_"+deskTop.winList[i])
				var objButton=document.getElementById("winBotton_"+deskTop.winList[i])
				var objBleft=document.getElementById("winBotton_left_"+deskTop.winList[i])
				var objBmain=document.getElementById("winBotton_main_"+deskTop.winList[i])
				var objBright=document.getElementById("winBotton_right_"+deskTop.winList[i])
				//alert(isObject(objButton));
				if (deskTop.winList[i]==this.objNum){
					obj.style.display="none";
					objButton.className="winBotton_2"
					objBleft.className="winBotton_left_2"
					objBright.className="winBotton_right_2"
					objBmain.className="winBotton_main_2"
					//alert(i+"不显示");
				}else{
					//alert(deskTop.winList[i]+"显示")
					obj.style.display="";
					objButton.className="winBotton_1"
					objBleft.className="winBotton_left_1"
					objBright.className="winBotton_right_1"
					objBmain.className="winBotton_main_1"
				}
			}
		}
	}
	
	
}








 function moveDiv(){  //移动对象类
     this.isMove=0;
     this.obj=null;
     this.Xmax=1024;
     this.Ymax=768;
     var x1=0;
     var y1=0;
	 var x2=0;
	 var y2=0;
	 var x3=0;
	 var y3=0;
	 this.moveOk=0;  //用于外部程序判定移动是否成功
     this.moveSize=10;  //移动的步长
	 
	 
     this.star=function(){
        x1=getmouseX()-getLeft(this.obj);
        y1=getmouseY()-getTop(this.obj);
		x2=getmouseX();
		y2=getmouseY();
		x3=getmouseX();
		y3=getmouseY();
		//alert(this.obj.id)
		if (this.obj.id.search("wUP_")>=0){
			win.wUP1.style.top="27px";
			win.wUP1.style.display="";
			document.getElementById("wUP1_"+win.objNum).style.height=(Element.getHeight(document.getElementById("window_p_"+win.objNum))-27)+"px"
		}
     }
     
     this.move=function(){
       if (this.isMove==1&this.obj!=null){
            x=getmouseX()-x1
            y=getmouseY()-y1
            if (x<=1){x=1;this.moveEnd();}
            if (y<=1){y=1;this.moveEnd();}
			//alert("moveOk变化")
			if (Math.abs(getmouseX()-x2)>10|Math.abs(getmouseY()-y2)>10){
            	this.moveOk=1;
			}
			if (Math.abs(getmouseX()-x3)>this.moveSize|Math.abs(getmouseY()-y3)>this.moveSize){
//				if (x+Element.getWidth(this.obj)>this.Xmax){x=this.Xmax-Element.getWidth(this.obj)}
//				if (y+Element.getHeight(this.obj)>this.Ymax){y=this.Ymax-Element.getHeight(this.obj)}
				if (x+100>this.Xmax){x=this.Xmax-100}
				if (y+100>this.Ymax){y=this.Ymax-100}
				if (x<1){
					x=1;
					this.moveEnd();		
					if (this.obj.id="icoIframe"){
						this.obj.style.zIndex="0";
					}
				}
				if (y<1){
					y=1;
					this.moveEnd();	
					if (this.obj.id="icoIframe"){
						this.obj.style.zIndex="0";
					}
				}
				this.obj.style.left=x
				this.obj.style.top=y
				x3=getmouseX();
				y3=getmouseY();
			}
			
			//selectCarDivBody.innerHTML=this.Xmax+","+this.Ymax
        }
     }
     
	 this.moveEnd=function(){
		 if (this.isMove==1){
			 if (this.obj.id.search("wUP_")>=0){
				win.wUP1.style.display="none";
				document.getElementById("wUP1_"+win.objNum).style.height=Element.getHeight(document.getElementById("window_p_"+win.objNum))+"px"
				win.wUP1.style.top="0px";
			 }
			 this.moveOk=0;
			 this.isMove=0;
			
		 }
	}
}


function zoomDiv(){  //缩放窗口类
	this.objNum=null;
	this.zoomSize=5;
	this.zoomMinX=500;
	this.zoomMinY=400;
	this.isZoom=0;
	var x1=0;
	var y1=0;
	var tempObj=null;
	var wObj=null;
	var hObj=null;
	var tSize=27;
	var bSize=24
	var wObj=null;
	var hObj=null;
	var obj=null;
	var obj_1=null
	
	
	this.start=function(){
		if (this.objNum==null){ return }
		wObj=document.getElementById("window_p_"+this.objNum);
		hObj=document.getElementById("wJob_"+this.objNum);
		obj=document.getElementById("wUP_"+this.objNum);
		obj_1=document.getElementById("wUP1_"+this.objNum);
		tempObj=document.getElementById("zoomBorder");
		this.isZoom=1;
		tempObj.style.left=obj.style.left;
		tempObj.style.top=obj.style.top;
		tempObj.style.width=Element.getWidth(wObj);
		tempObj.style.height=Element.getHeight(wObj);
		tempObj.style.display="block";
		x1=getLeft(obj);
		y1=getTop(obj);
		
//		obj_1.style.top=tSize+"px";
		//alert(Element.getHeight(obj)-tSize);
		obj_1.style.height=Element.getHeight(wObj)+"px"
		obj_1.style.display="";
	}
	
	this.zoom=function(){
		if (this.isZoom==1){
			var x2=getmouseX();
			var y2=getmouseY();
			if (x2<x1+this.zoomMinX|y2<y1+this.zoomMinY){return }
			var w=x2-x1;
			var h=y2-y1;
			tempObj.style.width=w+"px";
			tempObj.style.height=h+"px";
		}
	}
	
	this.end=function(){
		if (this.isZoom==1){
			//alert(tempObj.style.width)
			obj.style.width=tempObj.style.width;
			obj.style.height=tempObj.style.height;
			wObj.style.width=Element.getWidth(tempObj);
			hObj.style.height=Element.getHeight(tempObj)-tSize-bSize;
			win.titleMain.style.width=(Element.getWidth(tempObj)-Element.getWidth(win.titleLeft)-120)+"px";
			this.isZoom=0;
			this.objNum=null;
			obj_1.style.top="0px";
			obj_1.style.width=Element.getWidth(tempObj)+"px";
			obj_1.style.height=(Element.getHeight(tempObj)+11)+"px";
			obj_1.style.top="0px";
			obj_1.style.display="none";
			tempObj.style.width="0px";
			tempObj.style.height="0px";
			tempObj.style.left="0px";
			tempObj.style.top="0px";
			tempObj.style.display="none";
			try {
			win.frame.setWH();
			}catch(e){}
			//var a=eval(win.frame.id)
//			alert(a.setWH);
		}
	}
	
	
}


function id2num(id){  //把ID转为编号
	var strn=id.split("_");
	num=strn[strn.length-1];
	return parseInt(num)
}


function WALL_web(){
	try{
		var WshShell = new ActiveXObject('WScript.Shell')
		WshShell.SendKeys('{F11}');
	}catch(e) {
		var msg="系统不能正常全屏, 请你按键盘上的 \"F11\" 键, 使系统全屏显示\n\n";
			 msg=msg+" 或是把本站在 Internet选项 的安全项中, 加入可信任站点, 并设置可信任站点允许使用ActiveX控件\n\n";
			 msg=msg+" 在系统提示是否允许使用ActiveX控件时, 请选择是";
			 
			 alert(msg)
			 
	}
}

function icoHTML(str){
	var icoStr=""
	str=str.toLowerCase();
	if (str.search(/\./g)==-1){
		icoStr="<img src='ico/ico1.gif'>";
		return icoStr;
	}

	if (win.ieVer!=7){
		if (str.search(".png")!=-1){
			icoStr="<img src='ico/ico1.gif'>";
		}else{
			icoStr="<img src='"+str+"'>";
		}
	}else{
		if (str.search(".png")!=-1){
			icoStr="<div style='width:50px;height:50px;background-image:url('"+str+"');'></div>";
		}else{
			icoStr="<img src='"+str+"'>";
		}
	}
	return icoStr;
	
}