// le pas est fixé dans init()
// total est le nb total de layer (sans layer0 ky est le layer dintro)
// pour ns fixer les fichier testN.html dans rep courant avec N = 1-3 pour total=3
// pour IE fixé les layer.style.height dans <div> au pix pres 
var playing=1;
var pas=3;
var n=0;
var nt=0;
var IE = document.all;
var NS = document.layers;
var total=3;

// -------------------------------------------------------------------------------
function init() {
   if (NS)
   {
      ptr = document.layers[n].document.layers["layer"+nt];
      ptr1= document.layers[n];
   }
   else
   {
      ptr=document.all["layer"].document.all["layer"+nt];
      ptr1=document.all["layer"];
   }
}


// -------------------------------------------------------------------------------
function reinit() {
   if (NS)
   {
      ptr.y = ptr1.clip.height;
      pas=2;
   }
   else
   {
      ptr.style.top = parseInt(ptr1.style.height );
      pas=2;
   }
}

// -------------------------------------------------------------------------------
function page ( mode ) {
   playing=0;
   if (mode == 'back')
      if (NS)
      {
         ptr.y += ptr1.clip.height - 20;
	 if (ptr.y > 0) ptr.y=0;
      }
      else
      {
         ptr.style.top = parseInt(ptr.style.top) + parseInt(ptr1.style.height) -20;
	 if ( parseInt(ptr.style.top) > 0 ) ptr.style.top=0;
      }
   else // up
      if (NS) 
      {
          ptr.y -= ptr1.clip.height - 20;
	  if (ptr.y + ptr.clip.height <  ptr1.clip.height )
             ptr.y = ptr1.clip.height - ptr.clip.height;
      }
      else
      {
         ptr.style.top = parseInt(ptr.style.top) - parseInt(ptr1.style.height) +20;
	  if ( parseInt(ptr.style.top) +  parseInt(ptr.style.height) <   parseInt(ptr1.style.height) )
             ptr.style.top =  parseInt(ptr1.style.height) -  parseInt(ptr.style.height);
      }
}


// ------------------------------------------------------------------------
function truc() {
alert('truc');
   if (NS)
   {
      nt++;
      if (nt > total) nt=1;
      ptr.y = ptr1.clip.height;
      ptr.visibility='hide';
      document.layers[0].document.layers[0].src='/prompteur/html/test' + nt + '.html';
   }
   else
   {
      ptr.style.visibility='hidden';
   
      nt++;
      if (nt > total) nt=1;
  
      ptr=document.all["layer"].document.all["layer"+nt];
      ptr1=document.all["layer"];
      ptr.style.visibility='visible';
      ptr.style.top = parseInt(ptr1.style.height );      
   }
   playing=1;
  
}

// ------------------------------------------------------------------------
function rien() {
}

// ------------------------------------------------------------------------
function prompteur() {

if ( playing)
 {
   if (NS)
   {
//      ptr = document.layers[n].document.layers["layer"+nt];
//      ptr1= document.layers[n];
      ptr.y -= pas;
   }
   else
   {
//      ptr=document.all["layer"].document.all["layer"+nt];
//      ptr1=document.all["layer"];
      ptr.style.top = parseInt(ptr.style.top) - pas;      
   }
   
   
   if (pas > 0 )
   {
      if (NS)
      {
       if (ptr.y + ptr.clip.height < 0 )
       {  ptr.y = ptr1.clip.height; }
      }
      else // IE
      {
         if (  parseInt(ptr.style.top) + parseInt(ptr.style.height) < 0 )
	 {  ptr.style.top = parseInt(ptr1.style.height ); }
      }
   }
   else
   {
     if (NS)
     {
       if (ptr.y >  ptr1.clip.height )
         ptr.y = 0 - ptr.clip.height;
     }
      else // IE (af FAIRE
      {
         if (  parseInt(ptr.style.top) >  parseInt(ptr1.style.height) )
	   ptr.style.top = 0 - parseInt(ptr.style.height );
      }
   }
 }
// window.defaultStatus= "pas : " + pas + " / y l2 = " + document.layers[n].document.layers[0].y + " / clip height 2 = " +  document.layers[n].document.layers[0].clip.height  + " / clip height 1 = " +  document.layers[0].clip.height ;

setTimeout( 'prompteur()', 150);
}

