//Quotes start
Array.prototype.remove=function(from, to){
	var rest = this.slice((to || from) + 1 || this.length);
	this.length = from < 0 ? this.length + from : from;
	return this.push.apply(this, rest);
}
var news_ticker={
	sec_delay:15,
	ht:0,	
	quotes:new Array(),
	stop:false,
	timer:null,
	run:function(){
	    if(!this.stop){
		    if(this.ht<0){
			    this.ht+=1
			    this.qb.style.bottom=this.ht+'px';
			    this.timer=window.setTimeout("news_ticker.run()");
		    }else this.timer=window.setTimeout("news_ticker.showQuotes()",this.sec_delay)
		}
	},
	closeIt:function(){		
		if(this.ht>this.bt){
			this.ht-=1.5;
			this.qb.style.bottom=this.ht+'px';
			this.timer=window.setTimeout("news_ticker.closeIt()");
		}
	},
	showQuotes:function(){
		//debugger;
		var i=this.quotes.length;
		if(i>0){
		    i=window.Math.floor(window.Math.random()*i);
		    this.msg.innerHTML=this.quotes[i].msg;
		    this.name.innerHTML=this.quotes[i].name;
		    this.ht=this.dv[1].scrollHeight;
		    this.qb.style.height=this.dv[0].style.height=this.ht+20+'px';
	        this.quotes.remove(i);
	        this.bt=-this.ht-20;		
	        this.qb.style.bottom=this.bt+'px';	
	        this.ht=this.bt;
	        if(this.quotes.length<1)this.quotes=this.quotes_ori.slice();
	        this.run();		
	    }
	},
	init:function(){
		news_ticker.sec_delay*=1000;
		news_ticker.qb=document.getElementById("quotebox");
		news_ticker.dv=news_ticker.qb.getElementsByTagName("div");
		news_ticker.msg=document.getElementById("quotemsg");
		news_ticker.name=document.getElementById("quotename");
		news_ticker.quotes_ori=news_ticker.quotes.slice();		
		this.timer=window.setTimeout("news_ticker.showQuotes()",2000)
	}
}
//Quotes end
