function convertDate(inDate)
{
var outDate;
var myDays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var myMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var yr = inDate.getYear();
if (yr < 1900) { yr+=1900; }
outDate = myDays[inDate.getDay()] + ", " + myMonths[inDate.getMonth()] + " " + inDate.getDate(); // + ", " + yr;
return outDate;
}

function getDate()
{
var date_time;
var chk_hh;
var etzTime;
var dst = true; // DST flag
var todays_dt = new Date();
var localTime = todays_dt.getTime();
// convert local time to US/Eastern TZ
var localOffset = todays_dt.getTimezoneOffset() * 60000;
var utc = localTime + localOffset;
if (dst)
	etzTime = utc - (3600000*4);  // ETZ = UTC-4 in EDT and UTC-5 in EST
else
	etzTime = utc - (3600000*5);
var todays_dt_etz = new Date(etzTime);
if (todays_dt_etz.getDay() == 0 || (todays_dt_etz.getDay() == 4 && todays_dt_etz.getHours() < 9))  // Sundays go back to Thursdays; Thursdays < 9am go back to Mondays
	chk_hh = -72;
else if (todays_dt_etz.getDay() == 2 || todays_dt_etz.getDay() == 5)  // Tuesdays and Fridays go back one day
	chk_hh = -24;
else if (todays_dt_etz.getDay() == 1 && todays_dt_etz.getHours() < 9)  // Mondays < 9am, go back to Thursdays
	chk_hh = -96;
else  if (todays_dt_etz.getDay() == 3 || todays_dt_etz.getDay() == 6) // Wednesdays and Saturdays, go back 2 days
	chk_hh = -48;
else    // Mondays and Thursdays if >= 9am, stay on day
	chk_hh = 0;
etzTime += 3600*(chk_hh)*1000;
todays_dt_etz.setTime(etzTime);
var mydate=convertDate(todays_dt_etz);
// for (var i=28-mydate.length; i > 0; i=i-2) {
//	mydate = " " + mydate;
// }
var myform = document.getElementById("beqform");
myform.elements["timedate"].value=mydate;
}

function validateForm(myform)
{
var illegalChars = /[^a-zA-Z0-9_ .-]/;
if (myform.yourname.value.length < 1) {
	if (myform.mm.selectedIndex != 0 || myform.ss.selectedIndex != 0 || ratings) {
		alert("Please enter your name");
		return false;
	} else {    // checking standings, so no name or time
		return true;
	}
} else if (illegalChars.test(myform.yourname.value)) {
	alert("Only letters, numbers, space, period, hyphen and underscore allowed in names");
	return false;
} else if (myform.mm.selectedIndex == 0) {
	alert("Please enter a time in mm:ss");
	return false;
} else {
	return true;
}
}