// JavaScript Document
//**************************************
//Autor: José Luis Lasala 12/08/2009
//**************************************

function favoritos(pagina, nombre_pagina) 
{ 
	var browsName = navigator.appName; 
	if (browsName == "Microsoft Internet Explorer") { 
		window.external.AddFavorite(pagina,nombre_pagina);} 
	else 
	if (browsName == "Netscape") {
		alert ("\nPara agregar este sitio a favoritos presiona CTRL+D");
	}
}

function Validar_Cnt_Piso(theForm){
	if(theForm.nombre.value == "") {
		alert("Debe poner su Nombre y Apellidos!");
		theForm.nombre.focus();
		return (false);
	} 
	if(theForm.telefono.value == "") {
		alert("Debe poner un telefono  de contacto!");
		theForm.telefono.focus();
		return (false);
	} 

return (true);
}

function Enviar_OK(theForm){
	if(theForm.ok.checked== true) {
		theForm.enviar.disabled=false;
	}
	else {
		theForm.enviar.disabled=true;
	}
return (true);
}

function Validar_Buscar(theForm){

	if(theForm.ref.value != "") 
		{
		var ref= theForm.ref.value;
		var DeleNum= ref.split("-");
		if (DeleNum[0]=="")	
			{
			alert("Debes poner una Referencia en la forma \n\n\tOficina-Codigo");
			theForm.ref.focus();
			return (false);
			} 	
		if ( (DeleNum[1]== undefined) || (DeleNum[1]=="") )	
			{
			alert("Debes poner una Referencia en la forma \n\n\tOficina-Codigo");
			theForm.ref.focus();
			return (false);
			} 	
		return (true);
		}

	if(theForm.pvph[theForm.pvph.selectedIndex].value != "null") { //si no es NULL
		if(Number(theForm.pvph[theForm.pvph.selectedIndex].value) <= Number(theForm.pvpd[theForm.pvpd.selectedIndex].value)) {
			alert("Debe seleccionar un precio hasta mayor al precio desde!");
			theForm.pvph.focus();
			return (false);
		} 
	}
	if(theForm.habh[theForm.habh.selectedIndex].value != "null") { //si no es NULL
		if(Number(theForm.habh[theForm.habh.selectedIndex].value) < Number(theForm.habd[theForm.habd.selectedIndex].value)) {
			alert("Debe seleccionar un numero de Habitaciones hasta mayor que las seleccionadas en  desde!");
			theForm.habh.focus();
			return (false);
		} 
	}
	if(theForm.pvph[theForm.m2h.selectedIndex].value != "null") { //si no es NULL
		if(Number(theForm.m2h[theForm.m2h.selectedIndex].value) <= Number(theForm.m2d[theForm.m2d.selectedIndex].value)) {
			alert("Debe seleccionar una  superficie hasta mayor que la superficie desde!");
			theForm.m2d.focus();
			return (false);
		} 
	}
return (true);
}

function Validar_BuscarUso(theForm){
	
return (true);
}

function Validar_VerMapa(theForm){
	
return (true);
}

function Validar_BuscaRef(theForm)
	{
	if(theForm.ref.value == "") 
		{
		alert("Debes poner una Referencia en la forma \n\n\t115-1020");
		theForm.ref.focus();
		return (false);
		} 

	var ref= theForm.ref.value;
	var DeleNum= ref.split("-");
	if (DeleNum[0]=="")	
		{
		alert("Debes poner una Referencia en la forma \n\n\t115-1020");
		theForm.ref.focus();
		return (false);
		} 	
	if ( (DeleNum[1]== undefined) || (DeleNum[1]=="") )	
		{
		alert("Debes poner una Referencia en la forma \n\n\t115-1020");
		theForm.ref.focus();
		return (false);
		} 	
	
	return (true);
	}

