/** Gestion affichage/masquage pop-up authentification */
jQuery(document).ready(function() {
  // masque la pop-up uniquement en mode déconnecté => si le lien a.titre existe
  /*if ( $("div#espace_reserve div a.titre").length > 0 ) {
    $("div#pop-up").hide();
    $("div#espace_reserve div a.titre").attr("title", "Afficher la fenêtre d'authentification");
  }
  var speed = "slow"; // vitesse d'animation (peut être un nombre => ms)
  $("div#espace_reserve div a.titre").click(function() {
    if ( $("div#pop-up").is(":visible") ) {
      $("div#pop-up").slideUp(speed);
      $("div#espace_reserve div a.titre").css("background-image", 'url("/media/site/gen/puce_bas_blanc.png")');
      $("div#espace_reserve div a.titre").attr("title", "Afficher la fenêtre d'authentification");
    } else {
      $("div#pop-up").slideDown(speed);
      $("div#espace_reserve div a.titre").css("background-image", 'url("/media/site/gen/puce_haut_blanc.png")');
      $("div#espace_reserve div a.titre").attr("title", "Masquer la fenêtre d'authentification");
    }
  });*/
  
  // remplacement des boutons Alkanet
  jQuery("a.btpage, a.btform, a.form").each(function(){
    jQuery(this).hide();
    var newBt = '<button title="'+jQuery(this).attr('title')+'" class="bouton_simple" onclick="'+jQuery(this).attr('onClick')+'" type="button">' +
                  '<span class="bg_bouton_simple">'+jQuery(this).html()+'</span>' +
                '</button>';
    jQuery(this).after(newBt);
  });
  
});

<!--
// JavaScript Document

<!--[if lt IE 7]>
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}


// JavaScript Document
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//si necessaire
function P7_autoLayers() { //v1.2 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}

var AlkNbClickValidNewsletter=0;

function NewsLetterValide(strToken, strFormId)
{ 
  var f = document.getElementById(strFormId);
  if( AlkNbClickValidNewsletter == 0 ) {
    var bRes = AlkVerifCtrl(f);
    if( bRes == true ) {
      var strParam = strToken+"&"+convertFormValuesToUrlParam(f);
      var oAjax = new AlkAjax('nameNlValide', 'fnLoadNewsletterValide', ALK_FORM_METHOD_POST, '/scripts/alkanet/alkanet_site_sql.php?token='+strParam, strFormId);
    }
  }
}

function fnLoadNewsletterValide(strHtmlContent)
{
  // retourne le code html de la liste des blocs de la page
    var oDiv = document.getElementById("nlreturn");
  if ( !oDiv ) return;
  var oStyle = ( oDiv.style ? oDiv.style : oDiv );
  oStyle.display = 'block';
  //oDiv.innerHTML = strHtmlContent;
  visible('nlreturn');
}


<!-- fonctions grossir texte -->
function getElementsByClass(searchClass, node, tag) {
  var classElements = new Array();
  if ( node == null )
  node = document;
  if ( tag == null )
  tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
	  classElements[j] = els[i];
	  j++;
	}
  }
  return classElements;
}

var tailleFont = 100;
var maxZoom = 150;
var minZoom = 50;

function tailleFonte(classe, taille) {
  // On définit la zone du contenu de l'article
  var articleContent = document.getElementById('contenus_textes_page');
  //var colonne_gauche = document.getElementById('colonne_gauche');
  //var colonne_droite = document.getElementById('colonne_droite');
  
  //cibles = getElementsByClass('mod');
  //cibles = document.getElementsByTagName('p');
  
  if ((tailleFont>minZoom && tailleFont<maxZoom)
    || tailleFont==minZoom && taille > 0
    || tailleFont==maxZoom && taille < 0
  ){
	  tailleFont = tailleFont+(taille*10);
  }
  
  //for (i=0; i < cibles.length; i++) {
  //  cibles[i].style.fontSize = tailleFont+"%";
  //}
  
  articleContent.style.fontSize = tailleFont+"%";
//  if ( colonne_gauche ) {
//    colonne_gauche.style.fontSize = tailleFont+"%";
//  }
//  if ( colonne_droite ) {
//    colonne_droite.style.fontSize = tailleFont+"%";
//  }
}

