Playing with canvas, javascript and binary trees