
// Scroller Settings

var scrollerXIncrease	= 1;
var scrollerTimeDelay	= 30;
var scrollerWidth		= 730;
var scrollerHeight		= 20;

// Scroller Style
// http://codepunk.hardwar.org.uk/css2js.htm

var scrollerStyle		= new Array ();
//scrollerStyle[0]		= new Array ('border',		'1px solid #000000');
//scrollerStyle[1]		= new Array ('font',		'0.8em Verdana');

// Scroller Variables

var scrollerContainer;
var scrollerContent;
var scrollerLeft;
var scrollerContentWidth;

// Scroller Initialisation

window.onload	= function ()
{
	
	// Set scroller objects
	
	scrollerContainer	= document.getElementById('scroller_container');
	scrollerContent		= document.getElementById('scroller_content');
	
	// Set scroller movement variables
	
	scrollerLeft		= scrollerWidth;
	
	// Set the scroller container style
	
	if (scrollerContainer)
	{
		
		scrollerContainer.style.position	= 'relative';
		scrollerContainer.style.width		= scrollerWidth + 'px';
		scrollerContainer.style.height		= scrollerHeight + 'px';
		scrollerContainer.style.overflow	= 'hidden';
		
		// Set the custom styles
		
		for (x = 0; x < scrollerStyle.length; x++)
		{
			
			eval ('scrollerContainer.style.' + scrollerStyle[x][0] + ' = "' + scrollerStyle[x][1] + '";');
			
		}
		
		// Get content text width
		
		scrollerContentWidth	= scrollerWidth * (scrollerContent.offsetHeight / scrollerHeight)
		
		// Set the scroller content style
		
		scrollerContent.style.position		= 'absolute';
		scrollerContent.style.left			= scrollerLeft + 'px';
		scrollerContent.style.width			= scrollerContentWidth + 'px';
		
		// Set the scroller movement
		
		setInterval ('scrollerMove ()', scrollerTimeDelay);
		
	}
	
}

// Scroller Movement

function scrollerMove ()
{
	
	// Update scroller position
	
	scrollerLeft	-= scrollerXIncrease;
	
	// If the scroller is at te end
	
	if (scrollerLeft < 0- scrollerContentWidth)
	{
		
		// Reset the scroller position
		
		scrollerLeft	= scrollerWidth;
		
	}
	
	// Update the content position
	
	scrollerContent.style.left		= scrollerLeft + 'px';
	
}