javascript loop fix

foreach() this was returning an error in Firefox