var psubm=0;
function a1()
{
	document.frmbusca.idoperacion2.value=document.frmbusca.idoperacion.value;
	document.frmbusca.idopcion2.value="";
	moduloZ("http://www.metroscubicos.com/paginas/buscadorideas21/cargacombos.m3?a=1&idoperacion="+document.frmbusca.idoperacion2.value);
}
function a2(op)
{
	if (psubm!=1)
	{
		if(op==1){
			location.href="http://www.metroscubicos.com/paginas/yerenia/ideas/desarrollos.php";
		}else{
			document.frmbusca.idopcion2.value=op;
			document.frmbusca.idmunicipio.disabled=true;
			document.frmbusca.idcolonia.disabled=true;
			//alert("Saliendo a casa");
			moduloZ("http://www.metroscubicos.com/paginas/buscadorideas21/cargacombos.m3?a=1&idoperacion="+document.frmbusca.idoperacion2.value+"&idopcion="+document.frmbusca.idopcion2.value);
		}
	}
}
function a3()
{
	document.frmbusca.idmunicipio.disabled=true;
	document.frmbusca.idcolonia.value="";
	document.frmbusca.idcolonia.disabled=true;

	if (document.frmbusca.idestado.selectedIndex>0)
	{
		edo=document.frmbusca.idestado[document.frmbusca.idestado.selectedIndex].value
		tip=0;
		if (document.frmbusca.idtipoinmueble.selectedIndex>0)
		{
			tip=document.frmbusca.idtipoinmueble[document.frmbusca.idtipoinmueble.selectedIndex].value;
		}
		if (edo>0)
		{
			moduloZ("http://www.metroscubicos.com/paginas/buscadorideas21/cargacombos.m3?a=1&idoperacion="+document.frmbusca.idoperacion2.value+"&idopcion="+document.frmbusca.idopcion2.value+"&idestado="+edo+"&idtipoinmueble="+tip);
		}
	}else{
		alert("Debe seleccionar un estado");
	}
}
function a4()
{
	if (document.frmbusca.idmunicipio.selectedIndex>0)
	{
		edo=document.frmbusca.idestado[document.frmbusca.idestado.selectedIndex].value
		mun=document.frmbusca.idmunicipio[document.frmbusca.idmunicipio.selectedIndex].value
		if (mun>0)
		{
			tip=0;
			if (document.frmbusca.idtipoinmueble.selectedIndex>0)
			{
				tip=document.frmbusca.idtipoinmueble[document.frmbusca.idtipoinmueble.selectedIndex].value;
			}
			moduloZ("http://www.metroscubicos.com/paginas/buscadorideas21/cargacombos.m3?a=1&idoperacion="+document.frmbusca.idoperacion2.value+"&idopcion="+document.frmbusca.idopcion2.value+"&idestado="+edo+"&idmunicipio="+mun+"&idtipoinmueble="+tip);
		}else{
			alert("Debe seleccionar un municipio");
		}
	}else{
		alert("Debe seleccionar un municipio");
	}
}
function a5()
{
	if (document.frmbusca.idtipoinmueble.selectedIndex>0)
	{
		tip=document.frmbusca.idtipoinmueble[document.frmbusca.idtipoinmueble.selectedIndex].value
		if (tip>0)
		{
			moduloZ("http://www.metroscubicos.com/paginas/buscadorideas21/cargacombos.m3?a=1&idoperacion="+document.frmbusca.idoperacion2.value+"&idopcion="+document.frmbusca.idopcion2.value+"&idtipoinmueble="+tip);
		}else{
			alert("Debe seleccionar un tipo de inmueble");
		}
	}else{
		alert("Debe seleccionar un tipo de inmueble");
	}
}
function validago()
{
	if (document.frmbusca.idmunicipio.selectedIndex>0)
	{
		document.frmbusca.idopcion.value=document.frmbusca.idopcion2.value;
		document.frmbusca.submit();
	}else{
		alert("Debe seleccionar un municipio")	;
	}
}
function moduloZ(url)
{
	document.getElementById('datosJS').innerHTML="";
	var codigo=document.createElement('SCRIPT');
	codigo.type="text/javascript";
	codigo.src=url;
	document.getElementById('datosJS').appendChild(codigo);
	//alert(document.getElementById('datosJS').innerHTML);
}
function moduloZ_bak(url)
{
	var codigo=document.createElement('SCRIPT');
	codigo.type="text/javascript";
	codigo.src=url;
	document.getElementById('datosJS').appendChild(codigo);
}
function domx(idp)
{
	contentmanage.innerHTML="<table border=0 width=660><tr><td width=7></td><td width=653 class=carga height=400 align=center><img src=imagenes2/spinner.gif><br>Espere un momento!....</td></tr></table>";
	setTimeout('go('+idp+')', 10);
}
function go(idp)
{
	idopcion=document.frmbusca.idopcion2.value;
	idoperacion=document.frmbusca.idoperacion2.value;
	idtipoinmueble="";
	idestado="";
	idmunicipio="";
	idcolonia="";
	idfoto="";
	iddestacado="";
	if (document.frmbusca.idtipoinmueble.selectedIndex>0)
	{
		idtipoinmueble=document.frmbusca.idtipoinmueble[document.frmbusca.idtipoinmueble.selectedIndex].value;
	}
	if (document.frmbusca.idestado.selectedIndex>0)
	{
		idestado=document.frmbusca.idestado[document.frmbusca.idestado.selectedIndex].value;
	}
	if (document.frmbusca.idmunicipio.selectedIndex>0)
	{
		idmunicipio=document.frmbusca.idmunicipio[document.frmbusca.idmunicipio.selectedIndex].value;
	}
	if (document.frmbusca.idcolonia.selectedIndex>0)
	{
		idcolonia=document.frmbusca.idcolonia[document.frmbusca.idcolonia.selectedIndex].value;
	}
	if (document.frmbusca.idfoto.selectedIndex>0)
	{
		idfoto=document.frmbusca.idfoto[document.frmbusca.idfoto.selectedIndex].value;
	}
	if (document.frmbusca.iddestacado.selectedIndex>0)
	{
		iddestacado=document.frmbusca.iddestacado[document.frmbusca.iddestacado.selectedIndex].value;
	}
	
	//url="resultados21.m3?strverifica=no";
	url="resultados21.m3?strverifica=no";
	var xz=makeRequestSync(url+"&idoperacion="+idoperacion+"&idtipoinmueble="+idtipoinmueble+"&idopcion="+idopcion+"&idestado="+idestado+"&idmunicipio="+idmunicipio+"&idcolonia="+idcolonia+"&idp="+idp+"&idfoto="+idfoto+"&iddestacado="+iddestacado+"&idorden1="+document.frmbusca.idorden1.value+"&idorden2="+document.frmbusca.idorden2.value+"&idorden3="+document.frmbusca.idorden3.value+"&idorden4="+document.frmbusca.idorden4.value);
	contentmanage.innerHTML=xz;
}
function cambiaorden(id,id2, idp)
{
	document.frmbusca.idorden1.value=0;
	document.frmbusca.idorden2.value=0;
	document.frmbusca.idorden3.value=0;
	document.frmbusca.idorden4.value=0;
	if (id==1){document.frmbusca.idorden1.value=id2;}
	if (id==2){document.frmbusca.idorden2.value=id2;}
	if (id==3){document.frmbusca.idorden3.value=id2;}
	if (id==4){document.frmbusca.idorden4.value=id2;}
	domx(0);
}

