Updating the script for IE8/IE9 compatibility.