// 2000 AD TPB website JavaScript 
//
// ToC
// 		1. banner randomiser
//		2. drop-down menu

// ---------- 1. function for banner randomiser

function randomBanner()
{
var bannerLink=new Array();
// link src for each banner
bannerLink[1]="http://www.rebellion.co.uk/";
bannerLink[2]="https://www.2000adshop.com/";
bannerLink[3]="http://www.2000adonline.com/";
bannerLink[4]="http://www.abaddonbooks.com/";

var bannerFileName=new Array();
// filenames of images in this array
bannerFileName[1]="rebellion_animated.gif";
bannerFileName[2]="future_shop.gif";
bannerFileName[3]="2000adonline.gif";
bannerFileName[4]="abaddon.jpg";

var chosenAltCopy=new Array();
// title and alt copy for images goes here
chosenAltCopy[1]="Rebellion";
chosenAltCopy[2]="2000 AD Future Shop";
chosenAltCopy[3]="2000 AD online";
chosenAltCopy[4]="Abaddon Books";

var getRan=Math.floor(Math.random()*bannerFileName.length);
if (getRan==0)
getRan=1;

document.write('<a href=\"'+bannerLink[getRan]+'"><img src=\"assets/banners/'+bannerFileName[getRan]+'" alt=\"'+chosenAltCopy[getRan]+'\" width=\"468\" height=\"60\" class=\"imageBorder\" /></a>');
}


// ---------- 2. function for drop-down menu

startList = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("dmenu");
		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", "");
				}
			}
		}
	}
}

window.onload = function() {
      startList();
}
