Mortice.Application = Class.create(Mortice.Component, {
	initialize: function($super) {
		
	},
	
	open: function(url, name, size) {
		var specification = "location=no,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes";
		if(size) {
			specification += ",height=" + size.height + ",width=" + size.width;
		}
		
		window.open(url, name, specification);
	}
});

Mortice.Overlay = Class.create(Mortice.Component, {
	initialize: function($super) {
		$super($("overlay"));
		this.element.setOpacity(0.7);
	},
	
	show: function() {
		var elements = $$("embed");
		for(var i = 0; elements && i < elements.length; i++) {
			elements[i].up().hide();
		}
		this.element.show();
		
		
	},
	
	hide: function() {
		this.element.hide();
		var elements = $$("embed");
		for(var i = 0; elements && i < elements.length; i++) {
			elements[i].up().show();
		}
	}
});

var overlay = null;
var application = null;
Event.observe(window, "load", function() {
	application = new Mortice.Application();
	overlay = new Mortice.Overlay();
	var height = window.getScrollHeight();
	overlay.element.style.height = (height) + "px";
});

Event.observe(window, "resize", function() {
	if(overlay) {
		var height = window.getScrollHeight();
		
		overlay.element.style.height = (height) + "px";
	}
});
