var myPopup;
var ww = 100;
var hh = 100;
var step = 15;
function popup(url, titre, width, height, autosize)
{
    option = 'location=no, directories=no, menubar=yes, status=no, scrollbars=yes, resizable=yes';
    
    if (!width) width = ww;
    if (!height) height = hh;
    if (!autosize) autosize = false;
    
    var top = ((screen.height - height) / 2);
    var left = ((screen.width - width) / 2);
    option += ', width='+width+', height='+height+', top='+top+', left='+left;
    
    myPopup = window.open(url, titre, option);
    if (autosize)
	{
	    if (document.all)
		setTimeout("initResizeIE()", 100);
	    else
		myPopup.onload = function(){resize();}
	}
    return (false);
}

function initResizeIE()
{
    myPopup.onload = resize();
}

function resize()
{
    if (myPopup.document.all)
	{
	    x = myPopup.document.body.scrollWidth;
	    ww = (x < (screen.width - step) && x > ww) ? x : ww;
	    x = myPopup.document.body.scrollHeight;
	    hh = (x < (screen.height - step) && x > hh) ? x : hh;
	    //redim();
	}
    else
	{
	    ww = (myPopup.document.width > ww) ? (myPopup.document.width) : ww;
	    hh = (myPopup.document.height > hh) ? (myPopup.document.height) : hh;
	}
    ww = (ww + 25);
    hh = (hh + 95);
    setTimeout("myPopup.window.resizeTo(ww, hh);",100);
    var top = ((screen.height - hh) / 2);
    var left = ((screen.width - ww) / 2);
    myPopup.window.moveTo(left, top);
    
}

