function getFirstMonday(){ 	var d = new Date(); 	while(d.getDay() != 1)	{ d.setTime(d.getTime() + 24*60*60*1000); } 	return d; } /**  * Returns a date string of the form MM/DD/YY */ function myDateStr(d){ 	var s = d.getMonth()+1; 	s += "\/"; 	s += d.getDate(); 	s += "\/"; 	s += d.getFullYear(); 	return s; } function formSelect(){ 	} function formSelectApply(fObj){ fObj.opts = new Object(); }formSelect.prototype.formString = function(selectKey){ 	var s = ""; 	for(var k in this.opts)	{ 		if(k == selectKey)			{ s += "<option selected value=\"" + k + "\">" + this.opts[k] + "</option>"; } 		else			{ s += "<option value=\"" + k + "\">" + this.opts[k] + "</option>"; } 	} 	return s; } function trainGoal(){ 	formSelectApply(this); 	this.opts["fivk"] = "5 K"; 	//this.opts["tenk1"] = "8 K"; 	//this.opts["tenk2"] = "5 Miles"; 	this.opts["tenk3"] = "10 K"; 	//this.opts["tenk4"] = "12 K"; 	//this.opts["half1"] = "15 K"; 	this.opts["half2"] = "10 Miles"; 	//this.opts["half3"] = "20 K"; 	this.opts["half4"] = "Half-Marathon"; 	this.opts["mara"] = "Marathon"; 	} trainGoal.prototype = new formSelect(); function hourSelect(){ 	formSelectApply(this); 	for(var i = 0; i < 10; i++)	{ 		this.opts[i] = i; 	} } hourSelect.prototype = new formSelect(); function minsecSelect(){ 	formSelectApply(this); 	for(var i = 0; i < 60; i++)		{ this.opts[i] = i; } } minsecSelect.prototype = new formSelect(); function daySelect(){ 	formSelectApply(this); 	this.opts["0"] = "Sunday";  	this.opts["1"] = "Monday"; 	this.opts["2"] = "Tuesday";  	this.opts["3"] = "Wednesday";  	this.opts["4"] = "Thursday";  	this.opts["5"] = "Friday";  	this.opts["6"] = "Saturday";  } daySelect.prototype = new formSelect(); function diffSelect(){ 	formSelectApply(this);	this.opts["main"] = "Maintenance"; 	this.opts["mod"] = "Moderate"; 	this.opts["hard"] = "Hard"; 	this.opts["vhard"] = "Very Hard"; } diffSelect.prototype = new formSelect(); function mpweSelect(){ 	formSelectApply(this);		for(var i = 1; i < 12; i++)	{ 		this.opts[i*5+1] = (i*5+1) + "-" + (i*5+5); 		} } mpweSelect.prototype = new formSelect(); function paceSelect(){ 	formSelectApply(this); 	this.opts["noop"] = "Race Distance"; 	this.opts["onem"] = "One Mile"; 	this.opts["fivk"] = "5 K"; 	this.opts["tenk"] = "10 K"; 	this.opts["half2"] = "10 Miles";	this.opts["half"] = "Half-Marathon"; 	this.opts["mara"] = "Marathon"; 	} paceSelect.prototype = new formSelect(); function slenSelect(){ 	formSelectApply(this); 	for(var i = 2; i < 17; i++)		{ this.opts[i] = i + " Weeks"; } } slenSelect.prototype = new formSelect(); function weekSelect(){ 	formSelectApply(this); 	var d = getFirstMonday(); 	var pd = new Date(d.getTime() - 7*24*60*60*1000); 	this.opts["ds" + pd.getTime()] = "Previous Monday, " + myDateStr(pd);	this.opts["ds" +  d.getTime()] = "Next Monday, " + myDateStr(d);	var fd = new Date(d.getTime() + 7*24*60*60*1000)	this.opts["ds" + fd.getTime()] = "Following Monday, " + myDateStr(fd); 		//var td = new Date();	//this.opts["ds" + td.getTime()] = "Today, " + myDateStr(td); 	} weekSelect.prototype = new formSelect(); 