/* Copyright (C) YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

(function(f){$widgetkit.lazyloaders.slideshow=function(a,c){$widgetkit.support.canvas&&a.find("img[data-src]").each(function(){var a=f(this),b=document.createElement("canvas"),c=b.getContext("2d");b.width=a.attr("width");b.height=a.attr("height");c.drawImage(this,0,0);a.attr("src",b.toDataURL("image/png"))});a.css("visibility","hidden");var b=c.width,d=c.height,e=a.find("ul.slides:first"),g=e.children();g.css("width","");g.css("height","");e.css("height","");a.css("width","");"auto"!=b&&a.width()<
b&&(d=b="auto");a.css({width:"auto"==b?a.width():b});e.width();b=d;"auto"==b&&(b=g.eq(0).show().height());g.css({height:b});e.css("height",b);$widgetkit.load(WIDGETKIT_URL+"/widgets/slideshow/js/slideshow.js").done(function(){a.find("img[data-src]").each(function(){var a=f(this),b=a.data("src");setTimeout(function(){a.attr("src",b)},1)});a.slideshow(c).css("visibility","visible")})};$widgetkit.lazyloaders.showcase=function(a,c){var b=a.find(".wk-slideshow").css("visibility","hidden"),d=a.find(".wk-slideset").css("visibility",
"hidden"),e=d.find("ul.set > li");$widgetkit.lazyloaders.slideshow(b,c);$widgetkit.lazyloaders.slideset(d,f.extend({},c,{width:"auto",height:"auto",autoplay:!1,duration:c.slideset_effect_duration,index:parseInt(c.index/c.items_per_set)}));f(window).bind("resize",function(){var b=function(){a.css("width","");"auto"==c.width||c.width>a.width()?a.width(a.width()):a.width(c.width)};b();return b}());f.when($widgetkit.load(WIDGETKIT_URL+"/widgets/slideset/js/slideset.js"),$widgetkit.load(WIDGETKIT_URL+
"/widgets/slideshow/js/slideshow.js")).done(function(){b.css("visibility","visible");d.css("visibility","visible");var a=b.data("slideshow"),c=d.data("slideset");e.eq(a.index).addClass("active");b.bind("slideshow-show",function(a,b,d){if(!e.removeClass("active").eq(d).addClass("active").parent().is(":visible"))switch(d){case 0:c.show(0);break;case e.length-1:c.show(c.sets.length-1);break;default:c[d>b?"next":"previous"]()}});e.each(function(b){f(this).bind("click",function(){a.stop();a.show(b)})})})}})(jQuery);
