var datos2="";

//Limpia formulario
function limpia()
{
		//document.frmbuscador.idtipoinmueble.selectedIndex="";
		//document.frmbuscador.idestado.selectedIndex="";
		
		document.frmbuscador.idmunicipio1.selectedIndex="";
		var min = document.frmbuscador.colonia1izq.length;if(min>0){document.frmbuscador.colonia1izq.length=0;}
		var max = document.frmbuscador.colonia1izqb.length;if(max>0){document.frmbuscador.colonia1izqb.length=0;}
		//document.getElementById("fil").innerHTML="";

	//makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=18&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=", modulo2);
}
	
//Limpiamos variables
//OK
function cleancook()
{
	DeleteCookie("idbase");
	DeleteCookie("idopcion");
	DeleteCookie("fechaini");
	DeleteCookie("fechafin");
	DeleteCookie("fra");
	DeleteCookie("idfranq");
	DeleteCookie("idoperacion");
	DeleteCookie("idtipoinmueble");
	DeleteCookie("idestado");
	DeleteCookie("idmunicipio1");
	DeleteCookie("colonia1izqb");
	DeleteCookie("lastval");
	DeleteCookie("condicion");
	DeleteCookie("pasacols");
	DeleteCookie("sta");
}

function cleancook2()
{
	DeleteCookie("pr1");
	DeleteCookie("pr2");
	DeleteCookie("mc1");
	DeleteCookie("mc2");
	DeleteCookie("ba1");
	DeleteCookie("ba2");
	DeleteCookie("ed1");
	DeleteCookie("ed2");
	DeleteCookie("pt1");
	DeleteCookie("pt2");
	DeleteCookie("re1");
	DeleteCookie("re2");
	DeleteCookie("au1");
	DeleteCookie("au2");
}

//OK
function bloqueafecha()
{
	cleancook();
	if (document.frmbuscador.sta[0].checked)
	{
		fecha.style.visibility="hidden";
	}else{
		
		fecha.style.visibility="visible";
		
		if ((document.frmbuscador.sta[1].checked) || (document.frmbuscador.sta[2].checked))
		{
			document.frmbuscador.fechaini.disabled=0;
			document.frmbuscador.fechaini2.disabled=0;
			
			document.frmbuscador.fechafin.disabled=0;
			document.frmbuscador.fechafin2.disabled=0;
		}
	}
}

//OK
function validabase()
{
	cleancook();
	inttemp=0;
	if (document.frmbuscador.sta[0].checked){idbase=1;}
	if (document.frmbuscador.sta[1].checked){idbase=2;}	
	if (document.frmbuscador.sta[2].checked){idbase=3;}	
	document.frmbuscador.idbase.value=inttemp;
}

//OK  Aqui

function validafra1()
{

	document.frmbuscador.idoperacion[0].disabled=0;
	document.frmbuscador.idoperacion[1].disabled=0;
	document.frmbuscador.idoperacion[2].disabled=0;
	document.frmbuscador.idoperacion[3].disabled=0;

	if ((document.frmbuscador.fra[1].checked) || (document.frmbuscador.fra[2].checked)){
	franquicia2.style.visibility="visible";
	}else{
	franquicia2.style.visibility="hidden";
	}
	
	cleancook();
	if (document.frmbuscador.sta[0].checked){idbase=1;}	
	if (document.frmbuscador.sta[1].checked){idbase=2;}	
	if (document.frmbuscador.sta[2].checked){idbase=3;}	
	if (document.frmbuscador.fra[0].checked){frax=1;}	
	if (document.frmbuscador.fra[1].checked){frax=2;}	
	if (document.frmbuscador.fra[2].checked){frax=3;}	
	if (frax>0){makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=11&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax, modulo2);
	}else{alert ("Debe de seleccionar una opción")}
}

