//this file contains the javascript to check the fields that are required on most forms.


	function isLeap(year){
		if(year % 400 == 0){
			return true;
		} else if((year % 4 == 0) && (year % 100 != 0)){
			return true
		} else return false;
	}
	
	function days_in(month, year){
		if(month == 4 || month == 6 || month == 9 || month == 11){
			return 30;
		} else if(!isLeap(year) && month == 2){
			return 28;
		} else if(isLeap(year) && month == 2){
			return 29;
		} else return 31;
	}
	
	function checkdate(field)
	{
		var myArrayDate, myDay, myMonth, myYear, myString, myYearDigit;
		var b;
	
		myString = field.value + "";
		if (myString == "")
			return true;
		
		myArrayDate = myString.split("/");
		
		myDay = Math.round(parseFloat(myArrayDate[1]));
		myMonth = Math.round(parseFloat(myArrayDate[0]));
		myYear = Math.round(parseFloat(myArrayDate[2]));
		myString = myYear + "";
	
		if (myYear < 41)
			myYear = myYear + 2000;
		
		if ((myYear >= 41) && (myYear < 100))
			myYear = myYear + 1900;
	
		if (isNaN(myDay) || isNaN(myMonth) || isNaN(myYear))
			return false;
	
		if ((myYear < 1) || (myDay < 1) || (myMonth < 1) || (myYear < 1900))
			return false;
	
		if ((myMonth > 12) || (myYear > 2078) || (myDay > days_in(myMonth, myYear)))
			return false;
	
		field.value = myMonth + '/' + myDay + '/' + myYear;
		return true;
	}
	
	function warndate(field)
	{
		var r 
		r = checkdate(field);
		if (!r)
		{
			alert('You have entered an invalid Date.\n Dates must be in the format: M/D/YY or M/D/YYYY');
			field.focus();
		}
		return r;
	}
	
	
	function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject




