<!--// JavaScript Document
chiffreWid=0;
chiffreHit=0;
chiffreLft=0;
chiffreTop=0;
styleObj=(IE4)?".style":"";

function setPos(Elt, pos){
	if((NS4)||(isDOM)){
      Elt.top=(NS4)?pos:pos + "px";
   }else if (IE4){
      Elt.pixelTop = pos;
   }
}

function getChiffreObj(i){
   if((NS4)||(IE4)) {
      obj=eval("message"+i+styleObj);
   }else{
      obj=document.getElementById("message"+i).style;
   }
   return obj;
}

function moveChiffreUp(chElt){
   if((NS4)||(isDOM)){
      chElt.top=(NS4)?chElt.top-chincrement:(parseInt(chElt.top)-chincrement) + "px";
   }else if (IE4){
      chElt.pixelTop-=chincrement;
   }
}

function getMsgPrec(id){
	prec = (id == 0)?tab.length - 1:id - 1;
	
	if((NS4)||(IE4)){
     return eval("message"+prec);
  }else{
     return document.getElementById("message" + prec);
  }
}

function chiffreReplace(){
	for (i=0; i<tab.length; i++){
		if((NS4)||(IE4)){
       msg = eval("message"+i);
    }else{
       msg = document.getElementById("message" + i);
    }
		bot = msg.offsetTop + msg.offsetHeight;
		if(bot < 0){
			thePrec = getMsgPrec(i);
			msg.moveTo(leftpadding, thePrec.offsetTop + thePrec.offsetHeight);
		}			
	}
}

function scrollBanner(){
   for(i=0; i< tab.length; i++){
		 	chElt=getChiffreObj(i);
   		moveChiffreUp(chElt);		
	 }
	 
	 chiffreReplace();
	
}

function makeChiffreIE(){  
   var text='<DIV ID="banner" STYLE="position:absolute">';
   for(var i=tab.length-1;i>=0;i--){
      text+='<DIV ID="message'+i+'" STYLE="position:absolute"><\/DIV>';
   }
   text+='<\/DIV>';
   document.body.insertAdjacentHTML("BeforeEnd",text);
   with(banner.style){
      width=chiffreWid;
      height=chiffreHit;
      clip="rect(0 "+chiffreWid+" "+chiffreHit+" 0)";
      backgroundColor=bannercolor;
   }
   banner.moveTo=moveToIE;
   banner.moveTo(chiffreLft,chiffreTop)
   var theElt;
	 for(i=0;i<tab.length;i++){
      theElt=eval("message"+i);
      newsStr = "<p><span class=\"chiffre\">"+tab[i][0]+"<\/span><br \/>"+tab[i][1]+(tab[i][3] == "#"?"<\/p><br\/>":"<br \/><span class=\"chiffreSource\">"+ tab[i][2]+"<\/span><\/p><br\/>");
			theElt.innerHTML=newsStr;
			
			with(eval("message"+i+".style")){
         visibility="visible";
         width=chiffreWid-leftpadding;
         backgroundColor=bannercolor;
      }
      eval("message"+i+".moveTo=moveToIE");
			if(i == 0){
					 elTop = 0; 
				 } else {
					 elTop =  eval("message"+(i -1)).offsetTop + eval("message"+(i -1)).offsetHeight;
				 }
      eval("message"+i+".moveTo(leftpadding,elTop+toppadding)");
   }
}

function makeChiffreDOM(){
   var text='<DIV ID="banner" STYLE="position:absolute">';
   for(var i=tab.length-1;i>=0;i--){
      text+='<DIV ID="message'+i+'" STYLE="position:absolute"><\/DIV>';
   }
   text+='<\/DIV>';
   var r = document.body.ownerDocument.createRange();
   r.setStartBefore(document.body);
   var df = r.createContextualFragment(text);
   document.body.appendChild(df);
  
   bnrEL=document.getElementById('banner');
   with(bnrEL.style){
      width=chiffreWid+"px";
      height=chiffreHit+"px";
      clip="rect(0px "+chiffreWid+"px "+chiffreHit+"px 0px)";
      backgroundColor=bannercolor;
   }
   bnrEL.moveTo=moveToDOM;
   bnrEL.moveTo(chiffreLft,chiffreTop);
	 var theElt;
   for(i=0;i<tab.length;i++){
			theElt=document.getElementById("message"+i);
      newsStr = "<p><span class=\"chiffre\">"+tab[i][0]+"<\/span><br \/>"+tab[i][1]+(tab[i][3] == ""?"<\/p><br\/>":"<br \/><span class=\"chiffreSource\">"+ tab[i][2]+"<\/span><\/p><br\/>");
			theElt.innerHTML=newsStr;			
			
			msgEL=document.getElementById("message"+i);
      msgEL.moveTo=moveToDOM;
			with(msgEL.style){
         visibility="visible";
         width=(chiffreWid-leftpadding)+"px";
				 backgroundColor=bannercolor;
      }
			if(i == 0){
					 elTop = 0; 
				 } else {
					 elTop =  document.getElementById("message"+(i -1)).offsetTop + document.getElementById("message"+(i -1)).offsetHeight;
				 }
      msgEL.moveTo(leftpadding,elTop + toppadding);
   }
}

function makeChiffreNS(){ 
   banner=new Layer(chiffreWid);
   with(banner){
      clip.right=chiffreWid;
      clip.bottom=chiffreHit;
      bgColor=bannercolor;
      moveTo(chiffreLft,chiffreTop);
      visibility="show";
   }
   var theElt;
	 for(var i=0;i<tab.length;i++){
		  theElt=eval("message"+i);
			 newsStr = "<p "+chclassid+">"+tab[chiffreCount][0]+" "+tab[chiffreCount][1]+"<\/p>";
			 with(theElt.document){
            write(newsStr);
            close();}
      eval("message"+i+"="+"new Layer(chiffreWid-leftpadding, banner)");
      if(i == 0){
					 elTop = 0; 
				 } else {
					 elTop =  eval("message"+(i -1)).offsetTop + eval("message"+(i -1)).offsetHeight;
				 }
			with(eval("message"+i)) {
         moveTo(leftpadding,elTp + toppadding);
         bgColor=bannercolor;
      }
   }
}

function startBanner(){
   tab=new Array();
   if(!window.tabCHIFFRE)return;
   if(tabCHIFFRE.length==0)return;
   numheadlines=tabCHIFFRE.length; 
   for(i=0;i<numheadlines;i++){
      tab[i]=new Array(prefix+tabCHIFFRE[i],tabTEXT[i], tabSOURCE[i]);
   }
   chiffreCount=0;
   if (NS4){
      makeChiffreNS();
   }else if(IE4){
      makeChiffreIE();
   }else{
		  makeChiffreDOM();
	 }
	 
	 timeoutCH=setInterval("scrollBanner()",chinterval);
}

function initChiffreBanner() {
   if(NS4) {
      cHT=getPH("ch1");
   }else if(IE4){
      cHT=document.all.ch1;
   }else{
      cHT=document.getElementById('ch1');
   }

   if(cHT){
      cHT.getReal=getReal;
      chiffreLft=cHT.getReal("x")-1;
      	chiffreTop=cHT.getReal("y");

      if(NS4) {
         cHB=getPH("chb");
      }else if(IE4){
         cHB=document.all.chb;
      }else{
         cHB=document.getElementById('chb');
      }

      if(cHB){
         cHB.getReal=getReal;
         var chiffreRit=cHB.getReal("x");
         var chiffreBot=cHB.getReal("y");
         chiffreWid=chiffreRit - chiffreLft;
         chiffreHit=chiffreBot - chiffreTop;
         startBanner();
      } // if cHB
   }    // if cHT
}       // initChiffreBanner
//-->
