function potvrdit(text, url){

  okno = window.confirm(text);

  if(okno) window.location = url;

}





var arrInput = new Array(0);

var arrInputValue = new Array(0);



function addInput() {

  arrInput.push(arrInput.length);

  arrInputValue.push("");

  display();

}



function display() {

  document.getElementById('parah').innerHTML="";

  for (intI=0;intI<arrInput.length;intI++) {

    document.getElementById('parah').innerHTML+=createInput(arrInput[intI], arrInputValue[intI]);

  }

}







function createInput(id,value) {

  return "<input type='file' id='test "+ id +"' name='foto[]' /><br>";

}



function deleteInput() {

  if (arrInput.length > 0) { 

     arrInput.pop(); 

     arrInputValue.pop();

  }

  display(); 

}





// ajax funkce na zobrazeni vybraneho kraje

function ajax(id_data, data, url, kam, kam2) {

  var httpRequest = false;



  if(id_data != 0){

    var content = document.getElementById(id_data)[document.getElementById(id_data).selectedIndex].value;

    

    var data = 'idecko='+content;

  }

  

  var typ = 'POST';





  var httpRequest = null;

  

  



  if (window.XMLHttpRequest) 

  {

      httpRequest = new XMLHttpRequest();

  } 

  else if (window.ActiveXObject) 

  {

    try 

    {

      httpRequest = new ActiveXObject("Msxml2.XMLHTTP");

    } 

    catch (error) 

    {

      httpRequest = new ActiveXObject("Microsoft.XMLHTTP");

    }

  }

    

  httpRequest.onreadystatechange = function () 

  { 

      processRequest(httpRequest, kam, kam2) 

  }



  httpRequest.open(typ, url, true);

  httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

  if (data) 

  {

    httpRequest.setRequestHeader("Content-length", data.length);

    httpRequest.setRequestHeader("Connection", "close");

  }



  httpRequest.send(data);





}





function processRequest(httpRequest, kam, kam2) 

{

                

                

    if (httpRequest.readyState == 4)

    {

        if(httpRequest.status == 200)

        {

            if (typeof kam == 'string') 

            {



              document.getElementById(kam).innerHTML = httpRequest.responseText;

              document.getElementById(kam2).innerHTML = httpRequest.responseText;

            }

            if (typeof kam == 'function') 

            {

                kam(httpRequest.responseText);

            }

        }

        else

        {

            alert("Chyba pri nacitani stanky " + httpRequest.status +" : "+ httpRequest.statusText);

        }

    }

    else

    {

        if (typeof kam == 'string' && kam != '') 

        {

           //document.getElementById(kam).innerHTML = "<p class=\"info ok\"><img src=\"./img/loading.gif\">"+hlaska+"</p>";

        }

    }

       

} 



