var procesando_imagenes=false;
function validar_form_publique(form) {
if (procesando_imagenes) {
DHTMLALERT("Hay un proceso de imagenes pendiente en este momento");
return false;
}
var logueado=getObj("logueado");
if (logueado.value!="1") {
var aux_value=getObj("USR_nombres").value.trim();
if (aux_value=="") {
DHTMLALERT("Indique su nombre");
return false;
}
var aux_value=getObj("USR_apellido").value.trim();
if (aux_value=="") {
DHTMLALERT("Indique su apellido");
return false;
}
var aux_value=getObj("USR_telefono").value.trim();
if (aux_value=="") {
DHTMLALERT("Indique su teléfono");
return false;
}
var aux_value=getObj("USR_email").value.trim();
if (aux_value=="") {
DHTMLALERT("Indique su email");
return false;
}
}
var campo,mensaje,valor;
for (var i=0;i < obligatorios.length;i=i+2) {
campo=obligatorios[i];
mensaje=obligatorios[i+1];
valor=eval("form."+campo+".value");
force_no_check=false;
auxtipo=getObj("id_tipodepropiedad");
if (auxtipo!=null) {
valtipo=auxtipo.value;
if (campo=="id_comodidad" && valtipo=="12") {
force_no_check=true;
break;
}
}
if (campo=="clave") {
var clave_confirm=form.confirm_clave.value;
var aux=mensaje.split("|");
mensaje=aux[0];
mensaje_extra=aux[1];
if (valor.length < 6) {DHTMLALERT(mensaje);obj_focus=eval("form."+campo);return false;}
if (valor!=clave_confirm) {DHTMLALERT(mensaje_extra);obj_focus=eval("form."+campo);return false;}
} else if (campo=="email") {
var aux=mensaje.split("|");
mensaje=aux[0];
mensaje_extra=aux[1];
if (valor.indexOf('@') < 0 || valor.indexOf('.') < 0 || valor.indexOf(',') > 0) { DHTMLALERT(mensaje); obj_focus=form.email; return false; }
} else {
if (!force_no_check) {
if (valor=="") {DHTMLALERT(mensaje);obj_focus=eval("form."+campo);return false;}
}
}
}
var id_zona_publicar=form.id_zona_publicar;
if (id_zona_publicar==null || id_zona_publicar.value==0) {
DHTMLALERT("Seleccione la zona");
obj_focus=eval(id_zona_publicar);
return false;
}
var okmodalidad=false;
var check_venta=false;
var check_alq=false;
var check_temp=false;
var modalidad = document.getElementsByName("modalidades[]");
for (i=0;i < modalidad.length;i++) {
if (modalidad[i].checked) {
okmodalidad=true;
if (modalidad[i].value==5) check_alq=true;
if (modalidad[i].value==1) check_temp=true;
if (modalidad[i].value==2) check_venta=true;
}
}
if (!okmodalidad) {
DHTMLALERT("Indique la modalidad en la pestaña Precios");
return false;
}
var precio_alq = getObj("precios1023");
var precio_ven = getObj("precios999");
if (check_venta && parseFloat(precio_ven.value)==0) {
DHTMLALERT("Ingrese el precio de venta");
return false;
}
if (check_alq && parseFloat(precio_alq.value)==0) {
DHTMLALERT("Indique el precio de alquiler mensual");
return false;
}
if (check_temp) {
count_precios_ok=0;
for (i=0;i < ids_precios.length;i++) {
aux_precio=getObj("precios"+ids_precios[i]);
if (parseFloat(aux_precio.value)>0) {
count_precios_ok++;
}
}
if (count_precios_ok==0) {
DHTMLALERT("Indique un precio de alquiler por temporada como mínimo");
}
}
return true;
}
var map = null;
var myLatlng = null;
var marker;
var zoom_actual=15;
function initialize(latitud,longitud,zoom) {
zoom_actual=zoom;
var myLatlng = new google.maps.LatLng(latitud,longitud);
var myOptions = {
zoom: zoom,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map"), myOptions);
marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: myLatlng
});
google.maps.event.addListener(map, 'click', cambiarubicacion);
}
function cambiarubicacion(e) {
marker.setPosition(e.latLng);
getObj("latitud").value=e.latLng.lat();
getObj("longitud").value=e.latLng.lng();
}
function load_gmaps(latitud,longitud,zoom) {
initialize(latitud,longitud,zoom);
}
function reinit_gmap() {
var lat_actual=getObj("latitud").value;
var long_actual=getObj("longitud").value;
initialize(lat_actual,long_actual,zoom_actual);
}
function login_form_prop() {
var email=getObj("USR_email_login").value.trim();
var pwd=getObj("USR_clave_login").value.trim();
if (email=="" || pwd=="") {
DTHMLALERT("Indique usuario y clave. Gracias.");
return;
}
getObj("hidden_email").value=email;
getObj("hidden_pwd").value=pwd;
getObj("frm_login_prop").submit();
}
function check_email_registro() {
var email=getObj("USR_email").value.trim();
if (email!="") {
var url="/propiedades/modulos/scripts/check_email_registro.php?email="+escape(email);
crear_script_tag(url,"login_form");
}
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}