var xmlHttp

function getIdBezce(jmeno, mesic, den) {
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)  {
    alert ("Browser does not support HTTP Request")
    return
  }
  var url="plugin/web/kalendar-akci/getIdBezce.php"
  url=url+"?jmeno="+jmeno+"&mesic="+mesic+"&den="+den
  url=url+"&sid="+Math.random()
  xmlHttp.onreadystatechange=stateChanged
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function stateChanged() {
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
    //document.getElementById(divId).innerHTML="aaa"//xmlHttp.responseText
    var idBezce = xmlHttp.responseText
    if (idBezce > 0) {
    	document.location.href = "http://behy.cz/bezecketabulky.php?fce=vysledky_zavodniku&id="+idBezce+"&obdobi=on&obdobi_od=1800-01-01&obdobi_do=2099-01-01"
    }
    else {
    	alert("Litujeme, závodník nebyl v běžeckých tabulkách nalezen.")
    }
  }
}

function GetXmlHttpObject() {
  var xmlHttp=null;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e) {
    //Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}
