var ie	=	document.all;
var dom	=	document.getElementById;
/*
var one_pause =	2000;
var scroll_speed = 50;
var news_width = 150;
var n_count = 5;
*/
function SCROLL(){
	this.one_pause =	null;
	this.scroll_speed = null;
	this.news_width = null;
	this.n_count = null;
	this._name = null;
	this._div_prefix = null;
	
	this.lastobjdiv = null;
	this.stop_scroll = false;
	this.scrollDivs = new Array();
	this.tmp_stop_scroll = false;
	return this;
}

SCROLL.prototype.init = function(){
		if(!this.lastobjdiv){	
			this.lastobjdiv	=	getElt(this._div_prefix + "_" +(this.n_count-1));
		}

		for(i=0;i<this.n_count;i++){
			objdiv	= getElt( this._div_prefix + "_" + i);
			objdiv.style.width = this.news_width;

			if( i == 0 ){	
				objdiv.style.top = 0;
			} else { 
				prev = getElt(this._div_prefix + "_"+ (i-1));
				objdiv.style.top = 	parseInt(prev.style.top) + prev.clientHeight ; 
			}
			this.scrollDivs[i] = objdiv;
			objdiv.style.visibility = "visible";
		}
		this.makeMove();
}
	
SCROLL.prototype.makeMove = function(){ 
			for(i=0;i<this.n_count;i++){
					divid = i;
					objdiv = this.scrollDivs[divid];

					if(parseInt(objdiv.style.top) <= 0 - objdiv.clientHeight  ){	
						objdiv.style.top =   parseInt(this.lastobjdiv.style.top) + this.lastobjdiv.clientHeight ;	
						this.lastobjdiv = objdiv;
					}
					if(parseInt(objdiv.style.top) < 0){	
						this.tmp_stop_scroll  = true;	
					}
					if(parseInt(objdiv.style.top) == 0){	
						this.tmp_stop_scroll  = false;	
					}
		
					if(this.stop_scroll == false){   objdiv.style.top = parseInt(objdiv.style.top)- 1 ; }
			}
		
				if(this.tmp_stop_scroll == false){
					setTimeout((this._name +".makeMove()"), this.one_pause); 
				} else{	
					setTimeout((this._name+".makeMove()"), this.scroll_speed); 	
				}
}
	   
SCROLL.prototype.stop_S = function (act){
	this.stop_scroll = act;
}

