if(typeof LITHIUM == "undefined") { var LITHIUM={}; };
if(typeof LITHIUM.Dom == "undefined") { LITHIUM.Dom={}; };

LITHIUM.Dom.CLICK = "CLICK";
LITHIUM.Dom.MOUSEOVER = "MOUSEOVER";

LITHIUM.Dialog = Class.create({
	initialize: function(element, url, windowName, options, className) {		
		this.element = element;
		this.originalUrl = url;
		this.url = url;
		this.windowName = windowName;
		this.className = className || false;
		this.options = options || "width=300,height=400,scrollbars=yes,resizable=yes";		
		if(this.className != false) {
			this.element = $(this.element).down("." + className);
		}		
		$(this.element).addClassName("dialog-link");
		this.beforeOpenMethod = false;
		Event.observe(this.element, 'click', this.openWindow.bind(this));	
	},
	openWindow: function(event) {
		Event.stop(event);		
		if (this.beforeOpenMethod != false) {
			this.beforeOpenMethod(this);
		}
		if (this.url != false) {			
			window.open(this.url, this.windowName.gsub(" ", ""), this.options);
		}		
	},
	setBeforeOpenMethod: function(method) {
		this.beforeOpenMethod = method;
	}
});

LITHIUM.Warning = Class.create({
	initialize: function(error) {
		alert(error);
	}
});

var Tapestry = {
    onDOMLoaded : function(callback)
    {
        document.observe("dom:loaded", callback);
    }
} 

Tapestry.onDOMLoaded(function()
{
    $$(".t-invisible").each(function(element)
    {
        element.hide();
        element.removeClassName("t-invisible");
    });

});
