//fix ie background image caching
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}


	//Ticker Object
	/* Load html file */
	var XMLHttp=null;
	var myScroll=null;
	document.tickers=new Array();
	function addTicker(url){
		try{
			XMLHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){}
		}
		if (XMLHttp == null) XMLHttp = new XMLHttpRequest();
		XMLHttp.onreadystatechange = appendList;
        XMLHttp.open("GET", url, true);
		XMLHttp.send(null);
	}
	function appendList(){
		if (XMLHttp.readyState == 4){
			if (XMLHttp.status == 200 || XMLHttp.status == 0){
				$('tickerScroller').innerHTML = XMLHttp.responseText;
				document.tickers.push(new Ticker('tickerScroller'));
				startTickers(document.tickers.length-1);
				XMLHttp=null;
			}
		}
				
	}
	var Ticker = function(id){
		this.ul = $(id).getElementsByTagName('UL')[0];
		this.timer = null;
		this.init();
	}
	Ticker.prototype.init = function(){
		//this.el.style.overflow = "hidden";
		//this.el.style.position = "relative";
		this.ul.parentNode.style.overflow = "hidden";
		this.ul.parentNode.style.position = "relative";
		this.ul.style.position = "absolute";
		this.ul.style.overflow = "hidden";
		this.ul.style.width = this.ul.parentNode.offsetWidth + "px";
		this.ul.style.top = 0;
		//this.populate();		
	}
	Ticker.prototype.populate = function(){
		this.el.appendChild(this.ul);
	}
	Ticker.prototype.start = function(){
		if (obj) {
			step();
			return;
		}
		var obj = this;
		var delay = 50;
		var ulHeight = obj.ul.offsetHeight;
		var ulPosition = null;
		var step = function(){
			ulPosition = parseInt(obj.ul.style.top);
			if (Math.abs(ulPosition) > ulHeight) ulPosition = ulHeight;
			else ulPosition--;
			obj.ul.style.top = ulPosition + "px";
			if (!obj.timer) obj.timer = setInterval(step,delay);			
		}	
		//obj.el.onmouseover = obj.stop;
		step();
	}
	Ticker.prototype.stop = function(){
		clearInterval(this.timer);
		this.timer = null;
	}
	function stopTickers(num){
		if (!document.tickers[0]) return false;	
		if (typeof(num)!='undefined') {
			document.tickers[num].stop();
			return true;			
		}
		for (i=0;i<document.tickers.length;i++){
			document.tickers[i].stop();
		}
		return true;
	}
	function startTickers(num){
		if (!document.tickers[0]) return false;	
		if (typeof(num)!='undefined') {
			document.tickers[num].start();
			return true;			
		}
		for (i=0;i<document.tickers.length;i++){
			document.tickers[i].start();
		}
		return true;
	}

//Window onload
function onWindowLoad(){
	styleBox('toBox');
	addTicker('ticker_text.htm');
	
}
window.onload = onWindowLoad;


