var SITE_ROOT = '/app/webroot/'; Event. observe(window, 'load', function(e){ if(!$('extensionThumbs')){ return; } var images = $('extensionThumbs').getElementsByTagName('img'); for(var i = 0; i < images.length; i++){ var image = images[i]; image.originalSrc = image.src; image.width = image.width; image.height = image.height; Event.observe( image, 'mouseover', function(e){ var image = $(Event.findElement(e, 'img')); image.src = SITE_ROOT + 'img/thumb_ex_over.gif'; } ); Event.observe( image, 'mouseout', function(e){ var image = $(Event.findElement(e, 'img')); image.src = image.originalSrc; } ); } } );