//Desarrollado por Jesus Liñán
//ribosomatic.com
//Puedes hacer lo que quieras con el código
//pero visita la web cuando te acuerdes

function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function MostrarConsulta(datos,id_ficha){
	divResultado = document.getElementById('resultado');

	ajax=objetoAjax();
	ajax.open("POST", datos+"?id_ficha="+id_ficha);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
			print(divResultado.innerHTML);
			setTimeout("divResultado.innerHTML = ''", 10000);
		}
	}
	ajax.send(null);
}

function MostrarConsulta_mapa(datos,id_ficha){
	divResultado = document.getElementById('resultado');

	ajax=objetoAjax();
	ajax.open("POST", datos+"?id_ficha="+id_ficha);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText;
			if (document.form_imp_mapa.imprimir_mapa.checked || document.form_imp_texto.imprimir_texto.checked){ 
				if (document.form_imp_mapa.imprimir_mapa.checked){ 
					document.getElementById('empresa_subtitulos_imp').style.display='block';
					document.getElementById('map_imp').style.display='block';
				}else{
					document.getElementById('empresa_subtitulos_imp').style.display='none';
					document.getElementById('map_imp').style.display='none';
				}
				if (document.form_imp_texto.imprimir_texto.checked){ 
					document.getElementById('empresa_descripcion_texto_imp').style.display='block';;
				}else{
					document.getElementById('empresa_descripcion_texto_imp').style.display='none';
				}
			}else{
				document.getElementById('empresa_descripcion_texto_imp').style.display='none';
				document.getElementById('empresa_subtitulos_imp').style.display='none';
				document.getElementById('map_imp').style.display='none';
			}
			print(divResultado.innerHTML);
			setTimeout("divResultado.innerHTML = ''", 10000);
		}
	}
	ajax.send(null);
}