/**
 * 
 */
/**
 * 注册验证
 */
function registerVa(){
	
	var is_ok=true;
	var user=$("#user").val();
	var pass=$("#pass").val();
	var email=$("#email").val();
	if(user=="")
		{
			alert("用户名不能为空");
			is_ok=false;
			return  false;
		}
	
	$.ajax({
		type:"POST",
		url:'index.php?c=mem&a=userHasExit&_p=ajax',
		data:"user="+user,
	    async:false,
		success:function(data)
		{
			if(data=="0")
			{
				is_ok=true;
			}else{
				is_ok=false;
				alert("该用户名不可以注册");
				return false;
			}
		}
			
	}
);
	if(pass=="")
		{
			alert("密码不能为空");
			is_ok=false;
			return  false;
		}
	if($("#pass").val()!=$("#pass1").val())
	{
		alert("密码与确认密码不一样");
		is_ok=false;
		return  false;
	}
	if(email=="")
	{
			alert("邮箱不能为空");
			is_ok=false;
			return  false;
	}
	if(!/^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}/.test(email))
		{
		alert("邮箱格式不对");
		is_ok=false;
		return  false;
		}
//	if(is_ok)
//		{
//			$.post('index.php?c=mem&a=inu&_p=ajax',{"user":user,"pass":pass,"email":email},function(data){
//				if(data=="1")
//					{
//						alert("注册成功");
//						//location.href="index.php?c=mem&a=index";
//						location.replace("index.php?c=mem&a=index");
//						document.regi.reset();
//						location.reload();
//						
//					}else{
//						alert("注册失败");
//						location.reload();
//					}
//			});
//		}
	return is_ok;
	
}

/********用户登入*******/
function loginVa(){
	var name=$("#name").val();
	var pass=$("#pass").val();
	if(name==""||pass=="")
		{
			alert("账户或密码不能为空");
			return false;
		}
	return true;

}
/**
 * 产品留言
 */
function messVa(){
	
	var mess=document.mess;
	var name=mess.name;
	var email=mess.email;
	var title=mess.title;
	var content=mess.content;
	if(name.value=="")
		{
			alert("名称不能为空");
			name.focus();
			return false;
		}
	if(email.value==""  || !/^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}/.test(email.value)){
		alert("名称不能为空或格式错误");
		email.focus();
		return false;
	}
	if(title.value==""){
		alert("标题不能为空");
		title.focus();
		return false;
	}
	if(content.value==""){
		alert("内容不能为空");
		content.focus();
		return false;
	}
	return true;
}
