
/********************************************************************************/
/*                   PARAMETRES DE CONFIGURATION A RENSEIGNER                   */
/********************************************************************************/

/*------------------------------------------------------------------------------*/
/*                     parametres pour la popup d'impression                    */
/*                             fonction "impression()"                          */

var urlStyles1=hRefSite+"z-outils/styles/styles.css";
var urlStyles2=hRefSite+"z-outils/styles/xcharte.css";
var paramsPopup="toolbar=yes,location=no,scrollbars=yes,directories=,status=yes,menubar=yes,resizable=yes,width=700,height=600,left=0,top=0";
var url_espaceur_bas = hRefSite + "z-outils/images/charte/popup/popup-impression/espaceur-bas.gif";
var url_espaceur_haut = hRefSite + "z-outils/images/charte/popup/popup-impression/espaceur-haut.gif";
var url_img_centre_haut = hRefSite + "z-outils/images/charte/popup/popup-impression/img-centre-haut.gif";
var url_img_droite_haut = hRefSite + "z-outils/images/charte/popup/popup-impression/img-droite-haut.gif";
var url_img_titre = hRefSite + "z-outils/images/charte/popup/popup-impression/img-titre.gif";
var url_logo_cnrs_bas = hRefSite + "z-outils/images/charte/popup/popup-impression/logo-cnrs-bas.gif";
var url_logo_cnrs_haut = hRefSite + "z-outils/images/charte/popup/popup-impression/logo-cnrs-haut.gif";


/*-------------   FIN DES PARAMETRES DE CONFIGURATION A RENSEIGNER   --------------*/


/*-----------------------------------------------------------------------------------------
fonction JS qui ouvre une popup et y ecrit un bandeau d'images puis le contenu de la page 
HTML qui l'appelle situe dans la balise DIV dont l'id est "ZonePrint"
------------------------------------------------------------------------------------------*/
function impression()
{

/*----- ouverture de la popup -----*/
win=window.open("about:blank", "print", paramsPopup);

win.document.open();

win.document.write('<html><head><title>IN2P3</title>');
win.document.write('<link rel="stylesheet" type="text/css" href="' + urlStyles1 + '">');
win.document.write('<link rel="stylesheet" type="text/css" href="' + urlStyles2 + '">');
// ajouter ici si besoin est d'autres feuilles de styles ...

/* style pour l'impression : fond blanc */

win.document.write('</head>');

win.document.write('<body marginheight="0" marginwidth="0" style="background-color:#FFFFFF";>');

win.document.write('<table cellspacing="0" cellpadding="0" width="100%" class="table-avec-bordures" >');
win.document.write('<tr>');
win.document.write('<td>');
/*----- affichage du bandeau d'images -----*/
win.document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%" class="table-sans-bordures">');
win.document.write('<tr>');
win.document.write('<td width="150">');
win.document.write('<img border="0" src="' + url_logo_cnrs_haut + '" width="150" height="50"></td>');
win.document.write('<td width="200">');
win.document.write('<img border="0" src="' + url_img_centre_haut + '" width="200" height="50"></td>');
win.document.write('<td width="100%"><img border="0" src="' + url_espaceur_haut + '" width="100%" height="50"></td>');
win.document.write('<td width="122">');
win.document.write('<map name="FPMap0">');
win.document.write('<area href="javascript:window.close();" shape="rect" coords="6, 5, 117, 25">');
win.document.write('</map>');
win.document.write('<img border="0" src="' + url_img_droite_haut + '" usemap="#FPMap0" width="122" height="50"></td>');
win.document.write('</tr>');
win.document.write('</table>');

win.document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%" class="table-sans-bordures">');
win.document.write('<tr>');
win.document.write('<td width="150">');
win.document.write('<img border="0" src="' + url_logo_cnrs_bas + '" width="150" height="32"></td>');
win.document.write('<td width="100%"><img border="0" src="' + url_espaceur_bas + '" width="100%" height="32"></td>');
win.document.write('<td width="347"><img border="0" src="' + url_img_titre + '" height="32"></td>');
win.document.write('</tr>');
win.document.write('</table>');



win.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-sans-bordures">');
win.document.write('<tr>');
win.document.write('<td class="Xtextcourant" style="background-color:#FFFFFF"><div class="ZonePrint">');

/*-----    affichage de la zone contenue dans le layer "ZonePrint"     -----*/
/*----- (code dependant de la compatibilite du navigateur avec le DOM) -----*/

if (document.getElementById)  /* IE >= 5 / Netscape >= 6 / Mozilla >= 1.6 / Opera >= 7 */

  win.document.write(document.getElementById("ZonePrint").innerHTML);
	
else	/* Netscape 4 ou autre navigateur obsolete */ 
  {
    win.close();
    alert("Cette fonctionnalit? ne marche pas avec cette version de navigateur.");
  }
  
win.document.write('</div></td></tr></table>');
win.document.write('</td></tr></table>');
win.document.write('</body></html>');
win.document.close();
}