function GetExtranetIdent()
{
  //var oAjax = new AlkAjax('nameNlValide', 'fnLoadExtranetIdent', ALK_FORM_METHOD_GET, '/libconf/lib/lib_exectmpl.php?tmpl=alkexecextranetident&mode=1', null);
  var oDiv = document.getElementById("extranet");
  if ( !oDiv ) return;
  var oStyle = ( oDiv.style ? oDiv.style : oDiv );
  oStyle.display = 'block';
}

function fnLoadExtranetIdent(strHtml)
{
  // retourne le code html de la liste des blocs de la page
  var oDiv = document.getElementById("extranet");
  if ( !oDiv ) return;
  var oStyle = ( oDiv.style ? oDiv.style : oDiv );
  oStyle.display = 'block';
  oDiv.innerHTML = strHtml;
}

var nbClickValid = 0; 
function SubmitExtranetIdent()
{
  /*var f = document.formLogin;
  f.strPwd.value = hex_md5(f.strPwd2.value);
  f.strPwd2.value = "";
  var oAjax = new AlkAjax('nameNlValide', 'fnSubmitExtranetIdent', ALK_FORM_METHOD_POST, '/libconf/lib/lib_exectmpl.php?tmpl=alkexecextranetident&mode=2', 'formLogin');*/
	
  if( nbClickValid == 0 ) {
	nbClickValid++;
	var f = document.formLogin;
	f.strPwd.value = hex_md5(f.strPwd2.value);
	f.strPwd2.value = "";
	f.action = "/scripts/alkanet/alkanet_verif.php";
  } 
}

function fnSubmitExtranetIdent(strHtml)
{
  // retourne le code html de la liste des blocs de la page
  var oDiv = document.getElementById("extranet");
  if ( !oDiv ) return;
  var oStyle = ( oDiv.style ? oDiv.style : oDiv );
  oStyle.display = 'block';
  oDiv.innerHTML = strHtml;
}

function RechercherDroite(mot){
	var f = document.mnogoformfooter;
	f.search.value = mot;
	//f.action = "/accueil_lamballe/recherche";
	f.submit();
}

var form_nbClickValidNewsletter = 0;
function form_ValidNewsletter(idForm) {
  var f = document.getElementById(idForm);
  if( !f ) return false;
  if( form_nbClickValidNewsletter == 0 ) {
    var bRes = AlkVerifCtrl(f);
    if( bRes ) {
      bRes = true;//window.confirm("Confirmez vous la validation du formulaire ?");
      if( bRes ) {
        form_nbClickValidNewsletter++;
      }
    }
    return bRes;
  } else {
    return false;
  }
}

function form_ValidNewsletterDesinsc(idForm) {
  var f = document.getElementById(idForm);
  if( !f ) return false;
  var bRes = AlkVerifCtrl(f);
  if( bRes ) {
    bRes = true;//window.confirm("Confirmez vous la validation du formulaire ?");
    if( bRes ) {
      // on vérifie qu'on a au moins coché une option
      var oLettre = f.elements["classif_id[]"];
      var iCptChecked = getNbCtrlChecked(oLettre);
      var oAllLettre = f.elements["suppr"];
      
      if (iCptChecked==0 && oAllLettre.checked==false){
      	alert("Vous devez faire un choix");
      	bRes = false;
      }
    }
  }
  return bRes;
}

function disableOther(idForm, oCheck){
  var f = document.getElementById(idForm);
  if( !f ) return false;
  var oLettre = f.elements["classif_id[]"];
	if(oLettre.length>0){
    for (var i=0; i < oLettre.length;i++ ){
	    if (oCheck.checked==true){
	      oLettre[i].disabled= true;
	    }else {
        oLettre[i].disabled= false;
      }
    }
   }else {
   	  if (oCheck.checked==true){
   	  	oLettre.disabled = true;
   	  }else {
   	  	oLettre.disabled = false;
   	  }
   }
}


function getNbCtrlChecked(oCtrlCheck){
  var cpt = 0;
  if(oCtrlCheck.length>0){
	  for (var i=0; i < oCtrlCheck.length;i++ ){
		  if(oCtrlCheck[i].checked)
			 cpt++;
	  }
   }else {
	   if (oCtrlCheck.checked)
		   cpt++;
   }
  return cpt;
}

