$(document).ready(function(){$("body").on("click","a[data-reveal-id]",function(a){a.preventDefault();var b=$(this).attr("data-reveal-id");$("#"+b).reveal($(this).data())}),$.fn.reveal=function(a){var b={animation:"fade",animationspeed:300,closeonbackgroundclick:!0,dismissmodalclass:"close-reveal-modal"},a=$.extend({},b,a);return this.each(function(){function h(){e=!1}function i(){e=!0}var b=$(this),c=parseInt(b.css("top")),d=b.height()+c,e=!1,f=$(".reveal-modal-bg");0==f.length&&(f=$('
').insertAfter(b)),b.bind("reveal:open",function(){if(f.unbind("click.modalEvent"),$("."+a.dismissmodalclass).unbind("click.modalEvent"),!e){if(i(),"fadeAndPop"==a.animation&&(b.css({top:$(document).scrollTop()-d,opacity:0,visibility:"visible"}),f.fadeIn(a.animationspeed/2),b.delay(a.animationspeed/2).animate({top:$(document).scrollTop()+c+"px",opacity:1},a.animationspeed,h())),"fade"==a.animation){var g=$(window).height();$(this).find(".image-popup").each(function(){var a=$(this).height();$(this).css({marginTop:(g-a)/2})}),$(this).find(".wrap-popup").each(function(){var a=$(this).height();$(this).css({marginTop:(g-a)/2})}),b.css({opacity:0,visibility:"visible"}),f.fadeIn(a.animationspeed/2),b.delay(a.animationspeed/2).animate({opacity:1},a.animationspeed,h())}"none"==a.animation&&(b.css({visibility:"visible",top:$(document).scrollTop()+c}),f.css({display:"block"}),h())}b.unbind("reveal:open")}),b.bind("reveal:close",function(){e||(i(),"fadeAndPop"==a.animation&&(f.delay(a.animationspeed).fadeOut(a.animationspeed),b.animate({top:$(document).scrollTop()-d+"px",opacity:0},a.animationspeed/2,function(){b.css({top:c,opacity:1,visibility:"hidden"}),h()})),"fade"==a.animation&&(f.delay(a.animationspeed).fadeOut(a.animationspeed),b.animate({opacity:0},a.animationspeed,function(){b.css({opacity:1,visibility:"hidden",top:c}),h()})),"none"==a.animation&&(b.css({visibility:"hidden",top:c}),f.css({display:"none"}))),b.unbind("reveal:close")}),b.trigger("reveal:open");$("."+a.dismissmodalclass).bind("click.modalEvent",function(){b.trigger("reveal:close")});a.closeonbackgroundclick&&(f.css({cursor:"pointer"}),f.bind("click.modalEvent",function(){b.trigger("reveal:close")})),$("body").keyup(function(a){27===a.which&&b.trigger("reveal:close")})})}});