/*
 * Moving Boxes v1.5.1 min
 * by Chris Coyier 
 * http://css-tricks.com/moving-boxes/
 */

(function(){$.movingBoxes=function(e,f){var a=this;a.$el=$(e).addClass("movingBoxes");a.el=e;a.$el.data("movingBoxes",a);a.init=function(){a.options=$.extend({},$.movingBoxes.defaultOptions,f);a.$el.addClass("left-shadow").css({position:"relative",left:0,top:0,width:a.options.width}).wrapInner('<div class="scrollContainer" />').wrapInner('<div class="scroll right-shadow" />').prepend('<a class="scrollButtons left"></a>').append('<a class="scrollButtons right"></a>').find(".panel").wrapInner('<div class="inside" />').end().find(".scroll, .scrollContainer").css({position:"relative", overflow:"hidden",width:"100%"});a.$container=a.$el.find(".scrollContainer");a.$window=a.$el.find(".scroll");a.runTime=$(".movingBoxes").index(a.$el)+1;a.regex=RegExp("slider"+a.runTime+"=(\\d+)","i");a.$panels=a.$el.find(".panel").css({width:a.options.width*a.options.panelWidth,"float":"left"});a.totalPanels=a.$panels.length;a.curWidth=a.$panels.outerWidth();a.curImgWidth=a.$panels.find("img").outerWidth(true);a.curImgHeight=a.curImgWidth/a.options.imageRatio;a.curTitleSize=parseInt(a.$panels.find("h2").css("font-size"), 10);a.curParSize=parseInt(a.$panels.find("p").css("font-size"),10);a.regWidth=a.curWidth*a.options.reducedSize;a.regImgWidth=a.curImgWidth*a.options.reducedSize;a.regImgHeight=a.curImgHeight*a.options.reducedSize;a.regTitleSize=a.curTitleSize*a.options.reducedSize;a.regParSize=a.curParSize*a.options.reducedSize;a.$panels.find("img").css({height:a.curImgHeight});a.heights=a.$panels.map(function(c,d){return $(d).outerHeight(true)}).get();a.$container.css({position:"relative",width:(a.curWidth+50)*a.totalPanels, height:Math.max.apply(this,a.heights)});var b=a.options.hashTags?a.getHash()||a.options.startPanel:a.options.startPanel;a.initialized=false;a.currentlyMoving=false;a.curPanel=1;a.change(1);setTimeout(function(){a.change(b)},a.options.speed*2);a.initialized=true;a.$el.find(".right").click(function(){a.goForward();return false}).end().find(".left").click(function(){a.goBack();return false});a.$panels.click(function(){a.change(a.$panels.index($(this))+1)});a.$el.click(function(){a.active($(this))}).find("a").focus(function(){var c= $(this).closest(".slider");a.active(c);a.change(c.find(".panel").index($(this).closest(".panel"))+1,false)});$(document).keyup(function(c){switch(c.which){case 39:case 32:a.$el.is(".active-slider")&&a.goForward();break;case 37:a.$el.is(".active-slider")&&a.goBack()}})};a.returnToNormal=function(b){a.$panels.not(":eq("+(b-1)+")").animate({width:a.regWidth},a.options.speed).find("img").animate({width:a.regImgWidth,height:a.regImgHeight},a.options.speed).end().find("h2").animate({fontSize:a.regTitleSize}, a.options.speed).end().find("p").animate({fontSize:a.regParSize},a.options.speed)};a.growBigger=function(b){a.$panels.eq(b-1).animate({width:a.curWidth},a.options.speed).find("img").animate({width:a.curImgWidth,height:a.curImgHeight},a.options.speed).end().find("h2").animate({fontSize:a.curTitleSize},a.options.speed).end().find("p").animate({fontSize:a.curParSize},a.options.speed)};a.goForward=function(){a.change(a.curPanel+1)};a.goBack=function(){a.change(a.curPanel-1)};a.change=function(b,c){if(a.options.wrap){if(b< 1)b=a.totalPanels;if(b>a.totalPanels)b=1}else{if(b<1)b=1;if(b>a.totalPanels)b=a.totalPanels}if(a.initialized&&a.curPanel==b&&!c)return false;if(!a.currentlyMoving){a.currentlyMoving=true;a.$window.scrollLeft(0);var d=(a.options.width-a.curWidth)/2-a.$panels.eq(b-1).position().left;if(b>a.curPanel)d+=a.curWidth-a.regWidth;a.$container.animate(a.options.fixedHeight?{left:d}:{left:d,height:a.heights[b-1]},{queue:false,duration:a.options.speed,complete:function(){a.curPanel=b;a.$panels.eq(b-1).find("a").focus(); a.$window.scrollLeft(0);a.currentlyMoving=false}});a.$window.animate({scrollLeft:0},a.options.speed);a.returnToNormal(b);a.growBigger(b);a.options.hashTags&&a.setHash(b)}};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(b){$(".active-slider").removeClass("active-slider"); b.addClass("active-slider")};a.currentPanel=function(b){typeof b!=="undefined"&&a.change(parseInt(b,10));return a.curPanel};a.init()};$.movingBoxes.defaultOptions={startPanel:1,width:800,panelWidth:0.5,reducedSize:0.8,imageRatio:4/3,speed:500,fixedHeight:false,hashTags:true,wrap:false};$.fn.movingBoxes=function(e){return this.each(function(){new $.movingBoxes(this,e)})};$.fn.getmovingBoxes=function(){this.data("movingBoxes")}})(jQuery);

