Updating percent loading function to work with FireFox and Chrome