/**
 * @FileFR » Gestion des fonctions standard
 * @FileEN » Management of the standard functions
 */

// Code permettant de désactiver l'utilisation de "retour arri�re"
try { history.go(+1); } catch(e) {}

/**
 * @FunctionFR initForm » Crée un objet HTTP, utilisé pour générer dynamiquement du code (AJAX)
 * @FunctionEN initForm » Create an HTTP object used to generate dynamically code (AJAX)
 */
function getHTTPObject()
{
   var xmlhttp;
   /*@cc_on
   @if (@_jscript_version >= 5)
   try
   {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch (e)
   {
      try
      {
         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (E)
      {
         xmlhttp = false;
      }
   }
   @else
      xmlhttp = false;
   @end @*/
   if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
   {
      try
      {
         xmlhttp = new XMLHttpRequest();
      }
      catch (e)
      {
         xmlhttp = false;
      }
   }
   return xmlhttp;
}


/**
 * @FunctionFR updatePage » Met à jour une page (AJAX)
 * @FunctionEN updatePage » Update a page (AJAX)
 * @ParamFR asPage String / » Nom de la page
 * @ParamEN asPage String / » Name of the page
 * @ParamFR asZoneIdHtml String / » Identifiant HTML de la partie à modifier
 * @ParamEN asZoneIdHtml String / » HTML ID of the part to modify
 * @ParamFR abLoading Boolean / » Affichage ou non de l'animation de chargement
 * @ParamEN abLoading Boolean / » Display or not of the animation of loading
 */
function updatePage(asPage)
{
   var asZoneIdHtml = "";
   if (updatePage.arguments.length > 1)
   {
      asZoneIdHtml = updatePage.arguments[1];
   }
   abLoading = false;
   if (updatePage.arguments.length > 2)
   {
      abLoading = updatePage.arguments[2];
   }
   var http = getHTTPObject();
   http.open("GET", asPage, true);
   /*http.onreadystatechange = handleHttpResponse;*/
   http.onreadystatechange = function()
   {
      if (http.readyState == 4)
      {
         if (asZoneIdHtml != "" || abLoading)
         {
            if (document.getElementById('ajaxLoading'))
         	{
         		document.getElementById('ajaxLoading').style.display = 'none';
         	}
         	else if (parent.document.getElementById('ajaxLoading'))
         	{
         		parent.document.getElementById('ajaxLoading').style.display = 'none';
         	}
         }
         if (http.status == 200)
         {
            var responseText = http.responseText;
            if (asZoneIdHtml == "") // Javascript
            {
               while (responseText.indexOf('<script type=\"text/javascript\">\n') != -1)
               {
                  responseText = responseText.replace('<script type=\"text/javascript\">\n', '');
               }
               while (responseText.indexOf('</script>\n') != -1)
               {
                  responseText = responseText.replace('</script>\n', '');
               }
               eval(responseText);
            }
            else // HTML
            {
               responseText = responseText.replace('<div id="' + asZoneIdHtml + '">\n', '');
               responseText = responseText.substr(0, responseText.length-7);
               
               if (document.getElementById(asZoneIdHtml))
               {
                  document.getElementById(asZoneIdHtml).innerHTML = responseText;
                  initForm();
               }
               else if (parent.document.getElementById(asZoneIdHtml))
               {
                  parent.document.getElementById(asZoneIdHtml).innerHTML = responseText;
                  parent.initForm();
               }
               else if (window.opener && window.opener.document.getElementById(asZoneIdHtml))
               {
                  window.opener.document.getElementById(asZoneIdHtml).innerHTML = responseText;
                  window.opener.initForm();
               }
               
               var laJavascript = responseText.split('<script type=\"text/javascript\">\n');
               for (var index=0 ; index < laJavascript.length ; index++)
               {
                  var laJavascriptCode = laJavascript[index].split('</script>\n');
                  if (laJavascriptCode.length > 1)
                  {
                     eval(laJavascriptCode[0]);
                  }
               }
            }
         }
         else
         {
            alert('Un problème est survenu dans le chargement des données.');
         }
      }
      else if (asZoneIdHtml != "" || abLoading)
      {
         if (document.getElementById('ajaxLoading'))
         {
         	document.getElementById('ajaxLoading').style.display = 'block';
         }
         else if (parent.document.getElementById('ajaxLoading'))
         {
         	parent.document.getElementById('ajaxLoading').style.display = 'block';
         }
      }
   }
   http.send(null);
   working = true;
}

