Javascript

Changes:
- moved some function inside metrilyx graph to have quicker access to some variables. 
- change for ... in loops on array to use simple for to have better performances. 
- jquery/variables caching.