jQuery(function(a){a.fn.maximize=function(l){if(!this.length)return this;var b=a.extend({},a.fn.maximize.defaults,l);return this.each(function(){var d=a(this).find("img"),g=a(this),k=g.find("div"),m=k.outerHeight(!0)-k.height(),e=d.outerWidth(!0)-d.width(),n=d.outerHeight(!0)-d.height(),h={},f={},j;h[b.align]=0;f[b.align]=0;a(this).css(a.extend({position:"fixed",top:0,width:"100%",height:"100%",overflow:"hidden"},h));d.hide().css(a.extend({position:"absolute",top:0,left:0,visibility:"hidden"},f)); var q=function(){var i=a(window).height(),h=a(window).width(),c,f,j=g.data("img_size")||{width:d.width(),height:d.height(),ratio:d.width()/d.height()};k.length&&k.height(i-m);i=k.height();h=k.width();c=h/i;g.trigger("maximizerResize.maximize",[h,i]);if("crop"===b.resize)c>j.ratio?(c=h,f=h/j.ratio):(c=i*j.ratio,f=i);else if(c<j.ratio){c=h-e;0<b.zoomInLimit&&c>j.width*b.zoomInLimit&&(c=j.width*b.zoomInLimit);if(0<b.maxWidth&&c>b.maxWidth)c=b.maxWidth;f=c/j.ratio-n;if(0<b.maxHeight&&f>b.maxHeight)f= b.maxHeight,c=f*j.ratio}else{f=i-n;0<b.zoomInLimit&&f>j.height*b.zoomInLimit&&(f=j.height*b.zoomInLimit);if(0<b.maxHeight&&f>b.maxHeight)f=b.maxHeight;c=f*j.ratio-e;if(0<b.maxWidth&&c>b.maxWidth)c=b.maxWidth,f=c/j.ratio}d.width(c).height(f);-1!==a.inArray(b.center,["both","horizontal"])&&d.css({left:(h-c)/2});-1!==a.inArray(b.center,["both","vertical"])&&d.css({top:(i-f)/2});i=a("#imageWrapper");i.find("span.closeGallery").css({left:parseInt(i.find("img").css("left"))+parseInt(i.find("img").css("width"))- 30+"px",top:parseInt(i.find("img").css("top"))+"px"});i.find("span.productTipLarge").css({left:parseInt(i.find("img").css("left"))+parseInt(i.find("img").css("width"))-i.find("span.productTipLarge").width()+"px",top:parseInt(i.find("img").css("height"))+5+"px"}).fadeIn(200)};j=setInterval(function(){var h,f;d[0].complete&&(h=d.width(),f=d.height(),0<f&&0<h&&(g.data("img_size",{width:h,height:f,ratio:h/f}),q(),"fade"==b.effect?(g.trigger("beforeShow"),a("#imageWrapper").find("span.closeGallery").fadeIn(500), d.css({visibility:"visible"}).fadeIn(500,function(){g.trigger("afterShow")})):g.trigger("imageReady",[d,g]),h=a("#imageWrapper"),h.find("span.closeGallery").css({left:Math.ceil(parseFloat(h.find("img").css("left")))+Math.ceil(parseFloat(h.find("img").css("width")))-30+"px",top:parseInt(h.find("img").css("top"))+"px"}),h.find("span.productTipLarge").css({left:parseInt(h.find("img").css("left"))+parseInt(h.find("img").css("width"))-h.find("span.productTipLarge").width()+"px",top:parseInt(h.find("img").css("height"))+ 5+"px"}).fadeIn(200),clearInterval(j)))},50);a(window).bind("resize",function(){q()})})};a.fn.maximize.defaults={center:"both",align:"left",resize:"crop",zoomInLimit:0,maxWidth:0,maxHeight:0,effect:"fade"}}); (function(a){function l(b){var g=b||window.event,k=[].slice.call(arguments,1),m=0,e=0,n=0,b=a.event.fix(g);b.type="mousewheel";b.wheelDelta&&(m=b.wheelDelta/120);b.detail&&(m=-b.detail/3);n=m;void 0!==g.axis&&g.axis===g.HORIZONTAL_AXIS&&(n=0,e=-1*m);void 0!==g.wheelDeltaY&&(n=g.wheelDeltaY/120);void 0!==g.wheelDeltaX&&(e=-1*g.wheelDeltaX/120);k.unshift(b,m,e,n);return a.event.handle.apply(this,k)}var b=["DOMMouseScroll","mousewheel"];a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a= b.length;a;)this.addEventListener(b[--a],l,!1);else this.onmousewheel=l},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],l,!1);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); (function(a){a.fn.vCenter=function(){var l={sTop:function(){return window.pageYOffset||document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop},wHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body.clientHeight}};return this.each(function(b){if(0==b){var b=a(this),d=b.height(),d=l.sTop()+l.wHeight()/2-d/2;b.css({position:"absolute",marginTop:"0",top:d})}})}})(jQuery); (function(a){a.fn.newGallery=function(l){a.fn.newGallery.defaults={altText:"Allegro.pl",sessId:1};var b=a.extend(a.fn.newGallery.defaults,l);return this.each(function(){var d=a(this),g="",k=0,m,e,n={init:function(){b.productOnly&&1==a("#product_desc").data("photos").length?this.showSingleProduct():1==b.photos.small.length&&!b.productOnly?this.showSinglePhoto():this.construct()},showSingleProduct:function(){d.html('<div style="text-align:center;margin:50px 0 0 0;"><img src="'+a("#product_desc").data("photos")[0][2]+ '" alt="" width="800" height="600" /></div>')},showSinglePhoto:function(){d.html('<div class="gallery"><div class="galleryContainer"><div class="img" style="background:url('+b.photos.medium[0]+') no-repeat center;"></div></div><div class="clear"></div></div>');m=d.find("div.galleryThumbs");e=d.find("div.galleryContainer");galleryImage=d.find("div.img");this.populate()},construct:function(){d.html('<div class="gallery"><div class="galleryContainer"></div><div class="galleryThumbs"><div class="clear"></div><ul></ul></div><div class="clear"></div></div>'); m=d.find("div.galleryThumbs");e=d.find("div.galleryContainer");this.populate()},populate:function(){if(b.productOnly)for(var h=0;h<a("#product_desc").data("photos").length;h++)g+='<li><a href="#"><img src="'+a("#product_desc").data("photos")[h][0]+'" width="80" height="60" alt=""></a></li>';else for(h=0;h<b.photos.small.length;h++)g=1===b.external[h]?g+'<li class="productPhoto">':g+"<li>",g+='<a href="#"><img src="'+b.photos.small[h]+'" width="64" height="48" alt=""></a></li>';a(m).find("ul").html(g); b.productOnly?a(e).html('<img src="'+a("#product_desc").data("photos")[0][1]+'" alt="" /><a class="nextPhoto" href="#"><span></span></a><a class="prevPhoto" href="#"><span></span></a><a class="galleryTrigger" href="#"><span>'+b.zoomMsg+'</span></a><span class="photoFromProductCatalogueDesc">'+b.photoFromProductCatalogueMsg+'<a class="sIHelpIcon" style="margin:0 5px -2px;" href="#" data-helptip-body="'+b.productPhotoTip+'"></a></span>'):a(e).html('<div class="img" style="background:url('+b.photos.medium[0]+ ') no-repeat center;"></div><a class="nextPhoto" href="#"><span></span></a><a class="prevPhoto" href="#"><span></span></a><a class="galleryTrigger" href="#"><span>'+b.zoomMsg+'</span></a><span class="photoFromProductCatalogueDesc">'+b.photoFromProductCatalogueMsg+'<a class="sIHelpIcon" style="margin:0 5px -2px;" href="#" data-helptip-body="'+b.productPhotoTip+'"></a></span>');a(m).find("ul li:first-child").addClass("active");a(e).find("a.prevPhoto").addClass("disabled");1===b.photos.small.length&& a(e).find("a.nextPhoto").addClass("disabled");b.productOnly||(galleryImage=d.find("div.img"));a("a.nextPhoto span, a.prevPhoto span").hide();a("a.galleryTrigger").addClass("unavailable");a("a.prevPhoto").hover(function(){a("a.prevPhoto span").show()},function(){a("a.prevPhoto span").hide()});a("a.nextPhoto").hover(function(){a("a.nextPhoto span").show()},function(){a("a.nextPhoto span").hide()});a(".galleryContainer").hover(function(){a("a.galleryTrigger").removeClass("unavailable")},function(){a("a.galleryTrigger").addClass("unavailable")}); a(".galleryThumbs li.active").hasClass("productPhoto")?a("span.photoFromProductCatalogueDesc").show():a("span.photoFromProductCatalogueDesc").hide();1===b.external[0]&&1===b.photos.small.length&&a("span.photoFromProductCatalogueDesc").show();this.addEvents()},addEvents:function(){a(m).find("ul a").click(function(){k=a(m).find("ul li").index(a(this).parents("li"));a(this).parent().hasClass("active")||(a(this).parent().hasClass("productPhoto")?a("span.photoFromProductCatalogueDesc").show():a("span.photoFromProductCatalogueDesc").hide(), a(this).parent().addClass("active").siblings().removeClass("active"),b.productOnly?a(e).find("img").fadeOut(100,function(){a(this).attr("src",a("#product_desc").data("photos")[k][1]).unbind("load").load(function(){a(this).fadeIn(100)})}):a(e).find("div.img").fadeOut(100,function(){a(e).addClass("spinner");var h=new Image;a(h).load(function(){a(galleryImage).append(this);a(galleryImage).css("background-image","url("+b.photos.medium[k]+")");a(e).removeClass("spinner");a(galleryImage).fadeIn(100)}).attr("src", b.photos.medium[k]).hide();a("div.img img").remove()}),b.productOnly?0===k?a(e).find("a.nextPhoto").removeClass("disabled").siblings().addClass("disabled"):k===a("#product_desc").data("photos").length-1?a(e).find("a.nextPhoto").addClass("disabled").siblings().removeClass("disabled"):7===k?a(e).find("a.nextPhoto").addClass("disabled").siblings().removeClass("disabled"):a(e).find("a").removeClass("disabled"):0===k?a(e).find("a.nextPhoto").removeClass("disabled").siblings().addClass("disabled"):k=== b.photos.small.length-1?a(e).find("a.nextPhoto").addClass("disabled").siblings().removeClass("disabled"):a(e).find("a").removeClass("disabled"));return!1});a(e).delegate("a.prevPhoto","click",function(){var b=a(m).find("ul li.active").prev();b.length&&b.find("a").click();return!1});a(e).delegate("a.nextPhoto","click",function(){var b=a(m).find("ul li.active").next();b.length&&b.find("a").click();return!1});a(document).keyup(function(b){switch(b.which?b.which:b.keyCode){case 37:a(e).find("a.prevPhoto").click(); break;case 39:a(e).find("a.nextPhoto").click()}});a("div.galleryContainer img, div.galleryContainer div.img, a.galleryTrigger").click(function(){n.showLarge();return!1})},showLarge:function(){var h=a(document).height(),f,j,d,i,e,c,g,n,l="",o=0;if(a("#galContainer").length)k=a(m).find("li.active").index(),0<b.photos.large.length&&a("#thumbsContent a").eq(k).click(),f=a("#thumbsWrap"),g=a("#overlay"),e=a("span.nextPhoto"),c=a("span.prevPhoto"),a("#galContainer").fadeIn(300),g.css("height",h).fadeIn(300), f.fadeIn(300),e.fadeIn(300),c.fadeIn(300),a(document).bind("keyup",function(b){switch(b.which?b.which:b.keyCode){case 37:c.click();break;case 39:e.click();break;case 27:a("#galContainer").hide(),g.hide(),f.hide(),c.hide(),e.hide(),a(document).unbind("keyup")}});else{a("body").append('<div id="overlay"></div><span class="prevPhoto"></span><span class="nextPhoto"></span><div id="thumbsWrap"><div id="thumbsContent"><ul></ul><div id="contentSlider"><div id="track"></div></div></div></div><div id="galContainer"><div id="imageWrapper"></div></div>'); f=a("#thumbsWrap");j=a("#thumbsContent");d=a("#imageWrapper");i=a("#galContainer");g=a("#overlay");n=a("#contentSlider");e=a("span.nextPhoto");c=a("span.prevPhoto");1===b.photos.small.length&&a(e).css("opacity",0.5).css("cursor","default");if(0<b.photos.small.length)for(var p=0;p<b.photos.small.length;p++)l=1===b.external[p]?l+'<li class="productPhoto">':l+"<li>",l+='<a href="#"><span class="thumbBg"><img src="'+b.photos.small[p]+'" width="100" height="75" alt=""></span></a></li>';j.find("ul").html(l).find(".thumbBg img").css("opacity", 0.5);0<b.photos.large.length?d.html('<span class="closeGallery"></span><img src="'+b.photos.large[k]+'" alt="" />'):d.html('<span class="closeGallery"></span><img src="'+a("#product_desc").data("photos")[0][2]+'" alt="" />');f.find("ul li").eq(k).addClass("active").siblings().removeClass("active");f.find("ul li.active").find(".thumbBg img").css("opacity",1);c.css({top:a(window).scrollTop()+"px",opacity:0.5,cursor:"default"});e.css({top:a(window).scrollTop()+"px"});j.find("li.active").hasClass("productPhoto")&& (d.append('<span class="productTipLarge">'+b.photoFromProductCatalogueMsg+' <a href="#" style="margin:0 0 -2px;" class="sIHelpIcon" data-helptip-body="'+b.productPhotoTip+'"></a></span>'),a("#imageWrapper a.sIHelpIcon").helptip({event:"hover",pos:"t"}),a("#imageWrapper a.sIHelpIcon").click(function(){return!1}));8>=b.photos.small.length?(j.find("#contentSlider").hide(),j.css("width",110*j.find("ul li").size()+16)):(j.css({width:"893px",height:"110px"}),j.find("ul").css("width",110*b.photos.small.length+ 14),d.css({marginTop:"119px"}),n.show().find("#track").slider({min:0,max:parseInt(j.find("ul").css("width"))-parseInt(j.css("width")),slide:function(a,b){j.find("ul").css("marginLeft","-"+b.value+"px")},change:function(a,b){j.find("ul").css("marginLeft","-"+b.value+"px")}}));g.css("height",h).fadeIn(300);f.fadeIn(300).css({top:a(window).scrollTop()+2+"px"});i.fadeIn(300).maximize({resize:"fill",zoomInLimit:1.5}).vCenter();j.find("a").live("click",function(){o=f.find("ul li").index(a(this).parents("li")); if(!a(this).parent().hasClass("active")){a(this).parent().addClass("active").siblings().removeClass("active");a(this).parents("ul").find(".thumbBg img").css("opacity",0.6);a(this).parent().find(".thumbBg img").css("opacity",1);i.remove();a("body").append('<div id="galContainer"><div id="imageWrapper"></div></div>');d=a("#imageWrapper");i=a("#galContainer");a(this).parent().hasClass("productThumb")?d.html('<span class="closeGallery"></span><img src="'+(void 0).search_results[0].photo[0][2]+'" alt="" />'): d.html('<span class="closeGallery"></span><img src="'+b.photos.large[o]+'" alt="" />');a(this).parent().hasClass("productPhoto")&&(d.append('<span class="productTipLarge">'+b.photoFromProductCatalogueMsg+' <a href="#" style="margin:0 0 -2px;" class="sIHelpIcon" data-helptip-body="'+b.productPhotoTip+'"></a></span>'),a("#imageWrapper a.sIHelpIcon").helptip({event:"hover",pos:"t"}),a("#imageWrapper a.sIHelpIcon").click(function(){return!1}));if(8<j.find("ul li").size()){d.css({marginTop:"119px"});var h= a("#track").slider("option","value");j.find("ul li").size();var g=110*o;g<h?a("#track").slider("value",g):g+110>893+h&&a("#track").slider("value",h+110)}i.maximize({resize:"fill",zoomInLimit:1.5}).vCenter()}0!==o?c.css({opacity:1,cursor:"pointer"}):c.css({opacity:0.5,cursor:"default"});o!==0+b.photos.large.length-1?e.css({opacity:1,cursor:"pointer"}):e.css({opacity:0.5,cursor:"default"});return!1});f.find("div#thumbsContent").bind("mousewheel",function(a,b){0>b?e.click():c.click();return!1});d.live("click", function(){i.hide();g.hide();f.hide();c.hide();e.hide();a(document).unbind("keyup");return!1});c.click(function(){var b=f.find("ul li.active").prev();a(b).length&&a(b).find("a").click();0===o&&a(this).css({opacity:0.5,cursor:"default"});return!1});e.click(function(){var c=f.find("ul li.active").next();a(c).length&&a(c).find("a").click();o===b.photos.large.length-1&&a(this).css({opacity:0.5,cursor:"default"});return!1});a(document).bind("keyup",function(b){switch(b.which?b.which:b.keyCode){case 37:c.click(); break;case 39:e.click();break;case 27:i.hide(),g.hide(),f.hide(),c.hide(),e.hide(),a(document).unbind("keyup")}});a(window).scroll(function(){c.css({top:a(window).scrollTop()+"px"});e.css({top:a(window).scrollTop()+"px"});i.css({top:a(window).scrollTop()+"px"});f.css({top:a(window).scrollTop()+2+"px"})})}}};n.init();this.newGallery=n;a("span.photoFromProductCatalogueDesc a.sIHelpIcon").helptip({event:"hover",pos:"r"});a("span.photoFromProductCatalogueDesc a.sIHelpIcon").click(function(){return!1}); a("#siGallery .galleryContainer").each(function(){var b=a("#siGallery .galleryThumbs"),f=b.find("li").length,e=b.find("li").css("width"),d=b.find("ul"),i,g,c=5;b.find("li a:last").css("margin-right","0");d.css("width",f*parseFloat(e)+"px");5<f&&(a("#siGallery .galleryContainer").delegate("a.prevPhoto","click",function(){b.find("li.active").index()<c-5&&b.parent().find("span.leftControl").click()}),a("#siGallery .galleryContainer").delegate("a.nextPhoto","click",function(){b.find("li.active").index()+ 1>c&&b.parent().find("span.rightControl").click()}),b.parent().append('<span class="control leftControl lockArrow"></span><span class="control rightControl"></span>'),i=b.parent().find("span.rightControl"),g=b.parent().find("span.leftControl"),b.parent().delegate("span.rightControl","click",function(){c+5<=f?(d.animate({marginLeft:"-="+5*parseFloat(e)+"px"}),c+=5,c===f&&i.hide()):(d.animate({marginLeft:"-="+parseFloat(e)*(f-c)+"px"}),c+=f-c,i.hide());g.show()}),b.parent().delegate("span.leftControl", "click",function(){5<=c-5?(d.animate({marginLeft:"+="+5*parseFloat(e)+"px"}),c-=5,5===c&&g.hide()):(d.animate({marginLeft:"0px"}),c=5,g.hide());i.show()}),a("div.galleryContainer").delegate("a.nextPhoto","click",function(){b.find("li.active").index()<c-5&&(d.animate({marginLeft:"-="+parseFloat(e)*(b.find("li.active").index()-c+5)+"px"}),c+=b.find("li.active").index()-c+5,5<=c?g.show():g.hide(),c<f?i.show():i.hide())}),a("div.galleryContainer").delegate("a.prevPhoto","click",function(){b.find("li.active").index()> c-1&&(d.animate({marginLeft:"-="+parseFloat(e)*(b.find("li.active").index()-c+1)+"px"}),c+=b.find("li.active").index()-c+1,5<=c?g.show():g.hide(),c<f?i.show():i.hide())}),a("a.productPhoto").live("click",function(){var a=Math.ceil((b.find("li.productPhoto:first").index()+1)/5)-1,k=b.find("li.productPhoto:first").index()+1;k>c&&k<c+5?(c+5<=f?(d.animate({marginLeft:"-="+5*parseFloat(e)*a+"px"}),c+=5*a,c===f&&i.hide()):(d.animate({marginLeft:"-="+parseFloat(e)*(f-c)+"px"}),c+=f-c,i.hide()),g.show()): c-5>k&&(5<=c-5?(d.animate({marginLeft:"+="+5*parseFloat(e)*a+"px"}),c-=5*a,5===c&&g.hide()):(d.animate({marginLeft:"0px"}),c=5,g.hide()),i.show())}))})})}})(jQuery);
