PageSourceSearch

https://www.ruidera.es/js/funWeb.js?1790285324

js ruidera.es collected 2026-09-24 21:34:42 UTC 23,378 bytes, 672 lines download raw bytes

1
2// V A R I A B L E S ----------------------------------------------------------------------------------------------------------------------------------------------------
3
4//Ventanas modales
5var bolVM = false;
6var intVM = null;
7var intVM2 = null;
8var intTipoV = 0;
9
10//Varios
11var bolMenu = false;
12var intMF;
13
14
15// C O N S T A N T E S --------------------------------------------------------------------------------------------------------------------------------------------------
16
17//Para definir resultados en las consultas SQL
18const EXITO = 1;
19const FALLO = 0;
20const NO_EXISTE = -1;
21const YA_EXISTE = -2;
22const YA_EXISTE_ID = -3;
23const YA_EXISTE_EMAIL_BAJA = -4;
24const LOGIN_ERROR = -5;
25const LOGIN_ERROR_IP = -6;
26const ERROR = -7;
27const FALLO_PARCIAL = -8;
28const RECAPTCHA_INCORRECTO = -9;
29
30
31//Acciones a realizar en los mantenimientos
32const INSERTAR = 1;
33const MODIFICAR = 2;
34const ELIMINAR = 3;
35const ACTIVAR = 4;
36const DESTACAR = 5;
37const SUBIR = 6;
38const BAJAR = 7;
39const ENVIAR = 8;
40const ACTUALIZAR = 9;
41const BAJA = 10;
42
43//Tipos de identificación
44const DNI = 1;
45const NIE = 2;
46const CIF = 3;
47const OTRO = 4;
48
49//Google
50const GOOGLE_RECAPTCHA_SITE_KEY = "6LelHDArAAAAADVeqLwcyjPZ7ydoAB7mhI2ozr-u";
51const GOOGLE_RECAPTCHA_SECRET_KEY = "6LelHDArAAAAAAkfbgoW4Myv8407qaaKX0PFdu5A";
52
53
54
55// V E N T A N A S   M O D A L E S --------------------------------------------------------------------------------------------------------------------------------------
56
57function fncInfo(strMensaje,just,t) {
58	switch (just) {
59		case "L": strJustificacion = "left"; break;
60		case "R": strJustificacion = "right"; break;
61		case "C": strJustificacion = "center"; break;
62		case "J": strJustificacion = "justify"; break;
63		default : strJustificacion = "left"; break;
64	}
65	if (t == undefined) t=5;	
66	clearTimeout(intVM);
67	clearTimeout(intVM2);
68	bolVM = true;
69	intTipoV = 1;
70	$("#vm").css("width","500px").css("height","auto").css("padding-bottom","20px");
71	$("#vm").html("<div class='seg'>" + t + "</div><img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><img src='imagenes/info.svg'/><p style='text-align:" + strJustificacion + "'>" + strMensaje + "</p>");
72	$("#ovm").show();
73	history.pushState(null,null,location.href.split('#')[0] + "#vm");
74	intVM = setTimeout("$('#vm .bCerrar').trigger('click');",t*1000);
75	intVM2 = setInterval(function(){ $("#vm .seg").text($("#vm .seg").text()-1); },1000);
76}
77	
78/* ----------------------------------------------------- */
79
80function fncAviso(strMensaje,just,t) {
81	switch (just) {
82		case "L": strJustificacion = "left"; break;
83		case "R": strJustificacion = "right"; break;
84		case "C": strJustificacion = "center"; break;
85		case "J": strJustificacion = "justify"; break;
86		default : strJustificacion = "left"; break;
87	}
88	if (t == undefined) t=5;
89	clearTimeout(intVM);
90	clearTimeout(intVM2);
91	bolVM = true;
92	intTipoV = 1;
93	$("#vm").css("width","500px").css("height","auto").css("padding-bottom","20px");
94	$("#vm").html("<div class='seg'>" + t + "</div><img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><img src='imagenes/aviso.svg'/><p style='text-align:" + strJustificacion + "'>" + strMensaje + "</p>");
95	$("#ovm").show();
96	history.pushState(null,null,location.href.split('#')[0] + "#vm");
97	intVM = setTimeout("$('#vm .bCerrar').trigger('click');",t*1000);
98	intVM2 = setInterval(function(){ $("#vm .seg").text($("#vm .seg").text()-1); },1000);
99		
100}
101
102/* ----------------------------------------------------- */
103
104function fncError(strMensaje,just,t) {
105	switch (just) {
106		case "L": strJustificacion = "left"; break;
107		case "R": strJustificacion = "right"; break;
108		case "C": strJustificacion = "center"; break;
109		case "J": strJustificacion = "justify"; break;
110		default : strJustificacion = "left"; break;
111	}	
112	if (t == undefined) t=5;
113	clearTimeout(intVM);
114	clearTimeout(intVM2);
115	bolVM = true;
116	intTipoV = 1;
117	$("#vm").css("width","500px").css("height","auto").css("padding-bottom","20px");
118	$("#vm").html("<div class='seg'>" + t + "</div><img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><img src='imagenes/error.svg'/><p style='text-align:" + strJustificacion + "'>" + strMensaje + "</p>");
119	$("#ovm").show();
120	history.pushState(null,null,location.href.split('#')[0] + "#vm");	
121	intVM = setTimeout("$('#vm .bCerrar').trigger('click');",t*1000);
122	intVM2 = setInterval(function(){ $("#vm .seg").text($("#vm .seg").text()-1); },1000);
123}
124
125/* ----------------------------------------------------- */
126
127function fncConfirmar(strMensaje,strFuncion,strParametro1,strParametro2,strParametro3) {
128	clearTimeout(intVM);
129	clearTimeout(intVM2);
130	bolVM = true;
131	intTipoV = 2;
132	$("#vm").css("width","500px").css("height","auto").css("padding-bottom","70px");
133	$("#vm").html("<img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><img src='imagenes/aviso.svg'/><p>" + strMensaje + "</p><div class='bVM'><div class='bSI'>SI</div><div class='bNO'>NO</div></div>");
134	$("#vm .bSI").on("click",function(e) {  
135		$("#vm .bCerrar").trigger("click");
136		if (strParametro1 != undefined) {
137			if (strParametro2 != undefined) {
138				if (strParametro3 != undefined) strFuncion(strParametro1,strParametro2,strParametro3);
139				else strFuncion(strParametro1,strParametro2);
140			} 
141			else strFuncion(strParametro1);
142		}
143		else strFuncion();
144    });
145	$("#vm .bNO").on('click',function(e) {  
146		$("#vm .bCerrar").trigger("click");
147		return false;
148    });
149	$("#ovm").show();
150	history.pushState(null,null,location.href.split('#')[0] + "#vm");
151}
152
153/* ----------------------------------------------------- */
154
155function fncLogout() {
156	clearTimeout(intVM);
157	clearTimeout(intVM2);
158	bolVM = true;
159	intTipoV = 3;
160	$("#vm").css("width","500px").css("height","auto").css("padding-bottom","50px");
161	$("#vm").html("<img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><img src='imagenes/aviso.svg'/><p>¿Quieres cerrar tu sesión de usuario?</p><div class='bVM'><div class='bSI'>SI</div><div class='bNO'>NO</div></div>");
162	$("#vm .bSI").on('click',function(e) {  
163		$("#vm .bCerrar").trigger("click");
164		window.location.href = "logout.php";
165    });
166	$("#vm .bNO").on('click',function(e) {  
167		$("#vm .bCerrar").trigger("click");  		
168		return false;
169    });
170	$("#ovm").show();
171	history.pushState(null,null,location.href.split('#')[0] + "#vm");	
172}
173
174/* ----------------------------------------------------- */
175
176function fncVentana(strURL,w,h) {
177	clearTimeout(intVM);
178	clearTimeout(intVM2);
179	bolVM = true;
180	intTipoV = 4;
181	$("#vm").hide();
182	$("#ovm").show();
183	$("#ovm .loading").show();
184	$("#vm").css("padding-bottom","20px");
185	$("#vm").html("<img class='bCerrar' src='imagenes/cerrar.svg' info='Cerrar' /><div id='VURL'></div>");
186	if (w != undefined && w != 0) $("#vm").css("width",w);
187	if (h != undefined && h != 0) $("#vm").css("height",h);
188	$("#VURL").load(strURL, function(){
189		$("#ovm .loading").hide();
190		$("#vm").show();
191		$("#vm").scrollTop(0);
192	});
193	history.pushState(null,null,location.href.split('#')[0] + "#vm");
194}
195
196/* ----------------------------------------------------- */
197
198function fncLoading(bolAccion) {
199    clearTimeout(intVM);
200    clearTimeout(intVM2);
201    intTipoV = 0;
202    if (bolAccion) {
203		$("#vm").hide();
204        $("#ovm .loading").show();  
205        $("#ovm").show();
206        bolVM = true;
207    }
208    else {
209  		$("#ovm").hide();
210        $("#ovm .loading").hide();
211		$("#vm").show();
212		bolVM = false;
213    }
214}
215
216/* ----------------------------------------------------- */
217function fncCookies() {
218	clearTimeout(intVM);
219	bolVM = true;
220	intTipoV = 5;
221	$("#vm").hide();
222	$("#ovm").show();
223	$("#ovm img.loading").show();
224	$("#vm").addClass("ck");
225	$("#vm").html("<img class='bCerrar' src='imagenes/cerrar.svg' /><div id='contV'></div>");
226	$("#vm").css("width",600);
227	$("#vm").css("height",500);
228    $('#vm .bCerrar').on('click',function(e) { 
229        $("#ovm").hide();
230        $("#vm").empty();
231        $("#vm").css("width","500px");
232        $("#vm").css("height","auto");
233        intTipoV = 0;
234        bolVM = false;
235        history.replaceState(null,null,location.href.split('#')[0]);
236        setTimeout(function(){
237            if (fncGetCookie("CONSENT") == "") $("#avisoCookies").slideDown();	
238        },100); 
239    });
240	$("#contV").load("cookies.php", function(){
241		$("#ovm img.loading").hide();
242		$("#vm").show();
243		$("#vm").scrollTop(0);
244        $("#cookies .check h3").on("click",function() {
245            $(this).find("img").toggleClass("on");
246            $("#BC" + $(this).data("id")).slideToggle();
247        });
248        $("#cookies .bCookies").on("click",function() {
249            let strConsent = "";
250            $("input[name^='chkCookies']").each(function() {
251                strConsent += ($(this).is(":checked"))? "1" : "0";
252            });
253            fncSetCookie("CONSENT",strConsent.toString(),157766400,true);
254            $("#vm .bCerrar").trigger("click");
255        });	
256    
257	});
258	history.pushState(null,null,location.href.split('#')[0] + "#vm");
259}
260
261
262// F U N C I O N E S   V A R I A S --------------------------------------------------------------------------------------------------------------------------------------
263
264function fncMoverScroll(obj) {
265	var intAltura = ($("#cabecera").is(":visible"))? $("#cabecera").outerHeight(true) : $("#cabeceraM").outerHeight(true);
266	if ($(obj).length) {
267        $("html").stop();
268        $("#TT").empty().hide();
269		$("html").animate({
270			scrollTop : $(obj).offset().top - intAltura
271		}, 1000);
272	}
273}
274
275
276function fncActivarBotones(bolActivados) {
277    if (bolActivados) {
278        $("#botonAccion").css( "display", "table");
279        $("#botonAccionOff").css( "display", "none");
280    }
281    else {
282        $("#botonAccion").css( "display", "none");
283        $("#botonAccionOff").css( "display", "table");
284    }
285}
286
287
288function fncValidarContacto() {
289	
290	clearTimeout(intMF);
291
292	$("input").val(function() {
293		return $.trim(this.value);
294	});	
295			   
296	if (document.frmContacto.txtNombre.value == "") {
297		$(".mform p").slideUp(function() {
298			$(".mform p").addClass("error").text("DEBES INDICAR TU NOMBRE Y APELLIDOS").slideDown(function() {
299				intMF = setTimeout( "$('.mform p').slideUp();",3000 ); 
300			});
301		});
302		return false;
303	}
304
305	if (document.frmContacto.txtEmail.value == "") {
306		$(".mform p").slideUp(function() {
307			$(".mform p").addClass("error").text("DEBES INDICAR TU EMAIL").slideDown(function() {
308				intMF = setTimeout( "$('.mform p').slideUp();",3000 ); 
309			});
310		});
311		return false;
312	}	
313	else if (!fncValidarEmail(document.frmContacto.txtEmail.value)) {
314		$(".mform p").slideUp(function() {
315			$(".mform p").addClass("error").text("EL EMAIL INDICADO NO ES CORRECTO").slideDown(function() {
316				intMF = setTimeout( "$('.mform p').slideUp();",3000 ); 
317			});
318		});
319		return false;
320	}
321
322	if (document.frmContacto.txtMensaje.value == "") {
323		$(".mform p").slideUp(function() {
324			$(".mform p").addClass("error").text("DEBES INDICAR TU CONSULTA").slideDown(function() {
325				intMF = setTimeout( "$('.mform p').slideUp();",3000 ); 
326			});
327		});
328		return false;
329	}       
330	
331
332	return true;
333
334}
335
336
337function fncEnviarContacto() {
338
339	if (fncValidarContacto()) {
340
341		grecaptcha.ready(function() {
342			grecaptcha.execute("6LelHDArAAAAADVeqLwcyjPZ7ydoAB7mhI2ozr-u", {
343				action: 'sendC'
344			}).then(function(token) {
345				
346				clearTimeout(intMF);
347
348				document.getElementById("rcToken").value = token;
349
350				$(".mform p").hide().removeClass("error").addClass("enviando").text("ENVIANDO...").show();
351
352				$.ajax({
353					method: "POST",
354					url: "enviarContacto.php",
355					data: $("form[name='frmContacto']").serialize()
356				})
357				.done(function(data) {
358
359					if (data == EXITO) {
360						$(".mform p").hide().removeClass("error").removeClass("enviando").addClass("ok").text("CONSULTA REALIZADA CORRECTAMENTE").slideDown(function() {
361							intMF = setTimeout( "$('.mform p').slideUp();",20000 ); 
362						});
363						$("form[name='frmContacto']").trigger("reset");
364					}
365
366					if (data == FALLO) {
367						$(".mform p").removeClass("enviando").addClass("error").text("SE HA PRODUCIDO UN ERROR, POR FAVOR INTÉNTELO DE NUEVO").slideDown(function() {
368							intMF = setTimeout( "$('.mform p').slideUp();",5000 ); 
369						});
370					}
371				})
372				.fail(function() {
373					$(".mform p").removeClass("enviando").addClass("error").text("SE HA PRODUCIDO UN ERROR, POR FAVOR INTÉNTELO DE NUEVO**").slideDown(function() {
374						intMF = setTimeout( "$('.mform p').slideUp();",5000 ); 
375					});       
376				});   
377
378			});
379		});
380
381	}
382}
383
384
385// T A R E A S   C O M U N E S   D E   I N I C I O ----------------------------------------------------------------------------------------------------------------------
386
387$(document).ready(function() {
388
389
390	/** CABECERA --------------------------------------- */
391
392	intAlturaPrecab = $("#preCab").outerHeight(true);
393	intAlturaCabecera = $("#cabecera").outerHeight(true);
394	intAlturaLogo = $("#logo").outerHeight(true);
395	
396	if ($("#cabecera").is(":visible")) {
397		$(window).on("scroll", function() {
398			if ($(window).scrollTop() >= intAlturaPrecab+intAlturaLogo) {
399				$("#cabecera").addClass("on");
400				$("#logo").hide();
401				$("#preCab").css("margin-bottom",intAlturaCabecera+"px");
402				$("#cabecera #menu div img").fadeIn();
403			}
404			else {
405				$("#cabecera").removeClass("on");
406				$("#logo").show();
407				$("#preCab").css("margin-bottom","0px");
408				$("#cabecera #menu div img").hide();
409			}
410		});
411	}
412
413	/** MENÚ PRINCIPAL --------------------------------- */
414
415	$("#menu li").on("click",function(){
416		if ($(this).attr("scroll") != undefined) {
417			fncMoverScroll("#"+$(this).attr("scroll"));
418		}
419	});
420
421	$("#menuLateralMovil li").on("click",function(){
422		if ($(this).attr("scroll") != undefined) {
423			fncMoverScroll("#"+$(this).attr("scroll"));
424			$("#botonMenuMovil").trigger("click");
425		}
426	});
427
428	$("#botonMenuMovil").on("click", function() {
429        $("#menuLateralMovil").toggleClass("open-sidebar");
430        $("body").toggleClass("scrollOff");
431        $("#fMenuMovil").toggle();
432        if ($("#fMenuMovil").is(":visible")) {
433        	bolMenu = true;
434        	location.href = location.href.split('#')[0] + "#m";
435        }
436        else {
437        	bolMenu = false;
438        	if (location.hash) history.go(-1);
439        }
440    });
441    
442    
443    $("#fMenuMovil").on("click",function(){
444    	$("#botonMenuMovil").trigger("click");	
445    });
446
447	/** TOOLTIP ---------------------------------------- */
448
449	$("body").append('<div id="TT"></div>');
450    $("body").on("mouseenter","*[info]", function(e) {
451        if ($(this).attr('info') != "") $("#TT").html($(this).attr("info")).show();
452    }).on("click","*[info]", function(e) {
453        $("#TT").empty().hide();
454    }).on("mouseleave","*[info]", function(e) {
455        $("#TT").empty().hide();
456    }).on("mousemove","*[info]", function(e) {
457    	if (e.pageX + 10 + $("#TT").outerWidth(true) > $(window).width()) {
458    		var mousex = e.pageX - 15 - $("#TT").outerWidth(true);
459    	}
460    	else {
461			var mousex = e.pageX + 10;
462    	}	    	
463        var mousey = e.pageY + 10;
464        $("#TT").css({ top: mousey, left: mousex });
465    });
466
467   
468	/** VARIOS ----------------------------------------- */
469	
470	$(window).on("mousewheel DOMMouseScroll", function(){
471        $("body,html").stop();
472        $("#TT").empty().hide();
473    });
474    
475    $(".bVolver").on("click",function(){
476    	window.history.back();
477    });
478
479    $("body").on("click","*[link]", function(e) {
480        if ($(this).attr("link") != "") window.location.href = $(this).attr("link");
481    });    
482
483	$(".bEnviarContacto").on("click",fncEnviarContacto);
484
485	/** OPCIONES DE VENTANAS MODALES ------------------- */
486 
487	$("body").append('<div id="ovm"></div>');
488	$("#ovm").append("<img class='loading' src='data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHdpZHRoPSIxNjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMTI4IDE2IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjOTlkNGVlIiBmaWxsLW9wYWNpdHk9IjAuNDIiIGQ9Ik02LjQsNC44QTMuMiwzLjIsMCwxLDEsMy4yLDgsMy4yLDMuMiwwLDAsMSw2LjQsNC44Wm0xMi44LDBBMy4yLDMuMiwwLDEsMSwxNiw4LDMuMiwzLjIsMCwwLDEsMTkuMiw0LjhaTTMyLDQuOEEzLjIsMy4yLDAsMSwxLDI4LjgsOCwzLjIsMy4yLDAsMCwxLDMyLDQuOFptMTIuOCwwQTMuMiwzLjIsMCwxLDEsNDEuNiw4LDMuMiwzLjIsMCwwLDEsNDQuOCw0LjhabTEyLjgsMEEzLjIsMy4yLDAsMSwxLDU0LjQsOCwzLjIsMy4yLDAsMCwxLDU3LjYsNC44Wm0xMi44LDBBMy4yLDMuMiwwLDEsMSw2Ny4yLDgsMy4yLDMuMiwwLDAsMSw3MC40LDQuOFptMTIuOCwwQTMuMiwzLjIsMCwxLDEsODAsOCwzLjIsMy4yLDAsMCwxLDgzLjIsNC44Wk05Niw0LjhBMy4yLDMuMiwwLDEsMSw5Mi44LDgsMy4yLDMuMiwwLDAsMSw5Niw0LjhabTEyLjgsMEEzLjIsMy4yLDAsMSwxLDEwNS42LDgsMy4yLDMuMiwwLDAsMSwxMDguOCw0LjhabTEyLjgsMEEzLjIsMy4yLDAsMSwxLDExOC40LDgsMy4yLDMuMiwwLDAsMSwxMjEuNiw0LjhaIi8+PGc+PHBhdGggZmlsbD0iIzBjOTlkNiIgZmlsbC1vcGFjaXR5PSIxIiBkPSJNLTQyLjcsMy44NEE0LjE2LDQuMTYsMCwwLDEtMzguNTQsOGE0LjE2LDQuMTYsMCwwLDEtNC4xNiw0LjE2QTQuMTYsNC4xNiwwLDAsMS00Ni44Niw4LDQuMTYsNC4xNiwwLDAsMS00Mi43LDMuODRabTEyLjgtLjY0QTQuOCw0LjgsMCwwLDEtMjUuMSw4YTQuOCw0LjgsMCwwLDEtNC44LDQuOEE0LjgsNC44LDAsMCwxLTM0LjcsOCw0LjgsNC44LDAsMCwxLTI5LjksMy4yWm0xMi44LS42NEE1LjQ0LDUuNDQsMCwwLDEtMTEuNjYsOGE1LjQ0LDUuNDQsMCwwLDEtNS40NCw1LjQ0QTUuNDQsNS40NCwwLDAsMS0yMi41NCw4LDUuNDQsNS40NCwwLDAsMS0xNy4xLDIuNTZaIi8+PGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJ0cmFuc2xhdGUiIHZhbHVlcz0iMjMgMDszNiAwOzQ5IDA7NjIgMDs3NC41IDA7ODcuNSAwOzEwMCAwOzExMyAwOzEyNS41IDA7MTM4LjUgMDsxNTEuNSAwOzE2NC41IDA7MTc4IDAiIGNhbGNNb2RlPSJkaXNjcmV0ZSIgZHVyPSIxMTcwbXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+PC9nPjwvc3ZnPgo=' />");
489    $("#ovm").append('<div id="vm"></div>').hide();
490	$("#vm").on("click",".bCerrar",function(e) {
491  		$("#TT").empty().hide();
492  		$("#ovm").hide();
493		$("#vm").empty();
494		bolVM = false;
495		clearTimeout(intVM);
496		clearTimeout(intVM2);
497        history.replaceState(null,null,location.href.split('#')[0]);
498        if (typeof fncActivarBotones == "function") fncActivarBotones(true);
499		if (intTipoV == 5) {
500			setTimeout(function(){
501				if (fncGetCookie("CONSENT") == "") $("#avisoCookies").slideDown();	
502			},100); 
503		}
504		intTipoV = 0;		
505    });    
506    $("#ovm").on("click",function(e) {
507        if(e.target == this && intTipoV != 4) {
508        	clearTimeout(intVM);
509        	$("#vm .bCerrar").trigger("click");
510		}
511    });
512        
513	$(document).keyup(function(e) {
514		if ($("#ovm").is(":visible")) { 
515			
516			e.preventDefault();
517			
518			if (intTipoV < 4 && (e.keyCode == 27 || e.keyCode == 32 || e.keyCode == 13 || e.keyCode == 83 || e.keyCode == 78)) {
519				
520				clearTimeout(intVM);
521				
522				if (intTipoV == 1 && (e.keyCode == 27 || e.keyCode == 32 || e.keyCode == 13)) {
523					$("#vm .bCerrar").trigger("click");	
524				}
525				
526				if (intTipoV == 2 && (e.keyCode == 32 || e.keyCode == 13 || e.keyCode == 83)) {
527					$("#vm .bSI").trigger("click");
528				}
529				
530				if (intTipoV == 2 && (e.keyCode == 27 || e.keyCode == 78)) {
531					$("#vm .bNO").trigger("click");
532				}
533				
534				if (intTipoV == 3 && (e.keyCode == 32 || e.keyCode == 13 || e.keyCode == 83)) {
535					$("#vm .bSI").trigger("click");
536				}
537				
538				if (intTipoV == 3 && (e.keyCode == 27 || e.keyCode == 78)) {
539					$("#vm .bNO").trigger("click");
540				}
541
542		        return false;
543			}
544			
545			if (intTipoV == 4 && (e.keyCode == 27)) {
546				$("#vm .bCerrar").trigger("click");
547			}		
548			
549			if (intTipoV == 5 && (e.keyCode == 27)) {
550				$("#vm .bCerrar").trigger("click");
551			}			
552			
553  		}
554	}); 
555
556        
557	/** INPUT PARA MONEDA ------------------------------ */
558	
559	//Evita pegar
560	$("body").on("paste drop","input[type='currency']",function(e) {
561		e.preventDefault();
562  	});
563  	
564	$("body").on("keypress","input[type='currency']",function(e) {
565  		//Limita caracteres a números y puntos
566		if (e.which != 8 && e.which != 0 && e.which != 45 && e.which != 46 && (e.which < 48 || e.which > 57)) return false;
567		strTmp = $(this).val();
568		//No permite que se ponga más de un punto
569		if (e.which == 46 && strTmp.indexOf(".") >= 0) return false;
570		//No permite que se ponga más de un -
571		if (e.which == 45 && strTmp.indexOf("-") >= 0) return false;
572	});
573	
574	$("body").on("keyup","input[type='currency']",function(e) {
575		//Evita que se meta un - intermedio
576		if ($(this).val().indexOf("-") > 0) $(this).val(parseFloat($(this).val().replace("-","")));
577		//Si hay decimales comprueba que sean 2, si son más redondea el número
578		if ($(this).val().indexOf(".") >= 0) {
579			var intPosicionDecimal = $(this).val().indexOf(".");
580    		var intValorEntero = $(this).val().substring(0,intPosicionDecimal);
581    		var intValorDecimal = $(this).val().substring(intPosicionDecimal+1);
582    		if (intValorDecimal.length > 2) {
583    			$(this).val( parseFloat($(this).val()).toFixed(2) );
584    		} 
585	    }	
586	});
587	
588	$("body").on("blur","input[type='currency']",function() {
589		if ($(this).val() != "" && $(this).val() !== "-" && !$(this).data("int")) $(this).val( parseFloat($(this).val()).toFixed(2) );
590	});
591	
592	
593	/** INPUT PARA ENTEROS ----------------------------- */
594
595	//Evita pegar
596	$("body").on("paste drop","input[type='integer']",function(e) {
597		e.preventDefault();
598  	});
599  	
600	$("body").on("keypress","input[type='integer']",function(e) {
601		if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) return false;
602	});    
603	
604	
605	/** INPUT PARA IBAN BANCARIO ----------------------- */
606
607	$("body").on("input","input[type='iban']",function(e) {
608		var target = e.target, position = target.selectionEnd, length = target.value.length;
609		target.value = target.value.replace(/[^\dA-Z,a-z]/g, '').replace(/(.{4})/g, '$1 ').trim().toUpperCase();
610		target.selectionEnd = position += ((target.value.charAt(position - 1) === ' ' && target.value.charAt(length - 1) === ' ' && length !== target.value.length) ? 1 : 0);
611	});
612
613
614	/** INPUT PARA URL --------------------------------- */
615
616	$("input[type='url']").on("change blur paste drop",function(){
617		objEnlace = $(this);
618		if (objEnlace.val() == "") {
619			objEnlace.removeClass("aviso").removeClass("ok").attr("info","");
620		}
621		else if (fncValidarURL(objEnlace.val())) {
622			objEnlace.removeClass('aviso').addClass("ok").attr("info","");
623			fncFormateaLink(objEnlace);
624		}
625		else {
626			objEnlace.removeClass('ok').addClass("aviso").attr("info","La dirección indicada no parece una URL correcta");
627			objEnlace.val($.trim(objEnlace.val()));
628		}
629	}).on("keyup",function(){
630		objEnlace = $(this);
631		if (objEnlace.val() == "") {
632			objEnlace.removeClass("aviso").removeClass("ok").attr("info","");
633		}
634	});
635        
636		
637 	/** COOKIES ---------------------------------------- */
638	
639	if (fncGetCookie("CONSENT") == "") {
640		$("#avisoCookies").slideDown();
641	}
642
643	$("#avisoCookies #B").on("click", function() {
644		//11111 > necesarias preferencias estadisticas marketing otras - 5 AÑOS
645		fncSetCookie("CONSENT","11111",157766400,true);
646		$("#avisoCookies").slideUp();
647	});
648
649	$("#avisoCookies #C").on("click", function() {
650		fncCookies();
651		$("#avisoCookies").slideUp();
652	});
653
654	$("#BCookies").on("click", fncCookies);
655 	
656});
657
658
659// G E S T I Ó N   D E L   H A S H --------------------------------------------------------------------------------------------------------------------------------------
660
661$(window).on("hashchange",function() {
662	
663	if (location.href.indexOf("#vm") < 0 && bolVM) $("#vm .bCerrar").trigger("click");
664	
665	if (location.href.indexOf("#m") < 0 && bolMenu) $("#botonMenuMovil").trigger("click");
666
667	if (location.href.indexOf("#popup") < 0 && $.magnificPopup != undefined) $.magnificPopup.close(); 
668
669});
670
671
672

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.