/********************************************************************/
/******************** Gestion des fenêtres PopUp ********************/
/********************************************************************/

//----- Fenêtre PopUp -----
var FenPop='';
function FenPopUp(URL,Loc,Scrol,Largeur,Hauteur,Gauche,Sommet,Admin)
{
 if (Admin!='O')	FermePopUp(FenPop);
 if ((Largeur+Gauche)>screen.width) // si la fenêtre sort de l'écran en largeur
 {
  Gauche=0;
  if (Largeur>screen.width) Largeur=screen.width;
 }
 var HtTot=Hauteur+Sommet;
 if ((HtTot)>screen.height)  // si la fenêtre sort de l'écran en hauteur
 {
  Sommet=0;
  if (Hauteur>screen.height) Hauteur=screen.height-75;
 }
 if (Loc==0) Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 FenPop=window.open(URL,'',"toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable=yes,copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
}

//----- Fenêtre PopUp ouverte à droite de l'écran -----
var FenDroite='';
function FenPopUpDroite(URL,Loc,Scrol,Largeur,Hauteur,Gauche,Sommet) // On ne tient pas compte du paramètre "Gauche" (on le garde par symétrie avec les autres fonctions)
{
 FermePopUp(FenDroite);
 if (Largeur<(screen.width-12))
 Gauche=(screen.width-Largeur)-12;
 if ((Largeur+Gauche)>screen.width) // si la fenêtre sort de l'écran en largeur
 {
  Gauche=0;
  if (Largeur>screen.width) Largeur=screen.width;
 }
 if ((Hauteur+Sommet)>screen.height)  // si la fenêtre sort de l'écran en hauteur
 {
  Sommet=0;
  if (Hauteur>screen.height) Hauteur=screen.height-75;
 }
 if (Loc==0) Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 FenDroite=window.open(URL,'',"toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable=yes,copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
}

//----- Fenêtre PopUp pour image -----
var FenImage='';
function Fen_Image(TitreImage,URLImage,Loc,Scrol,Redim,Largeur,Hauteur,Gauche,Sommet) 
{
 FermePopUp(FenImage);
 Adr='no';
 if (Loc==0)   Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 if (Redim==0) Siz='no'; else Siz='yes';
 FenImage=window.open ("","","toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable="+Siz+",copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
 FenImage.document.open ();
 FenImage.document.writeln('<html>');
 FenImage.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
 FenImage.document.writeln('<title>'+TitreImage+'</title>');
 FenImage.document.writeln('<body bgcolor="#FFFFFF" style="margin:0 0 0 0;">');
 FenImage.document.writeln('<table bgcolor="#FFFFFF" border="0" height="100%" width="100%" cellspacing="0" cellpadding="0">');
 FenImage.document.writeln('<tr><td align=Center valign=middle>\n<img src="'+URLImage+'" border="0" height="'+Hauteur+'" width="'+Largeur+'" align=middle alt="'+TitreImage+'">\n</td></tr>');
 FenImage.document.writeln('</table>');
 FenImage.document.writeln('</body>');
 FenImage.document.write  ('</html>');
 FenImage.document.close ();
}

//----- Fenêtre PopUp pour image -----
var FenImage='';
function Fenetre_Image(TitreImage,URLImage,Loc,Scrol,Redim,Largeur,Hauteur,Gauche,Sommet) 
{
 Adr='no';
 if (Loc==0)   Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 if (Redim==0) Siz='no'; else Siz='yes';
 FenImage=window.open ("","","toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable="+Siz+",copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
 FenImage.document.open ();
 FenImage.document.writeln('<html>');
 FenImage.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
 FenImage.document.writeln('<title>'+TitreImage+'</title>');
 FenImage.document.writeln('<body bgcolor="#FFFFFF" style="margin:0 0 0 0;">');
 FenImage.document.writeln('<table bgcolor="#FFFFFF" border="0" height="100%" width="100%" cellspacing="0" cellpadding="0">');
 FenImage.document.writeln('<tr><td align=Center valign=middle>\n<img src="'+URLImage+'" border="0" height="'+Hauteur+'" width="'+Largeur+'" align=middle alt="'+TitreImage+'">\n</td></tr>');
 FenImage.document.writeln('</table>');
 FenImage.document.writeln('</body>');
 FenImage.document.write  ('</html>');
 FenImage.document.close ();
}

//----- Fenêtre PopUp double : une page + une référence -----
var PopUp2='';
function PopUpDble(Titre,URL,Ref,Loc,Scrol,Redim,Largeur,Hauteur,Gauche,Sommet)  
{
 FermePopUp(PopUp2); 
 var HTFen=Hauteur-38;
 if (Loc==0)   Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 if (Redim==0) Siz='no'; else Siz='yes';
 PopUp2=window.open ("","","toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable="+Siz+",copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
 PopUp2.document.open ();
 PopUp2.document.writeln('<html>');
 PopUp2.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />');
 PopUp2.document.writeln('<title>'+Titre+'</title>');
 PopUp2.document.writeln('<body bgcolor="#C9DAE3" style="font-family:Arial, Helvetica, Verdana, sans serif;font-size:11px;margin:0 0 0 0;">');
 PopUp2.document.writeln('<table bgcolor="#C9DAE3" border="0" height="100%" width="100%" cellspacing="0" cellpadding="0">');
 PopUp2.document.writeln(' <tr>');
 PopUp2.document.writeln(' </tr>');
 PopUp2.document.writeln('  <td align="center" height="'+HTFen+'" valign="middle">');
 PopUp2.document.writeln('   <iframe src="'+URL+'" style="background:#C9DAE3;height:'+HTFen+'px;" allowtransparency="true" frameborder="0" height="100%" hspace="0" marginheight="0" marginwidth="0" scrolling="auto" vspace="0" width="98%"></iframe> ');
 PopUp2.document.writeln('  </td>');
 PopUp2.document.writeln(' <tr>');
 PopUp2.document.writeln(' <tr>');
 PopUp2.document.writeln('  <td align="center" height="30" valign="middle" style="background:#C9DAE3;">');
 PopUp2.document.writeln('   <div style="color:#000055;font-size:11px;text-align:center">'+Ref+'</div>');
 PopUp2.document.writeln('   <form style="margin:0;"><input style="font-size:10px;" type="button" value="Fermer" onClick="window.close();"></form>');
 PopUp2.document.writeln('  </td>');
 PopUp2.document.writeln(' </tr>');
 PopUp2.document.writeln('</table>');
 PopUp2.document.writeln('</body>');
 PopUp2.document.write  ('</html>');
 PopUp2.document.close ();
}

//----- Fenêtre PopUp pour texte -----
var FenTexte='';
function Fen_Texte(Titre,Texte,Loc,Scrol,Redim,Largeur,Hauteur,Gauche,Sommet) 
{
 FermePopUp(FenTexte);
 if (Loc==0) Adr='no'; else Adr='yes';
 if (Scrol==0) Asc='no'; else Asc='yes';
 if (Redim==0) Siz='no'; else Siz='yes';
 FenImage=window.open ("","","toolbar=no,location="+Adr+",directories=no,status=no,menubar=no,scrollbars="+Asc+",resizable="+Siz+",copyhistory=no,width="+Largeur+",height="+Hauteur+",left="+Gauche+",top="+Sommet);
 FenImage.document.open ();
 FenImage.document.writeln('<html>');
 FenImage.document.writeln('<head>');
 FenImage.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
 FenImage.document.writeln('<title>'+Titre+'</title>');
 FenImage.document.writeln('</head>');
 FenImage.document.writeln('<body bgcolor="#E2FFFD" leftmargin="0" margiwidthn="0" topmargin="0" marginheight="0">');
 FenImage.document.writeln('<table bgcolor="#E2FFFD" border="0" height="100%" width="100%" cellspacing="0" cellpadding="8">');
 FenImage.document.writeln('<tr><td align="center" valign="middle" style="color:darkblue;font-family:Arial,Helvetica;font-size:11px;">\n'+Texte+'\n</td></tr>');
 FenImage.document.writeln('</table>');
 FenImage.document.writeln('</body>');
 FenImage.document.write  ('</html>');
 FenImage.document.close ();
}

//-- Fenêtre d´un lien externe refusant l´encapsulage --
var FenLien='';
function Fen_Lien (URL_Lien)
{
 FermePopUp(FenLien);
 var LargF=screen.width-100;
 var HautF=screen.height-100;
 FenLien=window.open (URL_Lien,"","toolbar=yes,location=yes,directories=yes,menuBar=yes,scrollbars=yes,resizable=yes,width="+LargF+",height="+HautF+",left=345,top=0");
}

//-- Fenêtre de lexique --
var FenLexique='';
function Lexique(MotCle){
 FermePopUp(FenLexique);
 var FichierLexique;
 FichierLexique='Lexique.php?MotCle='+MotCle;
 FenLexique=window.open (FichierLexique,"",",status=no,toolbar=no,location=no,directories=no,menuBar=no,scrollbars=yes,resizable=yes,width=380,height=350,left=320,top=250");
}// Fin Lexique

var FenSondage='';
function Fenetre_Sondage(){
 FermePopUp(FenSondage);
 var FichierSondage;
 if (document.location.href.indexOf('Codes_Postaux.php')!=-1)
 FichierSondage='../Sondage.php?Titre_page='+document.title;
 else
 FichierSondage='Sondage.php?Titre_page='+document.title;
 FenSondage=window.open (FichierSondage,"",",status=no,toolbar=no,location=no,directories=no,menuBar=no,scrollbars=yes,resizable=yes,width=480,height=570,left=370,top=5");
}// Fin Fenetre_Sondage

var FenAnomalie='';
function Fenetre_Anomalie(Txt){
 FermePopUp(FenAnomalie);
 var FichierAnomalie;
 if (document.location.href.indexOf('Codes_Postaux.php')!=-1)
 FichierAnomalie='../Anomalie.php?Titre_page='+document.title+'&Texte='+Txt;
 else
 FichierAnomalie='Anomalie.php?Titre_page='+document.title+'&Texte='+Txt;
 FenAnomalie=window.open (FichierAnomalie,"",",status=no,toolbar=no,location=no,directories=no,menuBar=no,scrollbars=yes,resizable=yes,width=650,height=485,left=250,top=20");
}// Fin Fenetre_Anomalie

var AjoutLien='';
function Ajouter_Lien(){
 FermePopUp(AjoutLien);
 var FichierLien='Demande_lien_timbre.php?Titre_page='+document.title;
 AjoutLien=window.open(FichierLien,"",",status=no,toolbar=no,location=no,directories=no,menuBar=no,scrollbars=yes,resizable=yes,width=600,height=450,left=300,top=10");
}// Fin Ajouter_Lien

var AjoutAdresse='';
function Ajouter_Adresse(){
 FermePopUp(AjoutAdresse);
 var FichierAdresse='Proposer_Adresse.php?Titre_page='+document.title;
 var AjoutAdresse=window.open(FichierAdresse,"",",status=no,toolbar=no,location=yes,directories=no,menuBar=no,scrollbars=yes,resizable=yes,width=580,height=560,left=350,top=10");
}// Fin Ajouter_Adresse

//----- Fermeture de PopUp avec variable "Fenetre" -----
function FermePopUp(Fenetre) 
{
 if (Fenetre) 
 Fenetre.close();
 Fenetre=null;
}


