 
	var em_flag=false;
	var pa_flag=false;
	 
	
	 $(document).ready(function(){
	 	
	 		//刷新验证码
	 		$('#refresh').click(function(){
	 		    var timestamp = (new Date()).valueOf();
	 			$('#authImg').attr('src','../../authImg?t='+timestamp+"'");
	 		});
	 		
	 		$('#authImg').click(function(){
	 		    var timestamp = (new Date()).valueOf();
	 			$('#authImg').attr('src','../../authImg?t='+timestamp+"'");
	 		});
	 		
	 		 
	 		 
	 	 	 
	 		//判断e-mail address是否为空，是否格式正确
	 		$('#email').blur(function(){
	 				if($(this).val()==''){
	 					$('#email_tip').html('<img src="../../theme/en-US/images/icon_error.gif">This information is required.');
	 					em_flag=false;
	 				}else {
	 					$('#email_tip').empty();
	 					var emailReg = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;
	 	 	 			var email_chk=emailReg.test($(this).val());
	 	 	 			if(email_chk!=true){
	 	 	 				$('#email_tip').html('<img src="../../theme/en-US/images/icon_error.gif">Please type your e-mail address in the following format: abc@example.com.');
	 	 	 				em_flag=false;
	 	 	 			}else{
	 	 	 				$('#email_tip').empty();
	 	 	 				em_flag=true;
	 	 	 			}
	 				}
	 				 
	 					
	 				 
	 		});
	 		
	 		//判断密码是否为空
	 		$('#password').blur(function(){
	 			if($(this).val()==''){
	 				$('#password_tip').html('<img src="../../theme/en-US/images/icon_error.gif">This information is required.');
	 				pa_flag=false;
	 			}else{
	 				$('#password_tip').empty();
	 				pa_flag=true;
	 			}
	 		});
	 		
	 		
	 		$('#randcode').bind('keydown',function(event) {   
          		if(event.keyCode==13){   
               	 $('#login_button').click();
               	 return false;
               	 }
       		 });
	 		  
	 		$('#login_button').click(function(){
	 				$('#password').blur();
	 				$('#email').blur();
	 			 	 
	 			 if(em_flag&&pa_flag){
	 			    var rand= $.trim($('#randcode').val());
	 			 	if(rand==""||rand.length<4){
	 			 		$('#randcode_tip').html('<img src="../../theme/en-US/images/icon_error.gif">This information is required.');
	 			 	return false;		
	 			 	}else{
	 			 		document.loginForm.submit();
	 			 	}
	 			 	 return false;
	 			 } 
	 			 return false;
	 		});
	 		
	 });

 
