var cacheInfo = $H(); /** Obtenemos todos los enlaces marcados como lightbox y les asignamos la función mostrarInfo al evento onClick **/ function iniciarGaleria() { var enlaces=document.getElementsByTagName('a'); var evento = "mouseover" if( $('iGaleria') && $F('iGaleria') == "3" ){ evento = "click" } for (var i=0; i< enlaces.length; i++){ var enlace = enlaces[i]; var relAttribute = String(enlace.getAttribute('rel')); if (relAttribute.toLowerCase().match('shadowbox')){ enlace.onclick = function() {return false}; Event.observe(enlace, evento, mostrarInfo.bindAsEventListener(this, enlace.getAttribute('href'))); } } } /** Obtenemos y mostramos el HTML asociado a la miniatura **/ function mostrarInfo(event, url) { var parseo=/(.*nsf).*0\/(.*)\/\$/i.exec(url); var ruta=parseo[1]; var unid=parseo[2]; if( cacheInfo[unid] ) { animarAparicion(cacheInfo[unid]); } else { //new Ajax.Updater('ampliacionGaleria', ruta + '/vGaleriaDetalleLateral/' + unid, { onSuccess:function(t) { new Effect.Appear('ampliacionGaleria'); cacheInfo[unid] = t.responseText; } }); new Ajax.Request(ruta + '/vGaleriaDetalleLateral/' + unid, { onSuccess:function(t) { cacheInfo[unid] = t.responseText; animarAparicion( t.responseText); } }); } } function animarAparicion( html ) { $('ampliacionGaleria').style.display='none'; Element.update('ampliacionGaleria', html); new Effect.Appear('ampliacionGaleria', { duration: 0.2, from: 0.5 }); } Event.observe(window, 'load', iniciarGaleria, false);