//*********************
// Ticker Constructor *
//*********************
function Ticker(content)
{
	// get id's
	this.ticker_wrapper	= document.getElementById('ticker').getElementsByTagName('h1')[0];
	this.ticker_text	= document.getElementById('ticker').getElementsByTagName('span')[0];
	
	// set vars
	this.width			= this.ticker_wrapper.offsetWidth;
	this.height			= this.ticker_wrapper.offsetHeight;
	this.speed			= 2;
	this.pause_onhover	= 1;
	this.content		= content;
	this.ticker_speed	= (document.all) ? this.peed : Math.max(2, this.speed-2);
	this.copyspeed		= this.speed;
	this.pausespeed		= (this.pause_onhover == 0) ? this.copyspeed : 0;
	
	this.ticker_text.style.left	= parseInt(this.width) + 'px';
	this.ticker_text.innerHTML	= this.content;
	this.actual_width			= this.ticker_text.offsetWidth;
	
	// initialize Object
	this.init();
}

//*****************************
// Function initialize ticker *
//*****************************
Ticker.prototype.init = function()
{
	// set object as var
	var _this = this;
	
	// set events
	this.events();
	
	setInterval(
		function ()
		{
			if (parseInt(_this.ticker_text.style.left) > -_this.actual_width)
			{
				_this.ticker_text.style.left = parseInt(_this.ticker_text.style.left) - _this.copyspeed + 'px';
			}
			else
			{
				_this.ticker_text.style.left = parseInt(_this.width) + 'px';
			}
		}
		, 30
		);
}
 
//*********************************
// Function set events for ticker *
//*********************************
Ticker.prototype.events = function()
{
	// set object as var
	var _this = this;
	
	this.ticker_wrapper.onmouseover = function()
	{
		_this.copyspeed = _this.pausespeed;
	}
	
	this.ticker_wrapper.onmouseout = function()
	{
		_this.copyspeed = _this.speed;
	}
	
	// onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=ticker_speed
}
