function isInteger(s)
{
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
 }
function isEmpty(s)
{
    return ((s == null) || (s.length == 0))
}

function isDigit(c)
{
   return ((c >= "0") && (c <= "9"))
}

function isValidEmail(address) 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(address) == false) {
      return false;
   }
   else
   {
	   return true;
   }
}

//去左空格; 
function ltrim(s){ 
    return s.replace( /^\s*/,""); 
} 
//去右空格; 
function rtrim(s){ 
    return s.replace( /\s*$/,""); 
} 
//去左右空格; 
function trim(s){
    return ltrim(rtrim(s));
}

function changeTwoDecimal(x)
{
   var f_x = parseFloat(x);
   if (isNaN(f_x))
   {
      //alert('function:changeTwoDecimal->parameter error');
      return false;
   }
   var f_x = Math.round(x*100)/100;
   var s_x = f_x.toString();
   var pos_decimal = s_x.indexOf('.');
   if (pos_decimal < 0)
   {
      pos_decimal = s_x.length;
      s_x += '.';
   }
   while (s_x.length <= pos_decimal + 2)
   {
      s_x += '0';
   }
   return s_x;
}
