function PopupImage(img,titre){
  this.image= new Image();
  this.image.src=(img);
  this.text=titre
  Controlla();
}
function Controlla(){
  if((this.image.width!=0)&&(this.image.height!=0)){
    viewFoto();
  }
  else{
    funzione="Controlla('"+this.image.src+"')";
    intervallo=setTimeout(funzione,20);
  }
}

// windowattributes can be:
// width=n,height=n,resizable=yes or no,scrollbars=yes or no,
// toolbar=yes or no,location=yes or no,directories=yes or no,
// status=yes or no,menubar=yes or no,copyhistory=yes or no

function viewFoto(){
  largh=this.image.width+20;
  altez=this.image.height+40;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(this.image.src,"",stringa);
  //finestra.document.write("<img src='image' >")
  finestra.document.write("<TITLE>"+this.text+"</TITLE>");
  finestra.document.write("<IMG src='"+this.image.src+"' border=0>");
  finestra.document.write("<center><a href='javascript:self.close()' target='_self'>Fermer</a></center>")
}

function preload(imgObj,imgSrc) {
        if (document.images) {
                eval(imgObj+' = new Image()')
                eval(imgObj+'.src = "'+imgSrc+'"')
        }
}
function changeImage(layer,imgName,imgObj) {
        if (document.images) {
                if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
                else document.images[imgName].src = eval(imgObj+".src")
        }
}
