function Espacios (InputVal){
	var espacios = false;

   	if (InputVal.charAt(0) == " ")
    	espacios = true;

	return espacios;
}

/*function validarEmail(valor) {
	var Email = true;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
    	Email = false;

    return Email;
}*/

function emailCheck(emailStr){
	//var eMail = true;
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null){
		return false;
	}

	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++){
		if (user.charCodeAt(i)>127){
			return false;
   		}
	}
	
	for (i=0; i<domain.length; i++){
		if (domain.charCodeAt(i)>127){
			return false;
   		}
	}

	if (user.match(userPat)==null){
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null){
		for (var i=1;i<=4;i++){
			if (IPArray[i]>255){
				return false;
		   	}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	
	for (i=0;i<len;i++){
		if (domArr[i].search(atomPat)==-1){
			return false;
   		}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1){
		return false;
	}

	if (len<2){
		return false;
	}

	return true;
}

function validar_C(){
	var NOM = document.getElementById("nombre_completo");
	var EMAIL = document.getElementById("email");
	var LOCAL = document.getElementById("telefono_local");
	var FAX = document.getElementById("telefono_fax");
	var MOVIL = document.getElementById("telefono_movil");
	var DIV = document.getElementById("division");
	var INF = document.getElementById("informacion");
	var ENVIAR = true;
	var ERROR = "Por favor, ingrese ó corrija:\n";
	
	if(NOM.value == ""){
		ENVIAR = false;
		ERROR += "\tNombre Completo\n";
		NOM.className = "invalido";
	} else
	if(NOM.value != "" && Espacios(NOM.value)){
		ENVIAR = false;
		ERROR += "\tNombre Completo inválido - no debe contener espacios en blanco al inicio\n";
		NOM.className = "invalido";
	}
	if(EMAIL.value == ""){
		ENVIAR = false;
		ERROR += "\tCorreo-e\n";
		EMAIL.className = "invalido";
	} else
	if(EMAIL.value != ""){
		if(emailCheck(EMAIL.value) != true || Espacios(EMAIL.value)){
			ENVIAR = false;
			ERROR += "\tCorreo-e inválido\n";
			EMAIL.className = "invalido";
		}
	}
	if(LOCAL.value == ""){
		ENVIAR = false;
		ERROR += "\tTelf. Local\n";
		LOCAL.className = "invalido";
	} else
	if(LOCAL.value != "" && LOCAL.value.length < 7){
		ENVIAR = false;
		ERROR += "\tTelf. Local inválido - debe contener al menos 7 dígitos\n";
		LOCAL.className = "invalido";
	}
	if(MOVIL.value == ""){
		ENVIAR = false;
		ERROR += "\tTelf. Móvil\n";
		MOVIL.className = "invalido";
	} else
	if(MOVIL.value != "" && MOVIL.value.length < 7){
		ENVIAR = false;
		ERROR += "\tTelf. Móvil inválido - debe contener al menos 7 dígitos\n";
		MOVIL.className = "invalido";
	}
	if(FAX.value != "" && FAX.value.length < 7){
		ENVIAR = false;
		ERROR += "\tTelf. Fax inválido - debe contener al menos 7 dígitos\n";
		FAX.className = "invalido";
	}
	if(DIV.value == 0){
		ENVIAR = false;
		ERROR += "\tDirigido a\n";
		DIV.className = "invalido";
	}
	if(INF.value == ""){
		ENVIAR = false;
		ERROR += "\tInformación\n";
		INF.className = "invalido";
	} else
	if(INF.value != "" && Espacios(INF.value)){
		ENVIAR = false;
		ERROR += "\tInformación inválido - no debe contener espacios en blanco al inicio\n";
		INF.className = "invalido";
	}
	
	if(ENVIAR)
	document.getElementById("contacto_csi").submit();
	else
	alert(ERROR);
}

function validar_I(){
	var USUARIO = document.getElementById("usuario");
	var CLAVE = document.getElementById("pass");
	var Entrar = true;
	var Error = "Por favor, ingrese \363 corrija:\n";
	
	if(USUARIO.value == "" || Espacios(USUARIO.value)){
		Entrar = false;
		Error += "\tUsuario\n";
		USUARIO.className = "invalido";
	}
	if(CLAVE.value == "" || Espacios(CLAVE.value)){
		Entrar = false;
		Error += "\tContrase\00F1a\n";
		CLAVE.className = "invalido";
	}

	if(Entrar)
		document.getElementById("ingreso").submit();
	else
		alert(Error);
}

function validar_CCSI(){
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.contacto_csi.nombre_completo.value == "" || Espacios(document.contacto_csi.nombre_completo.value)){
		Entrar = false;
		Error += "\tNombre Completo\n";
		document.contacto_csi.nombre_completo.className = "invalido";
	}
	if(document.contacto_csi.email.value == ""){
		Entrar = false;
		Error += "\tDirección E-mail\n";
		document.contacto_csi.email.className = "invalido";
	} else
	if(Espacios(document.contacto_csi.email.value) || validarEmail(document.contacto_csi.email.value)){
		Entrar = false;
		Error += "\tDirección E-mail inválida\n";
		document.contacto_csi.email.className = "invalido";
	}
	if(document.contacto_csi.telefono_local.value == ""){
		Entrar = false;
		Error += "\tTelf. local\n";
		document.contacto_csi.telefono_local.className = "invalido";
	} else
	if(document.contacto_csi.telefono_local.value != "" && document.contacto_csi.telefono_local.value.length < 7){
		Entrar = false;
		Error += "\tTelf. local inválido\n";
		document.contacto_csi.telefono_local.className = "invalido";
	}
	if(document.contacto_csi.telefono_fax.value != "" && document.contacto_csi.telefono_fax.value.length < 7){
		Entrar = false;
		Error += "\tTelf. fax inválido\n";
		document.contacto_csi.telefono_fax.className = "invalido";
	}
	if(document.contacto_csi.telefono_movil.value == ""){
		Entrar = false;
		Error += "\tTelf. móvil\n";
		document.contacto_csi.telefono_movil.className = "invalido";
	} else
	if(document.contacto_csi.telefono_movil.value != "" && document.contacto_csi.telefono_movil.value.length < 7){
		Entrar = false;
		Error += "\tTelf. móvil inválido\n";
		document.contacto_csi.telefono_movil.className = "invalido";
	}
	if(document.contacto_csi.division.value == "0"){
		Entrar = false;
		Error += "\tDivisión\n";
		document.contacto_csi.division.className = "invalido";
	}
	if(document.contacto_csi.informacion.value == "" || Espacios(document.contacto_csi.informacion.value)){
		Entrar = false;
		Error += "\tInformación\n";
		document.contacto_csi.informacion.className = "invalido";
	}
	if(Entrar)
		document.contacto_csi.submit();
	else
		alert(Error);
}

function validar_NC(){
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.cambiar_clave.clave.value == "" || Espacios(document.cambiar_clave.clave.value)){
		Entrar = false;
		Error += "\tContraseña actual\n";
		document.cambiar_clave.clave.className = "invalido";
	}
	if(document.cambiar_clave.clave.value != "" && document.cambiar_clave.nclave.value == ""){
		Entrar = false;
		Error += "\tNueva contraseña\n";
		document.cambiar_clave.nclave.className = "invalido";
	}	
	if(document.cambiar_clave.clave.value != "" && document.cambiar_clave.nclave.value != "" && document.cambiar_clave.nclave.value.length < 6){
		Entrar = false;
		Error += "\tNueva contraseña debe ser 6 caracteres mínimo\n";
		document.cambiar_clave.nclave.className = "invalido";
	}else
	if(document.cambiar_clave.clave.value != "" && document.cambiar_clave.nclave.value != "" && document.cambiar_clave.nclave.value.length >= 6 && Espacios(document.cambiar_clave.nclave.value)){
		Entrar = false;
		Error += "\tNueva contraseña no debe ser solo espacios\n";
		document.cambiar_clave.nclave.className = "invalido";
	}
	if(document.cambiar_clave.clave.value != "" && document.cambiar_clave.nclave.value != "" && document.cambiar_clave.nclave.value.length >= 6 && Espacios(document.cambiar_clave.nclave.value) == false && document.cambiar_clave.r_nclave.value == ""){
		Entrar = false;
		Error += "\tRepetir contraseña\n";
		document.cambiar_clave.r_nclave.className = "invalido";
	}else
	if(document.cambiar_clave.clave.value != "" && document.cambiar_clave.nclave.value != "" && document.cambiar_clave.nclave.value.length >= 6 && Espacios(document.cambiar_clave.nclave.value) == false && document.cambiar_clave.r_nclave.value != "" && document.cambiar_clave.r_nclave.value != document.cambiar_clave.nclave.value){
		Entrar = false;
		Error += "\tRepetir contraseña no coincide con Nueva contraseña\n";
		document.cambiar_clave.r_nclave.className = "invalido";
	}

	if(Entrar)
		document.cambiar_clave.submit();
	else
		alert(Error);
}

