
 function itemClassEditorClass(){  //用于读出设置的下拉菜单, 单选, 复选,
	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.id2Path=function(idList){
		var objResponse=new JHttpResponse();
		objResponse.write("idList",idList);
		var out=objAjax.getText("post","../../system/myWeb/mywebServer.aspx?type=readPath",objResponse,null);
		return out;
	}	
	
	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);
			var out=objAjax.getText("post",sysPath+"server/hiwebServer.aspx?type=readOption",objResponse,null);
			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(){
								textObj=document.getElementById(this.textName);
								textObj.value=this.options[this.selectedIndex].value;
							}
						}
					}
					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;
			}
		}
		this.clear();
	}
}
