﻿/*-----------------   PARAMETRES DE CONFIGURATION A RENSEIGNER   ------------------*/
// banalisation de cote : Dans le cas d'une apostrophe '.....mettre un antislash devant (\')..

// images du bandeau de la popup d'impression 
var imgGauche=hRefSite+"z-outils/images/charte/popup/imggauche.gif";
var espaceur=hRefSite+"z-outils/images/charte/popup/imgcentre.gif";
var imgDroite=hRefSite+"z-outils/images/charte/popup/imgdroite.gif";
var urlStyles=hRefSite+"styles/";

/*-------------   FIN DES PARAMETRES DE CONFIGURATION A RENSEIGNER   --------------*/

/*-------------   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 ddWriteMail(ddName)
{
    writemail('ipno.in2p3.fr',ddName,'',1)
}

/*-----------------------------------------------------------------------------------------
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 -----*/
stats="toolbar=no,location=no,scrollbars=yes,directories=no,status=no,menubar=yes,resizable=yes,width=650,height=600,left=0,top=0";
win=window.open("about:blank", "print", stats);

win.document.open();

win.document.write('<html><head><title>Institut de Physique Nucléaire d\'Orsay - Service D&eacute;tecteurs</title>');
win.document.write('<link rel="stylesheet" type="text/css" href="' + urlStyles + 'xcharte.css">');
win.document.write('<link rel="stylesheet" type="text/css" href="' + urlStyles + 'styles.css">');
win.document.write('</head>');

win.document.write('<body marginheight="0" marginwidth="0">');

/*----- affichage du bandeau d'images -----*/
win.document.write('<table border="0" cellspacing="0" cellpadding="0" width="600">');
win.document.write('<tr>');
win.document.write('<td width="145" height="66">');
win.document.write('<img src="' + imgGauche + '" width="145" height="66" border="0"></td>');
win.document.write('<td width="100%" height="66">');
win.document.write('<img src="' + espaceur + '" width="100%" height="66" border="0"></td>');
win.document.write('<td width="450" height="66">');
win.document.write('<img src="' + imgDroite + '" width="450" height="66" border="0" usemap="#map"></td>');
win.document.write('</tr>');
win.document.write('<tr>');
/* affichage du contenu a imprimer dans une cellule de tableau */
win.document.write('<td colspan="3" >');
win.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="10">');
win.document.write('<tr>');
win.document.write('<td>');

/*-----    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  /* navigateur incompatible avec la methode "getElementById : code specifique */

  if (document.all && !window.print)   /* IE 4 */
    win.document.write(document.all["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('</td></tr></table>');
win.document.write('</td></tr></table>');
/* mapping pour la partie "Fermer la fenetre" de imgDroite */
win.document.write('<map name="map">');
win.document.write('<area shape="rect" coords="330,5,445,20" HREF="javascript:window.close()">');
win.document.write('</map>');
win.document.write('<div id="divnavhaut-nom-labo">'); 
win.document.write('  <table width="100%" border="0" cellspacing="0" cellpadding="0">');
win.document.write('    <tr>'); 
win.document.write('      <td class="Xnavhaut">'); 
win.document.write('        <p><strong><font color="#ff8c00">Institut de Physique Nucl&eacute;aire d\'Orsay<br>Service D&eacute;tecteurs</font></strong>'); 
win.document.write('          <br>');
win.document.write('          <strong><font color="#1e90ff"></font></strong></p>');
win.document.write('      </td>');
win.document.write('    </tr>');
win.document.write('  </table>');
win.document.write('</div>');

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);
}
//_________________________________________________________________________________________
//__ Ouverture d'un fichier XML, et compatibilité avec les différents browsers_____________
//_________________________________________________________________________________________
function loadXMLDoc(dname)
{
    var xmlDoc;
    // IE: Microsoft DOM
    if (navigator.appName.indexOf("Microsoft") >= 0)
    {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async=false;
        xmlDoc.load(dname);
        return xmlDoc;
    }
    // Others: check the use of the "standard" procedure
	xmlDoc=new window.XMLHttpRequest();
	if(xmlDoc == null)
	{
		alert("Impossible d'ouvrir la base de données / activer les fonctionnalités XML");
		return null;
	}
	xmlDoc.open("GET",dname,false);
	xmlDoc.send("");
	return xmlDoc.responseXML;
} 

//_________________________________________________________________________________________
//_____ Variables associées à des fichiers xml ____________________________________________
//_____ définies de manière globale, car partagées par de nombreuses feuilles _____________
//_____ Les fichiers doivent être chargés avex loadXMLDoc à l'initialisation. _____________
//_________________________________________________________________________________________
// Liste des personnels
var xmlTeamName = hRefSite + "z-outils/team.xml";
var xmlTeam;
var members;
function loadXMLTeam()
{
	xmlTeam = loadXMLDoc(xmlTeamName);
	members = xmlTeam.getElementsByTagName("person");
}

//_________________________________________________________________________________________
// Path for the list marker
var pathList = BaseMenuHref + "z-outils/images/boite-outils/puce.gif";
var imgList = "<img src=\"" + pathList+ "\">";
var lang = "fr";

