//
// Affichettes dynamiques
// version 1.2
// 9 septembre 1999
// Copyright © Ircam-Centre Georges-Pompidou
//

// initialisation et capture de la taille de l'écran

charge = false;
refnum = false;

function init(){
  if (document.all){
    largeur = document.body.offsetWidth
    hauteur = document.body.offsetHeight
  }
  else if (document.layers){
    largeur =  window.innerWidth
    hauteur = window.innerHeight
  }
  charge = true;
// désactivation des notes pour IE4 non Windows
  if ((document.all) && (navigator.platform != "Win32")){
  charge = false;
  }
}

// désactivation des notes (par l'objet "event") pour les navigateurs de version < 4

if ((document.all == null) && (document.layers==null)){
  event = null;
}

// affichage et positionnement des notes

function donote(event, note){
  if (charge){
    refnum = note;
    if (document.layers){
      abscisse=event.pageX;
      ordonnee=event.pageY;
      if (abscisse>(largeur/2)){
        l = 305 ;
      } else {
      l = -10;
    }
    if (ordonnee>pageYOffset + (hauteur/2)){
      h = (document[note].clip.height+5);
    } else {
      h = -5;
    }
    var cote_gauche = abscisse - l;
    var sommet = ordonnee - h;
    document[note].left=cote_gauche;
    document[note].top=sommet;
    document[note].visibility="show"
    }
    if (document.all){
      abscisse=event.clientX;
      ordonnee=event.clientY;
      if (document.all[note].offsetWidth> (largeur/2)){
      document.all[note].style.width = ((largeur/2)-15)
    }
    if (abscisse>(largeur/2)){
      l = document.all[note].offsetWidth+5 ;
    } else {
      l = -10;
    }
    if (ordonnee>(hauteur/2)){
      h = (document.all[note].offsetHeight+5);
    } else {
      h = -5;
    }
    var cote_gauche = document.body.scrollLeft + abscisse - l; 
    var sommet = document.body.scrollTop + ordonnee - h;
    document.all[note].style.pixelTop = sommet
    document.all[note].style.pixelLeft = cote_gauche
    document.all[note].style.visibility = "visible"
    }
  }
}

// faire disparaître les notes

function undonote(){
  if (refnum){
    if (document.layers){
      document[refnum].visibility="hide";
    }
    if (document.all){
      document.all[refnum].style.visibility = "hidden";
    }
  }
}