/**
 * @FunctionFR expand » Ouvre ou ferme un panneau
 * @FunctionEN expand » Open or close a panel
 * @ParamFR asId String / » Identifiant HTML du panneau
 * @ParamEN asId String / » HTML ID of the panel
 * @ParamFR abExpand Boolean / » Etat ouvert ou fermé
 * @ParamEN abExpand Boolean / » Opened or closed panel
 */
function expand(asId, abExpand) {
   if (abExpand == true) {
      if (document.getElementById(asId + "Expand")) {
         document.getElementById(asId + "Expand").style.display='none';
      }
      if (document.getElementById(asId + "Collapse")) {
         document.getElementById(asId + "Collapse").style.display='';
      }
      if (document.getElementById(asId + "Content")) {
         document.getElementById(asId + "Content").style.display='';
      }
   } else {
      if (document.getElementById(asId + "Expand")) {
         document.getElementById(asId + "Expand").style.display='';
      }
      if (document.getElementById(asId + "Collapse")) {
         document.getElementById(asId + "Collapse").style.display='none';
      }
      if (document.getElementById(asId + "Content")) {
         document.getElementById(asId + "Content").style.display='none';
      }
   }
}

/**
 * @FunctionFR openWindow » Ouvre une page en popup
 * @FunctionEN openWindow » Open a page in popup
 * @ParamFR asPage String / » URL de la page à ouvrir
 * @ParamEN asPage String / » URL of the page to open
 * @ParamFR anWidth Integer / » Largeur en pixels de la popup
 * @ParamEN anWidth Integer / » Width in pixels of the popup
 * @ParamFR anHeight Integer / » Hauteur en pixels de la popup
 * @ParamEN anHeight Integer / » Height in pixels of the popup
 * @ParamFR asName String / » Nom (javascript) de la popup
 * @ParamEN asName String / » Name (javascript) of the popup
 * @ParamFR anPosX Integer / » Position en pixels de la popup par rapport au bord gauche de la fenêtre
 * @ParamEN anPosX Integer / » Position in pixels of the popup compared to the border on the right of the window
 * @ParamFR anPosY Integer / » Position en pixels de la popup par rapport au bord supérieur de la fenêtre
 * @ParamEN anPosY Integer / » Position in pixels of the popup compared to the border at the top of the window
 */
function openWindow(asPage, anWidth, anHeight, asName, anPosX, anPosY)
{
   if (!anWidth)
   {
      anWidth = screen.width;
   }
   if (!anHeight)
   {
      anHeight = screen.height;
   }
   if (!anPosX)
   {
      anPosX = (screen.width - anWidth) / 2;
   }
   if (!anPosY)
   {
      anPosY = (screen.height - anHeight) / 2;
   }
   if (!asName)
   {
      asName = 'window1';
   }
   window1 = window.open(asPage,asName,"toolbar=no,location=no,dependent=yes,directories=no,status=yes,menubar=no,resizable=yes,scrollbars=yes,left="+anPosX+",screenX="+anPosX+",top="+anPosY+",screenY="+anPosY+",width="+anWidth+",height="+anHeight);
}

/**
 * @FunctionFR openWindow » Retaille la popup
 * @FunctionEN openWindow » Resize the popup
 * @ParamFR anWidth Integer / » Largeur en pixels de la popup
 * @ParamEN anWidth Integer / » Width in pixels of the popup
 * @ParamFR anHeight Integer / » Hauteur en pixels de la popup
 * @ParamEN anHeight Integer / » Height in pixels of the popup
 */
function resize(anWidth, anHeight)
{
   if (anWidth > screen.width)
   {
      anWidth = screen.width;
   }
   if (anHeight > screen.height)
   {
      anHeight = screen.height;
   }
   window.resizeTo(anWidth,anHeight);
   window.moveTo((screen.width - anWidth) /2, (screen.height - anHeight)/2 );
   window.focus();
}


var gsIdFrame = "";

/**
 * @FunctionFR openIFrame » Ouvre une iframe (un cadre)
 * @FunctionEN openIFrame » Open an iframe
 * @ParamFR idFrame String / » Identifiant HTML de l'iframe
 * @ParamEN idFrame String / » HTML ID of the iframe
 */
function openIFrame(asIdFrame)
{
   gsIdFrame = asIdFrame;
   if (document.getElementById(asIdFrame).style.display=='block')
   {
      document.getElementById(asIdFrame).style.display = 'none';
   }
   else
   {
      try
      {
         document.onclick = check;
      }
      catch(e) {}
      document.getElementById(asIdFrame).style.display = 'block';
      try
      {
      	 document.getElementById(asIdFrame).contentWindow.init();
      }
      catch(e) {}
   }
}

