$(document).ready(function(){
      zdeBudouVysledky = el("vysledky").innerHTML;
});

function search(toto){
    kam='vysledky';
    if(toto.value.length>0){
        el(kam).innerHTML="Načítám...";
        adr="/search.php?lang="+lang;
        adr+="&q="+toto.value;
        ajax(adr,kam);
    }
    else el(kam).innerHTML=zdeBudouVysledky;
  }
function el(co){
    return document.getElementById(co);
}
function ajax(adr,vystup){
    xmlHttp=httpObject();
    xmlHttp.onreadystatechange=function(){
                 if (xmlHttp.readyState==4){
                     el(vystup).innerHTML=xmlHttp.responseText;
                 }       
     }                                                                              
    xmlHttp.open("GET",adr,true);
    xmlHttp.send(null);
    
}
function httpObject(){
    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 hide(co){
    if(el(co).style.display=="none" || el(co).style.display=="")el(co).style.display="block";
    else el(co).style.display="none";
}
function showPhotos(id, vrhLink){
    $('#photos'+id).show(600);
    secondOneExp = el("secondOneExp"+id).innerHTML;
    el("secondOneExp"+id).innerHTML = el("link"+id).innerHTML
    el("link"+id).innerHTML = secondOneExp;
    el("link"+id).onclick=function(){hidePhotos(id, vrhLink);}
}
function hidePhotos(id, vrhLink){
    $('#photos'+id).hide(600);
    secondOneExp = el("secondOneExp"+id).innerHTML;
    el("secondOneExp"+id).innerHTML = el("link"+id).innerHTML
    el("link"+id).innerHTML = secondOneExp;
    el("link"+id).onclick=function(){showPhotos(id, vrhLink);}
    location.href="#"+vrhLink;
}