
function buscar()
{
	var ubicacion = document.getElementById('estados').value;
	var operacion = document.getElementById('propiedades').value;
	var precio    = document.getElementById('preciomax').value;
	
	if(ubicacion == "")
	{
		alert("Elija un estado.");
		return false;
	} else if(operacion == "")
	{
		alert("Elija una operación");
		return false;
	/*} else if(precio == "")
	{
		alert("Elija un rango de precio.");
		return false;*/
	} else {
	
	location.href = 'propiedades.php?u=' + ubicacion + '&o='+operacion+'&p='+precio;
	}
}

function buscarClave()
{
	var clave = document.getElementById('clavewebs');
	if(clave.value != "")
	{
		location.href = 'propiedades.php?cw=' + clave.value;
	} else {
		
		alert("Debe introducir una clave web primero.");
		return false;
	}
}



function preCarga() 
{
	if (!document.images) return;
	var ar = new Array();
	var argumentos = preload.argumentos;
	for (var i = 0; i < argumentos.length; i++) 
	{
		ar[i] = new Image();
		ar[i].src = argumentos[i];
	}
}

window.onload=" preCarga('images/menu_con_01.gif', 'images/menu_sin_01.gif', 'images/menu_con_02.gif','images/menu_sin_02.gif','images/menu_con_02.gif','images/menu_sin_03.gif','images/menu_con_03.gif','images/menu_con_04.gif','images/menu_sin_04.gif','images/menu_con_05.gif','images/menu_sin_05.gif' )" ;

function rollOver(name,imagen)
{
	document.images[name].src = imagen;  
}
function chgseleccion(tbox,val)
{
	if(val != 0)
	{
	
		tbox.className = 'selection';
		document.getElementById(val).className = 'borderSelect';
		document.getElementById(val).disabled = false;
	
	} else if (val == "cotizacion")
	{
	
		tbox.className = 'selection';
		//setTimeout("document.getElementById(val).className = 'selectcot'",1000);
	
	} else {
		
			tbox.className = 'selection';
			
	
	}
}
function imprimir(id)
{
	ancho=570; alto=550;
	var _W=window.open('verimprimir.php?id='+id,'imprimir',"scrollbars=yes,width="+ancho+",height="+alto); 
	_W.focus(); 
    iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	
}
function verFoto(p,i)
{
	ancho=500; alto=500;
	var _W=window.open('verfoto.php?p='+p+'&i='+i,'verfoto',"scrollbars=yes,width="+ancho+",height="+alto); 
	_W.focus(); 
  /*  iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	*/
}
function cchg(a)
{
	a.className = 'cotizacion';
}
function seleccion(texto)
{
	//alert(texto);

		texto.className = 'borderSelect';
	
}
function seleccion2(b)
{
	b.className = "selectcot";
}
function recomendar(id){
  ancho=440; alto=400;
  var _W=window.open('recomendar.php?id='+id,'recomendar',"scrollbars=yes,width="+ancho+",height="+alto); 
	   _W.focus(); 
    iz=(screen.width-ancho) / 2;
    de=(screen.height-alto) / 2;
    _W.moveTo(iz,de);	
}
function parseUrl(url)
{
	var cadena = url.length;
	var cadena1 = url.substr(url.indexOf('images/'),cadena);
	return cadena1;
}
function showlist()
{
	var lista = document.getElementById('lista_fav');
	var imagen = parseUrl(document.getElementById('seelist').src);
	if(imagen == "images/up.gif")
	{
		lista.style.display = 'block';
		document.getElementById('seelist').src = "images/down.gif";
	} else {
		lista.style.display = 'none';
		document.getElementById('seelist').src = "images/up.gif";
	}
	
}
function AgregarFavoritas(id,banio,cuartos,ubicacion,precio)
{
	//alert(id +" " + precio + " " + banio + " "+cuartos+ " " + ubicacion);
	document.getElementById('titulo_fav').style.display = "block";
	document.getElementById('lista_fav').style.display = "block";
	xajax_addFavoritos(id,precio,banio,cuartos,ubicacion);
}
	
	
function verpagina(vr,variables)
{
	location.href = 'propiedades.php?'+variables+'&ver='+vr.value;
}
function selectchck(chck)
{
	
	var checar;


	if(chck.checked == true)
	{
			checar = true;
			
	}else if(chck.checked == false)
	{
		checar = false;
	}	
	
	j = 0;
	for(i = 0; i < document.forms[0].elements.length; i++)
	{
		j++;
		if(j != 6)
		{
			document.comparacion.elements[i].checked = checar;
		}
	}
	//chck.checked = cbx;
		
}

function chck5(obj)
{
	var j = 0;
	for(i = 0; i < document.forms[0].elements.length; i++)
	{
			//alert(j);
		if(document.forms[0].elements[i].checked == true)
		{
			j++;
		
		}
	}
	
	if(j > 5)
	{
		obj.checked = false;
	}
}

