﻿
	  /****************************************************/
	  /*               Gestion Popup                      */
	  /****************************************************/
    var oPopup_iFrame = document.createElement("iframe");
    oPopup_iFrame.id = "iframe_Popup"; 
    oPopup_iFrame.className = "Popup";
    oPopup_iFrame.frameBorder = "0";
    oPopup_iFrame.scrolling = "no";
    var oPopup_Shadow = document.createElement("div");  
    oPopup_Shadow.id = "Mask"; 
    oPopup_Shadow.className = "Mask"; 
    
    //Insertion + initialisation de l'objet popup dans la page 
    function open_Popup(sUrl) {
        oPopup_iFrame.style.visibility = "hidden";
        // Création des balises Mask et iframe
        if (!document.getElementById("iframe_Popup")) { document.body.appendChild(oPopup_iFrame); }
        if (!document.getElementById("Mask")){document.body.appendChild(oPopup_Shadow);}
        oPopup_iFrame.src = sUrl;
    }   
    //Destruction de l'objet popup
    function close_Popup() { 
        oPopup_iFrame.src = "";
        if (document.getElementById("iframe_Popup")) { document.body.removeChild(document.getElementById("iframe_Popup")); }
        if (document.getElementById("Mask")){document.body.removeChild(document.getElementById("Mask"));}
    }
    //recharge une nouvelle popup avec une nouvelle url (fonction crée pour Chrome)
    function change_Popup(sUrl) {
        setTimeout(function(){open_Popup(sUrl)}, 50);
        close_Popup();
    }
    
    //Redimensionne et positionne correctement la popup dans la page
    function ges_Popup(nWidth, nHeight){
      //Redimensionnement
      oPopup_iFrame.style.height = nHeight  + "px"; 
      oPopup_iFrame.style.width = nWidth + "px";
      //Positionnement horizontal
      oPopup_iFrame.style.marginLeft = "-" + nWidth/2 + "px"; 
      //Positionnement verticval
      oPopup_iFrame.style.marginTop = "-" + nHeight/2 + "px";
      
      //Affichage 
      oPopup_iFrame.style.visibility = "visible";
    };
	  /****************************************************/
	
