
//declare vars
var topbanner_content = [];
var tbc = [];

topbanner_content[0] = [];
topbanner_content[0][0] = '<a href="http://shop.telcodepot.com/index.php?main_page=page&id=23"><img src="includes/templates/tdcustom/images/banners/new/free-shipping-phone-systems.png" alt="Free Shipping when you order one of our Phone Systems! conditions apply, click for details" title=" Free Shipping when you order one of our Phone Systems! conditions apply, click for details " /></a>';
//cyber monday:
//topbanner_content[0][0] = '<a href="http://shop.telcodepot.com/index.php?main_page=page&id=34"><img src="includes/templates/tdcustom/images/banners/new/cybermonday.png" alt="Free Shipping! conditions apply, click for details" title=" Free Shipping! conditions apply, click for details " /></a>';

//change this number to 1+ max num of banners OR 0 if only 1 banner
//  EX: if max is 3, then make i=4
var i = 0;
var tmpi = Math.floor(Math.random()*i);

tbc[0] = [];
tbc[0][0] = tmpi;
//this is the max num of banners, 0= 1 banner; 1 = 2 banners; 2 = 3 banners, etc.
tbc[0][1] = 0;

function switch_topbanners(adiv, n) {
	if (tbc[n][1] > 0) {
		//more than one element so can switch out
		if (tbc[n][0] == tbc[n][1]) {
			tbc[n][0] = 0;
		} else {
			tbc[n][0]++;
		}
		document.getElementById(adiv).innerHTML = topbanner_content[n][tbc[n][0]];
		//this time is in milliseconds
		setTimeout('switch_topbanners(\'' + adiv + '\', ' + n + ')', 8000);
	} else {
		//just make sure we set first one
		if (tbc[n][0] == tbc[n][1]) {
			document.getElementById(adiv).innerHTML = topbanner_content[n][tbc[n][0]];
			tbc[n][0]++;
		}
	}
}

switch_topbanners('topbannerplace1', 0);