var scW = screen.availWidth ? screen.availWidth : screen.width;
var scH = screen.availHeight ? screen.availHeight : screen.height;


function popImage(imageURL,imageTitle,imageWidth,imageHeight) {
  var imgWin = window.open('','_blank','scrollbars=no,toolbar=no,resizable=no,width='+(imageWidth)+',height='+(imageHeight)+',left='+(Math.round((scW-imageWidth)/2)+',top='+Math.round((scH-imageHeight)/2))+'');
  if( !imgWin ) { 
      return; 
  } //popup blockers should not cause errors
  imgWin.document.write('<html><head><title>'+imageTitle+'<\/title>'+
    '<\/head><body>'+
    (document.layers?('<layer left="0" top="0" style="overflow:hidden">'):('<div style="position:absolute;left:0px;top:0px;display:table;overflow:hidden">'))+
    '<a href="javascript:window.close()"><img src="'+imageURL+'" border="0" alt="Loading image ..." title=""><\/a>'+
    (document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
  imgWin.document.close();
  if( imgWin.focus ) { 
      imgWin.focus(); 
  }
}
