(function($) { $.imagezoom = {}; $.imagezoom._close_handler = false; $.imagezoom._all_images = []; $.imagezoom._ctl_count = 0; $.imagezoom._defaults = { defaultWidth: 300, defaultHeight: 300, dimSpeed: 100, zoomAnimSpeed: 100, padding: 20, dimOpacity: 0.5, removeScroll: false }; $.imagezoom.settings = {}; // $.filelib._inst = null; $.fn.extend({ imagezoom: function(settings) { $.imagezoom.settings = $.extend({}, $.imagezoom._defaults, settings); return this.each(function() { var t = $(this); if(this.tagName == 'IMG') { var lnk = t.attr('longdesc'); t.wrap(''); t = t.parent(); } $.imagezoom._all_images.push(t); if(!t.attr('id')) { t.attr('id', '__imagezoom-' + ($.imagezoom._ctl_count++)); } t.click(function() { $.imagezoom.openImagezoom(t); return false; }); }); } }); function dimScreenOn(callback) { if($('#__dimScreen').length > 0 ) { if(typeof callback == 'function') { callback(); } return; } if($.imagezoom.settings.removeScroll) { $('BODY').css('overflow', 'hidden'); } $('
'). attr({id: '__dimScreen'}). css({ background: '#000', height: $(document).height(), left: '0px', opacity: 0, position: 'absolute', top: '0px', width: $(window).width(), zIndex: 1999 }). appendTo(document.body). fadeTo($.imagezoom.settings.dimSpeed, $.imagezoom.settings.dimOpacity, callback); $(window).resize(function() { $('#__dimScreen').css({ height: $(document).height(), width: $(window).width() }); }); } function dimScreenOff(callback) { $('#__dimScreen').fadeOut($.imagezoom.settings.dimSpeed, function() { $(this).remove(); if($.imagezoom.settings.removeScroll) { $('BODY').css('overflow', 'auto'); } if(typeof callback == 'function') { callback(); } }); } $.imagezoom.openImagezoom = function(t) { var tc = null; var n = null; var p = null; for(tc in $.imagezoom._all_images) { if($.imagezoom._all_images[tc].attr('id') == t.attr('id')) { tc = parseInt(tc, 0); if($.imagezoom._all_images[tc + 1]) { n = $.imagezoom._all_images[tc + 1]; } if($.imagezoom._all_images[tc - 1]) { p = $.imagezoom._all_images[tc - 1]; } } } dimScreenOn(function() { var w_w = $(window).width(); var w_h = $(window).height(); var i_w = $.imagezoom.settings.defaultWidth - $.imagezoom.settings.padding * 2; var i_h = $.imagezoom.settings.defaultHeight - $.imagezoom.settings.padding * 2; var description = t.find('IMG').attr('alt'); description = description.replace(/\n/g, '