/**	Funkce pro asynchronni komunikaci se serverem
	ver. 20070722
*/
var ajaxLoading = true; //pokud se ma zobrazovat Loading circle
var ajaxLoadingText = false; //pokud se ma zobrazovat text nahravame
var ajaxComunication = true; //pokud se ma zobrazovat text nahravame

function ajaxLoadData(srcFile, kam){
	//alert (srcFile + " " +  kam);
    //var httpRequest;
	if (window.ActiveXObject){
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
          httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", srcFile, ajaxComunication);
    httpRequest.onreadystatechange= function () {
        processAjaxRequest(httpRequest, kam);
	};
    httpRequest.send(null);
}

function processAjaxRequest(httpRequest, kam) {
    if (httpRequest.readyState == 4){
	  	 if(httpRequest.status == 200) {
	        document.getElementById(kam).innerHTML = httpRequest.responseText;
        } else{
            alert("Chyba pri nacitani stanky " + httpRequest.status +" : "+ httpRequest.statusText);
        }
    } else {
    	if ( ajaxLoading || ajaxLoadingText ){
			Out = '<div class="loadingBox">';
			Out += ajaxLoading ? '<img src="./img/loading.gif" alt="loading" width="16" height="16" border="0">' : '';
			Out += ajaxLoadingText ? '<br />... nahrávám ...' : '';
			Out += '</div>';
	      	document.getElementById(kam).innerHTML = Out;
		}
    }
}
