modified for ie8 compatibility.