function radioChecked(field){	result = false;	for(i=0; i < field.length; i ++)	{		if(field[i].checked)			result = true;	}	return result;}function radioValue(field){	for(i=0; i < field.length; i ++)	{		if(field[i].checked)			return field[i].value;	}}function isNumber(field){	if(isNaN(field.value))	{		alert("The Value of " + field.getAttribute("label") + " field is not a valid number\nPlease enter a number");		field.focus();		return false;	}	else		return true;}var year,month,day; // these are global so that they can be used in isValidDate and isDateInPastfunction isValidDate(dateStr){// Checks for the following valid date formats:// DD/MM/YYYY DD-MM-YYYY// Also separates date into month, day, and year variables	//var year,month,day; declared as globals now	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;	var matchArray = dateStr.match(datePat); // is the format ok?	if (matchArray == null) 	{		return false;	}	month = matchArray[3]; // parse date into variables	day = matchArray[1];	year = matchArray[4];	if (month < 1 || month > 12) 	{ // check month range		return false;	}	if (day < 1 || day > 31) 	{		return false;	}	if ((month==4 || month==6 || month==9 || month==11) && day==31) 	{		return false	}	if (month == 2) 	{ // check for february 29th		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));		if (day>29 || (day==29 && !isleap)) 		{			return false;		}	}	return true; // date is valid}function isDateInPast(){	var now = new Date();	var today = new Date(now.getFullYear(),now.getMonth(),now.getDate());	fldDate = new Date(year,month-1,day);	if (fldDate<today)		return true;	else		return false;}function swapImg(sImgName,sImgSrc){  document.images[sImgName].src = sImgSrc;}function showItem(id){	document.getElementById(id).style.display="";}function hideItem(id){	document.getElementById(id).style.display="none";}function EnforceMaxLength(obj, mlength){	if (obj.value.length > mlength)	{		obj.value = obj.value.substring(0,mlength);		alert ("This field only allows " + mlength + " characters");	}	}
