//////////////////////////////////////////////////////////////
// banners.js - adds basic banner functionality to a webpage

//////////////////////////////////////////////////////////////
// ADDING BANNERS TO THE RANDOM ROTATION
// Simply follow the example below
// -----------------------------------------------------------
// Note: Make sure you have a comma (,) after every line,
// 		 except for the last line. See example below.
//
//       new Array("<image URL #1>", "<goto URL #1>"),  <-- comma
// -----------------------------------------------------------
// 
// var banners = new Array(
//     new Array("<image URL #1>", "<goto URL #1>"),
//     new Array("<image URL #2>", "<goto URL #2>"),
//     new Array("<image URL #3>", "<goto URL #3>")
// );
//////////////////////////////////////////////////////////////
var banners = new Array(
	new Array("http://www.montrealvip.com/images/testbanner1.jpg", "http://www.montrealvip.com/advertise.html"),
	new Array("http://www.montrealvip.com/images/canadiangrandprixbanner.gif", "http://www.montrealvip.com/montrealgrandprix.html"),
	new Array("http://www.montrealvip.com/images/johnnie.jpg", "http://www.montrealvip.com/advertise.html")
	
	
);



//////////////////////////////////////////////////////////////
// ADDING SPECIFIC BANNERS TO A PAGE
// -----------------------------------------------------------
// Copy the example below, replacing <page URL>, <image URL>,
// <goto URL> to the required URLs.
//
// Note: Make sure you have a comma (,) after every line,
// 		 except for the last line. See example below.
//
//       new Array("<image URL #1>", "<goto URL #1>"),  <-- comma
// -----------------------------------------------------------
// 
// special_pages['<page URL>'] = new Array(
//     new Array("<image URL>", "<goto URL>")
// );
//////////////////////////////////////////////////////////////
var special_pages = new Array();

special_pages['http://www.montrealvip.com/bannertest.html'] = new Array(
	new Array("http://www.montrealvip.com/images/testbanner2.jpg", "http://www.montrealvip.com/advertise.html")
);

var banner_link = "";

function set_banner (img, url) {
	
	document.images['banner'].src = img;
	banner_link = url;
}

function banner_init () {

	if (!document.banner) { return; alert("no banner"); }
	
	// are we at a special page?
	if (special_pages[location.href]) {
		var temp = special_pages[location.href];		
		var current = Math.floor(Math.random() * temp.length);
		set_banner (temp[current][0], temp[current][1]);	
		temp = null;
	}
	else {
		var current = Math.floor(Math.random() * banners.length);
		set_banner (banners[current][0], banners[current][1]);	
	}
	
	if (window.hideDivs) hideDivs();
}

function sendpage () {
	location.href = banner_link;
}

window.onload = banner_init;
