/**
* Simple Horizontal Scroll v0.1
* By: me@daantje.nl
* last update: Sun Dec 24 00:13:19 CET 2006
*
*	Documentation: Copy & paste
*	License: LGPL
*	Support: some.
*/

var scrllTmr;
window.onload = function()
{
	SContainer = document.getElementById( 'ScrollContainer' );
	SContent   = document.getElementById( 'ScrollContent'   );
	
	//set style
	SContainer.style.overflow   = 'hidden';
	SContent.style.float        = 'left';
	SContent.style.position     = 'relative';
	SContent.style.visibility   = "visible";
	//SContent.style.width        = '';			// For Firefox bug.
	
	//get canvas
	cw = parseInt( document.getElementById( 'ScrollContainer'   ).offsetWidth );
	w  = parseInt( document.getElementById( 'ScrollContent' ).offsetWidth );
	
	//start scroll
	//lft = cw + w;
	lft = cw;

	document.getElementById( 'ScrollContent' ).style.left = lft + "px";
	scrollStep( cw, w, lft );
	
}

function scrollStep( cw, w, lft )
{
	var Step = 2;

	//document.getElementById( 'ScrollDebug' ).innerHTML = "cw: " + cw + ", w: " + w + ", lft: " + lft
	
	//calc and do step
	//if( lft < w * -1 )
	if( lft < -w )
	{
		//lft = cw + w;
		lft = cw;
	}
	document.getElementById( 'ScrollContent' ).style.left = lft + "px";
	
	//wait and do next...
	if( scrllTmr )
	{
		clearTimeout( scrllTmr );
	}
	scrllTmr = setTimeout( 'scrollStep( cw, w, ' + (lft - Step) + ' )', 50 );
}