function alert(n,t){typeof t=="undefined"&&(t=n,n="");$.jAlert({title:n,content:t})}function confirm(n,t){$.jAlert({type:"confirm",onConfirm:n,onDeny:t})}function showAlert(n,t,i){$.jAlert({title:n,content:t,theme:i})}function successAlert(n,t){typeof t=="undefined"&&(t=n,n="Success");showAlert(n,t,"green")}function errorAlert(n,t){typeof t=="undefined"&&(t=n,n="Error");showAlert(n,t,"red")}function infoAlert(n,t){typeof t=="undefined"&&(t=n,n="Info");showAlert(n,t,"blue")}function warningAlert(n,t){typeof t=="undefined"&&(t=n,n="Warning");showAlert(n,t,"yellow")}function blackAlert(n,t){typeof t=="undefined"&&(t=n,n="Warning");showAlert(n,t,"black")}function imageAlert(n,t){typeof t=="auto"&&(iframeHeight=!1);$.jAlert({image:n,imageWidth:t})}function videoAlert(n){$.jAlert({video:n})}function iframeAlert(n,t){typeof t=="undefined"&&(t=!1);$.jAlert({iframe:n,iframeHeight:t})}function ajaxAlert(n,t){typeof t=="undefined"&&(t=function(){return!1});$.jAlert({ajax:n,onOpen:t})}(function(n){Date.now||(Date.now=function(){return+new Date});n.fn.jAlert=function(t){var l,e,i,a,u,o,s;n("body").focus();n("body").blur();var h={xsmall:"xsm",small:"sm",medium:"md",large:"lg",xlarge:"xlg"},f=[],r=["animated"],c=[];return this.length>1?(this.each(function(){n.fn.jAlert(t)}),this):typeof n(this)[0]!="undefined"&&n(this)[0].jAlert!="undefined"?n(this)[0].jAlert:(n.each(n.fn.jAlert.defaults,function(n){var i=n.toLowerCase();typeof t[i]!="undefined"&&(t[n]=t[i])}),t=n.extend({},n.fn.jAlert.defaults,t),t.id?e=t.id:(l=Date.now().toString()+Math.floor(Math.random()*1e5),e="ja_"+l),i={set:function(n,t){return i[n]=t,i},__set:function(n,t){return i.set(n,t)},get:function(n){return i[n]},__get:function(n){return i.get(n)},centerAlert:function(){var u=n(window).height(),f=i.instance.height(),r=u-f,t=r/2;return t=t>200?t-100:t,t=t<=0?0:t,t=t-1,i.instance.css("margin-top",t+"px"),i.instance.css("margin-bottom","0px"),n("body").css("overflow","hidden"),r>5?i.instance.parents(".ja_wrap").css("position","fixed"):(i.instance.parents(".ja_wrap").css("position","absolute"),n("html, body").animate({scrollTop:top-50},200)),i},animateAlert:function(t){return t=="hide"?(i.instance.jAlert().blurBackground&&n("body").removeClass("ja_blur"),i.instance.removeClass(i.showAnimation).addClass(i.hideAnimation)):(i.instance.jAlert().blurBackground&&n("body").addClass("ja_blur"),i.centerAlert(),i.instance.addClass(i.showAnimation).removeClass(i.hideAnimation).show()),i},closeAlert:function(t,r){return t!=!1&&(t=!0),i.instance&&(i.instance.unbind("DOMSubtreeModified"),i.animateAlert("hide"),window.setTimeout(function(){var u=i.instance.parents(".ja_wrap");if(t?u.remove():u.hide(),typeof r=="function")r(i.instance);else if(typeof i.onClose=="function")i.onClose(i.instance);n(".jAlert:visible").length>0?n(".jAlert:visible:last").jAlert().centerAlert():n("body").css("overflow","auto")},i.animationTimeout)),i},showAlert:function(t,r,u,f){t!=!1&&(t=!0);r!==!1&&(r=!0);t&&n(".jAlert:visible").jAlert().closeAlert(r);var e=i.instance.parents(".ja_wrap");return n("body").append(e),i.animateAlert("show"),typeof f=="function"&&(i.onClose=f),window.setTimeout(function(){typeof u=="function"&&u(i.instance)},i.animationTimeout),i}},n.each(t,function(n,t){i.set(n,t)}),i.set("id",e),i.content&&i.content.indexOf("#")===0&&n(i.content).length>0&&(i.content=n(i.content).html()),i.video&&i.video.indexOf("youtube.com/watch?v=")>-1&&i.video.indexOf("embed")===-1&&(i.video=i.video.replace("watch?v=","embed/")),i.type=="confirm"&&(i.content||(i.content=i.confirmQuestion),i.btns=[{text:i.confirmBtnText,theme:"green","class":"confirmBtn",closeAlert:!0,onClick:i.onConfirm},{text:i.denyBtnText,theme:"red","class":"denyBtn",closeAlert:!0,onClick:i.onDeny}],i.autofocus=i.confirmAutofocus),i.color&&(i.theme=i.color),n.inArray(i.theme,["default","green","dark_green","red","dark_red","black","brown","gray","dark_gray","blue","dark_blue","yellow"])==-1)?(console.log("jAlert Config Error: Invalid theme selection."),!1):(r.push("ja_"+i.theme),i["class"]&&r.push(i["class"]),i.classes&&r.push(i.classes),i.fullscreen&&r.push("ja_fullscreen"),i.noPadContent&&r.push("ja_no_pad"),i.title||r.push("ja_noTitle"),i.width&&(i.size=i.width),i.size&&typeof i.size=="object"&&(typeof i.size.width=="undefined"||typeof i.size.height=="undefined"))?(console.log("jAlert Config Error: Invalid size selection (try a preset or make sure you're including height and width in your size object)."),!1):(i.size?typeof i.size=="object"?(f.push("width: "+i.size.width+";"),f.push("height: "+i.size.height+";"),r.push("ja_setheight")):(typeof h[i.size]!="undefined"&&(i.size=h[i.size]),n.inArray(i.size,["xsm","sm","md","lg","xlg","full","auto"])>-1?r.push("ja_"+i.size):f.push("width: "+i.size+";")):r.push("ja_sm"),n.inArray(i.backgroundColor,["white","black"])==-1)?(console.log("jAlert Config Error: Invalid background color selection."),!1):(c.push("ja_wrap_"+i.backgroundColor),i.onOpen=[i.onOpen],a="onload='$.fn.jAlert.mediaLoaded($(this))'",u="<div class='ja_loader'>Loading...<\/div>",i.picture&&(i.image=i.picture),i.image?(i.content="<div class='ja_media_wrap'>"+u+"<img src='"+i.image+"' class='ja_img' "+a+"'",i.imageWidth&&(i.content+=" style='width: "+i.imageWidth+"'"),i.content+="><\/div>"):i.video?(i.content="<div class='ja_media_wrap'>"+u+"<div class='ja_video'><\/div><\/div>",i.onOpen.unshift(function(t){var i=document.createElement("iframe");i.src=t.jAlert().video;i.addEventListener?i.addEventListener("load",function(){n.fn.jAlert.mediaLoaded(n(this))},!0):i.attachEvent?i.attachEvent("onload",function(){n.fn.jAlert.mediaLoaded(n(this))}):i.onload=function(){n.fn.jAlert.mediaLoaded(n(this))};t.find(".ja_video").append(i)})):i.iframe?(i.iframeHeight||(i.iframeHeight=n(window).height()+"px"),i.content="<div class='ja_media_wrap'>"+u+"<\/div>",i.onOpen.unshift(function(t){var i=document.createElement("iframe");i.src=t.jAlert().iframe;i.className="ja_iframe";i.addEventListener?i.addEventListener("load",function(){n.fn.jAlert.mediaLoaded(n(this))},!0):i.attachEvent?i.attachEvent("onload",function(){n.fn.jAlert.mediaLoaded(n(this))}):i.onload=function(){n.fn.jAlert.mediaLoaded(n(this))};t.find(".ja_media_wrap").append(i)})):i.ajax&&(i.content="<div class='ja_media_wrap'>"+u+"<\/div>",onAjaxCallbacks=i.onOpen,i.onOpen=[function(t){n.ajax(t.jAlert().ajax,{async:!0,complete:function(i){t.find(".ja_media_wrap").replaceWith(i.responseText);n.each(onAjaxCallbacks,function(n,i){i(t)})},error:function(n){i.onAjaxFail(t,"Error getting content: Code: "+n.status+" : Msg: "+n.statusText)}})}]),o=function(t){if(typeof t.href=="undefined"&&(t.href=""),typeof t["class"]=="undefined"&&(t["class"]=""),t["class"]+=typeof t.theme=="undefined"?" ja_btn_default":" ja_btn_"+t.theme,typeof t.text=="undefined"&&(t.text=""),typeof t.id=="undefined"){var i=Date.now().toString()+Math.floor(Math.random()*1e5);t.id="ja_btn_"+i}typeof t.target=="undefined"&&(t.target="_self");typeof t.closeAlert=="undefined"&&(t.closeAlert=!0);n("body").off("click","#"+t.id);n("body").on("click","#"+t.id,function(i){var u=n(this),r;return(t.closeAlert&&u.parents(".jAlert").jAlert().closeAlert(),r=!0,typeof t.onClick=="function"&&(r=t.onClick(i,u)),!r||t.closeAlert)?(i.preventDefault(),!1):r});return"<a href='"+t.href+"' id='"+t.id+"' target='"+t.target+"' class='ja_btn "+t["class"]+"'>"+t.text+"<\/a> "},s=function(t){var u="",e,s;if(u+='<div class="ja_wrap '+c.join(" ")+'"><div class="jAlert '+r.join(" ")+'" style="'+f.join(" ")+'" id="'+i.id+'"><div>',i.closeBtn&&(u+="<div class='closejAlert ja_close",i.closeBtnAlt?u+=" ja_close_alt":i.closeBtnRoundWhite?u+=" ja_close_round_white":i.closeBtnRound&&(u+=" ja_close_round"),u+="'>&times;<\/div>"),i.title&&(u+="<div class='ja_title'><div>"+i.title+"<\/div><\/div>"),u+='<div class="ja_body">'+t,i.btns&&(u+='<div class="ja_btn_wrap ',i.btnBackground&&(u+="optBack"),u+='">'),typeof i.btns[0]=="object"?n.each(i.btns,function(n,t){typeof t=="object"&&(u+=o(t))}):typeof i.btns=="object"?u+=o(i.btns):i.btns&&console.log("jAlert Config Error: Incorrect value for btns (must be object or array of objects): "+i.btns),i.btns&&(u+="<\/div>"),u+="<\/div><\/div><\/div><\/div>",e=n(u),i.replaceOtherAlerts&&(s=n(".jAlert:visible"),s.each(function(){n(this).jAlert().closeAlert()})),n("body").append(e),i.instance=n("#"+i.id),i.instance[0].jAlert=i,n("body").css("overflow","hidden"),i.animateAlert("show"),i.closeBtn)i.instance.on("click",".closejAlert",function(t){return t.preventDefault(),n(this).parents(".jAlert:first").jAlert().closeAlert(),!1});if(i.closeOnClick){n(document).off("mouseup touchstart",n.fn.jAlert.onMouseUp);n(document).on("mouseup touchstart",n.fn.jAlert.onMouseUp)}if(i.closeOnEsc){n(document).off("keydown",n.fn.jAlert.onEscKeyDown);n(document).on("keydown",n.fn.jAlert.onEscKeyDown)}return i.onOpen&&n.each(i.onOpen,function(n,t){t(i.instance)}),i.autofocus?i.instance.find(i.autofocus).focus():i.instance.focus(),i.instance.bind("DOMSubtreeModified",function(){i.centerAlert()}),i.instance},this.initialize=function(){return i.content||i.image||i.video||i.iframe||i.ajax?(i.content||(i.content=""),s(i.content)):(console.log("jAlert potential error: No content defined"),s(""))},this.initialize(),i)};n.fn.jAlert.defaults={title:!1,content:!1,noPadContent:!1,fullscreen:!1,image:!1,imageWidth:"auto",video:!1,ajax:!1,onAjaxFail:function(n,t){n.jAlert().closeAlert();errorAlert(t)},iframe:!1,iframeHeight:!1,"class":"",classes:"",id:!1,showAnimation:"fadeInUp",hideAnimation:"fadeOutDown",animationTimeout:600,theme:"default",backgroundColor:"black",blurBackground:!1,size:!1,replaceOtherAlerts:!1,closeOnClick:!1,closeOnEsc:!0,closeBtn:!0,closeBtnAlt:!1,closeBtnRound:!0,closeBtnRoundWhite:!1,btns:!1,btnBackground:!0,autofocus:!1,onOpen:function(){return!1},onClose:function(){return!1},type:"modal",confirmQuestion:"Are you sure?",confirmBtnText:"Yes",denyBtnText:"No",confirmAutofocus:".confirmBtn",onConfirm:function(n){return n.preventDefault(),console.log("confirmed"),!1},onDeny:function(n){return n.preventDefault(),!1}};n.fn.jAlert.onMouseUp=function(t){var r=t.target?t.target:t.srcElement,i=n(".jAlert:visible:last");i.length>0&&i.jAlert().closeOnClick&&(n(r).is(".jAlert *")||i.jAlert().closeAlert())};n.fn.jAlert.onEscKeyDown=function(t){if(t.keyCode===27){var i=n(".jAlert:visible:last");i.length>0&&i.jAlert().closeOnEsc&&i.jAlert().closeAlert()}};n.fn.attachjAlert=function(t){return t.preventDefault(),n.jAlert(n(this).data()),!1};n.jAlert=function(t){if(t=="current"){var i=n(".jAlert:visible:last");return i.length>0?i.jAlert():!1}if(t=="attach"){n("[data-jAlert]").off("click",n.fn.attachjAlert);n("[data-jAlert]").on("click",n.fn.attachjAlert);n("[data-jalert]").off("click",n.fn.attachjAlert);n("[data-jalert]").on("click",n.fn.attachjAlert);return!1}return n.fn.jAlert(t)};n.fn.alertOnClick=function(t){n(this).on("click",function(i){return i.preventDefault(),n.jAlert(t),!1})};n.alertOnClick=function(t,i){n("body").on("click",t,function(t){return t.preventDefault(),n.jAlert(i),!1})};n.fn.closeAlert=function(t,i){n(this).jAlert().closeAlert(t,i)};var t;n(window).resize(function(){window.clearTimeout(t);t=window.setTimeout(function(){n(".jAlert:visible").each(function(){n(this).jAlert().centerAlert()})},200)});n.fn.jAlert.mediaLoaded=function(n){var i=n.parents(".ja_media_wrap"),r=i.find(".ja_video"),u=n.parents(".jAlert:first"),t=u.jAlert();i.find(".ja_loader").remove();r.length>0?r.fadeIn("fast"):n.fadeIn("fast");typeof t.iframeHeight!="undefined"&&t.iframeHeight&&(n.css("display","block"),n.height(t.iframeHeight));t.centerAlert()}})(jQuery)