Improvements and some additional functionality

Hi OberstK,
as promised, I did some improvements to your javascript.
I added some comments to my changes and some questions.

I didn't know how much you actually know about Javascript...
If you want, I could expand on a few things.

Otherwise, have fun reviewing the request and have some nice LoL-Games :wink:
valentinouno.
does this apply to all for each loops we used until now?  Your link says, that we should use for of loops (didnt see them until now :))