
function loadUI(){ //加载界面设置	
	//alert(mode);
	if (mode=="call"){
		var tools=new toolsClass();	
		tools.add("","调用","vList.call()","调用这个调查")
		tools.create(toolsDiv)
	}else{
		var tools=new toolsClass();	
		tools.add("","新增","vList.create()","新增调查项目")
		tools.add("","删除","vList.del()","删除选项")
		tools.add("","修改","vList.modi()","修改一个调查")
		tools.add("","刷新","vList.loadVot()","刷新页面数据")
		tools.add("","帮助","","使用帮助");
		tools.create(toolsDiv)
	}

	var t=new outTitle();
	t.add("ID","","50");
	t.add("标题","","250");
	t.add("类型","","60");
	t.add("建立日期","","100");
	t.obj=document.getElementById("votTitle");
	t.create();	
		loadBodyclick();
	vList.loadVot();
	
}



function listClass(){
	var tempObj, selectObj
	
	
	this.loadVot=function(){
		var out=objAjax.getText("post","votServer.aspx?type=readList",null,null);	
		out= comminute(out,c1,c2);  //分割数据	
		//id,title,type,createDate
		//0   1     2     3
		selectObj=null;
		var wData=new tabList();
		$("votBody").innerHTML="";
		  wData.obj=document.getElementById("votBody");
		  wData.rowid="votRow_";            //行的ID, 列ID=行ID_行号如(  [abc_][_0])
		  wData.rowClass="tabListBodyRow";                 //行的样式
		  wData.mode=1;                      //数据显示的格式
		  wData.isCheckbox=true;             //加上复选框
		  wData.checkBoxID="votBox";         //复选框名
		  wData.onmouseroverRun="vList.rowonmouseover";           //鼠标移上
		  wData.onmouseroutRun="vList.rowonmouseout";             //鼠标移走
		  wData.onclickRun="vList.rowonclick";                    //鼠标单击
		  wData.ondblclickRun="vList.modi";                       //鼠标双击 不要写后面的()
		  wData.add(raadArray(out,0,1),"","50");    //添加一列数据  ID
		  wData.add(raadArray(out,1,1),"","250");    //添加一列数据 标题
		  wData.add(raadArray(out,2,1),"","60");     //添加一列数据 类型
		  wData.add(raadArray(out,3,1),"","100");    //添加一列数据  创建日期
		  wData.addid(raadArray(out,0,1));           //添加行标识, 标识 被添加 为TID属性和复框的VALUE属性
		  wData.create();		  
		  
		   var defaultObj=document.getElementsByName("votRow__2"); //字符处理第三列
		 // alert(defaultObj);
		  for (var i=0;i<defaultObj.length;i++){
			  if (defaultObj[i].innerText=="1"){
				  defaultObj[i].innerText="单选";
				  defaultObj[i].title="单选";
			  }else{
				  defaultObj[i].title="复选";
				  defaultObj[i].innerHTML="复选";
			  }
		  }
	}
	
	this.rowonmouseover=function(obj){  //
		tempObj=obj;
		obj.className="tabListBodyRow_1";
	}
	
	
	this.rowonmouseout=function(obj){
		//	alert(obj.tid)
		tempObj=null;
		if (obj !=selectObj){
			obj.className="tabListBodyRow";
		}
		
	}
	
	this.rowonclick=function(obj){  //当行被点击时处理行
		try{
			if (form1.votBox[tempObj.i].checked==true){
				form1.votBox[tempObj.i].checked=false;
			}else{
				form1.votBox[tempObj.i].checked=true;
			}
			if (selectObj!=null & selectObj!=obj){
				selectObj.className="tabListBodyRow";
			}
		}catch(e) {}
		selectObj=obj;
		
	}
	
	this.del=function(){ //删除
		var objs=document.getElementsByName("votBox");
		var id="";
		for (var i=0;i<objs.length;i++){
			if (objs[i].checked){
				id=id+objs[i].value+",";
			}
		}
		if (id==""){
			alert("请选择要删除的记录")
			return;
		}else{
			id=id.substr(0,id.length-1);
			var objResponse=new JHttpResponse();			
			objResponse.write("id",id);
			var out=objAjax.getText("post","votServer.aspx?type=del",objResponse,null);	
			if (out=="OK"){
				this.loadVot();
			}else{
				alert(erStr(out));
			}
		}
	}
	
	this.create=function(){ //新增
		var objnum=parent.win.objNum;
		par="wNum="+objnum;
		parent.win.pCreate("p-votCreate",par,"",true);
	}
	
	this.modi=function(){
		try{
			var objnum=parent.win.objNum;
			par="wNum="+objnum+"&mode=modi&id="+selectObj.tid;
			parent.win.pCreate("p-votModi",par,"",true);
		}catch(e) {}
	}
	
	this.call=function(){
		var objs=document.getElementsByName("votBox");
		var id="";
		for (var i=0;i<objs.length;i++){
			if (objs[i].checked){
				id=id+objs[i].value+",";
			}
		}
		if (id==""){
			alert("请选择要调用的记录")
			return;
		}else{
			id=id.substr(0,id.length-1);
			window.returnValue= id;
			window.close();
		}
	}
}