<!--

/* Pick one at random for week.

This code will select a fixed set of random number generating seeds for the
week and use them to randomly select text. This is very useful for web sites
as it allows for dynamic changing text on a weekly basis without any extra
work by the webmaster */

function getWeek(day,mth){ // day=1-31 mth=1-12;
	// Returns week number - 0 to 51 - based on day, and month parameters
	var month=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var totaldays=0;
	mth-=1; // adjust 1-12 to 0-11
	day-=1; // adjust 1-31 to 0-30
	for(n=0;n<mth;n++) totaldays+=month[n];
	return Math.floor((totaldays+day)/7)
}

function rnd(max) {
	// Returns a psuedo-random number between 0 and max-1, using a seed
	// so that a series of random numbers can be repeated by specifying the
	// same seed.
	var d = 987648503;  // a large prime number
    Seed = (d * Math.abs(Math.cos(Seed)));
    return Math.floor(Seed) % max;
}

function getSeedbaseYYYYWW() {
	/* Create a seedbase for random function that will change each week
	The seedbase is the first 6 positions of the seed number. In this case
	it will be YYYYWW, where YYYY is the year, and WW is the two digit week
	number (i.e.: 00 for the first week of the year, 51 for the last week
	of the year. */
	var dtToday = new Date()
	var s = ""
	var n = 0
	
	n = getWeek(dtToday.getDate(),dtToday.getMonth()+1)
	if (n < 10) {
    	s = "0" + n
    } else {
    	s = n
    }
	return eval("" + dtToday.getYear() + s)
}

function PickOneAtRandomForWeek(SeedGroup) {
	/* This function will randomly pick one of the string arguments passed to this 
	function and write it out. The random selection will be the same for an entire
	week. Different values for SeedGroup will produce different random selections for 
	the week. */
	Seed = eval("" + Seedbase + SeedGroup)
	document.write (PickOneAtRandomForWeek.arguments[rnd(PickOneAtRandomForWeek.arguments.length - 1) + 1])
}

var Seedbase = 0;
var Seed = 0;
Seedbase = getSeedbaseYYYYWW()


//PickOneAtRandomForWeek(1,"a","b","c")

//-->