var rallyposter = { onLoad: function() { // initialization code this.initialized = true; this.strings = document.getElementById("rallyposter-strings"); }, onMenuItemCommand: function(e) { var location, title; var savePopupURL = "http://localhost/rally2007/save_popup.php"; var browser = window.getBrowser(); var webNav = browser.webNavigation; if(webNav.currentURI) location = webNav.currentURI.spec; else location = gURLBar.value; if(webNav.document.title) title = webNav.document.title; else title = location; this.openPopupWindow(savePopupURL+"?location="+encodeURIComponent(location)+"&title="+encodeURIComponent(title), 700, 400); }, onToolbarButtonCommand: function(e) { // just reuse the function above. you can change this, obviously! rallyposter.onMenuItemCommand(e); }, openPopupWindow : function(aPath, aWidth, aHeight){ //make it center var width = aWidth, height = aHeight; var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var props = "width="+width+",height="+height+",left="+left+",top="+top+",menubar=0,toolbar=0,scrollbars=1,location=0,status=1,resizable=1"; var newWindow = window.open(aPath, "", props); newWindow.focus(); } }; window.addEventListener("load", function(e) { rallyposter.onLoad(e); }, false);