function openDialog(title, html) {
	$("<div id='greyBox'>").appendTo("body");
	$("<div id='dialog'><h1>" + title + "</h1><a id='dialog_close' href='javascript:closeDialog();void(0)'>schließen [X]</a><div id='dialogcontent'>" + html + "</div></div>").appendTo("body");
	$("#dialog").css("margin-left", -$("#dialog").width() / 2 + "px");
	$("#dialog_close").focus();
	$("#flashuploader").css("visibility", "hidden");
}

function closeDialog() {
	$("#greyBox").remove();
	$("#dialog").remove();
	if(window.opera) {
		$("body").css("background", "#80b7ff url(/res/imgs/gradient.jpg) repeat-x");
	}
	$("#flashuploader").css("visibility", "visible");
}

function resizeDialog(width) {
	$("#dialog").css("width", width + "px");
	$("#dialog").css("margin-left", -$("#dialog").width() / 2 + "px");
}

function confirmDialog(html, url) {
	openDialog('Bestätigung', html + '<button style="float: left" onclick="document.location.href = \'' + url + '\'">OK</button><button style="float: right" onclick="closeDialog()">Abbrechen</button>');
	resizeDialog(500);
}