function isNumber(val)
    {
     //Returns true if val is a number defined as
      //   having an optional leading + or -.
    //   having at most 1 decimal point.:
     //   otherwise containing only the characters 0-9.
  var test1 = ".,0123456789"
var c

//Remaining characters can be only . or a digit, but only one decimal.
for (var i = 0; i < val.length; i++)
{
c = test1.indexOf(val.charAt(i))
if (c < 0)
return false
}
return true
    }

 //*************************************************

 function checkPhone(val)
     {
      if (!isPhonenumber(val))
        {
  var msg = "Please enter a phone number in the xxx-xxx-xxxx format"
alert(msg)
        document.form1.phone.focus()
          }
     }

function validNumber(Val)
{
  var ds = Val.value;
  for (i=0;i<ds.length;i++)
  {
    if (ds.charAt(i) < "0" || ds.charAt(i) > "9") 
	 {
	   var msg = "ONLY Numbers are Allowed... "
	  	alert(msg)
		Val.value = '';
	   Val.focus()
		return false	
   }
	}
	return true
}

  function checkNumber(Val)
  {
  var ds = Val.value;
  
if (!isNumber(ds))
{
    var msg = "The  Amount MUST be a Number (xxx.xxx)!"
alert(msg)
			Val.value = '';
        Val.focus()
      }
}

function isPhonenumber(val,errMsg)
    {
     //Returns true if val is a phone number in the
      //format xxx-xxx-xxxx. Returns false otherwise.
if (val.length != 12)
        return false
      //Check first three chars. Since no area codes start with zero
    // the eval of the first three chars must be >= 100.
     if (eval(val.substring(0,3)) < 100)
  return false
//The 4th character should be a "-"
    if (val.charAt(3) != "-")
         return false
    //The 5th thru 7th characters should evaluate to a
     //number >= 100.
      if (eval(val.substring(4,7)) < 100)
        return false
      //The 8th character should be a "-".
    if (val.charAt(7) != "-")
         return false
    //The last 4 characters are tricky because we cannot assume
     //there is not one or more leading zeros. Instead we see if
      //each of the 4 characters is present is a test string
    //consisting of the ten digits.
     var test = "0123456789"
      for (var i = 8; i < 12; i++)
        if (test.indexOf(val.charAt(i)) == -1)
              return false

      //All tests passed, so...
    return true
     }
