hova=""

function urit(mit) {
hossz=mit.options.length
	for(i=1;i<=hossz;i++) {	
		mit.options[0] = null; }
}

function jelenik(hely,feladat,kod)
	{ 
	hova=hely
	
	if (feladat==1)
		urit(document.getElementById('k_megyek'))
	urit(document.getElementById('k_varos'))
	if (kod==0)
		{
		return false
		}
	// Mozilla and Friends 
	if (window.XMLHttpRequest)
		{ 
		req = new XMLHttpRequest(); 
		}
	  else
	  	if (window.ActiveXObject)
	  		{ 
			// Internet Explorer 
			req = new ActiveXObject("Microsoft.XMLHTTP"); 
			} 
	req.onreadystatechange = processChoices 
	req.open("GET", "xmlhttp_letolt.php?kod="+kod+"&feladat="+feladat, true); 
	req.send(null); 
	} 

function processChoices()
	{ 
	// wait until the request is done 
	if (req.readyState == 4)
		{ 
		// Make sure request came back OK 
		if (req.status == 200)
			{
			vissza=req.responseText
			if (vissza.length > 0)
				{
				newOptionName = new Option("*** Kérem válasszon ***"  ,0);
				document.getElementById(hova).options[0] = newOptionName;
				sor=vissza.split('\n')
				for (i=0; i<sor.length; i++)
					{ 
					adat=sor[i].split("\t")
					document.getElementById(hova).options[i+1] = new Option(adat[1], adat[0]);
					}
				document.getElementById(hova+"0").style.display=""
				}
			}
  		  else
			{
			alert("Can't retrieve XML: " + req.statusText);
			}
		}
	}
