your code looks correct except for 2 things:
1) you haven't added valid domains and keys to the switch statement
2) The original script line with the localhost api key is still in place, that will need to be removed.
if you still having a problem i need to see the page in the browser to troubleshoot.