var xmlHttp1 = new Array();
xmlHttp1[0] = createXMLHttpRequest();
//xmlHttp1[1] = GetXmlHttpObject();
//xmlHttp1[2] = GetXmlHttpObject();
//xmlHttp1[3] = GetXmlHttpObject();


//create the object based on the browser (or fail if AJAX not supported)
function GetXmlHttpObject(){
	xmlHttp=null;
	
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	
	return xmlHttp;
}


function createXMLHttpRequest() { 
	var xmlHttp; 
	
	if(window.XMLHttpRequest) { 
		try { 
		xmlhttp = new XMLHttpRequest(); 
		} 
		catch(e) { 
		xmlhttp = false; 
		} 
		} 
		else if(window.ActiveXObject) { 
		try { 
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(e) { 
		xmlhttp = false; 
		} 
		} 
		return xmlhttp; 
	}  
	
	//var req = createXMLHttpRequest(); 



function ajaxQueryClass(str){
	ajax1(str);
}

//rewrites class dropdown box in 'Add Subclass' table when a new section id is selected
function ajax1(str){
	
	var url="getclass.php"+"?m=a&q="+str+"&rid="+Math.random()+"&sid="+new Date().getTime();

	xmlHttp1[0].open("GET",url,true);
	xmlHttp1[0].onreadystatechange=function(){ stateChanged2(str); }
	xmlHttp1[0].send(null);
}

//query to see if the class request is complete
function stateChanged2(str){
	if (xmlHttp1[0].readyState==4){ 
		document.getElementById("fac_id").innerHTML=xmlHttp1[0].responseText;
		//alert(xmlHttp1[0].responseText);
	}
}

