I have been tasked to design a JScript puzzle game with the following rules:

1 - The board is 4x4 tiles and contains 15 tiles labelled "A" through "O" and the game is complete when the tiles are in alphabetical order from top left to bottom right (ie A, B, C, D across the top row)

2 - There is one empty space on the board into which an adjacent peice may slide into. The tiles may only move left, right, up and down and only into the empty space.

3 - Only one tile may move at a time.

4 - Tiles may not jump over other tiles.

5 - The board is scrambled at the beginning of the game.

I know this has been done to death online but I am wondering if anyone can help me out here or point me towards a tutorial of some kind to help me out. I am intending to use some kind of event handler to swap image ID's but if there is a better way to do it, it would be helpful.

Thanks a lot in advance!