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;
}
