<!--


//
//---------------------  openNewWnd  ----------------------
//

function openNewWnd(nomPhoto,Legende,Orient,ratio) { 
// by cpr Ouverture d'une fenetre auto ajustable pour afficher une photo  
// generation du code de la page par le script
//entré : nom de la photo a afficher
//      : legende  (si vide n'afiche rien)
//      : code orientation   0-> horiz 1-> vert
// ratio de hauteur/largeur ou l/h si verticale de l'image
//la fonction detecte le mode video utilise et ajuste la taille de l image
var withscr;       
var larg;                       // larg et hauteur de la fenetre de visu des images 
var haut;


if (ratio==0) {							// si on ne passse pas le ratio on impose 0,75 3/4 soit 600/800
	ratio =0.75;
}
withscr=screen.availWidth;      // nb de pixel disponoble horiz suivant mode video
if (Orient==0) {                // si Orient=zero format horizontal 
  larg=withscr/1.3;					// calcule une fenetre en fonction de la taille de l ecran
  haut=larg*ratio;					// et regle la hauteur de la fenetre en fonction du ratio de l image
}
else {                          //format vertical de la photo  calcul idem
 haut=withscr/1.6;
 larg=haut*ratio;
}
// cette function ouvre une fenetre pour visualiser une image
nouvFenet= window.open("","","height="+(haut+62)+",width="+(larg+20)+",Location=no,Menubar=no,Scrollbars=no,Resizable=no,Toolbar=no");
nouvFenet.moveTo(50,50);
nouvFenet.document.write("<HTML><HEAD><TITLE>"+nomPhoto+"</TITLE>");
nouvFenet.document.writeln("</HEAD><BODY onblur='self.close()'; onclick='self.close();'><BGCOLOR=#ffffff>");
//nouvFenet.document.writeln("</HEAD><BODY onblur='self.close()'><BGCOLOR=#ffffff>");
// affichage de la photo
nouvFenet.document.writeln("<IMG SRC=\""+nomPhoto+"\" width=\""+(larg)+"\" height=\""+(haut)+"\" title=\"Cliquer pour fermer\">");
if (Legende !="") {  // prevoit dafficher une legende si elle existe
	nouvFenet.document.writeln("<CENTER><FORM><INPUT SIZE= "+eval(Legende.length+3)+" TYPE=\"Text\" VALUE=\""+Legende+"\">")
	nouvFenet.document.writeln("</FORM></CENTER>");
}

nouvFenet.document.writeln("</BODY></HTML>");
nouvFenet.document.close();
}

