To open a new browser window, you can simply use window.open(). However, window.open() returns a Window object for content, not for the browser window itself, so you should get the chrome Window first. The simplest way to do that is to use nsIWindowMediator [developer.mozilla.org].
window.open();
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var newWindow = wm.getMostRecentWindow("navigator:browser");
var b = newWindow.getBrowser();
To make a window draggable by clicking on the window's contents, you can use the mousedown and mousemove events. The following code does not care which element is clicked on, simply responding to all mousedown events equally. You could improve this code by checking the event.target element and only setting the startPos if the element matches some criteria.
var startPos=0;
var mouseDown = function(event) {
startPos = [ event.clientX, event.clientY];
}
var mouseMove = function(event) {
if (startPos != 0) {
var newX = event.screenX-startPos[0];
var newY = event.screenY-startPos[1];
window.moveTo(newX,newY);
}
}
var mouseUp = function(event) {
startPos=0;
}
window.addEventListener("mousedown",mouseDown, false);
window.addEventListener("mouseup",mouseUp, false);
window.addEventListener("mousemove",mouseMove, false);