Added fallback in case JS is unavailable and moved JS to external file.