/*  PromoRotation, version 1.0.0
 *  Copyright (c) 2009 Carl Siegle (http://www.carlsiegle.com)
 *
 *  Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
 *  http://creativecommons.org/licenses/by-nc-nd/3.0/
 *
 *  For more information or to use this script on a commercial website or project, contact:
 *  Carl Siegle
 *  carl@carlsiegle.com
 *
 *--------------------------------------------------------------------------*/

var bannerRotation = {
	setItems: function(value) {
		this._items = value;
	},
	_currentItemIndex: -1,	
	currentItemIndex: function() {
		if(this._currentItemIndex == -1) {		
			this._currentItemIndex = Math.floor(Math.random()*this._items.length);
		}
		return this._currentItemIndex;
	},	
	currentItem: function() {
		return this._items[this.currentItemIndex()];
	}	
};

function initBanners() {
	var bannerItems = [
	    ['promo4','promo4'],
		['promo3','promo3_1'],
		['promo2','promo2'],
		['promo1','promo1']

	];

	for (var i=bannerItems.length-1; i>=0; i--) {					
		bannerRotation.setItems(bannerItems[i]);				
		var currentBanners = bannerRotation.currentItem();				
		/*$(currentBanners).style.display = 'block';*/
		document.getElementById(currentBanners).style.display = 'inline';
	}
};