function k2dialog_close(selector) {
  if (!selector) {selector="#k2dlg";}
  $(selector).dialog('destroy');
}

function k2dialog(selector, title, width, height) {
  $(selector).dialog({modal: true, height: height, width: width, title: title, closeOnEscape: true, dialogClass: "flora", overlay: {opacity: 0.2, background: "black"}});
  $(selector).dialog('open');
}

function showPopupHtml(htmlUrl, title, width, height) {
	var selector = '#k2dlg';
	var x = $(selector);	
	if (x.length>0)
	{
		$(x).html();
	}
	else
	{
		$('body').prepend('<div id="k2dlg" style="display:none;"></div>');
	}	
	$(selector).load(htmlUrl);
	k2dialog(selector, title, width, height);
}

/**
 * keep the session alive by making an ajax-request every 5 mins
 * @return
 */
function keepSessionAlive()
{
	setInterval ("$.ajax({url: '/ping.php'});",300000);
}
