var i = 0;
var rotateB = (Math.floor(Math.random() * 4)) + 1;
var rotateI = 9000;
var imagesB = new Array(4);

function StartBanner() {
    for (i = 0; i < imagesB.length; i++) {
		imagesB[i] = new Image(468,80);
		imagesB[i].src = "/ssc/images/topbanner_"+(i+1)+".gif";
	}

	document.images['TopBanner'].src = imagesB[rotateB - 1].src;
	setTimeout("RotateBanner()", rotateI);
}

function mvrB(banner) {
	banner.style.cursor = 'pointer';
}
function moutB(banner) {
	banner.style.cursor = 'default';
}
function mclkB(banner) {
	if (rotateB == 2)
	    window.open("http://www.weekendhockey.com", "_blank", "");
	else if (rotateB == 3)
	    window.open("http://www.danone.ca", "_blank", "");
	else if (rotateB == 4)
	    window.open("http://www.teamuptoconquercancer.ca", "_blank", "");
	else
	    window.open("http://www.marlies.ca", "_blank", "");
}

function RotateBanner() {
	rotateB++;

	if (rotateB == (imagesB.length+1)) rotateB = 1;

	if (rotateB == 2) rotateI = 9000;
	else if (rotateB == 3) rotateI = 9000;
	else if (rotateB == 4) rotateI = 9000;
	else rotateI = 12000;

	document.images['TopBanner'].src = imagesB[rotateB-1].src;
	setTimeout("RotateBanner()",rotateI);
}
