var xmlHttp
function izbor_mesta(str) { 
	ser=document.getElementById("ser").value;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser ne podrzava ovaj HTTP upit")
		return
	}
	var url="izbor_mesta.php"
	url=url+"?q="+str+"&ser="+ser
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function izbor_familije(ozn) { 
	ser=document.getElementById("ser").value;
	dr=document.getElementById("drzave").value;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser ne podrzava ovaj HTTP upit")
		return
	}
	var url="izbor_familije.php"
	url=url+"?ozn="+ozn+"&dr="+dr+"&ser="+ser
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged1 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function zapis(fam) { 
	me=document.getElementById("mesta").value;
	dr=document.getElementById("drzave").value;
	ser=document.getElementById("ser").value;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser ne podrzava ovaj HTTP upit")
		return
	}
	var url="zapis.php"
	url=url+"?fam="+fam+"&me="+me+"&dr="+dr+"&ser="+ser
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged2 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function promena_mesta_o(dr) {
    var x=document.getElementById("p_lista5");
    for (i = 0; i < x.length; i++) {
        x.remove(x.i);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_mesta.php"
    url=url+"?q="+dr
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged5
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_mesta_m(dr) {
    var x=document.getElementById("p_lista9");
    for (i = 0; i < x.length; i++) {
        x.remove(x.i);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_mesta.php"
    url=url+"?q="+dr
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged9
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_familije_o(me) {
    dr=document.getElementById("p_lista4").value;
    var y=document.getElementById("p_lista6");
    for (j = 0; j < y.length; j++) {
        y.remove(y.j);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_familije.php"
    url=url+"?me="+me+"&dr="+dr
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged6
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_familije_m(me) {
    dr=document.getElementById("p_lista8").value;
    var y=document.getElementById("p_lista10");
    for (j = 0; j < y.length; j++) {
        y.remove(y.j);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_familije.php"
    url=url+"?me="+me+"&dr="+dr
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged10
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_imena_o(fa) {
    dr=document.getElementById("p_lista4").value;
    me=document.getElementById("p_lista5").value;
    var z=document.getElementById("licni_brojo");
    for (k = 0; k < z.length; k++) {
        z.remove(z.k);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_imena.php"
    url=url+"?me="+me+"&dr="+dr+"&fa="+fa
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged7
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_imena_m(fa) {
    dr=document.getElementById("p_lista8").value;
    me=document.getElementById("p_lista9").value;
    var z=document.getElementById("licni_brojm");
    for (k = 0; k < z.length; k++) {
        z.remove(z.k);
    }
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_imena.php"
    url=url+"?me="+me+"&dr="+dr+"&fa="+fa
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged11
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_ostalo_o(lb) {
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_ostalo.php"
    url=url+"?lb="+lb
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged8
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

function promena_ostalo_m(lb) {
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null) {
	alert ("Browser ne podrzava ovaj HTTP upit")
	return
    }
    var url="promena_ostalo.php"
    url=url+"?lb="+lb
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged12
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
}

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 || xmlHttp.readyState=="complete") { 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
	} 
}

function stateChanged1() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("txtHint1").innerHTML=xmlHttp.responseText 
	} 
}

function stateChanged2() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("txtHint2").innerHTML=xmlHttp.responseText 
	} 
}

function stateChanged5() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("p_lista5").innerHTML=xmlHttp.responseText
	}
}

function stateChanged6() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("p_lista6").innerHTML=xmlHttp.responseText
	}
}

function stateChanged7() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("licni_brojo").innerHTML=xmlHttp.responseText
	}
}

function stateChanged8() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("ostalo_o").innerHTML=xmlHttp.responseText
	}
}

function stateChanged9() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("p_lista9").innerHTML=xmlHttp.responseText
	}
}

function stateChanged10() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("p_lista10").innerHTML=xmlHttp.responseText
	}
}

function stateChanged11() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("licni_brojm").innerHTML=xmlHttp.responseText
	}
}

function stateChanged12() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("ostalo_m").innerHTML=xmlHttp.responseText
	}
}