/**
 * @FunctionFR closeIFrame » Ferme une iframe (un cadre)
 * @FunctionEN closeIFrame » Close an iframe
 * @ParamFR asIdFrame String / » Identifiant HTML de l'iframe
 * @ParamEN asIdFrame String / » HTML ID of the iframe
 */
function closeIFrame(asIdFrame)
{
   document.getElementById(asIdFrame).style.display = 'none';
}


/**
 * @FunctionFR check » Ferme l'iframe lors d'un clic de souris à l'extérieur de la frame
 * @FunctionEN check » Close the iframe when a click is outside the frame
 * @ParamFR aoEvt Object / » Evènement javascript
 * @ParamEN aoEvt Object / » Javascript event
 */
function check(aoEvt)
{
   var target = (aoEvt && aoEvt.target) || (event && event.srcElement);
   var obj = document.getElementById(gsIdFrame);
   var obj2 = document.getElementById(gsIdFrame+'Img');
   if (target == obj2)
   {
      if (obj.style.display == "block")
      {
         obj.style.display = 'block';
      }
      else
      {
         obj.style.display = 'none';
      }
   }
   else if (checkParent(target))
   {
      obj.style.display = 'none';
   }
}

/**
 * @FunctionFR checkParent » Vérifier si l'objet est dans l'iframe
 * @FunctionEN checkParent » Check if the object is in the iframe
 * @ParamFR aoObject Object / » Objet du DOM
 * @ParamEN aoObject Object / » Object of the DOM
 * @ReturnFR Boolean » Objet est dans l'iframe
 * @ReturnEN Boolean » Object is in the iframe
 */
function checkParent(aoObject)
{
   while (aoObject.parentNode)
   {
      if (aoObject == document.getElementById(gsIdFrame))
      {
         return false;
      }
      aoObject = aoObject.parentNode;
   }
   return true;
}

/**
 * @FunctionFR showMenu » Affiche le menu
 * @FunctionEN showMenu » Display the menu
 * @ParamFR asMenu Object / » Nom du menu
 * @ParamEN asMenu Object / » Name of the menu
 * @ParamFR asSubMenu Object / » Nom du sous-menu
 * @ParamEN asSubMenu Object / » Name of the submenu
 */
function showMenu()
{
   var elements_menu = document.getElementById('s' + arguments[0]);
   var menu = document.getElementById(arguments[0]);
   var elements_sub_menu = null;
   var sub_menu = null;
   if (arguments.length>=2)
   {
      elements_sub_menu = document.getElementById('s' + arguments[1]);
      sub_menu = document.getElementById(arguments[1]);
   }
   var show_menu = true;
   var show_sub_menu = true;
   if (elements_sub_menu)
   {
      // Sous-menu déjà ouvert
      if (elements_sub_menu.style.display=='block')
      {
         show_sub_menu = false;
      }
   }
   // Menu déjà ouvert
   else if (elements_menu && elements_menu.style.display=='block')
   {
      show_menu = false;
   }

   var i = 1;
   while (document.getElementById('smenu'+i) && document.getElementById('menu'+i))
   {
      // Fermeture des sous-menus
      document.getElementById('smenu'+i).style.display='none';

      // Changement de direction des flèches
      if (document.getElementById('menu'+i).className.indexOf('menu-en-cours') >= 0)
      {
         document.getElementById('menu'+i).className='menu-en-cours-bas';
      }
      else
      {
         document.getElementById('menu'+i).className='';
      }

      var j = 1;
      while (document.getElementById('smenu'+i+'-'+j) && document.getElementById('menu'+i+'-'+j))
      {
         // Fermeture des menus
         document.getElementById('smenu'+i+'-'+j).style.display='none';

         // Changement de direction des flèches
         if (document.getElementById('menu'+i+'-'+j).className.indexOf('sous-menu-en-cours') >= 0)
         {
            document.getElementById('menu'+i+'-'+j).className='sous-menu-en-cours-bas';
         }
         else
         {
            document.getElementById('menu'+i+'-'+j).className='';
         }
         j++;
      }
      i++;
	 }
   //Ouverture du sous-menu
   if (elements_sub_menu && sub_menu && show_sub_menu)
   {
      elements_sub_menu.style.display='block';
      if (sub_menu.className.indexOf('sous-menu-en-cours') >= 0)
      {
         sub_menu.className='sous-menu-actif sous-menu-en-cours-haut';
      }
      else
      {
         sub_menu.className='sous-menu-actif';
      }
   }
   //Ouverture du menu
   if (elements_menu && menu && show_menu)
   {
      elements_menu.style.display='block';
      if (menu.className.indexOf('menu-en-cours') >= 0)
      {
         menu.className='menu-actif menu-en-cours-haut';
      }
      else
      {
         menu.className='menu-actif';
      }
      if (arguments.length==1)
      {
         var i = 1;
         while (document.getElementById('s'+arguments[0]+'-'+i) && document.getElementById(arguments[0]+'-'+i))
         {
            // Ouverture automatiquement du sous-menu en cours, lors de l'ouverture du menu en cours
            if (document.getElementById(arguments[0]+'-'+i).className.indexOf('sous-menu-en-cours') >= 0)
            {
               document.getElementById(arguments[0]+'-'+i).className='sous-menu-actif sous-menu-en-cours-haut';
               document.getElementById('s'+arguments[0]+'-'+i).style.display='block';
            }
            i++;
         }
      }
   }
}

