function getPageN() { getPage(getPageName()); } showLoadingMessage = function() { var div = document.getElementById("AA_" + this.id + "_loading_div"); if (div == null) { div = document.createElement("DIV"); document.body.appendChild(div); div.id = "AA_" + this.id + "_loading_div"; div.innerHTML = " Loading..."; div.style.position = "absolute"; div.style.border = "1 solid black"; div.style.color = "white"; div.style.backgroundColor = "red"; div.style.width = "100px"; div.style.heigth = "50px"; div.style.fontFamily = "Arial, Helvetica, sans-serif"; div.style.fontWeight = "bold"; div.style.fontSize = "11px"; } div.style.top = document.body.scrollTop + "px"; div.style.left = (document.body.offsetWidth - 100 - (document.all?20:0)) + "px"; div.style.display = ""; } hideLoadingMessage = function() { var div = document.getElementById("AA_" + this.id + "_loading_div"); if (div != null) div.style.display = "none"; } function getPage(page) { document.getElementById("load").style.display = "inline"; //show loading message showLoadingMessage(); //the regular ajax stuff (CONTENT) if (xmlhttp.readyState == 0 || xmlhttp.readyState == 4) { try { xmlhttp.open("GET", "http://www.gregbrock.co.uk/includes/ajax/data.php?url=photo&ajax=yes&id=5910&ref1=&p=" + page, true); //open the page xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { document.getElementById("load").style.display = "none"; //done loading hideLoadingMessage(); if (document.getElementById("content_tab").innerHTML != xmlhttp.responseText) { // doInnerHTML("content_tab", xmlhttp.responseText); //set the content html document.getElementById("content_tab").innerHTML = xmlhttp.responseText } } } xmlhttp.send(null); } catch(e) { doInnerHTML("content_tab", e); //if there's an error, display it ready = 3; } } } //stop ajax function sajax() { if (callInProgress()) { xmlhttp.abort(); } } //check if a call is in progress function callInProgress() { switch ( xmlhttp.readyState ) { case 1, 2, 3: return true; break; default: return false; break; } } //check if browser supports setRequestHeader function isSup() { try { if (xmlhttp.setRequestHeader) { return (true); } else { return (false); } } catch (e) { return (true); /*IE gives an exception even though it supports the method*/ } } //get the page name function getPageName() { var n; if (window.location.href.split("#")[1]) { n = window.location.href.split("#")[1]; } else { n = "home"; } return n; } var lastURL = window.location.href; //last location //periodically check if the location has changed to change the page if so function chkURL() { if (window.location.href != lastURL) { lastURL = window.location.href; getPageN(); } window.setTimeout("chkURL()", 100); } window.setTimeout("chkURL()", 100);