DietDog.ModalShim = new Class({
	Implements: Options,
	options:{
		opacity:0.5,
        'class' : 'modal-shim',
//		'background-color':'#ccf',
		'z-index':1000,
        'insertion-element' : null
	},
	initialize:function(options){
		this.setOptions(options);

		var shim;
		var that = this;

        var elem = this.options['insertion-element'] || $(document.body);

        function resize(){
            shim.setStyles({
					height:'100%',
                    'min-height' : elem.getScrollSize().y
            });
        }
		function show(){

			shim = new Element('div',{
                'class': that.options['class'],
				styles : {
//					'background-color' : that.options['background-color'],
					opacity: that.options.opacity,
					width:'100%',
					height:'100%',
                    'min-height' : elem.getScrollSize().y,
					position: 'absolute',
					top: 0,
					left: 0,
					'z-index':that.options['z-index']
				}
			}).inject( elem );
            window.addEvent('resize',resize);
		}

		function hide(){
            window.removeEvent('resize',resize);
			if(shim)shim.dispose();
		}

		this.dispose = function(){
			hide();
			delete that;
		}

		show();
	}
});
