replaced getelementbyid's with jQuery and cleaned up JS generally