// JavaScript Document
/*
	Author: Gabrielle C. Espina
	Created: 2007-12-03
	Updated: 2007-12-03
*/

function GabeHttpRequest(aurl, afunction, adiv, postInfo) {
	
	var method = 'GET';
	
	if(typeof postInfo != "undefined") {
		postInfo = null;
		method = 'POST';
	}
	
	if(typeof adiv != "undefined") {
		adiv.innerHTML = "<center>Loading content.<br />Please wait.</center>";
	}
	
	var httpreq = null;
	
	if(GabeUtil.isIE()) {
		httpreq = new ActiveXObject("Msxml2.XMLHTTP");
		if(!httpreq) {
			httpreq = new ActiveXObject("Microsoft.XMLHTTP");	
		}
	} else {
		httpreq = new XMLHttpRequest();
	}
	
	httpreq.onreadystatechange = function() {
		if(httpreq.readyState == 4) {
			if(httpreq.status == 200) {
				afunction(httpreq.responseText);
			}	
		}
	}
	
	httpreq.open(method, aurl);
	httpreq.send(postInfo);
	
}