function getDistricts(){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var okresy = httpRequest.responseXML.getElementsByTagName('district');
			var cell = document.getElementById("district");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			var cell = document.getElementById("town");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			document.getElementById("district").appendChild(new Option("- Vyberte -",""));
			document.getElementById("town").appendChild(new Option("- Vyberte -",""));
			for (var i=0; i < okresy.length; i++) {
				document.getElementById("district").appendChild(new Option(okresy[i].firstChild.data,okresy[i].getAttribute('id')));
			}
		} else {
			alert("Chyba při načítání stránky "+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}
function getTowns(){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var mesta = httpRequest.responseXML.getElementsByTagName('town');
			var cell = document.getElementById("town");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			document.getElementById("town").appendChild(new Option("- Vyberte -",""));
			for (var i=0; i < mesta.length; i++) {
				document.getElementById("town").appendChild(new Option(mesta[i].firstChild.data,mesta[i].getAttribute('id')));
			}
		} else {
			alert("Chyba při načítání stránky "+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}
function getdata(url,func){
	if (url != ''){
		if (window.ActiveXObject){
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			httpRequest = new XMLHttpRequest();
		}
		httpRequest.open("GET", url, true);
		httpRequest.onreadystatechange= function () { eval(func); } ;
		httpRequest.send(null);
	}
}
/*
function getDistrictsL(){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var okresy = httpRequest.responseXML.getElementsByTagName('district');
			var cell = document.getElementById("district");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			var cell = document.getElementById("town");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			document.getElementById("district").appendChild(new Option("- Vyberte -",""));
			document.getElementById("town").appendChild(new Option("- Vyberte -",""));
			var a=0;
			document.getElementById("locations").innerHTML="";
			//alert(okresy.length+" "+Math.ceil(okresy.length/3));
			for (var i=0; i < Math.ceil(okresy.length/3); i++) {
				//document.getElementById("district").appendChild(new Option(okresy[i].firstChild.data,okresy[i].getAttribute('id')));
				loc = document.getElementById("locations");
				var row = document.createElement('tr');
				//alert(row);
				for(j=0;j<3;j++){
					var cell = document.createElement('td');
					//alert(a);
					//alert(okresy[a].firstChild.data)
					if(okresy[a]){
						var textNode = document.createTextNode(okresy[a].firstChild.data);
						cell.appendChild(textNode);
						row.appendChild(cell);
						a++;
					}
				}
				//alert(row);
				loc.appendChild(row);
				//new Option(okresy[i].firstChild.data,okresy[i].getAttribute('id'))
				//document.getElementById("location").appendChild();
			}
		} else {
			alert("Chyba při načítání stránky "+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}
function getTownsL(){
	if (httpRequest.readyState == 4){
		if(httpRequest.status == 200){
			var mesta = httpRequest.responseXML.getElementsByTagName('town');
			var cell = document.getElementById("town");
			if ( cell.hasChildNodes()){
				while ( cell.childNodes.length >= 1 ){
					cell.removeChild(cell.firstChild);
				}
			}
			document.getElementById("town").appendChild(new Option("- Vyberte -",""));
			for (var i=0; i < mesta.length; i++) {
				document.getElementById("town").appendChild(new Option(mesta[i].firstChild.data,mesta[i].getAttribute('id')));
			}
		} else {
			alert("Chyba při načítání stránky "+ httpRequest.status +":"+ httpRequest.statusText);
		}
	}
}
*/