var UserRegister=
{
 	SubmitForm:function(event)
	{
		if (document.RegisterForm.IsRead.checked==false)
		{
			alert('注册，必须阅读并同意《雅昌艺品服务协议》')
			return false;
		}
		document.RegisterForm.submit();
	},
	ReIdentifyingCode:function()
	{
		$("#IdentifyingCodeImg")[0].src="/ArtronFrameWork/SiteCtrl/IdentifyingCode/IdentifyingCode.php?SessionKey=IdentifyingCode&Num="+Site.ReturnRandNum();
	}
}
$(document).ready(function(){
    $.formValidator.initConfig({formid:"RegisterForm",onerror:function(msg){alert(msg)},onsuccess:function(){UserRegister.SubmitForm();return false;}});
    $("#UserName").formValidator({onshow:"请输入用户名",onfocus:"邮件格式,最少6位，最高32位",oncorrect:"该用户名可以注册"}).inputValidator({min:6,max:32,onerror:"你输入的用户名非法,请确认"}).regexValidator({regexp:"email",datatype:"enum",onerror:"用户名格式不正确"})
    .ajaxValidator({
        type : "get",
        url : "/Response/CheckUser.php",
        datatype : "json",
        success : function(data){
            if( data == "1" )
            {
                return true;
            }
            else
            {
                return false;
            }
        },
        buttons: $("#button"),
        error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
        onerror : "用户名已存在，请更换用户名",
        onwait : "正在校检用户名，请稍候..."
    }); 
	
    $("#PassWord").formValidator({onshow:"请输入密码",onfocus:"密码不能为空",oncorrect:"密码合法"}).inputValidator({min:6,max:16,onerror:"密码长度不正确！"});
    $("#PassWord_").formValidator({onshow:"请输入重复密码",onfocus:"两次密码必须一致哦",oncorrect:"密码一致"}).inputValidator({min:1,max:16,empty:{leftempty:false,rightempty:false,emptyerror:"重复密码两边不能有空符号"},onerror:"重复密码不能为空,请确认"}).compareValidator({desid:"PassWord",operateor:"=",onerror:"2次密码不一致,请确认"})
	$("#IdentifyingCode").formValidator({empty:false,onshow:"&nbsp;",onfocus:"<img src='/images/0231.gif'/>",oncorrect:"<img src='/images/002.gif'/>",onempty:"<img src='/images/0151.gif'/>"}).inputValidator({min:4,max:4,onerror:"<img src='/images/0151.gif'/>"})
	.ajaxValidator({
        type : "get",
        url : "/Response/CheckIdentifyingCode.php",
        datatype : "json",
        success : function(data){    
            if( data == "1" )
            {
                return true;
            }
            else
            {
                return false;
            }
        },
        buttons: $("#button"),
        error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
        onerror : "<img src='/images/0151.gif'/>",
        onwait : "<img src='/images/0231.gif'/>."
    }); 
});