/**
	XMLHttpRequest
*/
function createXMLHttpRequest() {
	var req = null;
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		try {
			req = new XMLHttpRequest();
		} catch(e) {
		}
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e2) {
				alert("Microsoft XMLHttpRequest create error: "+e2.message);
			}
		}
	}
	return req;
}

/**
	Sends request using XMLHttpRequest
	@param url (string) - request url
	@param data (string) - data sent during request. optional.
	@param type (string) - "POST" or "GET". optional - if data is null it is GET
	@return XMLHttpRequest object or false
*/
function sendRequest(url,data,type) {
	if (typeof(data)=="undefined")
		data = null;
	if (typeof(type)=="undefined")
		type = (data===null?"GET":"POST");
	var async = false;
	var req = createXMLHttpRequest();
	if (req) {
		req.open( type, url, async );
		if (type=="POST") {
			req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		}
		req.send(data);
	}
	return req;
}

