function WaitPage(container)
{
    var m_Left  = 0;
    var m_Top   = 0;
	var m_Width = 0;
	var m_Height= 0;
	var m_Page  = null;
	var m_Id    = "waitpage_modal";
	var m_IdParent = null;
	var m_WaitPage = null;
	
	this.Wait = function() {
	        
	    if ( m_WaitPage ) {
	        m_WaitPage.css("width", m_Width)
	            .css("height" , m_Height)
	            .css("display", "block")
	            .css("left", m_Left)
	            .css("top", m_Top);
	       $("#wait_loading").css("left", (m_Width/2)-40)
	            .css("top", m_Top-25);	            
	    }
	},
	
	this.Hide = function() {
	    if ( m_WaitPage ) {
	        m_WaitPage.css("width", 0)
	            .css("height" , 0)
	            .css("display", "none")
	            .css("left", 0)
	            .css("top", 0);
	    }	
	},
	
	Init = function(container) {
        
        m_IdParent = ( null == container  ? "pages" : container);

        if ( (null == m_Page) || (m_Page.Id != m_IdParent) ) {
            m_Page = $("#"+m_IdParent);
            m_Width  = m_Page.outerWidth();
            m_Height = m_Page.outerHeight();
            var position = m_Page.position();
            m_Left   = position.left;
            m_Top    = position.top;
            Create();
        }
    },
    
    Create = function() {
        
        var me = $("#"+m_Id);
        if ( null != me ) me.remove();
        
        var html = '<div id="' + m_Id + '" class="wait_modal" style="width:0; height: 0; z-index: 9998;" >';
        html += '<div id="wait_loading" style="position: absolute;z-index: 9999;" >';
        html += '<div id="wait_loading_text" >Chargement</div>';
        html += '<p align="center" style="margin:5px;padding:0;">';
        html += '<img alt="Chargement" src="images/load.gif" />';
        html += '</p></div></div>';
        m_Page.after(html);
        m_WaitPage = $("#"+m_Id);
    },
    
    Init(container);
}

