/* Messages */

function errorMessage(text) {
	
	if (!document.getElementById("errMsg")) {
		$("#Wrapper").append("<div id=\"errMsg\"></div>");
	}
	
	$("#errMsg").dialog({
	modal: true,
	title: "Hiba történt!",
	autoOpen: true, 
    width: 400,
    height: 'auto',
    resizable: false,
	open: function() {
		$(this).css("height", "auto").html(text);
	},
	buttons: {
		"OK": function() {
			$(this).dialog("destroy");
		}
	}
	});
	
	$(".ui-dialog").css("zIndex", 399900);
    $(".ui-widget-overlay").css("zIndex", 399000);
    return false;
	
}

function alertMessage(text, title) {
	
	if (!document.getElementById("alertMsg")) {
		$("#Wrapper").append("<div id=\"alertMsg\"></div>");
	}
	
	$("#alertMsg").dialog({
	modal: true,
	bgiframe: true,
	title: title,
	autoOpen: true, 
	open: function() {
		$(this).html(text);
	},
	buttons: {
		"OK": function() {
			$(this).dialog("destroy");
		}
	}
	});
	
    $(".ui-dialog").css("zIndex", 399900);
    $(".ui-widget-overlay").css("zIndex", 399000);
	return false;
	
}


function infoMessage(text, title) {
	
	if (!document.getElementById("infoMsg")) {
		$("#Wrapper").append("<div id=\"infoMsg\"></div>");
	}
	
	$("#infoMsg").dialog({
	modal: true,
	bgiframe: true,
	title: title,
	autoOpen: true, 
	open: function() {
		$(this).html(text);
	},
	buttons: {
		"OK": function() {
			$(this).dialog("destroy");
		}
	}
	});
	
    $(".ui-dialog").css("zIndex", 399900);
    $(".ui-widget-overlay").css("zIndex", 399000);
	return false;
	
}

function fnMessage(text, title, action) {
	
	if (!document.getElementById("fnMsg")) {
		$("#Wrapper").append("<div id=\"fnMsg\"></div>");
	}
	
	if (title=="") { title="Információ!"; }
	
	$("#fnMsg").dialog({
	modal: true,
	title: title,
	autoOpen: true, 
	open: function() {
		$(this).html(text);
	},
	buttons: {
		"Rendben": function() {
			action();
			$(this).dialog("destroy");
		}
	}
	});
    
	$(".ui-dialog").css("zIndex", 399900);
    $(".ui-widget-overlay").css("zIndex", 399000);
    return false;
}


