﻿
var Overlay;

Overlay = {
    Show:function( ){
        $("#divOverlay").css( "display", "" );
    
        CenterElementVertically( $("#divOverlayUi") );
    }, 
    
    Hide:function( ){
        $("#divOverlay").css( "display", "none" );
    }, 
    
    LoadUi:function( theLocation, theCallbackMethod ){
        var theCallbackWrapperMethod;
        
        
        Overlay.Clear( );
        Overlay.Show( );
        
        theCallbackWrapperMethod = function( theResponseText, theStatus, theRequest ){
            theCallbackMethod( theResponseText, theStatus, theRequest );
            
            Overlay.Show( );
        }
        
        $("#divOverlayUi").load( theLocation, theCallbackWrapperMethod );
    },
    
    Clear:function( ){
        $("#divOverlayUi").html( "" );
    }
};


$(document).ready( function(){
    CenterElementVertically( $("#divOverlayUi") );
    
    $(window).resize( function(){
        CenterElementVertically( $("#divOverlayUi") );
    });
    
    $(window).scroll( function(){
        CenterElementVertically( $("#divOverlayUi") );
    });
});