statusText = {
	bars: new Array (),

	set: function (text) {
		$("status").innerHTML = text;
	},

	hide: function () {
		$("status").innerHTML = '';
	},

	info: function (text) {
		this.bars.push (new StatusBar ("info", text));
	},

	ok: function (text) {
		this.bars.push (new StatusBar ("true", text));
	},

	error: function (text) {
		this.bars.push (new StatusBar ("error", text));
	},

	hide2: function (id) {
		for (var i = 0; i < this.bars.length; i++) {
			if (this.bars[i].id == id) {
				this.bars[i].hide ();
				return;
			}
		}
	},

	remove2: function (id) {
		for (var i = 0; i < this.bars.length; i++) {
			if (this.bars[i].id == id) {
				this.bars.splice (i, 1);
				return;
			}
		}
	}
}

StatusBar = Class.create ();
StatusBar.prototype = {
	initialize: function (type, text) {
		this.id = "statusbar" + Math.uniqId ();
		var id = this.id;
		var divnode = document.createElement ("div");
		$(divnode).setid (this.id).addClassName ("statusbar").addClassName (type);
		$(divnode).innerHTML = '<img src="static/images/icons/' + type + '.png" alt="" class="icon" /> ' + text;
		$("body").appendChild (divnode);
		$(divnode).setOuterWidth ($("header").getOuterWidth ());
		var pos = $("header").getPosition ();
		$(divnode).setPosition ([pos[0], (-1 * $(divnode).getOuterHeight ())]);

		this.animator = new Animator ({
			effect: AnimatorEffects.down,
			action: function (y) {
				var pos = $("header").getPosition ();
				if (divnode != undefined) $(divnode).setPosition ([pos[0], ((-1 * $(divnode).getOuterHeight ()) + ($(divnode).getOuterHeight () * y))]).setStyle ({ opacity: (y * 0.8) });
			},
			onComplete: function () { window.setTimeout ("statusText.hide2 (\"" + id + "\");", 5000); }
		});
	},

	hide: function () {
		var id = this.id;
		var divnode = $(this.id);
		this.animator = new Animator ({
			effect: AnimatorEffects.up,
			action: function (y) {
				var pos = $("header").getPosition ();
				$(divnode).setPosition ([pos[0], (-1 * ($(divnode).getOuterHeight () * y))]).setStyle ({ opacity: ((1 - y) * 0.8)});
			},
			onComplete: function () { $(divnode).remove (); statusText.remove2 (id); }
		});
	}
}