function switchOnglet(id_onglet, id_contenu) {
  var d = document.getElementById('onglet_portail');
  if (d) {
  if (id_onglet=='onglet_travail_colaboratif') {
    d.className='travail_colaboratif';
  } else {
    d.className='';
  }
  }
  
  d = document.getElementById('onglet_geoservices');
  if (d) {
  if (id_onglet=='onglet_travail_colaboratif') {
    d.className='travail_colaboratif'; 
  } else {
    d.className='';
  }
  }
  
  d = document.getElementById('onglet_travail_colaboratif');
  if (d) {
  if (id_onglet=='onglet_geoservices') {
    d.className='';
  } else {
    d.className='';
  }
  }
  
  d = document.getElementById(id_onglet);
  if (d) { d.className='on'; }
    
  
  d = document.getElementById('onglet_portail_contenu');
  if (d) { d.style.display='none'; }
  
  d = document.getElementById('onglet_geoservices_contenu');
  if (d) { d.style.display='none'; }
  
  d = document.getElementById('onglet_travail_colaboratif_contenu');
  if (d) { d.style.display='none'; }
  
  d = document.getElementById(id_contenu);
  if (d) { d.style.display='block'; }
}

/** partie authentification */
function showIdent(strUrlRedirect)
{
  var oDivGeo =  document.getElementById("onglet_geoservices_contenu");
  var oDiv  = document.getElementById("onglet_travail_colaboratif_contenu");
  var oMaskLink = document.getElementById("mask_onglet_travail_colaboratif_contenu");
  if( oDiv.style ) {
    oDiv.style.display = "block";
    oDivGeo.style.display = "none";
  } else {
    oDiv.display = "block";
    oDivGeo.display = "none";
  }
   
  if( oMaskLink.style ) {
    oMaskLink.style.display = "";
  } else {
    oMaskLink.display = "";
  }
  var f = document.formLogin;
  f.urlRedirect.value = strUrlRedirect;
}
function hideIdent(strUrlRedirect)
{
  var oDivGeo =  document.getElementById("onglet_geoservices_contenu");
  var oDiv = document.getElementById("onglet_travail_colaboratif_contenu");
  var oMaskLink = document.getElementById("mask_onglet_travail_colaboratif_contenu");
  if( oDiv.style ) {
    oDiv.style.display = "none";
    oDivGeo.style.display = "block";
  } else {
    oDiv.display = "none";
    oDivGeo.display = "block";
  }
  if( oMaskLink.style ) {
    oMaskLink.style.display = "none";
  } else {
    oMaskLink.display = "none";
  }
  var f = document.formLogin;
  f.urlRedirect.value = strUrlRedirect;
}


nbClickValid = 0;
function validIdent(oForm, strUrl)
{
  if( nbClickValid == 0 ) {
    nbClickValid++;
    /*oForm.strPwd.value = hex_md5(oForm.strPwd2.value);*/
    oForm.strPwd.value = sha1Hash(oForm.strPwd2.value);
    oForm.strPwd2.value = "";
    var oAjax = new AlkAjax("", "fnValidIdent", "POST", ALK_ALKANET_VERIF, oForm.name);
  }
  return false;
}
function fnValidIdent(strContent)
{
  var f = document.formLogin;
  var oDiv = document.getElementById("identTxt");
  var n = new Number(strContent);
  if( n.toString()=="NaN" ) {
    var oHiddenColl = document.getElementById("coll");
    if (oHiddenColl && oHiddenColl.value==1){
    	document.location.href = f.urlRedirect.value;
    }else {
    	window.open(f.urlRedirect.value, "_blank");
    }
    //document.location.reload();
    return false;
  } else {
    var oP   = document.getElementById("txtAccueil");
    if (oP){
  	  oP.style.display="none";
    }
    var strErr = "";
    if( n == 1 ) {
      strErr = "<b>Identification erronnée.</b><br/>" +
        "Renouvelez votre saisie ou " + " <a class='homeLink' href='#' onclick=\"javascript:help('"+f.strTokenHelp.value+"')\">contactez un administrateur</a>.";
    } 
    else if( n == 2 ) {
     strErr = "Votre session a expiré.<br/>Veuillez vous réauthentifier.<br/>";
    } 
    else if( n == 3 ) {
     strErr = "Vous n'êtes invité à aucun espace.<br/>" +
       "Veuillez contacter <a class='homeLink' href='#' onclick=\"javascript:help('"+f.strTokenHelp.value+"')\">" +
       "l'administrateur</a> pour qu'il paramètre votre compte.<br/>";
    } 
    else if( n == 4 ) {
     strErr = "Votre compte est désactivé.<br/>Veuillez renseigner <a class='homeLink' href='#'" +
       " onclick=\"javascript:getLogin('"+f.strTokenHelp.value+"')\">ce formulaire</a> pour le réactiver.<br/>&nbsp;";
    } 
    else if( n == 5 ) {
     strErr = "Votre compte est en cours de validation.<br/>Il sera prochainement activé.<br/>&nbsp;";
    } 
    else if( n == 6 ) {
     strErr = "Vos droits ne vous ont pas permis d'atteindre une fonctionnalité.<br/>" +
       "Veuillez vous réauthentifier.<br/>&nbsp;";
    } 
    else if( n == 7 ) {
     strErr = "L'adresse de la page demandée est non valide.<br/>" +
       "Veuillez vous réauthentifier.<br/>&nbsp;";
    }
    nbClickValid = 0;
    if( strErr != "" ) {
      oDiv.innerHTML = strErr;
    } 
  }
}
function help(strToken)
{
  OpenWindow(ALK_ALKANET+'?token='+strToken, '380', '550', 'windAide');
}

