var _onload = "setTimeout('scrollInit()', strtdly);";
var origWidth = 0; 
var origHeight = 0;
var bw = new checkBrowser();
var speed;
var pause;
var strtdly = 1000;
var _maxinf = 0;
var _curinf = 0;
var _move = false;
var dloop, uloop, timer;
var nb = 1;
var nbLoop = 1; // TYU : nombre de passage scroll CCD
var loaded = false;
var infos = new Array();
var _build = "<div id=Cont align=left>";

function checkBrowser(){
	useragent=navigator.userAgent.toLowerCase();
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie6=(this.ver.indexOf("MSIE 6")>-1)?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie5=(this.ie6)?1:this.ie5;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	this.opr=useragent.indexOf('opera')!=-1?1:0;

	usragt=navigator.userAgent.toLowerCase();
	this.mac = ( usragt.indexOf('mac')!=-1 ) ? 1 : 0;
	this.opera = ( usragt.indexOf('opera')!=-1 ) ? 1 : 0;

	return this
}

function _do_resize_0(){
	onresize = function() { window.location.reload(); }
}

function _do_resize_1(){
	onresize = function() { if(innerWidth != origWidth || innerHeight != origHeight) location.reload(); }
}

function _locate_0(_objn){
	var _lobj = document.getElementById(_objn);
	var _lx = _lobj.offsetLeft, _ly = _lobj.offsetTop;
	while(_lobj.offsetParent){
		_lx += _lobj.offsetParent.offsetLeft;
		_ly += _lobj.offsetParent.offsetTop;
		_lobj = _lobj.offsetParent;
	}
	return new Array(_lx, _ly);
}

function _locate_1(_objn){
	var _lobj = document.all[_objn];
	var _lx = _lobj.offsetLeft, _ly = _lobj.offsetTop;
	if(_lobj.offsetParent.offsetLeft>0){
		while(_lobj.offsetParent){
			_lx += _lobj.offsetParent.offsetLeft;
			_ly += _lobj.offsetParent.offsetTop;
			_lobj = _lobj.offsetParent;
		}
	} else {
		while(_lobj.parentElement) {
			_lx += _lobj.parentElement.offsetLeft;
			_ly += _lobj.parentElement.offsetTop;
			_lobj = _lobj.parentElement;
		}
	}
	return new Array(_lx, _ly);
}

function _locate_3(_objn){
	_p = document.layers[_objn];
	return new Array(_p.pageX, _p.pageY);
}

//Object constructor
function makeObj(obj,nest){
    nest = (!nest) ? '':'document.' + nest + '.';

	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt;
    this.obj = obj + "Object";
    eval(this.obj + "=this");
    return this;
}

function moveIt(x,y){
	this.x=x;this.y=y;
	this.css.left=this.x;
	this.css.top=this.y;
}

//Makes the object go up
function goDown(move){
	if(this.y > 0){ 
		this.moveIt(0, this.y-move); timer = setTimeout(this.obj + ".down(" + move + ")", speed);
	} else {
		if(!_move){
			if(nb < (_maxinf*nbLoop)){ 
				setTimeout(this.obj+".down("+move+")",pause*1000); nb++;
			}
			_move = true;
		} else {
			if(this.y>-this.scrollHeight){ 
				this.moveIt(0,this.y-move); 
				timer = setTimeout(this.obj+".down("+move+")",speed);
			} else { 
				_multiscroll(); 
				_move = false;
			}
		}
	}
}


//Makes the object go down
function goUp(move){
	if(this.y < 0){
		this.moveIt(0,this.y-move)
		if(uloop) {
			timer = setTimeout(this.obj+".up("+move+")",speed);
		} else {
			if(nb < (_maxinf*nbLoop)){ 
				setTimeout("_test()",pause*1000);; nb++;
			}
		}
	}
}

function _scroll(i) {
	cobj = infos[i];
	if(loaded){
		if(speed > 0) {
			cobj.down(speed);
		} else {
			cobj.up(speed);
		}
	}
}

function scrollInit() {
	if(_curinf>0){
		infos[0]=new makeObj('Cont');
		locate = bw.dom?_locate_0("l"):bw.ie4?_locate_1("l"):bw.ns4?_locate_3("l"):new array(-100,-100);
		infos[0].moveIt(locate[0]+5,locate[1]+2);
		for(i=1;i<=_maxinf;i++) {
			infos[i] = new makeObj('Text'+i,'Cont');
			infos[i].moveIt(0,28);
		}
		infos[0].css.visibility='visible';
		loaded=true;
		_multiscroll();
 	} else {
  		setTimeout("scrollInit", 10);
 	}
}

function _multiscroll(){
	infos[_curinf].css.visibility = 'hidden';
	infos[_curinf].moveIt(0,28);
	_curinf = (_curinf<_maxinf)?(_curinf+1):1;
	infos[_curinf].css.visibility = 'visible';
	_scroll(_curinf);
}

function _add(_inf, _link){
 	_maxinf++;
 	if ( _link != '' && _link != '#' ) _build += "<div id=Text"+ _maxinf+" align=left><font class=News><a href=\""+_link+"\" class=News>"+_inf+"</a></font></div>";
 	else _build += '<div id=Text'+ _maxinf +' align=left><font style="font-size:12px;color:#FFFFFF;font-family:verdana,arial;font-weight:bold;">'+_inf+'</font></div>';
}

function setNbLoop(_nbLoop) {
	nbLoop = _nbLoop;
}

function _writeinfos(){
	_build+="</div>";
	document.write(_build);
	_curinf = _maxinf;
}

