var toggleElements_animating=false;(function(a){a.fn.toggleElements=function(b){b=a.extend({fxAnimation:"slide",fxSpeed:"normal",autoClose:"",markup:"{{markup}}",openedClass:"{{openedClass}}",closedClass:"{{closedClass}}"},b);if((b.fxAnimation!="slide")&&(b.fxAnimation!="show")&&(b.fxAnimation!="fade")){b.fxAnimation="slide";}this.each(function(){a(this).removeClass("nojs");});this.each(function(){wtitle="";wlinktext=a(this).attr("data-capt");id=a(this).attr("id");var d=b.markup.replace("{Caption}",wlinktext);if(a(this).attr("class").indexOf("opened")!=-1){a("div."+id).css("display","block");a(this).before('<div id="c'+id+'" class="accordion opened '+b.openedClass+'">'+d+"</div>");a(this).prepend('<div class="gap-content"></div>');a(this).after('<div class="gap-accord"></div>');a(this).addClass("tab-visible").removeClass("tab-hidden");}else{a(this).before('<div id="c'+id+'" class="accordion closed '+b.closedClass+'">'+d+"</div>");a(this).prepend('<div class="gap-content"></div>');a(this).after('<div class="gap-accord"></div>');a(this).addClass("tab-hidden").removeClass("tab-visible");}var c=a(this).attr("id");a("div#c"+id).click(function(){if(toggleElements_animating){return false;}toggleElements_animating=true;if(a(this).next().hasClass("tab-visible")){a(this).next().each(function(){a("div#c"+a(this).attr("id")).removeClass("opened").addClass("closed");a("div#c"+a(this).attr("id")).removeClass(b.openedClass).addClass(b.closedClass);if(b.fxAnimation=="slide"){a(this).slideUp(b.fxSpeed,function(){a.toggleElementsHidden(this);});}if(b.fxAnimation=="show"){a(this).hide(b.fxSpeed,function(){a.toggleElementsHidden(this);});}if(b.fxAnimation=="fade"){a(this).fadeOut(b.fxSpeed,function(){a.toggleElementsHidden(this);});}a.cookie(a(this).attr("id"),null);});}else{a(this).next().each(function(){a(this).css("display","none");a(this).removeClass("tab-hidden").addClass("tab-visible");a("div#c"+a(this).attr("id")).removeClass("closed").addClass("opened");a("div#c"+a(this).attr("id")).removeClass(b.closedClass).addClass(b.openedClass);if(b.fxAnimation=="slide"){a(this).slideDown(b.fxSpeed,function(){a.toggleElementsShown();});}if(b.fxAnimation=="show"){a(this).show(b.fxSpeed,function(){a.toggleElementsShown();});}if(b.fxAnimation=="fade"){a(this).fadeIn(b.fxSpeed,function(){a.toggleElementsShown();});}a.cookie(a(this).attr("id"),"open");});if(b.autoClose!=""){a.toggleElementsAutoClose(a(this).attr("id"),b);}}return false;});});};a.toggleElementsAutoClose=function(d,e){var b=e.autoClose.split(" ");if(b.length>0){toggleElements_animating=true;for(i=0;i<b.length;i++){var c=d.substr(1);if(c!=b[i]){a("div#c"+b[i]).removeClass(e.openedClass).addClass(e.closedClass);a("div#c"+b[i]).removeClass("opened").addClass("closed");if(e.fxAnimation=="show"){a("div#"+b[i]).hide(e.fxSpeed,function(){a.toggleElementsHidden(this);});}if(e.fxAnimation=="fade"){a("div#"+b[i]).fadeOut(e.fxSpeed,function(){a.toggleElementsHidden(this);});}if(e.fxAnimation=="slide"){a("div#"+b[i]).slideUp(e.fxSpeed,function(){a.toggleElementsHidden(this);});}a.cookie(b[i],null);}}toggleElements_animating=false;}};a.toggleElementsGetClasses=function(d){var c={openedClass:"",closedClass:""};var b=a("#"+d).attr("data-open");if(typeof b!==typeof undefined&&b!==false){c.openedClass=a("#"+d).attr("data-open");c.closedClass=a("#"+d).attr("data-close");}else{c.openedClass="{{openedClass}}";c.closedClass="{{closedClass}}";}return c;};a.toggleElementsClose=function(c,d,e){if(toggleElements_animating){return true;}toggleElements_animating=true;var b=a.toggleElementsGetClasses(c);if(d=="slide"){a("#"+c).slideUp(e,function(){a("#"+c).removeClass("tab-visible").addClass("tab-hidden");});}if(d=="show"){a("#"+c).hide(e,function(){a("#"+c).removeClass("tab-visible").addClass("tab-hidden");});}if(d=="fade"){a("#"+c).fadeOut(e,function(){a("#"+c).removeClass("tab-visible").addClass("tab-hidden");});}a("#c"+c).removeClass("openend").addClass("closed");a("#c"+c).removeClass(b.openedClass).addClass(b.closedClass);toggleElements_animating=false;};a.toggleElementsHidden=function(b){a(b).removeClass("tab-visible").addClass("tab-hidden");toggleElements_animating=false;};a.toggleElementsShown=function(){a(window).trigger("scroll");toggleElements_animating=false;};})(jQuery);