function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

// EXAMPLE
function ajaxRequest(url, str)
{ 
	xmlHttp=GetXmlHttpObject();
  //	var url="post2.php?"+str;
	xmlHttp.onreadystatechange=function() {
	  if(xmlHttp.readyState==4) {
	    document.getElementById(str).innerHTML=xmlHttp.responseText;
    }
  }

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ajaxRequest2(url, str)
{ 
	xmlHttp2=GetXmlHttpObject();
//	var url="post2.php?"+str;
	xmlHttp2.onreadystatechange=function()
   {
		if(xmlHttp2.readyState==4)
        {
			document.getElementById(str).innerHTML=xmlHttp2.responseText;
//			$.unblockUI();
        }
//		if(xmlHttp.readyState==1)
//		{
//			$.blockUI('<img src="loading.gif">');
//		}
    }

	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
}

function uj_hozzaszolas() {
  var oForm = document.getElementById("hozzaszolas");
  var sBody = getRequestBody(oForm);
        
  var oXmlHttp = zXmlHttp.createRequest();
  oXmlHttp.open("post", oForm.action, true);
  oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            
  oXmlHttp.onreadystatechange = function () {
    if (oXmlHttp.readyState == 4) {
      if (oXmlHttp.status == 200) {
        //saveResult(oXmlHttp.responseText);
        document.getElementById("vendegk_div").innerHTML = oXmlHttp.responseText
        //alert(oXmlHttp.responseText);
      } else {
        //saveResult("An error occurred: " + oXmlHttp.statusText);
        alert("An error occurred: " + oXmlHttp.statusText);
      }
    }
  };
  oXmlHttp.send(sBody);
}

function getRequestBody(oForm) {
  var aParams = new Array();
  for (var i=0 ; i < oForm.elements.length; i++) {
    var sParam = encodeURIComponent(oForm.elements[i].name);
    sParam += "=";
    sParam += encodeURIComponent(oForm.elements[i].value);
    aParams.push(sParam);
  } 
  return aParams.join("&");
}
