//Advert class

function Advert(img_src, url) {
	this.img_src = img_src;
	this.url = url;
}
Advert.prototype.getHtml = function() {
	return "<a href='" + this.url + "'><img src='" + this.img_src + "'/></a>";
}

//Friend class

function Friend(img_src, url) {
	this.img_src = img_src;
	this.url = url;
}
Friend.prototype.getHtml = function() {
	return "<a href='" + this.url + "'><img src='" + this.img_src + "'/></a>";
}

//Sponsor class

function Sponsor(title, url) {
	this.title = title;
	this.url = url;
}
Sponsor.prototype.getHtml = function() {
	return "<a href='" + this.url + "'>" + this.title + "</a>";
}


//create list of adverts and sponsors for display

var adverts = new Array();
adverts[0] = new Advert("images/adverts/claremont.gif", "advertisers.html#claremont");
adverts[1] = new Advert("images/adverts/laurie5.jpeg", "advertisers.html#maskall");
adverts[2] = new Advert("images/adverts/lodge.jpg", "advertisers.html#lodge");
adverts[3] = new Advert("images/adverts/1065.jpeg", "advertisers.html#officebase");
adverts[3] = new Advert("images/adverts/shahin.jpg", "advertisers.html#shahin");
adverts[4] = new Advert("images/adverts/supuk.gif", "advertisers.html#superior");
adverts[5] = new Advert("images/adverts/tiger.bmp", "advertisers.html#tiger");
adverts[6] = new Advert("images/adverts/twirltour.jpg", "advertisers.html#twirltour");
adverts[7] = new Advert("images/adverts/ras_terrace.jpg", "advertisers.html#ras");


var friends = new Array();
friends[0] = new Friend("images/adverts/clubmark_advert.png", "");
friends[1] = new Friend("images/adverts/shc.gif", "http://www.sunburyhockey.co.uk/");

var sponsors = new Array();
sponsors[0] = new Sponsor("Claremont Cattery Ltd", "sponsors.html#claremont");
sponsors[1] = new Sponsor("Laurie Maskall Menswear", "sponsors.html#maskall");
sponsors[2] = new Sponsor("Lodge Brothers", "sponsors.html#lodge");
sponsors[3] = new Sponsor("OfficeBase Ltd", "sponsors.html#officebase");
sponsors[3] = new Sponsor("Shahin Restaurant", "sponsors.html#shahin");
sponsors[4] = new Sponsor("Superior Freight Services", "sponsors.html#superior");
sponsors[5] = new Sponsor("Tiger Sports", "sponsors.html#tiger");
sponsors[6] = new Sponsor("Twirltour", "sponsors.html#twirltour");


//scroll the ads and sponsors

var adIndex = 0;
var frIndex = 0;

function displayNextAdSp() {
	var advert = adverts[adIndex];
	var friend = friends[frIndex];

	document.getElementById("adverts").innerHTML = advert.getHtml();
	document.getElementById("friends").innerHTML = friend.getHtml();	

	adIndex++;
	frIndex++;

	if(adIndex == adverts.length) {
		adIndex = 0;
	}

	if(frIndex == friends.length) {
		frIndex = 0;
	}
}

window.setInterval("displayNextAdSp()" , 5000);


startList = function() {

	//IE6 3px float bug
	var browser = navigator.appName;
	var versionString = navigator.appVersion;
	var versionSplit = versionString.split("MSIE");
	var version = parseFloat(versionSplit[1]);
			
	if (version<7) {
		var main = document.getElementById("main_section");
		main.style.marginLeft=174;
	}

	//dropdowns
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("nav");
	
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
					
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
  					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}



//v3.0
function MM_showHideLayers(id, display) {
    var layer = document.getElementById(id);

    if (display == 'show') {
        layer.style.display='inline';
    } else if (display == 'hide') {
        layer.style.display='none';
    }
}


function SM_hideall() {
}
function goteam1()
{
box = document.forms[0].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
function goteam2()
{
box = document.forms[1].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
function goteam3()
{
box = document.forms[2].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
function goteam4()
{
box = document.forms[3].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
function goteam5()
{
box = document.forms[4].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
function gocomp()
{
box = document.forms[5].navi;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}