function getLogin(strToken, height, width)
{
  if ( height == null ) height = 350;
  if ( width == null ) width = 450;
  OpenWindow(ALK_ALKANET+"?token="+strToken, height, width, 'WindCode');
}

/** onglet collab */

function openCloseList(strKey)
{
  var oDiv  = document.getElementById("header_"+strKey);
  var oAB   = document.getElementById("linkBul_"+strKey);
  var oImgB = document.getElementById("imgBul_"+strKey);
  var oA    = document.getElementById("link_"+strKey);
  var oUL   = document.getElementById("list_"+strKey);
  var oStyleUl  = ( oUL.style ? oUL.style : oUL );  
  
  if( oStyleUl.display == "none" ) {
    oStyleUl.display = "";
    oImgB.src= "/media/site/gen/puce_domaine_fermer.png";
    oAB.title = "Fermer";
    oDiv.className = "";
  } else {
    oStyleUl.display = "none";
    oImgB.src= "/media/site/gen/puce_domaine_ouvrir.png";  
    oAB.title = "Ouvrir";
    oDiv.className = "close";
  }
  if( oA )
    oA.title = oAB.title;
}

function openCloseNode(strKey)
{
  var oAB   = document.getElementById("linkBul_"+strKey);
  var oImgB = document.getElementById("imgBul_"+strKey);
  var oA    = document.getElementById("link_"+strKey);
  var oUL   = document.getElementById("node_"+strKey);
  var oStyleUl  = ( oUL.style ? oUL.style : oUL );  
  
  if( oStyleUl.display == "none" ) {
    oStyleUl.display = "";
    oImgB.src= "/media/site/gen/puce_domaine_fermer.png";
    oAB.title = "Fermer";
  } else {
    oStyleUl.display = "none";
    oImgB.src= "/media/site/gen/puce_domaine_ouvrir.png";  
    oAB.title = "Ouvrir";
  }
  if( oA )
    oA.title = oAB.title;
}

function openAlkToken(strToken)
{
  
}

/**
 * redimensionne la hauteur d'une iframe en fonction de son contenu
 * @param iFrameName    nom de l'iframe
 */
function setIFrameHeight(iFrameName){
  var height;
  var oIFrame = document.getElementById(iFrameName);
  var oDivRef = document.getElementById("menu_gauche");
  var height = oDivRef.offsetHeight-100;
  if ( oIFrame ) {
    oIFrame.setAttribute( "height", height );  
  }

}

/**
 * charge le contenu des combobox de Géosource
 * @return
 */
function loadCombos(idCombo, dependentComboValue){
  if ( !window.geosource.document.advsearch ) return;
  var strToken = tokenLoadCombos;
  var strUrl = ALK_ALKANET_SITE_SQL+"?token="+strToken+"&idCombo="+idCombo+"&dependentComboValue="+dependentComboValue;
  AlkAjax("loadCombos", "ajaxLoadCombos", "GET", strUrl, null);
}

function ajaxLoadCombos(hxrResponse) {
  eval(hxrResponse);
}