function login()
{
	sw(300,200,1);

	var obj3=document.getElementById('fillbox');
	ss='<table border=1 width=100% height=100% style="background-color:white"><tr><td align=center valign=center>';
	ss+='<form>';
	ss+='<table border=0 width=95% height=100% style="background-color:white" cellspacing=0 cellpadding=0><tr>';
	ss+='<td style="border-bottom:1px solid #6d0319" height=30><img src=imagenes2/flecha.png> <a class=ses>Inciar sesi�n</a></td><td width=25 style="border-bottom:1px solid #6d0319"><a class=suscrip href="javascript:closewin()">Cerrar</a>&nbsp;&nbsp;</td><td width=5 style="border-bottom:1px solid #6d0319"><a href="javascript:closewin()"><img border=0 src=imagenes2/close.png></a></td></tr>';
	ss+='<tr><td colspan=3>No eres usuario registrado registrate aqu�</td></tr>';
	ss+='<tr><td colspan=3>';
	ss+='<table border=0 width=100% height=100% style="background-color:white">';
	ss+='<tr><td>>&nbsp</td><td>Usuario :</td><input type=text id="us" class=busca3></td></tr>';
	ss+='<tr><td>>&nbsp</td><td>Contrase�a :</td><input type=text id="pw" class=busca3></td></tr>';
	ss+='<tr><td></td><td colspan=2 align=right>� Olvidaste tu contrase�a ?</td></tr>';
	ss+='<tr><td></td><td colspan=2 align=right><a href="javascript:uvlogin();"><img border=0 src=imagenes2/inises.png></a></td></tr>';
	ss+='<tr><td colspan=3>&nbsp;</td></tr>';
	ss+='</table>';
	ss+='</td></tr>';
	ss+='<tr><td colspan=3>&nbsp;</td></tr>';
	ss+='</table>';
	ss+='<form>';
	ss+='</td></tr></table>';
	obj3.innerHTML=ss;
	var z=document.getElementById('us')
	z.setfocus();
}
function obr(oj){return Clase64.shadow(DespN(oj));}
function uvlogin()
{
	var us=obr(document.getElementById('us').value);
	var pw=obr(document.getElementById('pw').value);
	waintwin()
	makeRequestAsyn2("valida.m3","us="+us+"&pw="+pw,uvlogin2);
}
function uvlogin2()
{
	if (http_request.readyState == 4)
	{
		if (http_request.status == 200)
		{
			datos=http_request.responseText;
			eval(datos);
		}else{
			alert("no se encontraron datos");
		}
	}
}
function cabecera_cnn()
{
	var cabecera = "";
	cabecera='<link href="lr.css" rel="stylesheet" type="text/css">';
	cabecera=cabecera +'<table width=650 border=0 cellpadding=0 cellspacing=0>';
	cabecera=cabecera +'<tr><td height=48>';
	cabecera=cabecera +'<table width=650 border=0 style="font-family:Arial,Helvetica;font-size:10px;">';
	cabecera=cabecera +'<tr><td width=300 height=24 rowspan=2><img src=imagenes2/flogo.gif></td><td width=300 align=right valign=top>&nbsp;</td></tr>';
	cabecera=cabecera +'<tr><td height=24></td><td width=300 align=right><font size="1">por <font color="#003C79">metros</font><font color="#FF5C01">cubicos</font><font color="#003C79">.com</font></font></td></tr>';
	cabecera=cabecera +'</table></td></tr></table>';
	cabecera=cabecera +'<br>';
	return cabecera;
}
function prtlpt(obj,bsq_idin,idfranq,idopcion)
{
	if(strtour!="")
	{
		var tourweb1 = document.getElementById('tourvirtualm3');
		var tourweb2 = strtour;
		tourweb1.innerHTML="";
	}
	var contenido
	contenido="<html><head>";
	contenido=contenido + '<link href="lr.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '<link href="dp.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '<link href="bienes.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '</head><body>';
	contenido=contenido + cabecera_cnn();
	contenido=contenido + document.getElementById(obj).innerHTML;
	contenido=contenido + '</body></html>';
	var ventana=window.open("print.m3?bsq_idin="+bsq_idin+"&idfranq="+idfranq+"&idopcion="+idopcion, "", "status=no, toolbar=no, location=no, menubar=no, resizable=no, scrollbars=yes, height=780, width=740, top=25, left=50");
	ventana.document.open();
	ventana.document.write(contenido);
	ventana.document.close();
	//window.print()
	ventana.print()
	if(strtour!="")
	{
		tourweb1.innerHTML=tourweb2;
	}
}
function prtlptdesa(obj)
{
	var contenido
	contenido="<html><head>";
	contenido=contenido + '<link href="lr.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '<link href="dp.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '<link href="bienes.css" rel="stylesheet" type="text/css">';
	contenido=contenido + '</head><body>';
	contenido=contenido + cabecera_cnn();
	contenido=contenido + document.getElementById(obj).innerHTML;
	contenido=contenido + '</body></html>';
	var ventana=window.open("ruta_tu_archivo", "", "status=no, toolbar=no, location=no, menubar=no, resizable=no, scrollbars=yes, height=780, width=740, top=25, left=50");
	ventana.document.open();
	ventana.document.write(contenido);
	ventana.document.close();
	//window.print()
	ventana.print()
}

function go_desa()
{
	document.frmbusca.idopcion2.value=1;
	document.frmbusca.idopcion[0].checked=true;
	document.frmbusca.idcolonia.selectedIndex=0;
	//domx(0);
	validago()
}
function go_prop()
{
	psubm=1;
	document.frmbusca.idopcion2.value=2;
	document.frmbusca.idopcion[1].checked=true;
	validago()
}
function verprop(id)
{
	document.frmbusca.idinmueble.value=id;
	document.frmbusca.action="detalle.m3"
	document.frmbusca.submit();
}
