function adduserClass(){
	this.addType=0;

    this.selectPhoto=function(sysPath){
		var photo=openUpfile(2,sysPath);
		if (photo!=null){
			photo=photo.split(c1);
			photo=photo[photo.length-2];
			imgobj=document.getElementById("userPhotoIMG");
			imgtext=document.getElementById("userPhotoUrl");
			imgobj.src=photo;
			imgtext.value=photo;
		}
	}
	
	
	this.save=function(){
		
		var v=new validate();
		v.form=form1;
		if (!v.start()){
			return false;
		}
		
		if (isNaN(form1.Mobile.value)&form1.Mobile.value!=""){
			alert("请正确填写手机号");
			return false;
		}
		if ($("PassWord")!=null){
			if (form1.PassWord.value!=form1.PassWord1.value){
				alert("密码和确认密码不一致请重新填写");
				return false;
			}
		}else{
			if (uid=="" | uid==null){
				return;
			}
		}
		var action=form1.action
		if (action.search(/type=/g)==-1){
			form1.action=form1.action+"type=add";
		}
		/*var obj=form1.getElementsByTagName("input");
		for (var i=0;i<obj.length;i++){
			alert("name: "+obj[i].name+"   id: "+obj[i].id+"    value:"+obj[i].value)
			
		}*/
		
		//alert(this.addType);
		
		var objResponse=new JHttpResponse();
		if (uid==null){
			uid="";
		}
		objResponse.write("uid",uid);
		objResponse.write("addType",this.addType);
		var out=objAjax.submit(form1,"post",true,objResponse);
		out=out.split(c1)
		if (out[0]=="OK"){
			switch (out[1]){
				case "1":
					if (this.addType==0){
					         sendxml();
						alert("用户添加成功, "+form1.UserName.value+" 用户的ID:"+out[2]+"\n 点击确定继续添加用户");
						
						form1.UserName.value="";
						try{
							var wNum =readPar(location.href,"wNum");
							frame=eval("parent.wIframe_"+wNum);
							frame.uList.loadList();
						}catch(e) {}
						try{
						form1.UserName.focus();				
						}catch(e) {}
					}else{
					    sendxml();
						alert("用户注册成功");
						location.href="../";
					}
					break;
				case "-100":
					alert("用户注册失败,禁止的用户名")
					break;
				case "-98":
					alert("用户注册成功,但需要等待审核")
					location.href="../";
					break;
				 default  :
						if (uid!=null & uid!=""){
						        sendxml();
							alert("用户资料修改成功!")
						}else{
							alert("用户添加失败, "+form1.UserName.value+" 用户已存在.");
						}
			}
			
		}else{
			if (out==""){
				alert("用户注册失败, 可能网站没有开放注册用户,\n或你现在已经是登录状态,无法注册新用户\n也可能是由于你没有添加新用户的权限.")
			}else{
				alert(erStr(out[0]));
			}
		}
		
	}
	
	
	this.loadExinfo=function(sysPath){
		if (sysPath==null){
			var out=objAjax.getText("post","saveUser.aspx?type=readConfig",null,null);
		}else{
			var out=objAjax.getText("post",sysPath+"saveUser.aspx?type=readConfig",null,null);
		}
		out=comminute(out,c1,c2); 
		obj=document.getElementById("userEx");
		for (var i=0;i<out.length-1;i++){
			var tempObj=document.createElement("span");
			var newObj=obj.appendChild(tempObj);
			
			tempObj=document.createElement("span");
			var textSpan=newObj.appendChild(tempObj);
			textSpan.innerText=out[i][1];
			textSpan.style.cssText="width:80px;"
			//[fieldName],[fieldAsName],[isFind],[isNull],[editMode] ,[isRow], [isEdit]
			//  0             1              2      3         4	("0"单行字符 "1"多行字符  2"数字  "3"日期 "4"EMAIL "5"网址 "6"IP) 5   6
			out[i][4]=parseInt(out[i][4])
			 switch (out[i][4]){
				//<textarea isV="1" title="签名" max="100" notNull="0" isNum="0"   rows="5" name="idiograph" id="idiograph" cols="74"></textarea>
				case 1:
					tempObj=document.createElement("textarea");
					var textObj=newObj.appendChild(tempObj);
					textObj.id=out[i][0];
					textObj.name=out[i][0];
					textObj.isV="1";
					textObj.rows="4";
					textObj.cols="74";
					textObj.title=out[i][1];
					textObj.notNull=out[i][3];
					textObj.max="100";
					newObj.style.width="99%";
					if (uid!=null & uid !="" & out[i][6]=="1"){
					 //   alert(out[i][1]+"禁止修改")
					     textObj.readOnly=true;				
					}
					break;
				 
			default :
			
				if (out[i][4]<20) {  //如果是文本框
					
					//newObj.style.backgroundColor ="#cfcfcf"
					tempObj=document.createElement("input");
					var textObj=newObj.appendChild(tempObj);
					textObj.id=out[i][0];
					textObj.name=out[i][0];
					textObj.isV="1";
					textObj.title=out[i][1];
					//alert(out[i][3])
					textObj.notNull=out[i][3];
					if (out[i][5]=="1"){
						newObj.style.width="99%"
						textObj.style.width="450px"
					}else{
						textObj.style.width="150px"
						newObj.style.width="48%"
						
					}
					textObj.max="100";
					if (uid!=null & uid !="" & out[i][6]=="1"){
					   // alert(out[i][1]+"禁止修改")
					    textObj.readOnly=true;					
					}

					switch (out[i][4]){
						case 2:
							textObj.isNum="1";
							textObj.max="";
							break;
						case 3:
							textObj.isDate="1";
							break;
						case 4:
							textObj.isMail="1";
							break;
						case 5:
							textObj.isNurl="1";
							break;
						case 6:
							textObj.isIP="1";
							break;
					}
					
				}else{ //选项
					if (out[i][5]=="1"){
						newObj.style.width="99%"
					}else{
						newObj.style.width="48%"
					}
					var sindex=out[i][4]-20;
					var findItem=new itemClass();
					findItem.mode="sindex";
					findItem.add(sindex,out[i][0],"");  //添加选项, 选项名或序号, 对象名, 样式表名
					findItem.obj=newObj;
					findItem.create(sysPath);
					
				}
				break;
				
			}
			tempObj=document.createElement("span");
			postfixObj=newObj.appendChild(tempObj);
			//alert(out[i][3])
			if (out[i][3]=="1"){
				postfixObj.innerHTML="<font color='#ff0000'>*</font>"
			}
			if (out[i][6]=="1"){
				postfixObj.innerHTML="<font color='#ff0000'>禁止修改</font>"
			}
		}
		
	}
	
	
	this.loadUserRecord=function(id,sysPath)  //读出用户资料, 填充数据
	{
		if (!isNaN(id)){
			var objResponse=new JHttpResponse();
			objResponse.write("uid",id);
		    if (sysPath==null){
				var out=objAjax.getText("post","saveUser.aspx?type=readUserRecord",objResponse,null);
			}else{
				var out=objAjax.getText("post",sysPath+"saveUser.aspx?type=readUserRecord",objResponse,null);
			}
			//alert(out);
			out= comminute(out,c1,c2);
			var field=raadArray(out,0,0);
			var value=raadArray(out,1,0);
			for (var i=0;i<field.length;i++){
				if (field[i]=="userPhoto"){
					$("userPhotoUrl").value=value[i];
					if (sysPath==null){
						$("userPhotoIMG").src=value[i];
					}else{
						$("userPhotoIMG").src=value[i].replace("../../","../");
					}
					
				}
				
				try{
					if (field[i]=="Integral_Base"){
						$("uIntBase").innerHTML=value[i];
					}
					
					//alert(field[i]);
					if (field[i]=="[Money]"){
						$("uMoney").innerHTML=value[i];
					}
				}	
				catch(e) {}
				
				var obj=document.getElementById(field[i]);
				if (obj!=null){
					
					
					switch (obj.type){
						case "text":
							obj.value=value[i];						
							break;
						 case "radio":
							 findRadio(obj.name,value[i])
						 	break;
						 case "checkbox":
							 findCheckbox(obj.name,value[i]);
						 	break;
						 case "hidden":
							 findSelect(obj.name,value[i])
						 	break;
						default:
							obj.value=value[i];
						
					}
					

				}
			}
			
		}
	}
	
}


 function sendxml(){  
           var objAjax=new JAjax();             
           var out=objAjax.getText("post","../../system/IEintegratedData/Parameters.aspx?type=issendxml",null,null);
           switch(out)
           {
            case "3":{senddvbbs();sendoblog();}break;
            case "2":{sendoblog();}break;
            case "1":{senddvbbs();}break;
           }
   }
