function fsmotto() {
	var motto=new Array();
	motto[0] = "Virtually...the best";
	motto[1] = "Free Spirits are willing but the flesh is weak.";
	motto[2] = "Every metre matters";
	motto[3] = "Every meter matters";
	motto[4] = "Fat or thin, fast or slow: just row.";
	motto[5] = "Unleash the power of the Free Spirits....row better, faster, farther!";
	motto[6] = "I love rowing, I hate rowing, I love rowing, I hate rowing...";
	motto[7] = "100m or 1 million - everybody and every metre welcome.";
	motto[8] = "Pull, pull and pull again.";
	motto[9] = "Catch, drive, glide, recover, repeat.";
	motto[10] = "100m or 1 million - everybody and every meter welcome.";
	motto[11] = "Every day that moon looms closer.";
	motto[12] = "Every metre counts, every day counts, everybody counts.";
	motto[13] = "Every meter counts, every day counts, everybody counts.";
	motto[14] = "I row, ergo, I am";
	motto[15] = "Free Spirits - 100% proof";
	return motto[Math.round(Math.random()*(motto.length-1))];
}
function moon_problems() {
	return "<small><br/>Moon shot %/meterboard/24 x 7 unavailable at present... Sorry.</small>";
}
function moonbackup() {
	var meterboard = fsvars();
	var no_rowers = meterboard[2];
	var rM = ""; //race message
	var jtm = journeytothemoon();
	var mtp = moon_time_percent();
	if (jtm < 100)
	{
		var rMP = Math.round((jtm - mtp)*100)/100;
		if (rMP < 0)
		{ rMP = rMP*-1; rM = rMP + "% behind target"; }
		else if (rMP == 0) 
		{ rM = "bang on target!"; }
		else
		{ rM = rMP + "% ahead of target"; }
		return "<small><br/><a style=\"color: white\" href=\"http://www.meterboard.com\">" + no_rowers + "</a> rowers <a title=\"Graphs of the moon shot\" style=\"color: white\" href=\"http://www.freespiritsrowing.com/content/index.php?page=moon_shot#graphs\">heading for the moon</a>: " + journeytothemoon() + "% (" + rM + ")</small>";
	} else {
		jtm -= 100;  // % past

		var mon = Math.round((jtm * 314403000)/100); //metres on
		var morbit = 10864000; // one orbit
		var orbits = Math.round((mon/morbit)*100)/100;
		return "<small><br/><a style=\"color: white\" href=\"http://www.meterboard.com\">" + no_rowers + "</a> rowers <a title=\"We made it!!\" style=\"color: red\" href=\"http://www.freespiritsrowing.com/fs/madeit.html\">ERGING ON THE MOON</a>: (" + orbits + " times round so far!)</small><img src=\"http://www.freespiritsrowing.com/forum/images/smiles/fssmall_grin.gif\" width=\"15\" height=\"15\"";
	}
}
function moon() {
	var meterboard = fsvars();
	var no_rowers = meterboard[2];
	return "<small><br/>" + no_rowers + " rowers planning their journey home <img src=\"http://www.freespiritsrowing.com/forum/images/smiles/fssmall_grin.gif\" width=\"15\" height=\"15\"/> (watch this space)</small>";

}

function journeytothemoon() {
	var meterboard = fsvars();
	var team_metres = meterboard[1];
	//var team_numbers = meterboard[2];
	var distance_to_moon = 384403000;
	var percentage_of_journey = Math.round((team_metres/distance_to_moon)*10000)/100;
	//var metres_per_member = team_metres/team_numbers;
	return percentage_of_journey;
}
function moon_progress() {
	var meterboard = fsvars();
	var team_metres = meterboard[1];
	return addCommas(team_metres) + "m out of 384,403,000m"
}
function moon_time_percent() {
	var today = new Date()
	var stdate = new Date("May 01, 2006")//adjust date, site created
	var offset = today.getTimezoneOffset() * 60 * 1000;
	var msPerDay = 24 * 60 * 60 * 1000 ;
	var daysUp = (( offset + today.getTime() - stdate.getTime() ) / msPerDay ) / 365;
	//var daysUp = (( today.getTime() - stdate.getTime() ) / msPerDay ) / 365;
	return Math.round(daysUp*10000)/100;
}
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}