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