
function dispClosings( listingfile, secHeader ) {
   var xmlDoc=null;
   var xmlhttp=null;
   var error="";

/*
   try //Internet Explorer
   {
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load( listingfile + ".xml");
    //document.write(xmlDoc);
   }
   catch(e)
   {
    try //Firefox, Mozilla, Opera, etc.
    {
     xmlDoc=document.implementation.createDocument("","",null);
     xmlDoc.async=false;
     xmlDoc.load( listingfile + ".xml");
     //document.write("FF");
    }
    catch(e)
    {
     try //Google Chrome
     {
      var xmlhttp = new window.XMLHttpRequest();
      xmlhttp.open("GET","/" + listingfile + ".xml",false);
      xmlhttp.send(null);
      xmlDoc = xmlhttp.responseXML.documentElement;
      //document.write("GC");
     }
     catch(e)
     {
      error=e.message;
     }
    }
   }
*/

     try
       {// code for IE7+, Firefox, Chrome, Opera, Safari
         xmlhttp=new XMLHttpRequest();
         xmlhttp.open("GET","/" + listingfile + ".xml",false);
         xmlhttp.send();
         xmlDoc=xmlhttp.responseXML.documentElement;

         datetext=new XMLHttpRequest();
         datetext.open("GET","/closingsdate.txt",false);
         datetext.send();
         document.write(datetext.responseText);
       }
     catch(e)
       {// code for IE6, IE5
         try
           {
             xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
             xmlDoc.async=false;
             xmlDoc.load( "http://ksmu.org/" + listingfile + ".xml");

             datetext=new ActiveXObject("Microsoft.XMLDOM");
             datetext.async=false;
             datetext.load("http://ksmu.org/closingsdate.txt");
             document.write(datetext.firstChild.text);
           }
           catch(e)
           {
             error=e.message;
           }
        }


					     
/* if (window.ActiveXObject)
   {// code for IE
      xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
   }
   else if (document.implementation.createDocument)
   {// code for Mozilla, Firefox, Opera, etc.
      xmlDoc=document.implementation.createDocument("","",null);
   }
   else
   {
      alert('Your browser cannot handle this script');
   }
*/
   if (xmlDoc!=null)
   {
   //xmlDoc.async=false;
   //xmlDoc.load( listingfile + ".xml");
   //document.write("<strong style='font-size:130%'><a name='"+listingfile+"'></a>"+secHeader+"</strong>");
   //document.write(" <a href='" + document.location.pathname + "#'>[top]</a>\n");
   if (xmlDoc.firstChild != null ) {
      document.write("<div>");
      document.write("<h3>Area School Closings</h3>");
      document.write("<table border='0'>");

      var x=xmlDoc.getElementsByTagName("School");
      var schoolname = "";
      var schoolstatus = "";

      //document.write( x.length );

      if(x[0].getElementsByTagName("Name")[0].firstChild != null ) {

         for (i=0;i<x.length;i++)
         { 
            schoolname = x[i].getElementsByTagName("Name")[0].childNodes[0].nodeValue;
            schoolstatus = x[i].getElementsByTagName("Status")[0].childNodes[0].nodeValue;
	    if (x[i].getElementsByTagName("Notes")[0].childNodes[0] != null)
	    	schoolnotes = x[i].getElementsByTagName("Notes")[0].childNodes[0].nodeValue;
	    else
	    	schoolnotes = "";
            if ( schoolstatus.toLowerCase() != "open") {
               document.write("<tr");
	       if (i % 2 == 0) {
	           document.write(">");
	       } else {
	           document.write(" class='schoolalt' >");
	       }
               document.write("<td>");
               document.write( schoolname );
               document.write("</td>");

               if (schoolstatus.toLowerCase() != "closed" ) {
                  document.write("<td> - ");
                  document.write( schoolstatus );
                  document.write("</td>");
               }
	       if (schoolnotes != "" ) {
	          document.write("<td> - ");
		  document.write(schoolnotes);
		  document.write("</td>");
	       }
               document.write("</tr>\n");
            }
         }
      }
      else {
         document.write("<tr><td>There are no school closings listed at this time.</td></tr>\n");
      }
      document.write("</table>");
      document.write("</div>");
   }
   else {
      document.write("<div>The service is unavailable at this time. Please check back later.</div>");
   }
   }
   return 0;
}

var retVal=null;
var listname="";
var i = 1;
var d=new Date();
var weekday=new Array(7);
var months=new Array(12);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
months[0]="Jan";
months[1]="Feb";
months[2]="Mar";
months[3]="Apr";
months[4]="May";
months[5]="Jun";
months[6]="Jul";
months[7]="Aug";
months[8]="Sep";
months[9]="Oct";
months[10]="Nov";
months[11]="Dec";

/*document.write("<div style='font-size:130%;font-weight:bold;text-align:center'>Closings for ");
document.write(weekday[d.getDay()]);
document.write(", ");
document.write(months[d.getMonth()] + " " + d.getDate());
document.write("</div>\n");*/

retVal = dispClosings( "schools", "test");

//}

