$(function() {                                                                  /*přiřazení ňáký tříde fci na kliknutí*/
	trida=".prodejci_mesto";
		$(trida).click(function(){
      zobraz_udaje(this);
    });
	});
$(function() {                                                                  /*přiřazení ňáký tříde fci na kliknutí*/
	trida=".zavreni";
		$(trida).click(function(){
      zavri(this);
    });
	});
function zobraz_udaje(prvek)
{
  var id=prvek.id;
  var x=id.split("_");
  id=x[1];
  var tagy=document.getElementById("seznam_prodejcu").getElementsByTagName("div");
  for(var i=0;i<tagy.length;i++)
  {
    tagy[i].innerHTML="";
  }
  ajax(prodejci_udaje,"POST","/prodejci_udaje.php",id); 
}
function prodejci_udaje(xmlhttp)
{
  if (xmlhttp.readyState == 4) 
  {
    var response=xmlhttp.responseText;
    response=response.split("-----");
    var id=response[0];
    var obsah=response[1];
    id="mesto_"+id;
    document.getElementById(id).innerHTML=obsah;
    
  }
}
function ajax(obsluha, method, url, content, headers)          
  {
    var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
    if (!xmlhttp) {
        return false;
    }
    xmlhttp.open(method, url);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    xmlhttp.onreadystatechange = function() {
        obsluha(xmlhttp);
    }; 
    if (headers) {
        for (var key in headers) {
            xmlhttp.setRequestHeader(key, headers[key]);
        }
    }
    
    xmlhttp.send("text="+content);
    return true;
  }
function nove_okno(odkaz)
{
  var link=odkaz.href;
  window.open(link,'_blank');
  return false;
}
function zavri(prvek)
{
  prvek.parentNode.style.display="none";
}