elemId=document.getElementById;

var xmlHttp = new Array(), ajax_count = 0;


function ajax_request(url, post)
{
    try {
	//alert(url);

        var async = true;

        if (window.XMLHttpRequest) {
            // If IE7, Mozilla, Safari, etc: Use native object
            xmlHttp[ajax_count] = new XMLHttpRequest();
            xmlHttp[ajax_count].onload = new Function("ajax_response(" + ajax_count + ")");

        } else {
            if (window.ActiveXObject) {
                // ...otherwise, use the ActiveX control for IE5.x and IE6
                xmlHttp[ajax_count] = new ActiveXObject("Microsoft.XMLHTTP");
                xmlHttp[ajax_count].onreadystatechange = new Function("ajax_response(" + ajax_count + ")");
            }
        }

	//alert('ajax_request:'+mydata[ajax_count]['tagg']);

        var pars = new Array(), k=0;
        if (post) {
            for (var par in post) {
                pars[k++] = escape(par) + "=" + escape(post[par]);
            }
            xmlHttp[ajax_count].open("POST", url, async);
            xmlHttp[ajax_count].setRequestHeader('Content-Type', 'text/html; charset=windows-1251; application/x-www-form-urlencoded;');
            xmlHttp[ajax_count++].send(pars.join('&'));
        } else {
            xmlHttp[ajax_count].open("GET", url, async);
            xmlHttp[ajax_count].setRequestHeader('Content-Type', 'text/html; charset=windows-1251');
            xmlHttp[ajax_count++].send(null);
        }
    } catch(e) {
		//alert("ajax_request: "+e.description);
    }
}

function ajax_response(ajax_count)
{
    try {
        if (xmlHttp[ajax_count].readyState != 4) return;
		//alert(xmlHttp[ajax_count].responseText);


        //xmlHttp[ajax_count].responseText;

        delete xmlHttp[ajax_count];
    } catch(e) {
		//alert("ajax_response: "+e.description);
    }
}

