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

function checkmess()
{  
   if(checkspace(document.messinfo.messtype.value)) {
	document.messinfo.messtype.focus();
    alert("您没有选择留言类型！");
	return false;
  }
   if(checkspace(document.messinfo.messsubject.value)) {
	document.messinfo.messsubject.focus();
    alert("您没有填写主题！");
	return false;
  }
   
    
  
  if(document.messinfo.messemail.value.length!=0)
  {
    if (document.messinfo.messemail.value.charAt(0)=="." ||        
         document.messinfo.messemail.value.charAt(0)=="@"||       
         document.messinfo.messemail.value.indexOf('@', 0) == -1 || 
         document.messinfo.messemail.value.indexOf('.', 0) == -1 || 
         document.messinfo.messemail.value.lastIndexOf("@")==document.messinfo.messemail.value.length-1 || 
         document.messinfo.messemail.value.lastIndexOf(".")==document.messinfo.messemail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.messinfo.messemail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.messinfo.messemail.focus();
   return false;
   }
 if(checkspace(document.messinfo.messcontent.value)) {
	document.messinfo.messcontent.focus();
    alert("请填写反馈信息内容！");
	return false;
  }

if(checkspace(document.messinfo.passcode.value)) {
	document.messinfo.passcode.focus();
    alert("请输入验证码！");
	return false;
}
}
//----------------------------
function search()
{
   if(checkspace(document.searchform.searchkey.value))  {
	document.searchform.searchkey.focus();
	alert("请输入查询关键字！");
	return false;
  }
   document.searchform.submit();
}
//----------------------------
function check()
{
   if(checkspace(document.searchform.searchkey.value !='请输入关键字'))  {
	document.searchform.searchkey.focus();
	alert('请输入查询关键字!');
	return false;
  }
  if(checkspace(document.searchform.searchkey.value))  {
	document.searchform.searchkey.focus();
	alert('请输入查询关键字!');
	return false;
  }
   document.searchform.submit();
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//--------------------------
function checkname(str){
exp=/[^\w]/gi;
if(str.search(exp)!=-1)
{return false;}
return true;
}
function check()
{
   if(checkspace(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("用户名不能为空，请重新输入！");
	return false;
  }
   if(!checkname(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("用户名只能用字母、数字、下划线组成，请重新输入！");
	return false;
  }
    if(checkspace(document.userinfo.username.value) || document.userinfo.username.value.length < 4) {
	document.userinfo.username.focus();
    alert("会员帐户必须大于4位，请重新输入！");
	return false;
  }

    if(checkspace(document.userinfo.UserPassword.value) || document.userinfo.UserPassword.value.length < 6) {
	document.userinfo.UserPassword.focus();
    alert("密码长度不能小于6，请重新输入！");
	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(checkspace(document.userinfo.UserQuesion.value)) {
	document.userinfo.UserQuesion.focus();
    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;
   }



  } 

function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}

//----------------
function search()
{
   if(checkspace(document.searchemsform.searchkey.value))  {
	document.searchemsform.searchkey.focus();
	alert("请输入查询关键字！");
	return false;
  }
   document.searchemsform.submit();
}
//----------------
function checkk()
{
   if(checkspace(document.form2.searchkey.value))  {
	document.form2.searchkey.focus();
	alert("请输入查询关键字！");
	return false;
  }
   document.form2.submit();
}

//-->