﻿function check_ss()
{
	if (document.form2.caption.value=="" || document.form2.caption.value=="--请输入产品名称--")
	{
		alert("搜索关键字不能为空!");
		document.form2.caption.focus();
		return false;
	}
	return true;
}

function check_ly(l)
{
	if (document.formly.name.value=="")
	{
		if(l=="cn"){lm="姓名不能为空!";}else{lm="Name can not be empty!";}
		alert(lm);
		document.formly.name.focus();
		return false;
	}
	if (document.formly.dianhua.value=="")
	{
		if(l=="cn"){lm="电话不能为空!"}else{lm="Phone can not be empty!";}
		alert(lm);
		document.formly.dianhua.focus();
		return false;
	}
	var t=/(^\d{4}-(\d{8}|\d{7})$)|(^\d{2}-\d{3}-(\d{8})$)/g;
	var tel = document.formly.dianhua.value;
	if (!t.test(tel))
	{
		if(l=="cn"){lm="电话格式不正确!";}else{lm="Telephone format not correct!";}
		alert(lm);
		document.formly.dianhua.focus();
		return false;
	}
	if (document.formly.dizhi.value=="")
	{
		if(l=="cn"){lm="地址不能为空!";}else{lm="Address can not be empty!";}
		alert(lm);
		document.formly.dizhi.focus();
		return false;
	}
	if (document.formly.content.value=="")
	{
		if(l=="cn"){lm="详细内容不能为空!";}else{lm="Details can not be empty!";}
		alert(lm);
		document.formly.content.focus();
		return false;
	}
	if (document.formly.CheckCode.value=="")
	{
		if(l=="cn"){lm="验证码不能为空!";}else{lm="Code can not be empty!"}
		alert(lm);
		document.formly.CheckCode.focus();
		return false;
	}
	chcode=document.formly.CheckCode.value
	if(isNaN(chcode)|| chcode.length!=4)
	{
		if(l=="cn"){lm="验证码填写错误!";}else{lm="Code fill in error!";}
		alert(lm);
		document.formly.CheckCode.focus();
		return false;
	}
	
	return true;
}
function dinggou()
{
	if (document.form1.proname.value=="")
	{
		alert("标题不能为空!");
		document.form1.proname.focus();
		return false;
	}
	if (document.form1.name.value=="")
	{
		alert("姓名不能为空!");
		document.form1.name.focus();
		return false;
	}
	if (document.form1.dianhua.value=="")
	{
		alert("电话不能为空!");
		document.form1.dianhua.focus();
		return false;
	}
	var t=/(^\d{4}-(\d{8}|\d{7})$)|(^\d{2}-\d{3}-(\d{8})$)/g;
	var tel = document.form1.dianhua.value;
	if (!t.test(tel))
	{
		alert("电话格式不正确!");
		document.form1.dianhua.focus();
		return false;
	}
	if (document.form1.dizhi.value=="")
	{
		alert("地址不能为空!");
		document.form1.dizhi.focus();
		return false;
	}
	if (document.form1.beizhu.value=="")
	{
		alert("详细内容不能为空!");
		document.form1.beizhu.focus();
		return false;
	}
	if (document.form1.CheckCode.value=="")
	{
		alert("验证码不能为空!");
		document.form1.CheckCode.focus();
		return false;
	}
	chcode=document.form1.CheckCode.value
	if(isNaN(chcode)|| chcode.length!=4)
	{
		alert("验证码填写错误!");
		document.form1.CheckCode.focus();
		return false;
	}
	return true;
}

//登陆
function checkdl()
{
	if (document.form_dl.username.value=="")
	{
		alert("用户名不能为空!");
		document.form_dl.username.focus();
		return false;
	}
	if (document.form_dl.userpwd.value=="")
	{
		alert("登陆密码不能为空!");
		document.form_dl.userpwd.focus();
		return false;
	}
	if (document.form_dl.CheckCode.value=="")
	{
		alert("验证码不能为空!");
		document.form_dl.CheckCode.focus();
		return false;
	}
	chcode=document.form_dl.CheckCode.value
	if(isNaN(chcode)|| chcode.length!=4)
	{
		alert("验证码填写错误!");
		document.form_dl.CheckCode.focus();
		return false;
	}
	return true;
}

