  //  nacteni kalendare podle mesice a roku
  function random_foto(cone, lang) {    
    if (window.ActiveXObject) {
      try {
        httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
        try {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
      }
    }
    else
      {
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.onreadystatechange= function () { random_foto_show(httpRequest); } ;
    httpRequest.open("GET", "moduly/foto-show.php?c="+cone+"&language="+lang, true);
    httpRequest.send(null);
  }
  
  function random_foto_show(httpRequest) {
    if(httpRequest.readyState == 1 || httpRequest.readyState == 2 || httpRequest.readyState == 3) {

    }
    else if (httpRequest.readyState == 4)
    {
      if(httpRequest.status == 200) {
        var id = httpRequest.responseXML.getElementsByTagName('id');
        var doc = httpRequest.responseXML.getElementsByTagName('doc');
        var sec = httpRequest.responseXML.getElementsByTagName('sec');
        var alt = httpRequest.responseXML.getElementsByTagName('alt');
        document.getElementById('random_foto_img').src='phpThumb/phpThumb.php?src=../obrazky/r/'+doc[0].firstChild.data+'/'+id[0].firstChild.data+'.jpg&zc=1&w=150&h=150';
        document.getElementById('random_foto_a').href='index.php?s='+sec[0].firstChild.data+'&d='+doc[0].firstChild.data;
        document.getElementById('random_foto_img').alt=alt[0].firstChild.data;
        document.getElementById('random_foto_img').title=alt[0].firstChild.data; 
        foto_id=id[0].firstChild.data;
        //timer_foto=setTimeout("random_foto("+id[0].firstChild.data+")", 10000);
      }
      else {
        //alert("Chyba pri nacitani fotografie "+ httpRequest.status);
      }
    }
  }

