            //call the right constructor for the browser being used
            var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

            function getFiles(){
                getFile("team/posted_prayer_requests.txt");
                getFile("intentions.xml");
                return false;
            }
            
            function getFile(fileName){
                var dateStamp = new Date();
                var theFile = fileName+"?" + dateStamp.getTime();
                var xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = function(){
                    if (xmlhttp.readyState == 4) {
                        if (xmlhttp.responseText != null) {
                            if (fileName == "team/posted_prayer_requests.txt") {
                                updateList(xmlhttp.responseText);
                            }
                            else
                            {
                                updateHF(xmlhttp.responseText);
                            }
                        }
                        else {
                            alert("Failed to receive file from the server - file not found.");
                            return false;
                        }
                    }
                }
                xmlhttp.open('GET', theFile, true);
                xmlhttp.setRequestHeader("Cache-Control", "no-cache");
                xmlhttp.setRequestHeader("Pragma", "no-cache");
                xmlhttp.send(null);
                return false;
            }
            
            function Toggle(item){
                obj = document.getElementById(item);
                if (obj) {
                    visible = (obj.style.display != "none")
                    if (visible) {
                        obj.style.display = "none";
                    }
                    else {
                        obj.style.display = "block";
                    }
                }
            }

            function monthItem(monthxml)
            {
                this.monthval;
                this.general;
                this.mission;
                var properties = new Array("monthval", "general", "mission");
                var tmpElement = null;
                for (var i=0; i<properties.length; i++)
                {
                    tmpElement = monthxml.getElementsByTagName(properties[i])[0];
                    try {
                        if (tmpElement != null)
                            eval("this."+properties[i]+"=tmpElement.childNodes[0].nodeValue");
                        if (properties[i]=="monthval")
                        {
                             this.monthval = new Date(Date.parse(this.monthval));
                        }
                    } catch (exception) {
                    }
                }
            }

            function Intentions(intentionsxml)
            {
                this.months = new Array();
                var intentionsElement = intentionsxml.getElementsByTagName("intentions");
                var monthElements = intentionsxml.getElementsByTagName("month");
                            
                for (var i=0; i<monthElements.length; i++)
                {
                    Item = new monthItem(monthElements[i]);
                    this.months.push(Item);
                }
            }

            function ReqItem(itemArray){
                //required
                this.names;
                this.untilDate;
                this.urgentTime;
                this.intention;
                this.submitter;
                this.submitDate;
                this.names = itemArray[0];
                this.intention = itemArray[6];
                this.submitter = itemArray[7];
                this.submitDate = new Date(Date.parse(itemArray[8] + " " + itemArray[9]));
                
                var testDate = null;
                if (itemArray[1] != "--") {
                    testDate = new Date(Date.parse(itemArray[1]));
                }
                if (testDate == null || 
                    (testDate.getDate() < this.submitDate.getDate() && 
                     testDate.getMonth() < this.submitDate.getMonth() &&
                     testDate.getYear() < this.submitDate.getYear())) {
                    if (testDate == null) {
                        testDate = new Date(Date.parse(itemArray[8]));
                    }
                    testDate.setDate(this.submitDate.getDate());
                    testDate.setMonth(this.submitDate.getMonth());
                    testDate.setYear(this.submitDate.getYear());
                    testDate.setDate(testDate.getDate() + 30);
                }
                this.untilDate = testDate;
                
                if (itemArray[2] != "--") {
                    if (itemArray[3] != "--" && itemArray[4] != "--" && itemArray[5] != null && itemArray[5] != "--") {
                        this.urgentTime = new Date(Date.parse(itemArray[2] + " " + itemArray[3] + ":" + itemArray[4] + " " + itemArray[5].toUpperCase()));
                    }
                    else {
                        this.urgentTime = new Date(Date.parse(itemArray[2]));
                    }
                }
            }
            function formatTime(dateObj, style)
            {
                if (style==0)
                {
                    var theHour = dateObj.getHours();                
                    var theMinutes = dateObj.getMinutes();
                    if (theMinutes < 10)
                    {
                       theMinutes = "0"+theMinutes;
                    }
                    var a_p = "AM";
                    if (theHour == 0)
                    {
                       theHour = 12;
                    }
                    else if (theHour > 12)
                    {
                       theHour = theHour - 12;
                       a_p = "PM";
                    }
                    return theHour + ":" + theMinutes + " " + a_p + ", " + m_names[dateObj.getMonth()] + " " + dateObj.getDate() + ", " + dateObj.getFullYear()
                }
                else
                {
                    return m_names[dateObj.getMonth()] + " " + dateObj.getDate() + ", " + dateObj.getFullYear()
                }
            }
            
            function updateList(fileContents){
                var junkFilt = /\n/
                var spudly = fileContents.split(junkFilt);
                for (var junk = 1; junk < spudly.length; junk++) {
                    if (spudly[junk].length > 0) {
                        spudly[junk] = spudly[junk].replace(/^"/, "").replace(/"$/, "").replace(/""/g, '"--"');
                        spudly[junk] = spudly[junk].split(/" "/);
                        spudly[junk] = new ReqItem(spudly[junk]);
                    }
                    else {
                        spudly[junk] = null;
                    }
                }
                var out = "";
                var today = new Date();
                for (var junk = spudly.length-1; junk > 1; junk--) {
                    if (spudly[junk] != null && 
                        spudly[junk].names != null &&
                        today < spudly[junk].untilDate) {
                        out += "<a href=\"javascript:Toggle('int" + junk + "');\">"
                        out += spudly[junk].names 
                        out += "</a>";
                        if (spudly[junk].urgentTime!=null)
                        {
                            out += " especially at " + formatTime(spudly[junk].urgentTime, 0);
                        }
                        out += "<div id=\"int" + junk + "\">";
                            out += "<b>Intention</b>:<br>";
                            if (spudly[junk].intention!=null)
                                out += spudly[junk].intention;
                            out += "<br><br>";
                            
                            out += "<font style=\"font-size: 90%; font-style: italic\">";
                            out += "<b>Remember until</b>: ";
                            if (spudly[junk].untilDate!=null)
                                out += formatTime(spudly[junk].untilDate, 1);
                            out += "<br><br>";
                            out += "<b>Submitted by:</b>";
                            if (spudly[junk].submitter!=null)
                                out += spudly[junk].submitter;
                            out += "<br>";
                            if (spudly[junk].submitDate!=null)
                                out += formatTime(spudly[junk].submitDate, 1);
                            out += "</font><hr/>";
                        out += "</div><br/>";
                    }
                }
                document.getElementById("requests").innerHTML = out;
                for (var junk = 1; junk < spudly.length; junk++) {
                    if (spudly[junk] != null && today < spudly[junk].untilDate) {
                        Toggle("int" + junk);
                    }
                }
            }

            function updateHF(fileContents){
                var doc = null;
                var months = null;
                var HFInt = null;
                // code for IE
                if (window.ActiveXObject)
                {
                  var doc=new ActiveXObject("Microsoft.XMLDOM");
                  doc.async="false";
                  doc.loadXML(fileContents);
                }
                // code for Mozilla, Firefox, Opera, etc.
                else
                {
                  var parser=new DOMParser();
                  var doc=parser.parseFromString(fileContents,"text/xml");
                }
                if (doc) {
                    HFInt = new Intentions(doc);
                }
                else
                {
                    return false;
                }
                if (HFInt!=null)
                {
                    // locate the current month
                    // load it into the div
                    var today = new Date();
                    var index = -1;
                    for (var inx = 0; inx < HFInt.months.length; inx++) {
                        var checkDate = HFInt.months[inx];
                        checkDate = checkDate.monthval;
                        if (today.getMonth()==checkDate.getMonth() &&
                            today.getYear()==checkDate.getYear())
                            {
                                index = inx;
                                inx = HFInt.months.length;
                            }
                    }
                    var out = "<font style=\"font-size: 75%; font-style: italic\">";
                    out += "for " + m_names[today.getMonth()] + " " + today.getFullYear() + "<br>"                    
                    out += "</font><font style=\"font-size: 90%\">";
                    out += "<b>General</b>:<br>";
                    out += HFInt.months[index].general + "<br>";
                    out += "<b>Mission</b>:<br>";
                    out += HFInt.months[index].mission;
                    document.getElementById("pope").innerHTML = out;
                }
                Toggle("pope");
            }
            
