/*! Thrive Dashboard - 2016-05-10
* http://www.thrivethemes.com/
* Copyright (c) 2016 Thrive Themes */
!function(a){var b=0,c=0,d=function(){return c++,"tvd-materialize-lean-overlay-"+c};a.fn.extend({openModal:function(c){var e=a("body").css("overflow","hidden"),f={opacity:.7,in_duration:350,out_duration:250,ready:void 0,complete:void 0,dismissible:!0,starting_top:"4%",overlay_class:""},g=d(),h=a(this),i=a('<div class="tvd-lean-overlay"></div>'),j=++b;i.attr("id",g).css("z-index",1e4+2*j),h.data("tvd-overlay-id",g).css("z-index",1e4+2*j+1),e.append(i),c=a.extend(f,c),i.addClass(c.overlay_class),c.dismissible&&(i.click(function(){h.closeModal(c)}),a(document).on("keyup.leanModal"+g,function(a){27===a.keyCode&&h.closeModal(c)})),h.find(".tvd-modal-close").on("click.close",function(a){h.closeModal(c)}),i.css({display:"block",opacity:0}),h.css({display:"block",opacity:0}),i.velocity({opacity:c.opacity},{duration:c.in_duration,queue:!1,ease:"easeOutCubic"}),h.data("tvd-associated-overlay",i[0]),h.hasClass("bottom-sheet")?h.velocity({bottom:"0",opacity:1},{duration:c.in_duration,queue:!1,ease:"easeOutCubic",complete:function(){"function"==typeof c.ready&&c.ready()}}):(a.Velocity.hook(h,"scaleX",.7),h.css({top:c.starting_top}),h.velocity({top:"10%",opacity:1,scaleX:"1"},{duration:c.in_duration,queue:!1,ease:"easeOutCubic",complete:function(){"function"==typeof c.ready&&c.ready()}}))}}),a.fn.extend({closeModal:function(c){var d={out_duration:250,complete:void 0},e=a(this),f=e.data("tvd-overlay-id"),g=a("#"+f);if(c=a.extend(d,c),a("body").css("overflow",""),e.find(".tvd-modal-close").off("click.close"),a(document).off("keyup.leanModal"+f),g.velocity({opacity:0},{duration:c.out_duration,queue:!1,ease:"easeOutQuart"}),b--,e.hasClass("bottom-sheet"))e.velocity({bottom:"-100%",opacity:0},{duration:c.out_duration,queue:!1,ease:"easeOutCubic",complete:function(){g.css({display:"none"}),"function"==typeof c.complete&&c.complete(),g.remove()}});else{if(0===c.out_duration)return e.hide(0),"function"==typeof c.complete&&c.complete(),void g.remove();e.velocity({top:c.starting_top,opacity:0,scaleX:.7},{duration:c.out_duration,complete:function(){a(this).css("display","none"),"function"==typeof c.complete&&c.complete(),g.remove()}})}}}),a.fn.extend({leanModal:function(b){return this.each(function(){var c={starting_top:"4%"},d=a(this),e=a.extend(c,b,d.data());d.click(function(b){e.starting_top=(a(this).offset().top-a(window).scrollTop())/1.15;var c=d.attr("href")||"#"+d.data("target");return a(c).openModal(e),b.preventDefault(),b.stopPropagation(),!1})})}})}(jQuery);