function senddvbbs(){
    try
    {
        var objAjax=new JAjax();
        var objResponse=new JHttpResponse();
	    objResponse.write("appid","dvbbs");
        var out=objAjax.getText("post","../../system/IEintegratedData/Parameters.aspx?type=readUrl",objResponse,null);
        if(out!=null&&out!="")
        {   
            var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); 
            xmlDoc.async = false; 
            var date=new Date();
            var str=date.getMilliseconds()+""+date.getMinutes()+""+date.getSeconds();
            xmlDoc.load("../../system/IEintegratedData/xml/dvbbs.xml?str="+str);
            
            var xmlhttps = new ActiveXObject("Msxml2.XMLHTTP.3.0");
            xmlhttps.open("POST",out, false);
            xmlhttps.send(xmlDoc);
            var txt=xmlhttps.responseText;
            alert(txt); 
        }
        else
        {
          //弹出提示：你还没有设置同步数据
        }
     }
     catch(err)
     {
        alert("不能够打开"+out+"\n请确保该整合数据是否正确设置")
     }
 }
function sendoblog(){
       try
       {
            var objAjax=new JAjax();
            var objResponse=new JHttpResponse();
            objResponse.write("appid","oblog");
            var out=objAjax.getText("post","../../system/IEintegratedData/Parameters.aspx?type=readUrl",objResponse,null);
            if(out!=null&&out!="")
            {
               var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); 
                xmlDoc.async = false; 
                var date=new Date();
                var str=date.getMilliseconds()+""+date.getMinutes()+""+date.getSeconds();
                xmlDoc.load("../../system/IEintegratedData/xml/oblog.xml?str="+str);
                
                var xmlhttps = new ActiveXObject("Msxml2.XMLHTTP.3.0");
                xmlhttps.open("POST",out, false);
                xmlhttps.send(xmlDoc);
                var txt=xmlhttps.responseText;
                alert(txt); 
            }
            else
            {
               //弹出提示：你还没有设置同步数据
            }
        }
   catch(err)
       {
          alert("不能够打开"+out+"\n请确保该整合数据是否正确设置");
       }
   }