// SimpleSwap by Jehiah Czebotar (http://jehiah.com/archive/simple-swap)
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
//
// How to implement SimpleSwap:
// <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
//

function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;      
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}



// RANDOM BACKGROUND HEADER IMAGES
// add pictures for the headers here
// defining the path isn't necessary since it's already defined in the "document.write" line
function randimg()
{
var index = Math.floor(7*Math.random());	//number of images
var randimg = new Array(7)	//number of images
randimg[0] = "header1.jpg";
randimg[1] = "header2.jpg";
randimg[2] = "header3.jpg";
randimg[3] = "header4.jpg";
randimg[4] = "header5.jpg";
randimg[5] = "header6.jpg";
randimg[6] = "header7.jpg";
document.write("<td background=\"images/" + randimg[index] + "\" colspan=\"3\" height=\"190\" valign=\"bottom\">");
}



// YEAR OF CLUB WITH CORRECT SUFFIX ("st", "nd", "rd", "st") IN OUR WELCOME MESSAGE
function clubyear()
{
var theDate = new Date();
var theYear = theDate.getFullYear();
var suffix;

if (theYear % 10 == 1)
 {
 suffix = "st";
 }
else if (theYear % 10 == 2)
 {
 suffix = "nd";
 }
else if (theYear % 10 == 3)
 {
 suffix = "rd";
 }
else
 {
 suffix = "th";
 }

document.write(theDate.getFullYear()-1963 + suffix);
}


// TEAM PROFILE SWAPPING
var ids=new Array('team','brendan','christopher','jonathan','raymond','gary','nam','roberto','steve','amanda','tiffany','vickie','ahnika','hannah','lan');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

// KEEPING EXTERNAL LINKS IN A LBSAC FRAME
function inframe(url) 
{
popUp = window.open('','external','menubar=0,toolbar=1,location=0,directories=0,status=0,scrollbars=1,resizable=1');
popUp.document.clear();
popUp.document.open();
popUp.focus();
popUp.document.write("<head>\n<title>You're visiting outside LBSAC</title>\n</head>\n<frameset rows=80,*>\n<frame name=top src=fheader.html noResize scrolling=no>\n<frame name=bottom src="+url+">\n</frameset>");
popUp.document.close();
}