5/7/2014 - Updating resource counters

The first Javascript code. As I expected it was a pain to make it work
and looks like wasteful. Well, its not like i'm not good at Javascript
or anything but anybody's feedback is very welcome.;