IE8 complains, if catch block is missing
IE8 don't knows the Array.forEach function (simple version fix)
use document, not doc
fixed spacing