//OK
function validafra3()
{
	cleancook();
	if (document.frmbuscador.sta[0].checked){idbase=1;}	
	if (document.frmbuscador.sta[1].checked){idbase=2;}	
	if (document.frmbuscador.sta[2].checked){idbase=3;}	
	if (document.frmbuscador.fra[0].checked){frax=1;}	
	if (document.frmbuscador.fra[1].checked){frax=2;}	
	if (document.frmbuscador.fra[2].checked){frax=3;}	
	if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
	if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
	if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	
	if (document.frmbuscador.idoperacion[3].checked){idoper=4;}	
	if (document.frmbuscador.fra[0].checked>0 || document.frmbuscador.fra[1].checked>0 || document.frmbuscador.fra[2].checked>0){if (idoper>0){makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=13&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper, modulo2);}else{alert ("Debe de seleccionar una opción")}}else{alert ("Debe seleccionar una oficina, franquicia o todos ...");}
}

//OK
function valida4()
{
	cleancook();
	if (document.frmbuscador.sta[0].checked){idbase=1;}	
	if (document.frmbuscador.sta[1].checked){idbase=2;}	
	if (document.frmbuscador.sta[2].checked){idbase=3;}	
	if (document.frmbuscador.fra[0].checked){frax=1;}	
	if (document.frmbuscador.fra[1].checked){frax=2;}	
	if (document.frmbuscador.fra[2].checked){frax=3;}	
	if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
	if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
	if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	
	if (document.frmbuscador.idtipoinmueble.value>0){
	makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=14&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value, modulo2);
	}else{alert ("Debe de seleccionar una opción")}
	
	
	///Aqui va la parte de los filtros

}
//OK

function valida5()
{
	///MUESTRA EL DIV PARA FILTROS
	
	ocultafiltros.style.display = "block";

	
	cleancook();
	if (document.frmbuscador.sta[0].checked){idbase=1;}	
	if (document.frmbuscador.sta[1].checked){idbase=2;}	
	if (document.frmbuscador.sta[2].checked){idbase=3;}	
	if (document.frmbuscador.fra[0].checked){frax=1;}	
	if (document.frmbuscador.fra[1].checked){frax=2;}	
	if (document.frmbuscador.fra[2].checked){frax=3;}	
	if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
	if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
	if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	
	if (document.frmbuscador.idestado.value>0){
	makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=15&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value, modulo2);}else{alert ("Debe de seleccionar una opción")}

	if (datos2!=""){
	fil.style.visibility="visible";
	fil.innerHTML=datos2;
		}

}
//OK
function valida6()
{
		strValues2 = document.frmbuscador.idmunicipio1.value;

		cleancook();		

		if (document.frmbuscador.sta[0].checked){idbase=1;}	
		if (document.frmbuscador.sta[1].checked){idbase=2;}	
		if (document.frmbuscador.sta[2].checked){idbase=3;}	
		if (document.frmbuscador.fra[0].checked){frax=1;}	
		if (document.frmbuscador.fra[1].checked){frax=2;}	
		if (document.frmbuscador.fra[2].checked){frax=3;}	
		if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
		if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
		if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	
	if (document.frmbuscador.idmunicipio1.selectedIndex>0)
	{//alert ("cargacombos.m3?idbase=" + idbase + "&idopcion=16&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + strValues2);
	makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=16&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + strValues2, modulo2);
	}else{alert ("Debe de seleccionar una opción")}
}
//OK
function moveVals(n, from, to) {

	if (document.layers) {
		fromObj = document.layers[from];
		to = document.layers[to];
	} else if (document.getElementsByTagName('*')) {
		//fromObj = document.all(from);
		//to = document.all(to);
		var fromObj = document.getElementById("colonia1izq");
		var to = document.getElementById("colonia1izqb");
	}
		
	if (n == 1 || n == 2) {
		var indTo = to.length-1;

		if (document.frmbuscador.colonia1izq.value==-1)
			{
				for (i=fromObj.length-1; i>=1; i--) {
				indTo++;
				to.options[indTo] = new Option(fromObj.options[i].text, fromObj.options[i].value);
				fromObj.options[i] = null;
				}
			}else{
				for (i=fromObj.length-1; i>=0; i--) {
				if (n==1 || fromObj.options[i].selected) {
				indTo++;
				to.options[indTo] = new Option(fromObj.options[i].text, fromObj.options[i].value);
				fromObj.options[i] = null;
				}
			     }
			}

	} else if (n == 3 || n == 4) {
		var indFrom = fromObj.length-1;
		for (i=to.length-1; i>=0; i--) {
			if (n==4 || to.options[i].selected) {
				indFrom++;
				fromObj.options[indFrom] = new Option(to.options[i].text, to.options[i].value);
				to.options[i] = null;
			}
		}
	}
}

