window.onload = init;

function init() {
	initTicker();
	// doit();
}


/* Ticker */
var pixel = 1;
var scrolled_pixel = 0;
var max_width = 0;
var displayed_width = 810;
var speed = 25;

function initTicker() {   
   if(document.getElementById("ticker")) {      
      max_width = document.getElementById("ticker").offsetWidth + displayed_width;      
      showTicker();
   }
}

function showTicker() {
	if(document.getElementById) { 
		document.getElementById("ticker").style.left = (displayed_width - scrolled_pixel) + "px";   
		scrolled_pixel += pixel; 
	}
	if(scrolled_pixel > max_width+400) {
		scrolled_pixel = 0;
	}
  window.setTimeout("showTicker()",speed);
}

/*
function doit() {

var Ticker = {
	pixel : 1,
	scrolled_pixel : 0,
	max_width : 0,
	displayed_width : document.getElementById('ticker').parentNode.offsetWidth,
	speed : 30,
	showTicker : function() {
		if(document.getElementById) {   
			document.getElementById("ticker").style.left = (this.displayed_width - this.scrolled_pixel) + "px";   
			this.scrolled_pixel += this.pixel;   
		}
		if(this.scrolled_pixel > this.max_width) {
			this.scrolled_pixel = 0;
		}
		window.setTimeout("this.showTicker()", this.speed);
	},
	initTicker : function() {		
		if(document.getElementById("ticker")) {      
			this.max_width = document.getElementById("ticker").offsetWidth + this.displayed_width;      
			this.showTicker();
		}
	}
}

Ticker.initTicker();

}
*/
