Jqueryfied the code 

...and added some new functionality