function closeAllPopovers(){$(".fixed_skills").slideUp();$(".fixed_footer").slideUp();$(".fixed_search").slideUp();$(".reader_bio").slideUp();$(".call_now_details").removeClass("show")}function addGoogleAnalyticsEventTelLink(n){$('a[href^="tel:"]',n).click(function(){typeof gtag!="undefined"&&gtag("event","Links - tel",{event_action:"Click",event_category:"Links - tel",event_label:$(this).attr("href").substring(4)})})}function addGoogleAnalyticsEventSmsLink(n){$('a[href^="sms:"]',n).click(function(){typeof gtag!="undefined"&&gtag("event","Links - sms",{event_action:"Click",event_category:"Links - sms",event_label:$(this).attr("href").substring(4)})})}function addGoogleAnalyticsEventMailtoLink(n){$('a[href^="mailto:"]',n).click(function(){typeof gtag!="undefined"&&gtag("event","Links - mailto",{event_action:"Click",event_category:"Links - mailto",event_label:$(this).attr("href").substring(7)})})}function addGoogleAnalyticsEventExpertSessionStart(n){$(".start_btn",n).click(function(){var n=$("input[id$=hfOnlineChatExpertId]").val();typeof gtag!="undefined"&&gtag("event","Expert-Session-Start",{event_action:"IM Session",event_category:"Expert-Session-Start",event_label:n!=="undefined"?n:""})})}function getComputedHeight(n){var i,r,t,u;if(n){if(i=function(n){var i=window.getComputedStyle(n,null),t,r;return i&&i!==null&&(t=i.getPropertyValue("height"),t&&t!==null&&(r=t.replace("px",""),!isNaN(r)))?parseFloat(r):null},n.jquery){if(window.getComputedStyle&&n.length>0){for(r=0,t=0;t<n.length;t++)r+=i(n[t]);return r}return u=n.height(),u===undefined?null:u}if(window.getComputedStyle)return i(n)}return null}function forceWebkitRedraw(n){n&&(n.jquery?n.is(":visible")&&(n.hide(),n.each(function(){this.offsetHeight}),n.show()):(n.style.display="none",n.offsetHeight,n.style.display="block"))}function elementIsOnScreen(n){var u=$(n),t=$(window).scrollTop(),f=t+$(window).height(),i=$(window).scrollLeft(),e=i+$(window).width(),r=!1;return u.each(function(){var u=$(this),n=u.offset(),o=n===null?null:n.top,h=o+u.outerHeight(),s=n===null?null:n.left,c=s+u.outerWidth();if(o<f&&h>t&&s<e&&c>i)return r=!0,!1}),r}function repositionCallNowPopover(n,t){var i=$(".call_now_details",n);if(t)closeAllPopovers(),i.addClass("show");else if(!i.is(":visible"))return;repositionPopover(i)}function repositionPopover(n){var e;n instanceof jQuery||(n=$(n));e=$("#fixed_nav .nav_menu");n.css("top","");n.css("left","");var a=$(window).scrollTop(),o=a+$(window).height(),v=$(window).scrollLeft(),w=v+$(window).width();e.is(":visible")&&(o=o-e.height());var f=n.offset(),r=f===null?null:f.top,s=r+n.outerHeight(),u=f===null?null:f.left,h=u+n.outerWidth(),c=r-a,y=s-o,l=u-v,p=h-w,t=0,i=0;c<=0?t=c*-1:y>0&&(t=-Math.min(y,c));l<=0?i=l*-1:p>0&&(i=-Math.min(p,l));r+t<0?t=-r:s+t>$(document).height()&&(t=$(document).height()-s);u+i<0?i=-u:h+i>$(document).width()&&(i=$(document).width()-h);(t!==0||i!==0)&&n.offset({top:r+t,left:u+i})}function initialiseCallNowPopovers(n){$(".reader, .reader_detail").each(function(){var t=this,i=$(".call_now_button",t),r=$(".phone-numbers>select",t),u=function(){repositionCallNowPopover(i,!1)},f=function(n){var i=n.data("accountrequired"),r;i=i?i:[];r=n.find(":selected").val();i.indexOf(r)>=0?$("div .account-info",t).addClass("account-required"):$("div .account-info",t).removeClass("account-required")};$(r).on("change",function(){f(r)});i.click(function(){f(r);$(".call_now_details",this).is(":visible")||(repositionCallNowPopover(i,!0),$(window).resize(u),$(".call_now_details",t).find(".call_now_error").removeClass("popoverVisible"))});$(".close,.confirmNo",this).click(function(){return $(".call_now_details",t).removeClass("show"),$(window).off("resize",u),$(".call_now_details",t).find(".call_now_error").removeClass("popoverVisible"),!1});n&&n===!0&&addGoogleAnalyticsEventTelLink(this)})}function readerFilterResize(){$(".skillSelectionHolder, .filterCriteriaHolder, .sms_readers .header").each(function(){$(".filter_trigger",this).is(":visible")||$(".skillSelection, .filterCriteria",this).show()})}function initialiseReaderFilterToggle(){$(".skillSelectionHolder, .filterCriteriaHolder, .sms_readers .header").each(function(){var n=this;$(".filter_trigger",n).click(function(){$(".filter_trigger span",n).toggleClass("open_filter");$(".filterCriteria, .skillSelection",n).toggleClass("open_criteria")})})}function initialiseExpertLoad(){$(".expertLoad").each(function(){var n=this;$(".show_more",this).click(function(){var t=parseInt($(".choose_number select option:selected",n).val());typeof gtag!="undefined"&&gtag("event","Buttons - show more experts",{event_action:"Click",event_category:"Buttons - show more experts",value:t})})})}function initialiseReaderBioToggle(){$("#onlineChatExpertPanel .reader_bio_toggle").click(function(){return $(".reader_bio").is(":visible")?($(".reader_bio").slideUp(),$(".reader_bio_toggle").addClass("closed"),$(".reader_bio_toggle").removeClass("opened")):(closeAllPopovers(),$(".reader_bio").slideDown(),$(".reader_bio_toggle").addClass("opened"),$(".reader_bio_toggle").removeClass("closed")),!1})}function setUserDesktopSite(n){var t=n?1:-1;Cookies.set("user_accepted_desktop","user_accepted_desktop",{expires:t,path:"/"})}function performExpertSearch(n){window.location=protocol+"//"+currentHostname+searchUrl+n+"/"}function IsKeyPressed(n,t){return(n.which?n.which===t:!1)||(n.keyCode?n.keyCode===t:!1)||(n.key?n.key===t:!1)}function detectIE(){var n=window.navigator.userAgent,i=n.indexOf("MSIE "),u,r,t;return i>0?parseInt(n.substring(i+5,n.indexOf(".",i)),10):(u=n.indexOf("Trident/"),u>0)?(r=n.indexOf("rv:"),parseInt(n.substring(r+3,n.indexOf(".",r)),10)):(t=n.indexOf("Edge/"),t>0)?parseInt(n.substring(t+5,n.indexOf(".",t)),10):!1}function detectSafari(){let n=window.navigator.userAgent;if(n.indexOf("Safari")!=-1&&n.indexOf("Chrome")==-1){let t=n.indexOf("Version/");if(t)return parseInt(n.substring(t+8,n.indexOf(".",t)),10)}return!1}function safariFixes(){var n=detectSafari();n&&n<=8&&$("#IEBanner").removeClass("hidden")}function internetExplorerFixes(){var n=detectIE();n&&n<=11&&$("#IEBanner").removeClass("hidden")}function fixedNavPositionFix(){var n=$("#fixed_nav"),t;n.is(":visible")&&(t=function(t){t===!0&&n.css("position","absolute");var i=window.innerHeight?window.innerHeight:$(window).height(),r=window.pageYOffset?window.pageYOffset:$(window).scrollTop();n.css("top",r+i-52+"px");forceWebkitRedraw(n)},t(!0),$(window).scroll(function(){t(!1)}),$(window).resize(function(){t(!1)}))}function fixedNavPositionFixForForms(){var n=$("#fixed_nav");n.is(":visible")&&($("input").not("#fixed_nav input").focus(function(){n.hide()}),$("input").not("#fixed_nav input").blur(function(){n.show()}))}function iOSversion(){if(/iP(hone|od|ad)/.test(navigator.platform)){var n=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3]||0,10)]}return null}function iOSFixes(){var n=iOSversion();n&&n!==null&&(n[0]<5?fixedNavPositionFix():fixedNavPositionFixForForms())}function androidFixes(){var n=navigator.userAgent,t,i;n&&n!==null&&(t=n.indexOf("Android"),t>=0&&(i=parseFloat(n.slice(t+8)),i<3&&fixedNavPositionFix()))}function ieMobileFixes(){var n=navigator.userAgent,i,r,t,u;n&&n!==null&&(i=n.indexOf("IEMobile"),i>=0&&(r=n.slice(i+8),t=r.match(/\d+\.\d+/),t!==null&&t.length>0&&(u=parseFloat(t[0]),u<10&&fixedNavPositionFix())))}function layoutWidgets(){$(".widget_container_main").each(function(){var n=$(this),s=$(".repeatingSectionContainer",n),h=$(".hideIfNoRoom",n),c=$(".hideIfNoRoomLast",n),r,k,o,f,a,v,nt,tt,y,it,p;if(s.length===1||h.length>0||c.length>0){if(r=n.closest("aside"),!n.is(":visible"))return r.height("auto"),n.height("auto"),!1;var l=r.prev("section"),w=r.offset(),ut=w===null?null:w.left,b=l.offset(),ft=b===null?null:b.left,et=ft+l.outerWidth();if(ut<et)r.height("auto"),n.height("auto"),h.hide(),c.show();else{h.show();c.show();k=getComputedHeight(l);r.height(k);var t=getComputedHeight(n),ot=getComputedHeight(n.siblings()),st=getComputedHeight(r),u=st-ot,e=0;if(s.length===1){var i=s.first(),d=$(".repeatingSection",i),g=d.length;if(g>0){if(n.height("100%"),i.height("100%"),o=d.first(),f=getComputedHeight(o),f>0&&(a=getComputedHeight(i),v=g*f,a>v))for(nt=a-v,tt=Math.ceil(nt/f),y=0;y<tt;y++)o.clone().appendTo(i);if(i.height("auto"),n.height("auto"),t=getComputedHeight(n),t>u&&(it=t-u,p=$(".widget",o).length,p>0)){var rt=f/p,ht=Math.ceil(it/rt),ct=ht*rt;e=getComputedHeight(i);i.height(Math.floor(e-ct))}}e=getComputedHeight(i)}t=getComputedHeight(n);t>u&&e===0&&($($(".hideIfNoRoom",n).get().reverse()).each(function(){return $(this).hide(),t=getComputedHeight(n),t<=u?!1:void 0}),t>u&&$($(".hideIfNoRoomLast",n).get().reverse()).each(function(){return $(this).hide(),t=getComputedHeight(n),t<=u?!1:void 0}))}}});$(window).trigger("layoutWidgetsComplete")}function addToSelect(n,t,i,r){$(n).append($("<option><\/option>").val(t).html(i).attr("selected",r))}function InitialiseWebFormsValidatorOverrides(){var t=window.ValidatorUpdateDisplay,n=function(n){var i,r,u;t(n);i=document.getElementById(n.controltovalidate);r=n.isvalid;r&&i&&(u=i.Validators.filter(function(t){return t.isvalid===!1&&t!==n}),u.length>0&&(r=!1));i&&i.setCustomValidity(r?"":n.errormessage)};window.ValidatorUpdateDisplay!==n&&(window.ValidatorUpdateDisplay=n)}function InitialiseJqueryValidationOverrides(){if($&&$.validator){$("form").each(function(){var t=this,n=$(t).data("validator"),i,r,u,f,e,o;if(n&&n.settings&&(i=n.settings.errorPlacement,r=function(){var r,u,n;i&&i.apply(t,arguments);r=arguments&&arguments.length>0?arguments[0]:null;u=arguments&&arguments.length>1?arguments[1]:null;u&&(n=r?$(r)[0].textContent:null,n=n?n:"Error",$(u).each(function(){this.setCustomValidity(n)}))},n.settings.errorPlacement!==r&&(n.settings.errorPlacement=r),u=n.settings.success,f=function(){u&&u.apply(t,arguments);var n=arguments&&arguments.length>1?arguments[1]:null;n&&$(n).each(function(){this.setCustomValidity("")})},n.settings.success!==f&&(n.settings.success=f),e=n.settings.invalidHandler,o=function(){e&&e.apply(t,arguments)},n.settings.invalidHandler!==o)){n.settings.invalidHandler=o;$(t).off("invalid-form.validate",n.settings.invalidHandler);$(t).on("invalid-form.validate",n.settings.invalidHandler)}});var n=$.validator.methods.range;$.validator.methods.range=function(t,i,r){return i.type==="checkbox"?i.checked:n.call(this,t,i,r)}}}function isFourDTestSystem(){return typeof fourDTestSystem!="undefined"}function CyberSourcePayment(n,t,i){$(".cyberSourceButton").addClass("aspNetDisabled");$(".error_message").empty();CyberSource.RequestPayment2(n,t,i,function(n){n?window.location.replace("/My-Account/Review/"):($(".cyberSourceButton").removeClass("aspNetDisabled"),$(".error_message").append("<span>The transaction failed. Please try again.<\/span>"))})}function GetParentPopOver(n){return $(n).closest(".call_now_details")}function GetParentButton(n){return $(n).closest(".call_now_button")}function GetExpertAvailability(n){return GetParentButton(n).find("[data-availability]").data("availability")}function GetCurrentStage(n){var t=GetParentButton(n).find("[data-stage]").data("stage");return t?t:1}function GetPopoverConfirmation(n){return GetParentPopOver(n).find(".popoverConfirmation")}function ShowStage(n,t,i){var r=$(n).find("[data-type]");GetParentButton(n).find("[data-stage]").data("stage",i);r&&r.length>0&&Array.forEach(r,function(n){$(n).addClass("hidden");Array.forEach(JSON.parse($(n).data("type").replace(/'/g,'"')),function(r){r.Availability==t&&Array.forEach(r.Stage,function(t){t==i&&$(n).removeClass("hidden")})})})}function CheckCallBackRequest(n){var t=GetParentButton(n).find("[data-expertId]").data("expertid");CallBack.GetRequest(t,function(t){var i,r;pollingOnRunning&&(t.ExpertCallBackDto?(i=CallBack.GetStatusConfiguration(t.ExpertCallBackDto.StatusId),i&&i!=""?(r=GetParentPopOver(n),i.type==CallBack.StatusType.waiting?(requestCanBeCancelled=t.ExpertCallBackDto.RequestCanBeCancelled,setTimeout(function(){CheckCallBackRequest(n)},CallBack.ClientConfigurations.DefaultPollingTime)):(pollingOnRunning=!1,requestCanBeCancelled=!0,i.type==CallBack.StatusType.completedAndClose&&setTimeout(function(){$(r).find(".close").click();ResetCallBackRequest(n);ShowStage(r,1,1)},CallBack.ClientConfigurations.DefaultCloseTimer)),$(n).find(".callBackStatusIcon").removeClass().addClass(i.icon).addClass("callBackStatusIcon"),$(n).find(".callBackStatusText").text(i.label),t.ExpertCallBackDto.StatusId==CallBack.Status.InsufficientCredit&&(GetPopoverConfirmation(currentButton).addClass("popoverVisible"),ShowStage(r,1,4)),t.ExpertCallBackDto.StatusId==CallBack.Status.ExpertBusy&&(GetPopoverConfirmation(n).addClass("popoverVisible"),ShowStage(r,1,3))):(pollingOnRunning=!1,requestCanBeCancelled=!0)):(pollingOnRunning=!1,requestCanBeCancelled=!0,t.ServiceOperationOutcome==80&&window.location.replace("/login")))})}function ResetCallBackRequest(n){pollingOnRunning=!1;requestCanBeCancelled=!1;$(n).find(".callBackStatusText").text("Call Me Now");$(n).find(".callBackStatusIcon").removeClass().addClass("callBackStatusIcon")}var AddressesByPostcode,InitialiseCardDetailsForm,InitialisePayment,CallBack;(function(n){var t=!1,r,i;typeof define=="function"&&define.amd&&(define(n),t=!0);typeof exports=="object"&&(module.exports=n(),t=!0);t||(r=window.Cookies,i=window.Cookies=n(),i.noConflict=function(){return window.Cookies=r,i})})(function(){function n(){for(var n=0,r={},t,i;n<arguments.length;n++){t=arguments[n];for(i in t)r[i]=t[i]}return r}function t(i){function r(t,u,f){var o,c,l,s,v,e,h;if(typeof document!="undefined"){if(arguments.length>1){f=n({path:"/"},r.defaults,f);typeof f.expires=="number"&&(c=new Date,c.setMilliseconds(c.getMilliseconds()+f.expires*864e5),f.expires=c);f.expires=f.expires?f.expires.toUTCString():"";try{o=JSON.stringify(u);/^[\{\[]/.test(o)&&(u=o)}catch(w){}u=i.write?i.write(u,t):encodeURIComponent(String(u)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);t=encodeURIComponent(String(t));t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);t=t.replace(/[\(\)]/g,escape);l="";for(s in f)f[s]&&(l+="; "+s,f[s]!==!0)&&(l+="="+f[s]);return document.cookie=t+"="+u+l}t||(o={});for(var y=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,a=0;a<y.length;a++){v=y[a].split("=");e=v.slice(1).join("=");this.json||e.charAt(0)!=='"'||(e=e.slice(1,-1));try{if(h=v[0].replace(p,decodeURIComponent),e=i.read?i.read(e,h):i(e,h)||e.replace(p,decodeURIComponent),this.json)try{e=JSON.parse(e)}catch(w){}if(t===h){o=e;break}t||(o[h]=e)}catch(w){}}return o}}return r.set=r,r.get=function(n){return r.call(r,n)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,i){r(t,"",n(i,{expires:-1}))},r.withConverter=t,r}return t(function(){})});var GETADDRESSESBYPOSTCODE="/Location/GetAddressesByPostcode",ONLINE_CHAT_MESSENGER_CALLBACK_ENDPOINT="/OnlineChatMessenger/MessengerCallbackHandler",GOOGLE_ANALYTICS_ENDPOINT="/GoogleAnalytics/LogClientId",TRANSACTION_HISTORY_ENDPOINT="/Account/GetTransactionHistory",REQUEST_PAYMENT_ENDPOINT="/Account/RequestPayment",REQUEST_CALL_BACK_ENDPOINT="/CallBack/RequestCallBack",REQUESTCREDITCARDPAYMENT="/CyberSourceSop/RequestPaymentFields",currentURL=window.location,host=window.location.host,hostname=window.location.hostname,protocol=window.location.protocol,port=window.location.port,currentHostname=port===80||port===443?hostname:host,searchWatermark="Reader Name/Pin",searchUrl="/Psychic-Reader-Search/Name-Pin/";$(".loginRequired").click(function(){var n=confirm($(this).attr("title"));n===!0&&(window.location="/Login/")});$(".noReading").click(function(){alert($(this).attr("title"))});$("#mast_bottom").length||$(".mast-wrap").addClass("hide-mobile");$(function(){var i,n,u,r,t,f;try{typeof gtag!="undefined"&&typeof googleAnalyticsProfile!="undefined"&&typeof googleAnalyticsClientId!="undefined"&&(googleAnalyticsClientId===""||googleAnalyticsClientId===null)&&gtag("get",googleAnalyticsProfile,"client_id",function(n){googleAnalyticsClientId=n;var t={clientId:googleAnalyticsClientId};$.ajax({data:JSON.stringify(t),type:"POST",contentType:"application/json; charset=utf-8",url:GOOGLE_ANALYTICS_ENDPOINT,dataType:"json"})});$(".share-btn").each(function(){$(this).attr("href",$(this).attr("href")+currentURL.href)});$(".fb_like_btn .button").html("<div class='fb-like' data-href='"+currentURL+"' data-send='false' data-layout='box_count' data-width='55' data-show-faces='false'><\/div>");$(".google_plus_btn .button").html("<g:plusone size='tall' href='"+currentURL+"'><\/g:plusone>");Cookies.get("user_accepted_desktop")?($("meta[name=viewport]").attr("content","width=1000,initial-scale=1,maximum-scale=1"),$(".desktop_link").hide(),$(".mobile_link").show(),$(".mobile_footer").hide(),$(".mobile_footer").show(),$(".mobile_link").click(function(){setUserDesktopSite(!1)})):($(".mobile_link").hide(),$(".desktop_link").show(),$(".desktop_link").click(function(){setUserDesktopSite(!0)}));$("tile-grid").length===0&&$(".mobile_search, .fixed_search, .search").each(function(){var n=this;$("input",this).each(function(){var t=$(this);t.keypress(function(t){if(IsKeyPressed(t,13)){var i=$(this).val();if(i===null||i.length<1)$(".error",n).show();else return performExpertSearch(i),!1}})});$(".submit",this).click(function(){var t=$("input",n).val();t===null||t.length<1?$(".error",n).show():performExpertSearch(t)})});$("#fixed_nav .nav_menu li.skillsMenuButton").click(function(){$(".fixed_skills").is(":visible")?$(".fixed_skills").slideUp():(closeAllPopovers(),$(".fixed_skills").slideDown())});$("#fixed_nav .nav_menu li.footerMenuButton").click(function(){$(".fixed_footer").is(":visible")?$(".fixed_footer").slideUp():(closeAllPopovers(),$(".fixed_footer").slideDown())});$("#fixed_nav .nav_menu li.searchMenuButton").click(function(){$(".fixed_search").is(":visible")?$(".fixed_search").slideUp():(closeAllPopovers(),$(".fixed_search").slideDown())});$(".fixed_search input").focus(function(){$(".nav_menu").slideUp()});$(".fixed_search input").blur(function(){$(".nav_menu").slideDown()});i="user_accepted_cookies";n=$("#cookie-notification");Cookies.get(i)?n.remove():(u=function(){Cookies.set(i,i,{expires:365,path:"/"})},n.slideDown("slow"),n.is(":visible")&&(setTimeout(function(){n.slideUp("slow")},5e3),u()),n.click(function(){n.slideUp();u()}));isFourDTestSystem()&&(r="user_accepted_testsystem",t=$("#testsystem-notification"),Cookies.get(r)?t.remove():(f=function(){Cookies.set(r,r,{expires:1/48,path:"/"})},t.slideDown("slow"),t.click(function(){t.slideUp();f()})));internetExplorerFixes();iOSFixes();androidFixes();ieMobileFixes();initialiseReaderFilterToggle();initialiseReaderBioToggle();$(window).resize(readerFilterResize);initialiseCallNowPopovers(!1);initialiseExpertLoad();layoutWidgets();$(window).resize(layoutWidgets);addGoogleAnalyticsEventTelLink();addGoogleAnalyticsEventSmsLink();addGoogleAnalyticsEventMailtoLink();addGoogleAnalyticsEventExpertSessionStart();typeof Sys!="undefined"&&typeof Sys.Application!="undefined"&&typeof Sys.Application.add_load!="undefined"&&Sys.Application.add_load(function(){internetExplorerFixes();initialiseReaderFilterToggle();initialiseReaderBioToggle();initialiseCallNowPopovers(!0);initialiseExpertLoad();layoutWidgets();typeof InitialiseExperts=="function"&&InitialiseExperts()})}catch(e){console.log(e);typeof errorHandler!="undefined"&&errorHandler(e,"FourD.Psychic.WebApp.BaseWebApp.JavaScript.main.js",null)}});$(function(){switch(window.location.hash){case"#upgrade":$("#has-phone-account").prop("checked",!0);$(".show-phone-account").show()}$("#has-phone-account").val(this.checked);$("#has-phone-account").change(function(){this.checked?($(".show-phone-account").show(),window.location.hash="upgrade"):($(".show-phone-account").hide(),window.location.hash="",$(".show-phone-account").find("input").val(""))});typeof InitialiseCardDetailsForm=="function"&&$(".CardDetailsForm").length>0&&InitialiseCardDetailsForm();typeof InitialiseExperts=="function"&&InitialiseExperts();typeof InitialiseTransactionHistory=="function"&&InitialiseTransactionHistory();typeof InitialisePayment=="function"&&InitialisePayment();typeof InitialiseWebFormsValidatorOverrides=="function"&&InitialiseWebFormsValidatorOverrides();typeof InitialiseJqueryValidationOverrides=="function"&&InitialiseJqueryValidationOverrides()}),function(){var n,t=[].indexOf||function(n){for(var t=0,i=this.length;i>t;t++)if(t in this&&this[t]===n)return t;return-1};n=jQuery;n.fn.validateCreditCard=function(i,r){var s,f,u,e,l,a,v,y,o,p,h,w,c;for(e=[{name:"amex",pattern:/^3[47]/,valid_length:[15]},{name:"diners_club_carte_blanche",pattern:/^30[0-5]/,valid_length:[14]},{name:"diners_club_international",pattern:/^36/,valid_length:[14]},{name:"jcb",pattern:/^35(2[89]|[3-8][0-9])/,valid_length:[16]},{name:"laser",pattern:/^(6304|670[69]|6771)/,valid_length:[16,17,18,19]},{name:"visa_electron",pattern:/^(4026|417500|4508|4844|491(3|7))/,valid_length:[16]},{name:"visa",pattern:/^4/,valid_length:[16]},{name:"mastercard",pattern:/^5[1-5]/,valid_length:[16]},{name:"maestro",pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,valid_length:[12,13,14,15,16,17,18,19]},{name:"discover",pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,valid_length:[16]}],s=!1,i&&("object"==typeof i?(r=i,s=!1,i=null):"function"==typeof i&&(s=!0)),null==r&&(r={}),null==r.accept&&(r.accept=function(){var n,i,t;for(t=[],n=0,i=e.length;i>n;n++)f=e[n],t.push(f.name);return t}()),c=r.accept,h=0,w=c.length;w>h;h++)if(u=c[h],t.call(function(){var n,i,t;for(t=[],n=0,i=e.length;i>n;n++)f=e[n],t.push(f.name);return t}(),u)<0)throw"Credit card type '"+u+"' is not supported";return l=function(n){var i,s,o;for(o=function(){var n,u,o,i;for(i=[],n=0,u=e.length;u>n;n++)f=e[n],o=f.name,t.call(r.accept,o)>=0&&i.push(f);return i}(),i=0,s=o.length;s>i;i++)if(u=o[i],n.match(u.pattern))return u;return null},v=function(n){var t,i,r,u,e,f;for(r=0,f=n.split("").reverse(),i=u=0,e=f.length;e>u;i=++u)t=f[i],t=+t,i%2?(t*=2,r+=10>t?t:t-9):r+=t;return r%10==0},a=function(n,i){var r;return r=n.length,t.call(i.valid_length,r)>=0},p=function(){return function(n){var t,i;return u=l(n),i=!1,t=!1,null!=u&&(i=v(n),t=a(n,u)),{card_type:u,valid:i&&t,luhn_valid:i,length_valid:t}}}(this),o=function(t){return function(){var i;return i=y(n(t).val()),p(i)}}(this),y=function(n){return n.replace(/[ -]/g,"")},s?(this.on("input.jccv",function(t){return function(){return n(t).off("keyup.jccv"),i.call(t,o())}}(this)),this.on("keyup.jccv",function(n){return function(){return i.call(n,o())}}(this)),i.call(this,o()),this):o()}}.call(this);AddressesByPostcode={Get:function(n,t,i){var r,u;i||(i=function(){});n=n.toUpperCase();t=t.toUpperCase();r=AddressesByPostcode.GetStoredElement(n,t);r.status==AddressesByPostcode.Status.loaded?i(r.data):(r.status==AddressesByPostcode.Status.empty||r.status==AddressesByPostcode.Status.error)&&(r.status=AddressesByPostcode.Status.waiting,u={postcode:n,countryCode:t},$.ajax({data:JSON.stringify(u),type:"POST",contentType:"application/json; charset=utf-8",url:GETADDRESSESBYPOSTCODE,dataType:"json",success:function(u){var f=AddressesByPostcode.Status.error;u&&(u.ServiceOperationOutcome==10||u.ServiceOperationOutcome==40)&&(f=AddressesByPostcode.Status.loaded);r?r.status!=AddressesByPostcode.Status.loaded&&(r.data=u?u:null,r.status=f):AddressesByPostcode.PostCodeDataStorage.push({id:n+t,data:u?u:null,status:f});i(r.data)},error:function(n,t,i){r.status!=AddressesByPostcode.Status.loaded&&(r.status=AddressesByPostcode.Status.error);i!="abort"&&n.status!=0&&n.readyState!=0&&typeof errorHandler!="undefined"&&errorHandler("AJAXRequest - error callback: "+String(i),"main.js/AJAXRequest/error",null)}}))},GetStoredElement:function(n,t){var i;return i=AddressesByPostcode.PostCodeDataStorage[AddressesByPostcode.PostCodeDataStorage.map(function(n){return n.id}).indexOf(n+t)],i||(AddressesByPostcode.PostCodeDataStorage.push({id:n+t,data:null,status:AddressesByPostcode.Status.empty}),i=AddressesByPostcode.PostCodeDataStorage[AddressesByPostcode.PostCodeDataStorage.map(function(n){return n.id}).indexOf(n+t)]),i},PostCodeDataStorage:[{id:"",data:undefined,status:null}],Status:{empty:0,waiting:1,error:2,loaded:3}};InitialiseCardDetailsForm=function(){function a(){n.data("is-manual-address")?(e=!0,n.text(n.data("list-address")),n.data("is-manual-address",!1),c()):(e=!1,n.text(n.data("manual-address")),n.data("is-manual-address",!0),v())}function v(){i.removeClass("toggleDown");i.addClass("toggleUp");t.removeClass("slide-fade-show");r.show();r.removeClass("hidden");u.show();u.removeClass("hidden");f.show();f.removeClass("hidden");setTimeout(function(){r.addClass("slide-fade-show");u.addClass("slide-fade-show");f.addClass("slide-fade-show");setTimeout(function(){t.hide()},200)},20)}function c(){var n=$("#BillAddress option:selected");n.val()>=0?$("#txtBillToStreet1").val($(n).text()):$("#txtBillToStreet1").val("");r.removeClass("slide-fade-show");u.removeClass("slide-fade-show");f.removeClass("slide-fade-show");$("#BillAddress option").length>0?(i.removeClass("toggleUp"),i.addClass("toggleDown"),t.removeClass("hidden"),t.show()):(i.removeClass("toggleUp"),i.removeClass("toggleDown"));setTimeout(function(){t.addClass("slide-fade-show");setTimeout(function(){r.hide();u.hide();f.hide()},200)},20)}function h(t){$("#liBillToState").hide();$("#ddlBillToState").empty();var i=$("#ddlBillToCountry").val(),r=$("#txtBillToPostalCode"),u=$("#lblBillToPostalCode"),f=$("#ddlBillToCountry").data("lookup"),o=$("#ddlBillToCountry").data("state");f.includes(i)!==!0?(e=!1,n.text(n.data("manual-address")),n.data("is-manual-address",!0),v()):(e=!0,n.text(n.data("list-address")),n.data("is-manual-address",!1),c());r.attr("placeholder","");u.text("Postal Code");i==="CA"&&r.attr("placeholder","A1A 1A1");i==="US"&&(r.attr("placeholder","00000-0000"),u.text("Zip Code (ZIP+4)"));o.includes(i)===!0&&($("#liBillToState").show(),$("#stateList"+i+" option").each(function(){var n=!1;t===this.value&&(n=!0);addToSelect("#ddlBillToState",this.value,this.text,n)}))}var i=$("#toggleArrow"),t=$("#liBillToStreet"),r=$("#liBillToStreetManual"),u=$("#liBillCity"),f=$("#liBillToState"),n=$("#lblToggleAddress"),e=!0,o=!1,l,s;h();$("#txtBillToStreet1").val().length>0&&(i.removeClass("toggleUp"),i.addClass("toggleDown"),t.addClass("slide-fade-show"),t.removeClass("hidden"),t.show());$("#ddlBillToState").length&&($("#ddlBillToState").val()===""?h():(l=$("#ddlBillToState").val(),h(l)));s=function(n,r){var o,u,f;e&&(t.hide(),t.removeClass("slide-fade-show"),i.removeClass("toggleDown"),o=$(".ddlBillToCountry").val(),u=r.replace(/ /g,"").length,u>=5&&u<=10?(f=function(n){if($("#txtBillToPostalCode").val().replace(/ /g,"").toUpperCase()==r.toUpperCase()&&($("#BillAddress").empty(),$("#txtBillToStreet1").val(""),$("#txtBillToCity").val(""),$("#ddlBillToState").val(""),n&&n.Addresses)){var t=$("#BillAddress");$(t).append(new Option("Please select an address...",null,!0,!0));n.Addresses.forEach(function(n,i){$(t).append(new Option((n.PropertyName?n.PropertyName:"")+(n.Street1?(n.PropertyName?", ":"")+n.Street1:"")+(n.Street2?(n.Street1?", ":"")+n.Street2:"")+(n.Street3?(n.Street2?", ":"")+n.Street3:""),i,!1,!1))});n.Addresses.length>=1&&c();$("#ddlBillToState").val(n.Addresses[0].AdministrativeArea);$("#txtBillToCity").val(n.Addresses[0].City)}$("#liloadingAddresses").hide()},$("#liloadingAddresses").removeClass("hidden"),$("#liloadingAddresses").show(),AddressesByPostcode.Get(r,n,f)):$("#BillAddress option").length>0&&($("#txtBillToStreet1").val(""),$("#txtBillToCity").val(""),$("#ddlBillToState").val(""),$("#BillAddress").empty()))};$("#btnRemoveCard").on("click",function(){o||(o=!0,$("#lblExistingCardRemoveSuccess").addClass("hidden"),$("#lblExistingCardRemoveFailure").addClass("hidden"),$("#btnRemoveCard").addClass("aspNetDisabled"),$.ajax({url:"/Account/RemoveCard",type:"POST",cache:!1,dataType:"json",success:function(n){n?n.removed?($("#lblExistingCardRemoveFailure").addClass("hidden"),$("#lblExistingCardRemoveSuccess").removeClass("hidden"),$("#currentCardDetails").remove(),$("#btnRemoveCard").remove()):($("#lblExistingCardRemoveSuccess").addClass("hidden"),$("#lblExistingCardRemoveFailure").removeClass("hidden"),$("#btnRemoveCard").removeClass("aspNetDisabled")):($("#lblExistingCardRemoveSuccess").addClass("hidden"),$("#lblExistingCardRemoveFailure").removeClass("hidden"),$("#btnRemoveCard").removeClass("aspNetDisabled"));o=!1},error:function(){$("#lblExistingCardRemoveSuccess").addClass("hidden");$("#lblExistingCardRemoveFailure").removeClass("hidden");$("#btnRemoveCard").removeClass("aspNetDisabled");o=!1}}))});$("#ddlBillToCountry").on("change",function(){h();s($("#ddlBillToCountry").val(),$("#txtBillToPostalCode").val().replace(/ /g,""))});$("#btnRequestAddressesByPostcode").on("click",function(){s($("#ddlBillToCountry").val(),$("#txtBillToPostalCode").val().replace(/ /g,""))});$("#txtBillToPostalCode").on("keyup",function(){s($("#ddlBillToCountry").val(),$(this).val().replace(/ /g,""))});$("#BillAddress").on("change",function(){var n=$(this).children("option").filter(":selected"),i=$("#txtBillToPostalCode").val(),r=$("#ddlBillToCountry").val(),t=AddressesByPostcode.GetStoredElement(i.replace(/ /g,"").toUpperCase(),r).data;n.val()>=0?($("#txtBillToStreet1").val(n.text()),t&&$("#txtBillToPostalCode").val(t.Addresses[0].PostalCode)):$("#txtBillToStreet1").val("")});n.on("click",a);$("#toggleArrow").on("click",a);if($("#txtCardAccountNumber")[0])$("#txtCardAccountNumber").on("input",function(){CyberSource.ValidateCreditCardNumber()})};InitialisePayment=function(){};CallBack={Request:function(n,t,i){i||(i=function(){});var r={expertId:n,callBackNumber:t};$.ajax({data:JSON.stringify(r),type:"POST",contentType:"application/json; charset=utf-8",url:REQUEST_CALL_BACK_ENDPOINT,dataType:"json",success:function(n){i(n)},error:function(n,t,i){i!="abort"&&n.status!=0&&n.readyState!=0&&typeof errorHandler!="undefined"&&errorHandler("AJAXRequest - error callback: "+String(i),"main.js/AJAXRequest/error",null)}})},GetRequest:function(n,t){t||(t=function(){});var i={expertId:n};$.ajax({data:JSON.stringify(i),type:"POST",contentType:"application/json; charset=utf-8",url:"/CallBack/GetRequestCallBack",dataType:"json",success:function(n){t(n)},error:function(n,t,i){i!="abort"&&n.status!=0&&n.readyState!=0&&typeof errorHandler!="undefined"&&errorHandler("AJAXRequest - error callback: "+String(i),"main.js/AJAXRequest/error",null)}})},CancelRequest:function(n){n||(n=function(){});$.ajax({data:JSON.stringify({}),type:"POST",contentType:"application/json; charset=utf-8",url:"/CallBack/CancelRequestCallBack",dataType:"json",success:function(t){n(t)},error:function(n,t,i){i!="abort"&&n.status!=0&&n.readyState!=0&&typeof errorHandler!="undefined"&&errorHandler("AJAXRequest - error callback: "+String(i),"main.js/AJAXRequest/error",null)}})},GetStatusConfiguration:function(n){return CallBack.StatusConfiguration[CallBack.StatusConfiguration.map(function(n){return n.status}).indexOf(n)]},Status:{Unknown:0,Requested:10,Processing:20,CallInProgress:30,Cancelled:100,Error:110,CallNotAnswered:120,CallNotAccepted:130,AccountNotEntered:131,CustomerBusy:140,ExpertBusy:150,InsufficientCredit:160,ExpertNotAccepted:170,ExpertNoAnswer:180,CustomerHungUp:190,CallAnswered:200,CallCompleted:300},StatusType:{waiting:1,error:2,completed:3,completedAndClose:4},StatusConfiguration:[{status:0,type:1,label:"Waiting",icon:"icon-wait"},{status:10,type:1,label:"Requested",icon:"icon-wait"},{status:20,type:1,label:"Processing",icon:"icon-wait"},{status:30,type:1,label:"Call In Progress",icon:"icon-wait"},{status:100,type:3,label:"Call Cancelled",icon:""},{status:110,type:2,label:"Error",icon:""},{status:120,type:3,label:"Call Not Answered",icon:""},{status:130,type:3,label:"Call Not Accepted",icon:""},{status:131,type:3,label:"Account Not Entered",icon:""},{status:140,type:3,label:"Your Line is Busy",icon:""},{status:150,type:3,label:"Expert Busy",icon:""},{status:160,type:3,label:"Insufficient Credit",icon:""},{status:160,type:3,label:"Expert Not Accepted",icon:""},{status:160,type:3,label:"Expert No Answer",icon:""},{status:160,type:3,label:"Customer Hung Up",icon:""},{status:200,type:4,label:"Call Answered",icon:""},{status:300,type:4,label:"Call Completed",icon:""}],ClientConfigurations:{DefaultPollingTime:1500,DefaultCloseTimer:5e3}};var InitialiseExperts=function(){$("[data-callback=false]").remove();$(".confirmCloseOnBusy").on("click",function(){window.location.reload(!0)});$(".confirmNoTopUp").on("click",function(){GetPopoverConfirmation(this).removeClass("popoverVisible");ShowStage(GetParentPopOver(this),GetExpertAvailability(this),1)});$(".callMeButton").on("click",function(){GetParentPopOver(this).find(".phone-numbers").find("select").val()?pollingOnRunning||ShowStage(GetParentPopOver(this),1,2):window.location.replace("/My-Account/ChangePhoneNumbers/")});$(".btnWeCallYou").on("click",function(){var n=this,t=GetParentPopOver(this),i=GetParentButton(this).find("[data-expertId]").data("expertid"),r=t.find(".phone-numbers").find("select").val();pollingOnRunning||CallBack.Request(i=i,r=r,function(i){if(i.ExpertCallBackDto){var r=CallBack.GetStatusConfiguration(i.ExpertCallBackDto.StatusId);$(n).find(".callBackStatusIcon").removeClass().addClass(r.icon).addClass("callBackStatusIcon");$(n).find(".callBackStatusText").text(r.label);i.ExpertCallBackDto.StatusId==CallBack.Status.Requested&&(pollingOnRunning=!0,CheckCallBackRequest(n));i.ExpertCallBackDto.StatusId==CallBack.Status.InsufficientCredit&&(GetPopoverConfirmation(n).addClass("popoverVisible"),ShowStage(t,1,4));i.ExpertCallBackDto.StatusId==CallBack.Status.ExpertBusy&&(GetPopoverConfirmation(n).addClass("popoverVisible"),ShowStage(t,1,3))}i.ServiceOperationOutcome==80&&window.location.replace("/login")})});$(".close").on("click",function(){var n=GetParentPopOver(this);pollingOnRunning||GetExpertAvailability(this)!==1||ShowStage(n,1,1)});$(".btnCancelWeCallYou").on("click",function(){var n=GetParentPopOver(this),t=n.find(".btnWeCallYou");pollingOnRunning&&requestCanBeCancelled?CallBack.CancelRequest(function(i){i.ExpertCallBackDto&&i.ExpertCallBackDto.StatusId==CallBack.Status.Cancelled&&(ResetCallBackRequest(t),ShowStage(n,1,1))}):(ResetCallBackRequest(t),ShowStage(n,1,1))});$(".call_now_details").each(function(n,t){var i=$(t);ShowStage(i,GetExpertAvailability(i),GetCurrentStage(i))})},pollingOnRunning=!1,requestCanBeCancelled=!1