The jQuery UI plugin for one of the big players in js libraries: jQuery, already features a full implementation of window-like behavior for div elements, along with typical ui elements such as buttons, dialogs, progress bars etc. all implemented in js.
Code snippets and tutorials on how to use jQuery UI can be found on
http://jqueryui.com/demos/droppable/
the elements along with their functionality such as resizing or drag and drop can mostly be realized in a few lines.
One thing to note is that certain behavior such as resizing will only work if you also have a jQuery UI theme installed. Themes for your website can be generated using a wizard which can be found on the jqueryui website.