/**
 * _________________________________________________________________________ | | |
 * Készítette: Széll András | | 2011. március 31., Budapest | | A tartalom
 * másolása és saját célú felhasználása TILOS! | | Minden jog fenntartva | |
 * __________________________________________________________________________
 * 
 */
function DialogInterface() {
	this.options = null;
	this.dialogui = null;
	this.name = null;
	this.title = null;
	this.content = null;
	this.created = false;
	this.create = DialogInterface_Create;
	this.modalMessage = DialogInterface_ModalMessage;
	this.destroy = DialogInterface_Destroy;
	this.timeredDestroy = DialogInterface_TimeredDestroy;
	this.selector = DialogInterface_Selector;
}
function DialogInterface_Create(name, title, content, options) {
	this.name = name;
	this.title = title;
	this.content = content;
	$("body").append(
			"<div style='display:hidden;' id='" + this.name
					+ "_dialog' title='" + this.title + "'>" + this.content
					+ "</div>");
	this.dialogui = $(this.selector());
	this.options = options;
	this.dialogui.dialog(this.options);
	this.created = true;
}
function DialogInterface_ModalMessage(name, title, content) {
	this.name = name;
	this.title = title;
	this.content = content;
	$("body").append(
			"<div style='display:hidden;' id='" + this.name
					+ "_dialog' title='" + this.title + "'>" + this.content
					+ "</div>");
	this.dialogui = $(this.selector());
	var dialogui = this.dialogui;
	this.options = {
		modal : true,
		show : 'fade',
		hide : 'fade',
		closeOnEscape : true,
		close : function(event, ui) {
			dialogui.dialog("destroy").remove();
		},
		buttons : {
			Ok : function() {
				dialogui.dialog('close');
			}
		}
	};
	this.dialogui.dialog(this.options);
	this.created = true;
}
function DialogInterface_Destroy() {
	if (this.created) {
		this.dialogui.dialog("destroy").remove;
	}
}
function DialogInterface_TimeredDestroy(time) {
	var selector = this.selector();
	if (time == "auto") {
		time = $(selector).text().length * 200;
	}
	if (this.created) {
		var timer = setTimeout("$('" + selector + "').dialog('close');", time);
	}
}
function DialogInterface_Selector() {
	return "#" + this.name + "_dialog";
}
