var sliderCount=1;
$.fn.codaSlider=function(a){a=$.extend({autoSlide:!0,autoSlideInterval:15E3,autoSlideStopWhenClicked:!0,crossLinking:!0,dynamicTabs:!0,dynamicTabsAlign:"center",dynamicTabsPosition:"bottom",externalTriggerSelector:"a.xtrig",firstPanelToLoad:4,panelTitleSelector:"h2.title",slideEaseDuration:500,slideEaseFunction:"easeInOutBack"},a);return this.each(function(){function l(c){a.autoHeight&&(panelHeight=$(".coda-panel:eq("+c+")",b).height(),b.animate({height:panelHeight},a.autoHeightEaseDuration,a.autoHeightEaseFunction))}
function o(){if(0==m||!a.autoSlideStopWhenClicked){if(c==j){var n=0;c=1;h=0}else n=-parseInt(k*c),c+=1,h+=33;l(c-1);var d=b.siblings(".social-icons").find("li").attr("style"," ").parents("ul").find("li:eq("+(c-1)+")"),f=d.css("background-position"),f="undefined"==typeof f?d.css("backgroundPositionX"):f.substring(0,f.indexOf(" "));d.css("background-position",f+" -290px");$(".coda-panel-container",b).animate({marginLeft:n},a.slideEaseDuration,a.slideEaseFunction);$("#social-speech").css({"background-position":h+
"px -262px"});setTimeout(o,a.autoSlideInterval)}}var b=$(this),h=0,k=b.find(".coda-panel").width(),j=b.find(".coda-panel").size(),e=k*j,m=0;$(".coda-panel",b).wrapAll('<div class="coda-panel-container"></div>');$(".coda-panel-container",b).css({width:e});if(a.crossLinking&&location.hash&&parseInt(location.hash.slice(1))<=j){var c=parseInt(location.hash.slice(1)),i=-(k*(c-1)),h=33*(c-1);$(".coda-panel-container",b).css({marginLeft:i});$("#social-speech").css({"background-position":h+"px -262px"})}else 1!=
a.firstPanelToLoad&&a.firstPanelToLoad<=j?(c=a.firstPanelToLoad,i=-(k*(c-1)),h=33*(c-1),$(".coda-panel-container",b).css({marginLeft:i}),$("#social-speech").css({"background-position":h+"px -262px"})):c=1;if(a.dynamicTabs){e='<ul class="social-icons ir" id="coda-nav-'+sliderCount+'"><ul class="clearfix"></ul></nav>';switch(a.dynamicTabsPosition){case "bottom":b.parent().append(e);break;default:b.parent().prepend(e)}ul=$("#coda-nav-"+sliderCount+" ul");$(".coda-panel",b).each(function(b){ul.append('<li class="socialbox tab'+
(b+1)+'"><a href="#'+(b+1)+'">'+$(this).find(a.panelTitleSelector).text()+"</a></li>")});navContainerWidth=b.width()+b.siblings(".coda-nav-left").width()+b.siblings(".coda-nav-right").width();ul.parent().css({width:navContainerWidth});switch(a.dynamicTabsAlign){case "right":ul.css("float","right")}}$("#coda-nav-"+sliderCount+" li").each(function(e){$(this).bind("click",function(){m++;var d=$(this),f=d.css("background-position");"undefined"==typeof f?d.css("backgroundPositionY","-290px"):(f=f.substring(0,
f.indexOf(" ")),d.parents("ul").find("li").not(d).attr("style"," "),d.css("background-position",f+" -290px"));i=-(k*e);l(e);c=e+1;d=33*(c-1);$("#social-speech").css({"background-position":d+"px -262px"});$(".coda-panel-container",b).animate({marginLeft:i},a.slideEaseDuration,a.slideEaseFunction);if(!a.crossLinking)return!1})});$(a.externalTriggerSelector).each(function(){sliderCount==parseInt($(this).attr("rel").slice(12))&&$(this).bind("click",function(){m++;targetPanel=parseInt($(this).attr("href").slice(1));
i=-(k*(targetPanel-1));l(targetPanel-1);c=targetPanel;var e=b.siblings(".coda-nav").find("li").css("background-position",d+" -312px").parents("ul").find("li:eq("+(targetPanel-1)+") li"),d=e.css("background-position");if("undefined"==typeof d)e.css("backgroundPositionY","-290px");else{var d=d.substring(0,d.indexOf(" "));e.css("background-position",d+" -290px")}$(".coda-panel-container",b).animate({marginLeft:i},a.slideEaseDuration,a.slideEaseFunction);if(!a.crossLinking)return!1})});if(a.crossLinking&&
location.hash&&parseInt(location.hash.slice(1))<=j)var e=$("#coda-nav-"+sliderCount+" a:eq("+(location.hash.slice(1)-1)+")").closest("li"),g=e.css("background-position"),g=g.substring(0,g.indexOf(" "));else e=1!=a.firstPanelToLoad&&a.firstPanelToLoad<=j?$("#coda-nav-"+sliderCount+" a:eq("+(a.firstPanelToLoad-1)+")").closest("li"):$("#coda-nav-"+sliderCount+" a:eq(0)").closest("li"),g=e.css("background-position"),g="undefined"==typeof g?e.css("backgroundPositionX"):g.substring(0,g.indexOf(" "));e.css("background-position",
g+" -290px");a.autoHeight&&(panelHeight=$(".coda-panel:eq("+(c-1)+")",b).height(),b.css({height:panelHeight}));a.autoSlide&&b.ready(function(){setTimeout(o,a.autoSlideInterval)});$(".coda-panel",b).show().end().find("div#ajax-load").remove();b.removeClass("preload");sliderCount++})};$(function(){$("body").removeClass("coda-slider-no-js");$(".coda-slider").children(".coda-panel").hide().end().prepend('<div id="ajax-load"></div>');$("#coda-slider-1").codaSlider()});

