jQuery.noConflict(); (function($){ $(document).ready(function(){ $('#gallery').each(function(){ var i = 0, a = ''; var lis = $('li', this).each(function(){ this.id = 'gallery-' + (++i); a += '' + i + ''; }); $(this).append('
'); $('.nav a', this).click(function(){ var id = this.id.split('-')[1]; $('#gallery li').removeClass('active'); $('#gallery-' + id).addClass('active'); $('#gallery .nav a').removeClass('active'); $(this).addClass('active'); return false; }); $('.nav a:eq(0)', this).click(); }); function galleryNext(){ var imgs = $('#gallery li'); var a = imgs.filter('.active'); var n = a.next(); if (!n.length) n = $(imgs[0]); var id = n[0].id.split('-')[1]; n.addClass('next').show(); a.fadeOut(400, function(){ $(this).removeClass('active'); $('#gallery .next').removeClass('next').addClass('active'); }); $('#gallery .nav a').removeClass('active'); $('#gal-' + id).addClass('active'); } setInterval(galleryNext, 3000); if ($.fn.fancybox) { $('.product .image a').fancybox({ }); } if ($.browser.msie) { try {document.execCommand("BackgroundImageCache", false, true);} catch(err){}; if (typeof(DD_belatedPNG) != 'undefined') { DD_belatedPNG.fix('img, #gallery .nav, #gallery .nav a'); } } }); })(jQuery);