Such long Javascript pieces of code should be located in dedicated *.js source files.