Idioma = "es"
errCaracter = "Caracter o valor incorrecto en campo recamaras";
errCaracter1 = "Caracter no válido en Metros Mínimos de contruccion o campo vacío";
errCaracter2 = "Caracter no válido en Metros Máximos de contruccion o campo vacío";
errCaracter3 = "Caracter no válido en Metros Mínimos disponibles o campo vacío";
errCaracter4 = "Caracter no válido en Metros Máximos disponibles o campo vacío";
errCampoVacio = "El campo Precio Máximo no debe estar vacío";
errCampoVacio1 = "El campo Precio Máximo debe ser numérico";
errCampoVacio2 = "El campo Precio Mínimo no debe estar vacío";
errCampoPositivo = "El campo Precio Máximo debe tener valor positivo";
errCampoPositivo1 = "El campo Precio Mínimo debe tener valor positivo";
errCampoNumerico = "El campo Precio Mínimo debe ser numérico";
errMayorQue = "El campo Precio Máximo debe ser Mayor que el Precio Mínimo";

function pre(t_prop)
 {
 with(document.busqueda)
  {
  mcMin = M_Constr_min;
  mcMax = M_Constr_max;
  mtMin = M_Terr_min;
  mtMax = M_Terr_max;
  precio = Precio;
  preciom = PrecioMin;
  rec = C_Recamaras;
  }

 //Convirtiendo a formato numérico
 if(isNaN(precio.value)){
	nprec = precio.value.split(",");
	precio.value = "";
	for(i = 0;i < parseInt(nprec.length); i++)
		precio.value += nprec[i];
	}
 if(isNaN(preciom.value)){
	nprec = preciom.value.split(",");
	preciom.value = "";
	for(i = 0;i < parseInt(nprec.length); i++)
		preciom.value += nprec[i];
	}

 if(isNaN(rec.value)||(rec.value<1))
   {
   alert(errCaracter);
   rec.focus();
   rec.select();
   }
  else 
 if((isNaN(mcMin.value))&&mcMin.value!=""&&t_prop=='com')
   {
   alert(errCaracter1);
   mcMin.focus();
   mcMin.select();
   }
 else
  if((isNaN(mcMax.value))&&mcMax.value!=""&&t_prop=='com')
   {
   alert(errCaracter2);
   mcMax.focus();
   mcMax.select();
   }
  else
   if((isNaN(mtMin.value))&&mtMin.value!=""&&t_prop=='res')
     {
     alert(errCaracter3);
     mtMin.focus();
     mtMin.select();
     }
   else
     if((isNaN(mtMax.value))&&mtMax.value!=""&&t_prop=='res')
       {
       alert(errCaracter4);
       mtMax.focus();
       mtMax.select();
       }
     else  
 if(precio.value == ""||precio.value == " "||precio.value == "  ")
  {
  alert(errCampoVacio);
  precio.focus();
  precio.select();
  }
 else
 if(isNaN(precio.value))
   {
   alert(errCampoVacio1);
   precio.focus();
   precio.select();
   }
 else
  if(precio.value<=0)
   {
   alert(errCampoPositivo);
   precio.focus();
   precio.select();
   }
  else
 if(preciom.value == ""||preciom.value == " "||preciom.value == "  ")
  {
  alert(errCampoVacio2);
  preciom.focus();
  preciom.select();
  }
 else
 if(isNaN(preciom.value))
   {
   alert(errorCampoNumerico);
   preciom.focus();
   preciom.select();
   }
 else
  if(preciom.value<0)
   {
   alert(errCampoPositivo1);
   preciom.focus();
   preciom.select();
   }
  else
   if(parseInt(precio.value)<=parseInt(preciom.value))
     {
     alert(errMayorQue);
     precio.focus();
     precio.select();
     }
   else
   document.busqueda.submit();
 }

function ver(param)
{
url = "detalles.asp?id="+param;
window.open(url,"","toolbar=no, width=550, height=490, scrollbars=yes");
}

function Act_R(tipo_prop, ultimo,url)
{
x = tipo_prop.selectedIndex;
opcion = tipo_prop[x].text;
tipo_prop = tipo_prop.value;
cambiar = true;
constr = "&con=true";
terre = "&ter=true";
ult = parseInt(ultimo);

if((ult>=1)&&(ult<4))
 if((tipo_prop>=1)&&(tipo_prop<4))
    cambiar = false;
if(ult>=4)
 if(tipo_prop>=4)
    cambiar = false;
if(tipo_prop>=4)
	x += 3;
switch(parseInt(x+1))
 {
 case 1:
 case 5:
 case 8:
   //TIENEN AMBAS OPCIONES
   if((ult!=1)&&(ult!=5)&&(ult!=8))
	cambiar = true;
   constr = "&con=true";
   terre = "&ter=true";
   break;
 case 2:
 case 3:
   //NO TIENEN TERRENO DISPONIBLE
   if((ult!=2)&&(ult!=3))
     cambiar = true;
   terre = "&ter=false";
   break;
 case 4:
 case 6:
 case 7:
   //NO TIENEN NIGUNA
   if((ult!=4)&&(ult!=6)&&(ult!=7))
     cambiar = true;
   constr = "&con=false";
   terre = "&ter=false";
   break;

 }
if(cambiar)
  if(tipo_prop<4)
    window.location = url+"?indice="+tipo_prop+constr+terre;
  else
    window.location = url+"?rec=true&indice="+tipo_prop+constr+terre;
}