// Procédures globales du projet
function PGNJAUGEMESSAGE_PGNRENVOYERARRETTRT( )
{
	{
	gArretTrtJauge=true;
	clWDAJAXMain.AJAXExecuteAsynchrone("PGA_RENVOYER_ARRET_TRT","", "",gArretTrtJauge);
	gArretTrtJauge=false;
}
}
function PGNJS_GFI_ON(pNomGfi,pBefore,pTop,pLeft,pWidth,pHeight)
{

	var xTop	= pTop?pTop:0;
	var xLeft	= pLeft?pLeft:0;
	var xWidth	= pWidth?pWidth:"100%";
	var xHeight	= pHeight?pHeight:"100%";
	var xNomGfi	= pNomGfi?pNomGfi:"gfi";
	var xBefore = pBefore?pBefore:$("body").children("table");
	
	if ($("#"+xNomGfi).length) {
		
		$("#"+xNomGfi).css("top",xTop);
		$("#"+xNomGfi).css("left",xLeft);
		$("#"+xNomGfi).css("width",xWidth);
		$("#"+xNomGfi).css("height",xHeight);
		
		if ($("#"+xNomGfi).css("display")=="none") { if ($.browser.msie) { $("#"+xNomGfi).css("display","block") } else { $("#"+xNomGfi).fadeTo("slow",0.3) } }
					
	} else {

		var xGFI = "<div id='"+xNomGfi+"' class='ui-widget-overlay' style='top: "+xTop+"; left: "+xLeft+"; width: "+xWidth+"; height: "+xHeight+"; position: absolute; z-index: 1010; display: none;'></div>";
				
		$(xGFI).insertBefore(xBefore);
		if ($.browser.msie) { $("#"+xNomGfi).css("display","block") } else { $("#"+xNomGfi).fadeTo("slow",0.3) };
			
	}
	
}
function PGNJS_JAUGE_OFF()
{
	
	if ($.browser.msie) { $("#gfi").css("display","none") } else { $("#gfi").fadeOut("slow") };
	if ($.browser.msie) { $("#jauge").css("display","none") } else { $("#jauge").fadeOut("slow") };
	
}
function PGNJS_JAUGE_ON(pTexte,pIndiceJauge,pBoutonArret)
{
		
	if ($("#gfi").length) {
		
		$("#gfi").css("top",0);
		$("#gfi").css("left",0);
		$("#gfi").css("width","100%");
		$("#gfi").css("height","100%");
		
		$("#bbStopTrt").css("display","none");
		$("#jauge").find("span.ui-dialog-title").text(pTexte);
				
		if ($("#gfi").css("display")=="none") { if ($.browser.msie) { $("#gfi").css("display","block") } else { $("#gfi").fadeTo("slow",0.3) } }
		if ($("#jauge").css("display")=="none") { if ($.browser.msie) { $("#jauge").css("display","block") } else { $("#jauge").fadeTo("slow",1) } }
		
		if (!pIndiceJauge) {
			$("#jaugeDia").progressbar({ value: 100});
			$("#jaugeDia").find(".ui-progressbar-value").html("");
		} else {
			$("#jaugeDia").progressbar({ value: parseInt(pIndiceJauge,10)});
			$("#jaugeDia").find(".ui-progressbar-value").html("<div style='position: absolute; height: 21px; width: 250px; color: rgb(90, 90, 90); font-size: 9pt; line-height: 21px;'>"+parseInt(pIndiceJauge,10)+"%</div>")
		}
		
		if (pBoutonArret) $("#bbStopTrt").css("display","block");
		
	} else {
		
		var xGFI = "<div id='gfi' class='ui-widget-overlay' style='width: 100%; height: 100%; position: absolute; z-index: 1010; display: none;'></div>";
		
		var xJauge ="<div id='jauge' style='z-index: 1011; position: absolute; height: 100%; width: 100%; display: none;'>";
		xJauge += "<table style='width: 100%; height: 100%;' align='center'>";
		xJauge += "<tbody>";
		xJauge += "<tr>";
		xJauge += "<td style='vertical-align: middle;' align='center'>";
		xJauge += "<div class='ui-widget ui-widget-content ui-corner-all' style='margin: auto; height: 100px; width: 300px;'>";
		xJauge += "<div class='ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix' style='height: 30px;' align='left'>";
		xJauge += "<div style='position: absolute; overflow: hidden; width: 265px; white-space: nowrap;'><span class='ui-dialog-title' style='padding: 5px; line-height: 30px;'>"+pTexte+"</span></div>";
		xJauge += "<button onclick='PGNJS_STOP_TRT();' style='float: right; margin: 5px; display: none; height: 20px; width: 20px;' id='bbStopTrt'>Arrêter le traitement</button>";
		xJauge += "</div>";
		xJauge += "<table style='width: 100%; height: 70px;'><tbody>";
		xJauge += "<tr><td style='vertical-align: middle;' align='center'>";
		xJauge += "<div id='jaugeDia' style='width: 250px; margin: auto; text-align: center; line-height: 21px;'>";
		xJauge += "</div>";
		xJauge += "</td></tr>";
		xJauge += "</tbody></table>";
		xJauge += "</div>";
		xJauge += "</td>";
		xJauge += "</tr>";
		xJauge += "</tbody>";
		xJauge += "</table>";
		xJauge += "</div>";
		
		$(xGFI).insertBefore($("body").children("table"));
		$(xJauge).insertBefore($("body").children("table"));
		
		$("#bbStopTrt").button({
			icons: { primary: "ui-icon-closethick" },
			text: false
		});
		
		if ($.browser.msie) { $("#gfi").css("display","block") } else { $("#gfi").fadeTo("slow",0.3) };
		if ($.browser.msie) { $("#jauge").css("display","block") } else { $("#jauge").fadeTo("slow",1) };
						
		if (!pIndiceJauge) {
			$("#jaugeDia").progressbar({ value: 100});
			$("#jaugeDia").find(".ui-progressbar-value").html("");
		} else {
			$("#jaugeDia").progressbar({ value: parseInt(pIndiceJauge,10)});
			$("#jaugeDia").find(".ui-progressbar-value").html("<div style='position: absolute; height: 21px; width: 250px; color: rgb(90, 90, 90); font-size: 9pt; line-height: 21px;'>"+parseInt(pIndiceJauge,10)+"%</div>")
		}
		
		if (pBoutonArret) $("#bbStopTrt").css("display","block");
		
		$("#jaugeDia").children().css("background-image","url(/DOMINO_WEB_WEB/CSS/ui/images/pbar-ani.gif)");
		
	}
	
}
function PGNJS_GFI_OFF(pNomGfi)
{
	
	var xNomGfi	= pNomGfi?pNomGfi:"gfi";
	
	if ($.browser.msie) { $("#"+xNomGfi).css("display","none") } else { $("#"+xNomGfi).fadeOut("slow") };
	
}
function PGNJS_STOP_TRT()
{

	if (confirm("Voulez-vous stopper le traitement en cours ?")) PGNJAUGEMESSAGE_PGNRENVOYERARRETTRT();	
	
}

