function PopMyMsg(type,titre,info,action,actionRequired)
{
$("#list_popups").empty();
$(".BasPopup").remove();
$("#Overlay").remove();
//$("html").css("overflow","hidden");
$("#body").after("<div id='Overlay'></div>");
$("#list_popups").attr("title",'<p class="popup_title_p">'+titre+'</p>');
$("#list_popups").append("<span class='fleft' style='padding-top:5px;'>"+info+"</span>");
$("#list_popups").dialog({autoHeight:true,autoWidth:true,resizable:false,draggable:false,width:480,beforeclose:function(event,ui)
{
if(actionRequired&&(action!=null)){action.call();
}},close:function(event,ui){
	//$('html').css("overflow","scroll");
	$("#list_popups").empty();
$("#list_popups").dialog("destroy");
$("#Overlay").remove();
}});
if(type=='POP_ERROR')
{
$("#list_popups").prepend("<img src='"+URL_STATICS+"images/site/popup/Erreur.png' alt='Information' width='24' height='24' class='fleft' style='padding-right:10px;' />");
$("#list_popups").dialog('option','buttons',{"Ok":function(){if(action!=null){action.call();$("#list_popups").empty();
$("#list_popups").dialog("destroy");																																			$("#Overlay").remove();}else{$(this).dialog("close");																																								$("#list_popups").empty();																																																	$("#list_popups").dialog("destroy");																																														$("#Overlay").remove();}}});}
if(type=='POP_ACHAT'){$("#list_popups").dialog('option','buttons',{"Ok":function(){if(action!=null){action.call();
$("#list_popups").empty();$("#list_popups").dialog("destroy");$("#Overlay").remove();}else{$(this).dialog("close");$("#list_popups").empty();
$("#list_popups").dialog("destroy");$("#Overlay").remove();}}});}
if(type=='POP_INFO'){$("#list_popups").prepend("<img src='"+URL_STATICS+"images/site/popup/Information.png' alt='Information' width='24' height='24' class='fleft' style='padding-right:10px;' />");
$("#list_popups").dialog('option','buttons',{"Ok":function(){if(action!=null){action.call();
$("#list_popups").empty();$("#list_popups").dialog("destroy");
$("#Overlay").remove();
}else{$(this).dialog("close");$("#list_popups").empty();
$("#list_popups").dialog("destroy");$("#Overlay").remove();}}});}
if(type=='POP_VALIDATION'){$("#list_popups").prepend("<img src='"+URL_STATICS+"images/site/popup/Attention.png' alt='Information' width='24' height='24' class='fleft' style='padding-right:10px;' />");$("#list_popups").dialog('option','buttons',{"Ok":function(){if(action!=null){$("#list_popups").empty();$("#list_popups").dialog("destroy");$("#Overlay").remove();
																																																																																										//$("html").css("overflow","auto");
																																																																																														action.call();}else{$("#list_popups").empty();$("#list_popups").dialog("destroy");$("#Overlay").remove();																																																																																														/*$("html").css("overflow","auto");*/																																																																																												$(this).dialog("close");}},"Cancel":function(){																																																																																											/*$("html").css("overflow","auto");*/																																																																																									$("#list_popups").empty();																																																																																								$("#list_popups").dialog("destroy");																																																																																								$("#Overlay").remove();																																																																																														$(this).dialog("close");}});}
$("#list_popups:last").dialog('open');
//$("html").css("overflow","hidden");
$(".ui-dialog").after().append('<div class="BasPopup"></div>');}



function PopMyMsgYesNo(titre,info,action,actioncancel,oklabel,cancellabel){
	$("#list_popups").empty();
	$(".BasPopup").remove();
	$("#Overlay").remove();
	//$("html").css("overflow","hidden");
	$("#body").after("<div id='Overlay'></div>");
	$("#list_popups").attr("title",'<p class="popup_title_p">'+titre+'</p>');
	$("#list_popups").append("<span class='fleft' style='padding-top:5px;'>"+info+"</span>");/*$('html').css("overflow","hidden");*/
	$("#list_popups").dialog({autoHeight:true,autoWidth:true,resizable:false,draggable:false,width:480,beforeclose:function(event,ui){
		if((action!=null)){action.call();}},close:function(event,ui){
//			$('html').css("overflow","scroll");
			$("#list_popups").empty();
			$("#list_popups").dialog("destroy");
			$("#Overlay").remove();
		}});
			$("#list_popups").prepend("<img src='"+URL_STATICS+"images/site/popup/Attention.png' alt='Information' width='24' height='24' class='fleft' style='padding-right:10px;' />");
			$("#list_popups").dialog('option','buttons',{

			"{cancel}":function()
                        {
				//$("html").css("overflow","auto");
				$("#list_popups").empty();
				$("#list_popups").dialog("destroy");
				$("#Overlay").remove();

                         	if(actioncancel!=null)actioncancel.call();
                                else $(this).dialog("close");

			},

			"{ok}":function()
                        {

				$("#list_popups").empty();
				$("#list_popups").dialog("destroy");
				$("#Overlay").remove();
				//$("html").css("overflow","auto");

                                if(action!=null)action.call();
                                else $(this).dialog("close");
			}

                            }
                        );

		$("#list_popups:last").dialog('open');
		//$("html").css("overflow","hidden");
		$(".ui-dialog").after().append('<div class="BasPopup"></div>');

                $(".ui-dialog-buttonpane button").each(function(index)
                {
                    switch( $(this).html() )
                    {
                        case "{ok}": $(this).html(oklabel); break;
                        case "{cancel}": $(this).html(cancellabel); break;
                    }
                });

}

function FormValidator()
{this.FormName='';this.NbFields=0;this.Fields=new Array();this.SetFormName=function(FormName)
{this.FormName=FormName;}
this.InsertField=function(FieldName,ErrFieldName)
{this.Fields[this.NbFields]=new Array();this.Fields[this.NbFields]['FieldName']=FieldName;this.Fields[this.NbFields]['ErrFieldName']=ErrFieldName;this.NbFields=this.NbFields+1;}
this.UpdateForm=function(Response,InvalidFieldAction,ValidFieldAction)
{for(var i=0;i<this.NbFields;i++)
{var CurrentField_ID='#'+this.Fields[i]['FieldName'];var CurrentErrField_ID='#'+this.Fields[i]['ErrFieldName'];var CurrentErrMsg=null;var CurrentErrMsg=Response[this.Fields[i]['FieldName']];$(CurrentErrField_ID).empty();if(CurrentErrMsg)
{$(CurrentErrField_ID).fadeIn("slow");$(CurrentErrField_ID).append(CurrentErrMsg);if(InvalidFieldAction!=null)
{InvalidFieldAction(CurrentField_ID);}}
else
{if(ValidFieldAction!=null)
{ValidFieldAction(CurrentField_ID);}}}}
this.CleanForm=function(FieldAction)
{for(var i=0;i<this.NbFields;i++)
{var CurrentField_ID='#'+this.Fields[i]['FieldName'];var CurrentErrField_ID='#'+this.Fields[i]['ErrFieldName'];$(CurrentErrField_ID).empty();$(CurrentField_ID).removeClass('form_alert');$(CurrentField_ID).removeClass('form_valid');$(CurrentField_ID).addClass('form_default');if(FieldAction!=null)
{FieldAction(CurrentField_ID);}}}}