//OK
function saveMe()
{
	
	cuantos.style.visibility="visible";
	
	var boxLength = document.frmbuscador.colonia1izqb.length;
	var count = 0;
	if (boxLength != 0)
	{
		for (i = 0; i < boxLength; i++)
		{
			if (count == 0)
			{
				strValues = document.frmbuscador.colonia1izqb.options[i].value;
			}else{
				strValues = strValues + "," + document.frmbuscador.colonia1izqb.options[i].value;
			}
			count++;
		}
	}
	
	strValues2 = document.frmbuscador.idmunicipio1.value;
	if (strValues.length == 0)
	{
		alert("No has hecho ninguna selección");
	}else{
		cleancook();
		if (document.frmbuscador.sta[0].checked){idbase=1;}	
		if (document.frmbuscador.sta[1].checked){idbase=2;}	
		if (document.frmbuscador.sta[2].checked){idbase=3;}	
		if (document.frmbuscador.fra[0].checked){frax=1;}	
		if (document.frmbuscador.fra[1].checked){frax=2;}	
		if (document.frmbuscador.fra[2].checked){frax=3;}	
		if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
		if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
		if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	
		if (document.frmbuscador.colonia1izqb.length>0)
		{
			//alert ("cargacombos.m3?idbase=" + idbase + "&idopcion=17&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + strValues2 + "&colonia1izqb=" + strValues)
			makeRequest("cargacombos.m3?idbase=" + idbase + "&idopcion=17&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + strValues2 + "&colonia1izqb=" + strValues , modulo2);
		}else{alert ("Debe de agregar una colonia")}
	}
		
}

pasa2="";
pasa="";

function enviacol(val)
{
document.frmbuscador.pasacols.value=strValues

//Guardamos las busquedas realizadas
if (val==1){
if (document.frmbuscador.sta[0].checked){idbase=1;}	
if (document.frmbuscador.sta[1].checked){idbase=2;}	
if (document.frmbuscador.sta[2].checked){idbase=3;}	

fechaini = document.frmbuscador.fechaini.value;
fechafin = document.frmbuscador.fechaini.value;

if (document.frmbuscador.fra[0].checked){frax=1;}	
if (document.frmbuscador.fra[1].checked){frax=2;}	
if (document.frmbuscador.fra[2].checked){frax=3;}	

idfra = document.frmbuscador.idfranq.value;

if (document.frmbuscador.idoperacion[0].checked){idoper=1;}	
if (document.frmbuscador.idoperacion[1].checked){idoper=2;}	
if (document.frmbuscador.idoperacion[2].checked){idoper=3;}	

idtipoinmueble = document.frmbuscador.idtipoinmueble.value;
idestado = document.frmbuscador.idestado.value;
idmunicipio1 = document.frmbuscador.idmunicipio1.value;

filtros();

	makeRequest("menuinf/insgdabsq2.m3?base=" + idbase + "&fechaini="+fechaini + "&fechafin="+fechafin + "&fra1="+frax + "&fra2="+idfra + "&idoperacion="+idoper + "&idtipoinmueble="+idtipoinmueble + "&idestado="+idestado + "&idmunicipio="+idmunicipio1 + "&coloniader="+strValues + "&filtros="+pasa2 + "&tmp=1", moduloinsbsq);
	}
}
function moduloinsbsq(){if (http_request.readyState==4){datos=http_request.responseText;eval(datos);}}

function filtros()
{
		Pre1="";Pre2="";M2t1="";M2t2="";M2c1="";M2c2="";Rec1="";Rec2="";Ban1="";Ban2="";Aut1="";Aut2="";
		Eda1="";Eda2="";Msu1="";Msu2="";Mfr1="";Mfr2="";Mfo1="";Mfo2="";Pis1="";Pis2="";M2a1="";M2a2="";And1="";And2=""; 
		
		var objTxt=document.getElementsByTagName('INPUT');
		for(i=0;i<objTxt.length;i++)
		{
		
			if(objTxt[i].type==="text")
			{
				if (objTxt[i].name=='Pre1'){Pre1=objTxt[i].value;}if (objTxt[i].name=='Pre2'){Pre2=objTxt[i].value;}
				if (objTxt[i].name=='M2t1'){M2t1=objTxt[i].value;}if (objTxt[i].name=='M2t2'){M2t2=objTxt[i].value;}
				if (objTxt[i].name=='M2c1'){M2c1=objTxt[i].value;}if (objTxt[i].name=='M2c2'){M2c2=objTxt[i].value;}
				if (objTxt[i].name=='Rec1'){Rec1=objTxt[i].value;}if (objTxt[i].name=='Rec2'){Rec2=objTxt[i].value;}
				if (objTxt[i].name=='Ban1'){Ban1=objTxt[i].value;}if (objTxt[i].name=='Ban2'){Ban2=objTxt[i].value;}
				if (objTxt[i].name=='Aut1'){Aut1=objTxt[i].value;}if (objTxt[i].name=='Aut2'){Aut2=objTxt[i].value;}
				if (objTxt[i].name=='Eda1'){Eda1=objTxt[i].value;}if (objTxt[i].name=='Eda2'){Eda2=objTxt[i].value;}
				if (objTxt[i].name=='Msu1'){Msu1=objTxt[i].value;}if (objTxt[i].name=='Msu2'){Msu2=objTxt[i].value;}
				if (objTxt[i].name=='Mfr1'){Mfr1=objTxt[i].value;}if (objTxt[i].name=='Mfr2'){Mfr2=objTxt[i].value;}
				if (objTxt[i].name=='Mfo1'){Mfo1=objTxt[i].value;}if (objTxt[i].name=='Mfo2'){Mfo2=objTxt[i].value;}
				if (objTxt[i].name=='Pis1'){Pis1=objTxt[i].value;}if (objTxt[i].name=='Pis2'){Pis2=objTxt[i].value;}
				if (objTxt[i].name=='M2a1'){M2a1=objTxt[i].value;}if (objTxt[i].name=='M2a2'){M2a2=objTxt[i].value;}
				if (objTxt[i].name=='And1'){And1=objTxt[i].value;}if (objTxt[i].name=='And2'){And2=objTxt[i].value;}
			}
		}


		idtinm = document.frmbuscador.idtipoinmueble.value;
		
		if (idtinm==4 || idtinm==20 || idtinm==10 || idtinm==14 || idtinm==9 || idtinm==11){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Rec1)!=""){Rec1=Rec1;Rec2=Rec2;}
			if ((Ban1)!=""){Ban1=Ban1;Ban2=Ban2;}
			if ((Aut1)!=""){Aut1=Aut1;Aut2=Aut2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Rec1="+Rec1+"&Rec2="+Rec2+"&Ban1="+Ban1+"&Ban2="+Ban2+"&Aut1="+Aut1+"&Aut2="+Aut2+"&Eda1="+Eda1+"&Eda2="+Eda2;
		}
		if (idtinm==8){
			if ((Pre1.value)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Rec1)!=""){Rec1=Rec1;Rec2=Rec2;}
			if ((Ban1)!=""){Ban1=Ban1;Ban2=Ban2;}
			if ((Aut1)!=""){Aut1=Aut1;Aut2=Aut2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Rec1="+Rec1+"&Rec2="+Rec2+"&Ban1="+Ban1+"&Ban2="+Ban2+"&Aut1="+Aut1+"&Aut2="+Aut2+"&Eda1="+Eda1+"&Eda2="+Eda2;
		}
		if (idtinm==12){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Rec1)!=""){Rec1=Rec1;Rec2=Rec2;}
			if ((Ban1)!=""){Ban1=Ban1;Ban2=Ban2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Rec1="+Rec1+"&Rec2="+Rec2+"&Ban1="+Ban1+"&Ban2="+Ban2+"&Eda1="+Eda1+"&Eda2="+Eda2;
		}
		if (idtinm==18){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			if ((Pis1)!=""){Pis1=Pis1;Pis2=Pis2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Eda1="+Eda1+"&Eda2="+Eda2+"&Pis1="+Pis1+"&Pis2="+Pis2;
		}
		if (idtinm==13 || idtinm==19){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((Msu1)!=""){Msu1=Msu1;Msu2=Msu2;}
			if ((Mfr1)!=""){Mfr1=Mfr1;Mfr2=Mfr2;}
			if ((Mfo1)!=""){Mfo1=Mfo1;Mfo2=Mfo2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&Msu1="+Msu1+"&Msu2="+Msu2+"&Mfr1="+Mfr1+"&Mfr2="+Mfr2+"&Mfo1="+Mfo1+"&Mfo2="+Mfo2;
		}
		if (idtinm==26){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Mfr1)!=""){Mfr1=Mfr1;Mfr2=Mfr2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Mfr1="+Mfr1+"&Mfr2="+Mfr2;
		}
		if (idtinm==17 || idtinm==22){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Eda1="+Eda1+"&Eda2="+Eda2;
		}
		if (idtinm==21){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((Mfr1)!=""){Mfr1=Mfr1;Mfr2=Mfr2;}
			if ((M2a1)!=""){M2a1=M2a1;M2a2=M2a2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&Mfr1="+Mfr1+"&Mfr2="+Mfr2+"&M2a1="+M2a1+"&M2a2="+M2a2;
		}
		if (idtinm==24 || idtinm==25){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2t1)!=""){M2t1=M2t1;M2t2=M2t2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2t1="+M2t1+"&M2t2="+M2t2+"&M2c1="+M2c1+"&M2c2="+M2c2;
		}
		if (idtinm==27 || idtinm==23){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((And1)!=""){And1=And1;And2=And2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&And1="+And1+"&And2="+And2;
		}
		if (idtinm==15){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Mfr1)!=""){Mfr1=Mfr1;Mfr2=Mfr2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Mfr1="+Mfr1+"&Mfr2="+Mfr2;
		}
		if (idtinm==16){
			if ((Pre1)!=""){Pre1=Pre1;Pre2=Pre2;}
			if ((M2c1)!=""){M2c1=M2c1;M2c2=M2c2;}
			if ((Eda1)!=""){Eda1=Eda1;Eda2=Eda2;}
			pasa = "&Pre1="+Pre1+"&Pre2="+Pre2+"&M2c1="+M2c1+"&M2c2="+M2c2+"&Eda1="+Eda1+"&Eda2="+Eda2+"|";
		}
		pasa2 = pasa;
}

