function Ticker(name, id, shiftBy, interval)
{
	this.name = name;
    this.id = id;
    this.shiftBy  = shiftBy ? shiftBy : 1;
    this.interval = interval ? interval : 100;
    this.runId	= null;

	this.div = document.getElementById(id);

  	// remove extra textnodes that may separate the child nodes
  	// of the ticker div

	var node = this.div.firstChild;
    var next;

	while (node){
    	next = node.nextSibling;
    	if (node.nodeType == 3){
        	this.div.removeChild(node);
		}
        node = next;
	}
    //end of extra textnodes removal

	this.left = 0;
	this.shiftLeftAt = this.div.firstChild.offsetWidth;
	this.div.style.height = this.div.firstChild.offsetHeight + 'px';
	this.div.style.width = 2 * screen.availWidth + 'px';
	this.div.style.visibility = 'visible';
}

Ticker.prototype.start = function()
{
	this.stop();
	this.left -= this.shiftBy;
	if (this.left <= -this.shiftLeftAt){
  		this.left = 0;
    	this.div.appendChild(this.div.firstChild);
    	this.shiftLeftAt = this.div.firstChild.offsetWidth;
	}

  	this.div.style.left = (this.left + 'px');
	this.runId = setTimeout(this.name + '.start()', this.interval);
};

Ticker.prototype.stop = function()
{
	if (this.runId){
   		clearTimeout(this.runId);
	}
	this.runId = null;
};


Ticker.prototype.stop = function()
{
	if (this.runId){
   		clearTimeout(this.runId);
	}
	this.runId = null;
};

var ticker = null;

function startTicker()
{
	// rather then mess with the ticker code we will duplicate the node we want to repeat	
	var root = document.getElementById('tickerItems');
	var node = root.firstChild;
    var next;
	var found = false;
	if(node.nodeType != 1){
		while (node){
			next = node.nextSibling;
			if (next.nodeType == 1){
				   node = next;
				   found = true ;
				   break ;
			}
			node = next;
		}
	}else{
		found = true ;
	}
	
	if(found){
		var cloned = node.cloneNode(true) ;		
		for(var i=0; i<2; i++){	
			root.appendChild(cloned.cloneNode(true)) ;
		}
	}
	

	// internal name, div id, amount to move per frame, speed (ms)
	ticker = new Ticker('ticker', 'tickerItems', 1, 90);
	ticker.start();
}