function Rotator(id) {
	this.id 			= id;
	this.oPanel 		= document.getElementById('news-panel');
	this.oAnchor 		= document.getElementById('n-anchor');
	this.oDescrip 		= document.getElementById('n-descrip');
	this.debugPanel 	= document.getElementById('debug');
	this.currentIndex 	= -1;
	this.autoTimer 		= null;
	this.rotateTimer 	= null;
	this.iClip 			= 320;
	this.step 			= 10;
	this.panelState 	= 'hiding';
	
	this.prev = function() {
		clearTimeout(this.autoTimer);
		this.currentIndex -= 1;
		if(this.currentIndex < 0) this.currentIndex = news.length-1;
		//this.debugPanel.innerHTML = this.currentIndex;
		this.panelState = 'hiding';
		this.rotate();
	}

	this.next = function() {
		clearTimeout(this.autoTimer);
		this.currentIndex ++;
		if(this.currentIndex >= news.length) this.currentIndex = 0;
		this.panelState = 'hiding';
		this.rotate();
	}
	
	this.auto = function() {
		if(this.currentIndex >= news.length) this.currentIndex = 0;
		this.panelState = 'hiding';
		this.rotate();
		this.autoTimer = setTimeout(this.id + ".auto();", 6000);
		this.currentIndex ++;
	}
	
	this.init = function() {
		this.panelState = 'hiding';
		this.rotate();
		this.currentIndex ++;
	}
	
	this.rotate = function() {
		switch(this.panelState) {

			case 'hiding':
				if(this.iClip <= 0) {
					this.iClip = 0;
					this.panelState = 'swapping';
				}
				this.clipItem(-(this.step));
			break;
			
			case 'swapping':
				this.swapContent();
				this.panelState = 'showing';
			break;
			
			case 'showing':
				if(this.iClip >= 320) {
					this.iClip = 320;
					clearTimeout(this.rotateTimer);
					this.panelState = 'static';
				} 
				this.clipItem(this.step);
			break;
		}
		this.rotateTimer = setTimeout(this.id + ".rotate();", 10);
	}
	
	this.clipItem = function(offset) {
		this.iClip += offset;
		this.oPanel.style.clip = 'rect(0 ' + this.iClip + 'px 72px 0)';
		//this.debugPanel.innerHTML = this.iClip;
	}
	
	this.swapContent = function() {
		if(this.currentIndex >= news.length) {
			this.currentIndex = 0;
		}	
		this.oAnchor.innerHTML = news[this.currentIndex][0];
		this.oAnchor.href = news[this.currentIndex][1];
		this.oDescrip.innerHTML = news[this.currentIndex][2];
	}
}