function isEMail(InputValue)
{
//Parameters:	InputValue - the value to be checked
//
//Returns:		True - the input value is a correctly formatted e-mail address
//					False - if the input value does not contain a '@' and '.' .

   if (InputValue.indexOf ('@',0) == -1 || InputValue.indexOf ('.',0) == -1)
	      return false;
   else
      return true;
}

function IsNumeric (InputValue, AllowDecimal, AllowMinus)
{
//Parameters:	InputValue - the value to be checked
//					AllowDecimal - indicates whether (true) or not (false) a decimal point is
//						allowed
//					AllowMinus - indicates whether (true) or not (false) a minus sign is allowed
//
//Returns:		True - the input value is a valid numeric
//					False - the input value contains an invalid character

	var FoundDecimal = false;
	var FoundMinus = false;

	for (var i = 0; i < InputValue.length; i++) 
	{
		var ch = InputValue.substring(i, i + 1);
		if (ch == ".")
			if (AllowDecimal)
				if (FoundDecimal)
					return false;
				else
					FoundDecimal = true;
			else
				return false;
		else if (ch == "-")
			if (AllowMinus)
				if (FoundMinus)
					return false;
				else
					FoundDecimal = true;
			else
				return false;
		else if (ch < "0" || "9" < ch)
			return false;
	}
	return true;	
}

function isPhone(InputValue)
{
//Parameters:	InputValue - the value to be checked
//
//Returns:		True - the input value is a valid phone/fax number
//					False - the input value contains an invalid character

// Checks that characters are numbers, hyphens or parenthesis.

	for (var i = 0; i < InputValue.length; i++) 
   {
	   var ch = InputValue.substring(i, i + 1);
	   if ((ch < "0" || "9" < ch) && ch != "-" && ch != " " && ch != "(" && ch != ")") 
	      return false;
   }
	return true;
}

function IsDate(InputValue)
{
//Parameters:	InputValue - the value to be checked
//
//Returns:		True - the input value is a valid phone/fax number
//					False - the input value contains an invalid character

// Checks that the date entered is valid

   if (InputValue != "")
   {
		if (InputValue.length != 10) 
		{
			alert("The date fields must be in the format 'mm-dd-yyyy'.");
			return false;
		}
			
		// Checks that characters are numbers or hyphens.
		for (var i = 0; i < InputValue.length; i++) 
		   {
		   var ch = InputValue.substring(i, i + 1);
		   if ((ch < "0" || "9" < ch) && ch != "-") 
		      {
		      alert("The date fields accept only numbers & a hyphen in this format:\n\nmm-dd-yyyy");
		      return false;
		      }
		   }

		// Check out month value.
		if ( (InputValue.substring(0, 2) < 1)  ||  (InputValue.substring(0, 2) > 12)  ) 
		   {
		   alert("\nMonth is incorrect.");
		   return false;
		   }

		// Check out day value.
		if ( (InputValue.substring(3, 5) < 1)  ||  (InputValue.substring(3, 5) > 31)  ) 
		   {
		   alert("\nDay is incorrect.");
		   return false;
		   }

		// Check out day value per each month value.
		// Febuary
		if ( (InputValue.substring(0, 2) == 2 )  &&  (InputValue.substring(3, 5) > 29)  )
		   {
		   alert("\nFebruary can not have over 29 days.");
		   return false;
		   }
		if ( (InputValue.substring(0, 2) == 2 )  &&  (InputValue.substring(3, 5) == 29)  )
		   { alert("\nYou have indicated February 29...\n\nbe sure it is a leap year."); }
		// April
		if ( (InputValue.substring(0, 2) == 4 )  &&  (InputValue.substring(3, 5) > 30)  )
		   {
		   alert("\nApril can not have over 30 days.");
		   return false;
		   }
		// June
		if ( (InputValue.substring(0, 2) == 6 )  &&  (InputValue.substring(3, 5) > 30)  )
		   {
		   alert("\nJune can not have over 30 days.");
		   return false;
		   }
		// September
		if ( (InputValue.substring(0, 2) == 9 )  &&  (InputValue.substring(3, 5) > 30)  )
		   {
		   alert("\nSeptember can not have over 30 days.");
		   return false;
		   }
		// November
		if ( (InputValue.substring(0, 2) == 11 )  &&  (InputValue.substring(3, 5) > 30)  )
		   {
		   alert("\nNovember can not have over 30 days.");
		   return false;
		   }

		// Check out year value.
		if ( (InputValue.substring(6, 10) < 1900) ) 
		   {
		   alert("\nYear is incorrect.");
		   return false;
		   }

		// Check for misplaced hyphen.
		if ( InputValue.substring(0, 1) == "-"  || InputValue.substring(1, 2) == "-" ) 
		   {
		   alert("\nMisplaced hypen in month.");
		   return false;
		   }
		if ( InputValue.substring(3, 4) == "-"  || InputValue.substring(4, 5) == "-" ) 
		   {
		   alert("\nMisplaced hypen in day.");
		   return false;
		   }
		if ( InputValue.substring(6, 7) == "-"  || InputValue.substring(7, 8) == "-" ) 
		   {
		   alert("\nMisplaced hypen in year.");
		   return false;
		   }

		// Check for missing hyphen.
		if ( InputValue.substring(2, 3) != "-"  ||  InputValue.substring(5, 6) != "-" ) 
		   {
		   alert("\nMissing hypen in date string.");
		   return false;
		   }
	}
	return true;
}