//--------注册函数

function showInformation(msg)
{
	//alert("regester error "+msg);
	//if(msg!="")
	// 	alert(msg);
    document.getElementById("info").innerHTML=msg;
}

function regesterUser(account,passwd,passwd_retry,nick_name,email,mobile_type,checkcodestr){
	
	
	if(account==""){
		//alert("regester 0");
		showInformation("手机号码不能为空！");       
      //account.focus();
      return ;
  	}
     //alert("regester 2");
     
	 if (isNaN(account))
	 {
	 	
	 		showInformation("手机号码输入的不是数字！");   
	 		return   false;
	 }
	 else if (account.length!=11){
			showInformation("手机号码的长度不是11位！");   
	 		return   false;
	}
	 
	 //alert("regester 3");
     
     if(passwd==""){
     	
       showInformation("密码不能为空！");  
       //passwd.focus();

     }
	 else if(passwd!=passwd_retry){
       showInformation("密码与密码确认不相同！");  
       //passwd.focus();
     }
     //else if(token.value==""){
     //  showInformation("访问密码不能为空！");  
      // token.focus();
     //}
     else if(email==""){
       showInformation("邮件不能为空！");  
       //email.focus();
     }
     else if(mobile_type==""){
       showInformation("手机型号不能为空！");  
       //mobile_type.focus();

     }
     
	 else{
		 regester(account,passwd,nick_name,email,mobile_type,checkcodestr);
	 }
	 
}


function regester(account,passwd,nick_name,email,mobile_type,checkcodestr)
{
	document.getElementById("info").innerText="正在处理中，请稍候...";
	ajax_call("../api/rpc.php","regester",new Array(account,passwd,nick_name,email,mobile_type,checkcodestr),onResult);
}

function onResult(rt)
{
	if (rt[0]=="0"){
		setCookie("login_uid",rt[1]);
		alert("注册成功，您的乐图号为"+rt[1]+",此号码用于手机和网站登录，请谨记此号码！");
		window.location.href = "../index.php";
		//parent.parent.hideInfoView();
		//parent.parent.openLoginForm();
	}
	else
		showInformation(rt[1]); 
}

function tourl()
{
		window.location.href = "../index.php";

}


//--------登陆函数

 function showContent(sUrl){
   	parent.showInfoView(sUrl);
}	
  /**      
function OnLoad()
{
	login_id.value=getCookie("login_uid");
	obj=document.getElementById("tb01");
	obj.style.top=(document.documentElement.offsetHeight-229)/2+"px";
	obj.style.left=(document.documentElement.offsetWidth-411)/2+"px";
}

**/
var _name=null;
function _login(name,password,type)
{
	//alert("user_info login name="+name);
	_name=name;
	ajax_call("../api/rpc.php","login",new Array(name,password,type),onLoginResult);
	showInformation("正在登录,请梢侯......");
	//ajaxSend(HOST+"/login.php?uid="+name+"&password="+password,ajaxRecv);
}

//成功登录跳转 REF
function onLoginResult(rt)
{
	//alert(" user_info onLoginResult");
	if (rt[0]=="0")
	{
		//var 
	//alert("login_uid "+_name);
		setCookie("login_uid",_name);
		window.location.href=REF;
	}
	else
		showInformation(rt[1]);	
}

window.onresize=function(){
		//obj=document.getElementById("tb01");
		//obj.style.top=(document.documentElement.offsetHeight-229)/2+"px";
		//obj.style.left=(document.documentElement.offsetWidth-411)/2+"px";

}
	

