function checkstring(name,data,allowednull)
{
var datastr = data;
var lefttrim = datastr.search(/\S/gi);

if (lefttrim == -1) {
    if (allowednull) {
      return 1;
    } else {
      alert("请输入" + name + "！");
      return -2;
    }
  }
  
  if (datastr.search(/[<>]/gi) != -1) {
    alert("" + name + "中包含非法字符<>");
    return -1;
  }
  
  if (datastr.search(/[''`@#$%^&()+-]/gi) != -1) {
    alert("" + name + "中包含非法字符''");
    return -1;
  }  
  if (datastr.search(/[""*! ]/gi) != -1) {
    alert("" + name + "中包含非法字符");
    return -1;
  } 
  if (datastr.search(/[“”《》]/gi) != -1) {
    alert("" + name + "中包含非法字符");
    return -1;
  } 

   return 0;
}

function checkemail(name, data, allowednull)
{
  var datastr = data;
  var lefttrim = datastr.search(/\S/gi);
  
  if (lefttrim == -1) {
    if (allowednull) {
      return 1;
    } else {
      alert("请输入一个正确的E-mail地址！");
      return -1;
    }
  }
  var myRegExp = /[a-z0-9](([a-z0-9]|[_\-\.][a-z0-9])*)@([a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)((\.[a-z0-9]([a-z0-9]|[_\-][a-z0-9])*)*)/gi;
  var answerind = datastr.search(myRegExp);
  var answerarr = datastr.match(myRegExp);
  
  if (answerind == 0 && answerarr[0].length == datastr.length)
  {
    return 0;
  }
  
  alert("请输入一个正确的E-mail地址！");
  return -1;
}
function parseNum(theNum){
  if (theNum.substring(0,1)==0)
    theNum=theNum.substring(1)
  return theNum
}
function numbersonly(myfield, e, dec)
         {
             var key;
             var keychar;
             if (window.event)
              key = window.event.keyCode;
             else if (e)
              key = e.which;
             else
              return true;
             keychar = String.fromCharCode(key);
             // control keys
             if ((key==null) || (key==0) || (key==8) ||(key==9) || (key==13) || (key==27) ) return true;
             // numbers
             else if ((("0123456789").indexOf(keychar) > -1))
             return true;
             // decimal point jump
             else if (dec && (keychar == "."))
             {
                 myfield.form.elements[dec].focus();
                 return false;
             }
             else return false;
         }

