// <!- RotaryYear Javascript source

/* IMPORTANT !!!!  A new line must be added to the contact table (see below) each 
   #########       year for the new contacts with change of President etc.

This script, if placed above the <body> tag, will set fields for use in later scripts,
setting the value to nnoo where nn the start of the current rotary year and oo is
the end year eg 0708.

     R Scott  25-Apr-2007
 */
 
  var ContactName = "TBA";  
  var ContactPres = "TBA";  
var RY = new Array();
// 				Presidents table			Secretaries table
var RYPres = new Array();
var RYSec = new Array();
 RY[0] = '0506';	RYPres[0] = "Trevor Mackey";		RYSec[0] = "Bob Scott";
 RY[1] = '0607';	RYPres[1] = "Cheryl Pisterman";		RYSec[1] = "Bob Scott";
 RY[2] = '0708';	RYPres[2] = "Michael Berry";		RYSec[2] = "Don Heath";
 RY[3] = '0809';	RYPres[3] = "Robert Hogan";		RYSec[3] = "Don Heath";
 RY[4] = '0910';	RYPres[4] = "Ian Willmott";		RYSec[4] = "Ted King";
 RY[5] = '1011';	RYPres[5] = "Ian Salek";		RYSec[5] = " ";

// Define 'random' numbers
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() * 35.0); }
srand();
   var LeadingZero = "0";
   var RTyy = "nn";
   var RTyyyy = "nnnn";
   function LZ(RTYear)
    { LeadingZero = "0";
      if (RTYear > 9) LeadingZero = "";
      RTyy = LeadingZero + RTYear;
      return RTyy; }


function ContactPresFn(RYcurrent)
{ 

  for (i=0; i < RY.length; i++) {
    var RYear = RY[i]
    // document.write('RYear' + RYear + ', RTyyyy ' + RTyyyy)
    if (RYear == RTyyyy) {
      ContactPres = '<img src="images/president' + RYear + '.jpg" width="120" border="0"><br>'
      ContactPres = ContactPres + 'President ' + RYPres[i];
      document.write(ContactPres)
      break;
    }
  }
}
function ContactFn(RYcurrent)
{ 

  for (i=0; i < RY.length; i++) {
    var RYear = RY[i]
    // document.write('RYear' + RYear + ', RTyyyy ' + RTyyyy)
    if (RYear == RTyyyy) {
      ContactName = 'President ' + RYPres[i] + ' or Secretary ' + RYSec[i];
      document.write(ContactName)
      break;
    }
  }
  if (i == RY.length) {
    ContactName = "TBA";
      document.write(ContactName)
  }
}


     	    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 CurrYr=CurrDate.getYear()
     		if (CurrYr < 100)
       		  {CurrYr=CurrDate.getYear()+2000}
	ThisYear= CurrYr - 2000
	ThisYearA=LZ(ThisYear)
	NextYear=ThisYear + 1
	NextYearA=LZ(NextYear)
	LastYear=ThisYear - 1
	LastYearA=LZ(LastYear)
	if (CurrMth > 6)
		RTyyyy = ThisYearA + NextYearA;
	  else
		RTyyyy = LastYearA + ThisYearA;




	//  End of RotaryYear Javascript source ->

