/**
 * Fonction d'ouverture d'un popup centré sur la fenêtre du navigateur (et non par rapport à l'écran !)
 * @author : Julien Fredon @ imaginance
 */
function popupThis(link, iWidth, iHeight, sOptions)
{
	// Récupération de l'url spécifié dans le href du lien.
	sUrl	=	link;
	if (typeof link == "object")
	{
		sUrl	=	link.href;
	}


    // Calcul de la position du popup (centré)
    var screenX;
    var screenY;
    var popupWidth      =   iWidth;
    var popupHeight     =   iHeight;
    if (sOptions == undefined || sOptions == "")
    {
    	sOptions	=	"resizable=yes,scrollbars=yes"
    }
    var options         =   sOptions;

	// Calcul de la position de la fenêtre du navigateur.
    if (window.screenX)	// Pour Mozilla & Co.
    {
        screenX =   window.screenX;
        screenY =   window.screenY;
        screenY =   screenY + 80;
    }
    else // Pour IE & Co.
    {
        screenX =   window.screenLeft;
        screenY =   window.screenTop;
    }

	// Calcul de la position du popup.
    popupTop    =   parseInt((document.documentElement.clientHeight / 2) - (popupHeight / 2) + screenY);
    popupLeft   =   parseInt((document.documentElement.clientWidth / 2) - (popupWidth / 2) + screenX);

	// Spécial Opéra qui considère clientHeight comme la hauteur total du document et non de la fenêtre.
	if (navigator.userAgent.indexOf("Opera") > -1)
	{
		popupTop    =   50 + screenY;
	    popupLeft   =   parseInt((document.documentElement.offsetWidth / 2) - (popupWidth / 2) + screenX);
	}

	// Ajout du parametre renderMode=plopup à l'url
	sUrl		=	sUrl + ((sUrl.indexOf("?") > -1) ? '&' : '?') + "layout=popup";


    // Ouverture du popup.
    oPopup      =   window.open(sUrl, "", "top=" + popupTop + ",left=" + popupLeft + ",width=" + popupWidth + ",height=" + popupHeight + "," + options);
    return false;
}