
function showOverlay( title, src ) {
	_overlay.setTitle( title );
	_overlay.setSource( src );
	_overlay.fadeIn();
}

if ( typeof MooTools == 'object' ) {

	var _overlay_Main = new Class( {

		initialize: function() {

			this.divOverlay = new Element( 'div', { 'id': 'overlay_DivMain' } );
			this.divOverlay.injectInside( document.body );
			this.divOverlayInfo = new Element( 'div', { 'id': 'overlay_DivInfo' } );
			this.divOverlayInfo.injectInside( document.body );
			this.AClose = new Element( 'a', { 'id': 'overlay_AClose', 'href': 'javascript:_overlay.fadeOut()' } );
			this.AClose.injectInside( document.body );
			this.AClose.set( 'text', 'X' );
			this.pTitle = new Element( 'p', { 'id': 'overlay_PTitle' } );
			this.pTitle.injectInside( this.divOverlayInfo );
			this.Frame = new Element( 'iframe', { 'id': 'overlay_Frame', 'frameborder': 0 } );
			this.Frame.injectInside( this.divOverlayInfo );
		},

		setTitle: function( title ) {
			this.pTitle.set( 'text', title );
		},

		setSource: function( src ) {
			this.Frame.src = src;
		},

		fadeIn: function() {
			_overlay.divOverlay.set( 'styles', { 'display': 'block', 'opacity': 0 } );
			var fx = new Fx.Tween( _overlay.divOverlay, { 'property': 'opacity', onComplete: _overlay.fadeIn2 } );
			fx.start( 0.7 );
		},

		fadeIn2: function() {
			_overlay.AClose.style.left = ( window.getSize().x - 53 ) + 'px';
			_overlay.AClose.style.top = '40px';
			_overlay.AClose.style.display = 'block';
			_overlay.divOverlayInfo.style.width = ( window.getSize().x - 100 ) + 'px';
			_overlay.divOverlayInfo.style.height = ( window.getSize().y - 100 ) + 'px';
			_overlay.Frame.style.width = ( window.getSize().x - 100 ) + 'px';
			_overlay.Frame.style.height = ( window.getSize().y - 100 ) + 'px';
			_overlay.divOverlayInfo.set( 'styles', { 'display': 'block', 'opacity': 0 } );
			var fx = new Fx.Tween( _overlay.divOverlayInfo, { 'property': 'opacity' } );
			fx.start( 1 );
		},

		fadeOut: function() {
			_overlay.AClose.style.display = 'none';
			var fx = new Fx.Tween( _overlay.divOverlayInfo, { 'property': 'opacity', onComplete: _overlay.fadeOut2 } );
			fx.start( 0 );
		},

		fadeOut2: function() {
			var fx = new Fx.Tween( _overlay.divOverlay, { 'property': 'opacity', onComplete: _overlay.fadeDone } );
			fx.start( 0 );
			_overlay.setSource( '' );
		},

		fadeDone: function() {
			_overlay.divOverlay.style.display = 'none';
			_overlay.divOverlayInfo.style.display = 'none';
		}

	} );

	var _overlay;

	window.addEvent( 'domready', function() { _overlay = new _overlay_Main(); }  );

}
