<!--
// JavaScript Document
function HTTPRequest(initURL){
	
	//<public_properties>
	this.url=null;
	this.dataString="";
	//</public_properties>
	
	//<public_methods>
	this.addRequestHeader=addHTTPRequestHeader;
	this.doReturnedGET=fetch_GET_Sync;
	this.doHandledGET=fetch_GET_aSync;
	this.doReturnedPOST=fetch_POST_Sync;
	this.doHandledPOST=fetch_POST_aSync;
	//</public_methods>
	
	//<private_properties>
	var construct=null;
	var xmlHTTP=null;
	//</private_properties>

	
	
	
	
	
	//<constructor>
	if (initURL!=""){this.url=initURL;}
	
	if (navigator.userAgent.indexOf("MSIE")>=0){ 
		construct='xmlHTTP=new ActiveXObject("Msxml2.XMLHTTP");';
	}
	else if (navigator.appVersion.indexOf("MSIE 5.5")>=0){
		construct='xmlHTTP=new ActiveXObject("Microsoft.XMLHTTP");';
	}
	else if (navigator.userAgent.indexOf("Mozilla")>=0){
		construct='xmlHTTP=new XMLHttpRequest();';
	}
	
	try{
		eval(construct);
	}
	catch(e){handleException(e);}
	//</constructor>
	
	
	
	
	function addHTTPRequestHeader(label, value){
		if (xmlHTTP!=null){
			xmlHTTP.setRequestHeader(label, value);
		}
	}
	
	
	
	
	function buildGETURL(url,dataString){
		var result=url;
		if (dataString!=''){result+="?"+dataString;}
		return result;
	}
	
	
	
	
	
	function sendXMLHTTP(xmlHTTPObj,data){
		xmlHTTPObj.send(data);
	}
	
	
	
	
	
	function handleException(e){
		alert("Error occurred: " + e.description);
	}
	
	
	
	
	
	
	function fetch_GET_Sync(){
		try{
			xmlHTTP.open("GET",buildGETURL(this.url, this.dataString),false);
			sendXMLHTTP(xmlHTTP,null);
			
			return xmlHTTP.responseText;
		}
		catch(e){handleException(e);}
	}
	
	
	
	
	
	function fetch_GET_aSync(clientResponseHandler){
		try{
			xmlHTTP.onreadystatechange=function(){
				if (xmlHTTP.readyState==4 || xmlHTTP.readyState=="complete"){
					if(clientResponseHandler!=null){
						clientResponseHandler(xmlHTTP.responseText);
					}
				}
			}
			
			xmlHTTP.open("GET",buildGETURL(this.url, this.dataString),true);
			sendXMLHTTP(xmlHTTP,null);
		}
		catch(e){handleException(e);}
	}
	
	
	
	
	
	function fetch_POST_Sync(){
		try{
			xmlHTTP.open("POST",this.url,false);
			sendXMLHTTP(xmlHTTP,this.data);
			
			return xmlHTTP.responseText;
		}
		catch(e){handleException(e);}
	}
	
	
	
	
	
	function fetch_POST_aSync(clientResponseHandler){
		try{
			xmlHTTP.onreadystatechange=function(){
				if (xmlHTTP.readyState==4 || xmlHTTP.readyState=="complete"){
					if(clientResponseHandler!=null){
						clientResponseHandler(xmlHTTP.responseText);
					}
				}
			}
			
			xmlHTTP.open("POST",this.url,true);
			sendXMLHTTP(xmlHTTP,this.data);
		}
		catch(e){handleException(e);}
	}
}

/*  EXAMPLE USAGE:
	t=new HTTPRequest("./ConfigReminders.txt");
	t.dataString="id=4&help=now";
	alert(t.doReturnedGET());
	alert(t.doReturnedPOST());
	t.doHandledGET(mm);
	t.url="./rad1 one music.txt";
	t.doHandledPOST(mm);
	
	//note you can use a handled call without nominating a function by passing null as the parameter.

	function mm(g){
		alert("HANDLED: " + g);
	}
*/

//-->