function getTab(tab, scid, xmlCatch) {
  if (xmlCatch == 1) {
    document.getElementById("generalInfo").innerHTML="<div id='hubLoader'><p>The school's KeyFacts are not available at this time.<br/>We are currently working to update our database and will display the information as soon as it is available.</p></div>";
  } else {
    document.getElementById("generalInfo").innerHTML="<div id='hubLoader'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='250' height='20'><param name='movie' value='/_f/loader.swf' /><param name='quality' value='high' /><embed src='/_f/loader.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='250' height='20'></embed></object></div>";
    loadXMLDoc(tab, "/school/"+tab+".jsp?scid="+scid);
  }

  
}

var req;

function loadXMLDoc(tab,url) {
	req = false;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function() { processReqChange(tab); }
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() { processReqChange(tab); }
            req.open("GET", url, true);
            req.send();
        }
    }
}

function processReqChange(tab) {
    // only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		
		if (req.status == 200) {
			document.getElementById("navCell1").className = "hub_keyfactsNavCell_f";
			document.getElementById("navCell2").className = "hub_keyfactsNavCell";
			document.getElementById("navCell3").className = "hub_keyfactsNavCell";
			document.getElementById("navCell4").className = "hub_keyfactsNavCell";
			document.getElementById("navCell5").className = "hub_keyfactsNavCell_l";
			
			switch(tab) {
			  case(tab = ""):
				document.getElementById("navCell1").className = "hub_keyfactsNavCell_f_active";
				break
			  case(tab = "admissions"):
				document.getElementById("navCell2").className = "hub_keyfactsNavCell_active";
				break
			  case(tab = "financialAid"):
				document.getElementById("navCell3").className = "hub_keyfactsNavCell_active";
				break
			  case(tab = "majorsDegrees"):
				document.getElementById("navCell4").className = "hub_keyfactsNavCell_active";
				break
			  case(tab = "studentLife"):
				document.getElementById("navCell5").className = "hub_keyfactsNavCell_l_active";
				break
			}
			
			document.getElementById("generalInfo").innerHTML=req.responseText;
			
		} else {
			//alert("There was a problem retrieving the XML data:\n" + req.statusText)
			//David Gilardi 12/21/2007:  I added the following code as a temporary change until I find
			//  the correct way to handle when an XML document does not exist.
			document.getElementById("hubLoader").innerHTML="<center><br/><br/><br/><p>The school's KeyFacts are not available at this time.<br/> We are currently working to update our database and will display the information as soon as it is available.</p></center>";
		}
/* these 2 lines are causing JavaScript errors as of Mar 3 2009. commenting out to avoid errors.
		//Re-register exit links after tab switch
		Behaviour.register(myrules);
		Behaviour.apply();
*/
	}
}
