function checkAlvazszam() {
	var v = document.getElementById('alvazszam').value;
	var c = '#f88';
	if ( v.length == 17 ) {
		c = '#fea';
	}
	document.getElementById('alvazszam').style.background = c;
}

function comboBox(event,db,field,id) {
    var oid = document.getElementById(id);
    ajaxKeres(db,field,oid.value,'xselect',id);
    var x = coox(oid);
    var y = cooy(oid);
    var xsel = document.getElementById('xselect');
    xsel.style.left = x + 'px';
    xsel.style.width = '170px'; //oid.offsetWidth+'px';
    xsel.style.top = (y + oid.offsetHeight)+'px';
}
function xSelected(id){
	var v = document.getElementById('s_xselect');
	document.getElementById(id).value=v.options[v.selectedIndex].text;
	document.getElementById('xselect').style.visibility='hidden';
	if ( v.options[v.selectedIndex].id.substr(0,3) == 'uid' ) {
		ajaxKeresValue(v.options[v.selectedIndex].id,'email','email');
		ajaxKeresValue(v.options[v.selectedIndex].id,'mobil','telefon');
		document.getElementById('gyarto').focus();
	} else {
		if ( v.options[v.selectedIndex].id.substr(0,3) == 'gid' ) {
			ajaxKeresValue(v.options[v.selectedIndex].id,'gyid','-');
			document.getElementById('tipus').focus();
		} else {
			document.getElementById('alvazszam').focus();
		}
	}
	hideXS();
}


		function ajaxKeres(db,field,search,id,target)
		{
			var xmlHttp;
			try {
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  			} catch (e) {
  				// Internet Explorer
  				try {
    				xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
				} catch (e) {
					try {
						xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
					} catch (e)	{
      					return false;
      				}
    			}
  			}
  			xmlHttp.onreadystatechange=function() {
    			if(xmlHttp.readyState==4) {
    				document.getElementById(id).innerHTML=xmlHttp.responseText;
    				if ( xmlHttp.responseText.length > 0 ) {
				    document.getElementById(id).style.visibility = 'visible';
				}
      			}
    		}
  			xmlHttp.open('GET','ajax.php?db='+db+'&field='+field+'&search='+search+'&id='+id+'&target='+target,true);
  			xmlHttp.send(null);
  		}
		function ajaxKeresValue(tid,mit,id)
		{
			var xmlHttp;
			try {
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  			} catch (e) {
  				// Internet Explorer
  				try {
    				xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
				} catch (e) {
					try {
						xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
					} catch (e)	{
      					return false;
      				}
    			}
  			}
  			xmlHttp.onreadystatechange=function() {
    			if(xmlHttp.readyState==4) {
    				if ( xmlHttp.responseText != '' ) {
    					document.getElementById(id).value=xmlHttp.responseText;
					}
				}
    		}
  			xmlHttp.open('GET','ajax.php?idv='+tid+'&mit='+mit,true);
  			xmlHttp.send(null);
  		}
		function hideXS() {
		    document.getElementById('xselect').style.visibility='hidden';
		}
		function coox(obj){
		    var cl=0;
		    if(obj.offsetParent){
			while(obj.offsetParent){
			    cl+=obj.offsetLeft;
			    obj=obj.offsetParent;
			}
		    }else if(obj.x) cl+=obj.x;
		    return cl;
		}
		function cooy(obj){
		    var ct=0;
		    if(obj.offsetParent) {
			while(obj.offsetParent){
			    ct+=obj.offsetTop;
			    obj=obj.offsetParent;
			}
		    }else if(obj.y) ct+=obj.y;
		    return ct;
		}

function selDB(th) {
	window.location= "index.php?tartalom=4&keres="+th.options[th.selectedIndex].value;
}

