/* Classe ascenseur  */
var aencours = null;


function Ascenseur(cadre,track) {
 this.cadre = cadre;
 this.element = document.createElement('div');
 document.body.appendChild(this.element);
 
 this.element.style.display = "none";
 this.element.style.position="absolute";
 this.element.style.height = cadre.offsetHeight + "px";
 
 this.element.style.width = "15px";
 this.element.style.top = getTopAbsolute(cadre) + "px";
 this.element.style.padding="0px 0px 0px 0px";
 this.element.style.left = getRightAbsolute(cadre) + "px";
 this.trackTop = 0;
 this.trackLeft = getRightAbsolute(cadre);
 this.trackBottom = this.trackTop + cadre.offsetHeight - 40;
 this.element.innerHTML = "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr></table>"
 this.cols = this.element.getElementsByTagName('td');
 this.cols[0].style.height="20px";
 this.cols[1].style.verticalAlign="top";
 this.cols[1].style.height= (cadre.offsetHeight-40) + "px";
 this.cols[2].style.height="20px";
 this.topArrow = new Image();
 this.cols[0].appendChild(this.topArrow);
 this.topArrow.src = "images/flechehaut.gif";
 this.topArrow.onmouseover = function (e) {
    this.className='btn_opacityon';
    
   }
 this.topArrow.onmouseout = function (e) {
    this.className='';
    this.onmouseup(e);
   }
 this.bottomArrow = new Image();
 this.cols[2].appendChild(this.bottomArrow);
 this.bottomArrow.src = "images/flechebas.gif";
 this.bottomArrow.onmouseover = function (e) {
    this.className='btn_opacityon';
    
   }
 this.bottomArrow.onmouseout = function (e) {
    this.className='';
    this.onmouseup(e);
   } 
 /*this.track = document.createElement('div');
 this.cols[1].appendChild(this.track);
 this.track.className="lift";*/
 
 this.bottomArrow.fLift = this;
 this.bottomArrow.onclick = function (e) {
  var l = getTarget(e).fLift;
  l.cadre.contentWindow.scrollBy(0,15);
 }
 this.scrollTimerU = null;
 this.scrollTimerB = null;
 
 this.scrollBottom = function () {
  this.cadre.contentWindow.scrollBy(0,15);
  //this.placeTrack();
 }
 this.scrollTop = function () {
  this.cadre.contentWindow.scrollBy(0,-15);
  //this.placeTrack();
 }
 
 this.bottomArrow.onmousedown = function (e) {
  var l = getTarget(e).fLift;
  clearInterval(l.scrollTimerU);
  aencours = l;
  l.scrollTimerB = setInterval("aencours.scrollBottom()",100);
 }
 this.bottomArrow.onmouseup = function (e) {
  var l = getTarget(e).fLift;
  clearInterval(l.scrollTimerB);
  
 } 

 
 this.topArrow.fLift = this;
 this.topArrow.onclick = function (e) {
  var l = getTarget(e).fLift;
  l.cadre.contentWindow.scrollBy(0,-15);
      
 }
 
 this.topArrow.onmousedown = function (e) {
  var l = getTarget(e).fLift;
  clearInterval(l.scrollTimerB);
  aencours = l;
  l.scrollTimerU = setInterval("aencours.scrollTop()",100);
 }
 this.topArrow.onmouseup = function (e) {
  var l = getTarget(e).fLift;
  clearInterval(l.scrollTimerU);
  
 } 
 
 /*
 this.placeTrack = function () {
  if (this.cadre.document) {
   var st = this.cadre.document.documentElement.scrollTop;
   var total = this.cadre.document.documentElement.scrollHeight;
  }   else {
   var st = this.cadre.contentDocument.body.scrollTop; 
   var total = this.cadre.contentWindow.scrollMaxY;
  }
  var top = (st/total) * (this.trackBottom-this.track.offsetHeight);
  
  this.track.style.top = top + "px";
 }
 if (!track) this.track.style.display = "none";*/
 
 this.hide = function() {
  this.element.style.display = "none";
 }
 
 this.show = function() {
  aencours = this;
  this.element.style.display = "";
  //this.track.style.top = "0px";
  //this.track.style.left = "0px";
  this.replace();
 }
 this.replace = function() {
  this.element.style.top = getTopAbsolute(this.cadre) + "px";
  this.element.style.left = getRightAbsolute(this.cadre) + "px";
 }
}

window.onresize = function (e) {
 if (aencours)
  aencours.replace();
 deplaceBtnAccueil();
}