Updated javascript for IE8