function mnu_act(mid) {
  x = document.getElementById('mnu' + mid);
  if (x) {
    x.style.backgroundColor = '#EDEDED';
    }
  }

function mnu_deact(mid) {
  x = document.getElementById('mnu' + mid);
  if (x) {
    x.style.backgroundColor = 'white';
    }
  }

var agt=navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

function open_win(url, winWidth, winHeight, winRes) {
  if (winRes==1) { stat="resizable=1,scrollbars=1"; }
            else { stat="resizable=0,scrollbars=0"; };
  // calculate centered window position
  winLeft = Math.round((screen.width-winWidth)/2);
  winTop  = Math.round((screen.availHeight-winHeight)/2);
  winDef = "left="+winLeft+",top="+winTop+",height="+winHeight+",width="+winWidth+",directories=no,location=no,menubar=no,status=no,toolbar=no,"+stat;
  window.open(url, "", winDef);
  return true;
  }

function SkryjSelektitka() {
  var S = "";
  for (i=0; i<document.forms.length; i++) {
    for (j=0; j<document.forms[i].elements.length; j++) {
      X = document.forms[i].elements[j];
      if (X.type.indexOf("select")!=-1) {
        X.style.visibility = "hidden";
        }
      }
    }
  }

function OdkryjSelektitka() {
  var S = "";
  for (i=0; i<document.forms.length; i++) {
    for (j=0; j<document.forms[i].elements.length; j++) {
      X = document.forms[i].elements[j];
      if (X.type.indexOf("select")!=-1) {
        X.style.visibility = "visible";
        }
      }
    }
  }

var poc = 0;
var iwinTitle = "Trabant.cz";

function show_image(imgName, imWidth, imHeight) { 
  if (poc!==0) { iwin.close(); }; 
  
  url = imgName;
  resStr = "resizable=0,scrollbars=0";
                                                         
  // define window oversize
  winPlusWidth = 0;
  winPlusHeight = 0;
  // calculate window size
  winHeight = imHeight + winPlusHeight;
  winWidth = imWidth + winPlusWidth;
  // test if the window is not too large
  heightOK = true;
  if (winHeight>screen.availHeight)
    { winHeight = screen.availHeight-80;
  	  resStr=",resizable=1,scrollbars=1";
  	heightOK = false;
  	}
  if (heightOK==false)
    { winWidth = winWidth+22;
  	}								 
  if (winWidth>screen.width)
    { winWidth = screen.width-80;
  	  resStr=",resizable=1,scrollbars=1";
  	}								 
  
  // calculate centered window position
  winLeft = Math.round((screen.width-winWidth)/2);
  winTop  = Math.round((screen.availHeight-winHeight)/2);
  
  iwin = window.open("", "", "left="+winLeft+",top="+winTop+",height="+winHeight+",width="+winWidth+",directories=no,location=no,menubar=no,status=no,toolbar=no"+resStr);
  iwin.document.write("<html><head><title>", iwinTitle, "</title>");
  iwin.document.write("<link rel='stylesheet' type='text/css' href='/imgwin.css' title='formal'>");
  iwin.document.write("</head>");
  iwin.document.write("<body class=ImgShow>");
  iwin.document.write("<a href='' onClick=\"window.close(); return false;\"><img width=", imWidth," height=", imHeight," src=\"", url, "\" alt='' border=0></a>");
  iwin.document.write("</body></html>");
  poc++;
  return true;
    }

function pg_load() {
  if (document.forms['prisp']) {
    frm = document.forms['prisp'];
    if (frm.elements['hokus']) {
      if (window.frames['trpaslik']) {
        window.frames['trpaslik'].location.href = 'http://www.trabant.cz/trpaslik.php?action=days';
      }
    }
  }
}

function trpaslikload() {
  if (window.top) {
    if (window.top.document.forms['prisp']) {
      window.top.document.forms['prisp'].elements['hokus'].value = document.forms[0].days.value;
    }
  }
}
