var titulopordefecto = "1000inmuebles"; //Si no se especifica un título al llamar a la función colocará el que se especifique aquí
var ventana;
var cont=0;

function popImage(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,scrollbars=no,width=50,height=50')
ventana.document.write('<html><head><title>1000inmuebles</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">');
ventana.document.close();
cont++;
}
function redimensionar(ancho, alto)
{
ventana.resizeTo(ancho+12,alto+36);
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2); //centra la ventana. Eliminar si no se quiere centrar el popup
}

function valida(f){
	for(i = 0; i < f.elements.length; i++){
		if(f.elements[i].type == "text" || f.elements[i].type == "password" || f.elements[i].type == "textarea"){
			nombre = f.elements[i].name;
			if(nombre.charAt(0) == "r"){
				temp = f.elements[i].value;
				if(temp.length <= 0){
					alert("El campo '" + nombre.substr(1) + "' es requerido.");
					f.elements[i].focus();
					return false;	
				}
			}
		}
	}
	return true;
}

function isValidEmail(str) {
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function validaBusqueda(f){
	var t = f.Clave.value;
	if(t.length <= 0){
		alert("Debe introducir una clave a buscar.");
		f.Clave.focus();
		return false;
	}
	return true;
}

