var c1="※";
var c2="⊙";
var c3="‖";

//检测当前的版本
function isWxVersion(){
var objAjax=new JAjax();   
    var isWx=false;
    var out=objAjax.getText("post","../../wxProgram/server/wx_Judge.aspx?type=judgeWx",null,null);
    if(out=="1"){
        isWx=true;
    }
    return isWx;
}
function loadBodyclick(){  // 在点击窗口的时候关闭开始菜单 
	document.body.onmousedown=function(){
		try{	
			parent.sMenu.close();
				//parent.move.moveEnd();
				//parent.zoom.end();				
		}catch(e) {}
	}
	document.body.onselectstart=function(){
	    if(document.activeElement.tagName!='INPUT'&document.activeElement.tagName!='TEXTAREA')
	    {
	        return false;
	    }
	}
	document.body.oncontextmenu=function(){
	    if(document.activeElement.tagName!='INPUT'&document.activeElement.tagName!='TEXTAREA'){
	        
    	    return false
	    }else{
	        try{
	            if (rmenu!=null){
	              return false
	            }
	        }catch(e) {}
	    }
	}
}

function writeFettleLeft(text){ //往当前窗口状态栏写文本;
	try{
		if (text==null){
			text="   提示: 在右键菜单中可以找到你最常用的功能选项"
		}
		parent.win.fettleLeft.innerText=text;
	}catch(e) {}
}

function closeWindow(){  //关闭当前正打开的窗口
	try{
		parent.win.bClose.click();
	}catch(e) {}
}

function menuClass(){    //系统菜单定义类
	var menuList =new Array();
	this.tempDiv=null;
	this.isClose=0;
	this.isOpen=0;
	this.tempObj=null;
	
	
	this.addMain=function(menuText,menuRun,title){ /*菜单名字,  菜单要运行的程序, 说明*/
		var i=menuList.length;
		menuList[i]=new Array();
		menuList[i][0]=new Array();
		menuList[i][0][0]=menuText;
		menuList[i][0][1]=menuRun;
		menuList[i][0][2]=title;
	}
	
	this.addMenu=function(num,menuText,menuRun,title){ /*添加子菜单,菜单的主序号,菜单的名字, 运行的程序,说明*/
		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]=menuRun;
		menuList[num][i][2]=title;
		
	}
	
	this.create=function(obj){
		
		if (!isArray(menuList[0])){
			alert("主菜单没有定义");
			return null;
		}
		if (!isArray(menuList[0][0])){
			alert("没有发现子菜单定义");
			return null;
		}
		
		for (var i=0;i<menuList.length;i++){
			var tempObj=document.createElement("div");
			tempObj.id="hiwebMenu";
			var newObj=obj.appendChild(tempObj);
			newObj.innerText=menuList[i][0][0];
			newObj.run=menuList[i][0][1];
			newObj.num=i;
			if (menuList[i][0][2]!=null&menuList[i][0][2]!=""){
				
				newObj.title=menuList[i][0][2];
			}
			newObj.onclick=function(){  //主菜单被点击
				menu.isOpen=1;
				eval(this.run);
				menu.isClose=0;
				menu.readMenu(parseInt(this.num),this)
			}
			
			newObj.onmouseover=function(){  //鼠标移到主菜单
				this.className="hiwebMenu_1";
				menu.isClose=0;
				if (menu.isOpen==1){
					menu.readMenu(parseInt(this.num),this)
				}
				if (menu.tempObj!=null&menu.tempObj!=this){
					menu.tempObj.className="";
				}
				menu.tempObj=this;
			}
			
			newObj.onmouseout=function(){   //鼠标离开主菜单
				//this.className="";
				//if (menu.isOpen==1){
					menu.isClose=1;
					setTimeout("menu.closeMenu()",1000);
				//}
			}
		}
		
		tempObj=document.createElement("div");
		tempObj.id="hiwebTempMenu";
		newObj=document.body.appendChild(tempObj);
		newObj.onmouseover=function(){
			menu.isClose=0;
			
		}
		newObj.onmouseout=function(){
			menu.isClose=1;
			setTimeout("menu.closeMenu()",2000);
		}
		this.tempDiv=newObj;
	}
	
	this.closeMenu=function(){  //关闭子菜单
		if (this.isClose==1){
			this.tempDiv.style.display="none";
			this.isOpen=0;
			if (this.tempObj!=null){
				this.tempObj.className="";
				this.tempObj=null;
			}
		}
	}
	
	this.readMenu=function(num,mObj){
		this.isClose=0;
		var m=menuList[num];
		this.tempDiv.style.display="block";
		var x=getLeft(mObj);
		var y=getTop(mObj);
		this.tempDiv.style.left=x+"px";
		this.tempDiv.style.top=(y+22)+"px";
		this.tempDiv.innerHTML="";
		for (var i=1;i<m.length;i++){
			var tempObj=document.createElement("div");
			tempObj.id="hiwebTempDownMenu";
			tempObj.className="hiwebTempDownMenu";
			var newObj=this.tempDiv.appendChild(tempObj);
			newObj.innerText=m[i][0];
			newObj.run=m[i][1];
			if (m[i][2]!=null&m[i][2]!=""){
				newObj.title=m[i][2]
			}
			newObj.onmouseover=function(){
				menu.isClose=0;
				this.className="hiwebTempDownMenu_1";
			}
			newObj.onmouseout=function(){
				this.className="hiwebTempDownMenu";
				menu.isClose=1;
				setTimeout("menu.closeMenu()",2000);
			}
			
			newObj.onclick=function(){
				menu.isClose=1;
				menu.closeMenu();
				eval(this.run)
			}
			
		}
	}
}



