/* gestion des popups suivant 4 types : console, consoleScroll, fixed, fixedscroll, elastic */
/* 03/09/04 */

var newWin = null;
function popUp(strURL, strType, strHeight, strWidth)
{
	if (newWin != null && !newWin.closed)
	{
		newWin.close();
	}
	var strOptions="";
	if (strType=="console")
	{
		strOptions="resizable,height="+strHeight+",width="+strWidth;
	}
	if (strType=="consoleScroll")
	{
		strOptions="scrollbars,resizable,height="+strHeight+",width="+strWidth;
	}
	if (strType=="fixed")
	{
		strOptions="status,height="+strHeight+",width="+strWidth;
	}
        if (strType=="fixedscroll")
	{
		strOptions="scrollbars,status,height="+strHeight+",width="+strWidth;
	}
	if (strType=="elastic")
	{
		strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;
	}
	/* modification du script initial - test : si fenêtre en cours = popup, changer la référence sinon chargement de la page demandée dans la même fenêtre*/
	if (!window.opener)
	{
		newWin = window.open(strURL, 'newWin', strOptions);
		newWin.focus();
	}
	else
	{
		externe = window.open(strURL, 'externe', strOptions);
		externe.focus();
	}
}

function lienFermerPopUp(text) {
	if (window.opener) {
		var linkTxt = (text != '') ? text : 'FERMER';
		document.writeln('<div class="fermeture"><a href="#" title="fermer la fenêtre" onclick="self.close();">' + linkTxt + '</a></div>');
		if (document.getElementById) {
			document.getElementById('footer').className = 'fixed';
		}
	}
}
