//子站管理js
function childManger(){//子站点管理js
	    this.menuid=null;
	    this.modi=null;
	}
childManger.prototype.edit=function(obj){//打开编辑器
		var textobj=obj.previousSibling;
		var arr=showModalDialog("../../system/Editor/Edit.htm?id="+textobj.id+"&t="+create_id(), window, "dialogWidth:620px; dialogHeight:535px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");		
		if (arr!=null&&typeof arr!="undefined"){
			var textobj=obj.previousSibling;
			textobj.value=arr;
		}
	}
childManger.prototype.upfile=function(obj){
		var arr=showModalDialog("../../system/sysSetup/filesManage.htm?mode=u&type=9&t="+create_id(), window, "dialogWidth:800px; dialogHeight:560px; toolbar=no;location=no;directories=no;status=no;menubar=no;scroll=auto;resizable=0;help=0");
		if(typeof arr=="undefined"){ return false;}
		else{
		 var url=arr;
		 var textobj=obj.previousSibling;
		 url=url.replace("../../","/");
		 url=url.replace(c1,"");
		 textobj.value=url;
	   }
	}
childManger.prototype.createBtn=function(obj){//创建提价按钮
	    var creInput=document.createElement("input");
	    creInput.setAttribute("type","button");
	    creInput.setAttribute("id",cM.menuid);
	    creInput.setAttribute("value","保存数据");
	    creInput.onclick=function(){
		    cM.save(this);	
	    }
	    obj.appendChild(creInput);
    }
childManger.prototype.loadPage=function(){
	   	if(cM.menuid==null||cM.menuid==""){
	   	    alert("非法进入");
	   	    return;
	   	}
	   	else{
	   	    var objResponse=new JHttpResponse();
	        objResponse.write("menuid",cM.menuid);
	        objResponse.write("modi",cM.modi);
	        var out=objAjax.getText("post","mangerRun.aspx?type=readChild",objResponse,null);
	        switch(out)
	        {
	           case "noPop":alert("当前你不具有权限");break;
	           default:
	               if(out.indexOf(c1)>-1)
	               {
	                var outSplit=out.split(c1);
	                $("TitleImg").value=outSplit[0];
	                $("Affiche").value=outSplit[1];
  	                $("menuText").value=outSplit[2];
  	                cM.createBtn($("saveDate"));
	               }
	               else
	               {
	                 alert(out);
	               }
	           break;
	        }
	    }
	}
childManger.prototype.save=function(obj){//保存数据
	    var v=new validate();
	    v.form=document.getElementById("form1");
	    if (!v.start()){  //验证必填项
	       return ;
	    }
	    var TitleImg=$("TitleImg").value;
	    var Affiche=$("Affiche").value;
	    var menuText=$("menuText").value;
	    var objResponse=new JHttpResponse();
	    objResponse.write("menuid",cM.menuid);
	    objResponse.write("TitleImg",TitleImg);
	    objResponse.write("Affiche",Affiche);
	    objResponse.write("menuText",menuText);
	    var out=objAjax.getText("post","mangerRun.aspx?type=saveChildDate",objResponse,null);
	     switch(out)
	     {
		     case "ok":
		 	    alert("保存成功");
		 	    createDiv.ifirmClose();
			    break;
		     default:
		 	    alert(out);
			    break;
	     }
    }