// Netventure, http://www.netventure.pl/

function enlarge(image,width,height) {
  newWindow = null;
  if (window.screen) { awidth = screen.availWidth; aheight = screen.availHeight; } else { awidth = 800; aheight = 600; }
  if ((width <= awidth) && (height <= aheight)) {
    params = 'width='+width+',height='+height+','
           + 'top='+(aheight-height)/2+',left='+(awidth-width)/2+','
           + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no';
  } else {
    if ((width <= awidth) && (height > aheight)) {
      params = 'width='+(width+16)+',height='+(aheight-29)+','
             + 'top=0,left='+(awidth-width)/2+','
             + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
    } else {
      if ((width > awidth) && (height <= aheight)) {
        params = 'width='+(awidth-10)+',height='+(height+16)+','
               + 'top='+(aheight-height)/2+',left=0,'
               + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
      } else {
        if ((width > awidth) && (height > aheight)) {
          params = 'width='+(awidth-10)+',height='+(aheight-29)+','
                 + 'top=0,left=0,'
                 + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
        }
      }
    }
  }
  newWindow = window.open('','image',params);
  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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">');
  newWindow.document.writeln('  <head>');
  newWindow.document.writeln('    <title>Powiększenie</title>');
  newWindow.document.writeln('    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />');
  newWindow.document.writeln('  </head>');
  newWindow.document.writeln('  <body style="padding: 0px; margin: 0px;" onload="this.focus()">');
  newWindow.document.writeln('    <img style="display: block;" src="'+image+'" alt="zamknij" onclick="self.close()" />');
  newWindow.document.writeln('  </body>');
  newWindow.document.writeln('</html>');
  newWindow.document.close();
}

function popup(url,width,height) {
  newWindow = null;
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      height = parseInt(height) + 50;
    }
  }
  if (window.screen) { awidth = screen.availWidth; aheight = screen.availHeight; } else { awidth = 800; aheight = 600; }
  if ((width <= awidth) && (height <= aheight)) {
    params = 'width='+width+',height='+height+','
           + 'top='+(aheight-height-60)/2+',left='+(awidth-width)/2+','
           + 'menubar=yes,toolbar=no,location=no,status=no,scrollbars=no,resizable=no';
  } else {
    if ((width <= awidth) && (height > aheight)) {
      params = 'width='+(width+16)+',height='+(aheight-29)+','
             + 'top=0,left='+(awidth-width)/2+','
             + 'menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
    } else {
      if ((width > awidth) && (height <= aheight)) {
        params = 'width='+(awidth-10)+',height='+(height+16)+','
               + 'top='+(aheight-height)/2+',left=0,'
               + 'menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
      } else {
        if ((width > awidth) && (height > aheight)) {
          params = 'width='+(awidth-10)+',height='+(aheight-29)+','
                 + 'top=0,left=0,'
                 + 'menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
        }
      }
    }
  }
  window.open(url,'popup',params);
}

function enlarge2(image,width,height,title) {
  newWindow = null;
  if (window.screen) { awidth = screen.availWidth; aheight = screen.availHeight; } else { awidth = 800; aheight = 600; }
  if ((width <= awidth) && (height <= aheight)) {
    params = 'width='+width+',height='+height+','
           + 'top='+(aheight-height)/2+',left='+(awidth-width)/2+','
           + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no';
  } else {
    if ((width <= awidth) && (height > aheight)) {
      params = 'width='+(width+16)+',height='+(aheight-29)+','
             + 'top=0,left='+(awidth-width)/2+','
             + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
    } else {
      if ((width > awidth) && (height <= aheight)) {
        params = 'width='+(awidth-10)+',height='+(height+16)+','
               + 'top='+(aheight-height)/2+',left=0,'
               + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
      } else {
        if ((width > awidth) && (height > aheight)) {
          params = 'width='+(awidth-10)+',height='+(aheight-29)+','
                 + 'top=0,left=0,'
                 + 'menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no';
        }
      }
    }
  }
  newWindow = window.open('','image',params);
  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 xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">');
  newWindow.document.writeln('  <head>');
  newWindow.document.writeln('    <title>'+title+'</title>');
  newWindow.document.writeln('    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />');
  newWindow.document.writeln('  </head>');
  newWindow.document.writeln('  <body style="padding: 0px; margin: 0px;" onload="this.focus()">');
  newWindow.document.writeln('    <img style="display: block;" src="'+image+'" alt="zamknij" onclick="self.close()" />');
  newWindow.document.writeln('  </body>');
  newWindow.document.writeln('</html>');
  newWindow.document.close();
}
