// Use Freely as long as following disclaimer is intact ::
//---------------------------------------------------------------
// Cross Browser Multi-Directional Scroller v1.1 18th January 2005
// This script written by Rik Comery. www.ricom.co.uk
// For support, visit the "Resources" section at www.ricom.co.uk           
// All rights reserved.   
var _auxScroller = 0;
var _speedScrolling = 0;
var _widthScrolling = 0;
var _timeStop = 0;
var _countItemScroller = 0;
var _indexItemScroller = 0;
var _scrolling = true;
var StartScroller = false;


function setSpeedScrolling(value)
{
	_speedScrolling = value;
}

function setWidthScrolling(value)
{
	_widthScrolling = value;
}

function setTimeStop(value)
{
	_timeStop = value;
}

//Browser Sniffer
isIE = (document.getElementById && document.all)?true:false;

function loadScroller(){

  obj = (isIE)?document.all.divScroller:document.getElementById("divScroller");
  tableObj = (isIE)?document.all("tableScroller"):document.getElementById("tableScroller"); 
  contentObj = (isIE)?document.all.divScrollerContent:document.getElementById("divScrollerContent");
  
  if(contentObj.offsetHeight > 190)
  {
	if(StartScroller){
		contentObj.innerHTML += 
		(replaceAll(contentObj.innerHTML,'ItemScroller','copy1ItemScroller')
		+ replaceAll(contentObj.innerHTML,'ItemScroller','copy2ItemScroller')
		+ replaceAll(contentObj.innerHTML,'ItemScroller','copy3ItemScroller'));
	}  
	objWidth = tableObj.offsetHeight;
	HalfWidth=Math.floor(objWidth/2);
	newWidth = (HalfWidth*2) + 2;
	obj.style.width = newWidth;
	  
	if(StartScroller){
		timer = setTimeout ("moveLayer(obj,"+ newWidth +");", _timeStop); 
	}
  }
} 

// Move the layer by one pixel to the left
function moveLayer(obj, width)
{
	maxLeft = (0-(width/2)+2)/2

	if(_scrolling)
	{		
		if(obj.style.top=="")
			obj.style.top=0;
		
		if (parseInt(obj.style.top)<(0-(width/2)+6))
			obj.style.top = 0
		else
			obj.style.top = parseInt(obj.style.top)-1
	}		
		
	_auxScroller++;
	_widthScrolling = ((isIE)?document.all("ItemScroller" + _indexItemScroller):document.getElementById("ItemScroller" + _indexItemScroller)).offsetHeight;

	if (_auxScroller == _widthScrolling)
	{
		_auxScroller = 0;
		_indexItemScroller = (++_indexItemScroller % _countItemScroller);
		clearTimeout(timer); 
		timer = setTimeout ("moveLayer(obj, "+width+");", _timeStop); 
	}
	else
		timer = setTimeout ("moveLayer(obj, "+width+");", _speedScrolling); 
}

function replaceAll(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replaceAll(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function stop()
{
	_scrolling = false;
}

function start()
{
	_scrolling = true;
}