/** reduit ou déploie le bloc des 3 onglets */
var widthMin = 140;
var widthMax = 350;
var widthMenuGauche  = widthMax;
var iDeltaMenu = -20;
var bOpen = true;
var bFloat = false;
var bFloatOpen = false;

function onShowHideOnglets()
{
  if( bOpen ) 
    closeOnglet(); 
  else 
    openOnglet();
}
function openOnglet()
{
  setTimeout("animeOpenCloseOnglet()", 0);
}
function endShowOnglets()
{
  var strClassName;
  var oStyleTmp;
  var oTagTmp = document.getElementById("onglet_geoservices");
  if( oTagTmp ) { 
    strClassName = oTagTmp.className;
    oTagTmp.className = strClassName.replace("alone", "on");
  }
  
  oTagTmp = document.getElementById("divOngletPied");
  if( oTagTmp ) {
    strClassName = oTagTmp.className;
    oTagTmp.className = strClassName.replace(" alone", "");
  }

  oTagTmp = document.getElementById("divOngletContenu");
  if( oTagTmp ) {
    oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
    oStyleTmp.minHeight = "200px";
    strClassName = oTagTmp.className; 
    oTagTmp.className = strClassName.replace(" alone", "");
  }

  oTagTmp = document.getElementById("pOngletPied");
  if( oTagTmp ) {
    oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
    oStyleTmp.marginRight = "40px";
    oStyleTmp.marginRight = "20px";
  }
 
  var tabLiId = new Array("liOnglet1", "liOnglet3", "h2Connect", "divpanier", "divdomaine", "aOngletPied");
  for (strLiId in tabLiId) {
    oTagTmp = document.getElementById(strLiId);
    if( oTagTmp ) {
      oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
      oStyleTmp.display = "";  
    }
  }

  var oOnglet = document.getElementById("menu_gauche");
  if( oOnglet ) {
    bOpen = !bOpen;
    var oImg = document.getElementById("imgOpenClosePanel");
    if( oImg ) {
      oImg.alt = ( !bOpen ? "Ouvrir" : "Réduire" );
      oImg.className = ( bOpen ? "btClosePanel" : "btOpenPanel" );
      var oA = document.getElementById("aOpenClosePanel");
      if( oA ) {
        oA.title = oImg.alt + " l'onglet";
      }
    }
    
    /*var oDivNav = document.getElementById("navigation");
    if( !bOpen ) {
      var oStyle = ( oDivNav.style ? oDivNav.style : oDivNav );
      //oStyle.position = "relative";
      oDivNav.onmouseover = onMouseShowOnglets;
      oDivNav.sty
      bFloat = true;
    }*/
  }
}

function closeOnglet()
{
  var oStyleTmp;
  var oTagTmp;
  var tabLiId = new Array("liOnglet1", "liOnglet3", "h2Connect", "divpanier", "divdomaine", "aOngletPied");
  for (strLiId in tabLiId) {
    oTagTmp = document.getElementById(strLiId);
    if( oTagTmp ) {
      oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
      oStyleTmp.display = "none";  
    }
  }
  
  oTagTmp = document.getElementById("pOngletPied");
  if( oTagTmp ) {
    oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
    oStyleTmp.marginRight = "10px";
    oStyleTmp.marginLeft = "5px";
  }
  
  setTimeout("animeOpenCloseOnglet()", 0);
}

function endHideOnglets()
{
  var strClassName;
  var oTagTmp = document.getElementById("onglet_geoservices");
  if( oTagTmp ) {
    strClassName = oTagTmp.className;
    strClassName = strClassName.replace("on", "alone");
    strClassName = strClassName.replace("calonenecte", "connecte");
    oTagTmp.className = strClassName;
  }

  oTagTmp = document.getElementById("divOngletContenu");
  if( oTagTmp ) {
    oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
    oStyleTmp.minHeight = "";
    strClassName = oTagTmp.className; 
    oTagTmp.className = strClassName + " alone";
  }
  
  oTagTmp = document.getElementById("divOngletPied");
  if( oTagTmp ) {
    strClassName = oTagTmp.className;
    oTagTmp.className = strClassName + " alone";
  }

  var oOnglet = document.getElementById("menu_gauche");
  if( oOnglet ) {
    bOpen = !bOpen;
    var oImg = document.getElementById("imgOpenClosePanel");
    if( oImg ) {
      oImg.alt = ( !bOpen ? "Ouvrir" : "Réduire" );
      oImg.className = ( bOpen ? "btClosePanel" : "btOpenPanel" );
      var oA = document.getElementById("aOpenClosePanel");
      if( oA ) {
        oA.title = oImg.alt + " l'onglet";
      }
    }
    
    /*var oDivNav = document.getElementById("navigation");
    if( !bOpen ) {
      var oStyle = ( oDivNav.style ? oDivNav.style : oDivNav );
      oStyle.position = "relative";
      oDivNav.onmouseover = onMouseShowOnglets;
      oDivNav.sty
      bFloat = true;
    }*/
  }
}

