var NotificationBar = {

	in_progress: false,
	is_shown: false,
	element: false,

	init: function(element, text) {
		if ($('message_bar_text')) {
			$('message_bar_text').innerHTML = text;

			this.element     = $(element);
			this.in_progress = false;
			this.in_shown    = false;
			new PeriodicalExecuter(function(pe){NotificationBar.process(pe);}, 5);
			this.process();

		} else {
			alert('"message_bar_text" is not found!');
		}
	},

	process: function(pe) {

		if (!this.in_progress){
			if(this.is_shown){
				this.up();
				if(pe) pe.stop();
			}else {
				this.down();
			}
		}
	},

	down: function() {
		this.in_progress = true;
		element = this.element;
		Effect.SlideDown(element, { duration: 1.0, afterFinish: function() {NotificationBar.in_progress=false;NotificationBar.is_shown=true}});
	},

	up: function() {
		this.in_progress = true;
		element = this.element;
		Effect.SlideUp(element, { duration: 1.0, afterFinish: function() {NotificationBar.in_progress=false;NotificationBar.is_shown=false}});
	}

}
