	function getRequestObj()
	{
		if (top.request == null)
			top.request	= new Request();

		return top.request;
	}
	
	function Request() {}

	Request.prototype.req			= null;
	Request.prototype.reqTimeout	= null;
	Request.prototype._postData		= '';

	 
	Request.prototype.loadXMLDoc	= function loadXMLDoc(url, method) {
		this.req = null;
		if (window.XMLHttpRequest) {
			this.req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			this.req = new ActiveXObject('Microsoft.XMLHTTP');
		}
	 
		if (this.req) {
			
			this.req.onreadystatechange = this.processReqChange;
			
			this.req.open(method, url, true);
			if (method == "POST")
				this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=windows-1251"); 
			this.req.send(method == "GET" ? null : (this._postData == '' ? null : this._postData));
			//this.reqTimeout = setTimeout("top.getRequestObj().req.abort();", 5000);
		} else {
			alert("Браузер не поддерживает AJAX");
		}
	}

	Request.prototype.setReqData	= function setReqData(obj) {
		this._postData	= '';
		for (var i in obj)
		{
			this._postData	+= i + "=" + encodeURIComponent(obj[i]) + "&";
		}
	}
	 
	Request.prototype.processReqChange	= function processReqChange() {
		//var req1	= top.getRequestObj().req;
		try
		{
		var req1	= top.getRequestObj().req;
		if (req1.readyState == 4) {
			//clearTimeout(this.reqTimeout);
			// only if "OK"
			if (req1.status == 200) {
				top.getRequestObj().callBackFunc.call(null, req1);
			}
//			else {
//				alert("Не удалось получить данные:\n" + req1.statusText);
//			}
		}  
		}
		catch(e)
		{
			//alert(e);
			//alert(top);
			//alert(top.getRequestObj);
		//
		}
	}
	 
	Request.prototype.stat	= function stat(n)
	{
		switch (n) {
			case 0: return "не инициализирован";
			case 1: return "загрузка...";
			case 2: return "загружено";
			case 3: return "в процессе...";
			case 4: return "готово";
			default: return "неизвестное состояние";  
		}  
	}
	 
	Request.prototype.getData	= function getData(url, feedback, method)
	{
		method	= typeof(method) == 'undefined' ? 'GET' : method;
		this.callBackFunc	= feedback;
		this.loadXMLDoc(url, method);
		//alert(top.request);
		//delete top.request;
	}