function onMouseShowOnglets()
{
  if( bFloat && !bFloatOpen ) {
    var oDivNav = document.getElementById("navigation");
    oDivNav.onmouseover = null;
    var oDivMG = document.getElementById("menu_gauche");
    oDivNav.onmouseover = onMouseHideOnglets;
    setTimeout("animeOpenCloseOnglet()", 0);
  }  
}
function onMouseHideOnglets()
{
  if( bFloat && bFloatOpen ) {
    var oDivMG = document.getElementById("menu_gauche");
    oDivMG.onmouseout = null;
    var oDivNav = document.getElementById("navigation");
    oDivNav.onmouseover = onMouseShowOnglets;
    setTimeout("animeOpenCloseOnglet()", 0);
  }  
}

function animeOpenCloseOnglet()
{
  var oMenuGauche = document.getElementById("menu_gauche");
  var bAgain = true;
  if( oMenuGauche ) {
    var oStyle = ( oMenuGauche.style ? oMenuGauche.style : oMenuGauche );
    widthMenuGauche += iDeltaMenu;
    if( widthMenuGauche<=widthMin ) {
      widthMenuGauche = widthMin;
      iDeltaMenu = iDeltaMenu*(-1);
      bAgain = false;
    } else if( widthMenuGauche>=widthMax ) {
      widthMenuGauche = widthMax;
      iDeltaMenu = iDeltaMenu*(-1); 
      bAgain = false;
    }
    oStyle.width = widthMenuGauche+"px";
    oStyle.overflow = ( oStyle.width == widthMax+"px" ? "" : "hidden" );
  }

  var oStyleTmp, oTagTmp;

  var tabDivId = new Array("navigation", "navigation_onglets", "divOngletContenu", "divOngletPied");
  for (strDivId in tabDivId) {
    oTagTmp = document.getElementById(strDivId);
    if( oTagTmp ) {
      oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
      oStyleTmp.width = (widthMenuGauche-60) + "px";  
    }
  }
  /*var tabDivId = new Array("divpanier", "divdomaine");
  for (strDivId in tabDivId) {
    oTagTmp = document.getElementById(strDivId);
    if( oTagTmp ) {
      oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
      oStyleTmp.width = (widthMenuGauche-74) + "px";  
    }
  }*/
  
 
  oTagTmp = document.getElementById("textes_page");
  if( oTagTmp ) {
    oStyleTmp = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
    var iML = parseInt(oStyleTmp.marginLeft)
    oStyleTmp.marginLeft = (iML+(bAgain ? iDeltaMenu : -iDeltaMenu)) + "px";
    
    var oIframe = document.getElementById("fenetre");
    if( oIframe ) {
      oIframe = ( oIframe.style ? oIframe.style : oIframe );
      var iW = parseInt(oIframe.width); 
      oIframe.width = (iW-(bAgain ? iDeltaMenu : -iDeltaMenu)) + "px";
    }
  }
  
  if( bAgain ) { 
    setTimeout("animeOpenCloseOnglet()", 10);
  } else {
    if( bOpen ) {
      endHideOnglets(); 
    } else { 
      endShowOnglets();
    }
  }

}

