!function(){"use strict";function Gumby(){this.$dom=$(document);this.isOldie=!!this.$dom.find("html").hasClass("oldie");this.click="click";this.onReady=this.onOldie=this.onTouch=false;this.uiModules={};this.inits={};this.path=$("script[gumby-path]").attr("gumby-path")||"js/libs";this.breakpoint=Number($("script[gumby-breakpoint]").attr("gumby-breakpoint"))||1024}Gumby.prototype.init=function(){var scope=this;this.$dom.ready(function(){scope.initUIModules();if(scope.onReady){scope.onReady()}if(scope.isOldie&&scope.onOldie){scope.onOldie()}if(Modernizr.touch&&scope.onTouch){scope.onTouch()}})};Gumby.prototype.ready=function(code){if(code&&typeof code==="function"){this.onReady=code}};Gumby.prototype.oldie=function(code){if(code&&typeof code==="function"){this.onOldie=code}};Gumby.prototype.touch=function(code){if(code&&typeof code==="function"){this.onTouch=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 li");this.$content=this.$el.find(".tab-content");var scope=this;this.$nav.children("a").on(Gumby.click,function(e){e.stopImmediatePropagation();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 Checkbox($el){this.$el=$el;var scope=this;this.$el.on(Gumby.click,function(e){e.stopImmediatePropagation();e.preventDefault();if(scope.$el.hasClass("checked")){scope.update(false)}else{scope.update(true)}}).on("gumby.check",function(){scope.update(true)}).on("gumby.uncheck",function(){scope.update(false)});if(scope.$el.hasClass("checked")){scope.update(true)}}Checkbox.prototype.update=function(check){var $input=this.$el.find("input"),$span=this.$el.find("span");if(check){$span.append('');$input.prop("checked",true).end().addClass("checked").trigger("gumby.onCheck").trigger("gumby.onChange")}else{$input.prop("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 RadioBtn($el){this.$el=$el;var scope=this;this.$el.on(Gumby.click,function(e){e.stopImmediatePropagation();e.preventDefault();scope.update()}).on("gumby.check",function(){scope.update()});if(scope.$el.hasClass("checked")){scope.update()}}RadioBtn.prototype.update=function(){var $input=this.$el.find("input[type=radio]"),$span=this.$el.find("span"),group='input[name="'+$input.attr("name")+'"]';$(".radio").has(group).removeClass("checked").find("input").prop("checked",false).end().find("i").remove();$input.prop("checked",true);$span.append('');this.$el.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 Fixed($el){this.$el=$el;this.fixedPoint="";this.pinPoint=false;this.offset=0;this.pinOffset=0;this.top=0;this.constrainEl=true;this.state=false;this.measurements={left:0,width:0};this.setup();var scope=this;$(window).on("scroll load",function(){scope.monitorScroll()});this.$el.on("gumby.initialize",function(){scope.setup()})}Fixed.prototype.setup=function(){var scope=this;this.fixedPoint=this.parseAttrValue(Gumby.selectAttr.apply(this.$el,["fixed"]));this.pinPoint=Gumby.selectAttr.apply(this.$el,["pin"])||false;this.offset=Number(Gumby.selectAttr.apply(this.$el,["offset"]))||0;this.pinOffset=Number(Gumby.selectAttr.apply(this.$el,["pinoffset"]))||0;this.top=Number(Gumby.selectAttr.apply(this.$el,["top"]))||0;this.constrainEl=Gumby.selectAttr.apply(this.$el,["constrain"])||true;if(this.constrainEl==="false"){this.constrainEl=false}this.$parent=this.$el.parents(".columns, .column, .row");this.$parent=this.$parent.length?this.$parent.first():false;this.parentRow=this.$parent?!!this.$parent.hasClass("row"):false;if(this.pinPoint){this.pinPoint=this.parseAttrValue(this.pinPoint)}if(this.$parent&&this.constrainEl){this.measure();$(window).resize(function(){if(scope.state){scope.measure();scope.constrain()}})}};Fixed.prototype.monitorScroll=function(){var scrollAmount=$(window).scrollTop(),fixedPoint=this.fixedPoint instanceof jQuery?this.fixedPoint.offset().top:this.fixedPoint,pinPoint=false;if(this.pinPoint){pinPoint=this.pinPoint instanceof jQuery?this.pinPoint.offset().top:this.pinPoint}if(this.offset){fixedPoint-=this.offset}if(this.pinOffset){pinPoint-=this.pinOffset}if(scrollAmount>=fixedPoint&&this.state!=="fixed"){if(!pinPoint||scrollAmount=pinPoint&&this.state!=="pinned"){this.pin()}};Fixed.prototype.fix=function(){this.state="fixed";this.$el.css({top:0+this.top}).addClass("fixed").removeClass("unfixed pinned").trigger("gumby.onFixed");if(this.$parent){this.constrain()}};Fixed.prototype.unfix=function(){this.state="unfixed";this.$el.addClass("unfixed").removeClass("fixed pinned").trigger("gumby.onUnfixed")};Fixed.prototype.pin=function(){this.state="pinned";this.$el.css({top:this.$el.offset().top}).addClass("pinned fixed").removeClass("unfixed").trigger("gumby.onPinned")};Fixed.prototype.constrain=function(){this.$el.css({left:this.measurements.left,width:this.measurements.width})};Fixed.prototype.measure=function(){var offsets=this.$parent.offset(),parentPadding;this.measurements.left=offsets.left;this.measurements.width=this.$parent.width();if(this.parentRow){parentPadding=Number(this.$parent.css("paddingLeft").replace(/px/,""));if(parentPadding){this.measurements.left+=parentPadding}}};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}};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 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 a, .skip").each(function(){var $this=$(this);if($this.data("isSkipLink")&&!all){return true}else if($this.data("isSkipLink")&&all){$this.trigger("gumby.initialize");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 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(){var scope=this;this.setup();this.$el.on(this.on,function(e){e.stopImmediatePropagation();if($(this).prop("tagName")==="A"){e.preventDefault()}scope.trigger(scope.triggered)}).on("gumby.trigger",function(){scope.trigger(scope.triggered)}).on("gumby.initialize",function(){scope.setup()})};Toggle.prototype.setup=function(){this.targets=this.parseTargets();this.on=Gumby.selectAttr.apply(this.$el,["on"])||Gumby.click;this.className=Gumby.selectAttr.apply(this.$el,["classname"])||"active"};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)]}targets=targetStr.split("|");return targets.length>1?[$(targets[0]),$(targets[1])]:[$(targets[0])]};Toggle.prototype.triggered=function(){this.$el.trigger("gumby.onTrigger",[this.$el.hasClass(this.className)])};Switch.prototype=new Toggle;Toggle.prototype.trigger=function(cb){if(!this.targets){this.$el.toggleClass(this.className)}else if(this.targets.length==1){this.$el.add(this.targets[0]).toggleClass(this.className)}else if(this.targets.length>1){if(this.targets[0].hasClass(this.className)){this.$el.add(this.targets[0]).removeClass(this.className);this.targets[1].addClass(this.className)}else{this.targets[1].removeClass(this.className);this.$el.add(this.targets[0]).addClass(this.className)}}if(cb&&typeof cb==="function"){cb.apply(this)}};Switch.prototype.trigger=function(cb){if(!this.targets){this.$el.addClass(this.className)}else if(this.targets.length==1){this.$el.add(this.targets[0]).addClass(this.className)}else if(this.targets.length>1){this.$el.add(this.targets[0]).addClass(this.className);this.targets[1].removeClass(this.className)}if(cb&&typeof cb==="function"){cb.apply(this)}};Gumby.addInitalisation("toggles",function(all){$(".toggle").each(function(){var $this=$(this);if($this.data("isToggle")&&!all){return true}else if($this.data("isToggle")&&all){$this.trigger("gumby.initialize")}$this.data("isToggle",true);new Toggle($this)})});Gumby.addInitalisation("switches",function(all){$(".switch").each(function(){var $this=$(this);if($this.data("isSwitch")&&!all){return true}else if($this.data("isSwitch")&&all){$this.trigger("gumby.initialize");return true}$this.data("isSwitch",true);new Switch($this)})});Gumby.UIModule({module:"toggleswitch",events:["trigger","onTrigger"],init:function(){Gumby.initialize("switches");Gumby.initialize("toggles")}})}();Modernizr.load({test:Modernizr.touch,yep:Gumby.path+"/jquery.mobile.custom.min.js",callback:function(url,result,key){if($.mobile){window.Gumby.click+=" tap"}},complete:function(){window.Gumby.init();if(typeof define=="function"&&define.amd){define(window.Gumby)}}});