jQuery.fn.crossSlide=function(A,C){var F=this,B=this.width(),E=this.height();function G(H){for(var I=1;I<arguments.length;I++){H=H.replace(new RegExp("\\{"+(I-1)+"}","g"),arguments[I])}return H}function D(){arguments[0]="crossSlide: "+arguments[0];throw G.apply(null,arguments)}(function(H){var J=0;function I(L,K){K.onload=function(M){J++;C[L].width=K.width;C[L].height=K.height;if(J==C.length){H()}};K.src=C[L].src;if(L+1<C.length){I(L+1,new Image())}}I(0,new Image())})(function(){function U(X){var W=1;var Z=X.replace(/^\s*|\s*$/g,"").split(/\s+/);if(Z.length>3){throw new Error()}if(Z[0]=="center"){if(Z.length==1){Z=["center","center"]}else{if(Z.length==2&&Z[1].match(/^[\d.]+x$/i)){Z=["center","center",Z[1]]}}}if(Z.length==3){W=parseFloat(Z[2].match(/^([\d.]+)x$/i)[1])}var Y=Z[0]+" "+Z[1];if(Y=="left top"||Y=="top left"){return{xrel:0,yrel:0,zoom:W}}if(Y=="left center"||Y=="center left"){return{xrel:0,yrel:0.5,zoom:W}}if(Y=="left bottom"||Y=="bottom left"){return{xrel:0,yrel:1,zoom:W}}if(Y=="center top"||Y=="top center"){return{xrel:0.5,yrel:0,zoom:W}}if(Y=="center center"){return{xrel:0.5,yrel:0.5,zoom:W}}if(Y=="center bottom"||Y=="bottom center"){return{xrel:0.5,yrel:1,zoom:W}}if(Y=="right top"||Y=="top right"){return{xrel:1,yrel:0,zoom:W}}if(Y=="right center"||Y=="center right"){return{xrel:1,yrel:0.5,zoom:W}}if(Y=="right bottom"||Y=="bottom right"){return{xrel:1,yrel:1,zoom:W}}return{xrel:parseInt(Z[0].match(/^(\d+)%$/)[1])/100,yrel:parseInt(Z[1].match(/^(\d+)%$/)[1])/100,zoom:W}}function O(Y,X){switch(X){case 1:var W=0;break;case 2:var W=Q/(Y.time_ms+2*Q);break;case 3:var W=1-Q/(Y.time_ms+2*Q);break;case 4:var W=1;break}return{left:Math.round(Y.from.left+W*(Y.to.left-Y.from.left)),top:Math.round(Y.from.top+W*(Y.to.top-Y.from.top)),width:Math.round(Y.from.width+W*(Y.to.width-Y.from.width)),height:Math.round(Y.from.height+W*(Y.to.height-Y.from.height))}}if(!A.fade){D("missing fade parameter.")}if(A.speed&&A.sleep){D("you cannot set both speed and sleep at the same time.")}var Q=Math.round(A.fade*1000);if(A.sleep){var S=Math.round(A.sleep*1000)}if(A.speed){var K=A.speed/1000,I=Math.round(Q*K)}F.empty().css({overflow:"hidden",padding:0});if(!F.css("position").match(/absolute|relative|fixed/)){F.css({position:"relative"})}if(!F.width()||!F.height()){D("container element does not have its own width and height")}if(A.shuffle){C.sort(function(){return Math.random()-0.5})}for(var H=0;H<C.length;++H){var P=C[H];if(!P.src){D("missing src parameter in picture {0}.",H+1)}if(K){switch(P.dir){case"up":P.from={xrel:0.5,yrel:0,zoom:1};P.to={xrel:0.5,yrel:1,zoom:1};var J=P.height-E-2*I;break;case"down":P.from={xrel:0.5,yrel:1,zoom:1};P.to={xrel:0.5,yrel:0,zoom:1};var J=P.height-E-2*I;break;case"left":P.from={xrel:0,yrel:0.5,zoom:1};P.to={xrel:1,yrel:0.5,zoom:1};var J=P.width-B-2*I;break;case"right":P.from={xrel:1,yrel:0.5,zoom:1};P.to={xrel:0,yrel:0.5,zoom:1};var J=P.width-B-2*I;break;default:D('missing or malformed "dir" parameter in picture {0}.',H+1)}if(J<=0){D("picture number {0} is too short for the desired fade duration.",H+1)}P.time_ms=Math.round(J/K)}else{if(!S){if(!P.from||!P.to||!P.time){D("missing either speed/sleep option, or from/to/time params in picture {0}.",H+1)}try{P.from=U(P.from)}catch(N){D('malformed "from" parameter in picture {0}.',H+1)}try{P.to=U(P.to)}catch(N){D('malformed "to" parameter in picture {0}.',H+1)}if(!P.time){D('missing "time" parameter in picture {0}.',H+1)}P.time_ms=Math.round(P.time*1000)}}if(P.from){jQuery.each([P.from,P.to],function(X,W){W.width=Math.round(P.width*W.zoom);W.height=Math.round(P.height*W.zoom);W.left=Math.round((B-W.width)*W.xrel);W.top=Math.round((E-W.height)*W.yrel)})}var T;if(P.href){T=jQuery(G('<a href="{0}"><img src="{1}"/></a>',P.href,P.src))}else{T=jQuery(G('<img src="{0}"/>',P.src))}if(P.onclick){T.click(P.onclick)}if(P.alt){T.find("img").attr("alt",P.alt)}T.appendTo(F)}K=undefined;var R=F.find("img").css({position:"absolute",visibility:"hidden",top:0,left:0,border:0,zIndex:1});R.eq(0).css({visibility:"visible"});if(!S){R.eq(0).css(O(C[0],2))}var M=A.loop;function L(d,k){if(d%2==0){if(S){var n=d/2,h=(n-1+C.length)%C.length,f=R.eq(n),j=R.eq(h);var c=function(){j.css("visibility","hidden");setTimeout(k,S)}}else{var e=d/2,h=(e-1+C.length)%C.length,m=R.eq(e),j=R.eq(h),X=C[e].time_ms,Z=O(C[e],3);var c=function(){j.css("visibility","hidden");m.animate(Z,X,"linear",k)}}}else{if(S){var l=Math.floor(d/2),Y=Math.ceil(d/2)%C.length,a=R.eq(l),W=R.eq(Y),o={},p={visibility:"visible"},g={};if(Y>l){p.opacity=0;g.opacity=1}else{o.opacity=0}var c=function(){W.css(p);if(o.opacity!=undefined){a.animate(o,Q,"linear",k)}else{W.animate(g,Q,"linear",k)}}}else{var l=Math.floor(d/2),Y=Math.ceil(d/2)%C.length,a=R.eq(l),W=R.eq(Y),o=O(C[l],4),p=O(C[Y],1),g=O(C[Y],2);if(Y>l){p.opacity=0;g.opacity=1}else{o.opacity=0}p.visibility="visible";var c=function(){a.animate(o,Q,"linear");W.css(p);W.animate(g,Q,"linear",k)}}}if(A.loop&&d==C.length*2-2){var b=c;c=function(){if(--M){b()}}}if(d>0){return L(d-1,c)}else{return c}}var V=L(C.length*2-1,function(){return V()});V()});return F};