// <!- RandomBgColours Javascript source

/* This script, if placed above the <body> tag, will randomly set the 
    background colours as detailed in the array below.  The colours used have been
    selected as pale shades for background, and dark colours should be used for text.
     R Scott  9-Jul-2003
 */
 
// Define 'random' numbers
var bgcount = 35
var seed = .5;
function srand() 
  {  today = new Date();    
     seed = Math.abs(Math.sin(today.getTime())); }  
function rand()
  {  seed = seed + .3;  
     if (seed > 1.0) seed = seed - 1.0;    
	 return seed; }  
function randbg()
  {  return Math.floor(rand() * bgcount); }
srand();

     	    var CurrDate=new Date()
            var CurrDay=CurrDate.getDate()
            var CurrMth=CurrDate.getMonth()+1
	var ThisYear=0
	var NextYear=0
	var LastYear=0
	var ThisYearA
	var LastYearA
	var RotaryAnnTheme


/* 
     		var CurrYr=CurrDate.getYear()
     		if (CurrYr < 100)
       		  {CurrYr=CurrDate.getYear()+2000}
	ThisYear= CurrYr - 2000
	ThisYearA=ThisYear
	if (ThisYear < 10)
		{ThisYearA='0' + ThisYear}
	NextYear=ThisYear + 1
	NextYearA=NextYear
	if (NextYear < 10)
		{NextYearA='0' + NextYear}
	LastYear=ThisYear - 1
	LastYearA=LastYear
	if (LastYear < 10)
		{LastYearA='0' + LastYear}
	if (CurrMth > 6)
		RotaryAnnTheme = 'bgrdrotarytheme' + ThisYearA + NextYearA + '.jpg';
	  else
		RotaryAnnTheme = 'bgrdrotarytheme' + LastYearA + ThisYearA + '.jpg';
*/
	
		RotaryAnnTheme = 'bgrdannualtheme' + RTyyyy + '.jpg';
	

	// Create array of background colours
	var BgColour = new Array(51)
	BgColour[0] = "AliceBlue"
	BgColour[1] = "AntiqueWhite"
	BgColour[2] = "Azure"
	BgColour[3] = "Beige"
	BgColour[4] = "Cornsilk"
	BgColour[5] = "FloralWhite"
	BgColour[6] = "Gainsboro"
	BgColour[7] = "GhostWhite"
	BgColour[8] = "Honeydew"
	BgColour[9] = "Ivory"
	BgColour[10] = "Lavender"
	BgColour[11] = "LavenderBlush"
	BgColour[12] = "LemonChiffon"
	BgColour[13] = "LightCyan"
	BgColour[14] = "LightGoldenrodYellow"
	BgColour[15] = "LightYellow"
	BgColour[16] = "Linen"
	BgColour[17] = "MintCream"
	BgColour[18] = "MistyRose"
	BgColour[19] = "OldLace"
	BgColour[20] = "BlanchedAlmond"
	BgColour[21] = "SeaShell"
	BgColour[22] = "Snow"
	BgColour[23] = "Wheat"
	BgColour[24] = "WhiteSmoke"
	BgColour[25] = "LightYellow"
	BgColour[26] = "Linen"
	BgColour[27] = "MintCream"
	BgColour[28] = "MistyRose"
	BgColour[29] = "OldLace"
	BgColour[30] = "BlanchedAlmond"
	BgColour[31] = "SeaShell"
	BgColour[32] = "Snow"
	BgColour[33] = "Wheat"
	BgColour[34] = "WhiteSmoke"
	// BgColour[0] = '"#ffffcc"'

	// Define BgCol for Background colour
	BgCol = BgColour[randbg()]

	// Define RndCol for Background colours
	BgNo1 = randbg()
	BgNo2 = ((BgNo1 + 1) % bgcount)
	BgNo3 = ((BgNo2 + 1) % bgcount)
	BgNo4 = ((BgNo3 + 1) % bgcount)
	BgNo5 = ((BgNo4 + 1) % bgcount)
	Bgrnd=BgNo1;

	BgCol1 = BgColour[BgNo1]
	BgCol2 = BgColour[BgNo2]
	BgCol3 = BgColour[BgNo3]
	BgCol4 = BgColour[BgNo4]
	BgCol5 = BgColour[BgNo5]

	BgCol1 = "white"
	BgCol2 = "white"
	BgCol3 = "white"
	BgCol4 = "white"
	BgCol5 = "white"


     // Specify style for Background colour
	 document.write('<style type="text/css">');
//	 document.write	var Bgrnd=BgNo1;
     document.write('body { background-color: "' + BgCol1 + '"}');
	 document.write('.leftframemain { background-color: ' + BgCol2 + '}');
	 document.write('.alternatebackground3 { background-color: ' + BgCol3 + '}');
	 document.write('.alternatebackground4 { background-color: ' + BgCol4 + '}');
	 document.write('.alternatebackground5 { background-color: ' + BgCol5 + '}');

     // Next two lines display the centenary logo as background image
	// if (CurrYr < 2006 && Bgrnd < 8)
        //  { document.write('body { background-image: url(images/RICentLogoColourBkgrd2.jpg) }') }
     // Next three lines display the centenary logo as background image
 	// if (CurrYr < 2006 && Bgrnd > 7)
        //  { document.write('body { background-image: url(images/30th background.jpg) }') }
	// if (CurrYr > 2005 && CurrMth < 3) { document.write('body { background-image: url(images/30th background.jpg) }') }
     // Next two lines display the current annual theme as background image
 	 if (Bgrnd > 25)
          { document.write('body { background-image: url(images/bgrdannualtheme' + RTyyyy + '.jpg) }') }

     document.write('<\/style>')
     // document.write('Background colour ' + BgCol)

	//  End of RandomBgColours Javascript source ->