/**
 * @FunctionFR expandMenu » Affiche la barre de menu
 * @FunctionEN expandMenu » Display the menu bar
 */
function expandMenu()
{
   if (document.getElementById('partieGauche'))
   {
      document.getElementById('partieGauche').className = 'partieGauche';
   }
   if (document.getElementById('partieMenu'))
   {
      document.getElementById('partieMenu').style.display = '';
   }
   if (document.getElementById('partieNoMenu'))
   {
      document.getElementById('partieNoMenu').style.display = 'none';
   }
   if (document.getElementById('partieCollapse'))
   {
      document.getElementById('partieCollapse').style.display = '';
   }
   if (document.getElementById('partieExpand'))
   {
      document.getElementById('partieExpand').style.display = 'none';
   }
   if (document.getElementById('partieDivio'))
   {
      document.getElementById('partieDivio').style.display = '';
   }
}

/**
 * @FunctionFR collapseMenu » Cache la barre de menu
 * @FunctionEN collapseMenu » Hide the menu bar
 */
function collapseMenu()
{
   if (document.getElementById('partieGauche'))
   {
      document.getElementById('partieGauche').className = 'partieGaucheNoMenu';
   }
   if (document.getElementById('partieMenu'))
   {
      document.getElementById('partieMenu').style.display = 'none';
   }
   if (document.getElementById('partieNoMenu'))
   {
      document.getElementById('partieNoMenu').style.display = '';
   }
   if (document.getElementById('partieCollapse'))
   {
      document.getElementById('partieCollapse').style.display = 'none';
   }
   if (document.getElementById('partieExpand'))
   {
      document.getElementById('partieExpand').style.display = '';
   }
   if (document.getElementById('partieDivio'))
   {
      document.getElementById('partieDivio').style.display = 'none';
   }
}

// Les 3 fonctions permettent de gérer les événements de la souris sur le menu

/**
 * @FunctionFR containsDOM » Vérifie si le contenu est contenu dans le conteneur (ici la barre de menu)
 * @FunctionEN containsDOM » Check if the containee is contained in the container (here in the menu bar)
 * @ParamFR aoContainer Object / » Nom du conteneur
 * @ParamEN aoContainer Object / » Name of the container
 * @ParamFR aoContainee Object / » Nom du contenant
 * @ParamEN aoContainee Object / » Name of the contenant
 * @ParamFR asSubMenu Object / » Contenant est contenu dans le conteneur ou non
 * @ParamEN asSubMenu Object / » Containee is contained in the container or not
 * @ReturnFR Boolean » Contenu est contenu dans le conteneur ou non
 * @ReturnEN Boolean » Containee is contained in the container or not
 */
function containsDOM(aoContainer, aoContainee)
{
   var isParent = false;
   do
   {
      if ((isParent = aoContainer == aoContainee))
      {
         break;
      }
      aoContainee = aoContainee.parentNode;
   }
   while (aoContainee != null);
   return isParent;
}

/**
 * @FunctionFR checkMouseEnter » Vérifie si le curseur est à l'intérieur du conteneur
 * @FunctionEN checkMouseEnter » Check if the cursor is contained inside the container
 * @ParamFR aoContainer Object / » Nom du conteneur
 * @ParamEN aoContainer Object / » Name of the container
 * @ParamFR aoEvt Object / » Evènement javascript
 * @ParamEN aoEvt Object / » Javascript event
 * @ReturnFR Boolean » Curseur est à l'intérieur du conteneur
 * @ReturnEN Boolean » Cursor is contained inside the container
 */
