function Slider( sID )
{
	this._container = document.getElementById( sID );
	if ( this._container )
		this._configure();
};

Slider.prototype._configure = function()
{
	/*  'Declare' variables  */
	this._item        = new Array();
	this._activeitem  = 0;
	this._currentstep = 0;
	this._totalstep   = 25;
	this._timer       = null;

	/** interchange delay  **/
	this._eventdelay  = 3500;
	this._eventtimer  = 35;


	/*  Gather Menu Items  */
	var aItem  = this._container.getElementsByTagName( "div" );
	var itemheight = 0;
	for ( var i = 0; i < aItem.length; ++i )
	{
		if ( aItem[ i ].className.match( /slideritem/gi ) )
		{
			if ( aItem[ i ].hasChildNodes() && aItem[ i ].childNodes.length > 0 )
			{
				for ( var j = 0; j < aItem[ i ].childNodes.length; j++ )
				{
					if ( aItem[ i ].childNodes[ j ].nodeName == "A" )
					{
						if ( aItem[ i ].childNodes[ j ].hasChildNodes() && aItem[ i ].childNodes[ j ].childNodes.length > 0 )
						{
							for ( var k = 0; k < aItem[ i ].childNodes[ j ].childNodes.length; k++ )
							{
								if ( aItem[ i ].childNodes[ j ].childNodes[ k ].nodeName == "IMG" )
								{
									this._item[ this._item.length ] = aItem[ i ].childNodes[ j ].childNodes[ k ];
								}
							}
						}
					}
				}
			}
		}
	}
				

	/*  Calculate the animation path  */
	this._path = this._calculatePath( 50, 0, this._totalstep );
	
	/*  Attach the mouseout event  */
	this._container._control   = this;
	window[ ( this._self = "SliderMasterControlObject" ) ] = this;
};

Slider.prototype._calculatePath = function( nFrom, nTo, nStep )
{
	var aReturn = new Array();
	for ( var i = 0; i < nStep; ++i )
		aReturn[ aReturn.length ] = Math.round( klib3.movement.smooth( nFrom, nTo, i, nStep ) );
	return aReturn;
};

Slider.prototype.start = function()
{
	setTimeout( this._self + "._update( true );", this._eventtimer );
}

Slider.prototype._update = function( bDisplay )
{
	clearTimeout( this._timer );
	
	if ( this._activeitem < 0 || this._activeitem >= this._item.length )
		this._activeitem = 0;
	
	oSlide = this._item[ this._activeitem ];
	
	if ( bDisplay )
	{
		oSlide.parentNode.parentNode.style.display = "block";
		if ( ++this._currentstep < this._path.length )
		{
			oSlide.style.bottom = -this._path[ this._currentstep ] + "px";
			this._timer = setTimeout( this._self + "._update( true );", this._eventtimer );
		}
		else
			this._timer = setTimeout( this._self + "._update( false );", this._eventdelay );
	}
	else
	{
		if ( --this._currentstep > 0 )
		{
			oSlide.style.bottom = -this._path[ this._currentstep ] + "px";
			this._timer = setTimeout( this._self + "._update( false );", this._eventtimer );
		}
		else
		{
			oSlide.parentNode.parentNode.style.display = "none";
			this._activeitem++;
			this._timer = setTimeout( this._self + "._update( true );", this._eventtimer );
		}
	}
};
