var $$;
$$ = jQuery.fn.load_aroha = function( url ) {
	$dialog = $('#aroha_dialog');
	$wait_box = '<div class="loading" style="width:220px;height:19px;padding:23px;padding-top:39px;"></div>';
	$dialog.attr('title', 'Prosím čakajte, načítava sa...').html($wait_box);
	$dialog_params = {
		autoOpen: false,
		resizable: false,
	};
	$dialog.dialog($dialog_params);
	$dialog.dialog('open');
	$(this).load(url, function() {
		$dialog.dialog('close');
		inicializacia();
	});
};
function inicializacia() {
	$(".button").button();
}
function getXmlHTTP(){
	if(typeof XMLHttpRequest!="undefined"){
		return new XMLHttpRequest();
	}
	else if(typeof ActiveXObject != "undefined")
	{
		try{
			var xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			return xmlhttp;
		}
		catch(e)
		{
			return null;
		}
	}
	return null;
}
function _ajax(url) {
	xmlReq=getXmlHTTP();
	xmlReq.open("GET", url, true)
	xmlReq.onreadystatechange=function(){
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText;
			eval(xmlDoc)
		}
	}
	xmlReq.send(null);
}
function _ajax_to_div(url, div_id, waiting) {
	xmlReq=getXmlHTTP();
	xmlReq.open("GET", url, true)
	xmlReq.onreadystatechange=function(){
		if (waiting) $('#wait_box').dialog('open');
		if(xmlReq.readyState==4){
			var xmlDoc = xmlReq.responseText;
			document.getElementById(div_id).innerHTML = xmlDoc;
			if (waiting) $('#wait_box').dialog('close');
		}
	}
	xmlReq.send(null);
}
function Asc(String)
{

	return String.charCodeAt(0);

}

function Chr(AsciiNum)
{

	return String.fromCharCode(AsciiNum)

}
function clk($a_link, $event) {
	if ($a_link.original_link == null ) {
		$a_link.original_link = $a_link.href;
	}
	$url = $a_link.original_link;
	$linka = 'http://' + document.location.host + '/?module=megaportal&action=redirect&values=' +  escape(encodeURI($url)) + '&button=' + $event.button;
	$a_link.bolo_zmenene = true;
	$a_link.href = $linka;
}
