function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}

function checkuserinfo()
{
   if(checkspace(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("对不起，请填写用户名！");
	return false;
  }
    if(checkspace(document.userinfo.userpassword.value) || document.userinfo.userpassword.value.length < 6 || document.userinfo.userpassword.value.length >20) {
	document.userinfo.userpassword.focus();
    alert("密码长度不能不能这空，在6位到20位之间，请重新输入！");
	return false;
  }
    if(document.userinfo.userpassword.value != document.userinfo.userpassword1.value) {
	document.userinfo.userpassword.focus();
	document.userinfo.userpassword.value = '';
	document.userinfo.userpassword1.value = '';
    alert("两次输入的密码不同，请重新输入！");
	return false;
  }

 if(document.userinfo.useremail.value.length!=0)
 {
  if (document.userinfo.useremail.value.charAt(0)=="." ||        
      document.userinfo.useremail.value.charAt(0)=="@"||       
     document.userinfo.useremail.value.indexOf('@', 0) == -1 || 
        document.userinfo.useremail.value.indexOf('.', 0) == -1 || 
      document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 || 
      document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
  {
  alert("Email地址格式不正确！");
   document.userinfo.useremail.focus();
    return false;
   }
  }
else
 {
alert("Email不能为空！");
  document.userinfo.useremail.focus();
 return false;
  }

   if(checkspace(document.userinfo.userzhenshiname.value)) {
	document.userinfo.userzhenshiname.focus();
    alert("对不起，请填写真实姓名！");
	return false;
  }
  if(checkspace(document.userinfo.shouhuodizhi.value)) {
	document.userinfo.shouhuodizhi.focus();
    alert("对不起，请填写收货人详细收货地址！");
	return false;
  }
    if(checkspace(document.userinfo.t1.value)) {
	document.userinfo.t1.focus();
    alert("对不起，请留下您的电话区号！");
	return false;
  }
 
    if(checkspace(document.userinfo.t2.value)) {
	document.userinfo.t2.focus();
    alert("对不起，请留下您的联系电话！");
	return false;
  }


}
function checkshouhuoxx()
{
   if(checkspace(document.shouhuoxx.userzhenshiname.value)) {
	document.shouhuoxx.userzhenshiname.focus();
    alert("对不起，请填写真实姓名！");
	return false;
  }
  if(checkspace(document.shouhuoxx.shouhuodizhi.value)) {
	document.shouhuoxx.shouhuodizhi.focus();
    alert("对不起，请填写收货人详细收货地址！");
	return false;
  }
  if(checkspace(document.shouhuoxx.youbian.value)) {
	document.shouhuoxx.youbian.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
  if(document.shouhuoxx.youbian.value.length!=6) {
	document.shouhuoxx.youbian.focus();
    alert("对不起，请正确填写邮编！");
	return false;
  } 
    if(checkspace(document.shouhuoxx.usertel.value)) {
	document.shouhuoxx.f1.focus();
    alert("对不起，请留下您的联系电话！");
	return false;
  }

}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
