document.onmousemove = function (e) {
	if ((e) && (e.target) && (e.target.tagName.toLowerCase() == 'option')) return;
	if (document.all) {
		ajax_mouse_x = event.clientX;
		ajax_mouse_y = event.clientY;
		if ((event.srcElement) && (event.srcElement.tagName) && (event.srcElement.tagName.toLowerCase() == 'select')) ajax_mouse_y += 0;
	} else if (document.getElementById) {
		ajax_mouse_x = e.clientX;
		ajax_mouse_y = e.clientY;
	} else if (document.layers) {
		ajax_mouse_x = e.x;
		ajax_mouse_y = e.y;
	} // end if
	if (window.pageXOffset) {
		ajax_mouse_x += window.pageXOffset;
		ajax_mouse_y += window.pageYOffset;
	} else {
		var html = document.getElementsByTagName('html')[0];
		ajax_mouse_x += html.scrollLeft;
		ajax_mouse_y += html.scrollTop;
	} // end if
} // end param

function CheckAsyncRequest(id) {
	var cursor = document.getElementById('load' + id);
	if (cursor) {
		if (ajax_wait_message) alert(ajax_wait_message);
		return false;
	} else {
		return true;
	} // end if
} // end function

function StartAsyncRequest(id) {
	var cursor = document.getElementById('load' + id);
	if (cursor) {
		if (ajax_wait_message) alert(ajax_wait_message);
		return false;
	} else {
		cursor = document.createElement('DIV');
		cursor.id = 'load' + id;
		cursor.className = ajax_cursor_class_name;
		if ((ajax_mouse_x) && (ajax_mouse_y)) {
			cursor.style.left = (ajax_mouse_x + parseInt((ajax_cursor_x_shift) ? ajax_cursor_x_shift : 0)) + 'px';
			cursor.style.top = (ajax_mouse_y + parseInt((ajax_cursor_y_shift) ? ajax_cursor_y_shift : 0)) + 'px';
		} // end if
		if (ajax_cursor_html) cursor.innerHTML = ajax_cursor_html;
		document.body.appendChild(cursor);
		return true;
	} // end if
} // end function

function FinishAsyncRequest(id) {
	var cursor = document.getElementById('load' + id);
	if (cursor) {
		document.body.removeChild(cursor);
	} // end if
} // end function

function HttpRequest(url, post_data, id, param, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) {
	var req = null;
	try {
		req = new XMLHttpRequest();
	} catch(e) {
		req = null;
	} // end try
	if (!req) {
		try {
			req = new ActiveXObject('Msxml2.XMLHTTP');
		} catch(e) {
			req = null;
		} // end try
	} // end if
	if (!req) {
		try {
			req = new ActiveXObject('Microsoft.XMLHTTP');
		} catch(e) {
			req = null;
		} // end try
	} // end if
	if (req) {
		var can_start = (id) ? StartAsyncRequest(id) : true;
		if (can_start) {
			try {
				req.onreadystatechange =
					function () {
						if (req.readyState == 4) {
							if (id) FinishAsyncRequest(id);
							if (req.status == 200) {
								if (param) param(req.responseText, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
							} else {
								alert('Возникла проблема с получением XML данных:\r\n' + req.statusText);
							} // end if
						} // end if
					} // end param
				if (Math.random) url = url + (url.indexOf('?') < 0 ? '?' : '&') + 'random=' + escape(Math.random() * 100000);
				if (post_data) {
					req.open('POST', url, true);
					req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					req.send(post_data);
				} else {
					req.open('GET', url, true);
					req.send('');
				} // end if
			} catch(e) {
				if (id) FinishAsyncRequest(id);
			} // end try
		} // end if
	} else {
		alert('XML компонента не обнаружена на вашем компьютере.');
	} // end if
} // end function

function XmlRootByText(text) {
	var dom = null;
	try {
		dom = new DOMParser();
		if (dom) dom = dom.parseFromString(text, 'text/xml');
		if (dom) dom = dom.documentElement;
	} catch(e) {
		dom = null;
	} // end try
	if (!dom) {
		try {
			dom = new ActiveXObject('Msxml2.DOMDocument');
			if (!dom.loadXML(text)) dom = null;
			if (dom) dom = dom.firstChild;
		} catch(e) {
			dom = null;
		} // end try
	} // end if
	if (!dom) {
		try {
			dom = new ActiveXObject('Microsoft.DOMDocument');
			if (!dom.loadXML(text)) dom = null;
			if (dom) dom = dom.firstChild;
		} catch(e) {
			dom = null;
		} // end try
	} // end if
	return dom;
} // end function

function GetXmlAttributeValue(node, attrName) {
	var attr;
	if ((node) && (attr = node.attributes.getNamedItem(attrName))) {
		return attr.value;
	} else {
		return '';
	} // end if
} // end function

function GetXmlNodeValue(node) {
	if ((node) && (node.text)) {
		return node.text;
	} else if ((node) && (node.firstChild) && (node.firstChild.nodeValue)) {
		return node.firstChild.nodeValue;
	} else {
		return '';
	} // end if
} // end function

function GetXmlNodeByTagName(parent, tagName) {
	if ((parent) && (parent.childNodes)) {
		var i;
		for (i = 0; i < parent.childNodes.length; i++) {
			if (parent.childNodes[i].tagName == tagName) return parent.childNodes[i];
		} // end for
	} // end if
	return null;
} // end function

function GetXmlNodesByTagName(parent, tagName) {
	if ((parent) && (parent.childNodes)) {
		return parent.getElementsByTagName(tagName);
	} else {
		return new Array();
	} // end if
} // end function