function toolsClass(){  //工具栏定义类
	var toolsList=new Array();
	
	
	this.add=function(img,text,run,title){
		var i=toolsList.length;
		toolsList[i]=new Array();
		toolsList[i][0]=img;
		toolsList[i][1]=text;
		toolsList[i][2]=run;
		toolsList[i][3]=title;
	}
	
	this.create=function(obj){
		for (var i=0;i<toolsList.length;i++){
			var tempObj=document.createElement("div");
			tempObj.id="hiwebTools";
			var newObj=obj.appendChild(tempObj);
			if (toolsList[i][0]!=""&toolsList[i][0].search(".")>1){
				var html="<img style='width:18px;height:18px;border:0px;' src='"+toolsList[i][0]+"'>  <span class='toolsText'>"+toolsList[i][1]+"</span>"
			}else{
				var html="<img style='visibility:hidden;width:18px;height:18px;border:0px;' src='"+toolsList[i][0]+"'> <span class='toolsText'> "+toolsList[i][1]+"</span>"
			}
			newObj.innerHTML=html;
			newObj.run=toolsList[i][2];
			if (toolsList[i][3]!=null&toolsList[i][3]!=""){
				newObj.title=toolsList[i][3];
			}
			
			newObj.onmouseover=function(){
				this.className="hiwebTools_1";
			}
			
			newObj.onmouseout=function(){
				this.className="";
			}
			
			newObj.onclick=function(){
				eval(this.run);
			}
			
		}
	}
}



function optionClass(){   //选项卡实现类
	this.titleObj=null;
	this.bodyObj=null;
	this.bodyHeight=null;
	this.d=0;
	this.create=function(){
		if (this.titleObj==null){
			alert("对象未定义");
		}
		for (var i=0;i<this.titleObj.length;i++){
			this.titleObj[i].i=i;
			this.titleObj[i].bodyName=this.bodyObj[i].id;
			
			this.titleObj[i].onmousedown=function(){
				
				var obj=document.getElementsByName(this.bodyName);
				var obj1=document.getElementsByName(this.name);
				for (var i=0;i<obj.length;i++){
					if (i==parseInt(this.i)){
						obj[i].style.display="block";
						this.className=this.id+"_1";
					}else{
						obj[i].style.display="none";
						obj1[i].className=this.id;
						
					}
				}
			}
			
			this.titleObj[i].onmouseout=function(){
				//this.className="";
			}
			
			if (i==this.d){
				this.titleObj[i].className=this.titleObj[i].id+"_1";
				this.bodyObj[i].style.display="block";
			}else{
				this.bodyObj[i].style.display="none";
				this.titleObj[i].className=this.titleObj[i].id+"";
			}
			if (this.bodyHeight!=null){
				
				this.bodyObj[i].style.height=this.bodyHeight+"px";
			}
		}
	}
}



