added code to js to work in IE