
function createDataClass(){
	var mParList=new Array();
	var tabParList=new Array();
	
	this.menuPar=null;
	this.tabPar=null;
	this.selectids=new Array();
	this.selectPaths=new Array();
	var fileData=null;
	var menuData=null;
	var fields=null;
	
	this.fData=null
	this.field=null
	this.serverPath="";
	
	
	this.readFileData=function(){
		var objResponse=new JHttpResponse();
		objResponse.write("table",asTab);	
		objResponse.write("fileid",fileid);
		objResponse.write("menuid",menuid);
		var out=objAjax.getText("post","createDataServer.aspx?type=readFileData",objResponse,null);
	    out=comminute(out,c1,c2);
		if (out.length<2){
			alert(erStr(out.toString()))
			return;
		}
		fileData=out[0];   //文件的字段的值
		menuData=out[1];   //数据在哪些栏目中有保存
		
		//title,Kind,content,TabImage,TabKeys,CBS,Source,SourceUrl,signForUser,signInUser,WebUrl," + fields + ",signFor,signForUser,signInUser,IsHidden,IsTop,IsEssence,IsRemark,Examine,P_A_View_ID,Art_View_Int_ID
		fields=out[2][0];  //字段集合
		fields=fields.split(",");
		this.fData=fileData;
		this.field=fields;
		
		for (var i=0;i<fields.length;i++){
			if (fields[i]=="signFor"){
				break;
			}
			var obj=document.getElementById("T_"+fields[i])
			if (obj!=null){
				var objType=obj.type;
				objType=objType.toLowerCase();
				switch (objType){
					case "text":
						obj.value=fileData[i]
						break;
					case "checkbox":
						findCheckbox("T_"+fields[i],fileData[i])
						break;
					case "radio":
						findRadio("T_"+fields[i],fileData[i])
						break;
					case "hidden":
						if (obj.id=="T_content"){
							EditContent=fileData[i].replace("<sc","<");
							EditContent=fileData[i].replace("<SC","<");
						}else{
							findSelect("T_"+fields[i],fileData[i])
						}
						break;
					default:
						if (obj.id=="T_content"){
							EditContent=fileData[i];
						}else{
							obj.value=fileData[i]
						}
						break;
				}
			}
		}
		form1.T_IsTop1.value=getField(fileData,fields,"IsTop") //读一个字段的值.
		
		this.setCheckBox("IsTop");
		this.setCheckBox("IsEssence");
		this.setCheckBox("IsHidden");
		this.setCheckBox("Examine");
		this.setCheckBox("IsRemark");
		var box=this.setCheckBox("signFor");
		
		if (box.checked==true){
			document.getElementById("signFor").style.display="";
		}
		if (form1.T_signFor.checked){
			signFor[0].style.display="";
			signFor[1].style.display="";
		}
		
		for (var i=0;i<menuData.length-1;i++){
			var menu=menuData[i].split(c3);
			menu[0]=m.readPath(menu[0]);
			var x=this.selectids.length;
			var add=1;
			for (var i1=0;i1<x;i1++){
				if (this.selectids[i1]==menu[1]){
					add=0;
					break;
				}
			}
			if (add=1){
				this.addSelectMenu(menu);
			}
		}
		
	}
	
	this.setCheckBox=function(field){
		
		var obj=document.getElementById("T_"+field)
		if (obj!=null){
			//alert (field+":"+getField(fileData,fields,field));
			if (getField(fileData,fields,field)=="1"){
				obj.checked=true;
			}else{
				obj.checked=false;
			}
		}else{
			
		}
		return obj;
	}
	
	this.selectPowerMenu=function(table){ //选择有权限的栏目
		var menu=openSelectPowerMenu(table);
		if (menu!=null){
			menu=menu.split(c1);
			var x=this.selectids.length;
			for (var i=0;i<x;i++){
				if (this.selectids[i]==menu[1]){
					return false;
				}
			}
			this.addSelectMenu(menu);
	     }
	}
	
	this.selectmenu=function(){ //选择栏目
		//alert(sysPath);
		try{
			if ( sysPath!=null &  sysPath!=""){
				var menu=showModalDialog(sysPath+"system/myweb/selectMenu.htm?tab="+this.menuPar[15]+"&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 menu=showModalDialog("selectMenu.htm?tab="+this.menuPar[15]+"&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 menu=showModalDialog("selectMenu.htm?tab="+this.menuPar[15]+"&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 (menu!=null){
			menu=menu.split(c1);
			var x=this.selectids.length;
			for (var i=0;i<x;i++){
				if (this.selectids[i]==menu[1]){
					return false;
				}
			}
			this.addSelectMenu(menu);
	     }
	}
		
	this.addSelectMenu=function(menu){  //写入选中的栏目
			var x=this.selectids.length;
			this.selectids[x]=menu[1];
			this.selectPaths[x]=menu[0];
			
			var tempObj=document.createElement("div");
			var obj=selectPathDiv.appendChild(tempObj);
			obj.title=menu[1];
			obj.style.width="350px";
			obj.id="pathOption";
			
			tempObj=document.createElement("span");
			var textObj=obj.appendChild(tempObj);
			textObj.innerText=menu[0];
			textObj.style.cssText="width:315px;";
			
			tempObj=document.createElement("span");
			var delObj=obj.appendChild(tempObj);
			delObj.innerText="删除";
			delObj.style.cssText="width:30px;cursor:default";
			delObj.title=menu[1];
			delObj.onclick=function(){
				var x=pathOption.length;
				if (x==1){
					alert("最后一个所属栏目不能删除")
					return;	
				}
				for (var i=0;i<x;i++){
					if (pathOption[i].title==this.title){
						pathOption[i].removeNode(true);
						d.selectids.removeAt(i);
						d.selectPaths.removeAt(i);
						break;
					}
				 }
			}
	}
	
	
	
	
	this.loadPar=function(mid){  //依据栏目ID加载栏目参数
 	    if (mid=="" | mid==null){
		  alert("没有读取到基础栏目") 
		  return;
		}
		var mPar=mParList;
		for (var i=0;i<mPar.length;i++){
			if (mPar[i][0]==mid){
				return mPar[i][1];
			}
		}
		var out=objAjax.getText("post",this.serverPath+"createDataServer.aspx?type=readMenuPar&menuid="+mid,null,null);
		if (out=="noPop"){
			return out;	
		}
	//alert ("a:"+out);
	    out=out.split(c1);
		if (out.length<2){
			alert(erStr(out.toString()))
			return;
		}

		var x=mPar.length;
		mPar[x]=new Array();
		mPar[x][0]=mid;
		mPar[x][1]=out;
		mParList=mPar;
			
		return out;
//MID,MName,IndexNum,UpListID,layer,isDown,isDel,
// 0   1        2        3       4      5      6
//mDate,DownListID,Type,UsePower,Intro,PageSize,
// 7        8        9       10     11     12
//IsPageUrl,PageUrl,AsTab,TitleImg,menuText,affiche,menuKey
	}
	
	this.loadExDataPar=function(tab){  //读出挂接表的参数;  这里是读出可编辑的字段
	
		var tPar=tabParList;
		for (var i=0;i<tPar.length;i++){
			if (tPar[i][0]==tab){
				return tPar[i][1];
			}
		}
		//alert ("s2")
		var out=objAjax.getText("post",this.serverPath+"createDataServer.aspx?type=tabPar&table="+tab,null,null);
		//alert (out)
	    out=comminute(out,c1,c2);
		var x=tPar.length;
		tPar[x]=new Array();
		tPar[x][0]=tab;
		tPar[x][1]=out;
		tabParList=tPar;
		return out;
	}
	
	this.displayExData=function(dObj){ //在指定的对象中,显示挂表可编辑字段
		var fList=this.tabPar;
		for (var i=0;i<fList.length-1;i++){
			var tempObj=document.createElement("div");
			var obj=dObj.appendChild(tempObj);
			obj.style.cssText="width:100%"

			//fName,fAsName,fType,fSize,fEditType,isNull 
			tempObj=document.createElement("div");
			var textObj=obj.appendChild(tempObj);

			tempObj=document.createElement("div");
			var inputObj=obj.appendChild(tempObj);
			
			textObj.style.cssText=" float:left;width:70px; padding-top:4px; padding-left:6px;"
			
			if (fList[i][5]=="1"){
				textObj.innerHTML=fList[i][1]+"<font color='#ff0000'>*</font>";
			}else{
				textObj.innerText=fList[i][1];
			}
			var html="";
			switch (fList[i][2]){
				case "int":
				case "numeric":
					inputObj.innerHTML="<input  isV='1' isNum='1' max='999999999' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:500px;' title='"+fList[i][1]+"'>";
					break;
				case "_img":
					html="<input  isV='1' isNum='' max='' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:400px;' title='"+fList[i][1]+"'>"
					//alert(this.serverPath);
					html=html+"<input type='button' value='上传' onclick=\"d.upfile(this,'"+this.serverPath+"','1')\">";
					inputObj.innerHTML=html;
					break;
				case "_soft":
				
					html="<input  isV='1' isNum='' max='' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:400px;' title='"+fList[i][1]+"'>"
					//alert(this.serverPath);
					html=html+"<input type='button' value='上传' onclick=\"d.upfile(this,'"+this.serverPath+"','3')\">";
					inputObj.innerHTML=html;
					break;
				case "datetime":
					html="<input readonly onclick='this.nextSibling.click();' isV='1' isNum='' max='' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:400px;' title='"+fList[i][1]+"'>"
					html=html+"<input type='button' value='选择' onclick='d.selectDate(this)'>";
					inputObj.innerHTML=html;
					break;
				default :
					if (fList[i][4]<20){
						switch  (fList[i][4]){
							case "1":
								inputObj.innerHTML="<textarea  isV='1'  max='"+fList[i][3]+"' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:500px;' title='"+fList[i][1]+"'></textarea>";
								break;
							case "2":
								html="<input readonly  onclick='this.nextSibling.click();' isV='1' isNum='' max='' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:400px;' title='"+fList[i][1]+"'>"
								html=html+"<input type='button' value='选择' onclick='d.selectDate(this)'>";
								inputObj.innerHTML=html;
								break;
							case "3":
								html="<input  isV='1' isNum=''  max='"+fList[i][3]+"'  notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:400px;' title='"+fList[i][1]+"'>"
								html=html+"<input type='button' value='选择' onclick='d.selectAddress(this)'>";
								inputObj.innerHTML=html;
								break;
							default :
								inputObj.innerHTML="<input  isV='1'  max='"+fList[i][3]+"' notNull='"+fList[i][5]+"'  type='text' id='T_"+fList[i][0]+"' name='T_"+fList[i][0]+"' style='width:500px;' title='"+fList[i][1]+"'>";
								break;
						}
					}else{  //自定义扩展下拉菜单
						var sindex=fList[i][4]-20;
						var findItem=new itemClass();
						findItem.mode="sindex";
						findItem.add(sindex,"T_"+fList[i][0],"");  //添加选项, 选项名或序号, 对象名, 样式表名
						findItem.obj=inputObj;
						findItem.create(this.serverPath+"myWeb/");
						
					}
			}
			inputObj.style.cssText=" float:left;"
		}
		
    }
   
   this.upfile=function(obj,sysPath,fileType){
	   if (sysPath==null){
		   sysPath="";
	   }
	   if (fileType==null)
	   {
		   fileType="1";
		}
	   var photo=openUpfile(fileType,sysPath);
	   	if (photo!=null){
			photo=photo.split(c1);
			var textObj=obj.previousSibling;
			textObj.value=photo[0];
		}
   }
   
   this.selectDate=function(obj){
	   var d=openSelectDate();
	   	if (d!=null){
			var textObj=obj.previousSibling;
			textObj.value=d;
		}
   }
   
   this.selectAddress=function(obj){
	    var d=openSelectAddress();
	   	if (d!=null){
			var textObj=obj.previousSibling;
			textObj.value=d;
		}
	}
   
   this.saveDAta=function(){  //提交表单
   		var va=editTxt.GetContent();
		va=va.replace(/script/gi,"ＳＣＲＩＰＴ");
		va=va.replace(/java/gi,"ＪＡＶＡ");
		
		
	    $("T_content").value=va;
		
		
   		var v=new validate();
		v.form=document.getElementById("form1");
		if (!v.start()){  //验证必填项
		   return ;
		}
   //alert ( $("T_content").value)
	   if (this.selectids.length==0){
		   	alert ("请设置你要发布文件的栏目")
			return false;
	    }
		var p=power.save(0);  //取出权限配置的ID
		if (p==null){
			return false;
		}
		
		if (form1.T_IsTop1.value<1){form1.T_IsTop1.value="1"}
		//alert (asTab)
		var objResponse=new JHttpResponse();
		objResponse.write("table",asTab);
		
		var fList=this.tabPar;
		var fields="";
		for (var i=0;i<fList.length-1;i++){
			if (i<fList.length-2){
				fields=fields+fList[i][0]+","
			}else{
				fields=fields+fList[i][0]+""
			}
		}
		//alert(fields)
		objResponse.write("fields",fields);
		objResponse.write("P_A",p);
		objResponse.write("menuids",this.selectids);
		if (fileid==null|fileid==""){fileid=""}
		objResponse.write("id",fileid);
		//fName,fAsName,fType,fSize,fEditType,isNull 
	    var out=objAjax.submit(form1,"post",true,objResponse);
		if (out.search("OK")!=-1){
			if (fileid==null | fileid==""){
				alert ("一条信息发布完成, 点击确定继续.")
				if ($("isClear").checked){
					location.reload();
				}
				//$("T_content.value")="";
			}else{
				alert ("数据已保存.");
				//$("T_content.value")="";
			}
			var frame=eval("parent.wIframe_"+wNum);
			try{
				frame.myWeb.readFiels();
			}catch(e){
				
			}			
		}else{
			alert (erStr(out));
		}
		
	}
	
	
	   this.saveContribute=function(){  //提交表单
   		var va=editTxt.GetContent();
		va=va.replace(/script/gi,"ＳＣＲＩＰＴ");
		va=va.replace(/java/gi,"ＪＡＶＡ");
		
		
	    $("T_content").value=va;
		
		
   		var v=new validate();
		v.form=document.getElementById("form1");
		if (!v.start()){  //验证必填项
		   return ;
		}
   //alert ( $("T_content").value)
	   //if (this.selectids.length==0){
//		   	alert ("请设置你要发布文件的栏目")
//			return false;
//	    }
		p=this.menuPar[10];
		
		
		//var p=power.save(0);  //取出权限配置的ID
//		if (p==null){
//			return false;
//		}
		
	
		
		var objResponse=new JHttpResponse();
		objResponse.write("table",asTab);
		
		var fList=this.tabPar;
		var fields="";
		for (var i=0;i<fList.length-1;i++){
			if (i<fList.length-2){
				fields=fields+fList[i][0]+","
			}else{
				fields=fields+fList[i][0]+""
			}
		}
		//alert(fields)
		objResponse.write("fields",fields);
		objResponse.write("P_A",p);
		objResponse.write("menuids",this.selectids);
		objResponse.write("mname",this.menuPar[1]);
		this.menuPar[10]
		//fName,fAsName,fType,fSize,fEditType,isNull 
	    var out=objAjax.submit(form1,"post",true,objResponse);
		if (!isNaN(out)){
			if (out=="1"){
				alert ("一条信息发布完成, 点击确定继续.")
				if ($("isClear").checked){
					location.reload();
				}
				//$("T_content.value")="";
			}else if(out=="0"){
				alert ("信息发布完成, 请等待管理员审核.");
				if ($("isClear").checked){
					location.reload();
				}
				//$("T_content.value")="";
			}else {
				alert ("您在此栏目下没有发布权限");
			}
				
		}else{
			alert (erStr(out));
		}
		
	}
	

	
	this.selectUser=function(obj){  //选择用户
		var upObj=obj
		var u= openSelectUser("all");
		if (u!=null){
			if (upObj.value==""){
				upObj.value=u;
			}else{
				upObj.value=upObj.value+","+u;
			}
		}
	}
	
	this.clearUser=function(obj){
		obj.value="";
	}
	
	this.createSignForTitle=function(){
		var t=new outTitle();
		t.add("用户","","150");
		t.add("创建日期","","90");
		t.add("签收日期","","90");
		t.add("结束日期","","90");
		t.add("签收状态","","60");
		t.obj=document.getElementById("signForTitle");
		t.create();	
	
	}
	
	this.loadSignForTitle=function(){
		if (pType!="modi"){
			return;
		}
		if (!$("T_signFor").checked){
			return;	
		}
		var objResponse=new JHttpResponse();
	
		objResponse.write("mid",menuid);
		objResponse.write("tabid",fileid);
		objResponse.write("tab",asTab);
		var out=objAjax.getText("post","createDataServer.aspx?type=readSignFor",objResponse,null);
		if (out==""){
			return false;
		}
		//alert(out)
		  out= comminute(out,c1,c2);  //分割数据
		  this.userList=out;
		  var page=out[0];
		  this.mPage=page[2];
		  //toUser,toDate,signFor,endDate,state
		  //0         1      2       3     4 
		  //显示内容
		  var wData=new tabList();
		  wData.obj=document.getElementById("signForList");
		  wData.rowid="signForRow_";                          //行的ID
		  wData.rowClass="tabListBodyRow";                 //行的样式
		  wData.mode=1;                                    //数据显示的格式
		  wData.isCheckbox=false;                          //加上复选框
		  wData.checkBoxID="";                      //复选框名
		  wData.onmouseroverRun="d.rowonmouseover";           //鼠标移上
		  wData.onmouseroutRun="d.rowonmouseout";             //鼠标移走
		  wData.onclickRun="";                    //鼠标单击
		  wData.ondblclickRun="";                   //鼠标双击
		  wData.add(raadArray(out,1,0),"listBodyOption","150");    //添加一列数据  用户名
		  wData.add(raadArray(out,2,0),"listBodyOption","90");    //添加一列数据 创建日期
		  wData.add(raadArray(out,3,0),"listBodyOption","90");     //添加一列数据  签收日期
		  wData.add(raadArray(out,4,0),"listBodyOption","90");     //添加一列数据   结束日期
		  wData.add(raadArray(out,5,0),"list_count","60");         //添加一列数据  状态
		  wData.addid(raadArray(out,0,0));                         //添加行标识 TID
		  wData.create();
		   var cObj=document.getElementsByName("signForRow__4"); //字符处理第四列, 
		  for (var i=0;i<cObj.length;i++){
			  if (cObj[i].innerText=="0"){
				  cObj[i].innerText="否";
				  cObj[i].title="未签收";
			  }else{
				  cObj[i].innerHTML="<B>是</B>";
				  cObj[i].title="已签收";
			  }
		  }
	}
	
	this.rowonmouseover=function(obj){
		obj.className="tabListBodyRow_1";
	}
	
	
	this.rowonmouseout=function(obj){
		obj.className="tabListBodyRow";
	}
	
	this.openSelectDate=function(){
	  var v=openSelectDate()
	  if (v!=null){
		  $("endsignDate").value=v;
	  }
	}
	
	
}