JavaScript fix for IE8/JS 1.5