/*
 * Si utilizas este codigo por favor no elimines esta cabecera.
 * para mas Codigos, Scripts y Aplicaciones visita www.tutores.org
 * Estas lineas de codigo han sido adaptadas para este script.
*/
var url = "comprueba.php?provincia=";
function handleHttpResponse() {
  if (http.readyState == 4) {
    results = http.responseText.split("|");
	resultado = results[0];
	if(resultado != '') {
		document.getElementById('provincias').innerHTML = results[1];
		if(resultado == 'no') {
			document.getElementById('provincias').style.color = '';
			
		} else {
			document.getElementById('provincias').style.color = '';
			
		}
		document.getElementById('provincias').style.background = '';
	}
  }
}
function comprueba_provincias(selObj,restore) {
	
	 var VALOR =  eval("'"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
	document.getElementById('provincias').style.background = '';
	document.getElementById('provincias').style.padding = '';
	try{
		var loginelegido = VALOR;
	// var loginelegido = document.getElementById("pais").value; 
	 http.open("GET", url + escape(loginelegido), true); 
	 http.onreadystatechange = handleHttpResponse; 
	 http.send(null);
	} catch (e) {
		setTimeout("comprueba_provincias(selObj,restore)", 400);
	}
}
function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5) try { 
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
	} catch (e) { 
		try { 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (E) { 
			xmlhttp = false; 
		} 
	} @else xmlhttp = false; 
	@end 
	@*/  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp; 
} 
var http = getHTTPObject(); 

