replaced jquery each by for
using js strict mode now