var win = null; function PopupWindow(url, name, w, h){ var l = (screen.width - w) / 2; var t = (screen.height - h) / 2; if (name == "ChatWindow") { var chat = true; var w = (screen.availWidth - 10).toString(); var h = (screen.availHeight - 35).toString(); var options = ',screenX=0,screenY=0,left=0,top=0'; } win = window.open(url, name, 'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars=yes,resizable=yes'+options); win.window.focus(); if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } }