http://
////////////////////////////////////////////////////////////////////
// Script Name: lib.js
// Created: September 16, 2000
// Purpose: Contains form validation functions for various forms.
////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////
// Name: valid_date
// Purpose: Given a date string of characters, checks to see if they form 
//			a valid date.
// Passed In: expDate - A date string in the format MM/DD/YY.
// Returns: true if date is valid
//			false otherwise
////////////////////////////////////////////////////////////////////
function valid_date(expDate)
{
	var arrDate = expDate.value.split("/")
	
	if (arrDate.length != 3)
	{ alert("You entered an invalid date.  Please re-enter it using the \"MM/DD/YY\" format."); expDate.focus(); return false; }
	
	if (isNaN(arrDate[0]) || isNaN(arrDate[1]) || arrDate[0] > 12 || arrDate[1] > 31)
	{ alert("You entered an invalid date.  Please re-enter it using the \"MM/DD/YY\" format."); expDate.focus(); return false; }
	
	//var today = new Date()
	//if (parseInt(arrDate[1]) < 70)		// using 1970 as the cut-off year
	//{ var adjustedYear = "20" + arrDate[1] }
	
	//else
	//{ var adjustedYear = "19" + arrDate[1] }
	
	//var expireDate = new Date(parseInt(adjustedYear), parseInt(arrDate[0]))
	//if (Date.parse(today) > Date.parse(expireDate))
	//{ alert("The date you entered has already passed.  Please re-enter it."); expDate.focus(); return false; }
	
	return true;
}

////////////////////////////////////////////////////////////////////    
// Name: isValidPhoneNumber
// Purpose: Checks to see if a phone number string is at least 10 digits long.
// Passed In: phoneNum - the number in question
// Returns: true if string is a "valid" phone number(i.e. has more than 10 digits)
//			false otherwise
////////////////////////////////////////////////////////////////////
function isValidPhoneNumber(phoneNum)
{
	cleanPhoneNum = clean_number(phoneNum.value)
	if (cleanPhoneNum.length >= 10) 
	{ return true; }
	
	else
	{ alert("You entered and incorrect phone number.  Please re-enter it before continuing."); phoneNum.focus(); return false; }
}

////////////////////////////////////////////////////////////////////    
// Name: isValidEmail
// Purpose: Checks to see if a string is a potential email address.
//			It really only validates the format: a@b.c
// Passed In: emailAdd - the address in question
// Returns: true if string is a "valid" email address (i.e. conforms to a@b.c)
//			false otherwise
////////////////////////////////////////////////////////////////////
function isValidEmail(emailAdd)
{
	var arrTemp = emailAdd.value.split("@")
	
	if (arrTemp.length != 2)
	{ alert("You entered and incorrect email address.  Please re-enter it before continuing."); emailAdd.focus(); return false; }
	
	var arrTemp2 = arrTemp[1].split(".")
	if (arrTemp.length != 2)
	{ alert("You entered and incorrect email address.  Please re-enter it before continuing."); emailAdd.focus(); return false; }

	return true;
}
    
////////////////////////////////////////////////////////////////////    
// Name: isNumber
// Purpose: General purpose function to see if a suspected numeric 
//			input is a positive integer.
// Passed In: digit - the character in question
// Returns: true if character is a positive integer
//			false otherwise
////////////////////////////////////////////////////////////////////
function isNumber(digit)
{
	if (digit < "0" || digit > "9") 
	{
		return false
	}
	else { return true }
}
