

function events()

{
var filemame;
// Array of events
var tablenames = new Array("jan.htm","feb.htm","mar.htm","apr.htm","may.htm","jun.htm","jly.htm","aug.htm","sep.htm","oct.htm","nov.htm","dec.htm");
var now = new Date();
filename = tablenames[now.getMonth()];
filename = "../calendar/"+now.getFullYear()+"/"+filename;

//alert(filename);

// check the path required 

return filename;
}
//======================================================================

//  Function to get the filename of the current time table

var today = new Date();
var year = today.getFullYear();
function goToTimes(form) {
        var myindex=form.Months.selectedIndex;
	  if (myindex < today.getMonth()) {year = year+1};
	  var newtimetable = "../"+year+"/"+(form.Months.options[myindex].value)
        this.location = newtimetable;
}

//Drop down menu script
// This script came from Web-Development.Com JavaScript Site
// Located at http://www.web-development.com/ 

function goTo(form) {
        var myindex=form.dest.selectedIndex
	  filename = (form.dest.options[myindex].value);
	  if (filename == "Events") {filename = events()}

//	not used
//	  if (filename == "Works") {filename = "../works/works.htm";
//	  parent.location = filename;}

	  parent.Main.location = filename;
}

//======================================================================
// displays current month and date and year
function todaysdate() {

// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// Array of month Names
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
//Sort out the year
var a_year = now.getYear();
if (a_year < 1000) {a_year = a_year+1900};
//Put the endings on the date
var a_date = now.getDate();
var ending = "th";
if (a_date == 1) {ending = "st"};
if (a_date == 21) {ending = "st"};
if (a_date == 31) {ending = "st"};
if (a_date == 2) {ending = "nd"};
if (a_date == 22) {ending = "nd"};
if (a_date == 3) {ending = "rd"};
if (a_date == 23) {ending = "rd"};



return (dayNames[now.getDay()] + " " + a_date + ending + " " + monthNames[now.getMonth()] + " " + a_year );
}
//
//
//======================================================================
//
// displays month and date
function showdate(adate) {
// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// Array of month Names
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date(adate);
//Put the endings on the date
var a_date = now.getDate();
var ending = "th";
if (a_date == 1) {ending = "st"};
if (a_date == 21) {ending = "st"};
if (a_date == 31) {ending = "st"};
if (a_date == 2) {ending = "nd"};
if (a_date == 22) {ending = "nd"};
if (a_date == 3) {ending = "rd"};
if (a_date == 23) {ending = "rd"};


return (dayNames[now.getDay()] + " " +a_date +ending + " " + monthNames[now.getMonth()]);
}

//
//
//******************************************************************
//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {

  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//===================================================================
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//===================================================================
//  Function to return the value of the cookie specified by "name".
//
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
//
//
//===================================================================
//  Function to create or update a cookie.
//
//

function SetCookie (name,value,expires,path,domain,secure) {
var cookiestr;
   cookiestr = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");


document.cookie =cookiestr;

}
//
//=====================================================================
//  Function to delete a cookie. (Sets expiration date to start of epoch)
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//
//Roster script

var roster = '../roster.txt';
var roster1 = '../rosters/roster1.htm';

var alfa = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz01234567890';
function checkPass(form,pass2, pass4 )
{
var pass3 = '';
var pass1 = form.value;
var checksum=0;
for (var i=0; i<pass1.length; i++) {
   // Enter loop code here
	var c = pass1.charAt(i);
   checksum = checksum + alfa.indexOf(c);
}
for (var i=0; i<pass1.length; i++) {
	var c = pass1.charAt(i);

var a = (checksum + (alfa.indexOf(c) * alfa.indexOf(c))) % 26;
pass3 =pass3 + alfa.substring(a,a+1);
}
alert (pass3);

	switch (pass3){
		case pass2 :
		parent.Main.location = roster;
	break;
		case pass4 :
		parent.Main.location = roster1;
	break;

default : window.alert('Incorrect Password \n Access Deneied' );
}

}

/*

if (pass2 == pass3) {
   	  parent.Main.location = roster;
}
else {
   window.alert('Incorrect Password \n Access Deneied' );


}




}
*/


//
//======================================================================

//
function openWindow(myLink,windowName)
{
if(! window.focus)return;
var myWin=window.open("",windowName,"height=400,width=510,dependent=yes,scrollbars=yes");
myWin.focus();
myLink.target=windowName;
}
//======================================================================

// copyright 1999 Mikodocs, Inc. http://www.mikodocs.com/tags/
// Distribute this script freely, but please keep this 
// notice with the code.

