function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}

function xmlIni()
{
	var xmlHttp;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Twoja przeglądarka nie obsługuje AJAXa!");
		  return;
	} 
	else return xmlHttp;
}

function ajaxGet(url,eid)
{
	var xmlHttp = xmlIni();
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{ 
			document.getElementById(eid).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ajaxGetNo(url)
{
	var xmlHttp = xmlIni();
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{ 
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function Ajax2(adres,id)
{
	this.xml = new Array();
	this.adres = adres;
	this.id = id;
	this.wynik = new Array();
	for(i=0;i<adres.length;i++)
	{
		this.xml[i] = xmlIni();
		this.xml[i].open("GET",this.adres[i],false);
		this.xml[i].send(null);
		obj = document.getElementById(this.id[i]);
		if(obj) obj.innerHTML = this.xml[i].responseText;
		this.wynik[i] = this.xml[i].responseText;
	}
}

function Ajax(url,pst,did,f)
{
	//loading(0);
	var xmlHttp=xmlIni();
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{
			obj = $(did);
			if(obj) obj.innerHTML = xmlHttp.responseText;
			//loading(1);
			var wynik=xmlHttp.responseText;
			if(f!="") eval(f);
		}
	}
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; text/html; charset=utf-8');
	xmlHttp.send(pst);
}

function $(id)
{
	return document.getElementById(id);
}
