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;
}

function stateChanged(){ 
  if(document.getElementById("b3form") && document.getElementById("b3registrace")){
    if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
      var rettext = xmlHttp.responseText;

      var src = rettext.split("|");
      var act = src[0];
      var href = src[1];

      document.getElementById("b3form").action = act;
      document.getElementById("b3registrace").href = href;
    }
  }
}

function predej_act(kam){
  if(kam){
    xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null){
      window.alert("Va prehliadač nepodporuje HTTP požadavky!");
      return
    } 
    var url = "ajax/predej_act.php";
    url = url+"?kam="+kam;
    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
}

function stateChanged2(){ 
  if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
    var rettext = xmlHttp.responseText;

    if(document.getElementById("h_p_tv_a_d")) document.getElementById("h_p_tv_a_d").innerHTML = rettext;
  }
}

function HPTVAD(hptvad,hptvadi,poch,styl_barvicka,b3_muj_styl,b3_poz_styl){
  if(hptvad){
    xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null){
      window.alert("Va prehliadač nepodporuje HTTP požadavky!");
      return
    } 
    var url = "ajax/"+hptvad+".php?hptvadi="+hptvadi+"&styl_barvicka="+styl_barvicka+"&b3_muj_styl="+b3_muj_styl+"&b3_poz_styl="+b3_poz_styl;
    xmlHttp.onreadystatechange = stateChanged2;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
    for(i = 0 ; i < poch ; i++){
      var ide = "hptvad"+i;
      if(document.getElementById(ide)){
        if(i == hptvadi) document.getElementById(ide).className = "a";
        else document.getElementById(ide).className = "x";
      }
    }
  }
}

function stateChanged3(){ 
  if(xmlHttp.readyState == 4 || xmlHttp.readyState == "complete"){ 
    var rettext = xmlHttp.responseText;

    if(document.getElementById("horoskopy")) document.getElementById("horoskopy").innerHTML = rettext;
  }
}

function ZobrDennyHoroskop(znam){
  xmlHttp = GetXmlHttpObject();
  if(xmlHttp==null){
    window.alert("Va prehliadač nepodporuje HTTP požadavky!");
    return
  } 
  var url = "ajax/horoskop_denny.php?znam="+znam;
  xmlHttp.onreadystatechange = stateChanged3;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}