function pop(iUrl, winW, winH, winN) {
     var iWidth = (winW)? winW : 600;
     var iHeight = (winH)? winH : 500;
     var iTitle = (winN)? winN : 'popupWin';
     var scrollB = 'no';
     var posCode = '';

     if(screen) {
          var scrW = screen.width ? screen.width - 100 : 0;
          var scrH = screen.height ? screen.height - 100 : 0;
          if( scrW < iWidth ) { scrollB = 'yes'; iWidth = scrW; }
               else { scrW = screen.width }
          if( scrH < iHeight ) { scrollB = 'yes'; iHeight = scrH; }
               else { scrH = screen.height }
          var posX = Math.round( ( scrW - iWidth ) / 2 );
          var posY = Math.round( ( scrH - iHeight ) / 2 );
          posCode = ',left='+posX+',top='+posY;
     }

     iOptions = 'width=' + iWidth + ',height=' + iHeight + ',scrollbars=' + scrollB + ',resizable=yes,toolbar=no,status=yes' + posCode;

     if(iUrl.match(/\.(gif|jpe?g|png)$/i)) {
          popWin = window.open('', '_blank', iOptions);
          popWin.document.open();
          popWin.document.write('<html><head><title>' +
               iTitle +
               '</title></head><body style="background: #fff; margin: 0; padding: 0;">' +
               '<table cellpadding="0" cellspacing="0" border="0" height="100%"><tr><td>' + 
               '<img src="' + iUrl + '" /></td></tr></table></body></html>'
               );
          popWin.document.close();
     } else {
          popWin = window.open(iUrl, iTitle, iOptions);
     }
     popWin.focus();
     return false;
}
