/**
 * Ways to display a consistant modal box.
 */
var UKISA = UKISA || {};
UKISA.site = UKISA.site || {};

UKISA.site.Modal = {
	context: null,
	Content: function(ct, title, options) {
		var panel, hd, db, ft, instance, content;

		// Kill any old YUI Panel
		if (this.context) {
			this.context.destroy();
			this.context = null;
		}

		// This creates the custom shadow around the Panel box.
		panel = document.createElement("div");

		hd = panel.cloneNode(false);
		bd = panel.cloneNode(false);
		ft = panel.cloneNode(false);

		panel.id = "ukisa-modal";
		panel.className = "yui-panel-container yui-dialog shadow";
		hd.className = "hd";
		bd.className = "bd";
		ft.className = "ft";

		panel.appendChild(hd);
		panel.appendChild(bd);
		panel.appendChild(ft);

		document.body.appendChild(panel);

		instance = this;

		this.context = new YAHOO.widget.Panel("ukisa-modal", { 
			fixedcenter: true,
			modal: true,
			visible : false, 
			close: true,
			underlay: "shadow",
			constraintoviewport: true,
			zIndex: 1100,
			
			autofillheight: "body"
		});

		if (title && title.length) {
			this.context.setHeader(title);
		}
			

		title = title || "this";

		ct = document.getElementById(ct);
		
		if (ct) {
			content = ct.cloneNode(true);
		}

		this.context.setBody(content);	
		this.context.render();
		this.context.show();

		return false;
	}
};
