// otevreni noveho okna s obrazky
function NewWindow(page)
        {
                var width,height;
                width = 780;
                height = 540;
                OpenWin = window.open(page,"",'top=10,left=10,width='+width+',height='+height+', scrollbars=yes, menubar=no, toolbar=no, location=no, status=no, resizable=yes');
        }
        
function openWindow(str) {

        window.open(str,'Webcam','scrollbars=no,resizable=yes,width=375,height=320,status=no,location=no,toolbar=no');

}
function changePage()
{
    document.getElementById('aj_strana').value=((document.getElementById('aj_s_page').value-1)*10);
    document.forms['fhledej'].submit();
}
 function mista_change()
 {
     region=document.getElementById('aj_s_region').value;
     aut=document.getElementById('aj_dopr_bus').value;
     vl=document.getElementById('aj_dopr_vlastni').value;
     let=document.getElementById('aj_dopr_letadlo').value;
     ajax('inc/searchUpdate.php?r='+region+'&b='+aut+'&l='+let+'&v='+vl,'aj_mista');
 }
 function change_show(target,target2)
 {
     w=document.getElementById(target).style;
     if (w.display=="none")
         w.display="block";
     else
         w.display="none";
     document.getElementById(target2).value="nic";
         

 }
  function ajax(stranka, kam)
{
    var httpRequest;

    if(typeof window.ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", stranka, true);
    httpRequest.onreadystatechange= function ()
    {
        processRequest(httpRequest, kam)
    };
    httpRequest.send(null);
}


function processRequest(httpRequest, kam)
{
    if (httpRequest.readyState == 4)
    {
        if(httpRequest.status == 200)
        {
            if (typeof kam == 'string')
            {
                document.getElementById(kam).innerHTML = httpRequest.responseText;


            }
            if (typeof kam == 'function')
            {
                kam(httpRequest.responseText);
            }
        }
    }


}