// Netventure, http://www.netventure.pl/
function popup(url,width,height) {
  newWindow = null;
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      height = parseInt(height);
    }
  }
  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=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';
        }
      }
    }
  }
  window.open(url,'popup',params);
}


