$(document).ready(
	function(){
		
		$('#regBox').animate({left:660},'fast');
					  $('#getPassword').animate({left:660},'fast');
					  $('#startReg').bind('click',startRegFun);
					  $('#forgetPswLink').bind('click',startGetPswFun);
					  $('#cancelRegBtn').bind('click',returnLogin);
					  $('#cancelGetPswBtn').bind('click',returnLogin);

		var flag=false;
		$('#usrname_reg').focus(function(){$('#iderr').html('<span><img src="css/blueprint/plugins/link-icons/icons/im.png"></span>用户名要求为email!');}).blur(function(){var email = $('input[name="usrname_reg"]').val();var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;flag = pattern.test(email);if(!flag){
$('#iderr').html('<span><img src="css/blueprint/plugins/buttons/icons/cross.png"></span>用户名格式不正确，必须为email!');$('usrname_reg').focus();return;}else{
$('#iderr').html('<span><img src="../cms/images/loading.gif" /></span>');
$.get("Ajax.aspx", {dopost:"regemail",email:email,num:Math.random()}, function (data, textStatus){
																this;
																if(data=="1"){
																$('#iderr').html('<span><img src="css/blueprint/plugins/buttons/icons/cross.png"></span>该email已经被注册！');
																flag=false;
																}
																else
																$('#iderr').html('<span><img src="css/blueprint/plugins/buttons/icons/tick.png"></span>用户名可用！');
																});
}
});
		$("#checkCode_reg").blur(
								 function(){
										   $.get("Ajax.aspx",{dopost:"chkcode",code:$('input[name="checkCode_reg"]').val(),mun:Math.random()},function(data,textStatus){																																				 this;
if(data=="0"){
$('#pwderr').html('<span><img src="css/blueprint/plugins/buttons/icons/cross.png"></span>验证码错误');
$('#pwderr').show();
flag =false;
}
})
										   });
		$("#psw_reg").focus(function (){$('#pwderr').css("display","none");});
		$("#pswConfirm_reg").focus(function (){$('#pwderr').css("display","none");});
		$("#regBtn").click(function (){
									 if($('input[name="psw_reg"]').val()!=$('input[name="pswConfirm_reg"]').val())
									 {
										 $('#pwderr').html("两次密码输入不一致！");
										 $('#pwderr').show();
										 return false;
										 }
										 if(!flag)
										 return false;
										 });
});
 function startRegFun(){
	$('#regBox').show();
	$('#loginBox').animate({left:0,opacity:0},'slow');
	$('#regBox').animate({left:330,opacity:1},'slow');
 }
 function startGetPswFun(){
	$('#getPassword').show();
	$('#loginBox').animate({left:0,opacity:0},'slow');
	$('#getPassword').animate({left:330,opacity:1},'slow');
 }
 function returnLogin(){
 	$('#regBox').animate({left:660,opacity:0},'slow');
 	$('#getPassword').animate({left:660,opacity:0},'slow');
	$('#loginBox').animate({left:330,opacity:1},'slow'); 	
 }
 
