
/* 10)--------------------------------------------------------------
 * Accordion
 * ----------------------------------------------------
 * Author: Themedo
 * Author URL: http://themeforest.net/user/themedo
 */
!function(c){c.fn.fotofly_fn_accordion=function(a){if(this.length>1)return this.each(function(){c(this).fotofly_fn_accordion(a)}),this;var e=c.extend({animation:!0,showIcon:!0,closeAble:!1,closeOther:!0,slideSpeed:150,activeIndex:!1},a);c(this).data("close-able")&&(e.closeAble=c(this).data("close-able")),c(this).data("animation")&&(e.animation=c(this).data("animation")),c(this).data("show-icon")&&(e.showIcon=c(this).data("show-icon")),c(this).data("close-other")&&(e.closeOther=c(this).data("close-other")),c(this).data("slide-speed")&&(e.slideSpeed=c(this).data("slide-speed")),c(this).data("active-index")&&(e.activeIndex=c(this).data("active-index"));var i=this,n=function(){i.createStructure(),i.clickHead()};return this.createStructure=function(){i.addClass("fotofly_fn_accordion"),e.showIcon&&i.addClass("acc_with_icon"),i.find(".accordion_in").length<1&&i.children().addClass("accordion_in"),i.find(".accordion_in").each(function(a,e){var i=c(e).children();c(i[0]).addClass("acc_head"),c(i[1]).addClass("acc_content")}),e.showIcon&&i.find(".acc_head").prepend('<div class="acc_icon_expand"></div>'),i.find(".accordion_in .acc_content").not(".acc_active .acc_content").hide(),e.activeIndex===parseInt(e.activeIndex)&&(0===e.activeIndex?(i.find(".accordion_in").addClass("acc_active").show(),i.find(".accordion_in .acc_content").addClass("acc_active").show()):(i.find(".accordion_in").eq(e.activeIndex-1).addClass("acc_active").show(),i.find(".accordion_in .acc_content").eq(e.activeIndex-1).addClass("acc_active").show()))},this.clickHead=function(){i.on("click",".acc_head",function(){var a=c(this).parent();0==a.hasClass("acc_active")&&e.closeOther&&(i.find(".acc_content").slideUp(e.slideSpeed),i.find(".accordion_in").removeClass("acc_active")),a.hasClass("acc_active")?!1!==e.closeAble&&(a.children(".acc_content").slideUp(e.slideSpeed),a.removeClass("acc_active")):(c(this).next(".acc_content").slideDown(e.slideSpeed),a.addClass("acc_active"))})},n(),this}}(jQuery);

!function(t,n,i,s){var e=function(s,e){this.elem=s,this.$elem=t(s),this.options=e,this.metadata=this.$elem.data("plugin-options"),this.$win=t(n),this.sections={},this.didScroll=!1,this.$doc=t(i),this.docHeight=this.$doc.height()};e.defaults=(e.prototype={defaults:{navItems:"a",currentClass:"current",changeHash:!1,easing:"swing",filter:"",scrollSpeed:1e3,scrollThreshold:.5,begin:!1,end:!1,scrollChange:!1},init:function(){return this.config=t.extend({},this.defaults,this.options,this.metadata),this.$nav=this.$elem.find(this.config.navItems),""!==this.config.filter&&(this.$nav=this.$nav.filter(this.config.filter)),this.$nav.on("click.onePageNav",t.proxy(this.handleClick,this)),this.getPositions(),this.bindInterval(),this.$win.on("resize.onePageNav",t.proxy(this.getPositions,this)),this},adjustNav:function(t,n){t.$elem.find("."+t.config.currentClass).removeClass(t.config.currentClass),n.addClass(t.config.currentClass)},bindInterval:function(){var t,n=this;n.$win.on("scroll.onePageNav",function(){n.didScroll=!0}),n.t=setInterval(function(){t=n.$doc.height(),n.didScroll&&(n.didScroll=!1,n.scrollChange()),t!==n.docHeight&&(n.docHeight=t,n.getPositions())},250)},getHash:function(t){return t.attr("href").split("#")[1]},getPositions:function(){var n,i,s,e=this;e.$nav.each(function(){n=e.getHash(t(this)),(s=t("#"+n)).length&&(i=s.offset().top,e.sections[n]=Math.round(i))})},getSection:function(t){var n=null,i=Math.round(this.$win.height()*this.config.scrollThreshold);for(var s in this.sections)this.sections[s]-i<t&&(n=s);return n},handleClick:function(i){var s=this,e=t(i.currentTarget),o=e.parent(),a="#"+s.getHash(e);o.hasClass(s.config.currentClass)||(s.config.begin&&s.config.begin(),s.adjustNav(s,o),s.unbindInterval(),s.scrollTo(a,function(){s.config.changeHash&&(n.location.hash=a),s.bindInterval(),s.config.end&&s.config.end()})),i.preventDefault()},scrollChange:function(){var t,n=this.$win.scrollTop(),i=this.getSection(n);null!==i&&((t=this.$elem.find('a[href$="#'+i+'"]').parent()).hasClass(this.config.currentClass)||(this.adjustNav(this,t),this.config.scrollChange&&this.config.scrollChange(t)))},scrollTo:function(n,i){var s=t(n).offset().top;t("html, body").animate({scrollTop:s},this.config.scrollSpeed,this.config.easing,i)},unbindInterval:function(){clearInterval(this.t),this.$win.unbind("scroll.onePageNav")}}).defaults,t.fn.onePageNav=function(t){return this.each(function(){new e(this,t).init()})}}(jQuery,window,document);