// JavaScript Document
function div_write(div_name, url){
	if(url != null){
		document.getElementById(div_name).innerHTML="<div style=\"width:100%; height:120px; text-align:center; margin-top:60px\"><img src=\"/images/loadinfo.net.gif\" width=\"24\" height=\"24\" alt=\"loading\" /></div>";
		if (window.ActiveXObject)
		{
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			httpRequest = new XMLHttpRequest();
		}
		httpRequest.open("GET", url, true);
		httpRequest.onreadystatechange= function () {processRequest(div_name,url); } ;
		httpRequest.send(null);
	}else{
		document.getElementById(div_name).innerHTML="";
	}
	return false;
}

function processRequest(div_name,url){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var mistoZobrazeni = document.getElementById(div_name);
			mistoZobrazeni.innerHTML = httpRequest.responseText;
		}else{
			var mistoZobrazeni = document.getElementById(div_name);
			var $out = "<div style=\"width:100%; height:120px; text-align:center; margin-top:60px\">";
			$out = $out + "Při načítání stránky - <strong>" + url + "</strong><br /><br />Nastala tato chyba - "+ httpRequest.status +":"+ httpRequest.statusText;
			$out = $out + "</div>";
			mistoZobrazeni.innerHTML = $out
		}
	}
}