function onResizeWindow()
{
  setIntialSizeContentData();
}
function onLoadIFrameProdige()
{
  setIntialSizeContentData();
  // fixe la hauteur en fonction du contenu de l'iframe
  var oIframe = document.getElementById("fenetre");
  
  var oTagTmp = document.getElementById("textes_page");
  var oStyle = ( oTagTmp.style ? oTagTmp.style : oTagTmp );
  oStyle.height = oIframe.contentWindow.document.body.scrollHeight + "px";
  
  oStyle = ( oIframe.style ? oIframe.style : oIframe );
  oStyle.height = oIframe.contentWindow.document.body.scrollHeight + "px";
}
function setIntialSizeContentData()
{
  var iWindowWidth = ( top.window.document.body.clientWidth
                       ? top.window.document.body.clientWidth  
                       : ( top.window.innerWidth 
                           ? top.window.innerWidth 
                           : 1005 ));
  
  var iMarginRight = ( iWindowWidth < 1180 ? iWindowWidth-1000 : 180 );
  if( iMarginRight < 0 ) iMarginRight = 0; 
  if( !bOpen ) iMarginRight -= 10;
                           
  iWindWidth = Math.max(600, iWindowWidth /* marge gauche */ - 375 - iMarginRight /*marge droite*/);
  oIframe = document.getElementById("fenetre");
  if( oIframe ) {
    oIframe = ( oIframe.style ? oIframe.style : oIframe );
    oIframe.width = (iWindWidth+(widthMax-widthMenuGauche)) + "px";
  }
  top.window.onresize = onResizeWindow;
}

function montreCache(id) {
  var d = document.getElementById(id);
  if (d) {
    if (d.style.display == 'none'){
      d.style.display='block';
    } else {
      d.style.display='none';
    }
  }
}
/** chargement des menus onglet et domaines */
function onLoadGeoservice(urlServiceBase, isUserInternet)
{
  // connection (initialisation de l'utilisateur Prodige)
  var oAjax = new AlkAjax("", "fnProdigeConnect", "GET", "/scripts/prodigedist/prodige_connect.php", null, false);
  //TODO à passer dans le retour AJAX
  window.open(urlServiceBase, 'WindowProdige',
      'status=yes,scrollbars=yes,resizable=yes,');
  
}
/**redirection vers la page d'accueil de prodige**/
function fnProdigeConnect(){
}

/***********************************
 * Fonctions de pagination
 ***********************************/
function ChangeNbEltParPage(strUrl)
{
  var oSelectNbEltParPage = document.getElementById("nb_resultats_page");
  if ( oSelectNbEltParPage ) {
    strUrl += '&nbEltParPage='+oSelectNbEltParPage.value;
  }
  AlkGoUrl(strUrl);
}

function ChangePage(page, formName, oSelectNbEltParPage) {
  var oForm = eval("document." + formName);
  if (!oForm)
    return;
  if ( oSelectNbEltParPage && oForm.nbEltParPage ) {
    oForm.nbEltParPage.value = oSelectNbEltParPage.value;
  }
  if ( oForm.page ) {
    oForm.page.value = page;
  }
  oForm.submit();
}

/***********************************
 * Fonctions calendar
 ***********************************/
function changeDate(iTimestamp, iAppli, idClassification, user_id, page_url)
{
  var strUrl = "/libconf/lib/lib_exectmpl.php?tmpl=internet/alkhtmlbloccalendar&iCT="+iTimestamp+"&iAp="+iAppli+"&iClassif="+idClassification+"&iAg="+user_id+"&purl="+page_url;
  var oAjax = new AlkAjax("", "fnChangeDate", "GET", strUrl, null);
}
function fnChangeDate(strHtmlContent)
{
  var oDiv = document.getElementById("calendrier");
  if( oDiv ) {
    tabRes = eval("("+strHtmlContent+")");
    oDiv.innerHTML = tabRes.html;
    
    loadJqueryAgenda(1032, 1, '');
  } 
}
var memInitEvent = "";
function viewEvent(iTimestamp)
{
  var strUrl = "/libconf/lib/lib_exectmpl.php?tmpl=internet/alkhtmlblocagendacalendar&iCT="+iTimestamp+"&iAp="+idAppliAgenda+"&iAg="+idUser+"&purl="+urlAgenda;
  var oAjax = new AlkAjax("", "fnViewEvent", "GET", strUrl, null);
}
function fnViewEvent(strHtmlContent)
{
  var oDiv = document.getElementById("date_viewer");
  if( oDiv ) {
    if( memInitEvent == "" ) {
      memInitEvent = oDiv.innerHTML;
    }
    oDiv.innerHTML = strHtmlContent;
  }
}
var iTo = null;
function onMouseOverDate(iTimestamp, iAppli, user_id, page_url)
{
  iTo = setTimeout("viewEvent("+iTimestamp+")", 100);
}
function onMouseOutDate()
{
  if( iTo ) {
    clearTimeout(iTo);
    iTo = null;
  }
  var oDiv = document.getElementById("date_viewer");
  if( oDiv && memInitEvent != "" ) { 
    //oDiv.innerHTML = memInitEvent;
    oDiv.innerHTML = "";
    
    //oDiv.style.display='none'; 
  } 
}
function viewDate(strUrl)
{
  window.location.href = strUrl; 
}

