function openPage(itemHref, width, height) {

   width = width || 350;
   height = height || 520;
  var left = Math.floor((screen.width - width)/2);
  var top = Math.floor((screen.height - height)/2);

  newWindow=window.open(itemHref,'newwin','toolbar=no,width='+width+',height='+height+',top='+top+',left='+left+',scrollbars=yes,resizable');
  if (newWindow) {
    if (parseInt(navigator.appVersion) >= 4) { newWindow.focus(); }
    return false;
  }
  return true;
}

function openimage(picName) {
  var winl, wint;
  
  winl = screen.width/2 - 250;
  wint = screen.height/2 - 200;

  newWindow=window.open('','newwin','statusbar=no,toolbar=no,width=500,height=500,top='+wint+',left='+winl+',scrollbars=no,resizable');

  if (newWindow) {

    newWindow.document.writeln('<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN"` "http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd">');
    newWindow.document.writeln('<html xml:lang="en" lang="en" xmlns="http:\/\/www.w3.org\/1999\/xhtml">');
    newWindow.document.writeln('<head><title>Incofis B. C. S - Realitný server - fotogaleria<\/title>');
    newWindow.document.writeln('<link rel="stylesheet" type="text\/css" href="/design/display/style_screen.css" media="screen" >');
    newWindow.document.writeln('<style type="text\/css">');
    newWindow.document.writeln('<!--');
    newWindow.document.writeln('BODY {margin:0;}');
    newWindow.document.writeln('img  {margin:0;');
    newWindow.document.writeln('      border:0;}');
    newWindow.document.writeln('-->');
    newWindow.document.writeln('<\/style>');
    newWindow.document.writeln('<script LANGUAGE="JavaScript" type="text\/javascript">');
    newWindow.document.writeln('<!-- Begin');
    newWindow.document.writeln('var isNav4, isIE4;');
    newWindow.document.writeln('if (parseInt(navigator.appVersion.charAt(0)) >= 4) {');
    newWindow.document.writeln('  isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;');
    newWindow.document.writeln('}');
    newWindow.document.writeln('function fitWindowSize() {');
    newWindow.document.writeln('width =  document.images[0].width;');
    newWindow.document.writeln('height = document.images[0].height;');
    newWindow.document.writeln('window.resizeTo(width, height);');
    newWindow.document.writeln('if (isIE4) {');
    newWindow.document.writeln('window.resizeTo(width + (width - document.documentElement.clientWidth), height + (height - document.documentElement.clientHeight));');
    newWindow.document.writeln('} else {');
    newWindow.document.writeln('window.resizeTo(width + (width - document.body.clientWidth), height + (height - document.body.clientHeight));');
    newWindow.document.writeln('}');
    newWindow.document.writeln('window.moveTo(screen.width/2 - width/2, screen.height/2 - height/2);');
    
//    newWindow.document.writeln('   } else {');
//    newWindow.document.writeln('window.innerHeight =  document.images[0].height+10;');
//    newWindow.document.writeln('window.innerWidth =  document.images[0].width+10;');
//    newWindow.document.writeln('   }');
    newWindow.document.writeln('}');
    newWindow.document.writeln('\/\/  End -->');
    newWindow.document.writeln('<\/script>');
    newWindow.document.writeln('<\/head><body onload="fitWindowSize();">');
    newWindow.document.writeln('<div style="margin: auto; text-align:center;"><a href="javascript:self.close();" title="[ Zavrieť okno ]"><img src="'+picName+'" border="0"><\/div><\/div>');
    newWindow.document.writeln('<\/body><\/html>');
    newWindow.document.close();
    if  (parseInt(navigator.appVersion)  >= 4) {
        newWindow.focus();
    }
    return false;
  }
  return  true;
}

