function popupCenter(href, maxWidth, maxHeight) { 

var link   = href;
var target = '_blank';

var screenWidth  = window.screen.availWidth;
var screenHeight = window.screen.availHeight;

var width = Math.min(maxWidth, screenWidth);
var height = Math.min(maxHeight, screenHeight - 30);

var left = (screenWidth/2) - (width/2 + 10); 
var top = (screenHeight/2) - (height/2 + 50); 

if( screenWidth <= 1024) left = 0;
if( screenHeight <= 768) top = 0;


var option = [
      "toolbar=no"
 ,   "location=no"
 ,"directories=no"
 ,     "status=no"
 ,    "menubar=no"
 , "scrollbars=yes"
 ,  "resizable=yes"
 ,      "width=" + width
 ,     "height=" + height
 ,       "left=" + left
 ,        "top=" + top
 ,    "screenX=" + left
 ,    "screenY=" + top
];

var winPopup = window.open(link, target, option.join(','));
winPopup.focus(); 

return false;

}
