jQuery.fn.crossSlide=function(_1,_2){
var _3=this,_4=this.width(),_5=this.height();
function _6(_7){
for(var i=1;i<arguments.length;i++){
_7=_7.replace(new RegExp("\\{"+(i-1)+"}","g"),arguments[i]);
}
return _7;
};
function _9(){
arguments[0]="crossSlide: "+arguments[0];
throw _6.apply(null,arguments);
};
(function(_a){
var _b=0;
function _c(i,_e){
_e.onload=function(e){
_b++;
_2[i].width=_e.width;
_2[i].height=_e.height;
if(_b==_2.length){
_a();
}
};
_e.src=_2[i].src;
if(i+1<_2.length){
_c(i+1,new Image());
}
};
_c(0,new Image());
})(function(){
function _10(_11){
var _12=1;
var _13=_11.replace(/^\s*|\s*$/g,"").split(/\s+/);
if(_13.length>3){
throw new Error();
}
if(_13[0]=="center"){
if(_13.length==1){
_13=["center","center"];
}else{
if(_13.length==2&&_13[1].match(/^[\d.]+x$/i)){
_13=["center","center",_13[1]];
}
}
}
if(_13.length==3){
_12=parseFloat(_13[2].match(/^([\d.]+)x$/i)[1]);
}
var pos=_13[0]+" "+_13[1];
if(pos=="left top"||pos=="top left"){
return {xrel:0,yrel:0,zoom:_12};
}
if(pos=="left center"||pos=="center left"){
return {xrel:0,yrel:0.5,zoom:_12};
}
if(pos=="left bottom"||pos=="bottom left"){
return {xrel:0,yrel:1,zoom:_12};
}
if(pos=="center top"||pos=="top center"){
return {xrel:0.5,yrel:0,zoom:_12};
}
if(pos=="center center"){
return {xrel:0.5,yrel:0.5,zoom:_12};
}
if(pos=="center bottom"||pos=="bottom center"){
return {xrel:0.5,yrel:1,zoom:_12};
}
if(pos=="right top"||pos=="top right"){
return {xrel:1,yrel:0,zoom:_12};
}
if(pos=="right center"||pos=="center right"){
return {xrel:1,yrel:0.5,zoom:_12};
}
if(pos=="right bottom"||pos=="bottom right"){
return {xrel:1,yrel:1,zoom:_12};
}
return {xrel:parseInt(_13[0].match(/^(\d+)%$/)[1])/100,yrel:parseInt(_13[1].match(/^(\d+)%$/)[1])/100,zoom:_12};
};
function _15(p,_17){
switch(_17){
case 1:
var pos=0;
break;
case 2:
var pos=_19/(p.time_ms+2*_19);
break;
case 3:
var pos=1-_19/(p.time_ms+2*_19);
break;
case 4:
var pos=1;
break;
}
return {left:Math.round(p.from.left+pos*(p.to.left-p.from.left)),top:Math.round(p.from.top+pos*(p.to.top-p.from.top)),width:Math.round(p.from.width+pos*(p.to.width-p.from.width)),height:Math.round(p.from.height+pos*(p.to.height-p.from.height))};
};
if(!_1.fade){
_9("missing fade parameter.");
}
if(_1.speed&&_1.sleep){
_9("you cannot set both speed and sleep at the same time.");
}
var _19=Math.round(_1.fade*1000);
if(_1.sleep){
var _1a=Math.round(_1.sleep*1000);
}
if(_1.speed){
var _1b=_1.speed/1000,_1c=Math.round(_19*_1b);
}
_3.empty().css({overflow:"hidden",padding:0});
if(!_3.css("position").match(/absolute|relative|fixed/)){
_3.css({position:"relative"});
}
if(!_3.width()||!_3.height()){
_9("container element does not have its own width and height");
}
for(var i=0;i<_2.length;++i){
var p=_2[i];
if(!p.src){
_9("missing src parameter in picture {0}.",i+1);
}
if(_1b){
switch(p.dir){
case "up":
p.from={xrel:0.5,yrel:0,zoom:1};
p.to={xrel:0.5,yrel:1,zoom:1};
var _1f=p.height-_5-2*_1c;
break;
case "down":
p.from={xrel:0.5,yrel:1,zoom:1};
p.to={xrel:0.5,yrel:0,zoom:1};
var _1f=p.height-_5-2*_1c;
break;
case "left":
p.from={xrel:0,yrel:0.5,zoom:1};
p.to={xrel:1,yrel:0.5,zoom:1};
var _1f=p.width-_4-2*_1c;
break;
case "right":
p.from={xrel:1,yrel:0.5,zoom:1};
p.to={xrel:0,yrel:0.5,zoom:1};
var _1f=p.width-_4-2*_1c;
break;
default:
_9("missing or malformed \"dir\" parameter in picture {0}.",i+1);
}
if(_1f<=0){
_9("picture number {0} is too short for the desired fade duration.",i+1);
}
p.time_ms=Math.round(_1f/_1b);
}else{
if(!_1a){
if(!p.from||!p.to||!p.time){
_9("missing either speed/sleep option, or from/to/time params in picture {0}.",i+1);
}
try{
p.from=_10(p.from);
}
catch(e){
_9("malformed \"from\" parameter in picture {0}.",i+1);
}
try{
p.to=_10(p.to);
}
catch(e){
_9("malformed \"to\" parameter in picture {0}.",i+1);
}
if(!p.time){
_9("missing \"time\" parameter in picture {0}.",i+1);
}
p.time_ms=Math.round(p.time*1000);
}
}
if(p.from){
jQuery.each([p.from,p.to],function(i,_21){
_21.width=Math.round(p.width*_21.zoom);
_21.height=Math.round(p.height*_21.zoom);
_21.left=Math.round((_4-_21.width)*_21.xrel);
_21.top=Math.round((_5-_21.height)*_21.yrel);
});
}
var elm;
if(p.href){
elm=jQuery(_6("<a href=\"{0}\"><img src=\"{1}\"/></a>",p.href,p.src));
}else{
elm=jQuery(_6("<img src=\"{0}\"/>",p.src));
}
if(p.onclick){
elm.click(p.onclick);
}
elm.css({position:"absolute",visibility:"hidden",top:0,left:0}).find("img").css({border:0});
elm.appendTo(_3);
}
_1b=undefined;
var _23=_3.children();
_23.eq(0).css({visibility:"visible"});
if(!_1a){
_23.eq(0).css(_15(_2[0],2));
}
var _24=_1.loop;
function _25(i,_27){
if(i%2==0){
if(_1a){
var _28=i/2,_29=(_28-1+_2.length)%_2.length,_2a=_23.eq(_28),_2b=_23.eq(_29);
var _2c=function(){
_2b.css("visibility","hidden");
setTimeout(_27,_1a);
};
}else{
var _2d=i/2,_29=(_2d-1+_2.length)%_2.length,_2e=_23.eq(_2d),_2b=_23.eq(_29),_2f=_2[_2d].time_ms,_30=_15(_2[_2d],3);
var _2c=function(){
_2b.css("visibility","hidden");
_2e.animate(_30,_2f,"linear",_27);
};
}
}else{
if(_1a){
var _31=Math.floor(i/2),_32=Math.ceil(i/2)%_2.length,_33=_23.eq(_31),_34=_23.eq(_32),_35={},_36={visibility:"visible"},_37={};
if(_32>_31){
_36.opacity=0;
_37.opacity=1;
}else{
_35.opacity=0;
}
var _2c=function(){
_34.css(_36);
if(_35.opacity!=undefined){
_33.animate(_35,_19,"linear",_27);
}else{
_34.animate(_37,_19,"linear",_27);
}
};
}else{
var _31=Math.floor(i/2),_32=Math.ceil(i/2)%_2.length,_33=_23.eq(_31),_34=_23.eq(_32),_35=_15(_2[_31],4),_36=_15(_2[_32],1),_37=_15(_2[_32],2);
if(_32>_31){
_36.opacity=0;
_37.opacity=1;
}else{
_35.opacity=0;
}
_36.visibility="visible";
var _2c=function(){
_33.animate(_35,_19,"linear");
_34.css(_36);
_34.animate(_37,_19,"linear",_27);
};
}
}
if(_1.loop&&i==_2.length*2-2){
var _38=_2c;
_2c=function(){
if(--_24){
_38();
}
};
}
if(i>0){
return _25(i-1,_2c);
}else{
return _2c;
}
};
var _39=_25(_2.length*2-1,function(){
return _39();
});
_39();
});
return _3;
};