var rollOverArr=new Array();
function setrollover(OverImgSrc,pageImageName)
{
if (! document.images)return;
if (pageImageName == null)
    pageImageName = document.images[document.images.length-1].name;
rollOverArr[pageImageName]=new Object;
rollOverArr[pageImageName].overImg = new Image;
rollOverArr[pageImageName].overImg.src=OverImgSrc;
}

function rollover(pageImageName)
{
if (! document.images)return;
if (! rollOverArr[pageImageName])return;
if (! rollOverArr[pageImageName].outImg)
    {
    rollOverArr[pageImageName].outImg = new Image;
    rollOverArr[pageImageName].outImg.src = document.images[pageImageName].src;
    }
document.images[pageImageName].src=rollOverArr[pageImageName].overImg.src;
}

function rollout(pageImageName)
{
if (! document.images)return;
if (! rollOverArr[pageImageName])return;
document.images[pageImageName].src=rollOverArr[pageImageName].outImg.src;
}
<!--
function openWindow(myLink,windowName)
{
if(! window.focus)return;
var myWin=window.open("",windowName,"height=400,width=510,dependent=yes,scrollbars=yes");
myWin.focus();
myLink.target=windowName;
}
//-->
<!--
// copyright 1998 Idocs, Inc. http://www.idocs.com/tags/
// Distribute this script freely, but please keep this 
// notice with the code.

// set the image for swapping
function setswap()
{
var image = arguments[0];
image.onload=null;
image.defaultImg = new Image();
image.defaultImg.src = image.src;
image.opts = new Object();
for (var i=1; i < arguments.length; i=i+2)
   {
   image.opts[arguments[i]]=new Image();
   image.opts[arguments[i]].src = arguments[i+1];
   }
image.swapready=true;
}

// set up the link for swapping
function swap(link,imageName,optname)
{
if (! document.images)return;
link.targetImg=document.images[imageName];
if (! link.targetImg.swapready)return;
link.setImgSrc=link.targetImg.opts[optname].src;
link.onmouseover=swapTo;
link.onmouseout=swapBack;
link.onmouseover();
}
//======================================================================

// the actual functions which swap the image
function swapTo()
   {this.targetImg.src=this.setImgSrc}
function swapBack()
   {this.targetImg.src=this.targetImg.defaultImg.src}


//======================================================================

function overit(pageImageName)
{
if (! document.images)return;
if (! rollOverArr[pageImageName])return;
if (! rollOverArr[pageImageName].outImg)
    {
    rollOverArr[pageImageName].outImg = new Image;
    rollOverArr[pageImageName].outImg.src = document.images[pageImageName].src;
    }
document.images[pageImageName].src=rollOverArr[pageImageName].overImg.src;

//document.images['Header'].src=rollOverArr[h_image].overImg.src;

}
//======================================================================


function overout(pageImageName)
{
if (! document.images)return;
if (! rollOverArr[pageImageName])return;
document.images[pageImageName].src=rollOverArr[pageImageName].outImg.src;

//document.images['Header'].src=rollOverArr[h_image].overImg.src;
}
//======================================================================

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=400,resizable=yes,scrollbars=yes');
return false;
}
//======================================================================
/*
function targetopener(mylink, closeme, closeonly)
{
if (! (window.focus && window.opener))return true;
window.opener.focus();
if (! closeonly)window.opener.location.href=mylink.href;
if (closeme)window.close();
return false;
}
*/


webmaster='<a href=\"\x6d\x61\x69\x6c\x74\x6f\x3a\x77\x65\x62\x6d\x61\x73\x74\x65\x72\x40\x63\x68\x65\x6c\x6d\x73\x66\x6f\x72\x64\x63\x6f\x6e\x63\x6c\x75\x62\x2e\x63\x6f\x2e\x75\x6b\">Webmaster</a>';

rumour='<a href=\"\x6d\x61\x69\x6c\x74\x6f\x3a\x77\x65\x62\x6d\x61\x73\x74\x65\x72\x40\x63\x68\x65\x6c\x6d\x73\x66\x6f\x72\x64\x63\x6f\x6e\x63\x6c\x75\x62\x2e\x63\x6f\x2e\x75\x6b\x3f\x73\x75\x62\x6a\x65\x63\x74\x3d\x52\x75\x6d\x6f\x75\x72\x20\x43\x6f\x6e\x74\x72\x6f\x6c\">Start a Rumour</a>';

secretary='<a href=\"\x6d\x61\x69\x6c\x74\x6f\x3a\x73\x65\x63\x72\x65\x74\x61\x72\x79\x40\x63\x68\x65\x6c\x6d\x73\x66\x6f\x72\x64\x63\x6f\x6e\x63\x6c\x75\x62\x2e\x63\x6f\x2e\x75\x6b\">Secretary</a>';



