// JavaScript Document
<!--交换图像JS代码
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function CheckExp(reg,str)
{
	if(reg.test(str))
	{
		return true;
	}
	return false;
}

//验证邮箱格式
function isValidEmail(str)
{
	var reg = /^([a-zA-Z0-9_\.-]+)@(([a-zA-Z0-9_-]+)\.)+[a-zA-Z]{2,3}$/;
	return CheckExp(reg,str);
}

function isNull(str){	
	if (str == "") return true;	
	var regu = "^[ ]+$";	
	var re = new RegExp(regu);	
	return re.test(str);
}

//检查输入项是否为数字
function digit(check)
{
 return (('0'<=check) && (check<='9'));
}
//检查输入项是否为字母
function alpha(check)
{
 return ((('a'<=check) && (check<='z')) || (('A'<=check) && (check<='Z')))
}

<!--客户留言表单判断
function CheckContact(TheForm)
{
	if (TheForm.Uname.value=="")
	{
		alert('请输入姓名!');
		TheForm.Uname.focus();
		return false;
	}
	if (TheForm.Email.value=="")
	{
		alert('请输入邮箱!');
		TheForm.Email.focus();
		return false;
	}
	else
	{
		if (!isValidEmail(TheForm.Email.value))
		{
			alert('请输入正确的邮箱格式!');
			TheForm.Email.focus();
			return false;
		}
	}
	if (TheForm.Title.value=="")
	{
		alert('请输入标题!');
		TheForm.Title.focus();
		return false;
	}
	if (TheForm.Content.value=="")
	{
		alert('请输入内容!');
		TheForm.Content.focus();
		return false;
	}

}
//-->

<!--Modify by jncao-->
<!--客户购买产品注册表单判断
function CheckService(TheForm)
{
	if (TheForm.cUsername.value=="")
	{
		alert('请输入姓名!');
		TheForm.cUsername.focus();
		return false;
	}
	if (TheForm.cAddress.value=="")
	{
		alert('请输入用户地址!');
		TheForm.cAddress.focus();
		return false;
	}
	if (TheForm.cPostcode.value=="")
	{
		alert('请输入邮编!');
		TheForm.cPostcode.focus();
		return false;
	}
	if (TheForm.cTelephone.value=="")
	{
		alert('请输入电话号码!');
		TheForm.cTelephone.focus();
		return false;
	}
	if (TheForm.dBuyDate.value=="")
	{
		alert('请输入购买日期!');
		TheForm.dBuyDate.focus();
		return false;
	}
	if (TheForm.cBuyAddress.value=="")
	{
		alert('请输入购买地点!');
		TheForm.cBuyAddress.focus();
		return false;
	}
	if (TheForm.cInvoiceNo.value=="")
	{
		alert('请输入发票号码!');
		TheForm.cInvoiceNo.focus();
		return false;
	}
	if (TheForm.cMDName.value=="")
	{
		alert('请输入产品名称!');
		TheForm.cMDName.focus();
		return false;
	}
	if (TheForm.cSMPModel.value=="")
	{
		alert('请输入产品型号!');
		TheForm.cSMPModel.focus();
		return false;
	}
}
//-->

<!--登陆界面Js验证
function CheckReg(TheForm)
{
	if ( TheForm.UserName.value=="" )
	{
		alert('请输入用户名!');
		TheForm.UserName.focus();
		return false;
	}
	if ( TheForm.Password.value=="" )
	{
		alert('请输入密码!');
		TheForm.Password.focus();
		return false;
	}
}
//-->

function contain(str,charset)// 字符串包含测试函数
{
var i;
for(i=0;i<charset.length;i++)
if(str.indexOf(charset.charAt(i))>=0)
return true;
return false;
}

