function changeDate(tempDate) {
	top.location = top.location.pathname + "?d=" + tempDate;
}

function checkDay() {
	cF = document.contentForm; //change to match current form name
	m = cF.smonth.value;       //change to match month form field name
	y = cF.syear.value;        //change to match year form field name
	d = cF.sday.value;         //change to match day form field name
	validDay = true;
	if (m == 2) {
		if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) {
			if (d > 29) {
				validDay = false;
			}
		} else {
			if (d > 28) {
				validDay = false;
			}
		}
	} else if (m == 9 || m == 4 || m == 6 || m == 11) {
		if (d > 30) {
			validDay = false;
		}
	} else {
		if (d > 31) {
			validDay = false;
		}
	}
	if (validDay = false) {
		alert("You have entered an invalid date. Please re-enter.");
		cF.sday.value = "";   //change
		cF.sday.focus();      //change
	}
}

function validDate() {
	cF = document.contentForm;         //change to match current form name
	tempMonth   = cF.smonth.value - 1; //change to match month form field name
	tempDay     = cF.sday.value;       //change to match day form field name
	tempYear    = cF.syear.value;      //change to match year form field name
	tempDate    = new Date(tempYear, tempMonth, tempDay);
	alert(tempDate);
	thisDate    = new Date();
	sHour       = cF.shour.value;         //change to match start hour form field name
	sMinute     = cF.sminute.value;       //change to match minute form field name
	eHour       = cF.ehour.value;         //change to match end hour form field name
	eMinute     = cF.eminute.value;       //change to match end minute form field name
	sAmPm       = cF.sampm.selectedIndex; //change to match start am/pm form field name
	eAmPm       = cF.eampm.selectedIndex; //change to match end am/pm form field name
	returnValue = false;

	if (tempDate < thisDate) {
		alert("You must enter a date in the future.");
		cF.smonth.value = "";            //change
		cF.sday.value = "";              //change
		cF.syear.value = "";             //change
		cF.smonth.focus();               //change
	} else if (sHour > eHour && (sAmPm == eAmPm || sAmPm > eAmPm)) {
		alert("The end time you have entered is earlier than the start time. Please re-enter.");
		cF.ehour.value = "";             //change
		cF.eminute.value = "";           //change
		cF.ehour.focus();                //change
	} else {
		returnValue = true;
	}
	return returnValue;
}

function checkForm(f) {
	//customize this function to fit your entry form
	returnValue = false;
	if (f.subject.value == "") {
		alert("Please enter a subject");
		f.subject.focus();
	} else if (f.smonth.value == "" || f.sday.value == "" || f.syear.value == "") {
		alert("Please enter a date for this event.");
		f.smonth.focus();
	} else if (f.shour.value == "" || f.sminute.value == "") {
		alert("Please enter a start time for this event.");
		f.shour.focus();
	} else if (f.description.value == "") {
		alert("Please enter some text describing this event.");
		f.description.focus();
	} else {
		returnValue = true;
	}
	validDate();
	return returnValue;
}
