//esta funcion se utiliza para la cabecera
	function Abrir_Ventana2(theURL,w,h) { 
		var windowprops = 'top=150,left=400,toolbar=no,location=no,status=no, menubar=no,scrollbars=no, resizable=no,width=' + w + ',height=' + h;
		var winName = 'Popup';
		window.open(theURL,winName,windowprops); 
	}
    function valida(){ 
    //valido el txtZona 
    if (document.getElementById('busqueda').txtZonas.value.length==0){ 
       alert('El campo Zona es obligatorio'); 
       document.getElementById('busqueda').txtZonas.focus(); 
       return false; 
    } 
     if (document.getElementById('busqueda').txtZonas.value.length<3){ 
       alert('El campo Zona debe tener un minimo de 3 caracteres'); 
       document.getElementById('busqueda').txtZonas.focus(); 
       return false; 
    } 
    if (document.getElementById('busqueda').txtZonas.value.indexOf("%")>=0){ 
       alert('El campo Zona no puede contener \'%\'');
       document.getElementById('busqueda').txtZonas.focus(); 
       return false; 
    }
    return true;
    }
    
	//función que cambia el precio del select de precio en función del tipo que se haya escogido en el select de tipo.
	var precio_Venta=new Array('0 - 60.000' ,'60.000 - 90.000','90.000 - 120.000','120.000 - 150.000','150.000 - 180.000','180.000 - 240.000','240.000 - 300.000','300.000 - 360.000','360.000 - 450.000','450.000 - 600.000','600.000 - 800.000','800.000 - 1.200.000','+1.200.000');
	var precio_Alquiler=new Array('0 - 300' ,'300 - 500','500 - 700','700 - 1.000','1.000 - 1.500','1.500 - 2.000','2.000 - 2.500','+3.000');



	function cambia_precio(){
		var tipo
		var txt_ini=document.getElementById('busqueda').rangodeprecio.options[0].text
		var txt_value=document.getElementById('busqueda').rangodeprecio.options[0].value
		tipo = document.getElementById('busqueda').transType[document.getElementById('busqueda').transType.selectedIndex].value
			mis_precio=eval("precio_" + tipo)
			num_precio = mis_precio.length+1
			document.getElementById('busqueda').rangodeprecio.length = num_precio
			document.getElementById('busqueda').rangodeprecio.options[0].text=txt_ini
			document.getElementById('busqueda').rangodeprecio.options[0].value=txt_value
			for(i=1;i<num_precio;i++){
				/*
			    var cadensa=mis_precio[i-1].split("-");
			    for (var i=0;i<cadena.length;i++){
			    	document.getElementById('busqueda').rangodeprecio.options[i].value=cadena;
			   		document.getElementById('busqueda').rangodeprecio.options[i].text=cadena;
			    } 
					*/
			    
			   document.getElementById('busqueda').rangodeprecio.options[i].value=mis_precio[i-1];
			   document.getElementById('busqueda').rangodeprecio.options[i].text=mis_precio[i-1];
			   
			}
	}
	
	function validaLog(){ 
	    if (document.login.password.value.length==0){ 
	       alert("El campo Password es obligatorio"); 
	       document.login.password.focus(); 
	       return false; 
	    }
	    if (document.login.eMail.value.length==0){ 
	       alert("El campo e-mail es obligatorio"); 
	       document.login.eMail.focus(); 
	       return false; 
	    } else{
			var s = document.login.eMail.value;
			var filter= new RegExp(/^[\w\.-]+@[\w\.-]+\.[\w]{2,}$/);
	
			if (filter.test(document.login.eMail.value)){
				return true;
			}else{
			alert("Email no valido");
				return false;
			}
			document.login.eMail.focus();
			return false;
		}
		return true;
	}

function getAbsoluteElementPosition(element) {
  if (typeof element == "string")
    element = document.getElementById(element)
    
  if (!element) return { top:0,left:0 };
  
  var y = 0;
  var x = 0;
  while (element.offsetParent) {
    x += element.offsetLeft;
    y += element.offsetTop;
    element = element.offsetParent;
  }
  return {top:y,left:x};
}

	
function ensenar()
{
	document.getElementById("resumen").style.display = "block";
  	var elemento = document.getElementById("otrosEnlaces");
  	var pos = getAbsoluteElementPosition(elemento);
	pos.top = pos.top - 100;
	pos.left = pos.left + 20;
	document.getElementById("resumen").style.top = pos.top+"px";
	document.getElementById("resumen").style.left = pos.left+"px";
}

function esconder()
{
	document.getElementById("resumen").style.display = "none";
}

function mostrar(id)
{
	if (document.getElementById('td_sub_' + id)!= 'null'){
		if (document.getElementById('td_sub_' + id).style.display != ''){
			document.getElementById('td_sub_' + id).style.display ='';
			document.getElementById('vinculo' + id).className ="link1_over";
		}
		else {
			document.getElementById('td_sub_' + id).style.display='none';
			document.getElementById('vinculo' + id).className ="link1";
		}
	}
}

function mostrarocultar()
{
 	   if (document.getElementById("subterminos").style.display != 'none'){
			document.getElementById("subterminos").style.display ='none';
		}
		else {
			document.getElementById("subterminos").style.display='block';
		}
}


function mostrar_enlaces()
{
 	   if (document.getElementById("relacionados").style.display != 'none'){
			document.getElementById("relacionados").style.display ='none';
			document.getElementById("relacionados_2").style.display='block';
		}
		else {
			document.getElementById("relacionados_2").style.display='none';
			document.getElementById("relacionados").style.display='block';
		}
}
