function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

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;
  }
  
var poc = 0;
var iwinTitle = document.title;
var lineCount = 1;
var lineHeight = 20;

function in_ff() {
  var agt=navigator.userAgent.toLowerCase();
  var firefox = (agt.indexOf("firefox") != -1);
  return firefox;
  }

function showImage(imgName, imWidth, imHeight, iTitle, iLines) { 
      if (poc!==0) { iwin.close(); }; 

      url = imgName;
      resStr = "resizable=0,scrollbars=0";
                                                             
      if (iLines) { 
        lineNum = iLines;
        } else {
        lineNum = lineCount;
        } 

      // define window oversize
      if (in_ff()) {
        winPlusWidth = 15;
        winPlusHeight = 35+(iLines-1)*lineHeight;
        } 
      else {
        winPlusWidth = 0;
        winPlusHeight = 20+(iLines-1)*lineHeight;
        }
      // 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)+",resizable=yes,scrollbars=no,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='css/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("<p>", iTitle);
      iwin.document.write("</body></html>");
      poc++;
      return true;
    }

function check_search(fld) {
  if (fld.value.length<2) {
    alert('Zadejte alespoň 2 znaky.')
    fld.focus();
    return false;
    };
  }

function SH(_objName,_formObj)
{
  var isIE=document.all?true:false; /* IE4, IE5, IE6 */
  var isDOM=document.getElementById?true:false; /* IE6, NS6 */

  /*
   * This creates an object inside the object passed to it.
   * It retains the state of show or hide.
   * This works when the check box is by default not checked.
   * (FIRST CLICK CHECKS AND MAKES DIV SHOW UP)
   */
  _formObj._show=_formObj._show?false:true;

  /*
   * Determine web browser type, then if to show or hide.
   */
   
  if(isDOM)
  {
    _formObj._show=document.getElementById(_objName).style.display=='none'?true:false;
    if(_formObj._show)
      document.getElementById(_objName).style.display="block";
    else
      document.getElementById(_objName).style.display="none";
  }
  else if(isIE)
  {
    _formObj._show=document.all._objName.style.display='none'?true:false;
    if(_formObj._show)
      eval("document.all."+_objName+".style.display='block'");
    else
      eval("document.all."+_objName+".style.display='none'");
  }
}
