(function(){"use strict";function n(n,t,i,r,u,f,e,o){function a(){n.$apply(function(){n.showContactCdWindow=!0});ct.agent.utls.initializeKendoWindow(h,"","","",!0,v);h.data("kendoWindow").center().open()}function v(){o(function(){n.showContactCdWindow=!1},1)}function y(){var n=localStorage.getItem(ct.utls.storageKeys.ProductLogos);n||e.GetLogo(function(n){localStorage.setItem(ct.utls.storageKeys.ProductLogos,JSON.stringify(n))})}function p(){var n=$(".mobile-nav.mobile-nav-open");n.length>0?n[0].className===mobileMenuClass?($(".mobile-nav.mobile-nav-open").removeClass("mobile-nav-open"),window.mobileMenuClass="mobile-nav mobile-nav-close"):window.mobileMenuClass="mobile-nav mobile-nav-open":window.mobileMenuClass="mobile-nav mobile-nav-close"}function w(){var n=$(".family-brands.brands-open");n.length>0?n[0].className===brandClass?($(".family-brands.brands-open").removeClass("brands-open"),$(".family-brands-menu").removeClass("menu-open"),$(".family-brands-menu").addClass("menu-close"),window.brandClass="family-brands brands-close"):window.brandClass="family-brands brands-open":window.brandClass="family-brands brands-close"}var s,c,l,h;if(f.log("run agent"),n.clientName="AgentPortal",r.defaults.headers.common[ct.utls.headerKeys.ApplicationType]="AgentPortal",window.location.search.indexOf("login")>=0&&signinAgent(),s=JSON.parse(ct.agent.clientStore.getItem(ct.utls.storageKeys.SignInResponse)),c=window.location.hash.length>0,s)n.accessToken==undefined&&(n.accessToken=s.access_token);else if(!c&&!ct.utls.isHomePage()&&!ct.utls.isRedirectPage()){l=window.location.search.indexOf("refreshUser")>=0;window.location.pathname==="/login"||l||ct.agent.clientStore.setItem(ct.utls.storageKeys.PostLoginRedirectUrl,window.location.pathname+window.location.search);signinAgent();throw new Error("You are not logged-in.");}n.initEResBookingContext=function(t){r.get(n.WebApiUrl+"InitializeAgentBookingContext").success(function(){window.location.pathname=t;n.isClickOnlineBookingMenu=!0})};n.checkMakeBookingAvailability=function(){n.makeBookingDisabled=ct.agent.utls.isMakeBookingDisabled(n.activeAgencyNo)};$("#contact-us-form").click(function(){a()});n.showContactCdWindow=!1;h=$("#contactUsCdFormWindow");$(".menu-login").keypress(function(n){n.which===13&&$(this).find("ul").addClass("menu-open").removeClass("menu-close")});window.mobileMenuClass="mobile-nav mobile-nav-close";window.brandClass="family-brands brands-close";$(document).on("click",function(){p();w()});y();n.getFacebookGroups=function(n){var i=ct.agent.clientStore.getItem(ct.agent.storageKeys.FacebookGroups),r,t;if(i){if(ct.utls.isNullOrEmpty(n))return null;if(r=JSON.parse(i),t=window._.where(r,{Region:n}),t.length>0)return t[0].Url}else e.GetFacebookGroups(function(t){if(ct.agent.clientStore.setItem(ct.agent.storageKeys.FacebookGroups,JSON.stringify(t)),n===undefined||n===null)return null;var i=window._.where(t,{Region:n});if(i.length>0)return i[0].Url});return null};n.getFacebookGroups(null);n.apToggleSlide=function(n,t){$("#"+n).slideToggle("slow");var i=$("#"+t)[0];i&&(i.className=i.className.indexOf("accordion-minus")>=0?"accordion-plus":"accordion-minus")}}angular.module("ct.agentPortal",["ngRoute","ngCookies","kendo.directives","ui.router","ct.common","cp.ngConfirm","ui.bootstrap"]).run(n);n.$inject=["$rootScope","$location","$cookies","$http","globalConstants","$log","generalService","$timeout"]})()