open window in center of screen in Java Script

function OpenWindow(url,title,width,height) {
             var left = (screen.width / 2) - (width / 2);
             var top = (screen.height / 2) - (height / 2);
             return window.open(url, title, 'toolbar=no, menubar=no, scrollbars=no, resizable=no,width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
         }