updated JS to JQuery 1.9 compliant