// JavaScript Document

function loginCheckAndSubmit()
{
	if(document.postForm.user_name.value.length<1)
	{ 
		alert('敬告：请填写用户名!');
		document.postForm.user_name.focus();
		return false;
	}
	if(document.postForm.password.value.length<1)
	{ 
		alert('敬告：请填写密码!');
		document.postForm.password.focus();
		return false;
	}
	if(document.postForm.isLoverGift.value.length<1)
	{ 
		alert('敬告：请填写验证码!');
		document.postForm.isLoverGift.focus();
		return false;
	}
	document.postForm.submit();
}

function userRegisterCheckAndSubmit()
{
	if( document.postForm.user_name.value.length < 1 )
	{ 
		alert('敬告：请填写用户名!') ;
		document.postForm.user_name.focus() ;
		return false ;
	}
	
	if( document.postForm.password.value.length < 1 )
	{ 
		alert('敬告：请填写密码!') ;
		document.postForm.password.focus() ;
		return false ;
	}
	
	if( document.postForm.password.value != document.postForm.confirmPassword.value )
	{ 
		alert('敬告：密码与确认密码不相同，请重新填写!') ;
		document.postForm.password.value = '' ;
		document.postForm.confirmPassword.value = '' ;
		document.postForm.password.focus() ;
		return false ;
	}
	
	if( document.postForm.email.value == '' )
	{
		alert('敬告：请填写电子邮件!');
		document.postForm.email.select();
		return false;
	}
	if( !isRightStr4Email(document.postForm.email.value) )
	{
		alert('敬告：请正确填写电子邮件地址!');
		document.postForm.email.select();
		return false;
	}
	if(document.postForm.isLoverGift.value.length<1)
	{ 
		alert('敬告：请填写验证码!');
		document.postForm.isLoverGift.focus();
		return false;
	}
	document.postForm.submit() ;
}

function userAmendCheckAndSubmit()
{
	if( document.postForm.user_name.value.length < 1 )
	{ 
		alert('敬告：请填写用户名!') ;
		document.postForm.user_name.focus() ;
		return false ;
	}
	
	if( document.postForm.password.value.length < 1 )
	{ 
		alert('敬告：请填写密码!') ;
		document.postForm.password.focus() ;
		return false ;
	}
	
	if( document.postForm.newPassword.value.length > 0 || document.postForm.newConfirmPassword.value.length > 0 )
	{ 
		if( document.postForm.newPassword.value.length < 1 )
		{ 
			alert('敬告：请填写新密码!') ;
			document.postForm.newPassword.focus() ;
			return false ;
		}
		
		if( document.postForm.newPassword.value != document.postForm.newConfirmPassword.value )
		{ 
			alert('敬告：新密码与确认密码不相同，请重新填写!') ;
			document.postForm.newPassword.value = '' ;
			document.postForm.newConfirmPassword.value = '' ;
			document.postForm.newPassword.focus() ;
			return false ;
		}
	}
	
	if( document.postForm.email.value == '' )
	{
		alert('敬告：请填写电子邮件!');
		document.postForm.email.select();
		return false;
	}
	if( !isRightStr4Email(document.postForm.email.value) )
	{
		alert('敬告：请正确填写电子邮件地址!');
		document.postForm.email.select();
		return false;
	}
	document.postForm.submit() ;
}