(function(b){b.yit_popup=function(c,e){var h={"class":"span6",content:""},a=this;a.settings={};var d=b(c);a.init=function(){a.settings=b.extend({},h,e);0==b("body").find(".yitpopup_overlay").length?a.overlay=b("<div />",{"class":"yitpopup_overlay"}).appendTo("body"):a.overlay=b("body").find(".yitpopup_overlay");0==a.overlay.find(".yitpopup_wrapper").length?a.popup=b("<div />",{"class":"yitpopup_wrapper "+a.settings["class"]}).appendTo(b("body")):a.popup=b("body").find(".yitpopup_wrapper");0==a.overlay.find(".close").length?
    a.close=b("<a />",{"class":"close"}).appendTo(a.popup):a.close=a.overlay.find(".close");k()};var k=function(){b(document).on("touchstart click",".yitpopup_overlay",function(a){(b(a.target).hasClass("close")||0==b(a.target).parents(".yitpopup_overlay").length)&&f()}).on("keyup",function(a){27==a.keyCode&&f()}).on("click",".yitpopup_wrapper a.close",function(){f()});b(window).on("resize",function(){g()});g();l();"1"!=a.overlay.css("opacity")&&a.overlay.css({display:"block",opacity:0}).animate({opacity:1},
    500)},g=function(){a.popup.css({position:"absolute",top:parseInt(Math.max(0,jQuery(window).scrollTop()))+50+"px",left:Math.max(0,(jQuery(window).width()-a.popup.outerWidth())/2)+"px"})},f=function(){a.overlay.css({display:"none",opacity:1}).animate({opacity:0},500);b("body").removeClass("yit-popup-opened");b(d.data("container")).html(a.popup.html());a.popup.remove();a.overlay.remove();d.removeData("yit_popup")},l=function(){""!=a.settings.content?a.popup.html(a.settings.content):d.data("container")?
    (a.popup.html(b(d.data("container")).html()),b(d.data("container")).empty()):d.data("content")?a.popup.html(d.data("content")):d.attr("title")?a.popup.html(d.attr("title")):d.data("template")?b.get(d.data("template"),function(b){a.popup.prepend(b)}):a.popup.html("");0==a.overlay.find(".close").length?a.close=b("<a />",{"class":"close"}).appendTo(a.popup):a.close=a.overlay.find(".close")};a.init()};b.fn.yit_popup=function(c){return this.each(function(){if(void 0===b(this).data("yit_popup")){var e=
    new b.yit_popup(this,c);b(this).data("yit_popup",e)}})}})(jQuery);
(function(b,c,e){c.yit_contact_popup=function(b,a){this.element=c(a);this._init(b)};c.yit_contact_popup.defaults={handler:".contact-popup",contactForm:".yitpopup_wrapper form.contact-form"};c.yit_contact_popup.prototype={_init:function(b){this.options=c.extend(!0,{},c.yit_contact_popup.defaults,b);this._isMobile()||this._initEvents()},_initEvents:function(){var b=this;c(document).on("click",b.options.handler,function(a){a.preventDefault();0==c("body").find(".yitpopup_overlay").length&&c("<div />",
    {"class":"yitpopup_overlay"}).appendTo("body").css({display:"block",opacity:0}).animate({opacity:1},500);c.post(contact_popup_vars.ajaxurl,{action:"yit_contact_popup",_nonce:contact_popup_vars.nonce},function(a){a&&b._initPopup(a)})});c(document).on("submit",b.options.contactForm,function(a){var b=c(this);a.preventDefault();c.post(contact_popup_vars.ajaxurl,b.serialize()+"&action=yit_contact_popup_send_email&_nonce="+contact_popup_vars.nonce,function(a){a&&b.replaceWith(a)})})},_initPopup:function(b){c("body").yit_popup({"class":"span10",
    content:b})},_isMobile:function(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/iPhone|iPod/i)||navigator.userAgent.match(/IEMobile/i)?!0:!1}};c.fn.yit_contact_popup=function(b){if("string"===typeof b){var a=Array.prototype.slice.call(arguments,1);this.each(function(){var d=c.data(this,"yit_contact_popup");d?c.isFunction(d[b])&&"_"!==b.charAt(0)?d[b].apply(d,a):console.error("no such method '"+b+"' for yit_contact_popup instance"):
    console.error("cannot call methods on yit_contact_popup prior to initialization; attempted to call method '"+b+"'")})}else this.each(function(){c.data(this,"yit_contact_popup")||c.data(this,"yit_contact_popup",new c.yit_contact_popup(b,this))});return this}})(window,jQuery);jQuery(function(b){b("body").yit_contact_popup()});
