﻿var OverlayFix=new Class({

	initialize:function(el) {
		this.element=$(el);
		if (Browser.Engine.trident4){
			this.element.addEvent("trash",this.destroy.bind(this));
			this.fix=new Element("iframe",{
				properties:{
					frameborder:"0",
					scrolling:"no",
					src:"javascript:false;"
				},
				styles:{
					position:"absolute",
					border:"none",
					display:"none",
					filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
				}
			}).inject(this.element,"after");
		}
	},

	show:function() {
		var coors=this.element.getCoordinates();
		if (coors.width==0) return;
		if (this.fix) this.fix.setStyles($extend(
			{left:0,top:0,width:coors.width-2,height:coors.height},{
				display:"",
				zIndex:(this.element.getStyle("zIndex") || 1) - 1
			}));
		return this;
	},

	hide:function() {
		if (this.fix) this.fix.setStyle("display","none");
		return this;
	},

	destroy:function() {
		this.fix.remove();
	}

});
