jQuery.fn.crossSlide=function(C,F){var A=this,E=this.width(),B=this.height();function D(I){var H;for(H=1;H3){throw new Error()}if(V[0]=="center"){if(V.length==1){V=["center","center"]}else{if(V.length==2&&V[1].match(/^[\d.]+x$/i)){V=["center","center",V[1]]}}}if(V.length==3){U=parseFloat(V[2].match(/^([\d.]+)x$/i)[1])}if(X=="left top"||X=="top left"){return{xrel:0,yrel:0,zoom:U}}if(X=="left center"||X=="center left"){return{xrel:0,yrel:0.5,zoom:U}}if(X=="left bottom"||X=="bottom left"){return{xrel:0,yrel:1,zoom:U}}if(X=="center top"||X=="top center"){return{xrel:0.5,yrel:0,zoom:U}}if(X=="center center"){return{xrel:0.5,yrel:0.5,zoom:U}}if(X=="center bottom"||X=="bottom center"){return{xrel:0.5,yrel:1,zoom:U}}if(X=="right top"||X=="top right"){return{xrel:1,yrel:0,zoom:U}}if(X=="right center"||X=="center right"){return{xrel:1,yrel:0.5,zoom:U}}if(X=="right bottom"||X=="bottom right"){return{xrel:1,yrel:1,zoom:U}}return{xrel:parseInt(V[0].match(/^(\d+)%$/)[1])/100,yrel:parseInt(V[1].match(/^(\d+)%$/)[1])/100,zoom:U}}function J(V,U){var W=[];switch(U){case 1:W=0;break;case 2:W=T/(V.time_ms+2*T);break;case 3:W=1-T/(V.time_ms+2*T);break;case 4:W=1;break}return{left:Math.round(V.from.left+W*(V.to.left-V.from.left)),top:Math.round(V.from.top+W*(V.to.top-V.from.top)),width:Math.round(V.from.width+W*(V.to.width-V.from.width)),height:Math.round(V.from.height+W*(V.to.height-V.from.height))}}if(!C.fade){throw"Missing fade parameter."}if(C.speed&&C.sleep){throw"You cannot set both speed and sleep at the same time."}var T=Math.round(C.fade*1000),K=0,S=0,H,N,I,Q,O,M;if(C.sleep){S=Math.round(C.sleep*1000)}if(C.speed){K=C.speed/1000,fade_px=Math.round(T*K)}if(C.debug){H=jQuery("

")}A.empty().css({overflow:"hidden",padding:0});if(!A.css("position").match(/absolute|relative|fixed/)){A.css({position:"relative"})}for(N in F){I=F[N];if(!I.src){throw D("Missing src parameter in picture {0}.",N+1)}if(K){switch(I.dir){case"up":I.from={xrel:0.5,yrel:0,zoom:1};I.to={xrel:0.5,yrel:1,zoom:1};Q=I.height-B-2*fade_px;break;case"down":I.from={xrel:0.5,yrel:1,zoom:1};I.to={xrel:0.5,yrel:0,zoom:1};Q=I.height-B-2*fade_px;break;case"left":I.from={xrel:0,yrel:0.5,zoom:1};I.to={xrel:1,yrel:0.5,zoom:1};Q=I.width-E-2*fade_px;break;case"right":I.from={xrel:1,yrel:0.5,zoom:1};I.to={xrel:0,yrel:0.5,zoom:1};Q=I.width-E-2*fade_px;break;default:throw D('Missing or malformed "dir" parameter in picture {0}.',N+1)}if(Q<=0){throw D("Picture number {0} is too short for the desired fade duration.",N+1)}I.time_ms=Math.round(Q/K)}else{if(!S){if(!I.from||!I.to||!I.time){throw D("Missing either speed/sleep option, or from/to/time params in picture {0}.",N+1)}try{I.from=R(I.from)}catch(P){throw D('Malformed "from" parameter in picture {0}.',N+1)}try{I.to=R(I.to)}catch(P){throw D('Malformed "to" parameter in picture {0}.',N+1)}if(!I.time){throw D('Missing "time" parameter in picture {0}.',N+1)}I.time_ms=Math.round(I.time*1000)}}if(I.from){jQuery.each([I.from,I.to],function(V,U){U.width=Math.round(I.width*U.zoom);U.height=Math.round(I.height*U.zoom);U.left=Math.round((E-U.width)*U.xrel);U.top=Math.round((B-U.height)*U.yrel)})}jQuery(D('',I.src)).appendTo(A).css({position:"absolute",visibility:"hidden"})}K=undefined;O=A.children();O.eq(0).css({visibility:"visible"});if(!S){O.eq(0).css(J(F[0],2))}function L(g,U){var X,a,l,h,k,e,Y,f,W,Z,j,V=O.eq(Z),m,c,b,d;if(g%2==0){if(S){X=g/2;l=(X-1+F.length)%F.length;h=O.eq(X);e=O.eq(l);d=function(){e.css("visibility","hidden");setTimeout(U,S)};if(H){H.prepend("
"+D("img[{0}].css(visibility, hidden)\n",l)+D("setTimeout(▼, {0})",S))}}else{a=g/2;l=(a-1+F.length)%F.length;k=O.eq(a);e=O.eq(l);Y=F[a].time_ms;f=J(F[a],3);d=function(){e.css("visibility","hidden");k.animate(f,Y,"linear",U)};if(H){H.prepend("
"+D("img[{0}].css(visibility, hidden)\n",l)+D("img[{0}].animate({1}, {2}, linear, ▼)",a,G(f),Y))}}}else{if(S){W=Math.floor(g/2);Z=Math.ceil(g/2)%F.length;j=O.eq(W);V=O.eq(Z);m={};c={visibility:"visible"};b={};if(Z>W){c.opacity=0;b.opacity=1}else{m.opacity=0}d=function(){V.css(c);if(m.opacity!=undefined){j.animate(m,T,"linear",U)}else{V.animate(b,T,"linear",U)}};if(H){H.prepend("
"+D("img[{0}].css({1})\n",Z,G(c))+(m.opacity!=undefined?D("img[{0}].animate({1}, {2}, linear, ▼)",W,G(m),T):D("img[{0}].animate({1}, {2}, linear, ▼)",Z,G(b),T)))}}else{W=Math.floor(g/2);Z=Math.ceil(g/2)%F.length;j=O.eq(W);V=O.eq(Z);m=J(F[W],4);c=J(F[Z],1);b=J(F[Z],2);if(Z>W){c.opacity=0;b.opacity=1}else{m.opacity=0}c.visibility="visible";d=function(){j.animate(m,T,"linear");V.css(c);V.animate(b,T,"linear",U)};if(H){H.prepend("
"+D("img[{0}].animate({1}, {2}, linear)\n",W,G(m),T)+D("img[{0}].css({1})\n",Z,G(c))+D("img[{0}].animate({1}, {2}, linear, ▼)",Z,G(b),T))}}}if(g>0){return L(g-1,d)}else{return d}}M=L(F.length*2-1,function(){return M()});if(H){jQuery(window.open("","debug","width=600,height=500,menubar=no,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes").document.body).empty().append(H)}M()});return A};