function validar_IET(){ /*Ingresar inmueble: Todos los inmuebles*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
		
	if(document.ingresar_inmueble.tipo_operacion.value == 0){
		Entrar = false;
		Error += "\tTipo operación\n";
		document.ingresar_inmueble.tipo_operacion.className = "invalido";
	}
	if(document.ingresar_inmueble.precio_oferta.value == ""){
		Entrar = false;
		Error += "\tPrecio de oferta\n";
		document.ingresar_inmueble.precio_oferta.className = "invalido";
	}
	if(document.ingresar_inmueble.comision.value == ""){
		Entrar = false;
		Error += "\tComisión\n";
		document.ingresar_inmueble.comision.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_inmueble.value == 0){
		Entrar = false;
		Error += "\tTipo inmueble\n";
		document.ingresar_inmueble.tipo_inmueble.className = "invalido";
	} else
	if((document.ingresar_inmueble.tipo_inmueble.value != 0 && document.ingresar_inmueble.tipo_inmueble.value != 2 && document.ingresar_inmueble.tipo_inmueble.value != 10 && document.ingresar_inmueble.tipo_inmueble.value != 11) && (document.ingresar_inmueble.numero_local.value == "" || Espacios(document.ingresar_inmueble.numero_local.value))){
		Entrar = false;
		Error += "\tApto./Ofc./Local\n";
		document.ingresar_inmueble.numero_local.className = "invalido";
	}
	if(document.ingresar_inmueble.pais.value == 0){
		Entrar = false;
		Error += "\tPaís\n";
		document.ingresar_inmueble.pais.className = "invalido";
	} else
	if(document.ingresar_inmueble.pais.value == "Otro" && (document.ingresar_inmueble.otro_pais.value == "" || Espacios(document.ingresar_inmueble.otro_pais.value))){
		Entrar = false;
		Error += "\tOtro país\n";
		document.ingresar_inmueble.otro_pais.className = "invalido";
	}
	if(document.ingresar_inmueble.estado.value == 0){
		Entrar = false;
		Error += "\tEstado\n";
		document.ingresar_inmueble.estado.className = "invalido";
	} else
	if(document.ingresar_inmueble.estado.value == "Otro" && (document.ingresar_inmueble.otro_estado.value == "" || Espacios(document.ingresar_inmueble.otro_estado.value))){
		Entrar = false;
		Error += "\tOtro estado\n";
		document.ingresar_inmueble.otro_estado.className = "invalido";
	}
	if(document.ingresar_inmueble.ciudad.value == 0){
		Entrar = false;
		Error += "\tCiudad\n";
		document.ingresar_inmueble.ciudad.className = "invalido";
	} else
	if(document.ingresar_inmueble.ciudad.value == "Otro" && (document.ingresar_inmueble.otra_ciudad.value == "" || Espacios(document.ingresar_inmueble.otra_ciudad.value))){
		Entrar = false;
		Error += "\tOtra ciudad\n";
		document.ingresar_inmueble.otra_ciudad.className = "invalido";
	}
	if(document.ingresar_inmueble.municipio.value == 0){
		Entrar = false;
		Error += "\tMunicipio\n";
		document.ingresar_inmueble.municipio.className = "invalido";
	} else
	if(document.ingresar_inmueble.municipio.value == "Otro" && (document.ingresar_inmueble.otro_municipio.value == "" || Espacios(document.ingresar_inmueble.otro_municipio.value))){
		Entrar = false;
		Error += "\tOtro municipio\n";
		document.ingresar_inmueble.otro_municipio.className = "invalido";
	}
	if(document.ingresar_inmueble.parroquia.value == 0){
		Entrar = false;
		Error += "\tParroquia\n";
		document.ingresar_inmueble.parroquia.className = "invalido";
	} else
	if(document.ingresar_inmueble.parroquia.value == "Otro" && (document.ingresar_inmueble.otra_parroquia.value == "" || Espacios(document.ingresar_inmueble.otra_parroquia.value))){
		Entrar = false;
		Error += "\tOtra parroquia\n";
		document.ingresar_inmueble.otra_parroquia.className = "invalido";
	}
	if(document.ingresar_inmueble.urbanizacion.value == 0){
		Entrar = false;
		Error += "\tUrb./Sector\n";
		document.ingresar_inmueble.urbanizacion.className = "invalido";
	} else
	if(document.ingresar_inmueble.urbanizacion.value == "Otro" && (document.ingresar_inmueble.otro_urb_sector.value == "" || Espacios(document.ingresar_inmueble.otro_urb_sector.value))){
		Entrar = false;
		Error += "\tOtra urb/sector\n";
		document.ingresar_inmueble.otro_urb_sector.className = "invalido";
	}
	if(document.ingresar_inmueble.avenida_calle.value == "" || Espacios(document.ingresar_inmueble.avenida_calle.value)){
		Entrar = false;
		Error += "\tAv./Calle\n";
		document.ingresar_inmueble.avenida_calle.className = "invalido";
	}
	if(document.ingresar_inmueble.como_mostrar.value == 0){
		Entrar = false;
		Error += "\tInst. p/mostrar\n";
		document.ingresar_inmueble.como_mostrar.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_calle.value == 0){
		Entrar = false;
		Error += "\tTipo de calle\n";
		document.ingresar_inmueble.tipo_calle.className = "invalido";
	}
	if(document.ingresar_inmueble.edif_casa_parcela.value == "" || Espacios(document.ingresar_inmueble.edif_casa_parcela.value)){
		Entrar = false;
		Error += "\tEdificio/Casa/Parcela\n";
		document.ingresar_inmueble.edif_casa_parcela.className = "invalido";
	}	
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IERES(){ /*Ingresar inmueble: Residencial*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.ano_const.value == ""){
		Entrar = false;
		Error += "\tAño de const.\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	} else
	if(document.ingresar_inmueble.ano_const.value != "" && (document.ingresar_inmueble.ano_const.value.length < 4 || document.ingresar_inmueble.ano_const.value == 0)){
		Entrar = false;
		Error += "\tAño de const. incorrecto\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	}
	if(document.ingresar_inmueble.vigilancia.value == 0){
		Entrar = false;
		Error += "\tVigilancia\n";
		document.ingresar_inmueble.vigilancia.className = "invalido";
	}
	if(document.ingresar_inmueble.estac_publico.value == 0){
		Entrar = false;
		Error += "\tEstac. Visitantes\n";
		document.ingresar_inmueble.estac_publico.className = "invalido";
	}
	if(document.ingresar_inmueble.salon_fiestas.value == 0){
		Entrar = false;
		Error += "\tSalón de fiestas\n";
		document.ingresar_inmueble.salon_fiestas.className = "invalido";
	}
	if(document.ingresar_inmueble.piscina.value == 0){
		Entrar = false;
		Error += "\tPiscina\n";
		document.ingresar_inmueble.piscina.className = "invalido";
	}
	if(document.ingresar_inmueble.gimnasio.value == 0){
		Entrar = false;
		Error += "\tGimnasio\n";
		document.ingresar_inmueble.gimnasio.className = "invalido";
	}
	if(document.ingresar_inmueble.sauna.value == 0){
		Entrar = false;
		Error += "\tSauna\n";
		document.ingresar_inmueble.sauna.className = "invalido";
	}
	if(document.ingresar_inmueble.jardin.value == 0){
		Entrar = false;
		Error += "\tJardín\n";
		document.ingresar_inmueble.jardin.className = "invalido";
	}
	if(document.ingresar_inmueble.parque_inf.value == 0){
		Entrar = false;
		Error += "\tParque Infantil\n";
		document.ingresar_inmueble.parque_inf.className = "invalido";
	}
	if(document.ingresar_inmueble.canchas_deportivas.value == 0){
		Entrar = false;
		Error += "\tCanchas deportivas\n";
		document.ingresar_inmueble.canchas_deportivas.className = "invalido";
	}
	if(document.ingresar_inmueble.amoblado.value == 0){
		Entrar = false;
		Error += "\tAmoblado\n";
		document.ingresar_inmueble.amoblado.className = "invalido";
	}
	if(document.ingresar_inmueble.area_const.value == ""){
		Entrar = false;
		Error += "\tArea de const.\n";
		document.ingresar_inmueble.area_const.className = "invalido";
	}
	if(document.ingresar_inmueble.puestos_estac.value == ""){
		Entrar = false;
		Error += "\tPuestos de estac.\n";
		document.ingresar_inmueble.puestos_estac.className = "invalido";
	}
	if(document.ingresar_inmueble.aire_central.value == 0){
		Entrar = false;
		Error += "\tA/A Central\n";
		document.ingresar_inmueble.aire_central.className = "invalido";
	}
	if(document.ingresar_inmueble.dorm_fam.value == ""){
		Entrar = false;
		Error += "\tDorm. familiares\n";
		document.ingresar_inmueble.dorm_fam.className = "invalido";
	}
	if(document.ingresar_inmueble.comedor.value == 0){
		Entrar = false;
		Error += "\tComedor\n";
		document.ingresar_inmueble.comedor.className = "invalido";
	}
	if(document.ingresar_inmueble.cocina_equip.value == 0){
		Entrar = false;
		Error += "\tCocina equipada\n";
		document.ingresar_inmueble.cocina_equip.className = "invalido";
	}
	if(document.ingresar_inmueble.lavandero.value == 0){
		Entrar = false;
		Error += "\tLavandero\n";
		document.ingresar_inmueble.lavandero.className = "invalido";
	}
	if(document.ingresar_inmueble.estar_fam.value == 0){
		Entrar = false;
		Error += "\tEstar familiar\n";
		document.ingresar_inmueble.estar_fam.className = "invalido";
	}
	if(document.ingresar_inmueble.estudio.value == 0){
		Entrar = false;
		Error += "\tEstudio\n";
		document.ingresar_inmueble.estudio.className = "invalido";
	}
	if(document.ingresar_inmueble.sotano.value == 0){
		Entrar = false;
		Error += "\tSótano\n";
		document.ingresar_inmueble.sotano.className = "invalido";
	}
	if(document.ingresar_inmueble.maletero.value == 0){
		Entrar = false;
		Error += "\tMaletero\n";
		document.ingresar_inmueble.maletero.className = "invalido";
	}
	if(document.ingresar_inmueble.jacuzzi.value == 0){
		Entrar = false;
		Error += "\tJacuzzi\n";
		document.ingresar_inmueble.jacuzzi.className = "invalido";
	}
	if(document.ingresar_inmueble.terraza.value == 0){
		Entrar = false;
		Error += "\tTerraza\n";
		document.ingresar_inmueble.terraza.className = "invalido";
	}
	if(document.ingresar_inmueble.patio.value == 0){
		Entrar = false;
		Error += "\tPatio\n";
		document.ingresar_inmueble.patio.className = "invalido";
	}
	if(document.ingresar_inmueble.sistema_tv.value == 0){
		Entrar = false;
		Error += "\tSistema de TV\n";
		document.ingresar_inmueble.sistema_tv.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IECOMOFC(){ /*Ingresar inmueble: Comercial (Oficina)*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.ano_const.value == ""){
		Entrar = false;
		Error += "\tAño de const.\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	} else
	if(document.ingresar_inmueble.ano_const.value != "" && (document.ingresar_inmueble.ano_const.value.length < 4 || document.ingresar_inmueble.ano_const.value == 0)){
		Entrar = false;
		Error += "\tAño de const. incorrecto\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	}
	if(document.ingresar_inmueble.vigilancia.value == 0){
		Entrar = false;
		Error += "\tVigilancia\n";
		document.ingresar_inmueble.vigilancia.className = "invalido";
	}
	if(document.ingresar_inmueble.estac_publico.value == 0){
		Entrar = false;
		Error += "\tEstac. Visitantes\n";
		document.ingresar_inmueble.estac_publico.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_const.value == 0){
		Entrar = false;
		Error += "\tTipo de const.\n";
		document.ingresar_inmueble.tipo_const.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion_general.value == 0){
		Entrar = false;
		Error += "\tRecepción general\n";
		document.ingresar_inmueble.recepcion_general.className = "invalido";
	}
	if(document.ingresar_inmueble.area_comercial.value == 0){
		Entrar = false;
		Error += "\tArea comercial\n";
		document.ingresar_inmueble.area_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.zona_carga.value == 0){
		Entrar = false;
		Error += "\tZona de carga\n";
		document.ingresar_inmueble.zona_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.ascensor_carga.value == 0){
		Entrar = false;
		Error += "\tAscensor de carga\n";
		document.ingresar_inmueble.ascensor_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.amoblado.value == 0){
		Entrar = false;
		Error += "\tAmoblado\n";
		document.ingresar_inmueble.amoblado.className = "invalido";
	}
	if(document.ingresar_inmueble.area_const.value == ""){
		Entrar = false;
		Error += "\tArea de const.\n";
		document.ingresar_inmueble.area_const.className = "invalido";
	}
	if(document.ingresar_inmueble.puestos_estac.value == ""){
		Entrar = false;
		Error += "\tPuestos de estac.\n";
		document.ingresar_inmueble.puestos_estac.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_pisos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_pisos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_pisos.value))){
		Entrar = false;
		Error += "\tOtro tipo de piso\n";
		document.ingresar_inmueble.otro_tipo_pisos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_techos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_techos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_techos.value))){
		Entrar = false;
		Error += "\tOtro tipo de techo\n";
		document.ingresar_inmueble.otro_tipo_techos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.aire_central.value == 0){
		Entrar = false;
		Error += "\tA/A Central\n";
		document.ingresar_inmueble.aire_central.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion.value == 0){
		Entrar = false;
		Error += "\tRecepción\n";
		document.ingresar_inmueble.recepcion.className = "invalido";
	}
	if(document.ingresar_inmueble.oficinas_cubiculos.value == ""){
		Entrar = false;
		Error += "\tNúm. ofc./cubículos\n";
		document.ingresar_inmueble.oficinas_cubiculos.className = "invalido";
	}
	if(document.ingresar_inmueble.sala_espera.value == 0){
		Entrar = false;
		Error += "\tRecepción\n";
		document.ingresar_inmueble.sala_espera.className = "invalido";
	}
	if(document.ingresar_inmueble.sala_reuniones.value == 0){
		Entrar = false;
		Error += "\tSala de reuniones\n";
		document.ingresar_inmueble.sala_reuniones.className = "invalido";
	}
	if(document.ingresar_inmueble.archivo.value == 0){
		Entrar = false;
		Error += "\tArchivo\n";
		document.ingresar_inmueble.archivo.className = "invalido";
	}
	if(document.ingresar_inmueble.comedor_comercial.value == 0){
		Entrar = false;
		Error += "\tComedor\n";
		document.ingresar_inmueble.comedor_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.terraza_comercial.value == 0){
		Entrar = false;
		Error += "\tTerraza\n";
		document.ingresar_inmueble.terraza_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.central_telf.value == 0){
		Entrar = false;
		Error += "\tCentral telefónica\n";
		document.ingresar_inmueble.central_telf.className = "invalido";
	}
	if(document.ingresar_inmueble.luces_emergencia.value == 0){
		Entrar = false;
		Error += "\tLuces emergencia\n";
		document.ingresar_inmueble.luces_emergencia.className = "invalido";
	}
	if(document.ingresar_inmueble.detector_humo.value == 0){
		Entrar = false;
		Error += "\tDetector de humo\n";
		document.ingresar_inmueble.detector_humo.className = "invalido";
	}
	if(document.ingresar_inmueble.extintores.value == 0){
		Entrar = false;
		Error += "\tExtintores\n";
		document.ingresar_inmueble.extintores.className = "invalido";
	}
	if(document.ingresar_inmueble.regaderas_techo.value == 0){
		Entrar = false;
		Error += "\tRegaderas de techo\n";
		document.ingresar_inmueble.regaderas_techo.className = "invalido";
	}
	if(document.ingresar_inmueble.tablero_incendios.value == 0){
		Entrar = false;
		Error += "\tSist. anti-incendios\n";
		document.ingresar_inmueble.tablero_incendios.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.estructura.value == "Otra" && (document.ingresar_inmueble.otra_estructura.value == "" || Espacios(document.ingresar_inmueble.otra_estructura.value))){
		Entrar = false;
		Error += "\tOtra estructura\n";
		document.ingresar_inmueble.otra_estructura.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
		
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IECOMLOC(){ /*Ingresar inmueble: Comercial (Local)*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.ano_const.value == ""){
		Entrar = false;
		Error += "\tAño de const.\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	} else
	if(document.ingresar_inmueble.ano_const.value != "" && (document.ingresar_inmueble.ano_const.value.length < 4 || document.ingresar_inmueble.ano_const.value == 0)){
		Entrar = false;
		Error += "\tAño de const. incorrecto\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	}
	if(document.ingresar_inmueble.vigilancia.value == 0){
		Entrar = false;
		Error += "\tVigilancia\n";
		document.ingresar_inmueble.vigilancia.className = "invalido";
	}
	if(document.ingresar_inmueble.estac_publico.value == 0){
		Entrar = false;
		Error += "\tEstac. Visitantes\n";
		document.ingresar_inmueble.estac_publico.className = "invalido";
	}
	if(document.ingresar_inmueble.estructura.value == "Otra" && (document.ingresar_inmueble.otra_estructura.value == "" || Espacios(document.ingresar_inmueble.otra_estructura.value))){
		Entrar = false;
		Error += "\tOtra estructura\n";
		document.ingresar_inmueble.otra_estructura.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_const.value == 0){
		Entrar = false;
		Error += "\tTipo de const.\n";
		document.ingresar_inmueble.tipo_const.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion_general.value == 0){
		Entrar = false;
		Error += "\tRecepción general\n";
		document.ingresar_inmueble.recepcion_general.className = "invalido";
	}
	if(document.ingresar_inmueble.area_comercial.value == 0){
		Entrar = false;
		Error += "\tArea comercial\n";
		document.ingresar_inmueble.area_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.zona_carga.value == 0){
		Entrar = false;
		Error += "\tZona de carga\n";
		document.ingresar_inmueble.zona_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.ascensor_carga.value == 0){
		Entrar = false;
		Error += "\tAscensor de carga\n";
		document.ingresar_inmueble.ascensor_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.amoblado.value == 0){
		Entrar = false;
		Error += "\tAmoblado\n";
		document.ingresar_inmueble.amoblado.className = "invalido";
	}
	if(document.ingresar_inmueble.area_const.value == ""){
		Entrar = false;
		Error += "\tArea de const.\n";
		document.ingresar_inmueble.area_const.className = "invalido";
	}
	if(document.ingresar_inmueble.puestos_estac.value == ""){
		Entrar = false;
		Error += "\tPuestos de estac.\n";
		document.ingresar_inmueble.puestos_estac.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_pisos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_pisos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_pisos.value))){
		Entrar = false;
		Error += "\tOtro tipo de piso\n";
		document.ingresar_inmueble.otro_tipo_pisos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_techos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_techos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_techos.value))){
		Entrar = false;
		Error += "\tOtro tipo de techo\n";
		document.ingresar_inmueble.otro_tipo_techos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.aire_central.value == 0){
		Entrar = false;
		Error += "\tA/A Central\n";
		document.ingresar_inmueble.aire_central.className = "invalido";
	}
	if(document.ingresar_inmueble.central_telf.value == 0){
		Entrar = false;
		Error += "\tCentral telefónica\n";
		document.ingresar_inmueble.central_telf.className = "invalido";
	}
	if(document.ingresar_inmueble.luces_emergencia.value == 0){
		Entrar = false;
		Error += "\tLuces emergencia\n";
		document.ingresar_inmueble.luces_emergencia.className = "invalido";
	}
	if(document.ingresar_inmueble.detector_humo.value == 0){
		Entrar = false;
		Error += "\tDetector de humo\n";
		document.ingresar_inmueble.detector_humo.className = "invalido";
	}
	if(document.ingresar_inmueble.extintores.value == 0){
		Entrar = false;
		Error += "\tExtintores\n";
		document.ingresar_inmueble.extintores.className = "invalido";
	}
	if(document.ingresar_inmueble.regaderas_techo.value == 0){
		Entrar = false;
		Error += "\tRegaderas de techo\n";
		document.ingresar_inmueble.regaderas_techo.className = "invalido";
	}
	if(document.ingresar_inmueble.tablero_incendios.value == 0){
		Entrar = false;
		Error += "\tSist. anti-incendios\n";
		document.ingresar_inmueble.tablero_incendios.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IEEDF(){ /*Ingresar inmueble: Edificio*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.ano_const.value == ""){
		Entrar = false;
		Error += "\tAño de const.\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	} else
	if(document.ingresar_inmueble.ano_const.value != "" && (document.ingresar_inmueble.ano_const.value.length < 4 || document.ingresar_inmueble.ano_const.value == 0)){
		Entrar = false;
		Error += "\tAño de const. incorrecto\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	}
	if(document.ingresar_inmueble.vigilancia.value == 0){
		Entrar = false;
		Error += "\tVigilancia\n";
		document.ingresar_inmueble.vigilancia.className = "invalido";
	}
	if(document.ingresar_inmueble.estac_publico.value == 0){
		Entrar = false;
		Error += "\tEstac. Visitantes\n";
		document.ingresar_inmueble.estac_publico.className = "invalido";
	}
	if(document.ingresar_inmueble.estructura.value == "Otra" && (document.ingresar_inmueble.otra_estructura.value == "" || Espacios(document.ingresar_inmueble.otra_estructura.value))){
		Entrar = false;
		Error += "\tOtra estructura\n";
		document.ingresar_inmueble.otra_estructura.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_const.value == 0){
		Entrar = false;
		Error += "\tTipo de const.\n";
		document.ingresar_inmueble.tipo_const.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion_general.value == 0){
		Entrar = false;
		Error += "\tRecepción general\n";
		document.ingresar_inmueble.recepcion_general.className = "invalido";
	}
	if(document.ingresar_inmueble.area_comercial.value == 0){
		Entrar = false;
		Error += "\tArea comercial\n";
		document.ingresar_inmueble.area_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.zona_carga.value == 0){
		Entrar = false;
		Error += "\tZona de carga\n";
		document.ingresar_inmueble.zona_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.ascensor_carga.value == 0){
		Entrar = false;
		Error += "\tAscensor de carga\n";
		document.ingresar_inmueble.ascensor_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.area_bruta.value == ""){
		Entrar = false;
		Error += "\tArea bruta\n";
		document.ingresar_inmueble.area_bruta.className = "invalido";
	}
	if(document.ingresar_inmueble.area_vendible.value == ""){
		Entrar = false;
		Error += "\tArea vendible\n";
		document.ingresar_inmueble.area_vendible.className = "invalido";
	}
	if(document.ingresar_inmueble.banos.value == ""){
		Entrar = false;
		Error += "\tNúm. de baños\n";
		document.ingresar_inmueble.banos.className = "invalido";
	}
	if(document.ingresar_inmueble.puestos_estac.value == ""){
		Entrar = false;
		Error += "\tPuestos de estac.\n";
		document.ingresar_inmueble.puestos_estac.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IEIND(){ /*Ingresar inmueble: Industrial*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.ano_const.value == ""){
		Entrar = false;
		Error += "\tAño de const.\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	} else
	if(document.ingresar_inmueble.ano_const.value != "" && (document.ingresar_inmueble.ano_const.value.length < 4 || document.ingresar_inmueble.ano_const.value == 0)){
		Entrar = false;
		Error += "\tAño de const. incorrecto\n";
		document.ingresar_inmueble.ano_const.className = "invalido";
	}
	if(document.ingresar_inmueble.vigilancia.value == 0){
		Entrar = false;
		Error += "\tVigilancia\n";
		document.ingresar_inmueble.vigilancia.className = "invalido";
	}
	if(document.ingresar_inmueble.estac_publico.value == 0){
		Entrar = false;
		Error += "\tEstac. Visitantes\n";
		document.ingresar_inmueble.estac_publico.className = "invalido";
	}
	if(document.ingresar_inmueble.estructura.value == "Otra" && (document.ingresar_inmueble.otra_estructura.value == "" || Espacios(document.ingresar_inmueble.otra_estructura.value))){
		Entrar = false;
		Error += "\tOtra estructura\n";
		document.ingresar_inmueble.otra_estructura.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_const.value == 0){
		Entrar = false;
		Error += "\tTipo de const.\n";
		document.ingresar_inmueble.tipo_const.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion_general.value == 0){
		Entrar = false;
		Error += "\tRecepción general\n";
		document.ingresar_inmueble.recepcion_general.className = "invalido";
	}
	if(document.ingresar_inmueble.area_comercial.value == 0){
		Entrar = false;
		Error += "\tArea comercial\n";
		document.ingresar_inmueble.area_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.zona_carga.value == 0){
		Entrar = false;
		Error += "\tZona de carga\n";
		document.ingresar_inmueble.zona_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.ascensor_carga.value == 0){
		Entrar = false;
		Error += "\tAscensor de carga\n";
		document.ingresar_inmueble.ascensor_carga.className = "invalido";
	}
	if(document.ingresar_inmueble.altura_central.value == ""){
		Entrar = false;
		Error += "\tAltura central\n";
		document.ingresar_inmueble.altura_central.className = "invalido";
	}
	if(document.ingresar_inmueble.altura_lateral.value == ""){
		Entrar = false;
		Error += "\tAltura lateral\n";
		document.ingresar_inmueble.altura_lateral.className = "invalido";
	}
	if(document.ingresar_inmueble.carga_camiones.value == 0){
		Entrar = false;
		Error += "\tCap. p/camiones\n";
		document.ingresar_inmueble.carga_camiones.className = "invalido";
	}
	if(document.ingresar_inmueble.carga_contenedores.value == 0){
		Entrar = false;
		Error += "\tCap. p/contenedores\n";
		document.ingresar_inmueble.carga_contenedores.className = "invalido";
	}
	if(document.ingresar_inmueble.montacargas.value == ""){
		Entrar = false;
		Error += "\tMontacargas\n";
		document.ingresar_inmueble.montacargas.className = "invalido";
	}
	if(document.ingresar_inmueble.amoblado.value == 0){
		Entrar = false;
		Error += "\tAmoblado\n";
		document.ingresar_inmueble.amoblado.className = "invalido";
	}
	if(document.ingresar_inmueble.area_const.value == ""){
		Entrar = false;
		Error += "\tArea de const.\n";
		document.ingresar_inmueble.area_const.className = "invalido";
	}
	if(document.ingresar_inmueble.puestos_estac.value == ""){
		Entrar = false;
		Error += "\tPuestos de estac.\n";
		document.ingresar_inmueble.puestos_estac.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_pisos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_pisos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_pisos.value))){
		Entrar = false;
		Error += "\tOtro tipo de piso\n";
		document.ingresar_inmueble.otro_tipo_pisos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_techos.value == "Otro" && (document.ingresar_inmueble.otro_tipo_techos.value == "" || Espacios(document.ingresar_inmueble.otro_tipo_techos.value))){
		Entrar = false;
		Error += "\tOtro tipo de techo\n";
		document.ingresar_inmueble.otro_tipo_techos.value.className = "invalido";
	}
	if(document.ingresar_inmueble.aire_central.value == 0){
		Entrar = false;
		Error += "\tA/A Central\n";
		document.ingresar_inmueble.aire_central.className = "invalido";
	}
	if(document.ingresar_inmueble.recepcion.value == 0){
		Entrar = false;
		Error += "\tRecepción\n";
		document.ingresar_inmueble.recepcion.className = "invalido";
	}
	if(document.ingresar_inmueble.oficinas_cubiculos.value == ""){
		Entrar = false;
		Error += "\tNúm. ofc./cubículos\n";
		document.ingresar_inmueble.oficinas_cubiculos.className = "invalido";
	}
	if(document.ingresar_inmueble.sala_espera.value == 0){
		Entrar = false;
		Error += "\tRecepción\n";
		document.ingresar_inmueble.sala_espera.className = "invalido";
	}
	if(document.ingresar_inmueble.sala_reuniones.value == 0){
		Entrar = false;
		Error += "\tSala de reuniones\n";
		document.ingresar_inmueble.sala_reuniones.className = "invalido";
	}
	if(document.ingresar_inmueble.archivo.value == 0){
		Entrar = false;
		Error += "\tArchivo\n";
		document.ingresar_inmueble.archivo.className = "invalido";
	}
	if(document.ingresar_inmueble.comedor_comercial.value == 0){
		Entrar = false;
		Error += "\tComedor\n";
		document.ingresar_inmueble.comedor_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.terraza_comercial.value == 0){
		Entrar = false;
		Error += "\tTerraza\n";
		document.ingresar_inmueble.terraza_comercial.className = "invalido";
	}
	if(document.ingresar_inmueble.central_telf.value == 0){
		Entrar = false;
		Error += "\tCentral telefónica\n";
		document.ingresar_inmueble.central_telf.className = "invalido";
	}
	if(document.ingresar_inmueble.luces_emergencia.value == 0){
		Entrar = false;
		Error += "\tLuces emergencia\n";
		document.ingresar_inmueble.luces_emergencia.className = "invalido";
	}
	if(document.ingresar_inmueble.detector_humo.value == 0){
		Entrar = false;
		Error += "\tDetector de humo\n";
		document.ingresar_inmueble.detector_humo.className = "invalido";
	}
	if(document.ingresar_inmueble.extintores.value == 0){
		Entrar = false;
		Error += "\tExtintores\n";
		document.ingresar_inmueble.extintores.className = "invalido";
	}
	if(document.ingresar_inmueble.regaderas_techo.value == 0){
		Entrar = false;
		Error += "\tRegaderas de techo\n";
		document.ingresar_inmueble.regaderas_techo.className = "invalido";
	}
	if(document.ingresar_inmueble.tablero_incendios.value == 0){
		Entrar = false;
		Error += "\tSist. anti-incendios\n";
		document.ingresar_inmueble.tablero_incendios.className = "invalido";
	}
	if(document.getElementById("220").value == 0){
		Entrar = false;
		Error += "\tElectricidad: 220volts\n";
		document.getElementById("220").className = "invalido";
	}
	if(document.getElementById("440").value == 0){
		Entrar = false;
		Error += "\tElectricidad: 440volts\n";
		document.getElementById("440").className = "invalido";
	}
	if(document.ingresar_inmueble.generador.value == 0){
		Entrar = false;
		Error += "\tGenerador ó Planta\n";
		document.ingresar_inmueble.generador.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IETER(){ /*Ingresar inmueble: Terreno*/
	var Entrar = true;
	var Error = "Por favor, ingrese ó corrija:\n";
	
	if(document.ingresar_inmueble.area_terreno.value == ""){
		Entrar = false;
		Error += "\tArea de terreno\n";
		document.ingresar_inmueble.area_terreno.className = "invalido";
	}
	if(document.ingresar_inmueble.uso_terreno.value == 0){
		Entrar = false;
		Error += "\tTipo de uso\n";
		document.ingresar_inmueble.uso_terreno.className = "invalido";
	}
	if(document.ingresar_inmueble.terreno_plano.value == 0){
		Entrar = false;
		Error += "\tTerreno plano\n";
		document.ingresar_inmueble.terreno_plano.className = "invalido";
	}
	if(document.ingresar_inmueble.zonificacion.value == "" || Espacios(document.ingresar_inmueble.zonificacion.value)){
		Entrar = false;
		Error += "\tZonificacion\n";
		document.ingresar_inmueble.zonificacion.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_electricidad.value == 0){
		Entrar = false;
		Error += "\tElectricidad\n";
		document.ingresar_inmueble.serv_electricidad.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_agua.value == 0){
		Entrar = false;
		Error += "\tAgua\n";
		document.ingresar_inmueble.serv_agua.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_aservidas.value == 0){
		Entrar = false;
		Error += "\tAguas servidas\n";
		document.ingresar_inmueble.serv_aservidas.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_telefono.value == 0){
		Entrar = false;
		Error += "\tTeléfono\n";
		document.ingresar_inmueble.serv_telefono.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_gas.value == 0){
		Entrar = false;
		Error += "\tGas directo\n";
		document.ingresar_inmueble.serv_gas.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_aurbano.value == 0){
		Entrar = false;
		Error += "\tAseo urbano\n";
		document.ingresar_inmueble.serv_aurbano.className = "invalido";
	}
	if(document.ingresar_inmueble.serv_pavimento.value == 0){
		Entrar = false;
		Error += "\tPavimentado\n";
		document.ingresar_inmueble.serv_pavimento.className = "invalido";
	}
	if(document.ingresar_inmueble.prop_legal.value == 0){
		Entrar = false;
		Error += "\t¿Es usted el propietario legal del inmueble?\n";
		document.ingresar_inmueble.prop_legal.className = "invalido";
	} else
	if(document.ingresar_inmueble.prop_legal.value == "No" && document.ingresar_inmueble.prop_tipo_persona.value == 0){
		Entrar = false;
		Error += "\tTipo de propietario\n";
		document.ingresar_inmueble.prop_tipo_persona.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == 0){
		Entrar = false;
		Error += "\t¿Tiene Mandato del propietario firmado?\n";
		document.ingresar_inmueble.mandato_propietario.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: día\n";
		document.ingresar_inmueble.mi_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: mes\n";
		document.ingresar_inmueble.mi_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mi_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mi_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de inicio: año incorrecto\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_dia.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: día\n";
		document.ingresar_inmueble.mf_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_mes.value == 0){
		Entrar = false;
		Error += "\tMandato: Fecha de término: mes\n";
		document.ingresar_inmueble.mf_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.mandato_propietario.value == "Si" && document.ingresar_inmueble.mf_ano.value == ""){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	} else
	if(document.ingresar_inmueble.mf_ano.value != "" && document.ingresar_inmueble.mf_ano.value.length < 4){
		Entrar = false;
		Error += "\tMandato: Fecha de término: año incorrecto\n";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if((document.ingresar_inmueble.mi_ano.value != "" && document.ingresar_inmueble.mf_ano.value != "") && (document.ingresar_inmueble.mi_ano.value.length == 4 && document.ingresar_inmueble.mf_ano.value.length == 4) && (document.ingresar_inmueble.mi_ano.value > document.ingresar_inmueble.mf_ano.value)){
		Entrar = false;
		Error += "\tMandato: fechas incorrectas\n";
		document.ingresar_inmueble.mi_ano.className = "invalido";
		document.ingresar_inmueble.mf_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.descripcion.value == "" || Espacios(document.ingresar_inmueble.descripcion.value)){
		Entrar = false;
		Error += "\tDescripción\n";
		document.ingresar_inmueble.descripcion.className = "invalido";
	}
	
	if(Entrar)
		document.ingresar_inmueble.submit();
		else
		alert(Error);
}

function validar_IEPT(){ /* Propietario: Todos */
	var Error = "";

	if(document.ingresar_inmueble.avenida_calle.value == "" || Espacios(document.ingresar_inmueble.avenida_calle.value)){
		Entrar = false;
		Error += "\tAv./Calle\n";
		document.ingresar_inmueble.avenida_calle.className = "invalido";
	}
	if(document.ingresar_inmueble.edif_casa_parcela.value == "" || Espacios(document.ingresar_inmueble.edif_casa_parcela.value)){
		Entrar = false;
		Error += "\tEdificio/Casa\n";
		document.ingresar_inmueble.edif_casa_parcela.className = "invalido";
	}
	if(document.ingresar_inmueble.pais.value == 0){
		Entrar = false;
		Error += "\tPaís\n";
		document.ingresar_inmueble.pais.className = "invalido";
	} else
	if(document.ingresar_inmueble.pais.value == "Otro" && (document.ingresar_inmueble.otro_pais.value == "" || Espacios(document.ingresar_inmueble.otro_pais.value))){
		Entrar = false;
		Error += "\tOtro país\n";
		document.ingresar_inmueble.otro_pais.className = "invalido";
	}
	if(document.ingresar_inmueble.estado.value == 0){
		Entrar = false;
		Error += "\tEstado\n";
		document.ingresar_inmueble.estado.className = "invalido";
	} else
	if(document.ingresar_inmueble.estado.value == "Otro" && (document.ingresar_inmueble.otro_estado.value == "" || Espacios(document.ingresar_inmueble.otro_estado.value))){
		Entrar = false;
		Error += "\tOtro estado\n";
		document.ingresar_inmueble.otro_estado.className = "invalido";
	}
	if(document.ingresar_inmueble.ciudad.value == 0){
		Entrar = false;
		Error += "\tCiudad\n";
		document.ingresar_inmueble.ciudad.className = "invalido";
	} else
	if(document.ingresar_inmueble.ciudad.value == "Otro" && (document.ingresar_inmueble.otra_ciudad.value == "" || Espacios(document.ingresar_inmueble.otra_ciudad.value))){
		Entrar = false;
		Error += "\tOtra ciudad\n";
		document.ingresar_inmueble.otra_ciudad.className = "invalido";
	}
	if(document.ingresar_inmueble.municipio.value == 0){
		Entrar = false;
		Error += "\tMunicipio\n";
		document.ingresar_inmueble.municipio.className = "invalido";
	} else
	if(document.ingresar_inmueble.municipio.value == "Otro" && (document.ingresar_inmueble.otro_municipio.value == "" || Espacios(document.ingresar_inmueble.otro_municipio.value))){
		Entrar = false;
		Error += "\tOtro municipio\n";
		document.ingresar_inmueble.otro_municipio.className = "invalido";
	}
	if(document.ingresar_inmueble.parroquia.value == 0){
		Entrar = false;
		Error += "\tParroquia\n";
		document.ingresar_inmueble.parroquia.className = "invalido";
	} else
	if(document.ingresar_inmueble.parroquia.value == "Otro" && (document.ingresar_inmueble.otra_parroquia.value == "" || Espacios(document.ingresar_inmueble.otra_parroquia.value))){
		Entrar = false;
		Error += "\tOtra parroquia\n";
		document.ingresar_inmueble.otra_parroquia.className = "invalido";
	}
	if(document.ingresar_inmueble.urbanizacion.value == 0){
		Entrar = false;
		Error += "\tUrb./Sector\n";
		document.ingresar_inmueble.urbanizacion.className = "invalido";
	} else
	if(document.ingresar_inmueble.urbanizacion.value == "Otro" && (document.ingresar_inmueble.otro_urb_sector.value == "" || Espacios(document.ingresar_inmueble.otro_urb_sector.value))){
		Entrar = false;
		Error += "\tOtra urb./sector\n";
		document.ingresar_inmueble.otro_urb_sector.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_local2.value != "" && document.ingresar_inmueble.telefono_local2.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono local: código de área incorrecto\n";
		document.ingresar_inmueble.telefono_local2.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_local3.value != "" && document.ingresar_inmueble.telefono_local3.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono local: serial incorrecto\n";
		document.ingresar_inmueble.telefono_local3.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_local4.value != "" && document.ingresar_inmueble.telefono_local4.value.length < 4){
		Entrar = false;
		Error += "\tTeléfono local: dígitos incorrectos\n";
		document.ingresar_inmueble.telefono_local4.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_movil2.value != "" && document.ingresar_inmueble.telefono_movil2.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono móvil: operador incorrecto\n";
		document.ingresar_inmueble.telefono_movil2.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_movil3.value != "" && document.ingresar_inmueble.telefono_movil3.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono móvil: serial incorrecto\n";
		document.ingresar_inmueble.telefono_movil3.className = "invalido";
	}
	if(document.ingresar_inmueble.telefono_movil4.value != "" && document.ingresar_inmueble.telefono_movil4.value.length < 4){
		Entrar = false;
		Error += "\tTeléfono móvil: dígitos incorrectos\n";
		document.ingresar_inmueble.telefono_movil4.className = "invalido";
	}
	if((document.ingresar_inmueble.telefono_local2.value == "" && document.ingresar_inmueble.telefono_local3.value == "" && document.ingresar_inmueble.telefono_local4.value == "") && (document.ingresar_inmueble.telefono_movil2.value == "" && document.ingresar_inmueble.telefono_movil3.value == "" && document.ingresar_inmueble.telefono_movil4.value == "")){
		Entrar = false;
		Error += "\tDebe ingresar un telefono local o un teléfono móvil\n";
		document.ingresar_inmueble.telefono_local1.className = "invalido";
		document.ingresar_inmueble.telefono_local2.className = "invalido";
		document.ingresar_inmueble.telefono_local3.className = "invalido";
		document.ingresar_inmueble.telefono_local4.className = "invalido";
		document.ingresar_inmueble.telefono_movil1.className = "invalido";
		document.ingresar_inmueble.telefono_movil2.className = "invalido";
		document.ingresar_inmueble.telefono_movil3.className = "invalido";
		document.ingresar_inmueble.telefono_movil4.className = "invalido";
	}
	if(document.ingresar_inmueble.email.value == ""){
		Entrar = false;
		Error += "\tE-mail\n";
		document.ingresar_inmueble.email.className = "invalido";
	}else
	if(document.ingresar_inmueble.email.value != "" && (validarEmail(document.ingresar_inmueble.email.value) || Espacios(document.ingresar_inmueble.email.value))){
		Entrar = false;
		Error += "\tDirección de E-mail incorrecta\n";
		document.ingresar_inmueble.email.className = "invalido";
	}
	
	return Error;
}

function validar_IEPPN(){ /* Propietario: Persona Natural */
	var Entrar= true;
	var Error = "Por favor, ingrese o corrija:\n";

	if(validar_IEPT() != ""){
		Entrar = false;
		Error += validar_IEPT();
	}
	
	if(document.ingresar_inmueble.primer_nombre.value == "" || Espacios(document.ingresar_inmueble.primer_nombre.value)){
		Entrar = false;
		Error += "\tPrimer nombre\n";
		document.ingresar_inmueble.primer_nombre.className = "invalido";
	}
	if(document.ingresar_inmueble.primer_apellido.value == "" || Espacios(document.ingresar_inmueble.primer_apellido.value)){
		Entrar = false;
		Error += "\tPrimer apellido\n";
		document.ingresar_inmueble.primer_apellido.className = "invalido";
	}
	if(document.ingresar_inmueble.segundo_apellido.value == "" || Espacios(document.ingresar_inmueble.segundo_apellido.value)){
		Entrar = false;
		Error += "\tSegundo apellido\n";
		document.ingresar_inmueble.segundo_apellido.className = "invalido";
	}
	if(document.ingresar_inmueble.tipo_identificacion.value == "0"){
		Entrar = false;
		Error += "\tTipo identidad\n";
		document.ingresar_inmueble.tipo_identificacion.className = "invalido";
	}
	if(document.ingresar_inmueble.cedula_pasaporte.value == "" || Espacios(document.ingresar_inmueble.cedula_pasaporte.value)){
		Entrar = false;
		Error += "\tNúm. identidad\n";
		document.ingresar_inmueble.cedula_pasaporte.className = "invalido";
	}
	if(document.ingresar_inmueble.nacionalidad.value == "" || Espacios(document.ingresar_inmueble.nacionalidad.value)){
		Entrar = false;
		Error += "\tNacionalidad\n";
		document.ingresar_inmueble.nacionalidad.className = "invalido";
	}
	if(document.ingresar_inmueble.estado_civil.value == 0){
		Entrar = false;
		Error += "\tEstado civil\n";
		document.ingresar_inmueble.estado_civil.className = "invalido";
	}
	if(document.ingresar_inmueble.n_dia.value != "" && (document.ingresar_inmueble.n_dia.value < 0 || document.ingresar_inmueble.n_dia.value > 31)){
		Entrar = false;
		Error += "\tFecha nacimiento: día incorrecto\n";
		document.ingresar_inmueble.n_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.n_dia.value != "" && document.ingresar_inmueble.n_mes.value == 0){
		Entrar = false;
		Error += "\tFecha nacimiento: mes\n";
		document.ingresar_inmueble.n_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.n_dia.value != "" && document.ingresar_inmueble.n_mes.value != 0 && document.ingresar_inmueble.n_ano.value == ""){
		Entrar = false;
		Error += "\tFecha nacimiento: Año\n";
		document.ingresar_inmueble.n_ano.className = "invalido";
	}else
	if(document.ingresar_inmueble.n_ano.value != "" && document.ingresar_inmueble.n_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha nacimiento: Año incorrecto\n";
		document.ingresar_inmueble.n_ano.className = "invalido";
	}

	if(Entrar)
		document.ingresar_inmueble.submit();
	else
		alert(Error);
}

function validar_IEPPJ(){ /* Propietario: Persona Juridica */
	var Entrar= true;
	var Error = "Por favor, ingrese o corrija:\n";

	if(validar_IEPT() != ""){
		Entrar = false;
		Error += validar_IEPT();
	}
	if(document.ingresar_inmueble.razon_social.value == "" || Espacios(document.ingresar_inmueble.razon_social.value)){
		Entrar = false;
		Error += "\tRazón social\n";
		document.ingresar_inmueble.razon_social.className = "invalido";
	}
	if(document.ingresar_inmueble.rif.value == ""){
		Entrar = false;
		Error += "\tRIF\n";
		document.ingresar_inmueble.rif.className = "invalido";
	}else
	if(document.ingresar_inmueble.rif.value.length < 10 || Espacios(document.ingresar_inmueble.rif.value)){
		Entrar = false;
		Error += "\tRIF es incorrecto - Ver muestra\n";
		document.ingresar_inmueble.rif.className = "invalido";
	}
	if(document.ingresar_inmueble.nombre_registro.value == "" || Espacios(document.ingresar_inmueble.nombre_registro.value)){
		Entrar = false;
		Error += "\tRegistro: nombre\n";
		document.ingresar_inmueble.nombre_registro.className = "invalido";
	}
	if(document.ingresar_inmueble.circunscripcion.value == "" || Espacios(document.ingresar_inmueble.circunscripcion.value)){
		Entrar = false;
		Error += "\tCircunscripción\n";
		document.ingresar_inmueble.circunscripcion.className = "invalido";
	}
	if(document.ingresar_inmueble.numero_registro.value == "" || Espacios(document.ingresar_inmueble.numero_registro.value)){
		Entrar = false;
		Error += "\tNúmero registro\n";
		document.ingresar_inmueble.numero_registro.className = "invalido";
	}
	if(document.ingresar_inmueble.tomo_registro.value == "" || Espacios(document.ingresar_inmueble.tomo_registro.value)){
		Entrar = false;
		Error += "\tTomo registro\n";
		document.ingresar_inmueble.tomo_registro.className = "invalido";
	}
	if(document.ingresar_inmueble.r_dia.value == ""){
		Entrar = false;
		Error += "\tFecha registro: día\n";
		document.ingresar_inmueble.r_dia.className = "invalido";
	}else
	if(document.ingresar_inmueble.r_dia.value != "" && (document.ingresar_inmueble.r_dia.value < 0 || document.ingresar_inmueble.r_dia.value > 31)){
		Entrar = false;
		Error += "\tFecha registro: día incorrecto\n";
		document.ingresar_inmueble.r_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.r_mes.value == "0"){
		Entrar = false;
		Error += "\tFecha registro: mes\n";
		document.ingresar_inmueble.r_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.r_ano.value == ""){
		Entrar = false;
		Error += "\tFecha registro: Año\n";
		document.ingresar_inmueble.r_ano.className = "invalido";
	}else
	if(document.ingresar_inmueble.r_ano.value != "" && document.ingresar_inmueble.r_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha registro: Año incorrecto\n";
		document.ingresar_inmueble.r_ano.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_primer_nombre.value == "" || Espacios(document.ingresar_inmueble.legal_primer_nombre.value)){
		Entrar = false;
		Error += "\tPrimer nombre\n";
		document.ingresar_inmueble.legal_primer_nombre.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_primer_apellido.value == "" || Espacios(document.ingresar_inmueble.legal_primer_apellido.value)){
		Entrar = false;
		Error += "\tPrimer apellido\n";
		document.ingresar_inmueble.legal_primer_apellido.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_segundo_apellido.value == "" || Espacios(document.ingresar_inmueble.legal_segundo_apellido.value)){
		Entrar = false;
		Error += "\tSegundo apellido\n";
		document.ingresar_inmueble.legal_segundo_apellido.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_tipo_identificacion.value == 0){
		Entrar = false;
		Error += "\tRepresentante legal: Tipo identidad\n";
		document.ingresar_inmueble.legal_tipo_identificacion.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_cedula_pasaporte.value == "" || Espacios(document.ingresar_inmueble.legal_cedula_pasaporte.value)){
		Entrar = false;
		Error += "\tC.I. ó Pasaporte\n";
		document.ingresar_inmueble.legal_cedula_pasaporte.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_nacionalidad.value == "" || Espacios(document.ingresar_inmueble.legal_nacionalidad.value)){
		Entrar = false;
		Error += "\tNacionalidad\n";
		document.ingresar_inmueble.legal_nacionalidad.className = "invalido";
	}
	if(document.ingresar_inmueble.legal_estado_civil.value == "" || Espacios(document.ingresar_inmueble.legal_estado_civil.value)){
		Entrar = false;
		Error += "\tEstado civil\n";
		document.ingresar_inmueble.legal_estado_civil.className = "invalido";
	}
	if(document.ingresar_inmueble.l_dia.value != "" && document.ingresar_inmueble.l_dia.value < 0 || document.ingresar_inmueble.l_dia.value > 31){
		Entrar = false;
		Error += "\tFecha nacimiento: día incorrecto\n";
		document.ingresar_inmueble.l_dia.className = "invalido";
	}
	if(document.ingresar_inmueble.l_dia.value != "" && document.ingresar_inmueble.l_mes.value == "0"){
		Entrar = false;
		Error += "\tFecha nacimiento: mes\n";
		document.ingresar_inmueble.l_mes.className = "invalido";
	}
	if(document.ingresar_inmueble.l_dia.value != "" && document.ingresar_inmueble.l_mes.value != "0" && document.ingresar_inmueble.l_ano.value == ""){
		Entrar = false;
		Error += "\tFecha nacimiento: Año\n";
		document.ingresar_inmueble.l_ano.className = "invalido";
	}else
	if(document.ingresar_inmueble.l_ano.value != "" && document.ingresar_inmueble.l_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha nacimiento: Año incorrecto\n";
		document.ingresar_inmueble.l_ano.className = "invalido";
	}
		if(Entrar)
		document.ingresar_inmueble.submit();
	else
		alert(Error);
}

function validar_AGN(){ /* Agregar Agente: Natural */
	var Error = "";
	
	if(document.agregar_agente.primer_nombre.value == "" || Espacios(document.agregar_agente.primer_nombre.value)){
		Entrar = false;
		Error += "\tPrimer nombre\n";
		document.agregar_agente.primer_nombre.className = "invalido";
	}
	if(document.agregar_agente.segundo_nombre.value != "" && Espacios(document.agregar_agente.primer_nombre.value)){
		Entrar = false;
		Error += "\tSegundo nombre inválido\n";
		document.agregar_agente.segundo_nombre.className = "invalido";
	}
	if(document.agregar_agente.primer_apellido.value == "" || Espacios(document.agregar_agente.primer_apellido.value)){
		Entrar = false;
		Error += "\tPrimer apellido\n";
		document.agregar_agente.primer_apellido.className = "invalido";
	}
	if(document.agregar_agente.segundo_apellido.value == "" || Espacios(document.agregar_agente.segundo_apellido.value)){
		Entrar = false;
		Error += "\tSegundo apellido\n";
		document.agregar_agente.segundo_apellido.className = "invalido";
	}
	if(document.agregar_agente.tipo_identificacion.value == 0){
		Entrar = false;
		Error += "\tTipo identidad\n";
		document.agregar_agente.tipo_identificacion.className = "invalido";
	}
	if(document.agregar_agente.cedula_pasaporte.value == "" || Espacios(document.agregar_agente.cedula_pasaporte.value)){
		Entrar = false;
		Error += "\tNúm. identidad\n";
		document.agregar_agente.cedula_pasaporte.className = "invalido";
	}
	if(document.agregar_agente.nacionalidad.value == "" || Espacios(document.agregar_agente.nacionalidad.value)){
		Entrar = false;
		Error += "\tNacionalidad\n";
		document.agregar_agente.nacionalidad.className = "invalido";
	}
	if(document.agregar_agente.estado_civil.value == 0){
		Entrar = false;
		Error += "\tEstado civil\n";
		document.agregar_agente.estado_civil.className = "invalido";
	}
	if(document.agregar_agente.n_dia.value != "" && (document.agregar_agente.n_dia.value < 1 || document.agregar_agente.n_dia.value > 31)){
		Entrar = false;
		Error += "\tFecha de nacimiento: día incorrecto\n";
		document.agregar_agente.n_dia.className = "invalido";
	}
	if(document.agregar_agente.n_dia.value != "" && document.agregar_agente.n_mes.value == 0){
		Entrar = false;
		Error += "\tFecha de nacimiento: mes\n";
		document.agregar_agente.n_mes.className = "invalido";
	}
	if(document.agregar_agente.n_dia.value != "" && document.agregar_agente.n_ano.value == ""){
		Entrar = false;
		Error += "\tFecha de nacimiento: año\n";
		document.agregar_agente.n_ano.className = "invalido";
	} else
	if(document.agregar_agente.n_ano.value != "" && document.agregar_agente.n_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha de nacimiento: año inválido\n";
		document.agregar_agente.n_ano.className = "invalido";
	}
	
	return Error;
}
	
function validar_AGJ(){ /* Agregar Agente: Juridico */
	var Error = "";

	if(document.agregar_agente.razon_social.value == "" || Espacios(document.agregar_agente.razon_social.value)){
		Entrar = false;
		Error += "\tRazón social\n";
		document.agregar_agente.razon_social.className = "invalido";
	}
	if(document.agregar_agente.rif.value == ""){
		Entrar = false;
		Error += "\tRIF\n";
		document.agregar_agente.rif.className = "invalido";
	} else
	if(document.agregar_agente.rif.value.length < 10 || Espacios(document.agregar_agente.rif.value)){
		Entrar = false;
		Error += "\tRIF inválido - Ver referencia\n";
		document.agregar_agente.rif.className = "invalido";
	}
	if(document.agregar_agente.nombre_registro.value == "" || Espacios(document.agregar_agente.nombre_registro.value)){
		Entrar = false;
		Error += "\tRegistro: nombre\n";
		document.agregar_agente.nombre_registro.className = "invalido";
	}
	if(document.agregar_agente.circunscripcion.value == "" || Espacios(document.agregar_agente.circunscripcion.value)){
		Entrar = false;
		Error += "\tCircunscripción\n";
		document.agregar_agente.circunscripcion.className = "invalido";
	}
	if(document.agregar_agente.numero_registro.value == "" || Espacios(document.agregar_agente.numero_registro.value)){
		Entrar = false;
		Error += "\tNúmero registro\n";
		document.agregar_agente.numero_registro.className = "invalido";
	}
	if(document.agregar_agente.tomo_registro.value == "" || Espacios(document.agregar_agente.tomo_registro.value)){
		Entrar = false;
		Error += "\tTomo registro\n";
		document.agregar_agente.tomo_registro.className = "invalido";
	}
	if(document.agregar_agente.r_dia.value == ""){
		Entrar = false;
		Error += "\tFecha registro: día\n";
		document.agregar_agente.r_dia.className = "invalido";
	}else
	if(document.agregar_agente.r_dia.value != "" && (document.agregar_agente.r_dia.value < 0 || document.registro.r_dia.value > 31)){
		Entrar = false;
		Error += "\tFecha registro: día inválido\n";
		document.agregar_agente.r_dia.className = "invalido";
	}
	if(document.agregar_agente.r_mes.value == 0){
		Entrar = false;
		Error += "\tFecha registro: mes\n";
		document.agregar_agente.r_mes.className = "invalido";
	}
	if(document.agregar_agente.r_ano.value == ""){
		Entrar = false;
		Error += "\tFecha registro: Año\n";
		document.agregar_agente.r_ano.className = "invalido";
	}else
	if(document.agregar_agente.r_ano.value != "" && document.agregar_agente.r_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha registro: Año inválido\n";
		document.agregar_agente.r_ano.className = "invalido";
	}
	if(document.agregar_agente.legal_primer_nombre.value == "" || Espacios(document.agregar_agente.legal_primer_nombre.value)){
		Entrar = false;
		Error += "\tPrimer nombre\n";
		document.agregar_agente.legal_primer_nombre.className = "invalido";
	}
	if(document.agregar_agente.legal_primer_apellido.value == "" || Espacios(document.agregar_agente.legal_primer_apellido.value)){
		Entrar = false;
		Error += "\tPrimer apellido\n";
		document.agregar_agente.legal_primer_apellido.className = "invalido";
	}
	if(document.agregar_agente.legal_segundo_apellido.value == "" || Espacios(document.agregar_agente.legal_segundo_apellido.value)){
		Entrar = false;
		Error += "\tSegundo apellido\n";
		document.agregar_agente.legal_segundo_apellido.className = "invalido";
	}
	if(document.agregar_agente.legal_tipo_identificacion.value == 0){
		Entrar = false;
		Error += "\tRepresentante legal: Tipo identidad\n";
		document.agregar_agente.legal_tipo_identificacion.className = "invalido";
	}
	if(document.agregar_agente.legal_cedula_pasaporte.value == "" || Espacios(document.agregar_agente.legal_cedula_pasaporte.value)){
		Entrar = false;
		Error += "\tC.I. ó Pasaporte\n";
		document.agregar_agente.legal_cedula_pasaporte.className = "invalido";
	}
	if(document.agregar_agente.legal_nacionalidad.value == "" || Espacios(document.agregar_agente.legal_nacionalidad.value)){
		Entrar = false;
		Error += "\tNacionalidad\n";
		document.agregar_agente.legal_nacionalidad.className = "invalido";
	}
	if(document.agregar_agente.legal_estado_civil.value == 0){
		Entrar = false;
		Error += "\tEstado civil\n";
		document.agregar_agente.legal_estado_civil.className = "invalido";
	}
	if(document.agregar_agente.l_dia.value != "" && (document.agregar_agente.l_dia.value < 0 || document.agregar_agente.l_dia.value > 31)){
		Entrar = false;
		Error += "\tFecha nacimiento: día inválido\n";
		document.agregar_agente.l_dia.className = "invalido";
	}
	if(document.agregar_agente.l_dia.value != "" && document.agregar_agente.l_mes.value == 0){
		Entrar = false;
		Error += "\tFecha nacimiento: mes\n";
		document.agregar_agente.l_mes.className = "invalido";
	}
	if(document.agregar_agente.l_dia.value != "" && document.agregar_agente.l_ano.value == ""){
		Entrar = false;
		Error += "\tFecha nacimiento: Año\n";
		document.agregar_agente.l_ano.className = "invalido";
	}else
	if(document.agregar_agente.l_ano.value != "" && document.agregar_agente.l_ano.value.length < 4){
		Entrar = false;
		Error += "\tFecha nacimiento: Año inválido\n";
		document.agregar_agente.l_ano.className = "invalido";
	}
	
	return Error;
}
	
function validar_AGP(){ /* Agregar Agente: Primaria */
	var Entrar = true;
	var Error = "Por favor, ingrese o corrija:\n";

	if(document.agregar_agente.tipo_agente.value == 0){
		Entrar = false;
		Error += "\tTipo de Agente\n";
		document.agregar_agente.tipo_agente.className = "invalido";
	}
	if(document.agregar_agente.tipo_agente.value == 1){
		if(validar_AGN() != ""){
			Entrar = false;
			Error += validar_AGN();
		}
	}
		
	if(document.agregar_agente.tipo_agente.value == 2){
		if(validar_AGJ() != ""){
			Entrar = false;
			Error += validar_AGJ();
		}
	}
		
	if(document.agregar_agente.avenida_calle.value == "" || Espacios(document.agregar_agente.avenida_calle.value)){
		Entrar = false;
		Error += "\tAv./Calle\n";
		document.agregar_agente.avenida_calle.className = "invalido";
	}
	if(document.agregar_agente.edif_casa_parcela.value == "" || Espacios(document.agregar_agente.edif_casa_parcela.value)){
		Entrar = false;
		Error += "\tEdificio/Casa\n";
		document.agregar_agente.edif_casa_parcela.className = "invalido";
	}
	if(document.agregar_agente.pais.value == 0){
		Entrar = false;
		Error += "\tPaís\n";
		document.agregar_agente.pais.className = "invalido";
	} else
	if(document.agregar_agente.pais.value == "Otro" && (document.agregar_agente.otro_pais.value == "" || Espacios(document.agregar_agente.otro_pais.value))){
		Entrar = false;
		Error += "\tOtro país\n";
		document.agregar_agente.otro_pais.className = "invalido";
	}
	if(document.agregar_agente.estado.value == 0){
		Entrar = false;
		Error += "\tEstado\n";
		document.agregar_agente.estado.className = "invalido";
	} else
	if(document.agregar_agente.estado.value == "Otro" && (document.agregar_agente.otro_estado.value == "" || Espacios(document.agregar_agente.otro_estado.value))){
		Entrar = false;
		Error += "\tOtro estado\n";
		document.agregar_agente.otro_estado.className = "invalido";
	}
	if(document.agregar_agente.ciudad.value == 0){
		Entrar = false;
		Error += "\tCiudad\n";
		document.agregar_agente.ciudad.className = "invalido";
	} else
	if(document.agregar_agente.ciudad.value == "Otro" && (document.agregar_agente.otra_ciudad.value == "" || Espacios(document.agregar_agente.otra_ciudad.value))){
		Entrar = false;
		Error += "\tOtra ciudad\n";
		document.agregar_agente.otra_ciudad.className = "invalido";
	}
	if(document.agregar_agente.municipio.value == 0){
		Entrar = false;
		Error += "\tMunicipio\n";
		document.agregar_agente.municipio.className = "invalido";
	} else
	if(document.agregar_agente.municipio.value == "Otro" && (document.agregar_agente.otro_municipio.value == "" || Espacios(document.agregar_agente.otro_municipio.value))){
		Entrar = false;
		Error += "\tOtro municipio\n";
		document.agregar_agente.otro_municipio.className = "invalido";
	}
	if(document.agregar_agente.parroquia.value == 0){
		Entrar = false;
		Error += "\tParroquia\n";
		document.agregar_agente.parroquia.className = "invalido";
	} else
	if(document.agregar_agente.parroquia.value == "Otro" && (document.agregar_agente.otra_parroquia.value == "" || Espacios(document.agregar_agente.otra_parroquia.value))){
		Entrar = false;
		Error += "\tOtra parroquia\n";
		document.agregar_agente.otra_parroquia.className = "invalido";
	}
	if(document.agregar_agente.urbanizacion.value == 0){
		Entrar = false;
		Error += "\tUrb./Sector\n";
		document.agregar_agente.urbanizacion.className = "invalido";
	} else
	if(document.agregar_agente.urbanizacion.value == "Otro" && (document.agregar_agente.otro_urb_sector.value == "" || Espacios(document.agregar_agente.otro_urb_sector.value))){
		Entrar = false;
		Error += "\tOtra urb./sector\n";
		document.agregar_agente.otro_urb_sector.className = "invalido";
	}
	if(document.agregar_agente.telefono_local2.value != "" && document.agregar_agente.telefono_local2.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono local: código de área incorrecto\n";
		document.agregar_agente.telefono_local2.className = "invalido";
	}
	if(document.agregar_agente.telefono_local3.value != "" && document.agregar_agente.telefono_local3.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono local: serial incorrecto\n";
		document.agregar_agente.telefono_local3.className = "invalido";
	}
	if(document.agregar_agente.telefono_local4.value != "" && document.agregar_agente.telefono_local4.value.length < 4){
		Entrar = false;
		Error += "\tTeléfono local: dígitos incorrectos\n";
		document.agregar_agente.telefono_local4.className = "invalido";
	}
	if(document.agregar_agente.telefono_movil2.value != "" && document.agregar_agente.telefono_movil2.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono móvil: operador incorrecto\n";
		document.agregar_agente.telefono_movil2.className = "invalido";
	}
	if(document.agregar_agente.telefono_movil3.value != "" && document.agregar_agente.telefono_movil3.value.length < 3){
		Entrar = false;
		Error += "\tTeléfono móvil: serial incorrecto\n";
		document.agregar_agente.telefono_movil3.className = "invalido";
	}
	if(document.agregar_agente.telefono_movil4.value != "" && document.agregar_agente.telefono_movil4.value.length < 4){
		Entrar = false;
		Error += "\tTeléfono móvil: dígitos incorrectos\n";
		document.agregar_agente.telefono_movil4.className = "invalido";
	}
	if((document.agregar_agente.telefono_local2.value == "" && document.agregar_agente.telefono_local3.value == "" && document.agregar_agente.telefono_local4.value == "") && (document.agregar_agente.telefono_movil2.value == "" && document.agregar_agente.telefono_movil3.value == "" && document.agregar_agente.telefono_movil4.value == "")){
		Entrar = false;
		Error += "\tDebe ingresar un telefono local o un teléfono móvil\n";
		document.agregar_agente.telefono_local1.className = "invalido";
		document.agregar_agente.telefono_local2.className = "invalido";
		document.agregar_agente.telefono_local3.className = "invalido";
		document.agregar_agente.telefono_local4.className = "invalido";
		document.agregar_agente.telefono_movil1.className = "invalido";
		document.agregar_agente.telefono_movil2.className = "invalido";
		document.agregar_agente.telefono_movil3.className = "invalido";
		document.agregar_agente.telefono_movil4.className = "invalido";
	}
	if(document.agregar_agente.email.value == ""){
		Entrar = false;
		Error += "\tE-mail\n";
		document.agregar_agente.email.className = "invalido";
	}else
	if(document.agregar_agente.email.value != "" && (validarEmail(document.agregar_agente.email.value) || Espacios(document.agregar_agente.email.value))){
		Entrar = false;
		Error += "\tDirección de E-mail incorrecta\n";
		document.agregar_agente.email.className = "invalido";
	}
	
	if(Entrar)
		document.agregar_agente.submit();
	else
		alert(Error);
}

function validar_NSP(){
	var Entrar = true;
	var Error = "Por favor, ingrese o corrija:\n";
	
	if(document.precio_status.n_status.value == 0){
		Entrar = false;
		Error += "\tNuevo status\n";
		document.precio_status.n_status.className = "invalido";
	}
	if(document.precio_status.n_status.value == 1 && document.precio_status.precio_oferta.value == ""){
		Entrar = false;
		Error += "\tPrecio de Oferta\n";
		document.precio_status.precio_oferta.className = "invalido";
	}
	if(document.precio_status.n_status.value == 2 && document.precio_status.precio_reserva.value == ""){
		Entrar = false;
		Error += "\tPrecio de reserva\n";
		document.precio_status.precio_reserva.className = "invalido";
	}
	if(document.precio_status.n_status.value == 2 && document.precio_status.r_corredor_vendedor.value == 0){
		Entrar = false;
		Error += "\tCorredor vendedor\n";
		document.precio_status.r_corredor_vendedor.className = "invalido";
	}
	
	if(Entrar)
		document.precio_status.submit();
	else
		alert(Error);
}

function setcorp(corpchecked){
	if(corpchecked.checked){
		document.getElementById("RE").checked = false;
		document.getElementById("RE").disabled = true;
		document.getElementById("OC").checked = false;
		document.getElementById("OC").disabled = true;
		document.getElementById("IN").checked = false;
		document.getElementById("IN").disabled = true;
		document.getElementById("ED").checked = false;
		document.getElementById("ED").disabled = true;
		document.getElementById("TE").checked = false;
		document.getElementById("TE").disabled = true;
	} else{
	document.getElementById("RE").disabled = false;
	document.getElementById("OC").disabled = false;
	document.getElementById("IN").disabled = false;
	document.getElementById("ED").disabled = false;
	document.getElementById("TE").disabled = false;
	}
}

function maxtext(textarea) {
		var intLimit = 400;
		var varValue = textarea.value;

		if (varValue.length > intLimit) {
			alert ("Máximo " + intLimit + " caracteres.");
			textarea.value = varValue.substring(0, intLimit);
		}
}

var nav4 = window.Event ? true : false;
function acceptNum(evt){	
	var key = nav4 ? evt.which : evt.keyCode;
	
	if(key <= 13 || key == 46 || (key >= 48 && key <= 57))
		return key;
	else{
		/*alert("Ingrese un valor numérico.");*/
		return false;
	}
}

function acceptNum2(evt){	
	var key = nav4 ? evt.which : evt.keyCode;
	
	if(key <= 13 || (key >= 48 && key <= 57))
		return key;
	else{
		/*alert("Ingrese un valor numérico.");*/
		return false;
	}
}

function acceptText(evt){	
	var key = nav4 ? evt.which : evt.keyCode;
	
	if(key <= 13 || key == 209 || key == 241 || (key >= 65 && key <= 122) || (key >= 48 && key <= 57))
		return key;
	else{
		alert("Ingrese solo letras o números.");
		return false;
	}
}

function validar_ENC(){
	var REFERENCIA = document.getElementById("referencia");
	var OTRAREF = document.getElementById("otra_referencia");
	var Enviar = true;
	var Error = "Por favor, ingrese o corrija:\n";
	
	if(REFERENCIA.value == 0){
		Enviar = false;
		Error += "\tDebe seleccionar una referencia\n";
		REFERENCIA.className = "invalido";
	}
	if(REFERENCIA.value == 7 && (OTRAREF.value == "" || Espacios(OTRAREF.value))){
		Enviar = false;
		Error += "\tOtro: favor indique\n";
		OTRAREF.className = "invalido";
	}
	
	if(Enviar)
		document.getElementById("csi_poll").submit();
}

function encuesta(valor){
	if(valor == 7)
		document.getElementById("otra_ref").style.visibility = "visible";
}

function FormatNumber(fld, milSep, decSep, e) {
  var sep = 0;
  var key = '';
  var i = j = 0;
  var len = len2 = 0;
  var strCheck = '0123456789';
  var aux = aux2 = '';
  var whichCode = (window.Event) ? e.which : e.keyCode;

  if (whichCode == 13) return true;  // Enter
  if (whichCode == 8) return true;  // Delete
  key = String.fromCharCode(whichCode);  // Get key value from key code
  if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
  len = fld.value.length;
  for(i = 0; i < len; i++)
  if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
  aux = '';
  for(; i < len; i++)
  if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
  aux += key;
  len = aux.length;
  if (len == 0) fld.value = '';
  if (len == 1) fld.value = '0'+ decSep + '0' + aux;
  if (len == 2) fld.value = '0'+ decSep + aux;
  if (len > 2) {
    aux2 = '';
    for (j = 0, i = len - 3; i >= 0; i--) {
      if (j == 3) {
        aux2 += milSep;
        j = 0;
      }
      aux2 += aux.charAt(i);
      j++;
    }
    fld.value = '';
    len2 = aux2.length;
    for (i = len2 - 1; i >= 0; i--)
    fld.value += aux2.charAt(i);
    fld.value += decSep + aux.substr(len - 2, len);
  }
  return false;
}
function irpag(ir, queryS){
	Pag = document.getElementById(ir).value - 1;
	if(Pag >= 0)
		document.location = "index.php?paginaN="+Pag+queryS;
}

/*
function show_otro(select, show){
	if(document.getElementById(select).value == 'Otro')
		document.getElementById(show).style.visibility = 'visible';
	else
		document.getElementById(show).value = null;
		document.getElementById(show).style.visibility = 'hidden';
}
*/