// Urgent Message Engine
// Written by Paul Ottley
// Modified with permision by David LeMieux
// copyright 2006


// Global Variable
var req3;

// Call Page pg - pg = url.
function callPage3(pg){
  loadXMLDoc3(pg);
}

// Implementation of Ajax
function loadXMLDoc3(url) {
	req3 = false;
    //document.getElementById("debugger").innerHTML += "I made it into the loadXMLDoc method <br />";
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req3 = new XMLHttpRequest();
        } catch(e) {
			req3 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req3 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req3 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req3 = false;
        	}
		}
    }
	if(req3) {
		
		// Call the process
		req3.onreadystatechange = processReqChange3;
		req3.open("GET", url, true);
		req3.send("");
			
	}
}

// This is the method that will be used to handle the request
function processReqChange3() {
    //document.getElementById("debugger").innerHTML += "<br />Did I make it to the processReqChange method? Yes! readyState=" + req3.readyState;
    // only if req3 shows "loaded"
	//alert("2: readyState: " + req3.readyState + " status: " + req3.status + " response: " + req3.responseText);
    if (req3.readyState == 4) {
        // only if "OK"
        if (req3.status == 200) {
            // ...processing statements go here...
            var respText = req3.responseText;
			if (respText == "") return;
			urgDiv = returnClass3("announcementMessage2");
			urgDiv.innerHTML = respText;
			urgDiv.className = "announcementMessage2";
				} 
		else {
            //alert("There was a problem retrieving the XML data:\n" + req3.statusText);
        }
    }
}


function returnClass3(name) { 
   //Populate the array with all the page tags 
   var allPageTags=document.getElementsByTagName("*"); 
   //Cycle through the tags using a for loop 
   for (i=0; i<allPageTags.length; i++) { 
      //Pick out the tags with our class name 
      if (allPageTags[i].className==name) { 
         //Manipulate this in whatever way you want 
         return allPageTags[i];
      } 
   } 
} 