//	 Basic browser compatibility check

var isAll = 0;
var isID = 0;
if (document.getElementById) {
	isID = 1;
}
else if (document.all) {
		isAll = 1;
}
else {
	alert('You will need a more modern browser to view this site');
}
function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) {
			return (document.getElementById(objectID).style);
		}
		else if (isAll) {
				return (document.all[objectID].style);
		}
	}
	else {
		if (isID) {
			return (document.getElementById(objectID));
		}
		else if (isAll) {
				return (document.all[objectID]);
		}
	}
}


//	Main home page functions

function showMenu(menuName) {
	domStyle = findDOM(menuName, 1);
	domStyle.visibility = "visible";
}
function hideMenu(menuName) {
	domStyle = findDOM(menuName, 1);
	domStyle.visibility = "hidden";
}
function swapColor(menuName) {
	domStyle = findDOM(menuName, 1);
	domStyle.color = "#fadc41";
}
function gotoUrl(newPage) {
	location.href=newPage;
}


//	Set up of randomly generated pictures, associated names and links

var adTeam = new Array("Joel Barolsky","George Beaton","Margaret Beaton","Mel Chee","Belinda Cusworth","Jelena Dodic","Tristan Forrester","Warren Riddell","Rebecca Sheils","Bill Taylor","Stefan Yelas","Rana Bose","Eric Chin","Vicki Coffin","Sylvia Collett","Lynda Dean","Maia Gould","Sue Harkin","Natasha Langton","Shirley Martin","Paul Moon","Phillip Sargeant","Jordan Webb");

function init() {
	var panel=document.getElementById("panel");
	var i, rand, temp, str, x, membID, nums = [];
	for( i=0; i<23; i++) {
		nums[i] = i ;
	}
	for( i=0; i<23; i++) {
		rand = Math.ceil(Math.random()*22);
		temp = nums[i];
		nums[i] = nums[rand];
		nums[rand]=temp;
	}
	str = "";
	for( i=0; i<23; i++) {
		x = nums[i];
		membID = adTeam[x].replace(" ","_")
		str += '<div class="teamBox" style="background-image: url(images/' + membID + '_sml.jpg);" onMouseover="showMenu(\'' + membID + '\')" onMouseout="hideMenu(\'' + membID + '\')" onClick="swapColor(\'' + membID + '\'), gotoUrl(\'' + membID + '.htm\')"><div id="' + membID + '" class="nameTag">' + adTeam[x] + '</div></div>';
	}
	panel.innerHTML = str;
}
window.onload=init;