//image path, url, target
//target -> "" = (self, no frames)
//target -> "-<framename>" = (framed window)
//target -> "top" = (same window)
//target -> "new" = (new window)

swapList = new Array(
dir+"images/banner_dreamcar.gif",dir+"auto/index.html","top",
dir+"images/banner_newhome.gif",dir+"homecenter/index.html","top",
dir+"images/banner_empbank.gif","","top"
);

//extras for new window
newWin = new Array(
"", //width
"", //height
"toolbar",
"menubar",
"location",
"directories",
"status",
"scrollbars",
"resizable"
);


var switchline = "";
var mod = swapList.length / 3;
var timer = null;
var n = -1;

function makeSwap(str,u,loc) {
	this.image = new Image();
	this.image.src = str;
	this.url = u;
	this.loc = loc;
}

slide = new Array();
var x = 0;
for (var i = 0; i < swapList.length; i++) {
	slide[x] = new makeSwap(swapList[i], swapList[++i], swapList[++i]);
	x++;
}

function swapbanner() {
	n = (n + 1) % mod;
	
	clearTimeout(timer);
	switchline = "document.images." + docimage + ".src = slide[n].image.src";
	eval(switchline);
	
	timer = setInterval('swapbanner();',factor);
}

function linkit() {
	var aloc = slide[n].loc;

	if(aloc == "") { // self (no frames)
		location = slide[n].url;
	} else if(aloc == "new") { // new window
		//create extras
		extras = newWin[2];
		for(var nw = 3; nw < newWin.length; nw++) {
			extras += "," + newWin[nw];
		}
	
		//open window with extras
		if(newWin[0] == "" && newWin[1] == "") {
			window.open(slide[n].url,"window",extras);
		} else {
			window.open(slide[n].url,"window","width="+ newWin[0] +",height="+ newWin[1] +","+ extras +"");
		}
	} else if(aloc.indexOf("-") >= 0) { // open in targeted window
		if(parent.frames.length > 0) {
			aloc = aloc.substring(aloc.length, 1);
			eval("parent." + aloc + ".location ='" + slide[n].url + "'");
		} else {
			alert("window is not a frameset");
		}
	} else { //open in target top
		if(parent.frames.length > 0) {
			eval(slide[n].loc + ".location='" + slide[n].url + "'");
		} else {
			alert("window is not a frameset");
		}
	}
}