wrap javascript in jQuery(document).ready() call. Clean up code.