function HTTPRequest(URL, Method, Asynchronous, CallBackFunction){
	if(window.ActiveXObject)HTTPObject=new ActiveXObject("Microsoft.XMLHTTP");
	else if(window.XMLHttpRequest)HTTPObject=new XMLHttpRequest();
	else{
		alert("Your browser does not support AJAX.");
		HTTPObject=null;
	}

	if(HTTPObject!=null){
		HTTPObject.open(Method, URL, Asynchronous);
		if(Asynchronous)HTTPObject.onreadystatechange = function(){ProcessHTTPResponse(HTTPObject, CallBackFunction);}
		HTTPObject.send(null);
		
		if(!Asynchronous){
			HTTPResponse=HTTPObject.responseText;
			return HTTPResponse;
		}
		else{
			return null;
		}
	}
}

function ProcessHTTPResponse(HTTPObject, CallBackFunction){
	if(HTTPObject.readyState == 4){
		HTTPResponse=HTTPObject.responseText;
		if(CallBackFunction!=null)CallBackFunction(HTTPResponse);
	}
}

/*
	Purpose: Fetch contents dynamically using HTTP protocol
	Author: Shahriar Kabir (SKJoy2001@Yahoo.Com)
	Date : Monday, November 20, 2006

	Funtion list:

	    HTTPGet(HTTPURL, UseOwnDomain)
*/

function HTTPGet(HTTPURL, UseOwnDomain){//alert(HTTPURL);
	/*
	    Implementation of AJAX to fetch the output of a given URL for HTPP GET method.

	    HTTPURL (string) = URL to navigate to for HTTP output in GET method
	    UseOwnDomain (boolean) = Will prepend current domain name part before the given url and the output will be "http://" + www.domainname.com + "/" + URL
	*/

	var pageRequest = false; //variable to hold ajax object
	/*@cc_on
	   @if (@_jscript_version >= 5)
	      try {
	      pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
	      }
	      catch (e){
	         try {
	         pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
	         }
	         catch (e2){
	         pageRequest = false
	         }
	      }
	   @end
	@*/

	if(!pageRequest && typeof XMLHttpRequest != 'undefined')pageRequest = new XMLHttpRequest();
	HTTPResponse='Couldn\'t get data!';

	if(pageRequest){ //if pageRequest is not false
	    if(UseOwnDomain)HTTPURL=''+window.location.protocol+'//'+window.location.hostname+window.location.pathname+HTTPURL;

		pageRequest.open('GET', HTTPURL, false); //get page synchronously
		pageRequest.send(null);
		//if viewing page offline or the document was successfully retrieved online (status code=2000)
		if(window.location.href.indexOf("http")==-1 || pageRequest.status==200)HTTPResponse=pageRequest.responseText;
	}

	//alert(HTTPResponse);
	return HTTPResponse;
}

function GetBrowserURL(PathOnly){
	NewURL = window.location.protocol+'//'+window.location.hostname;
	if(PathOnly){
		PathArray = window.location.pathname.split('/');
		for(i=1;i<PathArray.length;i++){
			if(i !=PathArray.length-1){
				NewURL +='/';
				NewURL +=PathArray[i];
			}
		}
		NewURL +='/';
	}
	else{
		NewURL +=window.location.pathname;
	}

	return NewURL;
}
