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 showMyGardenPage(id){	for(i = 1; i <= 7; i ++)	{		if(id == i)		{			showItem("myGarden" + i);			myArray = document.getElementsByName("tab" + i);			for (k=0; k < myArray.length; k++)			{				myArray[k].style.background="#666666";			}		}		else		{			var myStyle = document.getElementById("myGarden" + i).style			if(myStyle.display != "none")			{				hideItem("myGarden" + i);				myArray = document.getElementsByName("tab" + i);				for (k=0; k < myArray.length; k++)				{					myArray[k].style.background="#859fad";				}			}		}	}}function showAllMyGardenPages(){	// used for the print friendly page	for(i = 1; i <= 7; i ++)	{		showItem("myGarden" + i);			}	myArray = document.getElementsByTagName("input");	for (k=0; k < myArray.length; k++)	{		myArray[k].disabled=false;	}}var mlength = 600;function EnforceMaxLength(obj, mlength){	if (obj.value.length > mlength)	{		obj.value = obj.value.substring(0,mlength);		alert ("This field only allows " + mlength + " characters");	}	}var startTime = new Date();function sessionWarning(){	var warningTime = new Date();	alert("Warning! Your session has been idle for 50 minutes.\n\nThis session will expire in 10 minutes.\nTo avoid losing any changes made, save this page before those 10 minutes are up.\n\nThe session countdown started at: "+startTime.toLocaleString()+"\nThis message popped up at: "+warningTime.toLocaleString());}function sessionTimedOut(){	alert("Warning! Your session was idle for 60 minutes and timed out");	// maybe hide all the buttons here ....	//window.onbeforeunload = "";	//location = location.pathname;	hideItem("buttons");}function setSessionWarnings(){	setTimeout("sessionWarning()",50*60*1000);	setTimeout("sessionTimedOut()",60*60*1000);}