/** vim:se ai lbr sts=4 sw=4 ts=4: **/
/**
 * TinyBox v.0.2.2 - a tiny library for overlaying content over a page
 *
 * Copyright (c) 2007 Alexandru Marasteanu <http://alexei.417.ro/>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 */


Object.extend(Element, {
	show : function() {$A(arguments).each(function(i) {
		$(i).style.display =
			($(i).tagName.toLowerCase() == 'div' ? 'block' : '');
	});}
});

function $T() {
	var a = [];
	$A(arguments).each(function(i) {
		a.push($A(document.getElementsByTagName(i)));
	});
	return((a = a.flatten()).length > 1 ? a : a[0]);
};

var Over = {id: 'tiny-over'}, Load = {id : 'tiny-load'};
var Tiny = {
	initialize: function() {
		[Over, Load].each(function(i) {
			new Insertion.Bottom($T('body'), '<div id="' + i.id + '"></div>');
		});
	},

	show      : function(e) {
		Over.show ? Over.show() : Element.show(Over.id);
		Load.show ? Load.show() : Element.show(Load.id);
	},

	hide      : function(e) {
		Load.hide ? Load.hide() : Element.hide(Load.id);
		Over.hide ? Over.hide() : Element.hide(Over.id);
	}
};

Event.observe(window, 'load', Tiny.initialize);
