
function zalozka(title,url)
{
  if(window.sidebar){ window.sidebar.addPanel(title,url,"");}
  else if(document.all){ window.external.AddFavorite(url,title);}
  else if(window.opera&&window.print){return true;}
}

function vypoctiSporeni() {
    
  loading();
  
  httpObject = getHTTPObject();
  
  var ulozka = document.getElementById('Sporeni_Ulozka').value
  var rUrok = document.getElementById('Sporeni_RUrok').value
  var dan = document.getElementById('Sporeni_Dan').value
  var doba = document.getElementById('Sporeni_Doba').value
  var reg = /^[0-9.]*$/ 
  
  if (reg.test(ulozka)==true && reg.test(rUrok)==true && reg.test(doba)==true ) {
  
      if (httpObject != null) {
        httpObject.open("GET", "/includes/ajaxSporeni.php?Sporeni_Ulozka="+document.getElementById('Sporeni_Ulozka').value+"&" +
                          "Sporeni_RUrok="+document.getElementById('Sporeni_RUrok').value+"&" +
                          "Sporeni_Dan="+document.getElementById('Sporeni_Dan').value+"&" +
                          "Sporeni_Doba="+document.getElementById('Sporeni_Doba').value
                        , true);
        httpObject.send(null);
        httpObject.onreadystatechange = setOutput;
      }
      
  }
  
}

function vypoctiBmi() {
  return false;
}

function loading() {
  
  if(document.getElementById('outputText1')) {
    document.getElementById('outputText1').innerHTML = "...";
  }
  if(document.getElementById('outputText2')) { 
    document.getElementById('outputText2').innerHTML = "...";
  }
  if(document.getElementById('outputText3')) { 
    document.getElementById('outputText3').innerHTML = "...";
  }
  
}


function setOutput(){
  if(httpObject.readyState == 4){
  
    if (httpObject.status == 200)
    {
        poleHodnot = new Array();
         
        poleHodnot = httpObject.responseText.split(';');
    
        if(!poleHodnot.length) return false;
    
        document.getElementById('outputText1').innerHTML = poleHodnot[0];
        document.getElementById('outputText2').innerHTML = poleHodnot[1];
        
    } else
       alert('Chyba: ('+http_request.status+')');
       
  }
}

// Get the HTTP Object
function getHTTPObject(){

  if (window.ActiveXObject) 
    return new ActiveXObject("Microsoft.XMLHTTP");
    
  else if (window.XMLHttpRequest) 
    return new XMLHttpRequest();
    
  else {
    alert("Your browser does not support AJAX.");
    return null;
  }
  
}