function PGNJS_CONFIRMER(pMessageHTML,pProcedureOk,pProcedurePasOk,pTitle)
{

	$("#DIALOG_CONFIRMER").dialog('destroy');

	if (pTitle == undefined)
	pTitle = "Confirmation";
	
	if (pProcedureOk == undefined)
		{	pProcedureOk = ""; }
		else
		{	pProcedureOk += "();"; }
	
	if (pProcedurePasOk == undefined)
		{	pProcedurePasOk = ""; }
		else
		{	pProcedurePasOk += "();"; }

	if ( $("#DIALOG_CONFIRMER").length == 0 )
	{
		$('body').append("<style>font.bold {font-weight:bold;} font.red {color:red;} font.blue{color:blue;}</style><div id='DIALOG_CONFIRMER'></div>");
	}
	
	$("#DIALOG_CONFIRMER").html(pMessageHTML);
	
	$("#DIALOG_CONFIRMER").dialog({
		autoOpen: false,
		title:pTitle,
		minHeight:100,
		maxWidth:400,
		modal:true,
		resizable:false,
		close: function(event, ui) { eval(pProcedurePasOk) },
		buttons:{"Oui" : function(){ eval(pProcedureOk+" $(this).dialog('close');")}, "Non": function(){ eval(pProcedurePasOk+" $(this).dialog('close');") } }
	});
	
	$("#DIALOG_CONFIRMER").dialog('open');
	
}

function PGNJS_INFO(pMessageHTML,pTitle,pProcedureOk)
{
	$("#DIALOG_INFO").dialog('destroy');

	if (pTitle == undefined)
	pTitle = "Information";
	
	if (pProcedureOk == undefined)
	{	pProcedureOk = ""; }
	else
	{	pProcedureOk += "();"; }

	if ( $("#DIALOG_INFO").length == 0 )
	{
		$('body').append("<style>font.bold {font-weight:bold;} font.red {color:red;} font.blue{color:blue;}</style><div id='DIALOG_INFO'></div>");
	}
	
	$("#DIALOG_INFO").html(pMessageHTML);
	
	$("#DIALOG_INFO").dialog({
		autoOpen: false,
		title:pTitle,
		minHeight:100,
		maxWidth:400,
		modal:true,
		resizable:false,
		close: function(event, ui) { eval(pProcedureOk) },
		buttons:{"OK" : function(){ eval(pProcedureOk+" $(this).dialog('close');") } }
	});
	
	$("#DIALOG_INFO").dialog('open');
}