/*-----------------------------------------------------------------------------------------
fonction JS qui ouvre une popup avec les parametres qu'on lui donne
------------------------------------------------------------------------------------------*/
function MM_openBrWindow(theURL,winName,features) 
{
  window.open(theURL,winName,features);
}

/*-------------   Fonction writemail pour ?viter les spam   --------------
fonction JS qui ?vite le spam en codant les emails.
4 parametres :
  hostname : le nom du domaine (exemple : "cnrs.fr" si le mail est "contact@cnrs.fr")
  username : le nom du user (exemple : "contact" si le mail est "contact@cnrs.fr")
  linktext : si "" (=pas renseign?, le mail est affich? 'contact@cnrs.fr')
             si renseign? : exemple "ecrivez-nous", 
							alors le lien affichera ce texte et pointera vers le mail sp?cifi?.
  mode : 0 si c'est pour int?grer dans une partie HTML (le script ?crit toute la balise du <a au </a>, 
		 1 si c'est pour l'int?grer dans une map (href="#" onClick="javascript:writemail(..,.,..,1);" )
		 
------------------------------------------------------------------------------------------*/
function writemail(hostname,username,linktext,mode) {
  if (hostname.length > 0) {
	  mail_to="mail" + "to:" + username + "@" + hostname;
	  if (mode==0) {  
		  (linktext.length > 0)?document.write("<a href=" + mail_to + ">" + linktext + "</a>"):document.write("<a href=" +  mail_to + ">" + username + ""+"@" + hostname +"" + "</a>"); 
	  }
	  else { document.location.replace(mail_to); }
  }
}
function OpenInfoPers(nom, prenom, labo) {
        fenetrePers = window.open('http://annuaire.in2p3.fr/ConsultPerson.php?button=print&cn='+nom+'+'+prenom+'&dn=ou=people,+ou='+labo+',+o=in2p3,c=fr','fenetrePers','STATUS=NO,RESIZABLE=YES,MENUBAR=NO,SCROLLBARS=NO,WIDTH=600,HEIGHT=350');
}
function decrypt(debut, chaine, fin) {
   document.write(decryptJ(debut, chaine, fin));
}

function decryptJ(debut, chaine, fin) {
   var known_letters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q",
		"r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I",
		"J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
		"0","1","2","3","4","5","6","7","8","9","@",".","-");
   var count_known_letters = known_letters.length;
   var key = (chaine.length)%count_known_letters;
   var out = "";
   for ( var i=0; i<chaine.length; i++ ) {
      current = chaine.charAt(i);
      if ( isInArray(current, known_letters) ) {
         for ( var j=0; j<count_known_letters; j++ ) {
            if ( known_letters[j] == current ) break;
         }
         currentIndiceLetter = j;
         newIndiceLetter = (currentIndiceLetter-key)%count_known_letters;
         if ( newIndiceLetter < 0 ) {
            newIndiceLetter += count_known_letters;
         }
         out += known_letters[newIndiceLetter];
      } else {
         out += current;
      }
   }
   return debut+out+fin;
}

function isInArray(needle, arrayHaystack){
   for (x=0; x < arrayHaystack.length; x++) if (arrayHaystack[x] == needle) return true;
   return false;
} 

