/* Bootstrap v3.2.0 (c) 2011-2014 Twitter, Inc. Licensed under MIT */
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('
').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-kg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
/* Bootstrap: offcanvas.js v3.1.3 (c) 2012-2014 Arnold Daniels Licensed under Apache */
+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.state=null,this.placement=null,this.options.recalc&&(this.calcClone(),a(window).on("resize",a.proxy(this.recalc,this))),this.options.autohide&&a(document).on("click",a.proxy(this.autohide,this)),this.options.toggle&&this.toggle(),this.options.disablescrolling&&(this.options.disableScrolling=this.options.disablescrolling,delete this.options.disablescrolling)};b.DEFAULTS={toggle:!0,placement:"auto",autohide:!0,recalc:!0,disableScrolling:!0},b.prototype.offset=function(){switch(this.placement){case"left":case"right":return this.$element.outerWidth();case"top":case"bottom":return this.$element.outerHeight()}},b.prototype.calcPlacement=function(){function e(a,b){if(d.css(b)==="auto")return a;if(d.css(a)==="auto")return b;var c=parseInt(d.css(a),10),e=parseInt(d.css(b),10);return c>e?b:a}if(this.options.placement!=="auto"){this.placement=this.options.placement;return}this.$element.hasClass("in")||this.$element.css("visiblity","hidden !important").addClass("in");var b=a(window).width()/this.$element.width(),c=a(window).height()/this.$element.height(),d=this.$element;this.placement=b>=c?e("left","right"):e("top","bottom"),this.$element.css("visibility")==="hidden !important"&&this.$element.removeClass("in").css("visiblity","")},b.prototype.opposite=function(a){switch(a){case"top":return"bottom";case"left":return"right";case"bottom":return"top";case"right":return"left"}},b.prototype.getCanvasElements=function(){var b=this.options.canvas?a(this.options.canvas):this.$element,c=b.find("*").filter(function(){return a(this).css("position")==="fixed"}).not(this.options.exclude);return b.add(c)},b.prototype.slide=function(b,c,d){if(!a.support.transition){var e={};return e[this.placement]="+="+c,b.animate(e,350,d)}var f=this.placement,g=this.opposite(f);b.each(function(){a(this).css(f)!=="auto"&&a(this).css(f,(parseInt(a(this).css(f),10)||0)+c),a(this).css(g)!=="auto"&&a(this).css(g,(parseInt(a(this).css(g),10)||0)-c)}),this.$element.one(a.support.transition.end,d).emulateTransitionEnd(350)},b.prototype.disableScrolling=function(){var b=a("body").width(),c="padding-"+this.opposite(this.placement);a("body").data("offcanvas-style")===undefined&&a("body").data("offcanvas-style",a("body").attr("style")||""),a("body").css("overflow","hidden");if(a("body").width()>b){var d=parseInt(a("body").css(c),10)+a("body").width()-b;setTimeout(function(){a("body").css(c,d)},1)}},b.prototype.show=function(){if(this.state)return;var b=a.Event("show.bs.offcanvas");this.$element.trigger(b);if(b.isDefaultPrevented())return;this.state="slide-in",this.calcPlacement();var c=this.getCanvasElements(),d=this.placement,e=this.opposite(d),f=this.offset();c.index(this.$element)!==-1&&(a(this.$element).data("offcanvas-style",a(this.$element).attr("style")||""),this.$element.css(d,-1*f),this.$element.css(d)),c.addClass("canvas-sliding").each(function(){a(this).data("offcanvas-style")===undefined&&a(this).data("offcanvas-style",a(this).attr("style")||""),a(this).css("position")==="static"&&a(this).css("position","relative"),(a(this).css(d)==="auto"||a(this).css(d)==="0px")&&(a(this).css(e)==="auto"||a(this).css(e)==="0px")&&a(this).css(d,0)}),this.options.disableScrolling&&this.disableScrolling();var g=function(){if(this.state!="slide-in")return;this.state="slid",c.removeClass("canvas-sliding").addClass("canvas-slid"),this.$element.trigger("shown.bs.offcanvas")};setTimeout(a.proxy(function(){this.$element.addClass("in"),this.slide(c,f,a.proxy(g,this))},this),1)},b.prototype.hide=function(b){if(this.state!=="slid")return;var c=a.Event("hide.bs.offcanvas");this.$element.trigger(c);if(c.isDefaultPrevented())return;this.state="slide-out";var d=a(".canvas-slid"),e=this.placement,f=-1*this.offset(),g=function(){if(this.state!="slide-out")return;this.state=null,this.placement=null,this.$element.removeClass("in"),d.removeClass("canvas-sliding"),d.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")}),this.$element.trigger("hidden.bs.offcanvas")};d.removeClass("canvas-slid").addClass("canvas-sliding"),setTimeout(a.proxy(function(){this.slide(d,f,a.proxy(g,this))},this),1)},b.prototype.toggle=function(){if(this.state==="slide-in"||this.state==="slide-out")return;this[this.state==="slid"?"hide":"show"]()},b.prototype.calcClone=function(){this.$calcClone=this.$element.clone().html("").addClass("offcanvas-clone").removeClass("in").appendTo(a("body"))},b.prototype.recalc=function(){if(this.$calcClone.css("display")==="none"||this.state!=="slid"&&this.state!=="slide-in")return;this.state=null,this.placement=null;var b=this.getCanvasElements();this.$element.removeClass("in"),b.removeClass("canvas-slid"),b.add(this.$element).add("body").each(function(){a(this).attr("style",a(this).data("offcanvas-style")).removeData("offcanvas-style")})},b.prototype.autohide=function(b){a(b.target).closest(this.$element).length===0&&this.hide()};var c=a.fn.offcanvas;a.fn.offcanvas=function(c){return this.each(function(){var d=a(this),e=d.data("bs.offcanvas"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c);e||d.data("bs.offcanvas",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.offcanvas.Constructor=b,a.fn.offcanvas.noConflict=function(){return a.fn.offcanvas=c,this},a(document).on("click.bs.offcanvas.data-api","[data-toggle=offcanvas]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.offcanvas"),h=g?"toggle":c.data();b.stopPropagation(),g?g.toggle():f.offcanvas(h)})}(window.jQuery)
/*============================================
Navigation
==============================================*/
$('.nav-toggle').on('touchstart click', function(e) {
e.preventDefault();
$( this ).toggleClass( 'active' );
});
$(function dw_hidenav() {
var headerHeight = $('.navbar').height();
$(window).on('scroll', { previousTop: 0 },
function() {
var currentTop = $(window).scrollTop();
if (currentTop < this.previousTop) {
if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
$('.navbar').addClass('visible');
} else {
$('.navbar').removeClass('visible fixed');
}
}
else {
$('.navbar').removeClass('visible');
if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
}
this.previousTop = currentTop;
}
);
});
/*============================================
Conditional Logic
==============================================*/
var __gf_timeout_handle;
function gf_apply_rules(formId, fields, isInit){
var rule_applied = 0;
for(var i=0; i < fields.length; i++){
gf_apply_field_rule(formId, fields[i], isInit, function(){
rule_applied++;
if(rule_applied == fields.length){
jQuery(document).trigger('gform_post_conditional_logic', [formId, fields, isInit]);
if(window["gformCalculateTotalPrice"])
window["gformCalculateTotalPrice"](formId);
}
});
}
}
function gf_check_field_rule(formId, fieldId, isInit, callback){
//if conditional logic is not specified for that field, it is supposed to be displayed
if(!window["gf_form_conditional_logic"] || !window["gf_form_conditional_logic"][formId] || !window["gf_form_conditional_logic"][formId]["logic"][fieldId])
return "show";
var conditionalLogic = window["gf_form_conditional_logic"][formId]["logic"][fieldId];
var action = gf_get_field_action(formId, conditionalLogic["section"]);
//If section is hidden, always hide field. If section is displayed, see if field is supposed to be displayed or hidden
if(action != "hide")
action = gf_get_field_action(formId, conditionalLogic["field"]);
return action;
}
function gf_apply_field_rule(formId, fieldId, isInit, callback){
var action = gf_check_field_rule(formId, fieldId, isInit, callback);
gf_do_field_action(formId, action, fieldId, isInit, callback);
var conditionalLogic = window["gf_form_conditional_logic"][formId]["logic"][fieldId];
//perform conditional logic for the next button
if(conditionalLogic["nextButton"]){
action = gf_get_field_action(formId, conditionalLogic["nextButton"]);
gf_do_next_button_action(formId, action, fieldId, isInit);
}
}
function gf_get_field_action(formId, conditionalLogic){
if(!conditionalLogic)
return "show";
var matches = 0;
for(var i = 0; i < conditionalLogic["rules"].length; i++){
var rule = conditionalLogic["rules"][i];
if(gf_is_match(formId, rule))
matches++;
}
var action;
if( (conditionalLogic["logicType"] == "all" && matches == conditionalLogic["rules"].length) || (conditionalLogic["logicType"] == "any" && matches > 0) )
action = conditionalLogic["actionType"];
else
action = conditionalLogic["actionType"] == "show" ? "hide" : "show";
return action;
}
function gf_is_match(formId, rule){
var isMatch = false;
var inputs = jQuery("#input_" + formId + "_" + rule["fieldId"] + " input");
var fieldValue;
if(inputs.length > 0){
//handling checkboxes/radio
for(var i=0; i< inputs.length; i++){
fieldValue = gf_get_value(jQuery(inputs[i]).val());
//find specific checkbox/radio item. Skip if this is not the specific item and the operator is not one that targets a range of values (i.e. greater than and less than)
var isRangeOperator = jQuery.inArray(rule["operator"], ["<", ">", "contains", "starts_with", "ends_with"]) >= 0;
if(fieldValue != rule["value"] && !isRangeOperator) {
continue;
}
//blank value if item isn't checked
if(!jQuery(inputs[i]).is(":checked")) {
fieldValue = "";
}
else if (fieldValue == "gf_other_choice"){
//get the value from the associated text box
fieldValue = jQuery("#input_" + formId + "_" + rule["fieldId"] + "_other").val();
}
if(gf_matches_operation(fieldValue, rule["value"], rule["operator"]))
isMatch = true;
}
}
else{
//handling all other fields (non-checkboxes)
var val = jQuery("#input_" + formId + "_" + rule["fieldId"]).val();
//transform regular value into array to support multi-select (which returns an array of selected items)
var values = (val instanceof Array) ? val : [val];
var matchCount = 0;
var fieldNumberFormat = window['gf_global'] && gf_global.number_formats && gf_global.number_formats[formId] && gf_global.number_formats[formId][rule["fieldId"]] ? gf_global.number_formats[formId][rule["fieldId"]] : false;
for(var i=0; i < values.length; i++){
//fields with pipes in the value will use the label for conditional logic comparison
var hasLabel = values[i] ? values[i].indexOf("|") >= 0 : true;
fieldValue = gf_get_value(values[i]);
var decimalSeparator = ".";
if( fieldNumberFormat && !hasLabel){
if( fieldNumberFormat == "currency" )
decimalSeparator = gformGetDecimalSeparator('currency');
else if( fieldNumberFormat == "decimal_comma")
decimalSeparator = ",";
else if( fieldNumberFormat == "decimal_dot")
decimalSeparator = ".";
//transform to a decimal dot number
fieldValue = gformCleanNumber( fieldValue, '', '', decimalSeparator);
//now transform to number specified by locale
if(window['gf_number_format'] && window['gf_number_format'] == "decimal_comma")
fieldValue = gformFormatNumber(fieldValue, -1, ",", ".");
if( ! fieldValue )
fieldValue = 0;
fieldValue = fieldValue.toString();
}
if(gf_matches_operation(fieldValue, rule["value"], rule["operator"])){
matchCount++;
}
}
//If operator is Is Not, none of the value can match
isMatch = rule["operator"] == "isnot" ? matchCount == values.length : matchCount > 0;
}
return gform.applyFilters( 'gform_is_value_match', isMatch, formId, rule );
}
function gf_try_convert_float(text){
var format = window["gf_number_format"] == "decimal_comma" ? "decimal_comma" : "decimal_dot";
if(gformIsNumeric(text, format)){
var decimal_separator = format == "decimal_comma" ? "," : ".";
return gformCleanNumber(text, "", "", decimal_separator);
}
return text;
}
function gf_matches_operation(val1, val2, operation){
val1 = val1 ? val1.toLowerCase() : "";
val2 = val2 ? val2.toLowerCase() : "";
switch(operation){
case "is" :
return val1 == val2;
break;
case "isnot" :
return val1 != val2;
break;
case ">" :
val1 = gf_try_convert_float(val1);
val2 = gf_try_convert_float(val2);
return gformIsNumber(val1) && gformIsNumber(val2) ? val1 > val2 : false;
break;
case "<" :
val1 = gf_try_convert_float(val1);
val2 = gf_try_convert_float(val2);
return gformIsNumber(val1) && gformIsNumber(val2) ? val1 < val2 : false;
break;
case "contains" :
return val1.indexOf(val2) >=0;
break;
case "starts_with" :
return val1.indexOf(val2) ==0;
break;
case "ends_with" :
var start = val1.length - val2.length;
if(start < 0)
return false;
var tail = val1.substring(start);
return val2 == tail;
break;
}
return false;
}
function gf_get_value(val){
if(!val)
return "";
val = val.split("|");
return val[0];
}
function gf_do_field_action(formId, action, fieldId, isInit, callback){
var conditional_logic = window["gf_form_conditional_logic"][formId];
var dependent_fields = conditional_logic["dependents"][fieldId];
for(var i=0; i < dependent_fields.length; i++){
var targetId = fieldId == 0 ? "#gform_submit_button_" + formId : "#field_" + formId + "_" + dependent_fields[i];
//calling callback function on the last dependent field, to make sure it is only called once
do_callback = (i+1) == dependent_fields.length ? callback : null;
gf_do_action(action, targetId, conditional_logic["animation"], conditional_logic["defaults"][dependent_fields[i]], isInit, do_callback);
}
}
function gf_do_next_button_action(formId, action, fieldId, isInit){
var conditional_logic = window["gf_form_conditional_logic"][formId];
var targetId = "#gform_next_button_" + formId + "_" + fieldId;
gf_do_action(action, targetId, conditional_logic["animation"], null, isInit);
}
function gf_do_action(action, targetId, useAnimation, defaultValues, isInit, callback){
var $target = jQuery(targetId);
if(action == "show"){
if(useAnimation && !isInit){
if($target.length > 0){
$target.slideDown(callback);
} else if(callback){
callback();
}
}
else{
//$target.show();
//Getting around an issue with Chrome on Android. Does not like jQuery('xx').show() ...
$target.css('display', 'block');
if(callback){
callback();
}
}
}
else{
//if field is not already hidden, reset its values to the default
var child = $target.children().first();
if (child.length > 0){
if(!gformIsHidden(child)){
gf_reset_to_default(targetId, defaultValues);
}
}
if(useAnimation && !isInit){
if($target.length > 0 && $target.is(":visible")) {
$target.slideUp(callback);
} else if(callback) {
callback();
}
} else{
$target.hide();
if(callback){
callback();
}
}
}
}
function gf_reset_to_default(targetId, defaultValue){
var dateFields = jQuery(targetId).find('.gfield_date_month input[type="text"], .gfield_date_day input[type="text"], .gfield_date_year input[type="text"], .gfield_date_dropdown_month select, .gfield_date_dropdown_day select, .gfield_date_dropdown_year select');
var dateIndex = 0;
if(dateFields.length > 0){
dateFields.each(function(){
if(defaultValue){
val = defaultValue.split(/[\.\/-]+/)[dateIndex];
dateIndex++;
}
else{
val = "";
}
var element = jQuery(this);
if(element.prop("tagName") == "SELECT")
val = parseInt(val);
if(element.val() != val)
element.val(val).trigger("change");
else
element.val(val);
});
return;
}
//cascading down conditional logic to children to suppport nested conditions
//text fields and drop downs
var target = jQuery(targetId).find('select, input[type="text"], input[type="number"], textarea');
var target_index = 0;
target.each(function(){
var val = "";
var element = jQuery(this);
if(element.is('select:not([multiple])')){
val = element.find('option' ).not( ':disabled' ).eq(0).val();
}
//get name of previous input field to see if it is the radio button which goes with the "Other" text box
//otherwise field is populated with input field name
var radio_button_name = element.prev("input").attr("value");
if(radio_button_name == "gf_other_choice"){
val = element.attr("value");
}
else if(jQuery.isArray(defaultValue)){
val = defaultValue[target_index];
}
else if(jQuery.isPlainObject(defaultValue)){
val = defaultValue[element.attr("name")];
}
else if(defaultValue){
val = defaultValue;
}
if(element.val() != val)
element.val(val).trigger('change');
else
element.val(val);
target_index++;
});
//checkboxes and radio buttons
var elements = jQuery(targetId).find('input[type="radio"], input[type="checkbox"]');
elements.each(function(){
//is input currently checked?
var isChecked = jQuery(this).is(':checked') ? true : false;
//does input need to be marked as checked or unchecked?
var doCheck = defaultValue ? jQuery.inArray(jQuery(this).attr('id'), defaultValue) > -1 : false;
//if value changed, trigger click event
if(isChecked != doCheck){
//setting input as checked or unchecked appropriately
if(jQuery(this).attr("type") == "checkbox"){
jQuery(this).trigger('click');
}
else{
jQuery(this).prop("checked", doCheck);
//need to set the prop again after the click is triggered
jQuery(this).trigger('click').prop('checked', doCheck);
}
}
});
}
/*============================================
jQuery JSON
==============================================*/
(function($) {
function toIntegersAtLease(n)
// Format integers to have at least two digits.
{
return n < 10 ? '0' + n : n;
}
Date.prototype.toJSON = function(date)
// Yes, it polutes the Date namespace, but we'll allow it here, as
// it's damned usefull.
{
return this.getUTCFullYear() + '-' +
toIntegersAtLease(this.getUTCMonth()) + '-' +
toIntegersAtLease(this.getUTCDate());
};
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
var meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
$.quoteString = function(string)
// Places quotes around a string, inteligently.
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
{
//if (escapeable.test(string))
//{
return '"' + string.replace(escapeable, function (a)
{
var c = meta[a];
if (typeof c === 'string') {
return c;
}
c = a.charCodeAt();
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
}) + '"';
//}
//else{
// string = string.replace('\n','\\n');
//}
return '"' + string + '"';
};
$.toJSON = function(o, compact)
{
var type = typeof(o);
if (type == "undefined")
return "undefined";
else if (type == "number" || type == "boolean")
return o + "";
else if (o === null)
return "null";
// Is it a string?
if (type == "string")
{
var str = $.quoteString(o);
return str;
}
// Does it have a .toJSON function?
if (type == "object" && typeof o.toJSON == "function")
return o.toJSON(compact);
// Is it an array?
if (type != "function" && typeof(o.length) == "number")
{
var ret = [];
for (var i = 0; i < o.length; i++) {
ret.push( $.toJSON(o[i], compact) );
}
if (compact)
return "[" + ret.join(",") + "]";
else
return "[" + ret.join(", ") + "]";
}
// If it's a function, we have to warn somebody!
if (type == "function") {
throw new TypeError("Unable to convert object of type 'function' to json.");
}
// It's probably an object, then.
var ret = [];
for (var k in o) {
var name;
type = typeof(k);
if (type == "number")
name = '"' + k + '"';
else if (type == "string")
name = $.quoteString(k);
else
continue; //skip non-string or number keys
var val = $.toJSON(o[k], compact);
if (typeof(val) != "string") {
// skip non-serializable values
continue;
}
if (compact)
ret.push(name + ":" + val);
else
ret.push(name + ": " + val);
}
return "{" + ret.join(", ") + "}";
};
$.compactJSON = function(o)
{
return $.toJSON(o, true);
};
$.evalJSON = function(src)
// Evals JSON that we know to be safe.
{
return eval("(" + src + ")");
};
$.secureEvalJSON = function(src)
// Evals JSON in a way that is *more* secure.
{
var filtered = src;
filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
if (/^[\],:{}\s]*$/.test(filtered))
return eval("(" + src + ")");
else
throw new SyntaxError("Error parsing JSON, source is not valid.");
};
})(jQuery);
/*============================================
Placeholders.js v2.1.1
==============================================*/
(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(D)?(t.setAttribute(D,"false"),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(z),n&&(t.setAttribute("maxLength",n),t.removeAttribute(z)),r=t.getAttribute(I),r&&(t.type=r),!0):!1}function n(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(D,"true"),t.value=n,t.className+=" "+k,r=t.getAttribute(z),r||(t.setAttribute(z,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(I),e?t.type="text":"password"===t.type&&K.changeType(t,"text")&&t.setAttribute(I,"password"),!0):!1}function a(t,e){var r,n,a,u,i;if(t&&t.getAttribute(V))e(t);else for(r=t?t.getElementsByTagName("input"):p,n=t?t.getElementsByTagName("textarea"):h,i=0,u=r.length+n.length;u>i;i++)a=r.length>i?r[i]:n[i-r.length],e(a)}function u(t){a(t,r)}function i(t){a(t,n)}function l(t){return function(){b&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)?K.moveCaret(t,0):r(t)}}function o(t){return function(){n(t)}}function c(t){return function(e){return m=t.value,"true"===t.getAttribute(D)&&m===t.getAttribute(V)&&K.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function s(t){return function(){r(t,m),""===t.value&&(t.blur(),K.moveCaret(t,0))}}function d(t){return function(){t===document.activeElement&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)&&K.moveCaret(t,0)}}function g(t){return function(){u(t)}}function v(t){t.form&&(L=t.form,L.getAttribute(P)||(K.addEventListener(L,"submit",g(L)),L.setAttribute(P,"true"))),K.addEventListener(t,"focus",l(t)),K.addEventListener(t,"blur",o(t)),b&&(K.addEventListener(t,"keydown",c(t)),K.addEventListener(t,"keyup",s(t)),K.addEventListener(t,"click",d(t))),t.setAttribute(U,"true"),t.setAttribute(V,E),n(t)}var p,h,b,f,m,A,y,E,x,L,T,N,S,w=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],B="#ccc",k="placeholdersjs",R=RegExp("(?:^|\\s)"+k+"(?!\\S)"),V="data-placeholder-value",D="data-placeholder-active",I="data-placeholder-type",P="data-placeholder-submit",U="data-placeholder-bound",j="data-placeholder-focus",q="data-placeholder-live",z="data-placeholder-maxlength",F=document.createElement("input"),G=document.getElementsByTagName("head")[0],H=document.documentElement,J=t.Placeholders,K=J.Utils;if(J.nativeSupport=void 0!==F.placeholder,!J.nativeSupport){for(p=document.getElementsByTagName("input"),h=document.getElementsByTagName("textarea"),b="false"===H.getAttribute(j),f="false"!==H.getAttribute(q),A=document.createElement("style"),A.type="text/css",y=document.createTextNode("."+k+" { color:"+B+"; }"),A.styleSheet?A.styleSheet.cssText=y.nodeValue:A.appendChild(y),G.insertBefore(A,G.firstChild),S=0,N=p.length+h.length;N>S;S++)T=p.length>S?p[S]:h[S-p.length],E=T.attributes.placeholder,E&&(E=E.nodeValue,E&&K.inArray(w,T.type)&&v(T));x=setInterval(function(){for(S=0,N=p.length+h.length;N>S;S++)T=p.length>S?p[S]:h[S-p.length],E=T.attributes.placeholder,E&&(E=E.nodeValue,E&&K.inArray(w,T.type)&&(T.getAttribute(U)||v(T),(E!==T.getAttribute(V)||"password"===T.type&&!T.getAttribute(I))&&("password"===T.type&&!T.getAttribute(I)&&K.changeType(T,"text")&&T.setAttribute(I,"password"),T.value===T.getAttribute(V)&&(T.value=E),T.setAttribute(V,E))));f||clearInterval(x)},100)}J.disable=J.nativeSupport?e:u,J.enable=J.nativeSupport?e:i}(this);
/*============================================
Gravity Forms
==============================================*/
// "prop" method fix for previous versions of jQuery (1.5 and below)
if( typeof jQuery.fn.prop === 'undefined' ) {
jQuery.fn.prop = jQuery.fn.attr;
}
//Formatting free form currency fields to currency
jQuery(document).ready(function(){
jQuery(document).bind('gform_post_render', gformBindFormatPricingFields);
});
function gformBindFormatPricingFields(){
jQuery(".ginput_amount, .ginput_donation_amount").bind("change", function(){
gformFormatPricingField(this);
});
jQuery(".ginput_amount, .ginput_donation_amount").each(function(){
gformFormatPricingField(this);
});
}
//------------------------------------------------
//---------- CURRENCY ----------------------------
//------------------------------------------------
function Currency(currency){
this.currency = currency;
this.toNumber = function(text){
if(this.isNumeric(text))
return parseFloat(text);
return gformCleanNumber(text, this.currency["symbol_right"], this.currency["symbol_left"], this.currency["decimal_separator"]);
};
this.toMoney = function(number){
if(!this.isNumeric(number))
number = this.toNumber(number);
if(number === false)
return "";
number = number + "";
negative = "";
if(number[0] == "-"){
negative = "-";
number = parseFloat(number.substr(1));
}
money = this.numberFormat(number, this.currency["decimals"], this.currency["decimal_separator"], this.currency["thousand_separator"]);
var symbol_left = this.currency["symbol_left"] ? this.currency["symbol_left"] + this.currency["symbol_padding"] : "";
var symbol_right = this.currency["symbol_right"] ? this.currency["symbol_padding"] + this.currency["symbol_right"] : "";
money = negative + this.htmlDecode(symbol_left) + money + this.htmlDecode(symbol_right);
return money;
};
this.numberFormat = function(number, decimals, dec_point, thousands_sep, padded){
var padded = typeof padded == 'undefined';
number = (number+'').replace(',', '').replace(' ', '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
var k = Math.pow(10, prec);
return '' + Math.round(n * k) / k;
};
if(decimals == '0') {
s = ('' + Math.round(n)).split('.');
} else
if(decimals == -1) {
s = ('' + n).split('.');
} else {
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
s = toFixedFix(n, prec).split('.');
}
if (s[0].length > 3) {
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
}
if(padded) {
if ((s[1] || '').length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1).join('0');
}
}
return s.join(dec);
}
this.isNumeric = function(number){
return gformIsNumber(number);
};
this.htmlDecode = function(text) {
var c,m,d = text;
// look for numerical entities "
var arr=d.match(/[0-9]{1,5};/g);
// if no matches found in string then skip
if(arr!=null){
for(var x=0;x= -32768 && c <= 65535){
// decode every single match within string
d = d.replace(m, String.fromCharCode(c));
}else{
d = d.replace(m, ""); //invalid so replace with nada
}
}
}
return d;
};
}
function gformCleanNumber(text, symbol_right, symbol_left, decimal_separator){
//converting to a string if a number as passed
text = text + " ";
//Removing symbol in unicode format (i.e. ᅜ)
text = text.replace(/&.*?;/, "", text);
//Removing symbol from text
text = text.replace(symbol_right, "");
text = text.replace(symbol_left, "");
//Removing all non-numeric characters
var clean_number = "";
var is_negative = false;
for(var i=0; i= 0 && parseInt(digit) <= 9) || digit == decimal_separator )
clean_number += digit;
else if(digit == '-')
is_negative = true;
}
//Removing thousand separators but keeping decimal point
var float_number = "";
for(var i=0; i= '0' && char <= '9')
float_number += char;
else if(char == decimal_separator){
float_number += ".";
}
}
if(is_negative)
float_number = "-" + float_number;
return gformIsNumber(float_number) ? parseFloat(float_number) : false;
}
function gformGetDecimalSeparator(numberFormat){
var s;
switch (numberFormat){
case 'currency' :
var currency = new Currency(gf_global.gf_currency_config);
s = currency.currency["decimal_separator"];
break;
case 'decimal_comma' :
s = ',';
break;
default :
s = "."
}
return s;
}
function gformIsNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function gformIsNumeric(value, number_format){
switch(number_format){
case "decimal_dot" :
var r = new RegExp("^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]+)?)$");
return r.test(value);
break;
case "decimal_comma" :
var r = new RegExp("^(-?[0-9]{1,3}(?:\.?[0-9]{3})*(?:,[0-9]+)?)$");
return r.test(value);
break;
}
return false;
}
//------------------------------------------------
//---------- MULTI-PAGE --------------------------
//------------------------------------------------
function gformDeleteUploadedFile(formId, fieldId, deleteButton){
var parent = jQuery("#field_" + formId + "_" + fieldId);
var fileIndex = jQuery(deleteButton).parent().index();
parent.find(".ginput_preview").eq(fileIndex).remove();
//displaying single file upload field
parent.find("input[type=\"file\"]").removeClass("gform_hidden");
//displaying post image label
parent.find(".ginput_post_image_file").show();
//clearing post image meta fields
parent.find("input[type=\"text\"]").val('');
//removing file from uploaded meta
var files = jQuery.secureEvalJSON(jQuery('#gform_uploaded_files_' + formId).val());
if(files){
var inputName = "input_" + fieldId;
var $multfile = parent.find("#gform_multifile_upload_" + formId + "_" + fieldId );
if( $multfile.length > 0 ) {
files[inputName].splice(fileIndex, 1);
var settings = $multfile.data('settings');
var max = settings.gf_vars.max_files;
jQuery("#" + settings.gf_vars.message_id).html('');
if(files[inputName].length < max)
gfMultiFileUploader.toggleDisabled(settings, false);
} else {
files[inputName] = null;
}
jQuery('#gform_uploaded_files_' + formId).val(jQuery.toJSON(files));
}
}
//------------------------------------------------
//---------- PRICE -------------------------------
//------------------------------------------------
var _gformPriceFields = new Array();
var _anyProductSelected;
function gformIsHidden(element){
return element.parents('.gfield').not(".gfield_hidden_product").css("display") == "none";
}
function gformCalculateTotalPrice(formId){
if(!_gformPriceFields[formId])
return;
var price = 0;
_anyProductSelected = false; //Will be used by gformCalculateProductPrice().
for(var i=0; i<_gformPriceFields[formId].length; i++){
price += gformCalculateProductPrice(formId, _gformPriceFields[formId][i]);
}
//add shipping price if a product has been selected
if(_anyProductSelected){
//shipping price
var shipping = gformGetShippingPrice(formId)
price += shipping;
}
//gform_product_total filter. Allows uers to perform custom price calculation
if(window["gform_product_total"])
price = window["gform_product_total"](formId, price);
price = gform.applyFilters('gform_product_total', price, formId);
//updating total
var totalElement = jQuery(".ginput_total_" + formId);
if(totalElement.length > 0){
totalElement.next().val(price);
totalElement.html(gformFormatMoney(price));
}
}
function gformGetShippingPrice(formId){
var shippingField = jQuery(".gfield_shipping_" + formId + " input[type=\"hidden\"], .gfield_shipping_" + formId + " select, .gfield_shipping_" + formId + " input:checked");
var shipping = 0;
if(shippingField.length == 1 && !gformIsHidden(shippingField)){
if(shippingField.attr("type") && shippingField.attr("type").toLowerCase() == "hidden")
shipping = shippingField.val();
else
shipping = gformGetPrice(shippingField.val());
}
return gformToNumber(shipping);
}
function gformGetFieldId(element){
var id = jQuery(element).attr("id");
var pieces = id.split("_");
if(pieces.length <=0)
return 0;
var fieldId = pieces[pieces.length-1];
return fieldId;
}
function gformCalculateProductPrice(form_id, productFieldId){
var price = gformGetBasePrice(form_id, productFieldId);
var suffix = "_" + form_id + "_" + productFieldId;
//Drop down auto-calculating labels
jQuery(".gfield_option" + suffix + ", .gfield_shipping_" + form_id).find("select").each(function(){
var dropdown_field = jQuery(this);
var selected_price = gformGetPrice(dropdown_field.val());
var field_id = dropdown_field.attr("id").split("_")[2];
dropdown_field.children("option").each(function(){
var choice_element = jQuery(this);
var label = gformGetOptionLabel(choice_element, choice_element.val(), selected_price, form_id, field_id);
choice_element.html(label);
});
});
//Checkboxes labels with prices
jQuery(".gfield_option" + suffix).find(".gfield_checkbox").find("input").each(function(){
var checkbox_item = jQuery(this);
var id = checkbox_item.attr("id");
var field_id = id.split("_")[2];
var label_id = id.replace("choice_", "#label_");
var label_element = jQuery(label_id);
var label = gformGetOptionLabel(label_element, checkbox_item.val(), 0, form_id, field_id);
label_element.html(label);
});
//Radio button auto-calculating lables
jQuery(".gfield_option" + suffix + ", .gfield_shipping_" + form_id).find(".gfield_radio").each(function(){
var selected_price = 0;
var radio_field = jQuery(this);
var id = radio_field.attr("id");
var fieldId = id.split("_")[2];
var selected_value = radio_field.find("input:checked").val();
if(selected_value)
selected_price = gformGetPrice(selected_value);
jQuery(this).find("input").each(function(){
var radio_item = jQuery(this);
var label_id = radio_item.attr("id").replace("choice_", "#label_");
var label_element = jQuery(label_id);
var label = gformGetOptionLabel(label_element, radio_item.val(), selected_price, form_id, fieldId);
label_element.html(label);
});
});
jQuery(".gfield_option" + suffix).find("input:checked, select").each(function(){
if(!gformIsHidden(jQuery(this)))
price += gformGetPrice(jQuery(this).val());
});
var quantity = gformGetProductQuantity( form_id, productFieldId );
//setting global variable if quantity is more than 0 (a product was selected). Will be used when calculating total
if(quantity > 0)
_anyProductSelected = true;
price = price * quantity;
price = Math.round(price * 100) / 100;
return price;
}
function gformGetProductQuantity( formId, productFieldId ) {
var quantity,
quantityInput = jQuery( '#ginput_quantity_' + formId + '_' + productFieldId);
if( quantityInput.length > 0 ) {
quantity = ! gformIsNumber( quantityInput.val() ) ? 0 : quantityInput.val();
} else {
quantityElement = jQuery( '.gfield_quantity_' + formId + '_' + productFieldId);
quantity = 1;
if( quantityElement.find( 'select' ).length > 0 ) {
quantity = quantityElement.find( 'select' ).val();
} else if( quantityElement.find( 'input' ).length > 0 ) {
quantity = quantityElement.find( 'input' ).val();
}
if( ! gformIsNumber( quantity ) )
quantity = 0;
}
quantity = parseFloat( quantity );
return quantity;
}
function gformGetBasePrice(formId, productFieldId){
var suffix = "_" + formId + "_" + productFieldId;
var price = 0;
var productField = jQuery("#ginput_base_price" + suffix+ ", .gfield_donation" + suffix + " input[type=\"text\"], .gfield_product" + suffix + " .ginput_amount");
if(productField.length > 0){
price = productField.val();
//If field is hidden by conditional logic, don't count it for the total
if(gformIsHidden(productField)){
price = 0;
}
}
else
{
productField = jQuery(".gfield_product" + suffix + " select, .gfield_product" + suffix + " input:checked, .gfield_donation" + suffix + " select, .gfield_donation" + suffix + " input:checked");
var val = productField.val();
if(val){
val = val.split("|");
price = val.length > 1 ? val[1] : 0;
}
//If field is hidden by conditional logic, don't count it for the total
if(gformIsHidden(productField))
price = 0;
}
var c = new Currency(gf_global.gf_currency_config);
price = c.toNumber(price);
return price === false ? 0 : price;
}
function gformFormatMoney(text){
if(!gf_global.gf_currency_config)
return text;
var currency = new Currency(gf_global.gf_currency_config);
return currency.toMoney(text);
}
function gformFormatPricingField(element){
if(gf_global.gf_currency_config){
var currency = new Currency(gf_global.gf_currency_config);
var price = currency.toMoney(jQuery(element).val());
jQuery(element).val(price);
}
}
function gformToNumber(text){
var currency = new Currency(gf_global.gf_currency_config);
return currency.toNumber(text);
}
function gformGetPriceDifference(currentPrice, newPrice){
//getting price difference
var diff = parseFloat(newPrice) - parseFloat(currentPrice);
price = gformFormatMoney(diff);
if(diff > 0)
price = "+" + price;
return price;
}
function gformGetOptionLabel(element, selected_value, current_price, form_id, field_id){
element = jQuery(element);
var price = gformGetPrice(selected_value);
var current_diff = element.attr('price');
var original_label = element.html().replace(//i, "").replace(current_diff, "");
var diff = gformGetPriceDifference(current_price, price);
diff = gformToNumber(diff) == 0 ? "" : " " + diff;
element.attr('price', diff);
//don't add for drop down items (not supported)
var price_label = element[0].tagName.toLowerCase() == "option" ? " " + diff : "" + diff + "";
var label = original_label + price_label;
//calling hook to allow for custom option formatting
if(window["gform_format_option_label"])
label = gform_format_option_label(label, original_label, price_label, current_price, price, form_id, field_id);
return label;
}
function gformGetProductIds(parent_class, element){
var classes = jQuery(element).hasClass(parent_class) ? jQuery(element).attr("class").split(" ") : jQuery(element).parents("." + parent_class).attr("class").split(" ");
for(var i=0; i 1 && currency.toNumber(val[1]) !== false)
return currency.toNumber(val[1]);
return 0;
}
function gformRegisterPriceField(item){
if(!_gformPriceFields[item.formId])
_gformPriceFields[item.formId] = new Array();
//ignore price fields that have already been registered
for(var i=0; i<_gformPriceFields[item.formId].length; i++)
if(_gformPriceFields[item.formId][i] == item.productFieldId)
return;
//registering new price field
_gformPriceFields[item.formId].push(item.productFieldId);
}
function gformInitPriceFields(){
jQuery(".gfield_price").each(function(){
var productIds = gformGetProductIds("gfield_price", this);
gformRegisterPriceField(productIds);
jQuery(this).find("input[type=\"text\"], input[type=\"number\"], select").change(function(){
var productIds = gformGetProductIds("gfield_price", this);
if(productIds.formId == 0)
productIds = gformGetProductIds("gfield_shipping", this);
jQuery(document).trigger('gform_price_change', [productIds, this]);
gformCalculateTotalPrice(productIds.formId);
});
jQuery(this).find("input[type=\"radio\"], input[type=\"checkbox\"]").click(function(){
var productIds = gformGetProductIds("gfield_price", this);
if(productIds.formId == 0)
productIds = gformGetProductIds("gfield_shipping", this);
jQuery(document).trigger('gform_price_change', [productIds, this]);
gformCalculateTotalPrice(productIds.formId);
});
});
for(formId in _gformPriceFields){
//needed when implementing for in loops
if(!_gformPriceFields.hasOwnProperty(formId))
continue;
gformCalculateTotalPrice(formId);
}
}
//-------------------------------------------
//---------- PASSWORD -----------------------
//-------------------------------------------
function gformShowPasswordStrength(fieldId){
var password = jQuery("#" + fieldId).val();
var confirm = jQuery("#" + fieldId + "_2").val();
var result = gformPasswordStrength(password, confirm);
var text = window['gf_text']["password_" + result];
jQuery("#" + fieldId + "_strength").val(result);
jQuery("#" + fieldId + "_strength_indicator").removeClass("blank mismatch short good bad strong").addClass(result).html(text);
}
// Password strength meter
function gformPasswordStrength(password1, password2) {
var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, mismatch = 5, symbolSize = 0, natLog, score;
if(password1.length <=0)
return "blank";
// password 1 != password 2
if ( (password1 != password2) && password2.length > 0)
return "mismatch";
//password < 4
if ( password1.length < 4 )
return "short";
if ( password1.match(/[0-9]/) )
symbolSize +=10;
if ( password1.match(/[a-z]/) )
symbolSize +=26;
if ( password1.match(/[A-Z]/) )
symbolSize +=26;
if ( password1.match(/[^a-zA-Z0-9]/) )
symbolSize +=31;
natLog = Math.log( Math.pow(symbolSize, password1.length) );
score = natLog / Math.LN2;
if (score < 40 )
return "bad";
if (score < 56 )
return "good";
return "strong";
}
//----------------------------
//------ LIST FIELD ----------
//----------------------------
var gfield_original_title = "";
function gformAddListItem(element, max){
if(jQuery(element).hasClass("gfield_icon_disabled"))
return;
var tr = jQuery(element).closest('tr');
var clone = tr.clone();
clone.find("input, select").val("").attr("tabindex", clone.find('input:last').attr("tabindex"));
tr.after(clone);
gformToggleIcons(tr.parent(), max);
gformAdjustClasses(tr.parent());
}
function gformDeleteListItem(element, max){
var tr = jQuery(element).parent().parent();
var parent = tr.parent();
tr.remove();
gformToggleIcons(parent, max);
gformAdjustClasses(parent);
}
function gformAdjustClasses(table){
var rows = table.children();
for(var i=0; i 0 && rowCount >= max){
gfield_original_title = table.find(".add_list_item:first").attr("title");
table.find(".add_list_item").addClass("gfield_icon_disabled").attr("title", "");
}
else{
var addIcons = table.find(".add_list_item");
addIcons.removeClass("gfield_icon_disabled");
if(gfield_original_title)
addIcons.attr("title", gfield_original_title);
}
}
//-----------------------------------
//------ CREDIT CARD FIELD ----------
//-----------------------------------
function gformMatchCard(id) {
var cardType = gformFindCardType(jQuery('#' + id).val());
var cardContainer = jQuery('#' + id).parents('.gfield').find('.gform_card_icon_container');
if(!cardType) {
jQuery(cardContainer).find('.gform_card_icon').removeClass('gform_card_icon_selected gform_card_icon_inactive');
} else {
jQuery(cardContainer).find('.gform_card_icon').removeClass('gform_card_icon_selected').addClass('gform_card_icon_inactive');
jQuery(cardContainer).find('.gform_card_icon_' + cardType).removeClass('gform_card_icon_inactive').addClass('gform_card_icon_selected');
}
}
function gformFindCardType(value) {
if(value.length < 4)
return false;
var rules = window['gf_cc_rules'];
var validCardTypes = new Array();
for(type in rules) {
//needed when implementing for in loops
if(!rules.hasOwnProperty(type))
continue;
for(i in rules[type]) {
if(!rules[type].hasOwnProperty(i))
continue;
if(rules[type][i].indexOf(value.substring(0, rules[type][i].length)) === 0) {
validCardTypes[validCardTypes.length] = type;
break;
}
}
}
return validCardTypes.length == 1 ? validCardTypes[0].toLowerCase() : false;
}
function gformToggleCreditCard(){
if(jQuery("#gform_payment_method_creditcard").is(":checked"))
jQuery(".gform_card_fields_container").slideDown();
else
jQuery(".gform_card_fields_container").slideUp();
}
//----------------------------------------
//------ CHOSEN DROP DOWN FIELD ----------
//----------------------------------------
function gformInitChosenFields(fieldList, noResultsText){
return jQuery(fieldList).each(function(){
var element = jQuery(this);
//only initialize once
if( element.is(":visible") && element.siblings(".chosen-container").length == 0 ){
var options = gform.applyFilters( 'gform_chosen_options', { no_results_text: noResultsText }, element );
element.chosen( options );
}
});
}
//----------------------------------------
//--- CURRENCY FORMAT NUMBER FIELD -------
//----------------------------------------
function gformInitCurrencyFormatFields(fieldList){
jQuery(fieldList).each(function(){
var $this = jQuery(this);
$this.val( gformFormatMoney( jQuery(this).val() ) );
}).change( function( event ) {
jQuery(this).val( gformFormatMoney( jQuery(this).val() ) );
});
}
//----------------------------------------
//------ CALCULATION FUNCTIONS -----------
//----------------------------------------
var GFCalc = function(formId, formulaFields){
this.patt = /{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/i;
this.exprPatt = /^[0-9 -/*\(\)]+$/i;
this.isCalculating = {};
this.init = function(formId, formulaFields) {
var calc = this;
jQuery(document).bind("gform_post_conditional_logic", function(){
for(var i=0; i 1 || input.prop('type') == 'checkbox' )
input = input.filter(':checked');
var isVisible = window['gf_check_field_rule'] ? gf_check_field_rule( formId, fieldId, true, '' ) == 'show' : true;
if( input.length > 0 && isVisible ) {
var val = input.val();
val = val.split( '|' );
if( val.length > 1 ) {
value = val[1];
} else {
value = input.val();
}
}
var numberFormat = gf_global.number_formats[formId][fieldId];
if( ! numberFormat )
numberFormat = gf_global.number_formats[formId][formulaField.field_id];
var decimalSeparator = gformGetDecimalSeparator(numberFormat);
value = gformCleanNumber( value, '', '', decimalSeparator );
if( ! value )
value = 0;
expr = expr.replace( matches[i][0], value );
}
return expr;
}
this.init(formId, formulaFields);
}
function gformFormatNumber(number, rounding, decimalSeparator, thousandSeparator){
if(typeof decimalSeparator == "undefined"){
if(window['gf_global']){
var currency = new Currency(gf_global.gf_currency_config);
decimalSeparator = currency.currency["decimal_separator"];
}
else{
decimalSeparator = ".";
}
}
if(typeof thousandSeparator == "undefined"){
if(window['gf_global']){
var currency = new Currency(gf_global.gf_currency_config);
thousandSeparator = currency.currency["thousand_separator"];
}
else{
thousandSeparator = ",";
}
}
var currency = new Currency();
return currency.numberFormat(number, rounding, decimalSeparator, thousandSeparator, false)
}
function gformToNumber(text) {
var currency = new Currency(gf_global.gf_currency_config);
return currency.toNumber(text);
}
function getMatchGroups(expr, patt) {
var matches = new Array();
while(patt.test(expr)) {
var i = matches.length;
matches[i] = patt.exec(expr)
expr = expr.replace('' + matches[i][0], '');
}
return matches;
}
//----------------------------------------
//------ JAVASCRIPT HOOK FUNCTIONS -------
//----------------------------------------
var gform = {
hooks: { action: {}, filter: {} },
addAction: function( action, callable, priority, tag ) {
gform.addHook( 'action', action, callable, priority, tag );
},
addFilter: function( action, callable, priority, tag ) {
gform.addHook( 'filter', action, callable, priority, tag );
},
doAction: function( action ) {
gform.doHook( 'action', action, arguments );
},
applyFilters: function( action ) {
return gform.doHook( 'filter', action, arguments );
},
removeAction: function( action, tag ) {
gform.removeHook( 'action', action, tag );
},
removeFilter: function( action, priority, tag ) {
gform.removeHook( 'filter', action, priority, tag );
},
addHook: function( hookType, action, callable, priority, tag ) {
if ( undefined == gform.hooks[hookType][action] ) {
gform.hooks[hookType][action] = [];
}
var hooks = gform.hooks[hookType][action];
if ( undefined == tag ) {
tag = action + '_' + hooks.length;
}
gform.hooks[hookType][action].push( { tag:tag, callable:callable, priority:priority } );
},
doHook: function( hookType, action, args ) {
// splice args from object into array and remove first index which is the hook name
args = Array.prototype.slice.call(args, 1);
if ( undefined != gform.hooks[hookType][action] ) {
var hooks = gform.hooks[hookType][action], hook;
//sort by priority
hooks.sort(function(a,b){return a["priority"]-b["priority"]});
for( var i=0; i=0; i--) {
if ((undefined==tag||tag==hooks[i].tag) && (undefined==priority||priority==hooks[i].priority)){
hooks.splice(i,1);
}
}
}
}
};
//----------------------------------------
//------ MULTIFILE UPLOAD FUNCTIONS ------
//----------------------------------------
(function (gfMultiFileUploader, $) {
gfMultiFileUploader.uploaders = {};
var strings = typeof gform_gravityforms != 'undefined' ? gform_gravityforms.strings : {};
var imagesUrl = typeof gform_gravityforms != 'undefined' ? gform_gravityforms.vars.images_url : "";
$(document).ready(function () {
if((typeof adminpage !== 'undefined' && adminpage === 'toplevel_page_gf_edit_forms')|| typeof plupload == 'undefined'){
$(".gform_button_select_files").prop("disabled", true);
} else if (typeof adminpage !== 'undefined'){
$(".gform_fileupload_multifile").each(function(){
setup(this);
});
} else {
$(document).bind('gform_post_render', function(e, formID){
$("form#gform_" + formID + " .gform_fileupload_multifile").each(function(){
setup(this);
});
var $form = $("form#gform_" + formID);
if($form.length > 0){
$form.submit(function(){
var pendingUploads = false;
$.each(gfMultiFileUploader.uploaders, function(i, uploader){
if(uploader.total.queued>0){
pendingUploads = true;
return false;
}
});
if(pendingUploads){
alert(strings.currently_uploading);
window["gf_submitting_" + formID] = false;
return false;
}
});
}
});
$(document).bind("gform_post_conditional_logic", function(e,formID, fields, isInit){
if(!isInit){
$.each(gfMultiFileUploader.uploaders, function(i, uploader){
uploader.refresh();
});
}
});
}
});
function setup(uploadElement){
var settings = $(uploadElement).data('settings');
var uploader = new plupload.Uploader(settings);
formID = uploader.settings.multipart_params.form_id;
gfMultiFileUploader.uploaders[settings.container] = uploader;
var formID;
var uniqueID;
uploader.bind('Init', function(up, params) {
if(!up.features.dragdrop)
$(".gform_drop_instructions").hide();
var fieldID = up.settings.multipart_params.field_id;
var maxFiles = parseInt(up.settings.gf_vars.max_files);
var initFileCount = countFiles(fieldID);
if(maxFiles > 0 && initFileCount >= maxFiles){
gfMultiFileUploader.toggleDisabled(up.settings, true);
}
});
gfMultiFileUploader.toggleDisabled = function (settings, disabled){
var button = typeof settings.browse_button == "string" ? $("#" + settings.browse_button) : $(settings.browse_button);
button.prop("disabled", disabled);
}
function addMessage(messagesID, message){
$("#" + messagesID).prepend("" + message + "");
}
uploader.init();
uploader.bind('FilesAdded', function(up, files) {
var max = parseInt(up.settings.gf_vars.max_files),
fieldID = up.settings.multipart_params.field_id,
totalCount = countFiles(fieldID),
disallowed = up.settings.gf_vars.disallowed_extensions,
extension;
if( max > 0 && totalCount >= max){
$.each(files, function(i, file) {
up.removeFile(file);
return;
})
return;
}
$.each(files, function(i, file) {
extension = file.name.split('.').pop();
if($.inArray(extension, disallowed) > -1){
addMessage(up.settings.gf_vars.message_id, file.name + " - " + strings.illegal_extension);
up.removeFile(file);
return;
}
if ((file.status == plupload.FAILED) || (max > 0 && totalCount >= max)){
up.removeFile(file);
return;
}
var size = typeof file.size !== 'undefined' ? plupload.formatSize(file.size) : strings.in_progress;
var status = '';
$('#' + up.settings.filelist).prepend(status);
totalCount++;
});
up.refresh(); // Reposition Flash
var formElementID = "form#gform_" + formID;
var uidElementID = "input:hidden[name='gform_unique_id']";
var uidSelector = formElementID + " " + uidElementID;
var $uid = $(uidSelector);
if($uid.length==0){
$uid = $(uidElementID);
}
uniqueID = $uid.val();
if('' === uniqueID){
uniqueID = generateUniqueID();
$uid.val(uniqueID);
}
if(max > 0 && totalCount >= max){
addMessage(up.settings.gf_vars.message_id, strings.max_reached)
gfMultiFileUploader.toggleDisabled(up.settings, true);
}
up.settings.multipart_params.gform_unique_id = uniqueID;
up.start();
});
uploader.bind('UploadProgress', function(up, file) {
var html = file.percent + "%";
$('#' + file.id + " b").html(html);
});
uploader.bind('Error', function(up, err) {
if(err.code === plupload.FILE_EXTENSION_ERROR){
var extensions = typeof up.settings.filters.mime_types != 'undefined' ? up.settings.filters.mime_types[0].extensions /* plupoad 2 */ : up.settings.filters[0].extensions;
addMessage(up.settings.gf_vars.message_id, err.file.name + " - " + strings.invalid_file_extension + " " + extensions);
} else if (err.code === plupload.FILE_SIZE_ERROR) {
addMessage(up.settings.gf_vars.message_id, err.file.name + " - " + strings.file_exceeds_limit);
} else {
var m = "Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"";
addMessage(up.settings.gf_vars.message_id, m);
}
$('#' + err.file.id ).html('');
up.refresh(); // Reposition Flash
});
uploader.bind('FileUploaded', function(up, file, result) {
var response = $.secureEvalJSON(result.response);
if(response.status == "error"){
addMessage(up.settings.gf_vars.message_id, file.name + " - " + response.error.message);
$('#' + file.id ).html('');
return;
}
var html = '' + file.name + '';
var formId = up.settings.multipart_params.form_id;
var fieldId = up.settings.multipart_params.field_id;
html = " "
+ html;
$('#' + file.id ).html(html);
var fieldID = up.settings.multipart_params["field_id"];
if(file.percent == 100){
if(response.status && response.status == 'ok'){
addFile(fieldID, response.data);
} else {
addMessage(up.settings.gf_vars.message_id, strings.unknown_error);
}
}
});
function getAllFiles(){
var selector = '#gform_uploaded_files_' + formID,
$uploadedFiles = $(selector), files;
files = $uploadedFiles.val();
files = '' === files ? {} : $.parseJSON(files);
return files;
}
function getFiles(fieldID){
var allFiles = getAllFiles();
var inputName = getInputName(fieldID);
if(typeof allFiles[inputName] == 'undefined')
allFiles[inputName] = [];
return allFiles[inputName];
}
function countFiles(fieldID){
var files = getFiles(fieldID);
return files.length;
}
function addFile(fieldID, fileInfo){
var files = getFiles(fieldID);
files.unshift(fileInfo);
setUploadedFiles(fieldID, files);
}
function setUploadedFiles(fieldID, files){
var allFiles = getAllFiles();
var $uploadedFiles = $('#gform_uploaded_files_' + formID);
var inputName = getInputName(fieldID);
allFiles[inputName] = files;
$uploadedFiles.val($.toJSON(allFiles));
}
function getInputName(fieldID){
return "input_" + fieldID;
}
// fixes drag and drop in IE10
$("#" + settings.drop_element).on({
"dragenter": ignoreDrag,
"dragover": ignoreDrag
});
function ignoreDrag( e ) {
e.preventDefault();
}
}
function generateUniqueID() {
return 'xxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : r & 0x3 | 0x8;
return v.toString(16);
});
}
}(window.gfMultiFileUploader = window.gfMultiFileUploader || {}, jQuery));
//----------------------------------------
//------ GENERAL FUNCTIONS -------
//----------------------------------------
function gformInitSpinner( formId, spinnerUrl ) {
if( typeof spinnerUrl == 'undefined' || ! spinnerUrl )
spinnerUrl = gform.applyFilters( "gform_spinner_url", gf_global.spinnerUrl, formId );
jQuery('#gform_' + formId).submit(function () {
if (jQuery('#gform_ajax_spinner_' + formId).length == 0) {
jQuery('#gform_submit_button_' + formId + ', #gform_wrapper_' + formId + ' .gform_next_button')
.after('');
}
});
}
/*============================================
Stripe - Front-end
==============================================*/
window.GFStripe = null;
(function($){
GFStripe = function( args ) {
for( var prop in args ) {
if( args.hasOwnProperty( prop ) )
this[prop] = args[prop];
}
this.form = null;
this.init = function() {
if( ! this.isCreditCardOnPage() )
return;
var GFStripeObj = this;
Stripe.setPublishableKey( this.apiKey );
// initialize spinner
if( ! this.isAjax )
gformInitSpinner( this.formId );
// bind Stripe functionality to submit event
$( '#gform_' + this.formId ).submit( function( event ){
event.preventDefault();
var form = $(this),
ccInputPrefix = 'input_' + GFStripeObj.formId + '_' + GFStripeObj.ccFieldId + '_',
cc = {
number: form.find( '#' + ccInputPrefix + '1' ).val(),
exp_month: form.find( '#' + ccInputPrefix + '2_month' ).val(),
exp_year: form.find( '#' + ccInputPrefix + '2_year' ).val(),
cvc: form.find( '#' + ccInputPrefix + '3' ).val(),
name: form.find( '#' + ccInputPrefix + '5').val()
};
GFStripeObj.form = form;
Stripe.card.createToken( cc, function( status, response ) {
GFStripeObj.responseHandler( status, response );
} );
} );
};
this.responseHandler = function( status, response ) {
var form = this.form,
ccInputPrefix = 'input_' + this.formId + '_' + this.ccFieldId + '_',
ccInputSuffixes = [ '1', '2_month', '2_year', '3', '5' ],
cardType = false;
// remove "name" attribute from credit card inputs
for( var i = 0; i < ccInputSuffixes.length; i++ ) {
var input = form.find( '#' + ccInputPrefix + ccInputSuffixes[i] );
if( ccInputSuffixes[i] == '1' ) {
var ccNumber = $.trim( input.val() ),
cardType = gformFindCardType( ccNumber );
if( typeof this.cardLabels[cardType] != 'undefined' )
cardType = this.cardLabels[cardType];
form.append( $( '' ).val( ccNumber.slice( -4 ) ) );
form.append( $( '' ).val( cardType ) );
}
input.attr( 'name', null );
}
// append stripe.js response
form.append( $( '' ).val( $.toJSON( response ) ) );
// submit the form
form.get(0).submit();
}
this.isLastPage = function() {
var targetPageInput = $( '#gform_target_page_number_' + this.formId );
if( targetPageInput.length > 0 )
return targetPageInput.val() == 0;
return true;
}
this.isCreditCardOnPage = function() {
var currentPage = this.getCurrentPageNumber();
// if current page is false or no credit card page number, assume this is not a multi-page form
if( ! this.ccPage || ! currentPage )
return true;
return this.ccPage == currentPage;
}
this.getCurrentPageNumber = function() {
var currentPageInput = $( '#gform_source_page_number_' + this.formId );
return currentPageInput.length > 0 ? currentPageInput.val() : false;
}
this.init();
}
})(jQuery);
/*============================================
UI - Datepicker
==============================================*/
jQuery(document).ready(gformInitDatepicker);
function gformInitDatepicker(){
jQuery('.datepicker').each(
function (){
var element = jQuery(this);
var format = "mm/dd/yy";
if(element.hasClass("mdy"))
format = "mm/dd/yy";
else if(element.hasClass("dmy"))
format = "dd/mm/yy";
else if(element.hasClass("dmy_dash"))
format = "dd-mm-yy";
else if(element.hasClass("dmy_dot"))
format = "dd.mm.yy";
else if(element.hasClass("ymd_slash"))
format = "yy/mm/dd";
else if(element.hasClass("ymd_dash"))
format = "yy-mm-dd";
else if(element.hasClass("ymd_dot"))
format = "yy.mm.dd";
var image = "";
var showOn = "focus";
if(element.hasClass("datepicker_with_icon")){
showOn = "both";
image = jQuery('#gforms_calendar_icon_' + this.id).val();
}
element.datepicker( {
yearRange: '-0:+1',
minDate: '+90',
maxDate: '+18M',
showOn: showOn,
buttonImage: image,
buttonImageOnly: true,
dateFormat: format,
changeMonth: true,
changeYear: true,
onClose: function () {
element.closest('li').nextAll('li:visible:first').find(':input:first').focus();
}
} );
}
);
}
/*============================================
Conditional Date
==============================================*/
;(function($) {
"use strict";
function setOptionsByDate()
{
$('.booked, .unbooked').each(function() {
$(this).css('display', 'none');
});
var visiting = $('.book-date :input').val();
if (!visiting) {
return;
}
var visitdate = new Date(visiting);
var today = new Date().setHours(0, 0, 0, 0);
if (visitdate < today) {
alert("Hmm... that date is already booked. " + "Please pick another date.");
$('.visit-date :input').val('');
return;
}
var month = visitdate.getMonth();
if (month >= 5 && month <= 7) {
$('.summer, .year-round').each(function() {
$(this).css('display', '');
});
} else {
$('.winter, .year-round').each(function() {
$(this).css('display', '');
});
}
}
$(document).ready(function() {
setOptionsByDate();
$('.visit-date :input').change(function() {
setOptionsByDate();
});
});
}(jQuery, {}));