//
//---------------------  PopupImageXc1  ----------------------
//
function PopupImageXc1(img,legende) { 

// cette fonction cree une fenetre et y installe une image et un script qui se lance sur onload de l image
// le script verifie si l image est chargee
// puis determine ses dimensions, determine le meilleur ratio d affichage
// afin d exploiter le max de resolution de l ecran
// puis place l image au centre
 
w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no,menubar=no'); 
//w.document.writeln("<HTML><HEAD><TITLE>"+legende+" Ctrl+S pour enregistrer </TITLE></HEAD>"); 
w.document.writeln("<HTML><HEAD><TITLE> Ctrl+S pour enregistrer image</TITLE></HEAD>"); 
w.document.writeln("<SCRIPT language=javascript>function checksize() {");
w.document.writeln("var C1;");
w.document.writeln("var C2;");
w.document.writeln("var C;"); 
w.document.writeln("if (document.images[0].complete) { // si image chargee");
w.document.writeln("C1=screen.availWidth/document.images[0].width;// ratio largeur ecran /larg img ");
w.document.writeln("C2=screen.availHeight/document.images[0].height;// ratio hauteur ecran /haut img");
w.document.writeln("C=(C1>C2)?C2:C1;// select le plus petit des deux ratio");
w.document.writeln("C1=document.images[0].width*C-10;// et calcul la largeur de l image");
w.document.writeln("C2=document.images[0].height*C-30;// calcul la hauteurde img");
w.document.writeln("document.images[0].width=C1;//et l'applique a l image");
w.document.writeln("document.images[0].height=C2;");
w.document.writeln("window.resizeTo(C1+10,C2+30);// redimensione la fenetre");
w.document.writeln("window.moveTo((screen.availWidth-C1)/2,(screen.availHeight-C2)/2);//  centre w");
w.document.writeln("window.focus();}");
w.document.writeln(" else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 

 
w.document.writeln("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.writeln("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
w.document.writeln("<TD valign='middle' align='center'>");
w.document.writeln("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt='Mon image' title='"+legende+"'>"); 

w.document.writeln("</TD></TR></TABLE>");
w.document.writeln("</BODY></HTML>"); 
w.document.close(); 
} 

//
//---------------------  PopupImageXc  ----------------------
//
function PopupImageXc(img,legende) { 

//version 2
// on verifie taille de l image .. 
// si plus petite que la resol de l ecran .. on l affiche sans changer sa taille
// sinon on reduit

// cette fonction cree une fenetre et y installe une image et un script qui se lance sur onload de l image
// le script verifie si l image est chargee
// puis determine ses dimensions, determine le meilleur ratio d affichage
// afin d exploiter le max de resolution de l ecran
// puis place l image au centre
 
w=open("",'image','width=400,height=400,status=yes,toolbar=no,scrollbars=no,resizable=no,menubar=no'); 
w.document.writeln("<HTML><HEAD><TITLE>"+legende+" </TITLE></HEAD>"); 
//w.document.writeln("<HTML><HEAD><TITLE> Cliquer en dehors de la photo pour fermer</TITLE></HEAD>"); 
w.document.writeln("<SCRIPT language=javascript>function checksize() {");
w.document.writeln("var C1;");
w.document.writeln("var C2;");
w.document.writeln("var C;"); 
w.document.writeln("if (document.images[0].complete) { // si image chargee");
w.document.writeln("C1=screen.availWidth/document.images[0].width;// ratio largeur ecran /larg img ");
w.document.writeln("C2=screen.availHeight/document.images[0].height;// ratio hauteur ecran /haut img");
w.document.writeln("C=(C1>C2)?C2:C1;// select le plus petit des deux ratio");
w.document.writeln("if (C<1.0) { // image + grande que ecran.. il faut reduire");
w.document.writeln("C1=document.images[0].width*C-10;// et calcul la largeur de l image");
w.document.writeln("C2=document.images[0].height*C-30;// calcul la hauteurde img");
w.document.writeln("document.images[0].width=C1;//et l'applique a l image");
w.document.writeln("document.images[0].height=C2;");
w.document.writeln("} else {// image plus petite que ecran .. on redim fenetre a taille image");
w.document.writeln("C1=document.images[0].width;//");
w.document.writeln("C2=document.images[0].height;//");
w.document.writeln("}// fin du else ");
//w.document.writeln("window.status = 'Cliquer en dehors de la photo pour fermer'");
w.document.writeln("window.resizeTo(C1+10,C2+30);// redimensione la fenetre");
//w.document.writeln("alert ('C1: '+C1+' C2: '+C2+'screen.availWidth: '+screen.availWidth+' screen.availHeight: '+screen.availHeight)");
w.document.writeln("window.moveTo((screen.availWidth-C1)/2,(screen.availHeight-C2)/2);//  centre w");
w.document.writeln("window.focus();}");
w.document.writeln(" else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 

 
//w.document.writeln("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.writeln("<BODY onload='checksize()' onblur='window.close()'  leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.writeln("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
w.document.writeln("<TD valign='middle' align='center'>");
w.document.writeln("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt='Mon image' title='"+legende+"'>"); 
//w.document.writeln("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt='Mon image' title='Cliquer en dehors de la photo pour fermer'>"); 

w.document.writeln("</TD></TR></TABLE>");
w.document.writeln("</BODY></HTML>"); 
w.document.close(); 
} 


//Fin du script 
//--> 