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 getZoneForLocation(ID) {
var xmlHttp=GetXmlHttpObject();
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("zone_content").innerHTML=xmlHttp.responseText;
}
}
queryString = '?mode=getZone&id=' + ID;
xmlHttp.open("GET","request_sql.php" + queryString,true);
xmlHttp.send(null);
}

function getStreetsForLocation(ID, ZONE) {
var xmlHttp=GetXmlHttpObject();
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.getElementById("street_content").innerHTML=xmlHttp.responseText;
}
}
queryString = '?mode=getStreets&zone=' + ZONE + "&district=" + ID;
xmlHttp.open("GET","request_sql.php" + queryString,true);
xmlHttp.send(null);
}

function changeDistrict(selVal) {
    getZoneForLocation(selVal);
    getStreetsForLocation(selVal, null);
}

function changeZone(selVal) {
    var distVal = document.getElementById('helyseg').value;
    getStreetsForLocation(distVal, selVal);
}