Untangling Javascript from HTML