QuadTree implementation in Javascript for generic use