function submit2()
	{
		
	filtros();
	
		if (document.frmbuscador.amueblado.checked){amueblado=1;}else{amueblado=0}
			document.frmbuscador.amueblado.value=amueblado;
		if (document.frmbuscador.verfoto.checked){verfoto=1;}else{verfoto=0}
			document.frmbuscador.verfoto.value=verfoto;
		if (document.frmbuscador.noexclusiva.checked){noexclusiva=1;}else{noexclusiva=0}
			document.frmbuscador.noexclusiva.value=noexclusiva;
		
		document.frmbuscador.pasa.value=pasa2;
		document.frmbuscador.submit();
	}

function lista(ver){if (ver>0){makeRequest("cargamenu.m3?idopcion=" + ver + "&seleccionados=" + guarda, modulo3);}}
function modulo3(){if (http_request.readyState==4){menu2.innerHTML=http_request.responseText;}}

function resultados()
{
		//Muestra menu call to actions
		document.getElementById('vermenu').style.display="block";
		document.getElementById('menuinf').style.display="block";
		document.getElementById('menuinf3').style.display="block";
		
		guarda = [];

		filtros();
		
		
		///Fotos
		if (document.frmbuscador.verfoto.checked==true){verfoto=1;}else{if (document.frmbuscador.verfoto.checked==false){verfoto=0;}}
		///exclusividad
		if (document.frmbuscador.noexclusiva.checked==true){noexclusiva=1;}else{if (document.frmbuscador.noexclusiva.checked==false){noexclusiva=0;}}
		///Amueblado
		if (document.frmbuscador.amueblado.checked==true){amueblado=1;}else{if (document.frmbuscador.amueblado.checked==false){amueblado=0;}}

	if (document.frmbuscador.colonia1izqb.length>0)
	{
		for (j=1;j<=intrr;j)
			{
			grid_data[intrr--]=[0,"","","","","","","","","","","","","","","","",""];		
			}
		//alert ("resultados_b.m3?idbase=" + idbase + "&idopcion=17&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + document.frmbuscador.idmunicipio1.value + "&colonia1izqb=" + strValues + "&sta=" + idbase + "&pasa="+ pasa + "&verfoto="+ verfoto + "&noexclusiva="+ noexclusiva);
		makeRequest("resultados_b.m3?idbase=" + idbase + "&idopcion=17&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + document.frmbuscador.idmunicipio1.value + "&colonia1izqb=" + strValues + "&sta=" + idbase + "&pasa="+ pasa + "&verfoto="+ verfoto + "&noexclusiva="+ noexclusiva + "&amueblado="+ amueblado, modulo1);
	}
}

function resultadosx()
{
	guarda = [];
	if (document.frmbuscador.colonia1izqb.length>0)
	{
		for (j=1;j<=intrr;j)
			{
			grid_data[intrr--]=[0,"","","","","","","","","","","","","","","","",""];		
			}
		datos=makeRequestSync("resultados_b.m3?idbase=" + idbase + "&idopcion=17&fechaini=" + document.frmbuscador.fechaini.value + "&fechafin=" + document.frmbuscador.fechafin.value + "&fra=" + frax + "&idfranq=" + document.frmbuscador.idfranq.value + "&idoperacion=" + idoper + "&idtipoinmueble=" + document.frmbuscador.idtipoinmueble.value + "&idestado=" + document.frmbuscador.idestado.value + "&idmunicipio1=" + document.frmbuscador.idmunicipio1.value + "&colonia1izqb=" + strValues + "&sta=" + idbase + "&pasa="+ pasa + "&verfoto="+ verfoto + "&noexclusiva="+ noexclusiva+ "&amueblado="+ amueblado);
		eval(datos);
		//grid_pinta("grid01", grid_Heads, grid_data, 676, 380, grid_record_perpage, 1, "grid_Heads","grid_data", 0);
	}
}

function resultadosx2()
{
		guarda = [];
		for (j=1;j<=intrr;j)
			{
			grid_data[intrr--]=[0,"","","","","","","","","","","","","","","","",""];
			}
		makeRequest("resultados_b.m3?idbase=" + idbase + "&idopcion=17&fechaini="+ fechaini +"&fechafin="+ fechafin +"&fra=" + frax + "&idfranq=&idoperacion=" + idoper + "&idtipoinmueble="+ idtinm +"&idestado="+idestado+"&idmunicipio1="+idmunicipio+"&colonia1izqb=" + strValues + "&sta=" + sta + "&pasa="+ pasa , modulo1);
}

function modulo1()
{
	if (http_request.readyState == 1)
		//document.getElementById("status").style.display = 'block';
		spinner.style.visibility="visible";
	
	if (http_request.readyState == 4)
	{
		//document.getElementById("status").style.display = 'none'; 
		spinner.style.visibility="hidden";
		if (http_request.status == 200)
		{
			datos=http_request.responseText;
			//alert(datos);
			eval(datos);

			pasainfo.style.visibility="visible";
			
			setTimeout('grid_pinta("grid01", grid_Heads, grid_data, 676, 380, grid_record_perpage, 1, "grid_Heads","grid_data", 0);',676);
			
		}else{
			alert("no se encontraron datos");
		}
	}else{
		//Nada por el momento
	}
}

function modulo2()
{
	if (http_request.readyState == 1)
		
		//document.getElementById("status").style.display = 'block';
		spinner.style.visibility="visible";

	if (http_request.readyState == 4)
	{
		//document.getElementById("status").style.display = 'none'; 
		spinner.style.visibility="hidden";
		if (http_request.status == 200)
		{
			
			datos=http_request.responseText;
			//alert (datos);
			eval(datos);
		}else{
			alert("no se encontraron datos");
		}
	}else{
		//Nada por el momento
	}
}





