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

(function(j){var x=$widgetkit.support,y=[],l=function(){},p={width:"auto",height:"auto",index:0,autoplay:!1,effect:"slide",interval:5E3,easing:"easeOutCirc",duration:300};l.prototype=j.extend(l.prototype,{name:"slideset",initialize:function(c){this.options=j.extend({},p,c);var a=this,e=this.element;this.sets=e.find("ul.set");this.navitems=e.find("ul.nav").children();this.current=this.sets[this.options.index]?this.options.index:0;this.busy=!1;this.timer=null;this.hover=!1;this.gwidth="auto"==this.options.width?
e.width():this.options.width;this.navitems.each(function(e){j(this).bind("click",function(){a.stop().show(e)})});e.find(".next, .prev").bind("click",function(){a.stop()[j(this).hasClass("next")?"next":"previous"]()});"ontouchend"in document&&(e.bind("touchstart",function(c){function f(c){if(a){var d=c.originalEvent.touches?c.originalEvent.touches[0]:c;b={time:(new Date).getTime(),coords:[d.pageX,d.pageY]};10<Math.abs(a.coords[0]-b.coords[0])&&c.preventDefault()}}var g=c.originalEvent.touches?c.originalEvent.touches[0]:
c,a={time:(new Date).getTime(),coords:[g.pageX,g.pageY],origin:j(c.target)},b;e.bind("touchmove",f).one("touchend",function(){e.unbind("touchmove",f);a&&b&&1E3>b.time-a.time&&(30<Math.abs(a.coords[0]-b.coords[0])&&75>Math.abs(a.coords[1]-b.coords[1]))&&a.origin.trigger("swipe").trigger(a.coords[0]>b.coords[0]?"swipeleft":"swiperight");a=b=void 0})}),e.bind("swipeleft",function(){a.next()}).bind("swiperight",function(){a.previous()}));this.resize();j(window).bind("resize",function(){a.resize()});this.navitems.eq(this.current).addClass("active");
e.hover(function(){a.hover=true},function(){a.hover=false});this.options.autoplay&&this.start()},resize:function(){this.sets.css($widgetkit.css3({transform:""}));var c=this.element.find(".sets:first"),a=c.css({width:""}).width(),e=0,i="auto"==this.options.width?this.element.width():this.options.width,f="auto"==this.options.height?this.sets.eq(0).children().eq(0).outerHeight(!0):this.options.height;this.sets.each(function(){var c=j(this).show(),a=j(this).children();tmp=0;a.each(function(){var b=j(this);
b.css("left",tmp).data("left",tmp);tmp+=b.width()});e=Math.max(e,tmp);c.css("width",tmp).css("margin-left","").css("margin","0 auto").data("width",tmp)});this.element.data("optimalwidth",e);i="auto"==this.options.width?this.element.width():this.options.width;f="auto"==this.options.height?this.sets.eq(0).children().eq(0).outerHeight(!0):this.options.height;this.sets.css({height:f});c.css({height:f});this.element.data("optimalwidth")>a&&(i=e,a=e/a,this.sets.css($widgetkit.css3({transform:"scale("+1/
a+")"})),c.css("height",f/a));this.sets.each(function(){var c=j(this);c.data("margin-left",(i-c.data("width"))/2)});this.sets.hide().eq(this.current).show();this.gheight=f},next:function(){this.show(this.sets[this.current+1]?this.current+1:0)},previous:function(){this.show(-1<this.current-1?this.current-1:this.sets.length-1)},start:function(){if(!this.timer){var c=this;this.timer=setInterval(function(){!c.hover&&!c.busy&&c.next()},this.options.interval);return this}},stop:function(){if(this.timer){clearInterval(this.timer);
this.tmptimer&&clearTimeout(this.tmptimer);var c=this;this.tmptimer=setTimeout(function(){c.start();this.tmptimer=!1},3E4);this.timer=!1}return this},show:function(c){this.current==c||this.busy||(this.element.trigger("slideset-show",[this.current,c]),this[this[this.options.effect]?this.options.effect:"slide"](c),this.navitems.removeClass("active").eq(c).addClass("active"))},slide:function(c){var a=c>this.current?"left":"right",e=this.sets.eq(c),i=this;this.busy=!0;this.sets.eq(this.current).animate({"margin-left":2*
("left"==a?-1:1)*this.gwidth},{complete:function(){e.css("margin-left","auto").children().hide().css({left:2*("left"==a?1:-1)*i.gwidth});e.show();i.sets.eq(i.current).hide();var f=e.children(),g=0;f.each(function(e){"right"==a&&(e=f.length-1-e);(function(b,c){setTimeout(function(){f.eq(b).show().animate({left:f.eq(b).data("left")},{complete:function(){if("left"==a&&b==f.length-1||"right"==a&&0==b)i.busy=!1,i.current=c},duration:i.options.duration,easing:i.options.easing})},100*g)})(e,c);g+=1})}})},
zoom:function(c){var a=this.sets.eq(c),e=0,i=this.sets.eq(this.current).children(),f=this;this.busy=!0;this.sets.eq(this.current).children().animate(jQuery.support.opacity?{transform:"scale(0)",opacity:0}:{opacity:0},{complete:function(){e+=1;if(!(-1!=e&&e<i.length-1)){e=-1;var g=a.children().css(jQuery.support.opacity?{transform:"scale(0)",opacity:0}:{opacity:0}),j=0;f.sets.eq(f.current).hide();a.show();g.each(function(b){g.eq(b).css({left:g.eq(b).data("left")}).show();(function(b,d){setTimeout(function(){g.eq(b).show().animate(jQuery.support.opacity?
{transform:"scale(1)",opacity:1}:{opacity:1},{complete:function(){b==g.length-1&&(f.busy=!1,f.current=d)},duration:f.options.duration,easing:f.options.easing})},Math.round(f.options.duration/3)*j)})(b,c);j+=1})}},easing:"swing",duration:Math.round(f.options.duration/2)})},deck:function(c){if(!jQuery.support.opacity)return this.zoom(c);var a=c>this.current?"left":"right",e=this.sets.eq(c),i=this.sets.eq(this.current).children(),f=this.sets.eq(c).children();i[c>this.current?"first":"last"]();f[c>this.current?
"last":"first"]();var g=this;"right"==a&&i._reverse();"right"==a&&f._reverse();this.busy=!0;i.each(function(a){var b=j(this);(function(b,d){setTimeout(function(){d.animate({transform:"scale(0)",opacity:0},{complete:function(){d.hide();b==i.length-1&&(g.sets.eq(g.current).hide(),f.css({transform:"scale(0)",opacity:0}),e.show(),f.each(function(b){var d=j(this);(function(b,d){setTimeout(function(){d.animate({transform:"scale(1)",opacity:1},{complete:function(){b==f.length-1&&(i.show().each(function(b){i.eq(b).css({transform:"scale(1)",
opacity:1,left:i.eq(b).data("left")})}),g.busy=!1,g.current=c)},duration:g.options.duration,easing:g.options.easing})},Math.round(g.options.duration/3)*b)})(b,d)}))},duration:g.options.duration,easing:g.options.easing})},Math.round(g.options.duration/3)*b)})(a,b)})},drops:function(c){if(!jQuery.support.opacity)return this.zoom(c);var a=c>this.current?"left":"right",e=this.sets.eq(c),i=this.sets.eq(this.current).children().css($widgetkit.css3({transition:""})).css($widgetkit.css3({transform:"rotate(0deg)",
top:0,opacity:1})),f=this.sets.eq(c).children().css($widgetkit.css3({transition:""}));i[c>this.current?"first":"last"]();f[c>this.current?"last":"first"]();var g=this;"right"==a&&i._reverse();"right"==a&&f._reverse();this.busy=!0;i.each(function(a){var b=j(this);(function(b,d){setTimeout(function(){if(x.transition){d.css($widgetkit.css3({transition:"all "+g.options.duration+"ms ease-out"}));if(b==i.length-1)d.one("webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd",function(){g.sets.eq(g.current).hide();
f.css($widgetkit.css3({top:g.gheight,opacity:0,transform:"rotate(15deg)"}));e.show();f.each(function(b){var d=j(this);(function(b,d){setTimeout(function(){d.css($widgetkit.css3({transition:"all "+g.options.duration+"ms ease-in"}));if(b==f.length-1)d.one("webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd",function(){g.busy=!1;g.current=c});d.css($widgetkit.css3({opacity:1,top:0,transform:"rotate(0deg)"}))},Math.round(g.options.duration/3)*b)})(b,d)})});d.css($widgetkit.css3({opacity:0,
top:g.gheight,transform:"rotate(15deg)"}))}else d.animate({opacity:0,top:g.gheight},{complete:function(){d.hide();b==i.length-1&&(g.sets.eq(g.current).hide(),f.css({top:g.gheight,opacity:0}),e.css("margin-left","").show(),f.each(function(b){var d=j(this);(function(b,d){setTimeout(function(){d.animate({opacity:1,top:0},{complete:function(){b==f.length-1&&(i.show().each(function(b){i.eq(b).css({opacity:1,top:0})}),g.busy=!1,g.current=c)},duration:g.options.duration,easing:g.options.easing})},Math.round(g.options.duration/
3)*b)})(b,d)}))},duration:g.options.duration,easing:g.options.easing})},20+Math.round(g.options.duration/3)*b)})(a,b)})}});j.fn._reverse||(j.fn._reverse=[].reverse);j.fn[l.prototype.name]=function(){var c=arguments,a=c[0]?c[0]:null;return this.each(function(){var e=j(this);if(l.prototype[a]&&e.data(l.prototype.name)&&a!="initialize")e.data(l.prototype.name)[a].apply(e.data(l.prototype.name),Array.prototype.slice.call(c,1));else if(!a||j.isPlainObject(a)){var i=new l;i.element=e;y.push(i);l.prototype.initialize&&
i.initialize.apply(i,c);e.data(l.prototype.name,i)}else j.error("Method "+a+" does not exist on jQuery."+l.prototype.name)})}})(jQuery);
(function(j){function x(b){for(var b=b.split(")"),c=j.trim,d=b.length-1,u,e,h,a=1,f=0,g=0,i=1,o,r,m,s=0,n=0;d--;){u=b[d].split("(");e=c(u[0]);h=u[1];o=u=r=m=0;switch(e){case "translateX":s+=parseInt(h,10);continue;case "translateY":n+=parseInt(h,10);continue;case "translate":h=h.split(",");s+=parseInt(h[0],10);n+=parseInt(h[1]||0,10);continue;case "rotate":h=l(h);o=Math.cos(h);u=Math.sin(h);r=-Math.sin(h);m=Math.cos(h);break;case "scaleX":o=h;m=1;break;case "scaleY":o=1;m=h;break;case "scale":h=h.split(",");
o=h[0];m=1<h.length?h[1]:h[0];break;case "skewX":o=m=1;r=Math.tan(l(h));break;case "skewY":o=m=1;u=Math.tan(l(h));break;case "skew":o=m=1;h=h.split(",");r=Math.tan(l(h[0]));u=Math.tan(l(h[1]||0));break;case "matrix":h=h.split(","),o=+h[0],u=+h[1],r=+h[2],m=+h[3],s+=parseInt(h[4],10),n+=parseInt(h[5],10)}e=a*o+f*r;f=a*u+f*m;o=g*o+i*r;i=g*u+i*m;a=e;g=o}return[a,f,g,i,s,n]}function y(b){var c,d,e,a=b[0],h=b[1],f=b[2],g=b[3];a*g-h*f?(c=Math.sqrt(a*a+h*h),a/=c,h/=c,e=a*f+h*g,f-=a*e,g-=h*e,d=Math.sqrt(f*
f+g*g),e/=d,a*(g/d)<h*(f/d)&&(a=-a,h=-h,e=-e,c=-c)):rotate=c=d=e=0;return{translate:[+b[4],+b[5]],rotate:Math.atan2(h,a),scale:[c,d],skew:[e,0]}}function l(b){return~b.indexOf("deg")?parseInt(b,10)*(2*Math.PI/360):~b.indexOf("grad")?parseInt(b,10)*(Math.PI/200):parseFloat(b)}for(var p=document.createElement("div"),p=p.style,c=["OTransform","msTransform","WebkitTransform","MozTransform","transform"],a=c.length,e,i,f,g,w=/Matrix([^)]*)/;a--;)c[a]in p&&(j.support.transform=e=c[a]);e||(j.support.matrixFilter=
i=""===p.filter);p=p=null;j.cssNumber.transform=!0;e&&"transform"!=e?(j.cssProps.transform=e,"MozTransform"==e?f={get:function(b,c){return c?j.css(b,e).split("px").join(""):b.style[e]},set:function(b,c){b.style[e]=/matrix[^)p]*\)/.test(c)?c.replace(/matrix((?:[^,]*,){4})([^,]*),([^)]*)/,"matrix$1$2px,$3px"):c}}:/^1\.[0-5](?:\.|$)/.test(j.fn.jquery)&&(f={get:function(b,c){return c?j.css(b,e.replace(/^ms/,"Ms")):b.style[e]}})):i&&(f={get:function(b,c){var d=c&&b.currentStyle?b.currentStyle:b.style,
a;if(d&&w.test(d.filter)){a=RegExp.$1.split(",");a=[a[0].split("=")[1],a[2].split("=")[1],a[1].split("=")[1],a[3].split("=")[1]]}else a=[1,0,0,1];a[4]=d?d.left:0;a[5]=d?d.top:0;return"matrix("+a+")"},set:function(b,c,d){var a=b.style,e,f,g;if(!d)a.zoom=1;c=x(c);if(!d||d.M){f=["Matrix(M11="+c[0],"M12="+c[2],"M21="+c[1],"M22="+c[3],"SizingMethod='auto expand'"].join();g=(e=b.currentStyle)&&e.filter||a.filter||"";a.filter=w.test(g)?g.replace(w,f):g+" progid:DXImageTransform.Microsoft."+f+")";if(centerOrigin=
j.transform.centerOrigin){a[centerOrigin=="margin"?"marginLeft":"left"]=-(b.offsetWidth/2)+b.clientWidth/2+"px";a[centerOrigin=="margin"?"marginTop":"top"]=-(b.offsetHeight/2)+b.clientHeight/2+"px"}}if(!d||d.T){a.left=c[4]+"px";a.top=c[5]+"px"}}});f&&(j.cssHooks.transform=f);g=f&&f.get||j.css;j.fx.step.transform=function(b){var c=b.elem,d=b.start,a=b.end,q,h=b.pos,p,z,A,B,o=false,r=false,m;p=z=A=B="";if(!d||typeof d==="string"){d||(d=g(c,e));if(i)c.style.zoom=1;q=a.split(d);if(q.length==2){a=q.join("");
b.origin=d;d="none"}if(d=="none")d={translate:[0,0],rotate:0,scale:[1,1],skew:[0,0]};else{d=/\(([^,]*),([^,]*),([^,]*),([^,]*),([^,p]*)(?:px)?,([^)p]*)(?:px)?/.exec(d);d=y([d[1],d[2],d[3],d[4],d[5],d[6]])}b.start=d;if(~a.indexOf("matrix"))a=y(x(a));else{a=a.split(")");q=[0,0];for(var s=0,n=[1,1],v=[0,0],w=a.length-1,C=j.trim,k,t;w--;){k=a[w].split("(");t=C(k[0]);k=k[1];if(t=="translateX")q[0]=q[0]+parseInt(k,10);else if(t=="translateY")q[1]=q[1]+parseInt(k,10);else if(t=="translate"){k=k.split(",");
q[0]=q[0]+parseInt(k[0],10);q[1]=q[1]+parseInt(k[1]||0,10)}else if(t=="rotate")s=s+l(k);else if(t=="scaleX")n[0]=n[0]*k;else if(t=="scaleY")n[1]=n[1]*k;else if(t=="scale"){k=k.split(",");n[0]=n[0]*k[0];n[1]=n[1]*(k.length>1?k[1]:k[0])}else if(t=="skewX")v[0]=v[0]+l(k);else if(t=="skewY")v[1]=v[1]+l(k);else if(t=="skew"){k=k.split(",");v[0]=v[0]+l(k[0]);v[1]=v[1]+l(k[1]||"0")}}a={translate:q,rotate:s,scale:n,skew:v}}b.end=a;for(m in d)(m=="rotate"?d[m]==a[m]:d[m][0]==a[m][0]&&d[m][1]==a[m][1])&&delete d[m]}if(d.translate){p=
" translate("+(d.translate[0]+(a.translate[0]-d.translate[0])*h+0.5|0)+"px,"+(d.translate[1]+(a.translate[1]-d.translate[1])*h+0.5|0)+"px)";o=true}if(d.rotate!=void 0){z=" rotate("+(d.rotate+(a.rotate-d.rotate)*h)+"rad)";r=true}if(d.scale){A=" scale("+(d.scale[0]+(a.scale[0]-d.scale[0])*h)+","+(d.scale[1]+(a.scale[1]-d.scale[1])*h)+")";r=true}if(d.skew){B=" skew("+(d.skew[0]+(a.skew[0]-d.skew[0])*h)+"rad,"+(d.skew[1]+(a.skew[1]-d.skew[1])*h)+"rad)";r=true}b=b.origin?b.origin+p+B+A+z:p+z+A+B;f&&f.set?
f.set(c,b,{M:r,T:o}):c.style[e]=b};j.transform={centerOrigin:"margin"}})(jQuery);
