error handling for various url hash eventualities
refactored alert html stuff into a single function