/*  $Id$
 *  
 *  This file is part of the Jamiedia Toolkit.
 *  Copyright 2007/2008, Jamiedia Ltd., http://www.jamiedia.co.uk
 *  
 *  This file may not be used or (re)distributed for any other
 *  purposes than a commercial deployment by Jamiedia of a system
 *  based on the Jamiedia Toolkit. No modifications may be made to
 *  this file by anyone, except for individuals working for Jamiedia Ltd.
 *
 *  File description:
 *
 */ 

var Overlay = {
    initDone: false,
    overlay: null,
    container: null,
    content: null,
    initialise: function() {
        // Only initialise once
        if (this.initDone)
            return;
        
        this.overlay = $('#overlay');
        this.container = $('#overlay-container');
        this.content = this.container.find('div.content');
        
		if ($.browser.msie) {
			this.overlay.height($(window).height());
		}
		
        // Bind the close link to hide the overlay
       $('a.close-link, #overlay').click(function() {
         Overlay.hide();
         return false; 
       });
       
       this.initDone = true;
    },
    showLoader: function() {
        this.content.addClass('loader');
    },
    hideLoader: function() {
        if (this.content.hasClass('loader'))
            this.content.removeClass('loader');
    },
    show: function(heading) {
        this.content.html('');
        this.showLoader();
        this.container.find('h3').html(heading);
        
        this.overlay.show();
        this.container.show();
    },
    hide: function() {
        this.overlay.hide();
        this.container.hide();
    },
    setContent: function(data) {
        this.hideLoader();
        this.container.find('div.content').html(data);
    }
};
