String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function createXmlHttpObj()
{
	var xmlHttp;
	try
	{
		// IE7+, Firefox, Opera 8.0+, Safari, Chrome
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			// IE5, IE6
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			alert("Your browser does not support AJAX!");
			return false;
		}
	}
	return xmlHttp;
}

function ajaxFunction(strFileAndVars,strCompleteFunction,objArgs)
{
	var xmlHttp = createXmlHttpObj();
	var d = new Date();

	if (strFileAndVars.indexOf("?") == -1)
		strFileAndVars = strFileAndVars + "?nocachevar=" + d.getTime();
	else
		strFileAndVars = strFileAndVars + "&nocachevar=" + d.getTime();

	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var strResponse = xmlHttp.responseText;
			if (! objArgs)
				window[strCompleteFunction](strResponse.trim());
			else
				window[strCompleteFunction](strResponse.trim(),objArgs);
		}
	}
	xmlHttp.open("GET",strFileAndVars,true);
	xmlHttp.send(null);
}