// JavaScript Document
promoRotator = function(divId) {
	this.targetId = divId;
	this.List = Array();
	this.curNdx = 0;
};

promoRotator.prototype = {
	switchPromos : function() {
		this.curNdx++;
		
		if (this.curNdx >= this.List.length)
			this.curNdx = 0;
			
		var curPromo = this.List[this.curNdx];
		
		var promoA = document.getElementById(this.targetId);
		
		promoA.setAttribute('href', curPromo.link);
		promoA.firstChild.setAttribute('src', curPromo.img)
	},

	next : function() {
		this.curNdx++;
		
		if (this.curNdx >= this.List.length)
			this.curNdx = 0;
			
		var curPromo = this.List[this.curNdx];
		
		var promoA = document.getElementById(this.targetId);
		
		promoA.setAttribute('href', curPromo.link);
		promoA.firstChild.setAttribute('src', curPromo.img)
	},

	prev : function() {
		this.curNdx--;
		
		if (this.curNdx < 0)
			this.curNdx = this.List.length -1;
			
		var curPromo = this.List[this.curNdx];
		
		var promoA = document.getElementById(this.targetId);
		
		promoA.setAttribute('href', curPromo.link);
		promoA.firstChild.setAttribute('src', curPromo.img)
	}
};