function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function isDate (day,month,year) {
// checks if date passed is valid
// will accept dates in following format:
// isDate(dd,mm,ccyy), or
// isDate(dd,mm) - which defaults to the current year, or
// isDate(dd) - which defaults to the current month and year.
// Note, if passed the month must be between 1 and 12, and the
// year in ccyy format.

    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) )
        return true;
    else
        return false
}
function isblank(s) {
   for(var i = 0; i < s.value.length; i++) {
      var c = s.value.charAt(i);
      if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
   }
   return true;
}  
function IsNumeric(passedVal) {
    if (!passedVal) return false;
    if (((passedVal / passedVal ) != 1) && (passedVal != 0))
	  return false;
	else
      return true;
} 
function IsInteger(string) {
    var Chars = "0123456789";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
          return false;
    }
    return true;
} 
function wordcount(string) {
  var a = string.value.split(/\s+/g); // split the sentence into an array of words
  return a.length;
}

