function Ticker( sElementPrefix, iActiveItemIndex, iTotalItems, iAutomaticTickerValue, iManualTickerValue )
{
	// Properties
	this.PreviousItemIndex = 0;
	this.ElementPrefix = sElementPrefix;
	this.ActiveItemIndex = iActiveItemIndex;
	this.TotalItems = iTotalItems;
	this.AutomaticTickerValue = iAutomaticTickerValue;
	this.ManualTickerValue = iManualTickerValue;
	this.TimerID = -1;
	
}


Ticker.prototype.pause = function( oTickerTemp )
{
	clearTimeout( this.TimerID );
}

Ticker.prototype.reset = function( oTickerTemp )
{
	clearTimeout( this.TimerID );
	oThat = this;
	this.TimerID = setTimeout(function(){oThat.next()}, this.ManualTickerValue );
}

Ticker.prototype.go = function()
{
	this.next();
}

Ticker.prototype.previous = function( bManual )
{
	if( bManual )
		this.pause();
		
	this.PreviousItemIndex = this.ActiveItemIndex;
	
	if( this.ActiveItemIndex != 1 )
		this.ActiveItemIndex = this.ActiveItemIndex - 1;
	else
		this.ActiveItemIndex = this.TotalItems;
		
	this.switchIt( bManual );
}

Ticker.prototype.next = function( bManual )
{
	if( bManual )
		this.pause();
		
	this.PreviousItemIndex = this.ActiveItemIndex;
	
	if( this.ActiveItemIndex != this.TotalItems )
		this.ActiveItemIndex = this.ActiveItemIndex + 1;
	else
		this.ActiveItemIndex = 1;
		
	this.switchIt( bManual );
}

Ticker.prototype.show = function( iIndex )
{
	this.alter( iIndex, "visible", "block" );
}	

Ticker.prototype.hide = function( iIndex )
{
	this.alter( iIndex, "hidden", "none" );
}

Ticker.prototype.alter = function( iIndex, sVisibility, sDisplay )
{
	var sIndex = iIndex.toString();

	var sID = this.ElementPrefix + sIndex;
			
	var oItem = ( document.getElementById ) ? document.getElementById( sID ) : eval( 'document.all.' + sID );
	
	if( oItem != null )
	{
		oItem.style.visibility = sVisibility;
		oItem.style.display = sDisplay;
	}
}

Ticker.prototype.goTo = function( iIndex )
{
	if( this.ActiveItemIndex != iIndex )
	{
		this.PreviousItemIndex = this.ActiveItemIndex;
		
		this.ActiveItemIndex = iIndex;
		
		//alert( this.PreviousItemIndex + ' ' + this.ActiveItemIndex );
			
		this.switchIt( true );
	}
}

Ticker.prototype.switchIt = function( bManual )
{
	if( bManual == undefined )
		bManual = false;
	
	if( bManual )
		this.pause();
		
	this.show( this.ActiveItemIndex );
	
	if( !bManual )
	{
		if( this.PreviousItemIndex != 0 )
			this.hide( this.PreviousItemIndex );
	}
	else
	{
		if( this.PreviousItemIndex != 0 )
		{
			this.hide( this.PreviousItemIndex );
		}
		
	}
	
	// Start the Ticker over
	var oThat = this;
	if( bManual )
	{
		this.TimerID = setTimeout( function(){oThat.next()}, this.ManualTickerValue );
	}
	else
	{
		this.TimerID = setTimeout( function(){oThat.next()}, this.AutomaticTickerValue );
	}
}
