

//check that browser can use xmlhttp
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {			
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");			
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}


//var xmlhttp = new ActiveXObject("Msxml2.XMLHttp");



function MakeXmlhttp()
// method that connects between scripts
{
		var xmlHttp;
		try
		{	
			xmlHttp = new ActiveXObject("Msxml2.XMLHttp");
		}
		catch(e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
			}
			catch(e2)
			{
			}
		}
		
		if(xmlHttp == undefined && (typeof XMLHttpRequest != 'undefined'))
		{
			xmlHttp = new XMLHttpRequest();
		}
		return xmlHttp;
}


function zzzzzzzzMakeXmlhttp(){

var xmlhttp=false;


if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

return xmlhttp
}

































// this is a helper function
// method: get/post
// url: the url to make the request
// callbackfunction: create in the calling code with ccFunction = function {}
// data: the data sent, if its a get this variable will be added to url with a ? mark
// asyncCall: true - make the request async, false - make a synchronous request
function sendXmlHttpRequest(method, url, callbackFunction, data, asyncCall) {

	if (method.toLowerCase() == "post") {
		xmlhttp.open("POST", url, asyncCall);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		 
		xmlhttp.onreadystatechange = callbackFunction;
		xmlhttp.send(data);
	} else if (method.toLowerCase() == "get") {
		xmlhttp.open("GET", url + "?" + data, asyncCall);
		xmlhttp.onreadystatechange = callbackFunction;
		xmlhttp.send(null);
	}

}

function sendXmlHttpRequestNoCallback(method, url, data, asyncCall) {

	if (method.toLowerCase() == "post") {
		xmlhttp.open("POST", url, asyncCall);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		 		
		xmlhttp.send(data);
	} else if (method.toLowerCase() == "get") {
		xmlhttp.open("GET", url + "?" + data, asyncCall);		
		xmlhttp.send(null);
	}

}