I began on this once, but didn't get very far, but it's a start. Feel free to correct and add more features though, just remember to post it back here :)