var panel = new Class({
	setOptions: function(options) {
		this.options = {
			fxDuration: 600,
			displayDuration: 2000,
			parentObj: document.body
		}
		Object.extend(this.options, options || {});
	},    
 
	initialize: function(message, options) {
		this.setOptions(options);
		this.message = message;
		this.container = new Element('div', { 'id': 'panel'}).setOpacity(0).injectInside(this.options.parentObj);
		this.content = new Element('div', { 'id': 'text'}).setOpacity(0).injectInside(this.container);
		this.timer = null;
 		this.fxShow = new Fx.Elements([this.container, this.content], { duration: this.options.fxDuration, link: 'cancel'});
		this.fxHide = new Fx.Elements([this.container, this.content], { duration: this.options.fxDuration, link: 'cancel', onComplete: this.deleter.bind(this) });
		this.show();
 
	},
 
	show: function() {
		this.fxShow.start({ 0: { opacity: [0, 0.6] }, 1: { opacity: [0, 1] } });	
		this.content.setHTML(this.message);
		this.options.parentObj.addEvent('click', this.hide.bind(this));
		this.options.parentObj.addEvent('keyup', this.hide.bind(this));
		this.timer = this.hide.delay(this.options.displayDuration, this);
	
	},
 
	hide: function() {
		this.timer = $clear(this.timer); //nevermind on waiting to init hide if the events occured
		this.options.parentObj.removeEvents('click');
		this.options.parentObj.removeEvents('keyup');
		this.fxHide.start({'0': {'opacity': [0] }, '1': {'opacity': [0] }});

	},
 
	deleter: function() {
		this.container.setOpacity(0);
		this.content.setOpacity(0);
		this.container.remove();
		if (!window.ie) delete this;
	}
});

function showpanel(message){
	 var mp = new panel(message);
}