// ws_book
function ws_book(e,a,g){function m(a,b,d,c,p,h,g,m,y,E,q,B){if(x)a||(b*=-1,q=c,c=d,d=q,q=h,h=p,p=q),setTimeout(function(){d.children("img").css("opacity",r).animate({opacity:1},f/2);p.css("transform","rotateY("+b+"deg)").children("img").css("opacity",1).animate({opacity:r},f/2,function(){p.hide();h.show().css("transform","rotateX(0deg) rotateY(0deg)").children("img").css("opacity",r).animate({opacity:1},f/2);c.children("img").css("opacity",1).animate({opacity:r},f/2)})},0),setTimeout(B,f);else if(u){g.show();
var t=!0;wowAnimate(function(b){var k=jQuery.easing.easeInOutQuint(1,b,0,1,1),f=jQuery.easing.easeInOutCubic(1,b,0,1,1),q=!a;if(.5>b)var k=2*k,f=2*f,x=p;else q=a,k=2*(1-k),f=2*(1-f),x=h;b=g.height()*D/2;var k=(1-k)*g.width()/2,w=1+f*D,z=g.width()/2,l=d,u=q,B=f*r,C=g.height();numSlices=k/2;widthScale=k/z;heightScale=(1-w)/numSlices;l.clearRect(0,0,m.width(),m.height());for(w=0;w<numSlices+widthScale;w++){var v=u?w*e.width/k+e.width/2:(numSlices-w)*e.width/k,A=z+(u?2:-2)*w,G=b+C*heightScale*w/2;0>v&&
(v=0);0>A&&(A=0);0>G&&(G=0);l.drawImage(x,v,0,2.5,e.height,A,G,2,C*(1-heightScale*w))}l.save();l.beginPath();l.moveTo(z,b);l.lineTo(z+(u?2:-2)*(numSlices+widthScale),b+C*heightScale*(numSlices+widthScale)/2);l.lineTo(z+(u?2:-2)*(numSlices+widthScale),C*(1-heightScale*(numSlices+widthScale))+b+C*heightScale*(numSlices+widthScale)/2);l.lineTo(z,b+C);l.closePath();l.clip();l.fillStyle="rgba(0,0,0,"+Math.round(100*B)/100+")";l.fillRect(0,0,m.width(),m.height());l.restore();t&&(E.show(),t=!1);c.clearRect(0,
0,y.width(),y.height());c.fillStyle="rgba(0,0,0,"+(r-f*r)+")";c.fillRect(q?z:0,0,y.width()/2,y.height())},0,1,f,B)}}var c=jQuery,J=c(this),K=c(".ws_list",g),L=c("<div>").addClass("ws_effect ws_book").css({position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo(g),f=e.duration,D=e.perspective||.4,r=e.shadow||.35,u=e.noCanvas||!1,x=e.no3d||!1,v={domPrefixes:" Webkit Moz ms O Khtml".split(" "),testDom:function(a){for(var b=this.domPrefixes.length;b--;)if("undefined"!==typeof document.body.style[this.domPrefixes[b]+
a])return!0;return!1},cssTransitions:function(){return this.testDom("Transition")},cssTransforms3d:function(){var a="undefined"!==typeof document.body.style.perspectiveProperty||this.testDom("Perspective");if(a&&/AppleWebKit/.test(navigator.userAgent)){var b=document.createElement("div"),c=document.createElement("style"),a="Test3d"+Math.round(99999*Math.random());c.textContent="@media (-webkit-transform-3d){#"+a+"{height:3px}}";document.getElementsByTagName("head")[0].appendChild(c);b.id=a;document.body.appendChild(b);
a=3===b.offsetHeight;c.parentNode.removeChild(c);b.parentNode.removeChild(b)}return a},canvas:function(){if("undefined"!==typeof document.createElement("canvas").getContext)return!0}};x||(x=v.cssTransitions()&&v.cssTransforms3d());u||(u=v.canvas());var A;this.go=function(n,b,d){if(A)return-1;var e=a.get(n),p=a.get(b);d=void 0==d?0==b&&n!=b+1||n==b-1:!d;var h=c("<div>").appendTo(L);b=c(e);b={width:b.width(),height:b.height(),marginLeft:parseFloat(b.css("marginLeft")),marginTop:parseFloat(b.css("marginTop"))};
if(x){n={background:"#000",position:"absolute",left:0,top:0,width:"100%",height:"100%",transformStyle:"preserve-3d",zIndex:3,outline:"1px solid transparent"};perspect=g.width()*(3-2*D);h.css(n).css({perspective:perspect,transform:"translate3d(0,0,0)"});var r=90,v=c("<div>").css(n).css({position:"relative","float":"left",width:"50%",overflow:"hidden"}).append(c("<img>").attr("src",(d?e:p).src).css(b)).appendTo(h),y=c("<div>").css(n).css({position:"relative","float":"left",width:"50%",overflow:"hidden"}).append(c("<img>").attr("src",
(d?p:e).src).css(b).css({marginLeft:-b.width/2})).appendTo(h),E=c("<div>").css(n).css({display:d?"block":"none",width:"50%",transform:"rotateY("+(d?.1:r)+"deg)",transition:(d?"ease-in ":"ease-out ")+f/2E3+"s",transformOrigin:"right",overflow:"hidden"}).append(c("<img>").attr("src",(d?p:e).src).css(b)).appendTo(h),q=c("<div>").css(n).css({display:d?"none":"block",left:"50%",width:"50%",transform:"rotateY(-"+(d?r:.1)+"deg)",transition:(d?"ease-out ":"ease-in ")+f/2E3+"s",transformOrigin:"left",overflow:"hidden"}).append(c("<img>").attr("src",
(d?e:p).src).css(b).css({marginLeft:-b.width/2})).appendTo(h)}else if(u)var B=c("<div>").css({position:"absolute",top:0,left:d?0:"50%",width:"50%",height:"100%",overflow:"hidden",zIndex:6}).append(c(a.get(n)).clone().css({position:"absolute",height:"100%",right:d?"auto":0,left:d?0:"auto"})).appendTo(h).hide(),t=c("<div>").css({position:"absolute",width:"100%",height:"100%",left:0,top:0,zIndex:8}).appendTo(h).hide(),F=c("<canvas>").css({position:"absolute",zIndex:2,left:0,top:-t.height()*D/2}).attr({width:t.width(),
height:t.height()*(D+1)}).appendTo(t),k=F.clone().css({top:0,zIndex:1}).attr({width:t.width(),height:t.height()}).appendTo(t),H=F.get(0).getContext("2d"),I=k.get(0).getContext("2d");else K.stop(!0).animate({left:n?-n+"00%":/Safari/.test(navigator.userAgent)?"0%":0},f,"easeInOutExpo");!x&&u&&(v=H,y=I,E=p,q=e);A=new m(d,r,v,y,E,q,t,F,k,B,b,function(){J.trigger("effectEnd");h.remove();A=0})}}
jQuery.extend(jQuery.easing,{easeInOutCubic:function(e,a,g,m,c){return 1>(a/=c/2)?m/2*a*a*a+g:m/2*((a-=2)*a*a+2)+g},easeInOutQuint:function(e,a,g,m,c){return 1>(a/=c/2)?m/2*a*a*a*a*a+g:m/2*((a-=2)*a*a*a*a+2)+g}});
