// Détection du modéle objet du navigateur
function navModele(){ 

    agent  = navigator.userAgent.toLowerCase();
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) && 
                 ((agent.indexOf('spoofer')   ==   -1) && 
                 (agent.indexOf('compatible') ==   -1)));
	this.tom = (document.layers)? true:false;					//Ns4
	this.dom = (document.getElementById)? true:false;			//Ie6, ns6, opera
	this.xom = (document.all)? true:false;						//Ie4, Ie5
	this.yom=false;
	if (this.xom) {												//Ie5
		if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) this.yom = true;
		if (this.dom) this.dom = false;
	}
	this.nav=(this.ns || this.tom || this.dom || this.xom || this.yom || this.op);
    return this 
} 
nav=new navModele()
// Dimensions de la fenetre du navigateur
var winWidth;
var winHeight;
var loop, timer;
// Creation d'un calque
function createLayer(child){ 
    this.elt=nav.dom?document.getElementById(child):nav.xom?document.all[child]:nav.tom?eval('document.'+child):0; 
    this.cadre=nav.dom?document.getElementById(child).style:nav.xom?document.all[child].style:nav.tom?eval('document.'+child):0; 
	this.layerMove=layerMove;
	this.obj = child + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
// Ecrire dans un calque
function writeLayer(txt,lyr) {
	txt += "\n";
        if (nav.tom) {
                lyr.document.write(txt);
                lyr.document.close();
        } else if (nav.xom) {
		lyr.innerHTML = txt;
	} else if (nav.dom) {
		range = document.createRange();
		range.setStartBefore(lyr);
		domfrag = range.createContextualFragment(txt);
		while (lyr.hasChildNodes()) {
			lyr.removeChild(lyr.lastChild);
		}
		lyr.appendChild(domfrag);
	}
}
// Creation d'une fenetre de scroll
function createScroller(child,parent){ 
    this.elt=nav.dom?document.getElementById(child):nav.xom?document.all[child]:nav.tom?eval('document.'+parent+'.document.'+child):0; 
    this.css=nav.dom?document.getElementById(child).style:nav.xom?document.all[child].style:nav.tom?eval('document.'+parent+'.document.'+child):0; 
    this.cadre=nav.dom?document.getElementById(parent).style:nav.xom?document.all[parent].style:nav.tom?eval('document.'+parent):0; 
    this.scrollLength=nav.tom?this.css.document.height:this.elt.offsetHeight 
	this.x;
	this.y; 
	this.loop;
	this.timer; 
	this.stopup;
	this.stopdn; 
    this.scroll=scroll;
    this.scrollMove=layerMove;
	this.down=scrollDn; 
    this.up=scrollUp;
    this.scrolling=scrolling;
    this.scrollingStop=scrollingStop;
    this.scrollTest=scrollTest;
	this.obj = child + "Object" 
    this.scrollFin=scrollFin;
    this.scrollDebut=scrollDebut;
    eval(this.obj + "=this") 
    return this 
	this.initialised=false;
} 
// Deplacement du contenu de la fenetre de scroll
function scroll(x,y){ 
	this.x=x;	this.y=y; 
	this.css.left=this.x; this.css.top=this.y;
}
// Deplacement de la fenetre de scroll
function layerMove(x,y){ 
	this.x=x; this.y=y;
	this.cadre.left=this.x; this.cadre.top=this.y;
}
// Defilement du contenu de la fenetre de scroll vers la fin
function scrollFin(){ 
	if(this.initialised){ 
		scrollingStop();
		this.y=-parseInt(this.scrollLength)+parseInt(this.cadre.height)	;
		this.scroll(0,this.y);
		this.scrollTest();
		}
}
// Defilement du contenu de la fenetre de scroll vers le debut
function scrollDebut(){ 
	if(this.initialised){ 
		scrollingStop();
		this.y=0;
		this.scroll(0,this.y);
		this.scrollTest();
		}
}
// Defilement du contenu de la fenetre de scroll vers le bas
function scrollDn(step){ 
	if(this.y>-parseInt(this.scrollLength)+parseInt(this.cadre.height)){ 
    	this.scroll(0,this.y-step) 
    	if(this.loop) setTimeout(this.obj+".down("+step+")",50) 
	}
	this.scrollTest();
} 
// Defilement du contenu de la fenetre de scroll vers le haut
function scrollUp(step){ 
	if(this.y<0){ 
	    this.scroll(0,this.y-step) 
	    if(this.loop) setTimeout(this.obj+".up("+step+")",50) 
	}
	this.scrollTest();
} 
// Faire defiler le contenu de la fenetre de scroll
function scrolling(dir){ 
	if(this.initialised){ 
		this.loop=true; 
		if(dir>0) this.down(dir) 
		else this.up(dir) 
	} 
} 
// Stopper le defilement du contenu de la fenetre de scroll
function scrollingStop(){ 
    this.loop=false 
    if(this.timer) clearTimeout(this.timer) 
} 

