Refactored JQuery code

js/window.js