function isNumber(theElement,theElementname)
{
  s = theElement.value;
  if (isNaN(Math.abs(theElement.value)) && (s.charAt(0) != '#'))
  {
      if ( typeof theElementname == "undefined" ) 
      {
         alert( " Value must be a number." );
         theElement.focus(); 
         theElement.select(); 
         return false;
      } 
      else  
      { 
         for (var i=0; (i <= s.length && s.charAt(i) != '.'); )
         {
          if (((s.charAt(i) >= 0) && (s.charAt(i) <= 9)) ||
               (s.charAt(i) == ',' && i != 0 && i != s.length-1) || (s.charAt(i) == '.') )
                 i++; 
          else 
           { 
             alert( theElementname +  " Value must be a number / must be of proper format" ); 
             theElement.focus(); 
             theElement.select(); 
             return false; 
           } 
         } 
        if (s.charAt(i) == '.') 
         { 
	     for (i++;i <= s.length; ) 
           { 
            if (((s.charAt(i) >= 0) && (s.charAt(i) <= 9))) 
              i++; 
            else 
            { 
             alert( theElementname +  " Value must be a number / must be of proper format" ); 
             theElement.focus(); 
             theElement.select(); 
             return false;
            } 
           } 
         } 
       } 
  } 
  return true;
}
