// ------------------------------------ // MESSAGES on the home page. // - Constants for messages // - Function to display the message // & current date time // ------------------------------------ var THE_WAY_IT_WAS="original"; var PAGE_WHO="'" + "http://www.graHouse.com/who.htm" + "'"; var PAGE_WHAT="http://www.graHouse.com/what.htm"; var PAGE_WHY="http://www.graHouse.com/why.htm"; var PAGE_NEED="http://www.graHouse.com/aNeed.htm"; var PAGE_WE_HELP="http://www.graHouse.com/howWe.htm"; var PAGE_YOU_HELP="http://www.graHouse.com/howYou.htm"; var PAGE_CONTACT="http://www.graHouse.com/contactUs.htm"; var PET_MSG="petMsg"; var THE_TEST="theTestMsg"; var ONE "one"; var TWO "two"; var THREE "three"; var FOUR "four"; // // Function to display a html page // function showPage(id,theFile) { if (theFile==null) { document.getElementById(id).innerHTML="
NO PAGE TO OPEN

"; } else { // Get the absolute path / url for the page var path = top.location.pathname; if (document.all) { path = path.replace(/\\/g,"/"); } //path = path.substr(1,path.lastIndexOf("/")+1); path = path.substr(1,path.lastIndexOf("/")); //var url = top.location.protocol + "//" + path + theFile; var url = path + theFile; // Read the contents of the file 'theFile' into the innerHTML variable for the element var theHTML = ""; //var theRoot = "C:\\Users\\Robbo\\Documents\\gra\\NEW_Website\\"; //var theRoot = "./"; //var f = theRoot + theFile; var fso = new ActiveXObject("Scripting.FileSystemObject"); if (fso.fileExists(url)) { var contents =""; var line; alert("the file = [" + url + "]"); contents = fso.OpenTextFile(url, 1); // mode 1 = Read // loop over file till it reaches the end - line by line while ( !contents.AtEndOfStream ){ theHTML += contents.ReadLine(); } contents.Close(); fso = null; } else { theHTML = "
The file [" + url + "] does NOT exist
"; } document.getElementById(id).innerHTML= theHTML; } } // ---------------------------------- // // ---------------------------------- function processAjax(targetDivID, url) { alert("processAjax: START: DivID=[" + targetDivID + "] url=[" + url + "]"); if (window.ActiveXObject) { // IE Browser alert("processAjax: IE Browser..."); req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { alert("processAjax: 1 ..."); if (req.readyState == 4) { // Complete alert("processAjax:2 ActiveXObject complete..."); if (req.status == 200) { // OK response alert("processAjax:3 OK Response ..."); document.getElementById(id).innerHTML = req.responseText; } else { alert("processAjax: Problem: response NOT OK [" + req.statusText + "]"); } } else { alert("processAjax: ActiveXObject Not complete!..."); } //alert("processAjax: Completed readyState=[" + req.readyState + "] req.status=[" + req.status + "]"); //req.onreadystatechange = targetDiv(targetDivID); req.open("GET", url, true); req.send(); } } else if (window.XMLHttpRequest) { // Non-IE browsers alert("processAjax: NON IE Browser..."); req = new XMLHttpRequest(); req.onreadystatechange = targetDiv(targetDivID); try { req.open("GET", url, true); } catch (e) { alert("processAjax: CATCH[" + e + "]"); } req.send(null); } } // Same as above ... just swapped ifs order around function processAjax1(targetDivID, url) { alert("processAjax1: START: DivID=[" + targetDivID + "] url=[" + url + "]"); if (window.XMLHttpRequest) { // Non-IE browsers alert("processAjax1: NON IE Browser..."); req = new XMLHttpRequest(); req.onreadystatechange = targetDiv(targetDivID); try { req.open("GET", url, true); } catch (e) { alert("processAjax1: CATCH[" + e + "]"); } req.send(null); } else if (window.ActiveXObject) { // IE Browser alert("processAjax1: IE Browser..."); req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { alert("processAjax1: 1 ..."); if (req.readyState == 4) { // Complete alert("processAjax1:2 ActiveXObject complete..."); if (req.status == 200) { // OK response alert("processAjax1:3 OK Response ..."); document.getElementById(id).innerHTML = req.responseText; } else { alert("processAjax1: Problem: response NOT OK [" + req.statusText + "]"); } } else { alert("processAjax1: ActiveXObject Not complete!..."); } //alert("processAjax1: Completed readyState=[" + req.readyState + "] req.status=[" + req.status + "]"); //req.onreadystatechange = targetDiv(targetDivID); req.open("GET", url, true); req.send(); } } } // --------------------- // Load the HTML of the // requested page // --------------------- function targetDiv(id) { if (req.readyState == 4) { // Complete alert("targetDiv: 1 ..."); if (req.status == 200) { // OK response alert("targetDiv: 2 ..."); document.getElementById(id).innerHTML = req.responseText; } else { alert("Problem: " + req.statusText); } } } // ---------------------------------- // Functions to hide a container // ---------------------------------- var hideFirst=1; var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById; function xDOM(objectId, wS) { if (stdDOM) return wS ? document.getElementById(objectId).style : document.getElementById(objectId); if (ieDOM) return wS ? document.all[objectId].style : document.all[objectId]; if (nsDOM) return document.layers[objectId]; } function hideContainer(objectID,vis) { if (stdDOM) aDOM = 1; else { ieDOM = document.all; if (ieDOM) aDOM = 1; else { var nsDOM = ((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1; } } var objs = xDOM(objectID,1); objs.visibility = vis; } // ---------------------------------------------------- // THE LINKS on the home page. // Details of the links; used instead of separate pages // functions to manage them. // ---------------------------------------------------- // -------- Functions to change colour of links button --- function changeButton(targetID,sourceID) { // This does'nt work - sourceID object has no colour ??? // document.getElementById(targetID).style.backgroundColor=document.getElementById(sourceID).style.backgroundColor; document.getElementById(targetID).style.backgroundColor=defaultMidContainerColour; document.getElementById(targetID).style.color=BLACK; } function changeButtonBack(targetID) { document.getElementById(targetID).style.backgroundColor=defaultLinkButtonColour; document.getElementById(targetID).style.color="#ffffff"; } // ----------------------------------------- // Show current date and time // ----------------------------------------- var timerID = null; var timerRunning = false; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime () { var now = new Date(); var day = now.getDate(); var year = now.getYear(); if (year < 2000) year = year + 1900; var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); var theday = now.getDay(); if (theday == "0") theday = "Sun"; if (theday == "1") theday = "Mon"; if (theday == "2") theday = "Tues"; if (theday == "3") theday = "Wed"; if (theday == "4") theday = "Thurs"; if (theday == "5") theday = "Fri"; if (theday == "6") theday = "Sat"; var themonth = ""; var month = now.getMonth() + 1; if (month == "1") themonth = "Jan"; if (month == "2") themonth = "Feb"; if (month == "3") themonth = "Mar"; if (month == "4") themonth = "Apr"; if (month == "5") themonth = "May"; if (month == "6") themonth = "June"; if (month == "7") themonth = "July"; if (month == "8") themonth = "Aug"; if (month == "9") themonth = "Sept"; if (month == "10") themonth = "Oct"; if (month == "11") themonth = "Nov"; if (month == "12") themonth = "Dec"; // var offset = now.getDay(); //alert("offset=" + offset + "; day=" + day); // if(offset != 0) { // if ( day < 1) { // day = day - offset; // if (month == 1) day = 31 + day; // if (month == 2) day = 31 + day; // if (month == 3) { // if (( year == 00) || ( year == 04)) {day = 29 + day;} // else {day = 28 + day;} // } // if (month == 4) day = 31 + day; // if (month == 5) day = 30 + day; // if (month == 6) day = 31 + day; // if (month == 7) day = 30 + day; // if (month == 8) day = 31 + day; // if (month == 9) day = 31 + day; // if (month == 10) day = 30 + day; // if (month == 11) day = 31 + day; // if (month == 12) day = 30 + day; // if (month == 1) { // month = 12; // year = year - 1; // } else { // month = month - 1; // } // } // } //var timeValue = "" + ((hours >12) ? hours -12 :hours); var timeValue = "" + theday + " " + day + " " + themonth + " " + year + ": " + ((hours >12) ? hours -12 :hours); if (timeValue == "0") timeValue = 12; timeValue += ((minutes < 10) ? ":0" : ":") + minutes; timeValue += ((seconds < 10) ? ":0" : ":") + seconds; timeValue += (hours >= 12) ? " P.M." : " A.M."; document.clock.clockFace.value = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true; } // --- start the clock ------ function startclock() { stopclock(); showtime(); }