// script déroulant home

var lstart=60;
var loop='';
var speed=70;
var pr_step=1;

function ConstructObject(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.'; 
	this.el=document.getElementById(obj); 
  	this.css=document.getElementById(obj).style; 
	this.scrollHeight=this.el.offsetHeight;
	this.indice=-1;
	this.writeMsg=writeMsg;
	this.newsScroll=newsScroll; 
	this.moveIt=b_moveIt; this.x; this.y; 
    this.obj = obj + "Object";
    eval(this.obj + "=this");	
	return this;
} 
function b_moveIt(x,y){ 
	this.x=x;this.y=y;
	this.css.left=this.x;
	this.css.top=this.y;
}  

function writeMsg(){ 
	this.indice++;
	if (this.indice >= textStr.length) this.indice=0;
	this.el.innerHTML = textStr[this.indice]; 
}
 
//Makes the object scroll up 
function newsScroll(speed){ 
	if(this.y>1){ 	
		this.moveIt(0,this.y-pr_step);
		setTimeout(this.obj+".newsScroll("+speed+")",speed);
		loop='';
	} else if(loop) { 
		this.moveIt(0,lstart);
		objContent.writeMsg();
		eval(this.obj+".newsScroll("+speed+")" );
	} else {
		loop='true';
		if (this.indice==0) 
			pause=3000;
		else 
			pause=3000;
		setTimeout(this.obj+".newsScroll("+speed+")",speed+pause );
	}
} 

//Makes the object 
function InitialiseAutoScrollArea(){ 
	objContainer=new ConstructObject('divASContainer');
	objContent=new ConstructObject('divASContent','divASContainer');
	objContent.moveIt(0,lstart);
	objContainer.css.visibility='visible';
	objContent.writeMsg();
	objContent.newsScroll(speed);
} 

