
	function seleLoc(){		
		//var value=document.getElementById('country').selectedIndex;
		var value = document.getElementById('country').options[document.getElementById('country').selectedIndex].value;
		
		createRequest();
		var url = "xml.php?random="+Math.random()+"&value="+value;
		request.open("GET", url, true);
		request.onreadystatechange = mostraxml1;
		request.send(null);				
	}
	
	function mostraxml1(){
		if (request.readyState == 4) {	
			if(request.status==200){
			
				var oRoot=request.responseXML.documentElement; 
				var nodos = oRoot.childNodes.length;
				
				var d=document.getElementById('location');
				var selectlength=d.length;
				
				//Si el select ya tenia OPTIONS tengo que borrarlos para aņadir los nuevos...
				if(selectlength>1){
					var i=1;
					while (i<selectlength){
						d.remove(d.length-1);
						i=i+1;
					}
				}
								
				//Si hay barrios en la BD procedo...
				if(nodos>0){
									
					d.disabled="";
					//Y los aņado a la lista...
					for (i=0;i<nodos;i++) {
					
						var id=oRoot.childNodes[i].childNodes[0].firstChild.nodeValue;
						var nombre=oRoot.childNodes[i].childNodes[1].firstChild.nodeValue;	
						
						var y=document.createElement('option');
						y.text=nombre;
						y.value=id;
						  
						  try{			d.add(y,null); /* standards compliant */ }
						  catch(ex){	d.add(y); /* IE only */ }
					}
										
				}else{
					d.disabled="disabled";
				}
			}
		}
	}
	
	this.k=0;
	function addElement(){
		if(this.k==0)	document.getElementById('loc').type='text';
	}
