function Ticker( sElementPrefix, iActiveItemIndex, iTotalItems, iTimerID, iAutomaticTickerValue, iManualTickerValue )
{
	// Properties
	this.PreviousItemIndex = 0;
	this.ElementPrefix = sElementPrefix;
	this.ActiveItemIndex = iActiveItemIndex;
	this.TotalItems = iTotalItems;
	this.TimerID = iTimerID;
	this.AutomaticTickerValue = iAutomaticTickerValue;
	this.ManualTickerValue = iManualTickerValue;
}


Ticker.prototype.pause = function( oTickerTemp )
{
   	clearTimeout( this.TimerID );
}

Ticker.prototype.reset = function( oTickerTemp )
{
	if( this.TotalItems > 1 )
	{
		clearTimeout( this.TimerID );
		oThat = this;
		this.TimerID = setTimeout(function(){oThat.next()}, this.ManualTickerValue );
	}
}

Ticker.prototype.go = function()
{
    if( this.TotalItems > 1 )
    	this.next();
    else
    {        
        this.show(1);
    }
}

Ticker.prototype.previous = function( bManual )
{
	if( this.TotalItems > 1 )
	{
		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( this.TotalItems > 1 )
	{
		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" );
	
	//--hack by gph
	var oButton = ( document.getElementById ) ? document.getElementById( 'rotater-button' + iIndex ) : eval( 'document.all.' + 'rotater-button' + iIndex );

	if( oButton )
    {
    	oButton.style.color = '#999';
    }
}	

Ticker.prototype.hide = function( iIndex )
{
	this.alter( iIndex, "hidden", "none" );
	
	//--hack by gph
	var oButton = ( document.getElementById ) ? document.getElementById( 'rotater-button' + iIndex ) : eval( 'document.all.' + 'rotater-button' + iIndex );

	if( oButton )
    {
    	oButton.style.color = '#347ca8';
    }
}

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 );
	}
}