It almost works for me; the only problem is that if the browser window is not maximized, I can drag .dragbar all the way past the right edge of the browser window until my cursor hits my right monitor edge. I want .dragbar to stop when there are 100px left for #main, however. I can't figure out why my code doesn't do this. Any ideas?
(when I posted it in JSFiddle, the bug doesn't occur, probably because of the website constraints. In a standard browser window, the bug occurs.)
Also, any suggestions for optimizing and improving this code would be appreciated. I don't know if I have a bunch of dead wood in there or what - just that it works.