Chain Reaction in HTML5 and Javascript