// Browser Back button and location support functions for AJAX // Usage: in the main javascript for the page, create a ProcessOnHashChange() function // and check the hash value. function al_RenameAnchor(anchorid, anchorname) { document.getElementById(anchorid).name = anchorname; } function al_RedirectLocation(anchorid, anchorname, HashName) { //alert("main_redirect"); al_RenameAnchor(anchorid, anchorname); document.location = HashName; } function al_GetHashTag() { if (document.location.hash) { var HashLocationName = document.location.hash; HashLocationName = HashLocationName.replace("#",""); return HashLocationName; } else { return ""; } } function al_CompareHash() { if (al_GetHashTag() != g_al_LastHash) { g_al_LastHash = document.location.hash; ProcessOnHashChange(); } } var g_al_LastHash = ""; // Hook the onhashchange event if present or set an interval for checking it function al_Init() { if ("onhashchange" in window) { window.onhashchange = ProcessOnHashChange; } else { // Dummy up the onhashchange event by setting an interval and compare the hash // to a the last stored hash window.setInterval("CompareHash()", 200); } }