//*****************************************************************************
//
// Fonctions d'affichage des différentes boîtes de dialogue modales, à savoir :
//       - alert    - boîte de dialogue affichant un message et le bouton
//                    Fermer.
//
// Date de création      : 18/03/2002
// Date de modification  :
// Auteur                : Mohammed Alkass.
// Version 1.0
//
// ATTENTION à ne pas oublier d'inclure le fichier dans la jsp à l'aide de
// la balise : <script language=JavaScript src="js/dialog.js"></script>
//
// Packages js à inclure:   - Aucun.
//
//*****************************************************************************

    var sJspAlert	= "/jsp/dialog/dialog_alert.jsp";
    var sJspConfirm	= "/jsp/dialog/dialog_confirm.jsp";
    var sJspPassword= "/jsp/dialog/dialog_alert.jsp";
    var sJspPrompt	= "/jsp/dialog/dialog_prompt.jsp";




    //*************************************************************************
    //
    // Fonction chargée d'afficher une boîte de dialogue modale de type Alert
    //
    // @param sMessage   Le message à afficher.
    //
    //*************************************************************************

    function dialog_alert(sMessage){

	// Modif SRO - 22/10/02 - Affichage conditionnel des messages.
	// Un test est fait sur le n° de version du navigateur. Si la version de celui-ci
	// est supérieure ou égale à 5.5, on affiche avec des parametres differents.
		var sFeatures = "";
		var versionIE=navigator.appVersion;
		versionIE=versionIE.substring(22,25);
		if (eval(versionIE) >= 5.5){
        		sFeatures = "dialogHeight:160px;"+
                        	"dialogWidth: 400px;"+
                        	"center: Yes;"+
                        	"help: no;"+
                        	"resizable: no;"+
                        	"status: no;" +
                        	"unadorned: no;" +
                        	"edge:sunken; " +
                        	"scroll:no";
		}else{
        		sFeatures = "dialogHeight:12em;"+
                        	"dialogWidth: 25em;"+
                        	"center: Yes;"+
                        	"help: no;"+
                        	"resizable: no;"+
                        	"statusBar: no;" +
                        	"unadorned: no;" +
                        	"edge:sunken; " +
                        	"scroll:no";
		}
                        

        return window.showModalDialog(sJspAlert, sMessage, sFeatures);

    }

    function dialog_prompt(sTitle, sLabel, sRows){
		var target=sJspPrompt;
		target+="?promptTitle="+sTitle;
		target+="&promptLabel="+sLabel;
		target+="&promptValue="+"";
		target+="&promptRows="+sRows;
		target+="&promptBack="+"backPrompt";		
    	window.open(target, 'SearchWindow', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height=300, width=400, left=100, top=5').focus;
    }

    function dialog_promptValue(sTitle, sLabel, sValue, sRows){
		var target=sJspPrompt;
		target+="?promptTitle="+sTitle;
		target+="&promptLabel="+sLabel;
		target+="&promptValue="+sValue;
		target+="&promptRows="+sRows;
		target+="&promptBack="+"backPrompt";		
    	window.open(target, 'SearchWindow', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height=300, width=400, left=100, top=5').focus;
    }

    function dialog_promptForcer(sTitle, sLabel, sValue, sRows){
		var target=sJspPrompt;
		target+="?promptTitle="+sTitle;
		target+="&promptLabel="+sLabel;
		target+="&promptValue="+sValue;
		target+="&promptRows="+sRows;
		target+="&promptBack="+"backPromptMemoForcer";		
    	window.open(target, 'SearchWindow', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height=300, width=400, left=100, top=5').focus;
    }

    function dialog_promptAuto(sTitle, sLabel, sRows){
		var target=sJspPrompt;
		target+="?promptTitle="+sTitle;
		target+="&promptLabel="+sLabel;
		target+="&promptValue="+"";
		target+="&promptRows="+sRows;
		target+="&promptBack="+"backPromptAuto";		
    	window.open(target, 'SearchWindow', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height=300, width=400, left=100, top=5').focus;
    }

    function dialog_promptManual(sTitle, sLabel, sRows){
		var target=sJspPrompt;
		target+="?promptTitle="+sTitle;
		target+="&promptLabel="+sLabel;
		target+="&promptValue="+"";
		target+="&promptRows="+sRows;
		target+="&promptBack="+"backPromptManual";		
    	window.open(target, 'SearchWindow', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height=300, width=400, left=100, top=5').focus;
    }

    //*************************************************************************
    //
    // Fonction chargée d'afficher une boîte de dialogue modale de type Alert
    //
    // @param sMessage   Le message à afficher.
    //
    //*************************************************************************

    function dialog_confirm(sMessage){

	// Modif SRO - 22/10/02 - Affichage conditionnel des messages.
	// Un test est fait sur le n° de version du navigateur. Si la version de celui-ci
	// est supérieure ou égale à 5.5, on affiche avec des parametres differents.
		var sFeatures = "";
		var versionIE=navigator.appVersion;
		versionIE=versionIE.substring(22,25);
		if (eval(versionIE) >= 5.5){
    		sFeatures = "dialogHeight:160px;"+
                    	"dialogWidth: 400px;"+
                    	"center: Yes;"+
                    	"help: no;"+
                    	"resizable: no;"+
                    	"status: no;" +
                    	"unadorned: no;" +
                    	"edge:sunken; " +
                    	"scroll:yes";
		}else{
    		sFeatures = "dialogHeight:12em;"+
                    	"dialogWidth: 25em;"+
                    	"center: Yes;"+
                    	"help: no;"+
                    	"resizable: no;"+
                    	"statusBar: no;" +
                    	"unadorned: no;" +
                    	"edge:sunken; " +
                    	"scroll:yes";
		}
                        

        return window.showModalDialog(sJspConfirm, sMessage, sFeatures);

    }
   
function dialog_showMsg()    {
	var oPopup=window.createPopup();
	var oPopBody=oPopup.document.body;
	oPopBody.style.backgroundColor="#FFFFFF";
	oPopBody.style.border="solid black 2px";
	oPopBody.innerHTML="<div align='center'><font face='Arial, Helvetica, sans-serif' color='#666666'>Connexion en cours...</font></div>";
	var height=0;
	var width=0;
	try {
		height=document.body.clientHeight;
		width=document.body.clientWidth;
	}catch(ex){
		height=768;
		width=1024;
	}
	oPopup.show(width/2-125,height/2-12,250,24, document.body);
}

/**
 * affichage d'une popup
 *
 */
function dialog_showPopup(jsp) {
	dialog_showPopup(jsp, 700, 600)
}
function dialog_showPopup(jsp, width, height) {
	winModalWindow = window.open(jsp, '', 'toolbar=no, status=no, menubar=no, scrollbars=no, directories=no, localisation=no, resizable=no, height='+height+', width='+width+',left=100, top=5');
	//winModalWindow = window.open(jsp, '', '');
}
// Fin du package JavaScript 'dialog.js'.