Nicked the code from http://thecodeplayer.com/walkthrough/create-binary-trees-using-javascript-and-html5-canvas