function adRotator(objectID, interval, amount) {
	this.t = ""
	this.objectID = objectID
	this.target = document.getElementById(objectID);
	this.interval = interval;
	this.current = 0;
	this.ads = new Array();
	this.channels = new Array();
	
	for (i=1; i<=amount; i++) {
		this.channels.push(document.getElementById(this.objectID + "_" + i))
		this.ads.push(document.getElementById(this.objectID + "_" + i + "_html"))
	}
}

adRotator.prototype.moveto = function(omoveto) {
	movetonum = omoveto.getAttribute("id")
	movetonum = movetonum.substr(movetonum.length-1, 1)-1
	
	with (this) {
		clearTimeout(t);
	
		for (i=0; i<channels.length; i++)
			mouseout(channels[i]);
		
		target.innerHTML = ads[movetonum].innerHTML;
		mouseover(channels[movetonum]);
		
		current = movetonum;
		++current;
		if (current > channels.length-1)
			current = 0;
		
		t = setTimeout(objectID + ".rotate()", interval*1000);
	}
}

adRotator.prototype.mouseover = function(button) {
	button.style.color = "#ffffff";
	button.style.backgroundColor = "#000000";
}

adRotator.prototype.mouseout = function(button) {
	button.style.color = "#000000";
	button.style.backgroundColor = "#e0e0e0";
}

adRotator.prototype.rotate = function() {
	with (this) {
		for (i=0; i<channels.length; i++)
			mouseout(channels[i]);
		
		target.innerHTML = ads[current].innerHTML;
		mouseover(channels[current]);
		
		++current;
		if (current > channels.length-1)
			current = 0;
		
		t = setTimeout(objectID + ".rotate()", interval*1000);
	}
}