function loadJqueryAgenda(idAppliAgenda, idUser, urlAgenda){
  jQuery(document).ready(function () {
    jQuery('html').click(function() {
      jQuery("#date_viewer").hide();
      jQuery("#date_viewer").text('');
    });
    
    jQuery("a.actif").mouseover(function (event) {
      viewEvent(jQuery(this).prop("name"));
      
      var parent = jQuery("div#agenda");
      var position_parent = parent.offset();
      var left_parent = position_parent.left;
      var top_parent = position_parent.top;
              
      var iPosX = event.pageX+5;
      var iPosY = event.pageY+5;
      
      jQuery("#date_viewer").css('top', (iPosY-top_parent)+'px');
      jQuery("#date_viewer").css('left', (iPosX-left_parent)+'px');
      jQuery("#date_viewer").fadeIn('slow');
    });
  
  });
}

/**
 * réalise l'export de l'annuaire au formation excel
 */
function ExportExcel(iTypeExport){
	 var trombi = 0;
	 if (arguments.length > 1){
	 	trombi =  arguments[1];
	 }
	 strUrl = "/libconf/classes/alkhtmlblocannuresultatannu.php?i="+iTypeExport+"&t="+trombi;
	 var f= document.form_guide;
	 strUrlFrom = f.action; 
	 f.action = strUrl;
	 f.submit();
	 f.action = strUrlFrom; 
}

function AddSelect(){
  var oForm = document.form_guide_simple;
  var oSelect = document.getElementsByName("theme[]");
  iSelect     = oSelect.length;
  var oAjax = new AlkAjax('data_infos', 'FnAddSelect', ALK_FORM_METHOD_GET, 
                           "/libconf/lib/lib_exectmpl.php?tmpl=alkexecdata&iSelect="+iSelect+"&iMode=1"); 
}

function FnAddSelect(strJs){
  if (document.getElementById("divTheme")){
  	var strHtmlTemp = document.getElementById("divTheme").innerHTML;
  	var tab_results = eval( "("+strJs+")");

    if(tab_results.length != 0){
	    var strHtml = tab_results.strHtml;
	    var iSelect = tab_results.iSelect;
	    // remplacement du bon id pour la fonction AddSelect
	    var regAddSelect = new RegExp("AddSelect\\([0-9]+", "g");
	    //strHtmlTemp = strHtmlTemp.replace(regAddSelect, "AddSelect(" + iSelect);
	    var oDiv = document.createElement("div");
	    oDiv.setAttribute("id", "theme_"+iSelect);
	    oDiv.innerHTML = strHtml;
	    //document.getElementById("divTheme").innerHTML.replace(regAddSelect, "AddSelect(" + (iSelect*1+1));
	    document.getElementById("divTheme").appendChild(oDiv);
    }
  }
}

function DeleteSelect(iSelect){
  var oDiv = document.getElementById("theme_" +iSelect);
  if (oDiv){
  	oDiv.innerHTML = "";
  }
}

function afficheDivMdp(divId, strToken){
 var oDiv = document.getElementById(divId);
 var oIframe = document.getElementById("alkIFrameNiv1");
 
 if (oDiv){
   if (oDiv.style.display=="block"){
   	  if (oIframe){
 	      oDiv.removeChild(oIframe);
 	      oDiv.style.display = "none";
      }
   }else {
   	 var oIFrame = top.document.createElement("iframe");
     oIFrame.id = "alkIFrameNiv1";
     oIFrame.name ="alkIFrameNiv1";
     oIFrame.scrolling = "no";
     oIFrame.src = ALK_ALKANET + "?token=" +strToken;
     oDiv.appendChild(oIFrame);
     oDiv.style.display = "block";
  }
  }
}
