	function npeGetHttp()
	{
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try
			{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlhttp = new
					ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (E)
				{
					xmlhttp = false;
				}
			}
		@else
			xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
		{
			try
			{
				xmlhttp = new XMLHttpRequest();
			}
			catch (e)
			{
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}

	/**
	*	Загружает данные с указанного адреса в элемент страницы с заданным id
	*	@param id
	* 	@param url
	*	@param attr = 0 - innerHTML, 1 - value
	*/
	function npeLoadElement(id, url, attr)
	{
		//if(!this.http)
		{
			this.npeHttp = npeGetHttp();
			this.npeWorking = false;
		}

		if (!this.npeWorking && this.npeHttp)
		{
			var http = this.npeHttp;
			var rnd = Math.floor(Math.random()*10000000);
			if (url.indexOf ("?")>0)
				url = url + "&npeAjaxRnd=" + rnd;
			else
				url = url + "?npeAjaxRnd=" + rnd;

			this.npeHttp.open("GET", url, true);
			this.npeHttp.onreadystatechange = function()
			{
				if (http.readyState == 4)
				{
					if (attr==0)
						document.getElementById(id).innerHTML = http.responseText;
					else
					if (attr==1)
						document.getElementById(id).value = http.responseText;

					this.npeWorking = false;
				}
			}
			this.npeWorking = true;
			this.npeHttp.send(null);
		}
		if(!this.npeHttp)
		{
			alert('Ошибка при создании XMLHTTP объекта!')
		}
	}

	/**
	*	Загружает данные с указанного адреса в строку
	* 	@param url
	*/
	function npeLoadString(url)
	{
		//if(!this.http)
		{
			this.npeHttp = npeGetHttp();
			this.npeWorking = false;
		}

		if (!this.npeWorking && this.npeHttp)
		{
			var http = this.npeHttp;
			var rnd = Math.floor(Math.random()*10000000);
			if (url.indexOf ("?")>0)
				url = url + "&npeAjaxRnd=" + rnd;
			else
				url = url + "?npeAjaxRnd=" + rnd;

			this.npeHttp.open("GET", url, true);
			this.npeHttp.send(null);
			this.npeHttp.onreadystatechange = function()
			{
				if (http.readyState == 4)
				{
					this.npeWorking = false;
					return http.responseText;
				}
			}
			this.npeWorking = true;
		}
		if(!this.npeHttp)
		{
			alert('Ошибка при создании XMLHTTP объекта!')
		}
	}
