The functions mouseMove(), attached to the mousemove event, and mouseDrop(), attached to the mouseup event, control the drag-and-drop feature. A function invoked from within mouseDrop() named dropValid() tests if the piece which is about to be dropped is hovering over another piece. If yes, mouseMove() and mouseDrop() are detached from the mousemove and mouseup events to prevent the user from dropping the piece.
The dropValid() function uses the withinIt(object1, object2) function to test if the piece that is about to be dropped is hovering over another piece. Parameter object1 is the piece to be dropped, and parameter object2 is any other piece in the puzzle. The withinIt() function looks at every piece in the puzzle to get each one's top and left coordinates from the style sheet. It then uses these coordinates to determine if object1 (piece to be dropped) is over object2 (any other piece).
All files are included in the attached .zip file.