!function(){"use strict";function Gumby(){this.$dom=$(document);this.isOldie=!!this.$dom.find("html").hasClass("oldie");this.click="click";this.onReady=false;this.onOldie=false;this.uiModules={};this.inits={}}Gumby.prototype.init=function(){this.initUIModules();var scope=this;this.$dom.ready(function(){if(scope.onReady){scope.onReady()}if(scope.isOldie&&scope.onOldie){scope.onOldie()}})};Gumby.prototype.ready=function(code){if(code&&typeof code==="function"){this.onReady=code}};Gumby.prototype.oldie=function(code){if(code&&typeof code==="function"||!this.isOldie){this.onOldie=code}};Gumby.prototype.debug=function(){return{$dom:this.$dom,isOldie:this.isOldie,uiModules:this.uiModules,click:this.click}};Gumby.prototype.selectAttr=function(){var i=0;for(;i').trigger("gumby.onCheck").trigger("gumby.onChange")}else{this.$el.find("input").attr("checked",false).end().find("i").remove().end().removeClass("checked").trigger("gumby.onUncheck").trigger("gumby.onChange")}};Gumby.addInitalisation("checkboxes",function(){$(".checkbox").each(function(){var $this=$(this);if($this.data("isCheckbox")){return true}$this.data("isCheckbox",true);new Checkbox($this)})});Gumby.UIModule({module:"checkbox",events:["onCheck","onUncheck","onChange","check","uncheck"],init:function(){Gumby.initialize("checkboxes")}})}();!function(){"use strict";function Fixed($el){this.$el=$el;this.$holder=Gumby.selectAttr.apply(this.$el,["holder"]);this.fixedPoint=Gumby.selectAttr.apply(this.$el,["fixed"]);this.unfixPoint=false;if(this.$holder){this.$holder=$(this.$holder)}else{this.$holder=$(window)}if(this.fixedPoint.indexOf("|")>-1){var points=this.fixedPoint.split("|");this.fixedPoint=points[0];this.unfixPoint=points[1]}this.fixedPoint=this.parseAttrValue(this.fixedPoint);if(this.unfixPoint){this.unfixPoint=this.parseAttrValue(this.unfixPoint)}var scope=this;this.$holder.scroll(function(){scope.scroll()})}Fixed.prototype.scroll=function(){var offset=this.$holder.scrollTop(),fixedPoint=this.fixedPoint,unfixPoint=this.unfixPoint,endPoint=this.endPoint;fixedPoint=fixedPoint instanceof jQuery?this.fixedPoint.offset().top:this.fixedPoint;unfixPoint=unfixPoint instanceof jQuery?this.unfixPoint.offset().top:this.unfixPoint;if(!unfixPoint){unfixPoint=offset*2}if(offset>=fixedPoint&&offset=unfixPoint&&this.$el.hasClass("fixed")){this.$el.removeClass("fixed").trigger("gumby.onUnfixed",1)}};Fixed.prototype.parseAttrValue=function(attr){if($.isNumeric(attr)){return Number(attr)}else if(attr==="top"){return this.$el.offset().top}else{var $el=$(attr);return $el.length?$el:false}};Gumby.addInitalisation("fixed",function(){$("[data-fixed],[gumby-fixed],[fixed]").each(function(){var $this=$(this);if($this.data("isFixed")){return true}$this.data("isFixed",true);new Fixed($this)})});Gumby.UIModule({module:"fixed",events:["onFixed","onUnfixed"],init:function(){Gumby.initialize("fixed")}})}();!function(){"use strict";function RadioBtn($el){this.$el=$el;var scope=this;this.$el.on(Gumby.click,function(e){scope.click(e)}).on("gumby.check",function(){scope.update()});if(scope.$el.hasClass("checked")){scope.update()}}RadioBtn.prototype.click=function(e){var $target=$(e.target);e.stopPropagation();e.preventDefault();this.update()};RadioBtn.prototype.update=function(){var $input=this.$el.find("input[type=radio]"),group='input[name="'+$input.attr("name")+'"]';$(".radio").has(group).removeClass("checked").find("input").attr("checked",false).end().find("i").remove();$input.attr("checked",true);this.$el.append('').addClass("checked").trigger("gumby.onChange")};Gumby.addInitalisation("radiobtns",function(){$(".radio").each(function(){var $this=$(this);if($this.data("isRadioBtn")){return true}$this.data("isRadioBtn",true);new RadioBtn($this)})});Gumby.UIModule({module:"radiobtn",events:["onChange","check"],init:function(){Gumby.initialize("radiobtns")}})}();!function(){"use strict";function Retina($el){this.$el=$el;this.imageSrc=this.$el.attr("src");this.retinaSrc=this.fetchRetinaImage();this.$retinaImg=$(new Image);var scope=this;if(!this.retinaSrc){return false}this.$retinaImg.attr("src",this.retinaSrc).load(function(){scope.retinaImageLoaded()})}Retina.prototype.fetchRetinaImage=function(){var imgSrc=this.imageSrc,index=this.imageSrc.search(/(\.|\/)(gif|jpe?g|png)$/i);if(index<0){return false}return imgSrc.substr(0,index)+"@2x"+imgSrc.substr(index,imgSrc.length)};Retina.prototype.retinaImageLoaded=function(){this.$el.attr("src",this.$retinaImg.attr("src")).trigger("gumby.onRetina")};Gumby.addInitalisation("retina",function(){if(!window.devicePixelRatio||window.devicePixelRatio<=1){return}$("img[data-retina],img[gumby-retina],img[retina]").each(function(){var $this=$(this);if($this.data("isRetina")){return true}$this.data("isRetina",true);new Retina($this)})});Gumby.UIModule({module:"retina",events:["onRetina"],init:function(){Gumby.initialize("retina")}})}();!function(){"use strict";function SkipLink($el){this.$el=$el;this.targetPos=0;this.duration=Number(Gumby.selectAttr.apply(this.$el,["duration"]))||200;this.offset=Gumby.selectAttr.apply(this.$el,["offset"])||false;this.easing=Gumby.selectAttr.apply(this.$el,["easing"])||"swing";var scope=this;this.$el.on(Gumby.click+" gumby.skip",function(e){e.preventDefault();scope.calculateTarget()})}SkipLink.prototype.calculateTarget=function(){var scope=this,target=Gumby.selectAttr.apply(this.$el,["goto"]),$target;if(target=="top"){this.targetPos=0}else if($.isNumeric(target)){this.targetPos=Number(target)}else{$target=$(target);if(!$target){return false}this.targetPos=$target.offset().top}this.skipTo()};SkipLink.prototype.skipTo=function(){var scope=this;$("html,body").animate({scrollTop:this.calculateOffset()},this.duration,this.easing).promise().done(function(){scope.$el.trigger("gumby.onComplete")})};SkipLink.prototype.calculateOffset=function(){if(!this.offset){return this.targetPos}var op=this.offset.substr(0,1),off=Number(this.offset.substr(1,this.offset.length));if(op==="-"){return this.targetPos-off}else if(op==="+"){return this.targetPos+off}};Gumby.addInitalisation("skiplinks",function(){$(".skiplink > a, .skip").each(function(){var $this=$(this);if($this.data("isSkipLink")){return true}$this.data("isSkipLink",true);new SkipLink($this)})});Gumby.UIModule({module:"skiplink",events:["onComplete","skip"],init:function(){Gumby.initialize("skiplinks")}})}();!function(){"use strict";function Tabs($el){this.$el=$el;this.$nav=this.$el.find("ul.tab-nav > li");this.$content=this.$el.find(".tab-content");var scope=this;this.$nav.children("a").on(Gumby.click,function(e){e.preventDefault();scope.click($(this))});this.$el.on("gumby.set",function(e,index){scope.set(e,index)})}Tabs.prototype.click=function($this){var index=$this.parent().index();this.$nav.add(this.$content).removeClass("active");this.$nav.eq(index).add(this.$content.eq(index)).addClass("active");this.$el.trigger("gumby.onChange",index)};Tabs.prototype.set=function(e,index){this.$nav.eq(index).find("a").trigger(Gumby.click)};Gumby.addInitalisation("tabs",function(){$(".tabs").each(function(){var $this=$(this);if($this.data("isTabs")){return true}$this.data("isTabs",true);new Tabs($this)})});Gumby.UIModule({module:"tabs",events:["onChange","set"],init:function(){Gumby.initialize("tabs")}})}();!function(){"use strict";function Toggle($el){this.$el=$($el);this.targets=[];this.on="";if(this.$el.length){this.init()}}function Switch($el){this.$el=$($el);this.targets=[];this.on="";if(this.$el.length){this.init()}}Toggle.prototype.init=function(){this.targets=this.parseTargets();this.on=Gumby.selectAttr.apply(this.$el,["on"])||Gumby.click;var scope=this;this.$el.on(this.on,function(e){if($(this).prop("tagName")==="A"){e.preventDefault()}e.stopPropagation();scope.trigger(scope.triggered)}).on("gumby.trigger",function(){scope.trigger(scope.triggered)})};Toggle.prototype.parseTargets=function(){var targetStr=Gumby.selectAttr.apply(this.$el,["trigger"]),secondaryTargets=0,targets=[];if(!targetStr){return false}secondaryTargets=targetStr.indexOf("|");if(secondaryTargets===-1){return[$(targetStr)]}var targets=targetStr.split("|");return targets.length>1?[$(targets[0]),$(targets[1])]:[$(targets[0])]};Toggle.prototype.triggered=function(){var targetLength=this.targets.length,targetData=!targetLength?[this.$el.hasClass("active")]:[],i;for(i=0;i1){if(this.targets[0].hasClass("active")){this.$el.add(this.targets[0]).removeClass("active");this.targets[1].addClass("active")}else{this.targets[1].removeClass("active");this.$el.add(this.targets[0]).addClass("active")}}if(cb&&typeof cb==="function"){cb.apply(this)}};Switch.prototype.trigger=function(cb){if(!this.targets){this.$el.addClass("active")}else if(this.targets.length==1){this.$el.add(this.targets[0]).addClass("active")}else if(this.targets.length>1){this.$el.add(this.targets[0]).addClass("active");this.targets[1].removeClass("active")}if(cb&&typeof cb==="function"){cb.apply(this)}};Gumby.addInitalisation("toggles",function(){$(".toggle").each(function(){var $this=$(this);if($this.data("isToggle")){return true}$this.data("isToggle",true);new Toggle($this)})});Gumby.addInitalisation("switches",function(){$(".switch").each(function(){var $this=$(this);if($this.data("isSwitch")){return true}$this.data("isSwitch",true);new Switch($this)})});Gumby.UIModule({module:"toggleswitch",events:["trigger","onTrigger"],init:function(){Gumby.initialize("switches");Gumby.initialize("toggles")}})}();!function($){"use strict";function Validation($this,req){this.$this=$this;this.$field=this.$this.parents(".field");this.req=req||function(){return!!this.$this.val().length};var scope=this;if(this.$this.is("[type=checkbox], [type=radio]")){this.$field=this.$this.parent("label");this.$field.on("gumby.onChange",function(){scope.validate()})}else if(this.$this.is("select")){this.$field=this.$this.parents(".picker");this.$field.on("change",function(){scope.validate()})}else{this.$this.on("blur",function(e){if(e.which!==9){scope.validate()}})}}Validation.prototype.validate=function(){var result=this.req(this.$this);if(!result){this.$field.removeClass("success").addClass("danger")}else{this.$field.removeClass("danger").addClass("success")}return result};$.fn.validation=function(options){var settings=$.extend({submit:false,fail:false,required:[]},options),validations=[];return this.each(function(){if(!settings.required.length){return false}var $this=$(this),reqLength=settings.required.length,i;for(i=0;i