// --- Remember to add a call to this function OnLoad in the BODY tag, or just after the /FORM tag ---
	//This is the script that will change the number of days, according to the month and (leap) year that is currenctly selected
	//Do not change this function, only the names of the fields in the form.
		function ChangeDays(Form, Months, Days, Years) {
			//set some variables for convenience.
			MyForm = document.forms[Form];
			MonthList = MyForm.elements[Months];
			DayList = MyForm.elements[Days];
			YearList = MyForm.elements[Years];
			//get which month is selected
			MonthSelected = MonthList.options[MonthList.selectedIndex].value;
			YearSelected = YearList.options[YearList.selectedIndex].value;
			//if it's a month that has 31 days
			if (MonthSelected == 1 || MonthSelected == 3 || MonthSelected == 5 || MonthSelected == 7 ||
				MonthSelected == 8 || MonthSelected == 10 || MonthSelected == 12) {			
				NumDays = 31;
			}
			//or if it's a month that has 30 days
			else if (MonthSelected == 4 || MonthSelected == 6 || MonthSelected == 9 || MonthSelected == 11) {
				NumDays = 30;
			}
			//or if it's February
			else if (MonthSelected == 2) {
				if ((YearSelected % 4) == 0) NumDays = 29; //check to see if a leap year is selected
				else NumDays = 28;
			}
			
			i=0;


			if (DayList[i].value != 0)
			{			
				while (i < NumDays)	{ //fill the day list with the chosen number of days
					if (DayList[i] == null) DayList[i] = new Option();
					DayList[i].value = i + 1;
					DayList[i].text = i + 1;
					i++;
				}
			}
			else //quick workaround fix for when first entry is 0
			{
				i++;
				while (i <= NumDays)	{ //fill the day list with the chosen number of days
					if (DayList[i] == null) DayList[i] = new Option();
					DayList[i].value = i;
					DayList[i].text = i;
					i++;
				}
				
			}
			StartIndex = i;
			EndIndex = DayList.length;
			j = EndIndex;
			while (j >= StartIndex) {		//delete the rest of the elements from the day list, if there are any
				DayList[j] = null;			//this has to be done counting /down/ from the top; don't ask me why....
				j--;
			}						
			return true;
		}
