/*
* Moving Boxes v2.0.3 minified
* by Chris Coyier
* http://css-tricks.com/moving-boxes/
*/
(function(c){c.movingBoxes=function(e,h){var a=this;a.$el=c(e).addClass("mb-slider");a.el=e;a.$el.data("movingBoxes",a);a.init=function(){a.options=c.extend({},c.movingBoxes.defaultOptions,h);a.$el.wrap('
');a.$window=a.$el.parent();a.$wrap=a.$window.parent().css({width:a.options.width}).prepend('').append(''); a.$panels=a.$el.find(a.options.panelType).addClass("mb-panel");a.runTime=c(".mb-slider").index(a.$el)+1;a.regex=RegExp("slider"+a.runTime+"=(\\d+)","i");a.initialized=!1;a.currentlyMoving=!1;a.curPanel=1;a.update();a.$wrap.find(".mb-right").click(function(){a.goForward();return!1}).end().find(".mb-left").click(function(){a.goBack();return!1});a.$el.delegate(".mb-panel","click",function(){a.change(a.$panels.index(c(this))+1)});a.$wrap.click(function(){a.active()});a.$panels.delegate("a","focus",function(){a.$panels.index(c(this).closest(".mb-panel"))+ 1!==a.curPanel&&a.change(a.$panels.index(c(this).closest(".mb-panel"))+1,{},!1)});c(document).keyup(function(b){if(!b.target.tagName.match("TEXTAREA|INPUT|SELECT"))switch(b.which){case 39:case 32:a.$wrap.is(".mb-active-slider")&&a.goForward();break;case 37:a.$wrap.is(".mb-active-slider")&&a.goBack()}});var b=a.options.hashTags?a.getHash()||a.options.startPanel:a.options.startPanel;setTimeout(function(){a.change(b,function(){c.each("initialized.movingBoxes initChange.movingBoxes beforeAnimation.movingBoxes completed.movingBoxes".split(" "), function(b,d){var e=d.split(".")[0];c.isFunction(a.options[e])&&a.$el.bind(d,a.options[e])});a.initialized=!0;a.$el.trigger("initialized.movingBoxes",[a,b])})},a.options.speed*2)};a.update=function(){var b;a.$panels=a.$el.find(a.options.panelType).addClass("mb-panel").css({width:a.options.width*a.options.panelWidth}).each(function(){c(this).find(".mb-inside").length===0&&c(this).wrapInner('')});a.totalPanels=a.$panels.length;b=a.$panels.eq(a.curPanel-1);a.curWidth=a.curWidth|| b.outerWidth();a.curImgWidth=a.curImgWidth||b.find("img").outerWidth(!0);a.curImgHeight=a.curImgHeight||a.curImgWidth/a.options.imageRatio;a.regWidth=a.curWidth*a.options.reducedSize;a.regImgWidth=a.curImgWidth*a.options.reducedSize;a.regImgHeight=a.curImgHeight*a.options.reducedSize;a.$panels.css({width:a.curWidth,fontSize:"1em"}).find("img").css({height:a.curImgHeight,width:a.curImgWidth});a.heights=a.$panels.map(function(a,b){return c(b).outerHeight(!0)}).get();a.returnToNormal(a.curPanel,!0); a.growBigger(a.curPanel,!0);a.$el.css({position:"absolute",width:(a.curWidth+100)*a.totalPanels+(a.options.width-a.curWidth)/2,height:Math.max.apply(this,a.heights)+10});a.$window.css({height:a.options.fixedHeight?Math.max.apply(this,a.heights):a.heights[a.curPanel-1]});a.$panels.eq(0).css({"margin-left":(a.options.width-a.curWidth)/2});a.buildNav();a.change(a.curPanel,{},!1)};a.buildNav=function(){a.$navLinks={};a.$nav&&a.$nav.remove();if(a.options.buildNav&&a.totalPanels>1){a.$nav=c('').appendTo(a.$wrap); var b,f="",d=c.isFunction(a.options.navFormatter),e=parseInt(a.$nav.find(".mb-testing").css("text-indent"),10)<0;a.$panels.each(function(g){b=g+1;f+=''+g+" "):f+='">'+b+" "});a.$navLinks=a.$nav.html(f).find("a").bind("click",function(){a.change(a.$navLinks.index(c(this))+1);return!1})}};a.returnToNormal=function(b,c){a.$panels.not(":eq("+(b-1)+")").removeClass(a.options.currentPanel).animate({width:a.regWidth, fontSize:a.options.reducedSize+"em"},c?0:a.options.speed).find("img").animate({width:a.regImgWidth,height:a.regImgHeight},c?0:a.options.speed)};a.growBigger=function(b,c){a.$panels.eq(b-1).addClass(a.options.currentPanel).animate({width:a.curWidth,fontSize:"1em"},c?0:a.options.speed).find("img").animate({width:a.curImgWidth,height:a.curImgHeight},c?0:a.options.speed,function(){a.initialized&&a.$el.trigger("completed.movingBoxes",[a,b])})};a.goForward=function(){a.change(a.curPanel+1)};a.goBack=function(){a.change(a.curPanel- 1)};a.change=function(b,c,d){b=parseInt(b,10);a.initialized&&(a.active(),a.$el.trigger("initChange.movingBoxes",[a,b]));if(a.options.wrap){if(b<1)b=a.totalPanels;b>a.totalPanels&&(b=1)}else if(b<1&&(b=1),b>a.totalPanels)b=a.totalPanels;if(a.initialized&&a.curPanel==b&&!d)return!1;if(!a.currentlyMoving)a.currentlyMoving=!0,d=a.$panels.eq(b-1).position().left-(a.options.width-a.curWidth)/2,b>a.curPanel&&(d-=a.curWidth-a.regWidth),d=a.options.fixedHeight?{scrollLeft:d}:{scrollLeft:d,height:a.heights[b- 1]},a.initialized&&a.$el.trigger("beforeAnimation.movingBoxes",[a,b]),a.$window.animate(d,{queue:!1,duration:a.options.speed,easing:a.options.easing,complete:function(){a.curPanel=b;a.initialized&&a.$window.scrollTop(0);a.currentlyMoving=!1;typeof c==="function"&&c(a)}}),a.returnToNormal(b),a.growBigger(b),a.options.hashTags&&a.setHash(b);a.$wrap.find(".mb-controls a").removeClass(a.options.currentPanel).eq(b-1).addClass(a.options.currentPanel)};a.getHash=function(){var b=window.location.hash.match(a.regex); return b===null?"":parseInt(b[1],10)};a.setHash=function(b){var c="slider"+a.runTime+"=",d=window.location.hash;if(typeof d!=="undefined")window.location.hash=d.indexOf(c)>0?d.replace(a.regex,c+b):d+"&"+c+b};a.active=function(){c(".mb-active-slider").removeClass("mb-active-slider");a.$wrap.addClass("mb-active-slider")};a.currentPanel=function(b,c){typeof b!=="undefined"&&a.change(b,c);return a.curPanel};a.init()};c.movingBoxes.defaultOptions={startPanel:1,width:800,panelWidth:0.5,reducedSize:0.8, imageRatio:4/3,fixedHeight:!1,speed:500,hashTags:!0,wrap:!1,buildNav:!1,navFormatter:null,easing:"swing",currentPanel:"current",tooltipClass:"tooltip",panelType:"> div",initialized:null,initChange:null,beforeAnimation:null,completed:null};c.fn.movingBoxes=function(e,h){var a,b=this.data("movingBoxes");return this.each(function(){(typeof e).match("object|undefined")?b?b.update():new c.movingBoxes(this,e):/\d/.test(e)&&!isNaN(e)&&b&&(a=typeof e==="number"?e:parseInt(c.trim(e),10),a>=1&&a<=b.totalPanels&& b.change(a,h))})};c.fn.getMovingBoxes=function(){return this.data("movingBoxes")}})(jQuery);