PageSourceSearch

https://www.enciclopediadegastronomia.es/scripts/public/default/scripts.js

js enciclopediadegastronomia.es collected 2026-10-02 11:04:11 UTC 5,912 bytes, 230 lines download raw bytes

1<!--
2
3if (document.getElementById){ 
4  document.write('<style type="text/css">#correoContentTools {display: none; } #contenidoRefRapida {display: none;}</style>')
5}
6function despliegaCapa(objLayer) {
7	this.contador = 0;
8	this.objLayer= objLayer;
9}
10despliegaCapa.prototype.alternaCapa = function(objImg,srcOff,srcOn) {
11	if (document.getElementById) {
12		if (objImg!="") var eleImagen = document.getElementById(objImg);
13		var eleLayer = document.getElementById(this.objLayer);
14		if  (eleLayer != null) {
15			if (eleLayer.style.display != "block") {
16				eleLayer.style.display = "block";
17				if (srcOn!="") eleImagen.src=srcOn;
18			} else {
19				eleLayer.style.display = "none";
20				if (srcOff!="") eleImagen.src=srcOff;
21			}			
22		}			
23	}
24}
25
26function SwitchMail(obj) {
27	if(document.getElementById) {
28	var el = document.getElementById(obj);
29	var title = document.getElementById(obj+'Title');
30	
31	if(el.style.display != "block"){
32	 el.style.display = "block";
33	 }else{
34	 el.style.display = "none";
35	 }
36	 }
37}
38function MM_openBrWindow(theURL,winName,features) { //v2.0
39 window.open(theURL,winName,features);
40}
41var evento = null;	
42function abreLightbox(foto,pie) {
43	dojo.require("dojox.image.Lightbox");
44	var lightBox = new dojox.image.Lightbox({ title: pie, href:"/fotos/"+foto});
45	dojo.connect(lightBox,'onClose',function(){
46		lightBox.destroy();
47	});
48	lightBox.startup();
49	lightBox.show();
50}
51/*
52* ---------------- CAPAS ALTERNAS -------------------------
53* 
54* Son las capas del correo y referencia rápida
55*
56*/
57cajaRefRapida = new despliegaCapa('contenidoRefRapida');
58//-->
59
60/***** Función de validación del formulario de envío.  *****/
61function check(){
62	if((document.getElementById('fromEmail').value == '')||(document.getElementById('toEmail').value == '')){
63		alert("Rellene el email de origen y de destino.");
64		return false;
65	}
66	else{
67		var mailOrigen = document.getElementById('fromEmail').value;
68		var mailDestino = document.getElementById('toEmail').value;
69		
70		var filtro = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
71		
72		if ((filtro.test(mailOrigen))&&(filtro.test(mailDestino))){
73			return true;
74		}
75        else{
76        	alert("Email con formato incorrecto");
77        	return false;
78        }
79     }
80}
81function cambiarFoto(foto, pie,width,height){
82	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
83		
84	var img = document.getElementById('fotoSeleccionada');
85 	var pieFoto = document.getElementById('pieFotoSeleccionada');
86 	var nueva="/fotos/"+foto;
87 	img.src = nueva;
88 	if(!hasInnerText) pieFoto.textContent = pie;
89 	else pieFoto.innerText = pie;
90 	if (width) {
91 		var ampliacion = dojo.byId("bAmpliarImagen");
92 		if (dojo.hasAttr(ampliacion, "onclick" )) dojo.removeAttr(ampliacion, "onclick" );
93 		if (evento!=null) dojo.disconnect(evento);
94 		evento = dojo.connect(ampliacion,"onclick",function() {
95 			abreLightbox(foto,pie);
96		});
97 	}
98}
99
100//Retorna: 1 = NIF ok, 2 = CIF ok, 3 = NIE ok, -1 = NIF error, -2 = CIF error, -3 = NIE error, 0 = ??? error
101function valida_nif_cif_nie( a )
102{
103	var temp = a.toUpperCase();
104	var cadenadni = "TRWAGMYFPDXBNJZSQVHLCKE";
105 
106	if( temp!= '' )
107	{
108		
109		//si no tiene un formato valido devuelve error
110		if( ( !/^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$/.test( temp ) && !/^[T]{1}[A-Z0-9]{8}$/.test( temp ) ) && !/^[0-9]{8}[A-Z]{1}$/.test( temp ) )
111		{
112			return 0;
113		}
114 
115		//comprobacion de NIFs estandar
116		if( /^[0-9]{8}[A-Z]{1}$/.test( temp ) )
117		{
118			posicion = a.substring( 8,0 ) % 23;
119			letra = cadenadni.charAt( posicion );
120			var letradni = temp.charAt( 8 );
121			if( letra == letradni )
122			{
123				return 1;
124			}
125			else
126			{
127				return -1;
128			}
129		}
130 
131 
132		//algoritmo para comprobacion de codigos tipo CIF
133		suma = parseInt(a.charAt(2))+parseInt(a.charAt(4))+parseInt(a.charAt(6));
134 
135		for( i = 1; i < 8; i += 2 )
136		{
137			temp1 = 2 * parseInt( a.charAt( i ) );
138			temp1 += '';
139			temp1 = temp1.substring(0,1);
140			temp2 = 2 * parseInt( a.charAt( i ) );
141			temp2 += '';
142			temp2 = temp2.substring( 1,2 );
143			if( temp2 == '' )
144			{
145				temp2 = '0';
146			}
147 
148			suma += ( parseInt( temp1 ) + parseInt( temp2 ) );
149		}
150		suma += '';
151		n = 10 - parseInt( suma.substring( suma.length-1, suma.length ) );
152 
153		//comprobacion de NIFs especiales (se calculan como CIFs)
154		if( /^[KLM]{1}/.test( temp ) )
155		{
156			if( a.charAt( 8 ) == String.fromCharCode( 64 + n ) )
157			{
158				return 1;
159			}
160			else
161			{
162				return -1;
163			}
164		}
165 
166		//comprobacion de CIFs
167		if( /^[ABCDEFGHJNPQRSUVW]{1}/.test( temp ) )
168		{
169			temp = n + '';
170			if( a.charAt( 8 ) == String.fromCharCode( 64 + n ) || a.charAt( 8 ) == parseInt( temp.substring( temp.length-1, temp.length ) ) )
171			{
172				return 2;
173			}
174			else
175			{
176				return -2;
177			}
178		}
179 
180		//comprobacion de NIEs
181		//T
182		if( /^[T]{1}[A-Z0-9]{8}$/.test( temp ) )
183		{
184			if( a.charAt( 8 ) == /^[T]{1}[A-Z0-9]{8}$/.test( temp ) )
185			{
186				return 3;
187			}
188			else
189			{
190				return -3;
191			}
192		}
193		//XYZ
194		if( /^[XYZ]{1}/.test( temp ) )
195		{
196			temp = temp.replace( 'X','0' )
197			temp = temp.replace( 'Y','1' )
198			temp = temp.replace( 'Z','2' )
199			pos = temp.substring(0, 8) % 23;
200 
201			if( a.toUpperCase().charAt( 8 ) == cadenadni.substring( pos, pos + 1 ) )
202			{
203				return 3;
204			}
205			else
206			{
207				return -3;
208			}
209		}
210		return 1;
211	}
212 
213	return 0;
214}
215function str_replace( search, position, replace, subject )
216{
217	var f = search, r = replace, s = subject, p = position;
218	var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
219 
220	while( j = 0, i-- )
221	{
222		if( s[i] )
223		{
224			while( s[p] = s[p].split( f[j] ).join( ra ? r[j] || "" : r[0] ), ++j in f){};
225		}
226	};
227 
228	return sa ? s : s[0];
229}
230		 

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.