Refactor the javascript to support multiple sites.