function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}

function checkuserinfo()
{
   if(checkspace(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("Please input your user name ");
	return false;
  }
    if(checkspace(document.userinfo.userpassword.value) || document.userinfo.userpassword.value.length < 5 || document.userinfo.userpassword.value.length >10) {
	document.userinfo.userpassword.focus();
    alert("Password length can wei space in between 5 to 10, please re-entry. ");
	return false;
  }
    if(document.userinfo.userpassword.value != document.userinfo.userpassword1.value) {
	document.userinfo.userpassword.focus();
	document.userinfo.userpassword.value = '';
	document.userinfo.userpassword1.value = '';
    alert("Two different input password, please re-entry. ");
	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 address format is not correct! ");
      document.userinfo.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email not empty! ");
   document.userinfo.useremail.focus();
   return false;
   }
   if(checkspace(document.userinfo.quesion.value)) {
	document.userinfo.quesion.focus();
    alert("Sorry, please fill key questions. ");
	return false;
  }
   if(checkspace(document.userinfo.answer.value)) {
	document.userinfo.answer.focus();
    alert("Sorry, please fill in the answer key questions!");
	return false;
  }
}
function checkshouhuoxx()
{
   if(checkspace(document.shouhuoxx.userzhenshiname.value)) {
	document.shouhuoxx.userzhenshiname.focus();
    alert("Sorry, please fill in real names! ");
	return false;
  }
  if(checkspace(document.shouhuoxx.shouhuodizhi.value)) {
	document.shouhuoxx.shouhuodizhi.focus();
    alert("Sorry, please complete address of the consignee detailed receipt!");
	return false;
  }
  if(checkspace(document.shouhuoxx.youbian.value)) {
	document.shouhuoxx.youbian.focus();
    alert("Sorry, please complete zip code. ");
	return false;
  }
  if(document.shouhuoxx.youbian.value.length!=6) {
	document.shouhuoxx.youbian.focus();
    alert("Sorry, please fill in the correct zip code. ");
	return false;
  } 
    if(checkspace(document.shouhuoxx.usertel.value)) {
	document.shouhuoxx.usertel.focus();
    alert("Sorry, please leave your phone! ");
	return false;
  }
      if(checkspace(document.shouhuoxx.songhuofangshi.value)) {
	document.shouhuoxx.songhuofangshi.focus();
    alert("Sorry, you have not chosen delivery method. ");
	return false;
  }
      if(checkspace(document.shouhuoxx.zhifufangshi.value)) {
	document.shouhuoxx.zhifufangshi.focus();
    alert("Sorry, you have not chosen to pay the way! ");
	return false;
  }
}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
