<!--

function autofocus(field, limit, next, evt){
	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode > 31 && field.value.length == limit) {
		field.form.elements[next].focus();
	}
}



function submitenter(myfield,e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13) {
   		submitForm();
   		return false;
   	} else return true;
}

// Loads the number of days in the days drop down list based on the months drop down list
function setDaysInMonth(monthID, dayID) {
			var ddlMonth = document.getElementById(monthID);
			var ddlDays = document.getElementById(dayID);
				
	
			switch(ddlMonth.options[ddlMonth.selectedIndex].value) {
					case "1": // January 
						setDays(31, dayID);
						break;
					case "2": // February
						// If divisible by 4 it is a leap year (Except for every 400 years: 400, 800, .. 2000, 2400.. etc.) 											 
						setDays(28, dayID);				
						break;
					case "3": // March
						setDays(31, dayID);
						break;
					case "4": // April
						setDays(30, dayID);
						break;
					case "5": // May
						setDays(31, dayID);
						break;
					case "6": // June
						setDays(30, dayID);
						break;
					case "7": // July
						setDays(31, dayID);
						break;
					case "8": // August
						setDays(31, dayID);
						break;
					case "9": // September
						setDays(30, dayID);
						break;
					case "10": // October
						setDays(31, dayID);
						break;
					case "11": // November
						setDays(30, dayID);
						break;
					case "12": // December
						setDays(31, dayID);
						break;
				}		
			}
			
			
// Removes or adds the number of days to the days drop down list based on 
// the given daysInMonth
function setDays(daysInMonth, dayID) {
				var ddlDays = document.getElementById(dayID);
				var lastDay = ddlDays.length;				
				if(lastDay > daysInMonth) {
					// subtract the number of days to reach daysInMonth				
					var diff = eval(lastDay - daysInMonth);
					while(diff > 0) {
						ddlDays.remove(eval(lastDay-1));
						lastDay--;
						diff--;
					}
				} else if(lastDay < daysInMonth) {
					// add the number of days to reach daysInMonth					
					var diff = eval(daysInMonth - lastDay);
					var nextDay;
					while(diff > 0) {						
						nextDay = new Option(eval(lastDay + 1), eval(lastDay + 1));												
						ddlDays.options[ddlDays.length]=nextDay;
						lastDay++;
						diff--;
					}
				}
			}
			


//-->