function runClock() {
  today=new Date();
  day=today.getDate();
  month=today.getMonth()+1;
  year=today.getFullYear();
  hours=today.getHours();
  minutes=today.getMinutes();
  seconds=today.getSeconds();
  timeValue=day+". "+month+". "+year+" ";
  timeValue+=hours;
  timeValue+=((minutes<10) ? ":0" : ":")+minutes;
  timeValue+=((seconds<10) ? ":0" : ":")+seconds;
  if (document.getElementById("hodiny").nodeValue != timeValue) domInnerText(document.getElementById("hodiny"), timeValue);
  setTimeout("runClock()",100);
  return timeValue;
}

function domInnerText(node, text) {
  while (node.hasChildNodes()) {
    node.removeChild(node.firstChild);
  }
  node.appendChild(document.createTextNode(text));
}

function email(node, adrpred, adrza) {
  while (node.hasChildNodes()) {
    node.removeChild(node.firstChild);
  }
  elem = document.createElement("a");
  elem.setAttribute("href", "mailto:"+adrpred+"%40"+adrza);
  node.appendChild(elem);
  elem.appendChild(document.createTextNode(adrpred+"@"+adrza));
}

function winH() {
   if (window.innerHeight)
      return window.innerHeight;
   else if
   (document.documentElement &&
   document.documentElement.clientHeight)
      return document.documentElement.clientHeight;
   else if
   (document.body && document.body.clientHeight)
      return document.body.clientHeight;
   else
      return null;
}

function winW() {
   if (window.innerWidth)
      return window.innerWidth;
   else if
   (document.documentElement &&
   document.documentElement.clientWidth)
      return document.documentElement.clientWidth;
   else if
   (document.body && document.body.clientWidth)
      return document.body.clientWidth;
   else
      return null;
}

function kontrola(co) {
      if (document.getElementById(co).jmeno.value == "") {
            alert("Položka se jménem musí být vyplněna.");
            document.getElementById(co).jmeno.focus();
            return false;
      }
      else if ((document.getElementById(co).email.value == "") && (document.getElementById(co).telefon.value == "")) {
            alert("Uveďte prosím kontakt.");
            document.getElementById(co).email.focus();
            return false;
      }
      else if (document.getElementById(co).predmet.value == "") {
            alert("Položka předmět musí být vyplněna.");
            document.getElementById(co).predmet.focus();
            return false;
      }
      else if (document.getElementById(co).zprava.value == "") {
            alert("Zpráva musí obsahovat text.");
            document.getElementById(co).zprava.focus();
            return false;
      }
      else return true;
}

function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin,lang) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4

        if (bgcolor=="") {
                bgcolor="#FFFFFF";
        }
        var adj=10;
        var w = screen.width;
        var h = screen.height;
        var byFactor=1;

        if(w<740){
          var lift=0.90;
        }
        if(w>=740 & w<835){
          var lift=0.91;
        }
        if(w>=835){
          var lift=0.93;
        }
        if (imageWidth>w){
          byFactor = w / imageWidth;
          imageWidth = w;
          imageHeight = imageHeight * byFactor;
        }
        if (imageHeight>h-adj){
          byFactor = h / imageHeight;
          imageWidth = (imageWidth * byFactor);
          imageHeight = h;
        }

        var scrWidth = w-adj;
        var scrHeight = (h*lift)-adj;

        if (imageHeight>scrHeight){
            imageHeight=imageHeight*lift;
          imageWidth=imageWidth*lift;
        }

        var posLeft=0;
        var posTop=0;

        if (hugger == "hug image"){
          if (hugMargin == ""){
            hugMargin = 0;
          }
          var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
          if (scrHeightTemp < scrHeight) {
                scrHeight = scrHeightTemp;
          }
          var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
          if (scrWidthTemp < scrWidth) {
                scrWidth = scrWidthTemp;
          }

          if (scrHeight<100){scrHeight=100;}
          if (scrWidth<100){scrWidth=100;}

          posTop =  ((h-(scrHeight/lift)-adj)/2);
          posLeft = ((w-(scrWidth)-adj)/2);
         }

        if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
                imageHeight=imageHeight-adj;
                imageWidth=imageWidth-adj;
        }
        posTop = parseInt(posTop);
        posLeft = parseInt(posLeft);
        scrWidth = parseInt(scrWidth);
        scrHeight = parseInt(scrHeight);

        var agt=navigator.userAgent.toLowerCase();
        if (agt.indexOf("opera") != -1){
          var args= new Array();
          args[0]='parent';
          args[1]=imageName;
          var i;
          document.MM_returnValue = false;
          for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
        } else {
        newWindow = window.open("","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
        newWindow.document.open();
        newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onmousedown="if (event.button == 1 || event.which == 1) du = 1" onmouseup="if ((event.button == 1 || event.which == 1) && du) self.close(); else du = 0" onmouseout="du = 0">');
        newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+'><tr><td>');
        newWindow.document.write('<script type="text/javascript">var du = 0;</script>');
        newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="'+(lang ? 'Close the window by clicking it.' : 'Kliknutím zavřete okno.')+'" />');
        newWindow.document.write('</td></tr></table></body></html>');
        newWindow.document.close();
        newWindow.focus();
        }
        return false;

}

function mOdpocet(obj) {
  zpozdeni = setTimeout("document.getElementById('nmenu').style.display = 'none'", 250);
}

function mUkaz(obj) {
  if (typeof zpozdeni!="undefined") clearTimeout(zpozdeni);
  document.getElementById('nmenu').style.display = 'block';
}