function validate(){
// 数据验证类
	this.form=null; 
	
	this.vString=function(v)
	{ // 判断一个字符串是否合法
		if (v.search(/※⊙\{\}]{1,}/g)>=0){
			return false;
		}
		return true;
	}
	
	this.start=function(){
		
		for (var i=0;i<this.form.elements.length;i++){
			var e = this.form.elements[i];
			
			if (e.isV!=null){
				//alert(e.id)
				if (e.value.length>parseInt(e.max)){
					alert("“"+e.title+"”的内容长度不能超过"+e.max+"个字符,现长度为:"+e.value.length);
					this.focus(e);
					return false;
				}
				
				if (e.min!=null & e.min!="" & e.value!="" & e.isNum!="1"){
					if (e.value.length<parseInt(e.min)){
						alert("“"+e.title+"”的内容长度不能小于"+e.min+"个字符,现长度为:"+e.value.length);
						this.focus(e);
						return false;
					}
				}
				
				if (e.value=="" & e.notNull=="1"){
					alert("“"+e.title+"”的内容不能为空");
					this.focus(e);
					return false;
				}
				
				if (e.isNum=="1"&isNaN(e.value)){
					alert("“"+e.title+"”只能是数字");
					e.value="";
					this.focus(e);
					return false;
				}
				
				if (e.isNum=="1"&parseInt(e.value)>parseInt(e.max)){
					alert("“"+e.title+"”不能超过"+e.max);
					this.focus(e);
					return false;
				}
				
				if (e.min!=null&e.min!=""){
					if (e.isNum=="1"&parseInt(e.value)<parseInt(e.min)){
						alert("“"+e.title+"”不能小于"+e.min);
						this.focus(e);
						return false;
					}
				}
				
				if (e.isMail=="1"){
					var str=e.value;
					if (str.search(/^[^\n]{1,}@[^\n]{1,}\.[^\n]{1,}$/g)==-1){
						alert("“"+e.title+"”不是一个正确的EMAIL地址");
						this.focus(e);
						return false;
					}
				}
				
				if (e.isIP=="1"){
				    var str=e.value;
				    if (!isIP(str)){
				        alert("“"+e.title+"”不是一个正确的IP地址");
				        this.focus(e);
				        return false;
				    }
				}
				
				if (e.isDate=="1"){
				    var str=e.value;
				    if (!Date.isValidDate(str,"-") & str!=""){
				        alert("“"+e.title+"”不是一个正确的日期, 格式为：  yyyy-MM-dd\n如：1980-1-1");
				        this.focus(e);
				        return false;
				    }
				}
				
				if (e.value.search(/[※⊙]{1,}/g)>=0){
					alert("“"+e.title+"”中包含被禁用的符号※⊙");
					this.focus(e);
					return false;
				}
			 

				if (e.useHTML!="1"){
				 // alert(e.useHTML);
					if (e.value.search(/[\\>'\{\}\(\)\]\[]{1,}/g)>=0){
						alert("“"+e.title+"”中包含特殊字符,系统中禁止使用(<>'\=[]{}这些字符");
						this.focus(e);
						return false;
					}
				}
			}
		}
		return true
	}
	
	this.focus=function(obj){
		try {
			obj.focus();
		}catch(e) {}

	}
}


function isIP(str){ //判断一个字符串是不是IP　是返回true
    var strL=str.split(".");
    if (strL.length!=4){
        return false;
    }
    var s="";
    for (var i=0;i<4;i++){
        s=strL[i];
        if (isNaN(s)){
            return false;
        }
        
        s=parseInt(s);
        if (s>255 | s <1){
            return false;
        }   
    }
    return true;
  //122.224.4.122
}





function rightmenu(){ //右键菜单类
	 var menu=new Array();
	 var i=0;
	 var iscreate=0;
	 this.Xmax=null;
	 this.Ymax=null;
	 this.bgimg=null;
	 this.limg=null;
	 var left=null;
	 var top=null;
	 this.isStop=1; //是否允许创建右键菜单
	 
	 this.add=function(MenuName,PidRun){
		 menu[i]=new Array();
		 menu[i][0]=MenuName;
		 menu[i][2]=PidRun;
		 i++
	}
	
	this.create=function(){
		if (this.isStop==0){
			return ;
		}
		
		var limg=""
		var bgimg=""
		if (this.bgimg!=null){
			bgimg="background-image : url(\""+this.bgimg+"\");"
		}else{
			bgimg="background-color:#f1f1f1;"			
		}
		if (this.limg!=null){
		    limg="background-image : url(\""+this.limg+"\");"
		}
		var html="<table cellspacing=0 cellpadding=0 width='175' style='"+bgimg+"border: 1px solid #979797'>"
		html=html+"<tr><td width='35' align='right' style='border-right: 2px inset #FFFFFF;"+limg+"'>&nbsp;"
		html=html+"</td><td width=140>";
		var downMenu=""
		var num=0
		for (var x=0;x<i;x++){
			if (menu[x][0]!="|"&menu[x][0]!=""){
				if (x<i-1){
					downMenu=menu[x+1][0]
				}else{
				    downMenu=""
				}
				if (downMenu!="|"){
					num++;
					html=html+"<div id='Rmenuoption' i='"+x+"' style='cursor:default;padding-left:3px;padding-top:5px;height:22px;width:140px;overflow : hidden;word-break : keep-all ;'>"+menu[x][0]+"</div>";
				}else{
					num=num+1
					html=html+"<div id='Rmenuoption' i='"+x+"' style='cursor:default;padding-left:3px;padding-top:5px;height:22px;width:140px;overflow : hidden;word-break : keep-all ;border-bottom: 2px inset #FFFFFF;'>"+menu[x][0]+"</div>";
				}
			}
		}
		html=html+"</td></tr></table> <div id='Rmenuoption'></div>";
		
		var RmenuDiv=document.getElementById("rmenuDiv001")
		if (RmenuDiv==null){
			var tempObj=document.createElement("div");
			RmenuDiv=document.body.appendChild(tempObj);
			RmenuDiv.id="rmenuDiv001";
			RmenuDiv.style.cssText="position:absolute;"
		}
		
		RmenuDiv.style.zIndex=1000001;
		var x=getmouseX();
		var y=getmouseY();
		if (this.Xmax!=null&this.Ymax!=null){
			if (x+175>this.Xmax){x=this.Xmax-175}
			if (y+22*num>this.Ymax){y=this.Ymax-22*num-2}
		}
		if (this.left!=null){x=this.left}
		if (this.top!=null){y=this.top}
		this.top=null
		this.left=null
		RmenuDiv.style.left=x
		RmenuDiv.style.top=y
		RmenuDiv.style.display="";
		iscreate=1
		//alert(html)
		RmenuDiv.innerHTML=html;
		var Rmenuoption=document.all.Rmenuoption;
		for (x=0;x<Rmenuoption.length-1;x++){
			Rmenuoption[x].onmouseover=function(){
				this.style.backgroundColor='#dfdfdf'
			}
			
			Rmenuoption[x].onmouseout=function(){
				this.style.backgroundColor=''
			}
			
			Rmenuoption[x].onclick=function(){
				//alert("执行程序")
				rmenu.run(parseInt(this.i))
			}
		}
		
		
	}
	
	this.run=function(x){
		eval(menu[x][2])
		this.clear();		 
	}
	
	 this.clear=function(){
		 i=0;
		 if (iscreate==1){
			 rmenuDiv001.style.display="none";
			 iscreate=0
		 } 
	}
}
 
 
 
 
 

//****************
//以下用于分页显示数据的对象和函数
//*****************

function outTitle(){  //用来显示内容区的标题
   var title=new Array();
   this.obj=null;
   this.setW=0;
   var wAll=0;
   
   this.add=function(titleText,clickText,width){
	   var l=title.length;
	   title[l]=new Array();
	   title[l][0]= titleText;
	   title[l][1]=clickText;
	   title[l][2]=width;
   }
	
	this.create=function(){
		if (this.obj==null){
			  return  null;
		}
		for (var i=0;i<title.length;i++)
		{
			var tempObj=document.createElement("span");
			var div=this.obj.appendChild(tempObj);
			div.style.width=title[i][2]+"px";
			wAll=wAll+parseInt(title[i][2]);
			div.className="listTitleOption";
			div.innerText=title[i][0];
			div.clickText=title[i][1];
			div.id="_TabListTitle";
			div.name="_TabListTitle";
			div.sel="0";
			
			div.onmouseover=function(){
				this.className="listTitleOption_1";
			}
			
			div.onmouseout=function(){
				this.className="listTitleOption";
				
			}
			
			div.onclick=function(){
				if (this.clickText!=""){
					var objs=document.getElementsByName("_TabListTitle")
					for (var i=0;i<objs.length;i++){
						if (objs[i].sel=="1" & objs[i]!=this){
							objs[i].sel="0";
							objs[i].style.className="listTitleOption";
						}
					}
					this.sel="1";
					this.className="listTitleOption_1";
					eval(this.clickText);
				}
			}
			
			
		}
		if (this.setW==1){
			this.obj.style.width=wAll+"px"
		}
		
	}
	
	
}





	
function outPage(){ //用于输出分页显示内容的类
	this.obj=null               //显示分页的对象
	this.pageArray=null;        //保存分页数据的数组
	this.run=null;              //分页运行的程序名
	this.mode=0;                 //分页的显示格式
	this.pClass="";              //上一页, 下一页的样式表
	this.pid="pageDiv_";          //上一页, 下一页的ID
	this.language="c";
	
	this.create=function(){     //创建分页
	
		if (this.obj==null | this.pageArray==null | this.run==null){
			  return  null;
		}

		var p=this.pageArray;
		if (isNaN(p[1])){
		    return;
		}		
		switch  (this.mode){
			case 0:
				switch (this.language){
					case "e":
						this.obj.innerText="A total of "+p[0]+", points"+p[1]+", p."+p[2]+" ";
						break;
					default:
					this.obj.innerText="一共有"+p[0]+"条, 分"+p[1]+"页, 第"+p[2]+"页 ";
					break;
				}
				break;
			case 1:
				switch (this.language){
					case "e":
						this.obj.innerHTML="A total of "+p[0]+" <span style='width:10px'></span>"+p[2]+"/"+p[1]+"";
						break;
					default:
						this.obj.innerHTML="共"+p[0]+"条 <span style='width:10px'></span>"+p[2]+"/"+p[1]+"";
						break;
				}
				break;
		}
	
	   var l_home,l_end;
	   switch (this.language){
		   case "e":
		   		l_home="home";
		   	   l_end="Last";
			   break;
		    default :
				l_home="首页";
				l_end="尾页";
				break;
	   }
	
		var tempObj=document.createElement("span");
		var div=this.obj.appendChild(tempObj);
		div.style.cssText="width:60px;text-align:center;cursor:default "
		div.className=this.pClass;
		div.pid=this.pid+"up";
		div.innerText=l_home;
		if (p[2]>1){
			div.runText=this.run+"(1)"
			div.onclick=function(){
				eval(this.runText);
			}
		}else{
			div.style.color="#c0c0c0";
		}
		
		var start=parseInt(p[2])-3;
		if (start<1){start=1}
		var end=parseInt(p[2])+3;
		if (end>parseInt(p[1])){end =parseInt(p[1])}
		//alert(end)
		if (end > start){
			for (var i=start;i<=end;i++){
				tempObj=document.createElement("span");
				div=this.obj.appendChild(tempObj);
				div.style.cssText="border: 1px solid #C0C0C0;background-color:#F2F2F2;margin:2px;text-align:center;cursor:default "
				div.className=this.pClass;
				div.pid=this.pid+"down";
				div.innerText=" "+i+" ";
				if (i!=parseInt(p[2])){
					div.runText=this.run+"("+i+")"
					div.onclick=function(){
						//alert(this.runText);
						eval(this.runText);
					}
				}else{
					div.style.color="#c0c0c0";
				}
			}
		}
		
		tempObj=document.createElement("span");
		div=this.obj.appendChild(tempObj);
		div.style.cssText="width:60px;text-align:center;cursor:default "
		div.className=this.pClass;
		div.pid=this.pid+"down";
		div.innerText=l_end;
		if (p[2]<p[1]){
			div.runText=this.run+"("+(parseInt(p[1]))+")"
			div.onclick=function(){
				//alert(this.runText);
				eval(this.runText);
			}
		}else{
			div.style.color="#c0c0c0";
		}
		//显示完成, 清空初始化参数;
		this.obj=null              
		this.pageArray=null;     
		this.run=null; 
	}
	
}


function tabList()//用于列表显示数据
{
	var data=new Array();  //要显示的数据列
	var dClass=new Array(); //各列的样式表
	var dWidth=new Array(); //各列的宽度
	var id=null;
	this.obj=null;           //把数据写到哪个对象中.
	this.rowClass="";         //各行的样式表
	this.rowid="";            //行的ID
	this.isCheckbox=false;   //是否显示一个复选框在最前面
	this.checkBoxID="";       //复选框的名字
	this.onmouseroverRun="";  //鼠标移上去后要执行的程序
	this.onmouseroutRun="";   //鼠标移开后要执行的程序
	this.onclickRun="";       //鼠标点击后要执行的程序
	this.ondblclickRun="";    //鼠标双击后要执行的程序
	
	
	this.addid=function(addData){
		id=addData
	}
	
	this.add=function(addData,addClass,w){ //添加一个数据显示列, 1 数据列, 2 样式表, 3 列宽
		if (!isArray(addData)){
			  return  null;
		}
		if (addData.length==0){
			  return  null;
		}
		var l=data.length;
		data[l]=addData;
		dClass[l]=addClass;
		dWidth[l]=w;
	}

	this.create=function(){ //创建表格
		
		if (this.obj==null|data.length==0 |id==null){
			 return  null;
		}
		if (id.length==0)
		{
			return null;
		}
		var obj=this.obj;
		obj.innerHTML="";
		var rl=data[0].length; //行数
		var ll=data.length;     //列数
		for (var i=0;i<rl;i++){
			var tempObj=document.createElement("div");
			var div=obj.appendChild(tempObj);
			div.className=this.rowClass;
			div.tid=id[i];
			div.id=this.rowid; 
			div.name=this.rowid;
			div.i=i;
			div.overText=this.onmouseroverRun;
			div.outText=this.onmouseroutRun;
			div.clickText=this.onclickRun;
			div.cdblText=this.ondblclickRun;
			
			if (this.onmouseroverRun!="" & this.onmouseroverRun!=null){
				div.onmouseover=function(){
					eval(this.overText+"(this)")
				}
			}
			
			if (this.onmouseroutRun!="" & this.onmouseroutRun!=null){
				
				div.onmouseout=function(){
					eval(this.outText+"(this)")
				}
			}
			
			if (this.onclickRun!="" & this.onclickRun!=null){
				div.onclick=function(){
					eval(this.clickText+"(this)")
				}
			}
			
			//alert(this.ondblclick)
			if (this.ondblclickRun!="" & this.ondblclickRun!=null){
				div.ondblclick=function(){
					eval(this.cdblText+"(this)")
				}
			}
			
			for (var x=0;x<ll;x++){
				tempObj=document.createElement("span");
				ldiv=div.appendChild(tempObj);
				if (x==0 & this.isCheckbox){
					ldiv.innerHTML= "<input name='"+this.checkBoxID+"' id='"+this.checkBoxID+"' type='checkbox' value='"+id[i]+"' >"+  data[x][i];
				}else{
					ldiv.innerText=data[x][i];
				}
				ldiv.title=data[x][i];
				
				ldiv.id=this.rowid+"_"+x;  //创建列名
				ldiv.name=this.rowid+"_"+x; //创建列名
				if (dClass[x]==""){
					ldiv.style.cssText="height:20px;overflow:hidden;cursor:default"
				}
				ldiv.className=dClass[x];
				if (dWidth[x]!=""){
					ldiv.style.width=dWidth[x]+"px";
				}
				
			}
		}
		
		data.clear();
		dClass.clear();
		dWidth.clear();
		id=null;
	}

}


function raadArray(A,line,x){ //把数组中的指定列读到一个数组中 A 要读取 的数组, l 要读的列数 X是否从0开始读, 默认从1开始读
	var l=A.length;

	var out=new Array();
	if (x!=null){
		x=0;
	}else{
		x=1;
	}
	for (var i=x;i<l-1;i++){
		out[i-x]=A[i][line];
		
	}
	return out;
}

//****************
//以上用于分页显示数据的对象和函数
//*****************



function itemClass(){  //用于读出设置的下拉菜单, 单选, 复选,
	this.obj=null;                 //写入选项的对象
	var optionList=new Array();    //要读的选项的名字
	var optionName=new Array();
	var optionClass=new Array();
	this.mode="name";           //用NAME来读数据  可设置为用sindex来读数据
	
	this.add=function(name,optName,optClass){ //增加一个要读取的菜单项目. 要增加的选项对象的名字
		var l= optionList.length;
		optionList[l]=name;
		optionName[l]=optName;
		optionClass[l]=optClass;
		
	}
	
	this.clear=function(){
		optionList.clear();    //要读的选项的名字
		optionName.clear();
		optionClass.clear();
	}
	
	this.create=function(sysPath){ //创建菜单
		var l= optionList.length;
		if (l==0 | this.obj==null){
			return;
		}
	    for (var i=0;i<l;i++){
			var objResponse=new JHttpResponse();
			objResponse.write("optionName",optionList[i]);
			objResponse.write("mode",this.mode);
			if (sysPath==null | sysPath=="" | sysPath=="myWeb/"){
				var out=objAjax.getText("post","../server/hiwebServer.aspx?type=readOption",objResponse,null);
			}else{
				var out=objAjax.getText("post",sysPath+"../server/hiwebServer.aspx?type=readOption",objResponse,null);
			}
			//alert(out);
			
			out=comminute(out,c1,c2);
			if (out.length==0){
				return;
			}
			
			var tempObj=document.createElement("span");
			var div=this.obj.appendChild(tempObj);
			div.id="hiweb_optionDiv"+out[0][4];
			if (this.mode=="name" ){
				
			  div.innerText=optionList[i].split("-")[0]+":";
			}
			div.className=optionClass[i]
			
		    switch (out[0][3]){
				case "0":
				    tempObj=document.createElement("select");
					tempObj.id="hiweb_selectMain"+optionName[i]
					var selectObj=div.appendChild(tempObj);
					selectObj.textName=optionName[i];
					
				    tempObj=document.createElement("select");
					tempObj.id="hiweb_selectDown"+optionName[i]
					var selectDownObj=div.appendChild(tempObj);
					selectDownObj.style.display="none";
					selectDownObj.textName=optionName[i];
					
				    tempObj=document.createElement("input");
					tempObj.type="hidden";
					//tempObj.type="text";
					var textObj=div.appendChild(tempObj);
					textObj.id=optionName[i];
					textObj.name=optionName[i];
					textObj.value=out[0][1]
					
					for (var x=0;x<out.length-1;x++){
						var opt=document.createElement("option");
						opt.text=out[x][0];
						opt.value=out[x][1];
						if (out[x][2]!=""&out[x][2]!=null){
							var dMenu=out[x][2].replace(/\r\n/g,c1)
							opt.dMenu=dMenu;
						}
						selectObj.options.add(opt);
					}
					
					selectObj.onchange=function(){
						var dName=this.id.replace(/Main/g,"Down")
						var downObj=document.getElementById(dName)
						var dMenu=this.options[this.selectedIndex].dMenu;
						if (dMenu=="" |dMenu==null){
							downObj.style.display="none";
							textObj=document.getElementById(this.textName);
							textObj.value=this.options[this.selectedIndex].value;
						}else{
							var dList=dMenu.split(c1);
							
							downObj.style.display="";
							
							var l=downObj.options.length
							for (var i=0;i<l;i++){
								
								downObj.options[0].removeNode(true);
							}
							for (i=0;i<dList.length;i++){
								var opt=document.createElement("option");
								opt.text=dList[i];
								opt.value=dList[i];
								downObj.options.add(opt);
							}
							downObj.onchange=function(){
								//alert(this.outerHTML)
								textObj=document.getElementById(this.textName);
								textObj.value=this.options[this.selectedIndex].value;
							}
							//alert(dList)
							//alert(downObj.outerHTML);
						}
					}
					break;
			case "1":
			//mainItemText,mainItemValue,downItem,itemType,sindex
			//0              1             2         3        4
				for (var x=0;x<out.length-1;x++){
					if (x==0){
						html="<input checked type='radio' id='"+optionName[i]+"_"+x+"' name='"+optionName[i]+"' value='"+out[x][1]+"'>"
					}else{
						html="<input type='radio' id='"+optionName[i]+"_"+x+"' name='"+optionName[i]+"' value='"+out[x][1]+"'>"
					}
					html=html+"<label for='"+optionName[i]+"_"+x+"'>"+out[x][0]+"</label>&nbsp;&nbsp;";
					div.innerHTML=div.innerHTML+html;
				}
				break;
			case "2":
				for (var x=0;x<out.length-1;x++){
					if (x==0){
						html="<input checked  type='checkbox' id='"+optionName[i]+"_"+x+"' name='"+optionName[i]+"' value='"+out[x][1]+"'>"
					}else{
						html="<input type='checkbox' id='"+optionName[i]+"_"+x+"' name='"+optionName[i]+"' value='"+out[x][1]+"'>"
					}
					html=html+"<label for='"+optionName[i]+"_"+x+"'>"+out[x][0]+"</label>&nbsp;&nbsp;";
					div.innerHTML=div.innerHTML+html;
				}
				break;
			}
			
		
			//alert(out);
		}
		this.clear();
	}
}








function  comminute(str,c1,c2){
	//字符串， 保存到二维数组中 c1,第一次分割符C2第二次分隔符
	var u=str.split(c1)
	var o=new Array();
	for (var i=0;i<u.length;i++){
		o[i]=new Array();
		var t=u[i].split(c2);
		for (var x=0;x<t.length;x++){
			o[i][x]=t[x];
		}
	}
	return o;
}

function create_id(){  //生成对象的ID
   var objdate=new Date()
   var o_datetime
   o_datetime=""
   o_datetime=o_datetime+objdate.getHours()
   o_datetime=o_datetime+objdate.getMinutes()
   o_datetime=o_datetime+objdate.getSeconds()
   var o_r=Math.random()
   o_r=o_datetime+parseInt(o_r*1000)
   return o_r
}

function delpx(s){ //删除长宽后的PX
	s=s+"";
	s=s.toLowerCase();
	s=s.replace("px","");
	s=parseInt(s);
    return s
}

function readPar(url,parName){ //找出URL中指定的参数 返回字符串
	var p=null;
	if (url==null){
		url=location.href;
	}
	if (url.search(/\?/g)==-1){return p;}
	url=url.split("?");
	url=url[1].split("&");
	for (var i=0;i<url.length;i++){
		var p1=url[i].split("=");
		if(p1[0]==parName){
			p=p1[1]
			break;
		}
	}
	return p;
	
}

function getField(data,flist,field){ //取出字段的值 data 数据数组, flist 字段名列表数组 , field 要读的字段字符串
	for (var i=0;i<flist.length;i++){
		if (flist[i].toLowerCase()==field.toLowerCase()){
			 return data[i];
		}			
	}	
	return -1;
}

function getTop(e){
//获得对象的Y坐标（相对于页面）
	var t=e.offsetTop;
	while(e=e.offsetParent){
		t+=e.offsetTop;
		}
	return t;
}
 
function getLeft(e){
//获得对象的X坐标（相对于页面）
	var l=e.offsetLeft;
	while(e=e.offsetParent){
		l+=e.offsetLeft;
		}
	return l;
}

function getmouseX(){
   var x=window.event.clientX;
   return x;
}

function getmouseY(){
   var y=window.event.clientY;
   return y;
}



function findSelect(objname,value){ //依据下拉菜单的名字, 和已选择项值, 创建出已选择的项目 , 此功能仅用于系统设置的下拉菜单
	var mSelect=document.getElementById("hiweb_selectMain"+objname);
	if (!selectoption(mSelect,value)){
		//alert(value);
		var opt=document.createElement("option");
		opt.text=value;
		opt.value=value;
		opt.selected=true;
		mSelect.options.add(opt);
	}
}


  function selectoption(obj,v){ //在下拉菜单中选择一个指定的选择项
      for (var i=0;i<obj.options.length;i++){
	     //  alert(v+"\n"+obj.options[i].value);
	      if (obj.options[i].value==v){
			
		     obj.options[i].selected=true;
			 return true;
			 break;
		  }
	  }
	  return false;
  }
  
  function selectoptionText(obj,t){ //在下拉菜单中选择一个指定的选择项, 和TEXT匹配 .
      for (var i=0;i<obj.options.length;i++){
	      if (obj.options[i].text==t){
		     obj.options[i].selected=true;
			 return true;
			 break;
		  }
	  }
	  return false;
  }
  
  function selectDelvalue(obj,v){ //删除下拉菜单中值为V的选项
     var l=obj.options.length
     for (var i=0;i<l;i++){
	      if (obj.options[i].value==v){
		     obj.options[i].removeNode(true);
			 break;  
		  }
	  }
  }
  
  function selectdel(obj,v){ //从下拉菜单中删除没有使用的选项,即值不为V的选项.
    // selectObj.options.remove(index);
     var l=obj.options.length
	 var x=0
     for (var i=0;i<l;i++){
	      if (obj.options[x].value!=v){
		      obj.options[x].removeNode(true);
			  
		  }else{
		    x=x+1
		  }
	  }
  
  }
  
  
  
function findRadio(objname,value){ //依据单选按钮的名字, 和已选择项值, 选择出已选择的项目
	var objs=document.getElementsByTagName("input");
	for (var i=0;i<objs.length;i++){
		//alert(objs[i].name+"\n"+objname)
		if (objs[i].name==objname){
			if (objs[i].value==value){
				objs[i].checked=true;
				 return true;
				break;
			}else{
				objs[i].checked=false;
			}
		}
	}
	objs[0].checked=true;
	return false;
}


function findCheckbox(objname,value){ //依据复选按钮的名字, 和已选择项值,已选择值用逗号分隔 选择出已选择的项目
	//if (value=="" | value==null ){
//		return false;
//	}
	var objs=document.getElementsByTagName("input");
	value=value.split(",");
	var isFind =false;
	for (var i=0;i<objs.length;i++){
		//alert(objs[i].name+"\n"+objname)
		if (objs[i].name==objname){
			for (var x=0;x<value.length;x++){
				if (objs[i].value==value[x]){
					objs[i].checked=true;
					 isFind =true;
					break;
				}else{
					objs[i].checked=false;
				}
			}
		}
	}
	if (!isFind){
		objs[0].checked=true;
	}
	return isFind;
}


  
  function erStr(str){ //过滤HTML
	 var out=str.replace(/<[^\n]*>/g,"")
	 out=out.replace(/\n\r/g,"")
	  return out;
	  
 }
 
function isIMG(fileName){  //判断路径是不是一个图片
	
	var n=fileName.split(".");
	var exName=n[n.length-1];
	exName=exName.toLowerCase();
	var iList="jpg,bmp,gif,jpeg,png"
	var il=iList.split(",");
	
	for (var i=0;i<il.length;i++){
		//alert("准备复制项目")
		if (exName==il[i]){
			return true;
		}
	}
	return false;
}

function ieVer(){  //取IE的版本
	
	JBrowser.agent=JBrowser.InternetExplorer;
	return JBrowser.version;
	
}

function openUpfile(type,sysPath,fileSize){ //打开一个上传文件的对话框  type 要上传的文件分类 ,rType 是不是用逗号返回一个分割的多个文件列表, 1 需要 2 不需要.
 	
	if (sysPath==null || sysPath==""){
			var arr=showModalDialog("../sysSetup/filesManage.htm?fileSize="+fileSize+"&mode=u&type="+type+"&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}else{
		
		var arr=showModalDialog(sysPath+"sysSetup/filesManage.htm?fileSize="+fileSize+"&mode=u&type="+type+"&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	//alert(arr);
	return arr;
	
}

function openSelectDate(path,language){ //打开 一个对话框, 在里面选择日期
	try{
		var p=sysPath;
	}catch(e) {
		sysPath=null;
	}
	
	if (path==null){
		if ( sysPath!=null &  sysPath!=""){
			var arr=showModalDialog(sysPath+"system/sysSetup/selectDate.htm?language="+language+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:340px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../sysSetup/selectDate.htm?language="+language+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:340px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}else{
		var arr=showModalDialog(path+"system/sysSetup/selectDate.htm?language="+language+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:340px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	return arr;
}

function openSelectAddress(){ //打开 一个对话框, 在里面选择地区
	try{
		var p=sysPath;
	}catch(e) {
		sysPath=null;
	}
	if ( sysPath!=null &  sysPath!=""){
		var arr=showModalDialog(sysPath+"system/sysSetup/selectAddress.htm?t="+create_id(), window, "dialogWidth:315px; dialogHeight:300px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}else{
		var arr=showModalDialog("../sysSetup/selectAddress.htm?t="+create_id(), window, "dialogWidth:315px; dialogHeight:300px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	
	return arr;
}

function openSelectUser(type,path){ //打开一个选择用户的对话框. TYPE=admin 只能看管理员  all 全部用户
	try{
		var p=sysPath;
	}catch(e) {
		sysPath=null;
	}
	if (path==null){	
	
		if ( sysPath!=null &  sysPath!=""){
			var arr=showModalDialog(sysPath+"system/user/selectUser.htm?mode=u&type="+type+"&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
		else
		{
			var arr=showModalDialog("../user/selectUser.htm?mode=u&type="+type+"&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}else{
		var arr=showModalDialog(path+"user/selectUser.htm?mode=u&type="+type+"&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	return arr;
}

function openSelectPowerMenu(table){ //打开一个选择栏目的对话框, 但只选择自己有权限的,并且指定了表名的栏目
	try{
		if ( sysPath!=null &  sysPath!=""){
			var arr=showModalDialog(sysPath+"system/myweb/selectPowerMenu.htm?tab="+table+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:290px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../myweb/selectPowerMenu.htm?tab="+table+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:290px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}catch(e) {
		var arr=showModalDialog("../myweb/selectPowerMenu.htm?tab="+table+"&t="+create_id(), window, "dialogWidth:380px; dialogHeight:290px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	return arr
}


function openSelectMenu(tab){ //打开一个选择栏目的对话框. 
	if (tab==null | tab==""){
		tab="not";
	}
	try{	
		if ( sysPath!=null &  sysPath!=""){
			var arr=showModalDialog(sysPath+"system/myweb/selectMenu.htm?tab="+tab+"&t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../myweb/selectMenu.htm?tab="+tab+"&t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}catch(e) {
			var arr=showModalDialog("../myweb/selectMenu.htm?tab="+tab+"&t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	return arr
}



function openStartMenu(tab){ //打开一个选择栏目的对话框.   返回数组 0 MNAME 1 MID;
	try{	
		if ( sysPath!=null &  sysPath!=""){
			var arr=showModalDialog(sysPath+"system/myweb/selStratMenu.aspx?t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../myweb/selStratMenu.aspx?t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}catch(e) {
			var arr=showModalDialog("../myweb/selStratMenu.aspx?t="+create_id(), window, "dialogWidth:580px; dialogHeight:460px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	if (arr!=null){
	    arr=arr.split(",");
	}
	return arr
}


function openSelectColor(path){ //打开一个选择颜色的对话框
	if (path==null){path=""}
	if (ieVer()<7){
		if (path!=""){
			var arr=showModalDialog(path+"sysSetup/palette.htm", window, "dialogWidth:362px; dialogHeight:275px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../sysSetup/palette.htm", window, "dialogWidth:362px; dialogHeight:275px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}else{
		if (path!=""){
			var arr=showModalDialog(path+"sysSetup/palette.htm", window, "dialogWidth:362px; dialogHeight:240px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog("../sysSetup/palette.htm", window, "dialogWidth:362px; dialogHeight:240px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}
	return arr;
	
}
//-----------------------------------
function openSelectBBSName(){//打开一个选择论坛帖子列表的标签
    var date=new Date();
    var txt=date.getMilliseconds()+""+date.getMinutes();
    var arr=showModalDialog("../sysSetup/selectStyle.aspx?index="+txt, window, "dialogWidth:335px; dialogHeight:230px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
    
    return arr;
}
//-----------------------------------

function openEdit(objid,path){ //打开一个编辑器对话框
	if (path!=null & path!=""){
		if (ieVer()<7){
			var arr=showModalDialog(path+"system/Editor/Edit.htm?id="+objid+"&t="+create_id(), window, "dialogWidth:620px; dialogHeight:535px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog(path+"system/Editor/Edit.htm?id="+objid+"&t="+create_id(), window, "dialogWidth:620px; dialogHeight:500px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
		return arr;
	}
	if (ieVer()<7){
		var arr=showModalDialog("../Editor/Edit.htm?id="+objid+"&t="+create_id(), window, "dialogWidth:620px; dialogHeight:535px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}else{
		var arr=showModalDialog("../Editor/Edit.htm?id="+objid+"&t="+create_id(), window, "dialogWidth:620px; dialogHeight:500px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	}
	return arr;
	
}



function openEditOrderType(path){ //打开一个选择订单类型对话框
	var arr=showModalDialog("../shop/orderTypeList.aspx?t="+create_id(), window, "dialogWidth:200px; dialogHeight:100px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	return arr;
}


function openSelectEditFile(path,fileType){ //打开一个选择根目录下的指定扩展名的文件的对话框, 注意扩展名前要加. 多种文件类型,用,分隔
    //alert(fileType);
	var arr=showModalDialog("../label/selectFile.aspx?type="+fileType+"&t="+create_id(), window, "dialogWidth:550px; dialogHeight:300px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	return arr;
}



function openSelectUserGroup(path){ //打开一个选择用户组的对话框
	var arr=showModalDialog("../user/groupList.aspx?t="+create_id(), window, "dialogWidth:500px; dialogHeight:250px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
	return arr;
}



function openVot(path){ //打开一个选择调查对话框
	if (ieVer()<7){
		if (path==null){
			var arr=showModalDialog("../vot/list.htm?mode=call&t="+create_id(), window, "dialogWidth:500px; dialogHeight:535px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog(path+"vot/list.htm?mode=call&t="+create_id(), window, "dialogWidth:500px; dialogHeight:535px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}else{
		if (path==null){
			var arr=showModalDialog("../vot/List.htm?mode=call&t="+create_id(), window, "dialogWidth:500px; dialogHeight:500px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}else{
			var arr=showModalDialog(path+"vot/List.htm?mode=call&t="+create_id(), window, "dialogWidth:500px; dialogHeight:500px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		}
	}
	return arr;
}





function isColor(v){
	if (v.length==7 & v.search("#")==0){
		return true;
	}else{
		return false;
	}
}


function setImgWH(imgObj){  //自动设置图片的长宽比, 使其适应外部对象,要求外部对象设置有固定的长和宽
//
//	if (imgObj.fileSize==-1){
//		imgObj.style.display="none";
//		return;
//	}
	
	
	var obj=imgObj.parentNode;
	var h=Element.getHeight(obj);
	var w=Element.getWidth(obj);
	var w1=Element.getWidth(imgObj);
	var h1=Element.getHeight(imgObj);
	var	isSet=0;
	if (w==0){
		var h2=obj.style.height
		var w2=obj.style.width
		if (h2!="" & h2!=null){
			w=delpx(w2);
			h=delpx(h2);
		}
	}
	if (w1==0){
		imgObj.style.width=(w-2)+"px";
		imgObj.style.verticalAlign="middle";
		//obj.style.verticalAlign="middle";
		return;
	}
	
//	alert("w:"+w+" w1:"+w1+" h:"+h+" h1:"+h1)
//return;
	if ((w/h)>(w1/h1)){ //图片比外框高
		imgObj.style.height=(h-2)+"px";
		imgObj.style.width="auto";
		w1=Element.getWidth(imgObj);
		imgObj.style.marginLeft=((w-w1)/2);
		obj.style.textAlign="left";
		//alert("居中")
	}else{ //图片比外框宽
		imgObj.style.height="auto";
		imgObj.style.width=(w-2)+"px";
		 h1=Element.getHeight(imgObj);
		imgObj.style.marginTop=((h-h1)/2);
	}
	
	if ( (w1>(w*2)|h1>(h*2)) & w1>400  && ( imgObj.title==""|| imgObj.title==null ) & (imgObj.onclick==null|| imgObj.onclick=="")){
		
		imgObj.title="点击放大";
		imgObj.style.cursor="hand";
		imgObj.onclick=function(){
			//window.open(this.src);
		}
	}
	//alert(w+"/"+h)
}


function ExchangeTr(tr1,tr2) //交换tr1和tr2的位置 用户实现表格行的上下移, 实例参考用户自定义字段配置.
{ 
        var target=(tr1.rowIndex<tr2.rowIndex)?tr2.nextSibling:tr2;
        var tBody=tr1.parentNode
        tBody.replaceChild(tr2,tr1);
        tBody.insertBefore(tr1,target);
 }
 
 
function cObj(inObj,newObjtype,type){ //在对象对创建一个新对象
	var tempObj=$c(newObjtype);
	if (type!=null){
	    tempObj.type=type;
	}
	newObj=inObj.appendChild(tempObj);	
	return newObj;
}


function urlPar(parName){
    var url=location.href;
    var p=null;
	if (url.search(/\?/g)==-1){return p;}
	url=url.split("?");
	url=url[1].split("&");
	for (var i=0;i<url.length;i++){
		var p1=url[i].split("=");
		if(p1[0]==parName){
			p=decodeURI(p1[1]);
			break;
		}
	}
	return p;
}
//选择头像
function selimg(){
    var fs=window.location.href.split('/');
    var pathtxt="http://"+fs[2];
    var arr=showModalDialog(pathtxt+"/webUser/facelist.aspx", window, "dialogWidth:625px; dialogHeight:580px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
    if(arr!=undefined)
    {
       document.getElementById("userPhotoUrl").value=arr;
       document.getElementById("userPhotoIMG").src=arr;
    }
}


function createOurTitle(){//创建表头
   var title=new Array();  
   this.setW=0;
   var wAll=0;
   var table=null;
   this.add=function(titleText,clickText,width){
	   var l=title.length;
	   title[l]=new Array();
	   title[l][0]= titleText;
	   title[l][1]=clickText;
	   title[l][2]=width;
   }
   this.create=function(){
		if (this.table==null){
			  return  null;
		}
		var createTR=this.table.insertRow();
		for (var i=0;i<title.length;i++){
			var createTD=createTR.insertCell();
			createTD.appendChild(document.createTextNode(title[i][0]));
			if(i==0){
				createTD.style.cssText="width:"+title[i][2]+"px;"+title[i][1];
			}else{
				createTD.style.cssText="width:"+title[i][2]+"px;"+title[i][1]+";";
			}
			createTD.className="titleRow";
			createTD.onmouseover=function(){
				this.className="listTitleOption_1Other";
			}
			createTD.onmouseout=function(){
				this.className="titleRow";
			}
		}
	}
}

function imgx(img){ //输入一个图片路径，返回它的略图
    if (img.indexOf("upfile")==-1){
        return img;
    }
    if (img.length<3){
        return "";
    }
    var img1=img.split("/");
    var f="";
    for (var i=0;i<img1.length;i++){
        if (i==img1.length-1){
            img1[i]="x"+img1[i]+".jpg";
        }else{
          img1[i]= img1[i]+"/";
        }
        f+=img1[i];
    }
    return f;    
}