//普通注册
function zccheck()
{
	if (document.theForm.name.value=="")
	{
		alert("用户名不能为空!");
		document.theForm.name.focus();
		return false;
	}
	/*
	var filter=/^\s*[.A-Za-z0-9_-]{4,15}\s*$/;
	if (!filter.test(document.theForm.name.value)) { 
		alert("用户名填写不正确,可使用的字符为（A-Z a-z 0-9 _ - .)长度不小于4个字符，不超过15个字符。"); 
		document.theForm.name.focus();
		//document.Form1.user.select();
		return false;
	}*/ 
	if (document.theForm.Pwd.value=="")
	{
		alert("登陆密码不能为空!");
		document.theForm.Pwd.focus();
		return false;
	}
	if (document.theForm.Pwd2.value=="")
	{
		alert("确认密码不能为空!");
		document.theForm.Pwd2.focus();
		return false;
	}
/*
	if (document.theForm.dianhua.value=="")
	{
		alert("电话不能为空!");
		document.theForm.dianhua.focus();
		return false;
	}
	var t=/(^\d{4}-(\d{8}|\d{7})$)|(^\d{2}-\d{3}-(\d{8})$)/g;
	var tel = document.theForm.dianhua.value;
	if (!t.test(tel))
	{
		alert("电话格式不正确!");
		document.theForm.dianhua.focus();
		return false;
	}
	//if (document.theForm.shouji.value.length!=11)
	var shouj =parseInt(document.theForm.shouji.value);
	if(isNaN(shouj) || document.theForm.shouji.value.length!=11)
	{
		alert("手机填写不正确!");
		document.theForm.shouji.focus();
		return false;
	}
	var jine =parseInt(document.theForm.zfje.value);
	//if(isNaN(jine) || jine<100 || jine>1000)
	if(isNaN(jine) || jine<100)
	{
		alert('支付金额必须是大于100的整数!'); 
		document.theForm.zfje.focus();
		return false;
	}
*/
	if (document.theForm.mail.value=="")
	{
		alert("邮箱不能为空!");
		document.theForm.mail.focus();
		return false;
	}
	var email = document.theForm.mail.value;  //电子邮件
	var regEmail = /^\w+([.+-]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if (!regEmail.test(email)&&email.length>0)
	{
			alert("电子邮件输入格式不正确,请重新填写!");
			document.theForm.mail.focus();
			return false;
	}
	if (document.theForm.CheckCode.value=="")
	{
		alert("验证码不能为空!");
		document.theForm.CheckCode.focus();
		return false;
	}
	return true;
	
}

function payzf()
{
	
	if (document.payfrom.zfzh.value=="")
	{
		alert("支付账号不能为空!");
		document.payfrom.zfzh.focus();
		return false;
	}
	
	var jine =parseInt(document.payfrom.zfje.value);
	//if(isNaN(jine) || jine<50 || jine>1000)
	if(isNaN(jine) || jine<100)
	{
		alert('支付金额必须是大于100的整数!'); 
		document.payfrom.zfje.focus();
		return false;
	}
	return true;
}


function pinglunfrom()
{
	if (document.plname.nicheng.value=="")
	{
		alert("昵称不能为空!");
		document.plname.nicheng.focus();
		return false;
	}
	if (document.plname.content.value=="")
	{
		alert("内容不能为空!");
		document.plname.content.focus();
		return false;
	}
	if (document.plname.CheckCode.value=="")
	{
		alert("验证码不能为空!");
		document.plname.CheckCode.focus();
		return false;
	}

	return true;
}
