var MessageWindow = new Class({            

	initialize: function(options) {
		this.setOptions({
			"travelDistance": 100,
			"containerWidth": 300,
			"containerHeight": "auto",
			"containerTop": 300,
			"containerClass": "messageWindow"
		}, options);
	
		this.timer = 0;
	
		this.container = new Element('div', { 
			"opacity": 0,
			"styles": {
				"display": "none",
				"position": "absolute",
				"z-index": 999,
				"width": this.options.containerWidth,
				"height": this.options.containerHeight,
				"top": this.options.containerTop
			},
			"class": this.options.containerClass
		}),
		
		this.message = new Element('div', {
			"opacity": 0 
		}).injectInside(this.container),
		
		this.fx = new Fx.Styles(this.container, {
			"duration": 400
		});

		this.fx.set({
			"opacity": 0,
			"top": this.options.containerTop
		});
		
		this.container.injectInside($(document.body));
	},

	show: function(text) {
		$clear(this.timer);
		this.container.setStyles({
			"top": this.options.containerTop,
			"display": "block",
			"left": (window.getWidth() / 2) - (this.options.containerWidth / 2)
		});
		this.message.setHTML(text);
		if(this.container.getStyle("opacity") != 1){
			this.fx.start({ 
				"opacity": [0, 1] 
			});
		}
		this.timer = this.hide.delay(5000, this);
	},

	hide: function() {              		        		
		this.fx.start({
			"opacity": 0,
			"top": this.options.containerTop - this.options.travelDistance
		});
	}

});

MessageWindow.implement(new Options);