<!--
//Generic Javascript functions used by several pages.  Putting them here
//will make the browser cache them, making pages faster to load, and
// the pages themselves will be smaller, easier to code...
var OldImageName=null;
var OldImageSrc=null;
var MenuImagetimerOn=null;

//Retrieve a random number between 1 and the number passed in...
//Note that the number should divide evenly into 60 and cannot be larger than 60...
//It will work otherwise, but the last number tends to appear more frequently...
function RandomNumber(intRange) {
	//First Get the current Seconds
	var CurrentDate = new Date();
	var CurrentSeconds = CurrentDate.getSeconds();
	var StepAmount = 0;
	var Result = 0;
	var Counter = 0;

	//Minor error checking
	if (intRange>=60) return CurrentSeconds;
	else if (intRange<=1) return 1;
	else {
		if ((60%intRange)>0) StepAmount=(parseInt(60/intRange)-1);
		else StepAmount=parseInt(60/intRange);
		while (Result==0){
			Counter++;
			if (CurrentSeconds < (Counter*StepAmount)) Result=Counter;
			if ((Counter*StepAmount)>60) Result=StepAmount;
			if (StepAmount<1) Result=1;
		}
		return Result;
	}
}

//Create an image array
function MakeImageArray(n)
{
  this.length = n
  for (var i = 0; i<=n; i++) {
    this[i] = new Image()
  }
  return this
}

//Image Change Function
function change(Name, No) {
  document[Name].src = ImageArray[No].src;
  return true
}

//Image Change Function
function imgChange(Name, NewSrc) {
  document[Name].src = NewSrc;
  return true
}

//Clears any old image and sets a newone
function ShowMenuImage(Name, NewSrc) {
  if (OldImageName!=null) {
    //Clear any setTimeouts...
    clearTimeout(MenuImagetimerOn);
    //Clear the old image
    document[OldImageName].src = OldImageSrc;
  }
  //Now set the old image variables
  OldImageName=Name;
  OldImageSrc=document[Name].src;
  //Now Change the image
  document[Name].src = NewSrc;
}
//Clear the Menubar image in a delayed manner to match the menu script
function HideMenuImage(Name, NewSrc) {
  MenuImagetimerOn = setTimeout("document[OldImageName].src = OldImageSrc;OldImageName=null;",5000);
}

//-->
