/* Funkce pro převzetí textu ze serveru */
function transferText(url, funkce){
   var xHttp = false;
   
   if (window.ActiveXObject){
      xHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   else if (window.XMLHttpRequest){
      xHttp = new XMLHttpRequest();
   } 
   
   if (xHttp){
      xHttp.open("GET", url);
      xHttp.onreadystatechange = function() { 
         if(xHttp.readyState == 4 && xHttp.status == 200){          
            funkce(xHttp.responseText);
            delete xHttp;
            xHttp = null;         
         } 
      }
      xHttp.send(null);
   }
}


/* Funkce pro převzetí obsahu XML ze serveru */
function fransferXML(url, funkce){
   var xHttp = false;
   
   if (window.ActiveXObject){
      xHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   else if (window.XMLHttpRequest){
      xHttp = new XMLHttpRequest();
   }
   
   if (xHttp){
      xHttp.open("GET", url);
      xHttp.onreadystatechange = function(){
         if (xHttp.readyState == 4 && xHttp.status == 200){
            funkce(xHttp.responseXML);
            delete xHttp;
            xHttp = null;            
         }
      }
      xHttp.send(null);         
   }
}


/* Funkce pro poslání údajů na server, server vrátí text */
function giveText(url, data, funkce){
   var xHttp = false;
   
   if (window.ActiveXObject){
      xHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   else if (window.XMLHttpRequest){
      xHttp = new XMLHttpRequest();
   }
   
   if (xHttp){
      xHttp.open("POST", url);
      xHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
      
      xHttp.onreadystatechange = function(){
        if (xHttp.readyState == 4 && xHttp.status == 200){
            funkce(xHttp.responseText);
            delete xHttp;
            xHttp = null;            
        }
      }
      xHttp.send(data);               
   }   
}


/* Funkce poslání údajů na server, server vrátí obsah XML */ 
function giveXML(url, data, funkce){
   var xHttp = false;
   
   if (window.ActiveXObject){
      xHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   else if (window.XMLHttpRequest){
      xHttp = new XMLHttpRequest();
   }
   
   if (xHttp){
      xHttp.open("POST", url);
      xHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
      
      xHttp.onreadystatechange = function(){
        if (xHttp.readyState == 4 && xHttp.status == 200){
            funkce(xHttp.responseXML);
            delete xHttp;
            xHttp = null;            
        }
      }
      xHttp.send(data);               
   }   
}

/* Funkce pro zobrazování textu */
function zobraz(text){
  document.getElementById("vystupDiv").innerHTML = text;   
}
