function valto_keres(x) {
	document.getElementById('meret').value=x;
	document.getElementById('kereses').value=1;
	document.getElementById('form_auto_tipus_kereso').action='autotipusok_kereso.php';
	document.getElementById('form_auto_tipus_kereso').submit();
}

hova=""

function urit(mit) {
hossz=mit.options.length
	for(i=1;i<=hossz;i++) {	
		mit.options[0] = null; }
}

function jelenik(hely, feladat, gyartmany_id, tipus_id, evjarat_id)
	{ 
	hova=hely;
	
	if (feladat==1) { 
		urit(document.getElementById('tipus_id'));
		urit(document.getElementById('evjarat_id'));
		urit(document.getElementById('modell_id'));
		document.getElementById('auto_kereso_div').innerHTML='<div style="height:160px;"></div>';
	}
	
	if (feladat==2) {
		urit(document.getElementById('evjarat_id'));
		urit(document.getElementById('modell_id'));
		document.getElementById('auto_kereso_div').innerHTML='<div style="height:160px;"></div>';
	}

	if (feladat==3) {
		urit(document.getElementById('modell_id'));
		document.getElementById('auto_kereso_div').innerHTML='<div style="height:160px;"></div>';
	}
	
	//urit(document.getElementById('k_varos'))
	//alert('gyartmany_id:'+document.getElementById('gyartmany_id').value+' tipus_id:'+document.getElementById('tipus_id').value);
	
	if (gyartmany_id==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?gyartmany_id="+gyartmany_id+"&tipus_id="+tipus_id+"&evjarat_id="+evjarat_id+"&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(';')
				for (i=0; i<sor.length; i++)
					{ 
					adat=sor[i].split(",")
					document.getElementById(hova).options[i+1] = new Option(adat[1], adat[0]); 
					} 
				}
			  else
				{ 
				alert("Nincs adat!"); 
				} 
			}
  		  else
			{ 
			alert("Can't retrieve XML: " + req.statusText); 
			} 
		} 
	} 
	
	
function jelenik_adat(gyartmany_id, tipus_id, evjarat_id, modell_id)
	{ 

	// Mozilla and Friends 
	if (window.XMLHttpRequest)
		{ 
		req = new XMLHttpRequest(); 
		}
	  else
	  	if (window.ActiveXObject)
	  		{ 
			// Internet Explorer 
			req = new ActiveXObject("Microsoft.XMLHTTP"); 
			} 

	req.onreadystatechange = processChoices_adat 
	req.open("GET", "xmlhttp_letolt_eredmeny.php?gyartmany_id="+gyartmany_id+"&tipus_id="+tipus_id+"&evjarat_id="+evjarat_id+"&modell_id="+modell_id, true); 
	req.send(null); 
	} 
	
function processChoices_adat()
	{ 
	// 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)
				{
				
				document.getElementById('auto_kereso_div').innerHTML=vissza;
				
				
				}
			  else
				{ 
				alert("Nincs adat!"); 
				} 
			}
  		  else
			{ 
			alert("Can't retrieve XML: " + req.statusText); 
			} 
		} 
	} 	