<!--注册页面Js表单验证
function CheckRegData(TheForm)
{
	var strAccount=TheForm.Account.value;
	if ( strAccount=="" )
	{
		alert('请输入用户名!');
		TheForm.Account.focus();
		return false;
	}
	else
	{
		if ( strAccount.length>11 )
		{
			alert('用户名不能超过10位!');
			TheForm.Account.focus();
			return false;
		}
		for (index=0; index<strAccount.length; index++)
		{
			check = strAccount.charAt(index);
			if (!(digit(check) || alpha(check)))
			{
				alert("用户名只能使用字母或数字！");
				form1.Account.focus();
				return false;
			}
		}
	}
	if ( TheForm.Username.value=="" )
	{
		alert('请输入宝宝姓名!');
		TheForm.Username.focus();
		return false;
	}
	if (TheForm.Email.value=="")
	{
		alert('请输入邮箱!');
		TheForm.Email.focus();
		return false;
	}
	else
	{
		if (!isValidEmail(TheForm.Email.value))
		{
			alert('请输入正确的邮箱格式!');
			TheForm.Email.focus();
			return false;
		}
	}
	var strPwd=TheForm.Pwd.value;
	if ( strPwd=="" )
	{
		alert('请输入密码!');
		TheForm.Pwd.focus();
		return false;
	}
	else
	{
		if(strPwd.length<6 || strPwd.length>13)
		{
			alert('密码必须是6到12位之间!');
			TheForm.Pwd.focus();
			return false;
		}
		
		for (pwIndex=0; pwIndex<strPwd.length; pwIndex++)  
		{  
			cCheck = strPwd.charAt(pwIndex);
			if ( cCheck==' ' || cCheck==':' || cCheck=='\'' || cCheck=='"' )  
			{  
				alert("密码不能使用空格和单双引号( ,',\")!");  
				TheForm.Pwd.focus();  
				return false;  
			}  
		}
		if (strPwd != TheForm.Pwd2.value)
		{
			alert("两次输入的密码不一致!");
			TheForm.Pwd2.focus();
			return false;
		}
	}
	if ( TheForm.cckk.checked==false )
	{
		alert('只有接受协议才能继续进行注册!');
		return false;
	}
}
//-->

<!--会员资料页面Js表单验证
function CheckData(TheForm)
{
	var strPwd=TheForm.Pwd.value;
	if ( strPwd!="" )
	{
		if(strPwd.length<6 || strPwd.length>13)
		{
			alert('密码必须是6到12位之间!');
			TheForm.Pwd.focus();
			return false;
		}
		for (pwIndex=0; pwIndex<strPwd.length; pwIndex++)  
		{  
			cCheck = strPwd.charAt(pwIndex);
			if ( cCheck==' ' || cCheck==':' || cCheck=='\'' || cCheck=='"' )  
			{  
				alert("密码不能使用空格和单双引号( ,',\")!");  
				TheForm.Pwd.focus();  
				return false;  
			}  
		}
		if (strPwd != TheForm.Pwd2.value)
		{
			alert("两次输入的密码不一致!");
			TheForm.Pwd2.focus();
			return false;
		}
	}
	if ( TheForm.Birthday.value=="" )
	{
		alert('请选取宝宝生日!');
		TheForm.Birthday.focus();
		return false;
	}
	if (TheForm.Email.value=="")
	{
		alert('请输入邮箱!');
		TheForm.Email.focus();
		return false;
	}
	else
	{
		if (!isValidEmail(TheForm.Email.value))
		{
			alert('请输入正确的邮箱格式!');
			TheForm.Email.focus();
			return false;
		}
	}
	if ( TheForm.province.value=="" )
	{
		alert('请选取省份!');
		TheForm.province.focus();
		return false;
	}
	if ( TheForm.city.value=="" )
	{
		alert('请选取城市!');
		TheForm.city.focus();
		return false;
	}
}
//-->


//会员注册账号，昵称，邮箱检测Js代码
function check_id_window(value){
	window.open("inc/Sycode.asp?action=CheckAccount&Account="+value,"",'toolbar=no,directories=no,scrollbars=0,resizable=1,status=no,menubar=0,width=250,height=100');
}

function check_name_window(value){
	window.open("inc/Sycode.asp?action=CheckUsername&Username="+value,"",'toolbar=no,directories=no,scrollbars=0,resizable=1,status=no,menubar=0,width=250,height=100');
}

<!--报名表单Js验证
function CheckAppData(TheForm)
{
	if ( TheForm.Sel.value=="" )
	{
		alert('请选择活动!');
		TheForm.Sel.focus();
		return false;
	}
	if ( TheForm.Username.value=="" )
	{
		alert('请输入姓名!');
		TheForm.Username.focus();
		return false;
	}
	if (TheForm.Email.value=="")
	{
		alert('请输入邮箱!');
		TheForm.Email.focus();
		return false;
	}
	else
	{
		if (!isValidEmail(TheForm.Email.value))
		{
			alert('请输入正确的邮箱格式!');
			TheForm.Email.focus();
			return false;
		}
	}
	if (TheForm.MSN.value!="")
	{
		if (!isValidEmail(TheForm.MSN.value))
		{
			alert('请输入正确的MSN格式!');
			TheForm.MSN.focus();
			return false;
		}
	}
	if ( TheForm.province.value=="" )
	{
		alert('请选取省份!');
		TheForm.province.focus();
		return false;
	}
	if ( TheForm.city.value=="" )
	{
		alert('请选择城市!');
		TheForm.city.focus();
		return false;
	}
}
//-->

<!--
function del_row(url)
{
	if(confirm("确认删除?"))
	{
		location.href=url;
	}
}
//-->