/**********Fonctions relatives au défilement d'un texte dans un iframe et un Layer *****************************/
function lib_bwcheck(){ /*detect browser*/
  this.ver=navigator.appVersion
  this.agent=navigator.userAgent
  this.dom=document.getElementById?1:0
  this.opera5=this.agent.indexOf("Opera 5")>-1
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  this.ie=this.ie4||this.ie5||this.ie6;
  this.mac=this.agent.indexOf("Mac")>-1
  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5)
  return this
}
bw=new lib_bwcheck()
function lib_obj(iframe,obj,nestobj){ /*propriétés du calque à faire défiler*/
  if(!bw.bw) return alert("Votre navigateur n'a pas été reconnu\nEssayez de recharger la page\n") ;
  iframe=(bw.ns4) ? "":eval(iframe);
  nest=(!nestobj) ? "":nestobj;
  this.elmt=bw.dom? iframe.document.getElementById(obj): 
  bw.ie4?iframe.document.all[obj]:bw.ns4?nest.document.layers[obj]:0;
  this.css=bw.dom||bw.ie4?this.elmt.style:this.elmt; 
  this.ref=bw.dom||bw.ie4?iframe.document:this.css.document;
  this.wref=bw.ie?this.ref.body.clientWidth:bw.ns4?nest.clip.width:iframe.innerWidth; /*retourne la largeur du conteneur iframe ou layer*/
  this.x=parseInt(this.css.left)||this.css.pixelLeft||this.elmt.offsetLeft||0;
  this.y=parseInt(this.css.top)||this.css.pixelTop||this.elmt.offsetTop||0
  this.w=this.elmt.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0;
  this.h=this.elmt.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0
		this.oldx=Function(oldx=this.x);
		this.oldy=Function(oldy=this.y);
		this.playing=false;
		this.toc=0;this.toc-=this.w; /* retourne la position finale: 0 - largeur du calque défilant */
  this.obj = obj + "Object"; eval(this.obj + "=this")
  return this
}

lib_obj.prototype.moveIt = function(x,y){ /*déplacement ponctuel*/
 this.x=x;this.y=y;
 this.css.left=x;this.css.top=y;
}

lib_obj.prototype.moveBy = function(x,ant,time){ /* déplace, rogne et retour position départ */
    if (!this.playing){this.playing="ok";this.moveIt(this.wref-ant,0)}
    this.css.left=this.x+=x;// this.css.top=this.y+=y;
    if (this.x<(this.toc+ant)){this.playing=false}
    setTimeout(this.obj+".moveBy("+x+","+ant+","+time+")",time)
}

function CreateIframe(top, left, width, height, src){ /* Crée un Layer pour ns4 superposé au iframe AUTO_CENTRE */
top=document['gauche'].y ; left=document['gauche'].x+document['gauche'].width ; 
width=document['droite'].x-document['gauche'].x-document['gauche'].width ; height=document['droite'].height;
this.layer=new Layer(width);
this.layer.top=top;
this.layer.left=left;
this.layer.clip.top=0;
this.layer.clip.left=0;
this.layer.clip.right=width;
this.layer.clip.bottom=height;
this.layer.visibility='show';
this.layer.src=src;
this.layer.onload=function(){obj=new lib_obj('marquee', 'div1',this);eval(PARAMETRES)}
this.layer=this
return this
}

if(bw.ns4){ /* Spécifique pour NS4 en cas de modif de la taille de la fenêtre*/
scrX= innerWidth; scrY= innerHeight;
onresize=function(){if(scrX!= innerWidth || scrY!= innerHeight) history.go(0);}}
//onload=NSinit; /* initialisation NS4 */ 
function libinit(){  /* initialisation IE NS6 OP appelée du iframe onload */ 
if (bw.ns4 ) return
	obj=new lib_obj('marquee', 'div1','DefilText');/*crée l'obj pour  IE NS6 OP*/
	eval(PARAMETRES);
}

/*****Attribuer les coordonnées et taille du Layer ci-dessus : (Top, Left, Width, height, "URL"),100)****************/
/***** ici les coordonées de images "GAUCHE et DROITE du iframe sont utilisées pour définir les côtes du LAYER**********/
function NSinit(){ if (bw.ns4 ) setTimeout('NSframe=new CreateIframe(93,168,565,17,"../../_include/mess.asp")',100)}
PARAMETRES="obj.moveBy( -2, 25, 30 )";//([décrémentation en px],[rogner départ/arrivée en px],[fréquence en millisecondes])
/*************************************************************************************************************/

