[jQuery] Script to keep draggable windows in the main window not working?

[jQuery] Script to keep draggable windows in the main window not working?


I have a script to keep the draggable windows from leaving the main
window they are in. When I comment out the code everything else works
perfectly. But if I allow this code to be included, not everything
loads, the windows won't move, but nothing shows up in error console.
    jQuery(document).mousemove(function(){
        $('.draggableWindow').each(function(){
            if(parseInt($(this).css("top")) < 0){
            $(this).css("top", "0");
            }
            if(parseInt($(this).css("left")) < 0){
            $(this).css("left","0");
            }
            newTop= window.height - $(this).outerHeight();
            newLeft= window.width - $(this).outerWidth();
            if(parseInt($(this).css("top")) > newTop){
            $(this).css("top", newTop);
            }
            if(parseInt($(this).css("left")) > newLeft){
            $(this).css("left", newLeft);
            }
        }
    });
Not sure whats messing it up. I've tried changing a few parts of it to
no prevail. Help is appreciated.
-CodingCyborg