var keyword;
$(document).ready(function(){ 

keyword= $("input#eb5707348").val()=='regupdate'?'修改':'注册';
if(keyword=='修改'){
	$("#Submitbut").val('修 改');
	$("#Submitbut").click(submitact);
}else{
	$("#Submitbut").click(function(){nextstep('down');});
}
var bodyheight=document.body.clientHeight||document.documentElement.clientHeight;
var trheight =bodyheight*0.8-160 ; if(trheight<100) trheight=100;
$("table#tab_main td.middletr").css('height',trheight+'px');
	if(top==self){//刘
		var paramarr=[];
		paramarr['webhost'] = location.hostname ;
		paramarr['targeturl']=location.href.replace('http://','').replace(location.hostname,'');		
		$e28dd6773=$e28dd6773?$e28dd6773:request('e28dd6773').replace('_mr_','.');
		$e28dd6773=$e28dd6773?$e28dd6773:location.hostname;
		top.location.href='http://'+ $e28dd6773 +'/index.php?'+http_build_query(paramarr);
	}

	validator.hypotaxis=3;
	validator.successMsg = '填写正确';
	validator.lastcheckmode=1;
	validator.lastcheckalert=1;
	validator.clickconfirm=1;
	$('#form1').checkForm();
}); 
function changeAuthCode() {
	var num = 	(new Date()).getTime();
	var rand = Math.round(Math.random() * 10000);
	num = num + rand;
	$('#ver_code').css('visibility','visible');
	if ($("#vdimgck")[0]) {
		$("#vdimgck")[0].src = "http://"+cfg_remote_host+"/include/vdimgck.php?tag=" + num;
	}
	return false;	
}
function nextstep(direc) {	
	if(direc=='down'){
		if(validator.yanzheng()==false ) return false;
		$("#licensetable").show();
		$("div#reginput").hide();
	}else{
		$("#licensetable").hide();
		$("div#reginput").show();
		
	}
	
	
}

function submitact(butt) {
	if(validator.yanzheng()==false ) return false;
	var redirecturl;
	redirecturl = $("input#e0f5a79e6").val();
	var jp= new monor_jsonp();
	jp.callbackfunc=function(data) {
		jp.localloginfinish=true;
		if(data.status=='success'){
			var tipinfo='';
			//if(data.redirecturl) redirecturl=data.redirecturl;
			if(data.info)tipinfo=data.info;
			else tipinfo=jp.default_sucmaininfo;
			
			$("div#poping .title span#poptitleinfo").html(jp.default_suctitle);
			$("div#poping .main").html(tipinfo);
			setTimeout(function(){	
				location.href='http://'+window.name.replace('_mr_','.')+'/reload.html';						
			}, jp.timedelay);
		}else{
			jp.err_handle(data);
		}
	};
	$.poping({height:'auto'},{},keyword+'中');
	$("input#e28dd6773").val(window.name);
	$.ajax({
		type: "POST",
		url:'?eb5707348=reginsert',
		timeout: 1500000,//刘改 单位 毫秒
		cache: false,
		data: $("#form1").serialize(),
		dataType: "json" ,
		success: function(data){			
			if(data.status=='error'){
				jp.default_errmaininfo=keyword+'失败，请关闭本窗口返回检查原因！';
				jp.err_handle(data);
			}else if(data.status=='success'){
				if(data.redirecturl) redirecturl=data.redirecturl;
				var remotedata={};
				remotedata['eb5707348']=$("input#eb5707348").val();
				remotedata['eea8f538c']=$("input#eea8f538c").val();
				remotedata['pwd']=$("input#pwd").val();
				remotedata['uname']=$("input#uname").val();
				remotedata['qq']=$("input#qq").val();
				remotedata['email']=$("input#email").val();
				remotedata['e80c42f39']=$("input#e80c42f39").val();
				remotedata['e532c28d5']=$("input#e532c28d5").val();
				remotedata['tel']=$("input#tel").val();
				remotedata['ecdf740a2']=$("input#ecdf740a2").val();
				remotedata['ed1befa03']=$("input#ed1befa03").val();
				remotedata['e4335285f']=data.e4335285f;
				remotedata['e9b0de583']=data.params;
				remotedata['nullvalue']=data.nullvalue;
				jp.url='http://'+window.name.replace('_mr_','.')+'/locallogin.php?remotehost='+encodeURIComponent(location.host)+'&callback=?';
				jp.senddata=remotedata;
				jp.default_suctitle=keyword+'成功';
				jp.default_errtitle=keyword+'失败';
				jp.default_errmaininfo='已成功远程'+keyword+'，但未能通过本地验证，请返回检查原因！';

				jp.default_sucmaininfo= $("input#eb5707348").val()=='regupdate'?'已成功修改用户资料信息！':'恭喜！您已成功注册，已往您的邮箱中发送一封验证码激活信，请前往点击激活码链接。';

				jp.do_locallogin(data);
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown){
			jp.default_errmaininfo='系统错误，请返回重新操作，再试一次！';
			jp.err_handle();
		}
	});		
}



$(document).ready(function(){ 
	$("#validate").keydown(function(e){ 
		if(e.which == 13){ 
		$("#Submitbut").click(); 
		return false; 
	} 
	});
}); 

