"),o="position:fixed; width:100px; height:100px; left:0; top:0; bottom:0; right:0; margin:auto; z-index:10000002; background:#fff; border-radius:5px;",i=t.setStyles?t.setStyles:"",n='';e.attr("class","crazyPopUp_container loader"),e.attr("style",o+"overflow:"+t.overflow+"; border-radius:"+t.borderPadius+";"+i),$("body").prepend(e),e.prepend(''),$("body").prepend(n)},create:function(t){var o,i=this,n=e(),a=!1,r=!1,s=!1;$(".crazyPopUp_container.loader").remove(),$("#crazyPopUp_spinner").remove(),"localHash"==n&&(window.location.hash=t.url),this.add_container=function(e){var o=t.url,n=window.location.origin,a=$("
"),r="position:fixed; width:100px; height:100px; left:0; top:0; bottom:0; right:0; margin:auto; z-index:10000002; background:#fff; border-radius:5px;",s=t.setStyles?t.setStyles:"",p=t.addClass?"crazyPopUp_container "+t.addClass:"crazyPopUp_container";a.attr("class",p),a.attr("style",r+"overflow:"+t.overflow+"; border-radius:"+t.borderPadius+";"+s),a.html('');var c=-1==o.indexOf("http://")&&o.indexOf("https://")?n+o:o,d=t.iframeScrolling?t.iframeScrolling:"no",l="local"==e?$("#"+o).html():"localHash"==e?$(o).html():"image"==e?'':'';$("body").prepend(a),$(".crazyPopUp_container:not(.hidden_popup) .crazyPopUp_content").prepend(l);var h='';$("#crazyPopUp_background").length?$("#crazyPopUp_background").removeClass("crazyPopUp_to_remove").css({opacity:"0.55"}):$("body").prepend(h),t.addButtonClose&&a.prepend(''),a.prepend('');var f=$(".crazyPopUp_container:not(.hidden_popup) .crazyPopUp_content");return"image"==e||"iframe"==e?void i.onLoad():("localHash"==e&&(o=o.substr(1)),f.css({position:"absolute",width:t.width?t.width:$("#"+o).width()+"px",height:t.height?t.height:$("#"+o).height()+"px",opacity:"0","border-radius":t.borderPadius,transition:"background 0.3s ease, transform 0.3s ease"}),void setTimeout(function(){i.contentOptions(f)},300))},this.onLoad=function(){var e=$("image"==n?"#crazyPopUp_image_content":"iframe"==n?"#crazyPopUp_iframe":".crazyPopUp_content");e.hide(),$(".crazyPopUp_container").css({width:"100px",height:"100px"}),e.load(function(){$(".crazyPopUp_content").css({position:"absolute",opacity:"0",border:"none",transition:"background 0.3s ease, transform 0.3s ease"}),$(this).fadeIn(300),CrazyPopUp.resize(!0),i.contentOptions()})},this.contentOptions=function(){t.waitLoading=!0;var e=$(".crazyPopUp_container:not(.hidden_popup) .crazyPopUp_content"),o=$(".crazyPopUp_container:not(.hidden_popup)");if("string"==typeof t.onShow)if("iframe"==n){var a=t.onShow;document.getElementById("crazyPopUp_iframe").contentWindow.eval(a)}else setTimeout(t.onShow);else t.onShow();"scale"==t.animate&&(CrazyPopUp.resize(!0),o.css({transform:"scale(0.1, 0.1)"})),"fade"==t.animate&&o.css({opacity:"0"}),o.css("bottom",""),o.css("right",""),CrazyPopUp.resize(!0),$("#crazyPopUp_spinner").remove(),o.css({"transition-delay":".3s all",transition:".3s all",transform:"scale(1, 1)"});var r=300;o.delay(r).animate({opacity:"1"},r),e.delay(r).animate({opacity:"1"},r),t.addButtonClose&&($(".closeCrazyPopupOutside").delay(r).fadeIn(r),$(".crazypopup_slide_right, .crazypopup_slide_left").delay(r).fadeIn(r)),setTimeout(function(){i.addListeners(e)},300)},this.addListeners=function(){function e(t){if("crazyPopUp_background"==t.target.id||$(t.target).hasClass("closeLightview")||$(t.target).hasClass("closeCrazyPopupOutside")||$(t.target).hasClass("closeCrazyPopup")){if(a)return;i.closePopUp(),$(document).unbind("click",e)}}if(!s){var r=$(".crazyPopUp_container:not(.hidden_popup) .crazyPopUp_content");try{var p="iframe"==n?r.find("iframe").contents().find("body"):r.children()}catch(c){var p="iframe"==n?r.find("iframe"):r.children()}s=!0;var d,l=this;p.bind("DOMNodeInserted",function(e){clearTimeout(o),o=setTimeout(function(){l.onchangeDOM()},50)}),p.bind("DOMNodeRemoved",function(e){clearTimeout(o),o=setTimeout(function(){l.onchangeDOM()},50)}),p.bind("change",function(e){l.onchangeDOM()}),p.on({click:e,touchstart:e}),t.closeOnOut&&$(document).on({click:e,touchstart:e}),$(window).resize(function(){-1==t.fixPosition&&(t.fixPosition="resize"),CrazyPopUp.resize(!0)}),this.submitListeners=function(){if(t.submitControl){var e="iframe"==n?r.find("iframe").contents().find("html"):r;d=e.find("form")[0],$(d).unbind("submit"),i.submitControl(d)}},this.onchangeDOM=function(){setTimeout(function(){CrazyPopUp.resize(!1),i.submitListeners(),(t.fixPosition||"resize"==t.fixPosition)&&(t.fixPosition=-1)},150)},l.onchangeDOM(),"iframe"==n&&CrazyPopUp.resize(!0)}},this.submitControl=function(e){$(e).on("submit",function(o){if(o.preventDefault(),t.ajax)return $(this).find("[type='submit']").addClass("loading").prop("disabled",!0),"string"==typeof t.ajax?setTimeout(t.ajax+"(this)"):t.ajax(this),!1;if("local"==n||"localHash"==n){if(!form_check(this))return!1}else if("iframe"==n&&!document.getElementById("crazyPopUp_iframe").contentWindow.form_check(this))return!1;return t.validation(e),$(this).find("[type='submit']").addClass("loading").prop("disabled",!0),i.ajaxAction($(this)),!1})},this.ajaxAction=function(e){a=!0,r=$.ajax({url:$(e).attr("action"),type:"post",dataType:"json",data:$(e).serialize(),complete:function(t){e.find(':input[type="submit"]').removeClass("loading").prop("disabled",!1),a=!1},success:function(e){t.onSubmit_success?t.onSubmit_success(e):i.ajax_response(e)},error:function(e){t.onSubmit_error?t.onSubmit_error(e):i.ajax_response(e)},beforeSend:function(){i.before()}})},this.closePopUp=function(){n=e(),r&&r.abort(),"local"==n?$("#"+t.url).html($(".crazyPopUp_content").html()):"localHash"==n&&$(t.url).html($(".crazyPopUp_content").html()),CrazyPopUp.hide()},this.before=function(){var e=$(".crazyPopUp_content").children().prop("tagName"),t="IFRAME"==e?$(".crazyPopUp_content").children().contents().find("form"):$(".crazyPopUp_content").find("form");t.find(".borderRed").removeClass("borderRed"),t.parent().find(".requiredField").hide()},this.ajax_response=function(e){try{var o=$(".crazyPopUp_content").children().prop("tagName"),i="IFRAME"==o?$(".crazyPopUp_content").children().contents().find("form"):$(".crazyPopUp_content").find("form"),a="Ooops! Something went wrong. Please, try again later.",r="error";if("string"==typeof e.redirect&&""!=e.redirect)return void(window.location=e.redirect);if(i.find(".loading").removeClass("loading"),e.status&&(a="Your request will be processed.",r="success","undefined"!=typeof window.updateTableFlag&&(window.updateTableFlag=!0)),"string"==typeof e.message&&""!=e.message&&(a=e.message),p='
",i.parents("body").find(".quickResponse").remove(),i.parents("body").find(".lightviewContent").prepend(p),"object"==typeof e.data)if("undefined"!=typeof e.data.validation)i.parent().find(".lightviewContent").html(""),$.each(e.data.validation,function(e,t){var o=i.find("[name='"+e+"']").addClass("borderRed");null!=t&&""!=$.trim(t)&&o.next("span").show().text(t)});else if("undefined"!=typeof e.data.html)return $("#crazyPopUp_iframe").contents().find("html").html(e.data.html),void $("#crazyPopUp_iframe").contents().find("form")[0].submit()}catch(s){var p='
Ooops! Something went wrong. Please, try again later.
';i.parents("body").find(".quickResponse").remove(),i.parents("body").find(".lightviewContent").prepend(p)}if(t.ajaxCallback){if("string"==typeof t.ajaxCallback){if("iframe"==n)return void setTimeout("document.getElementById('crazyPopUp_iframe').contentWindow."+t.ajaxCallback);var c;return void(null!==(c=/([a-z][a-z0-9_]*)/i.exec(t.ajaxCallback))&&window[c[0]](e))}t.ajaxCallback()}},i.add_container(n)},group:function(e,t,o){var i=$(':[data-crazyPopUp-group="'+e+'"]'),a=i.length-1;if(!(o>a||0>o)){$(".crazyPopUp_container").remove(),$(".crazypopup_slide_right, .crazypopup_slide_left").unbind("click"),CrazyPopUp.show(i.eq(o).attr("href"),t);var r='',s='',p='',c='',d=0==o?r+p:o==a?s+c:r+s+p+c;$(".crazyPopUp_container").prepend(d),$(".crazypopup_slide_right").click(function(o){o.preventDefault();var i=parseInt($(this).attr("id").replace("crazypopup_slide_right_",""));CrazyPopUp.group(e,t,i+1)}),$(".crazypopup_slide_left").click(function(o){o.preventDefault();var i=parseInt($(this).attr("id").replace("crazypopup_slide_left_",""));CrazyPopUp.group(e,t,i-1)}),CrazyPopUp.resize(!0),"0"!=n.parent().css("left")&&n.parent().css("margin","")}},resize:function(o){function a(e){try{var o="iframe"==p?s.find("iframe").contents().find("body"):s}catch(i){var o="iframe"==p?s.find("iframe"):s}if(o.find(t.header).length&&o.find(t.content).length&&t.searchContent){var a=(o.find(t.content).height(),o.find(t.header)),r=o.find(t.content),c=a.height(),d=0;return n=o.find(t.content),$.each(r.children(),function(){"none"!=$(this).css("display")&&(d+=$(this).height()+parseInt($(this).css("margin-top"))+parseInt($(this).css("margin-bottom"))+parseInt($(this).css("padding-top"))+parseInt($(this).css("padding-bottom")))}),c+=parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom"))+parseInt(a.css("padding-top"))+parseInt(a.css("padding-bottom")),d+=parseInt(r.css("padding-top"))+parseInt(r.css("padding-bottom")),[r,d,c]}var d=0;return $.each(o.children(),function(){"none"==$(this).css("display")||$(this).hasClass("t_UpdateQueue")||$(this).hasClass("t_Tooltip")||(d+=$(this).height()+parseInt($(this).css("margin-top"))+parseInt($(this).css("margin-bottom"))+parseInt($(this).css("padding-top"))+parseInt($(this).css("padding-bottom")))}),n=s,[!1,d]}if(t.waitLoading){var r=$(".crazyPopUp_container:not(.hidden_popup)"),s=$(".crazyPopUp_container:not(.hidden_popup) .crazyPopUp_content"),p=e();try{var c="iframe"==p?s.find("iframe").contents().find("body"):s.children().length>1?s:s.children()}catch(d){var c="iframe"==p?s.find("iframe"):s.children().length>1?s:s.children()}if(c.length){var l=t.height?t.height:window.innerHeight-t.margin,h=a(c),f=h[0]?h[1]:"iframe"==p&&t.height?t.height:"iframe"==p?c.innerHeight():h[1],u=h[0]?h[2]:0,m=h[0]?h[0]:s,y=t.width?t.width:c.width()<100?s.width():c.width()<700?700:c.width(),g=h[0]?f+u:f,_=window.innerHeight-t.margin
_?!0:!1;is_mobile&&(w=!1);var z=0,v=parseInt(m.css("margin-top"))+parseInt(m.css("margin-bottom"))+parseInt(m.css("padding-top"))+parseInt(m.css("padding-bottom"));if(t.fixPosition){var P=parseInt(r.css("top"));w=window.innerHeight-P-100<(t.height?t.height:f+u)?!0:!1,_=window.innerHeight-P-100}var b=h[0]||"iframe"!=p?w?_-u-v:f-v:f;if(window.innerWidth<768&&w&&h[0]&&(b=_+u+v),t.scroll&&(s.css({overflow:w?"hidden":t.overflow,"overflow-y":!h[0]&&"iframe"==p&&w?"auto":w?"hidden":t.overflow}),r.css({overflow:w?"hidden":t.overflow}),m.css({overflow:w?"hidden":t.overflow,"overflow-y":w?"auto":t.overflow})),t.fixedParams[0]!=b)m.height(b),h[0]||"iframe"!=p||s.find("iframe").height(b);else if(!o&&!i)return;if(t.fixedParams=[b],g=w?_:t.height?t.height:f+u,h[0]&&"iframe"==p&&s.find("iframe").height(g),s.css({height:g+"px",width:y+z+"px"}),r.css({height:g+"px",width:y+z+"px",left:$(window).width()/2-(y+z)/2+"px",top:-1==t.fixPosition?r.css("top"):$(window).height()/2-s.height()/2+"px",right:"none",bottom:"none"}),window.innerHeightx?x:U;r.css({"-webkit-transform":"scale("+S+", "+S+")",transform:"scale("+S+", "+S+")","-ms-transform":"scale("+S+", "+S+")"})}else r.css({"-webkit-transform":"scale(1, 1)",transform:"scale(1, 1)","-ms-transform":"scale(1, 1)"});"local"==p&&$("#"+t.url).html(""),"localHash"==p&&$(t.url).html(""),$(window).off("mousewheel").on("mousewheel",function(e){return t.mousewheel&&(e.target===$(t.mousewheel)[0]||$(e.target).parents(t.mousewheel).length)?!0:void e.preventDefault()}),t.mousewheel&&CrazyPopUp.disableScroll($(t.mousewheel)),w&&"iframe"!=p&&CrazyPopUp.disableScroll(m)}}},disableScroll:function(e){$(window).off("mousewheel").on("mousewheel",function(e){$(e.srcElement).is("#crazyPopUp_background")&&e.preventDefault()}),e.hasClass(t.content)||e.hasClass("crazyPopUp_content")||($(".crazyPopUp_container "+t.content).off("mousewheel").on("mousewheel",function(t){var o=e.attr("class");"undefined"!=typeof o&&null!=o&&(o=o.split(" ")[0],$(t.srcElement).parents("."+o).length||t.preventDefault())}),$(".crazyPopUp_container").off("mousewheel").on("mousewheel",function(e){$(e.srcElement).parents(t.content).length||$(e.srcElement).parents(t.header).length||!$(e.srcElement).parents(".crazyPopUp_content").length||e.preventDefault()})),$(".crazyPopUp_container "+t.header).off("mousewheel").on("mousewheel",function(e){e.preventDefault()}),e.off("mousewheel").on("mousewheel",function(e){var t=$(this);return t[0].scrollHeight-t.height()<10?!1:t[0].scrollHeight-t.outerHeight()==t.scrollTop()&&e.originalEvent.wheelDelta<0?!1:0==t.scrollTop()&&e.originalEvent.wheelDelta>0?!1:!0})},enableScroll:function(){n.off("mousewheel"),$(window).off("mousewheel")},onShow:function(){},onHide:function(){},settings_basic:function(){var e={buttonClose:"closeLightview",addButtonClose:!1,url:!1,setStyles:!1,addClass:!1,fixPosition:!1,closeOnOut:!0,width:!1,height:!1,animate:"scale",scroll:!0,mousewheel:!1,overflow:"hidden",searchContent:!0,header:".crazy_header",content:".crazy_content",submitControl:!0,onSubmit_success:!1,onSubmit_error:!1,iframeScrolling:!1,margin:150,fixedParams:[-1],ajax:!1,ajaxCallback:!1,validation:function(){},onShow:CrazyPopUp.onShow,onHide:CrazyPopUp.onHide,waitLoading:!1,source_element:void 0};return e},get_settings:function(){return t},restore_settings:function(){t=CrazyPopUp.settings_basic()}},window.CrazyPopUp=CrazyPopUp,CrazyPopUp.init();var t=CrazyPopUp.settings_basic(),o=CrazyPopUp.settings_basic(),i=!1,n=$(document)}();