function createRequestObject()
{
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

function callScriptPOST(loc, url, qstr) {
	var http = createRequestObject();
	var furl = loc + url;
	var params = "rnd=" + Math.floor(Math.random()*100001) + qstr;
	http.open("POST", furl, true);

	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");

	http.onreadystatechange = function () {
			if(http.readyState == 4)
			{ 
				var response = http.responseText;
				//alert(response);
				try
				{
					eval(response.trim());
				}
				catch(err)
				  {
				  //Handle errors here
				  alert(response.trim());
				  }
				//eval(response.trim());
			}
			else
			{
				//waiting
			}
		}; 
	http.send(params);
}


//Calls any Ajax Script from the passed url
function callScript(loc, url, qstr) {
	var http = createRequestObject();
	fUrl = loc + url + "?" + "rnd=" + Math.floor(Math.random()*100001) + qstr;
	http.open('get', fUrl, true);
	http.onreadystatechange = function () {
			if(http.readyState == 4)
			{ 
				var response = http.responseText;
				//alert(response);
				try
				{
					eval(response.trim());
				}
				catch(err)
				  {
				  //Handle errors here
				  alert(response.trim());
				  }
				//eval(response.trim());
			}
			else
			{
				//waiting
			}
		}; 
	http.send(null);
}

//Trim Function
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

//Handles Ajax Response
