/*
 * Moving Boxes script by Chris Coyier
 * http://css-tricks.com/moving-boxes/
 */
(function(c){c.movingBoxes=function(d,f){var a=this;a.$el=c(d);a.el=d;a.$el.data("movingBoxes",a);a.init=function(){a.options=c.extend({},c.movingBoxes.defaultOptions,f);var b=a.$el.find(".panel");a.options.totalPanels=b.length;a.options.regWidth=b.css("width");a.options.regImgWidth=b.find("img").css("width");a.options.regTitleSize=b.find("h2").css("font-size");a.options.regParSize=b.find("p").css("font-size");b.css({"float":"left",position:"relative"});a.$el.data("currentlyMoving",false);a.$el.find(".scrollContainer").css("width",
a.$el.find(".panel")[0].offsetWidth*a.$el.find(".panel").length+150);a.$el.find(".scroll").css("overflow","hidden");a.$el.data("currentPanel",-1);a.change(a.options.startPanel);curPanel=a.options.startPanel;a.$el.find(".right").click(function(){a.change(a.$el.data("currentPanel")+1)}).end().find(".left").click(function(){a.change(a.$el.data("currentPanel")-1)});b.click(function(){a.change(b.index(c(this))+1)})};a.returnToNormal=function(b){a.$el.find(".panel").not(":eq("+(b-1)+")").animate({width:a.options.regWidth},
a.options.speed).find("img").animate({width:a.options.regImgWidth},a.options.speed).end().find("h2").animate({fontSize:a.options.regTitleSize},a.options.speed).end().find("p").animate({fontSize:a.options.regParSize},a.options.speed)};a.growBigger=function(b){a.$el.find(".panel").eq(b-1).animate({width:a.options.curWidth},a.options.speed).find("img").animate({width:a.options.curImgWidth},a.options.speed).end().find("h2").animate({fontSize:a.options.curTitleSize},a.options.speed).end().find("p").animate({fontSize:a.options.curParSize},
a.options.speed)};a.change=function(b){var e=a.$el.find(".panel");if(b<1||a.$el.data("currentPanel")==b||b>e.length)return false;if(!a.$el.data("currentlyMoving")){a.$el.data("currentPanel",b);a.$el.data("currentlyMoving",true);e=a.$el.find(".scroll").innerWidth()/2-e.eq(b-1).outerWidth()/2-a.options.movingDistance*(b-1);a.$el.find(".scrollContainer").stop().animate({left:e},a.options.speed,function(){a.$el.data("currentlyMoving",false)});a.returnToNormal(b);a.growBigger(b)}};a.currentPanel=function(b){typeof b!==
"undefined"&&a.change(parseInt(b,10));return a.$el.data("currentPanel")};a.init()};c.movingBoxes.defaultOptions={startPanel:1,movingDistance:300,curWidth:350,curImgWidth:326,curTitleSize:"20px",curParSize:"15px",speed:500};c.fn.movingBoxes=function(d){return this.each(function(){new c.movingBoxes(this,d)})};c.fn.getmovingBoxes=function(){this.data("movingBoxes")}})(jQuery);