function checkMouseEnter(aoContainer, aoEvt)
{
   if (aoContainer.contains && aoEvt.fromElement)
   {
      return !aoContainer.contains(aoEvt.fromElement);
   }
   else if (aoEvt.relatedTarget)
   {
      return !containsDOM(aoContainer, aoEvt.relatedTarget);
   }
}

/**
 * @FunctionFR checkMouseLeave » Vérifie si le curseur est sorti du conteneur
 * @FunctionEN checkMouseLeave » Check if the cursor is gone out the container
 * @ParamFR aoContainer Object / » Nom du conteneur
 * @ParamEN aoContainer Object / » Name of the container
 * @ParamFR aoEvt Object / » Evènement javascript
 * @ParamEN aoEvt Object / » Javascript event
 * @ReturnFR Boolean » Curseur est sorti du conteneur
 * @ReturnEN Boolean » Cursor is gone out the container
 */
function checkMouseLeave(aoContainer, aoEvt)
{
   if (aoContainer.contains && aoEvt.toElement)
   {
      return !aoContainer.contains(aoEvt.toElement);
   }
   else if (aoEvt.relatedTarget)
   {
      return !containsDOM(aoContainer, aoEvt.relatedTarget);
   }
}


/************************************************************************
                         Overlay + Fausse popup
************************************************************************/

/**
 * @FunctionFR showOverlayPopupFrame » Affiche la popup et le fond grisé
 * @FunctionEN showOverlayPopupFrame » Display the popup and the gray background
 * @ParamFR asUrlPage String / » Url de la page à afficher dans la popup
 * @ParamEN asUrlPage String / » Url of the page to display in the popup
 * @ParamFR anWidth Integer / » Largeur de la popup
 * @ParamEN anWidth Integer / » Width of the popup
 * @ParamFR anHeight Integer / » Hauteur de la popup
 * @ParamEN anHeight Integer / » Height of the popup
 */
function showOverlayPopupFrame(asUrlPage, anWidth, anHeight)
{
   showOverlay();
   loadPopupIframe(asUrlPage, anWidth, anHeight);
}

/**
 * @FunctionFR showOverlay » Affiche le fond grisé
 * @FunctionEN showOverlay » Display the gray background
 */
function showOverlay()
{
   text = "<table class='loadingImage' valign='center' border='0' align='center'><tr><td><img src='"+IMG_URL+"loading_"+DivioLang["language"].toLowerCase()+".gif'/></td></tr></table>";
   loOverlay = document.getElementById("overlay");
   loOverlay.innerHTML = text; // fixe le code HTML dans l'overlay balise (div)
   loOverlay.style.visibility = "visible"; // modification du style
   //alert(IMG_URL+"load_"+DivioLang["language"].toLowerCase()+".gif");
}

/**
 * @FunctionFR loadPopupIframe » Affiche la popup
 * @FunctionEN loadPopupIframe » Display the popup
 * @ParamFR asUrlPage String / » Url de la page à afficher dans la popup
 * @ParamEN asUrlPage String / » Url of the page to display in the popup
 * @ParamFR anWidth Integer / » Largeur en pixels de la popup
 * @ParamEN anWidth Integer / » Width in pixels of the popup
 * @ParamFR anHeight Integer / » Hauteur en pixels de la popup
 * @ParamEN anHeight Integer / » Height in pixels of the popup
 */
function loadPopupIframe(asUrlPage, anWidth, anHeight)
{
   //affichage de la fenetre
   loPopupDiv = document.getElementById('popupDiv');
   loPopupDiv.style.height = anHeight+'px';
   loPopupDiv.style.width  = anWidth+'px';
   loPopupDiv.style.marginLeft = parseInt(-(anWidth / 2))+'px';
   loPopupDiv.style.marginTop  = parseInt(-(anHeight / 2))+'px';
   loPopupDiv.style.marginRight = parseInt(-(anWidth / 2))+'px';
   loPopupDiv.style.marginBottom  = parseInt(-(anHeight / 2))+'px';
   loPopupDiv.style.left = "50%";
   loPopupDiv.style.top = "50%";

   // affichage du corps de la fenêtre (balise iframe)
   loPopupIframe = document.getElementById('popupIframe');
   //loPopupIframe.contentWindow.location.href = asUrlPage;
   frames['popupIframe'].location.href = asUrlPage;
}

