(function($){"";"use strict";var defaults={autoplay:true,speed:5000,text:{play:"",stop:"",previous:"previous",next:"next",loading:"loading"},transition:[1],showcaption:true,iesafe:false,showtooltips:false,carousel:false,swipe:true,carouselvertical:false,animationfinished:null,buildfinished:null,bindsfinished:null,starton:0,thumbopacity:0.4,hoverpause:false,animationspeed:600,fadethumbsin:false,carouseloptions:{},thumbchangeevent:'click.pikachoose',stoponclick:false,hidethumbnails:false};$.fn.pikachoose=function(o){return this.each(function(){$(this).data('pikachoose',new $pc(this,o));});};$.pikachoose=function(e,o){this.options=$.extend({},defaults,o||{});this.list=null;this.image=null;this.anchor=null;this.caption=null;this.imgnav=null;this.imgplay=null;this.imgprev=null;this.imgnext=null;this.textnext=null;this.textprev=null;this.previous=null;this.next=null;this.aniwrap=null;this.anidiv=null;this.aniimg=null;this.thumbs=null;this.transition=null;this.active=null;this.tooltip=null;this.animating=false;this.stillout=null;this.counter=null;this.timeout=null;this.pikastage=null;if(typeof(this.options.data)!="undefined"){e=$("").addclass("jcarousel-skin-pika").appendto(e);$.each(this.options.data,function(){var tmp=null;if(typeof(this.link)!="undefined"){tmp=$("
  • ").appendto(e);if(typeof(this.title)!="undefined"){tmp.find('a').attr('title',this.title);}}else{tmp=$("
  • ").appendto(e);} if(typeof(this.caption)!="undefined"){tmp.append(""+this.caption+"");} if(typeof(this.thumbnail)!="undefined"){tmp.find('img').attr('ref',this.image);tmp.find('img').attr('src',this.thumbnail);}else{tmp.find('img').attr('src',this.image);}});} if(e instanceof jquery||e.nodename.touppercase()=='ul'||e.nodename.touppercase()=='ol'){this.list=$(e);this.build();this.bindevents();}else{return;} var y=0;var x=0;for(var t=0;t<25;t++){var a='
    ';this.anidiv.append(a);y++;if(y==5){x++;y=0;}}};var $pc=$.pikachoose;$pc.fn=$pc.prototype={version:"96"};$.fn.pikachoose=$.fn.pikachoose;$pc.fn.extend=$pc.extend=$.extend;$pc.fn.extend({build:function(){this.step=0;if(this.options.pikastage){this.wrap=this.options.pikastage;this.wrap.addclass('pika-stage');}else{this.wrap=$("
    ").insertbefore(this.list);} this.image=$("").appendto(this.wrap);this.imgnav=$("
    ").insertafter(this.image);this.imgplay=$("").appendto(this.imgnav);this.counter=$("").appendto(this.imgnav);if(this.options.autoplay){this.imgplay.addclass('pause');}else{this.imgplay.addclass('play');} this.imgprev=$("").insertafter(this.imgplay);this.imgnext=$("").insertafter(this.imgprev);this.caption=$("
    ").insertafter(this.imgnav).hide();this.tooltip=$("
    ").insertafter(this.list).hide();this.aniwrap=$("
    ").insertafter(this.caption);this.aniimg=$("").appendto(this.aniwrap).hide();this.anidiv=$("
    ").appendto(this.aniwrap);this.textnav=$("
    ").insertafter(this.aniwrap);this.textprev=$("").appendto(this.textnav);this.textnext=$("").appendto(this.textnav);this.list.addclass('pika-thumbs');this.thumbs=this.list.find('img');this.loader=$("
    ").appendto(this.wrap).hide().html(this.options.text.loading);this.active=this.thumbs.eq(this.options.starton);this.finishanimating({'index':this.options.starton,'source':this.active.attr('ref')||this.active.attr('src'),'caption':this.active.parents('li:first').find('span:first').html(),'clickthrough':this.active.parent().attr('href')||"",'clickthroughtarget':this.active.parent().attr('target')||"",'clickthroughtitle':this.active.parent().attr('title')||""});this.anidiv.css({position:'relative'});var self=this;this.updatethumbs();if(this.options.fadethumbsin){this.list.fadein();} if(this.options.hidethumbnails){this.list.hide();} if(this.options.carousel&&$.fn.jcarousel){var carouseldefaults={vertical:this.options.carouselvertical,initcallback:function(carousel){jquery(carousel.list).find('img').click(function(e,x){if(typeof(x)!=='undefined'&&x.how=="auto"){if(self.options.autoplay===false){return false;}} var clicked=parseint(jquery(this).parents('.jcarousel-item').attr('jcarouselindex'),10);var last=(jquery(this).parents('ul').find('li:last').attr('jcarouselindex')==clicked-1)?true:false;if(!last){clicked=(clicked-2<=0)?0:clicked-2;} clicked++;carousel.scroll(clicked);});}};var carouseloptions=$.extend({},carouseldefaults,this.options.carouseloptions||{});this.list.jcarousel(carouseloptions);} if(this.options.swipe&&$.fn.touchwipe){this.wrap.touchwipe({wipeleft:function(){self.next();},wiperight:function(){self.prev();}});} if(typeof(this.options.buildfinished)=='function'){this.options.buildfinished(this);}},createthumb:function(ele){var self=ele;var that=this;this.thumbs=this.list.find('img');if(typeof $.data(ele[0],'source')!=='undefined'){return;} ele.parents('li:first').wrapinner("
    ");self.hide();$.data(ele[0],'clickthrough',self.parent('a').attr('href')||"");$.data(ele[0],'clickthroughtarget',self.parent('a').attr('target')||"");$.data(ele[0],'clickthroughtitle',self.parent('a').attr('title')||"");if(self.parent('a').length>0){self.unwrap();} $.data(ele[0],'caption',self.next('span').html()||"");self.next('span').remove();$.data(ele[0],'source',self.attr('ref')||self.attr('src'));$.data(ele[0],'imagetitle',self.attr('title')||"");$.data(ele[0],'imagealt',self.attr('alt')||"");$.data(ele[0],'index',this.thumbs.index(ele));$.data(ele[0],'order',self.closest('ul').find('li').index(self.parents('li')));var data=$.data(ele[0]);$('').on('load',{data:data},function(){if(typeof(that.options.buildthumbstart)=='function'){that.options.buildthumbstart(that);} var img=$(this);var w=this.width;var h=this.height;if(w===0){w=img.attr("width");} if(h===0){h=img.attr("height");} var ph=parseint(self.parents('.clip').css('height').slice(0,-2),10);var pw=parseint(self.parents('.clip').css('width').slice(0,-2),10);if(pw===0){pw=self.parents('li:first').outerwidth();} if(ph===0){ph=self.parents('li:first').outerheight();} var rw=pw/w;var rh=ph/h;var ratio;if(rw').on('load',{self:self,data:data},function(){self.loader.fadeout('fast');self.anidiv.css({height:self.image.height(),width:self.image.width()}).show();self.anidiv.children('div').css({'width':'20%','height':'20%','float':'left'});var n=0;if(self.options.transition[0]==-1){n=math.floor(math.random()*7)+1;}else{n=self.options.transition[self.step];self.step++;if(self.step>=self.options.transition.length){self.step=0;}} if(self.options.iesafe&&$.browser.msie){n=1;} self.doanimation(n,data);}).attr('src',$.data(this).source);},doanimation:function(n,data){this.aniwrap.css({position:'absolute',top:this.wrap.css('padding-top'),left:this.wrap.css('padding-left'),width:this.wrap.width()});var self=this;self.image.stop(true,false);self.caption.stop().fadeout();var awidth=self.anidiv.children('div').eq(0).width();var aheight=self.anidiv.children('div').eq(0).height();var img=new image();$(img).attr('src',data.source);if(img.height!=self.image.height()||img.width!=self.image.width()){if(n!==0&&n!==1&&n!==7){}} self.anidiv.css({height:self.image.height(),width:self.image.width()});self.anidiv.children().each(function(){var div=$(this);var xoffset=math.floor(div.parent().width()/5)*div.attr('col');var yoffset=math.floor(div.parent().height()/5)*div.attr('row');div.css({'background':'url('+data.source+') -'+xoffset+'px -'+yoffset+'px','background-size':div.parent().width()+'px '+div.parent().height()+'px','width':'0px','height':'0px','position':'absolute','top':yoffset+'px','left':xoffset+'px','float':'none'});});self.anidiv.hide();self.aniimg.hide();switch(n){case 0:self.image.stop(true,true).fadeout(self.options.animationspeed,function(){self.image.attr('src',data.source).fadein(self.options.animationspeed,function(){self.finishanimating(data);});});break;case 1:self.anidiv.hide();self.aniimg.height(self.image.height()).hide().attr('src',data.source);self.wrap.css({height:self.image.height()});$.when(self.image.fadeout(self.options.animationspeed),self.aniimg.eq(0).fadein(self.options.animationspeed)).done(function(){self.finishanimating(data);});break;case 2:self.anidiv.show().children().hide().each(function(index){var delay=index*30;$(this).css({opacity:0.1}).show().delay(delay).animate({opacity:1,"width":awidth,"height":aheight},200,'linear',function(){if(self.anidiv.find("div").index(this)==24){self.finishanimating(data);}});});break;case 3:self.anidiv.show().children("div:lt(5)").hide().each(function(index){var delay=$(this).attr('col')*100;$(this).css({opacity:0.1,"width":awidth}).show().delay(delay).animate({opacity:1,"height":self.image.height()},self.options.animationspeed,'linear',function(){if(self.anidiv.find(" div").index(this)==4){self.finishanimating(data);}});});break;case 4:self.anidiv.show().children().hide().each(function(index){if(index>4){return;} var delay=$(this).attr('col')*30;var gap=self.gapper($(this),aheight,awidth);var speed=self.options.animationspeed*0.7;$(this).css({opacity:0.1,"height":"100%"}).show().delay(delay).animate({opacity:1,"width":gap.width},speed,'linear',function(){if(self.anidiv.find(" div").index(this)==4){self.finishanimating(data);}});});break;case 5:self.anidiv.show().children().show().each(function(index){var delay=index*math.floor(math.random()*5)*7;var gap=self.gapper($(this),aheight,awidth);if($(".animation div").index(this)==24){delay=700;} $(this).css({"height":gap.height,"width":gap.width,"opacity":0.01}).delay(delay).animate({"opacity":1},self.options.animationspeed,function(){if(self.anidiv.find(" div").index(this)==24){self.finishanimating(data);}});});break;case 6:self.anidiv.height(self.image.height()).hide().css({'background':'url('+data.source+') top left no-repeat'});self.anidiv.children('div').hide();self.anidiv.css({width:0}).show().animate({width:self.image.width()},self.options.animationspeed,function(){self.finishanimating(data);self.anidiv.css({'background':'transparent'});});break;case 7:self.wrap.css({overflow:'hidden'});self.aniimg.height(self.image.height()).hide().attr('src',data.source);self.anidiv.hide();self.image.css({position:'relative'}).animate({left:"-"+self.wrap.outerwidth()+"px"});self.aniimg.show();self.aniwrap.css({left:self.wrap.outerwidth()}).show().animate({left:"0px"},self.options.animationspeed,function(){self.finishanimating(data);});break;}},finishanimating:function(data){this.animating=false;this.image.attr('src',data.source);this.image.attr('alt',data.imagealt);this.image.attr('title',data.imagetitle);this.image.css({left:"0"});this.image.show();var self=this;$('').on('load',function(){self.aniimg.fadeout('fast');self.anidiv.fadeout('fast');}).attr('src',data.source);var cur=data.index+1;var total=this.thumbs.length;this.counter.html(cur+"/"+total);if(data.clickthrough!==""){if(this.anchor===null){this.anchor=this.image.wrap("").parent();} this.anchor.attr('href',data.clickthrough);this.anchor.attr('title',data.clickthroughtitle);this.anchor.attr('target',data.clickthroughtarget);}else{if(this.image.parent('a').length>0){this.image.unwrap();} this.anchor=null;} if(this.options.showcaption&&data.caption!==""&&data.caption!==null){this.caption.html(data.caption).fadeto('slow',1);} if(this.options.autoplay&&total>1){this.timeout=settimeout((function(self){return function(){self.nextclick();};})(this),this.options.speed,this.timeout);} if(typeof(this.options.animationfinished)=='function'){this.options.animationfinished(this);}},gapper:function(ele,aheight,awidth){var gap;if(ele.attr('row')==4){gap=(this.anidiv.height()-(aheight*5))+aheight;aheight=gap;} if(ele.attr('col')==4){gap=(this.anidiv.width()-(awidth*5))+awidth;awidth=gap;} return{height:aheight,width:awidth};},nextclick:function(e){var how="natural";var self=null;try{self=e.data.self;if(typeof(e.data.self.options.next)=='function'){e.data.self.options.next(this);}}catch(err){self=this;how="auto";} var next=self.active.parents('li:first').next().find('img');if(next.length===0){next=self.list.find('img').eq(0);} next.trigger('click',{how:how});return next;},prevclick:function(e){if(typeof(e.data.self.options.previous)=='function'){e.data.self.options.previous(this);} var self=e.data.self;var prev=self.active.parents('li:first').prev().find('img');if(prev.length===0){prev=self.list.find('img:last');} prev.trigger('click');return prev;},playclick:function(e){var self=e.data.self;self.options.autoplay=!self.options.autoplay;self.imgplay.toggleclass('play').toggleclass('pause');if(self.options.autoplay){self.nextclick();}else{cleartimeout(self.timeout);} return(self.options.autoplay)?"playing":"paused";},next:function(){var e={data:{self:this}};return this.nextclick(e);},prev:function(){var e={data:{self:this}};return this.prevclick(e);},goto:function(v){var e={data:{self:this}};var gotoimg=this.list.find('img').eq(v);if(gotoimg.length>0){gotoimg.trigger('click');return gotoimg;}else{throw"image not found. images are 0 indexed.";}},play:function(){if(this.options.autoplay){return"playing";} var e={data:{self:this}};return this.playclick(e);},pause:function(){if(!this.options.autoplay){return"paused";} var e={data:{self:this}};return this.playclick(e);},updatethumbs:function(){var self=this;this.thumbs=this.list.find('img');this.thumbs.each(function(){self.createthumb($(this),self);});}});})(jquery);