/***************************** check the contact form ***************************/
var whitespace = " \t\n\r";
var digits = "0123456789";

function isEmpty(s) {   
	return ((s == null) || (s.length == 0))
}
function isDigit(c) {
    return ((c >= "0") && (c <= "9"))
}

function isEmptyOrWhitespace (s) {   
	var i;
    if (isEmpty(s)) return true;
    for (i = 0; i < s.length; i++) {   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    return true;
}

function isRadioSelected(radiofield) {   
	for (var i = 0; i < radiofield.length; i++) {   
		if (radiofield[i].checked) return true
    }
    return false
}

function isValidPhoneNumber(s) {
	var temp = s.replace(/\D/g, "")
	return temp.length > 9 && temp.length < 26
}

function isNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
 }

 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;
 }