/**
 * @FunctionFR showPopupContent » Affiche le contenu de la popup
 * @FunctionEN showPopupContent » Display the content of the popup
 */
function showPopupContent()
{
   //affichage de la fenetre
   loPopupDiv = parent.document.getElementById('popupDiv');
   loPopupDiv.style.visibility = "visible";
   loPopupIframe = parent.document.getElementById('popupIframe');
   loPopupIframe.style.visibility = "visible";
}

/**
 * @FunctionFR closeOverlay » Masque le fond grisé
 * @FunctionEN closeOverlay » Hide the gray background
 * @ParamFR abParent Boolean / » Fond grisé de la fenêtre appelante ou de la fenêtre en cours
 * @ParamEN abParent Boolean / » Gray background of the calling window or the current window
 */
function closeOverlay(abParent)
{
   // masque l'overlay (balise div [overlay]) si c'est dans la fenêtre parent
   if (abParent)
   {
      loOverlay = parent.document.getElementById('overlay');
      loOverlay.style.visibility = "hidden";
   // masque l'overlay (balise div [overlay]) si c'est dans la fenêtre elle-m�me
   }
   else
   {
      loOverlay = document.getElementById('overlay');
      loOverlay.style.visibility = "hidden";
   }
}

/**
 * @FunctionFR closePopupIframe » Ferme la popup
 * @FunctionEN closePopupIframe » Close the popup
 * @ParamFR abParent Boolean / » Popup de la fenêtre appelante ou de la fenêtre en cours
 * @ParamEN abParent Boolean / » Popup of the calling window or the current window
 */
function closePopupIframe(abParent)
{
   if (abParent)
   {
      // masque la fenetre (balise div)
      loPopupDiv = parent.document.getElementById('popupDiv');
      loPopupDiv.style.left = "0px";
      loPopupDiv.style.top = "0px";
      loPopupDiv.style.width = "0px";
      loPopupDiv.style.height = "0px";
      loPopupDiv.style.visibility = "hidden";
      // masque le contenu (balise iframe [contempwindow])
      loPopupIframe = parent.document.getElementById('popupIframe');
      loPopupIframe.style.visibility = "hidden";
   }
   else
   {
      // masque la fenetre (balise div)
      loPopupDiv = document.getElementById('popupDiv');
      loPopupDiv.style.left = "0px";
      loPopupDiv.style.top = "0px";
      loPopupDiv.style.width = "0px";
      loPopupDiv.style.height = "0px";
      loPopupDiv.style.visibility = "hidden";
      // masque le contenu (balise iframe [contempwindow])
      loPopupIframe = document.getElementById('popupIframe');
      loPopupIframe.style.visibility = "hidden";
   }
}

/**
 * @FunctionFR closeOverlayPopupFrame » Ferme la popup et le fond grisé
 * @FunctionEN closeOverlayPopupFrame » Close the popup and the gray background
 * @ParamFR abParent Boolean / » Popup et fond grisé de la fenêtre appelante ou de la fenêtre en cours
 * @ParamEN abParent Boolean / » Popup and gray background of the calling window or the current window
 */
function closeOverlayPopupFrame()
{
   if (arguments.length == 0)
   {
      abParent = true
   }
   else
   {
      abParent = arguments[0];
   }
   closePopupIframe(abParent);
   closeOverlay(abParent);
}

/**
 * @FunctionFR resizeIframe » Retaille l'iframe
 * @FunctionEN resizeIframe » Resize the iframe
 * @ParamFR anWidth Integer / » Largeur en pixels de la popup
 * @ParamEN anWidth Integer / » Width in pixels of the popup
 * @ParamFR anHeight Integer / » Hauteur en pixels de la popup
 * @ParamEN anHeight Integer / » Height in pixels of the popup
 */
function resizeIframe(anWidth, anHeight)
{
   if (anWidth > (screen.availWidth - 50))
   {
      anWidth = (screen.availWidth - 50);
   }
   if (anHeight > (screen.availHeight - 200))
   {
      anHeight = (screen.availHeight - 200);
   }
   loPopupDiv = parent.document.getElementById('popupDiv');
   loPopupDiv.style.width  = anWidth+'px';
   loPopupDiv.style.height = anHeight+'px';
   loPopupDiv.style.marginLeft = parseInt(-(anWidth / 2))+'px';
   loPopupDiv.style.marginTop  = parseInt(-(anHeight / 2))+'px';
}
