function splash_Engine( wnd ) {

	this.opacity = 50;
	this.zIndex = 10;
	this.queue = new Object();

	this.documentRoot = document.body;

    this.active = false;
    this.wnd = wnd;

};

splash_Engine.prototype = {

	show: function(p, dim, windowName) {

        if ( this.active ) {
            return false;
        }

        this.active = true;

		var w,h;
		var test1 = dim.scrollHeight;
		var test2 = dim.offsetHeight

		// all but Explorer Mac
		if (test1 > test2) 
		{
			w = dim.scrollWidth;
			h = dim.scrollHeight;

		// Explorer Mac; would also work in Explorer 6 Strict, Mozilla and Safari
		} else {
			w = dim.offsetWidth;
			h = dim.offsetHeight;
		}

		var splash = document.createElement('div');
		splash.setAttribute('id', windowName + 'splash');
		splash.style.left = 0;
		splash.style.top = 0;
		splash.style.width = w+'px';
		splash.style.height = h+'px';

        splash.style.visibility = 'visible';
		splash.style.position = 'absolute';
		splash.style.backgroundColor = '#edf2fc';

		splash.style.zIndex = getZIndex();

		splash.style.opacity = (this.opacity / 100);
		splash.style.MozOpacity = (this.opacity / 100);
		splash.style.KhtmlOpacity = (this.opacity / 100);
		splash.style.filter = "alpha(opacity=" + this.opacity + ")"; 

		p.appendChild(splash);

		this.queue[windowName + 'splash'] = splash;

//        this.hideShowSelects( true );

	},

	remove: function(p, windowName) {

        if ( !this.active ) {
            return false;
        }

		var splash = this.queue[windowName + 'splash'];
        p.removeChild(splash);

        this.hideShowSelects( false );

        this.active = false;

	},

    hideShowSelects: function( bHover ) {

        if ( !browser.isIE ) {
            return;
        }

        if ( this.wnd.isParent() != null ) {
            return;
        }

		var els = this.documentRoot.getElementsByTagName('select')
        var i;

		for ( i = 0; i < els.length; i++ ) {
            els[i].style.visibility = bHover ? 'hidden' : 'visible';
		};

    }

}

var splash = new splash_Engine();
