Over at Hack-a-Day, they’ve got a short story about a Motion Detection system written almost entirely in JavaScript. It uses mjpg-streamer to communicate with the camera & stream images to the client (browser), but all of the motion detection is done client-side by the user. This allows very low-end hardware (read: Cheap & Expendable) to be deployed at the camera locations, and a larger machine to be deployed for the user client.
He’s got a sample video (above), source code, and a descriptive PDF online.