    function displaySimpleCalc()
    {
        var width = 300;
        var height = 200;
        var topPos;
        var leftPos;
        if (screen.availHeight != null)
        {
            topPos = ( (screen.availHeight-height-15) < 0) ? 15 : (screen.availHeight-height-15)/2;
        }
        else
        {
            topPos = 15;
        }

        if (screen.availWidth != null)
        {
            leftPos = ( (screen.availWidth-width) < 0) ? 0 : (screen.availWidth-width)/2;
        }
        else
        {
            leftPos = 15;
        }
        openWindow("simple_calculator.html", 1, 220, 160, topPos, leftPos);
    }
    
    function displayCalc()
    {
        //display selected calc
		if ( parent.main.document.form.calcu.value == 1 )
		{
        
			var result = confirm("Vous allez perdre toutes les données en cours! Désirez-vous continuer? Si oui, cliquez sur OK.");
			if( result == true )
			{
			var calc = parent.headerCalc.document.form.calc.options[parent.headerCalc.document.form.calc.selectedIndex].value;
			parent.main.location = calc;
	        }
			else if( result == false )
	        {
	        return false;
			} 
		}
		var calc = parent.headerCalc.document.form.calc.options[parent.headerCalc.document.form.calc.selectedIndex].value;
        parent.main.location = calc;	
    }
   

    function resetAll()
    {       
    	if ( parent.main.document.form.calcu.value == 1 )
		{
		
			var result = confirm("Vous allez perdre toutes les données en cours! Désirez-vous continuer? Si oui, cliquez sur OK.");
			if( result == true )
			{
			top.location.href = "default.aspx"
	        }
			else if( result == false )
	        {
	        return false;
			}      
		}
	top.location.href = "default.aspx"
	}

    function openWindow(address, nbrWindow, width, height, topPos, leftPos)
    {
        for ( var i = 0; i < nbrWindow; i++)
        {
            topPos = topPos + (i*25);
            leftPos = leftPos + (i*35);
            var popup = window.open(address,new Date().getTime(),"width=" + width + ",height=" + height + ",resizable=yes,scrollbars=yes,top=" + topPos+ ",left=" +leftPos+ ",menubar=no,toolbar=no,directories=no,location=no,status=no");

            if (popup.focus != null)
                popup.focus();
        }
    }
