<!--
//函数名：fucCheckTEL。
//功能介绍：检查是否为电话号码。
//参数说明：要检查的字符串。
//返回值：1为是合法，0为不合法。
function fucCheckTEL(TEL)
{
	var i,j,strTemp;
	strTemp="0123456789-()# ";
	for (i=0;i<TEL.length;i++)
	{
		j=strTemp.indexOf(TEL.charAt(i));	
		if (j==-1)
		{
		//说明有字符不合法
			return 0;
		}
	}
	//说明合法
	return 1;
}

//函数名：fucCheckLength。
//功能介绍：检查字符串的长度。
//参数说明：要检查的字符串。
//返回值：长度值。
function fucCheckLength(strTemp)
{
	var i,sum;
	sum=0;
	for(i=0;i<strTemp.length;i++)
	{
		if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255))
			sum=sum+1;
		else
			sum=sum+2;
	}
	return sum;
}

function textLimitCheck(thisArea, maxLength)
{
	if (thisArea.value.length > maxLength){
		alert('您只能输入' + maxLength + '个字符！\n超出的字符将被自动截掉！');
		thisArea.value = thisArea.value.substring(0, maxLength);
		thisArea.focus();
	}
    
	//回写span的值为当前填写文字的数量。
    messageCount.innerText = thisArea.value.length;
}

//检测数据的合法性。

function FormFeedback_onsubmit()
{

 if (document.FormFeedback.title.value == "")        
  {        
    alert("请填写反馈主题！");        
    document.FormFeedback.title.focus();        
    return (false);        
  }

 if (document.FormFeedback.real_name.value == "")        
  {        
    alert("请填写您的姓名！");        
    document.FormFeedback.real_name.focus();        
    return (false);        
  }

 if(document.FormFeedback.mailbox.value.length != 0)
  {
    if (
         document.FormFeedback.mailbox.value.charAt(0) == "." ||        
         document.FormFeedback.mailbox.value.charAt(0) == "@"||       
         document.FormFeedback.mailbox.value.indexOf('@', 0) == -1 || 
         document.FormFeedback.mailbox.value.indexOf('.', 0) == -1 || 
         document.FormFeedback.mailbox.value.lastIndexOf("@") == document.FormFeedback.mailbox.value.length-1 || 
         document.FormFeedback.mailbox.value.lastIndexOf(".") == document.FormFeedback.mailbox.value.length-1)
     {
      alert("电子邮箱书写格式不正确！");
      document.FormFeedback.mailbox.focus();
      return false;
      }
   }
 else
  {
   alert("电子邮箱不能为空！");
   document.FormFeedback.mailbox.focus();
   return false;
  }

 if ((fucCheckLength(document.FormFeedback.telephone.value)>30)||(fucCheckTEL(document.FormFeedback.telephone.value)==0))
  {
    alert("电话号码填写有误！");
    document.FormFeedback.telephone.focus();
    return false;			
  }

 if (document.FormFeedback.content.value == "")        
  {        
    alert("请填写内容！");        
    document.FormFeedback.content.focus();        
    return (false);        
  }

}
//-->

