

function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
function String.prototype.Ltrim(){return this.replace(/(^\s*)/g, "");}
function String.prototype.Rtrim(){return this.replace(/(\s*$)/g, "");}

function Trim_char(obj)
{
  var str=obj.value.Trim();
  obj.value=str;
  }

function check_view(form)
		{
                 if (form.commentaryTitle.value==""||form.commentaryTitle.value.Trim()=="")
                   {
                   window.alert("请填写评语标题，谢谢！");
                   form.commentaryTitle.focus();
                   return false;
		   }
               if(countInstances(form.commentaryTitle.value)>0){
                alert("信息监控系统提醒您：很抱歉，由于您提交的内容中含有系统不允许的关键词或者您的IP受到了访问限制，本次操作无效，系统已记录您的IP及您提交的所有数据。请注意，不要提交任何违反国家规定的内容！");
                form.commentaryTitle.focus();
                  return (false);
                }
		 if (form.txtcontent.value==""||form.txtcontent.value.Trim()=="")
		   {
                   window.alert("请填写评语内容，谢谢！");
		   form.txtcontent.focus();
		   return false;
		   }
              if (getLength(form.txtcontent.value) > 100)
                 {
                     alert("评语内容字数应小于100字符！");
		   form.txtcontent.focus();
		   return false;
                  }
                if(countInstances(form.txtcontent.value)>0){
              alert("信息监控系统提醒您：很抱歉，由于您提交的内容中含有系统不允许的关键词或者您的IP受到了访问限制，本次操作无效，系统已记录您的IP及您提交的所有数据。请注意，不要提交任何违反国家规定的内容！");
              form.txtcontent.focus();
                return (false);
              }
                  return true;
        }

  function textCounter(maxChars)
{
    var vlen=Math.floor(getLength(document.all.txtcontent.value));
	document.all.InputCount.innerHTML = maxChars -vlen ;
}


//字符长度
function  getLength(stringIn)
{
        var   strLength=0;
        strLength=stringIn.length;
        return   strLength;
}
