function checkmail(){
if(document.youjian.useremail.value.length!=0)
  {
    if (document.youjian.useremail.value.charAt(0)=="." ||        
         document.youjian.useremail.value.charAt(0)=="@"||       
         document.youjian.useremail.value.indexOf('@', 0) == -1 || 
         document.youjian.useremail.value.indexOf('.', 0) == -1 || 
         document.youjian.useremail.value.lastIndexOf("@")==document.youjian.useremail.value.length-1 || 
         document.youjian.useremail.value.lastIndexOf(".")==document.youjian.useremail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.youjian.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.youjian.useremail.focus();
   return false;
   }
}


 function   adduser(adduser)   
  {   
          window.open("",adduser,"width=510,height=370,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no");   
  } 
  
  
  function is_number(str)
{
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}

function CheckInput(){

	if(form.name.value==''){
		alert("您没有填写昵称！");
		form.name.focus();
		return false;
	}
	if(form.name.value.length>20){
		alert("昵称不能超过20个字符！");
		form.name.focus();
		return false;
	}

	if(!is_number(document.form.qq.value)){
		alert("QQ号必须是数字！");
		form.qq.focus();
		return false;
	}

	if(form.content.value==''){
		alert("您没有填写留言内容！");
		form.content.focus();
		return false;
	}
	if(form.content.value.length>255){
		alert("留言内容不能超过255个字符！");
		form.content.focus();
		return false;
	}
	if(form.validatecode.value==''){
		alert("您没有填写验证码！");
		form.validatecode.focus();
		return false;
	}
	return true;
}


function chsel(){
		with (document.userinfo){
			if(szSheng.value) {
				szShi.options.length=0;
				for(var i=0;i<selects[szSheng.value].length;i++){
					szShi.add(selects[szSheng.value][i]);
				}
			}
		}
	}
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.youbian.value)) {
	document.userinfo.youbian.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
  if(document.userinfo.youbian.value.length!=6) {
	document.userinfo.youbian.focus();
    alert("对不起，请正确填写邮编！");
	return false;
  } 
    if(checkspace(document.userinfo.usertel.value)) {
	document.userinfo.usertel.focus();
    alert("对不起，请填写电话号码！");
	return false;
  } 
        if(checkspace(document.userinfo.songhuofangshi.value)) {
	document.userinfo.songhuofangshi.focus();
    alert("对不起，您还没有选择送货方式！");
	return false;
  }
      if(checkspace(document.userinfo.zhifufangshi.value)) {
	document.userinfo.zhifufangshi.focus();
    alert("对不起，您还没有选择支付方式！");
	return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function dlgform(theForm)
{
	
	
	
	if (theForm.username.value=="") {
    window.alert("请输入帐号!");
    theForm.username.focus();
    return (false);
  }
  
   if (theForm.userpassword.value=="") {
    window.alert("请输入密码!");
    theForm.userpassword.focus();
    return (false);
  }
  
    if (theForm.verifycode.value=="") {
    window.alert("请输入验证码!");
    theForm.verifycode.focus();
    return (false);
  }
}

function check()
{
  if(checkspace(document.pinglunform.pinglunname.value)) {
	document.pinglunform.pinglunname.focus();
    alert("请填写您的姓名！");
	return false;
  }
  if(checkspace(document.pinglunform.pingluntitle.value)) {
	document.pinglunform.pingluntitle.focus();
    alert("请填评论标题！");
	return false;
  }
  if(checkspace(document.pinglunform.pingluncontent.value)) {
	document.pinglunform.pingluncontent.focus();
    alert("请填评论正文！");
	return false;
  }
  
   if(checkspace(document.pinglunform.validatecode.value)) {
	document.pinglunform.validatecode.focus();
    alert("请填验证码！");
	return false;
  }
	  }


function getObject(objectId) {
			if(document.getElementById && document.getElementById(objectId)) {
			return document.getElementById(objectId);
			} 
			  else if (document.all && document.all(objectId)) {
			      return document.all(objectId);
			} 
			  else if (document.layers && document.layers[objectId]) {
			return document.layers[objectId];
			} 
			  else {
			return false;
		    }
			
			}
	
		function showmenu(n,num){
	      for(var i=1;i<=num;i++)
		  {
	  
		        if (i==n){
			    getObject('bimg'+i).style.display='';
				getObject('tb'+i).style.display='';
	                   }
			
			else {
			   getObject('bimg'+i).style.display='none';
			   getObject('tb'+i).style.display='none';
			
			      }
			}
        }

