
/**
 * news.js -> http://ojmed.com/
 * scroll text dynamically
 * (cc) creative commons by 3.0
 */
 

var _news;


function news_start()
{
	
	_news = document.getElementById("news");
	if ( _news.offsetWidth!=0 ) {
	
		var maxw  = CSS.get( _news, "max-width", true );
		var width = _news.offsetWidth>maxw ? _news.offsetWidth : maxw;
		var blank = '<span style="display:inline-block;width:'+width+'px;height:'+(_news.offsetHeight/2)+'px;"></span>';
		
		_news.innerHTML = blank + _news.innerHTML  + blank;
	}
	
	setInterval( "news_run()", 30 );
}

function news_run()
{
	_news.scrollLeft += 2;
	//if ( _news.scrollLeft<=0 ) _news.scrollLeft = _news.scrollWidth - _news.offsetWidth; // RL
	if ( _news.scrollLeft>=_news.scrollWidth - _news.offsetWidth) _news.scrollLeft = 0; // LR
}

