(function(K){var N,Q="mobile-mode",L="desk-mode";_.obj("rosy.context.vars");var T=false,M=[];K.mh.addLabelListener("<=minipad",function(A){if(A.matches){T=true;K.mh.removeClass(L);K.mh.addClass(Q);}else{T=false;K.mh.removeClass(Q);K.mh.addClass(L);}P();},true);function P(){M.forEach(function(A){A(T);});}K.mh.addStyleSheet("html.mobile-mode .mobile-mode-hide.mobile-mode-hide,"+"html.desk-mode .desk-mode-hide.desk-mode-hide"+" { display:none; }");var S={selfDestruct:true,autoOpen:true,modal:true};function R(A){if(_.isString(A)){return'<div class="dlg-wrap" >'+A+"</div>";}else{if(K.is$(A)){if(A.find(".dlg-wrap, .dlg-wrap-min").length==0){A=A.wrap('<div class="dlg-wrap-min"></div>').parent();}}}return A;}function O(){var A=[],B=_.toArray(arguments);K.each(B,function(D,C){if(!B.dialogClass){return 1;}A.concat($w(B.dialogClass));});A=_.uniq(A);if(A.length>0){B.push({dialogClass:A.join(" ")});}return K.extend.apply(null,B);}K.extend(_.obj("rosy"),{isMobileMode:function(){return T;},isDeskMode:function(){return !T;},isSalonRunnerApp:function(){var A=navigator.userAgent.toLowerCase();return/salonrunnerapp/.test(A);},addMobileModeListener:function(B,A){if(M.indexOf(B)==-1){M.push(B);}if(A!=undefined){if(K.isFunction(A)){A=A(T);}if(A){B(T);}}return T;},removeMobileModeListener:function(A){var B=M.indexOf(A);if(B!=-1){M.splice(B,1);}},removeAllMobileModeListeners:function(){M=[];},dialog:function(B){var E=[].slice.call(arguments,1),C=null,D=true;if(_.isBoolean(B)){D=B;B=E.shift();}K.each(E,function(G,F){if(K.isFunction(F)||_.isString(F)){C=F;E[G]=null;return false;}});var A=O.apply(null,[{},S,{body:B,close:C}].concat(E));if(!A.buttons&&D!==false){A.buttons={"OK":K.noop};}return new rosy.widget.Dialog(A);},confirm:function(E,C,D,B){if(K.isArray(E)){E=E.join("<br/>");}if(D==null){D=K.noop;}else{if(K.isPlainObject(D)){B=D;D=K.noop;}}var A;if(!K.isFunction(C)){A=C;}else{A={"No":D,"Yes":C};}return rosy.dialog(R(E),{title:"Confirm",dialogClass:"dlg-confirm",resizable:false,buttons:A,titlebarClose:D,modal:true,selfDestruct:true},B);},runConfirmFirstIf:function(C,E,A,D,B){if(!!C){rosy.confirm(E,A,D,B);}else{A();}},alert:function(A,C,B){if(K.isArray(A)){A=A.join("<br/>");}return rosy.dialog(R(A),{title:"Message",dialogClass:"dlg-alert",resizable:false,buttons:{"OK":K.noop},modal:true,selfDestruct:true},C,B);},error:function(A,B){if(A){rosy.alert("<p><strong>Oops! The following error has occurred:</strong></p>"+A+"<p>If this problem persists, please try refreshing the page or contact SalonRunner support for assistance.</p>",B);}else{rosy.alert("<p><strong>Oops! An error occurred during the last request.</strong></p><p>If this problem persists, please try refreshing the page or contact SalonRunner support for assistance.</p>",B);}},jsonResponseFn:function(B,A){return function(C){if(C.success){B.apply(this,arguments);}else{if(K.isFunction(A)){A.call(this,C.errors);}else{if(!_.isPlainObject(A)){A=null;}if(C.errors!=null){rosy.alert(C.errors,A);}else{rosy.error(null,A);}}}};},openWindow:function(A,B){var C;if(B){C=K.extend({},{uuid:K.utils.random()},B);}else{C={uuid:K.utils.random()};}window.open(rosy.appendParameters(A,C));},appendParameter:function(A,C,D){var B=(A.indexOf("?")===-1?"?":"&");return A+B+C+"="+D;},appendParameters:function(E,F,G,A){var B=E;if(A==null){A=(B.indexOf("?")===-1?"?":"&");}if(!B){A="";}for(var C in F){if(G!=null&&!_.contains(G,C)){continue;}var D=F[C];B+=A+encodeURIComponent(C)+"="+encodeURIComponent(D);if(A!="&"){A="&";}}return B;},getCurrentMoment:function(){if(!N){var B=rosy.contextVariable("currentDateTime");if(!B&&K.rosy){B=K.rosy.pageloadSalonTime||undefined;}if(B===undefined){B=null;}N=moment(B);}var A=moment(N);if(!A.isValid()){return moment();}return A.add(K.now()-Bp.loadTime,"milliseconds");},getCurrentDateTime:function(){return rosy.getCurrentMoment().toDate();},moment:function(){var A=_.toArray(arguments);var B=moment.apply(null,A);if(B.isValid()||A.length<2){return B;}try{console.error("Wrong date formats sent to parse moment("+A.join()+")");}catch(D){console.error("Wrong date formats sent to parse momentjs.");}var C=B;if(A[3]==true){A[3]=false;B=moment.apply(null,A);if(B.isValid()){return B;}}else{if(A[2]==true){A[2]=false;B=moment.apply(null,A);if(B.isValid()){return B;}}}B=moment(A[0]);if(B.isValid()){return B;}return C;},popUp:function(A){day=new Date();id=day.getTime();return window["page"+id]=window.open(A,id,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=475");},popUpAtUrlContext:function(A){return rosy.popUp(rosy.getUrlContext()+A);},getCurrentAppointmentBlockMoment:function(){var B=rosy.getCurrentMoment(),A=Math.floor((B.minutes()+1)/15)*15;B.minutes(A).seconds(0).milliseconds(0);return B;},setContextVariables:function(A){K.extend(_.obj("rosy.context.vars"),A);},getContextVariable:function(A){return rosy.context.vars[A];},logAllContextVariables:function(){console.log(rosy.context.vars);},contextVariable:function(A,C){if(C===undefined){if(typeof (A)=="object"){for(var B in A){rosy.context.vars[B]=A[B];}}else{return rosy.context.vars[A];}}else{rosy.context.vars[A]=C;}},stylesToString:function(A){var B="";K.each(A,function(D,C){B+=D+":"+C+";";});return B;},getRequestParam:function(A){A=A.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var B="[\\?&]"+A+"=([^&#]*)";var C=new RegExp(B);var D=C.exec(window.location.href);if(D==null){return"";}else{return D[1];}},getUrlContext:function(){var A=window.location.href.split("/");var B=A.slice(0,1);A=A.slice(2,4);return B+"//"+A.join("/")+"/";},isManager:function(){return rosy.getUrlContext().indexOf("/manager")!=-1;},cookies:{viewedTicketIds:function(A){if(!!A){var B=new Date(new Date().setHours(24,0,0,0));K.cookie("pTktIds",A,{expires:B});}else{return K.cookie("pTktIds")||[];}}},event:{UPDATE_PRODUCT_RESERVATIONS:"updateProductReservations"},defaults:{cardConnectTokenizerParams:{invalidinputevent:true,autofocus:true,tokenizewheninactive:true,formatinput:true}}});_.obj("rosy.cardConnect").getTokenizerParamString=function(A,C){if(C==null){C={};}var B=A.body,D=A.input;if(!B){B="body{margin:0;padding-top:1px;padding-bottom:1px}";}else{if(_.isObject(B)){B=rosy.stylesToString(B);}B="body{"+B+"}";}if(!D){D="";}else{if(_.isObject(D)){D=rosy.stylesToString(D);}D="input{"+D+"}";}C.css=B+D;return K.param(K.extend({},rosy.defaults.cardConnectTokenizerParams,C));};})(jQuery);(function(V){var R=_.obj("login");if(!R.hasErrors){R.hasErrors=false;}var T=false,N="rememberMe",Q="lg",O=true,P=false,U=24*60*60*1000;function S(){if(!T){T=true;V(".logon_hidden").show();}else{V(".logon_hidden").show(500);}}function X(){if(P){return ;}P=true;var E=V("#logonForm"),C=E.find("#salonId"),B=E.find("#username"),D=E.find("#password");var A=V("#rememberMe");if(V.localStorage==null){S();return ;}W(A);E.submit(function(){E.attr("autocomplete","off");if(A.prop("checked")){var G=rosy.getCurrentMoment();G.add(7,"days").calendar();var F={salonId:C.val(),username:B.val(),password:D.val(),expireDate:G.toDate().getTime()};V.localStorage.secure(Q,F);}});M();}function W(A){if(V.localStorage("rememberMe")==null){A.prop("checked",false);}else{A.prop("checked",V.localStorage(N));}A.change(function(){V.localStorage(N,A.prop("checked"));});}function M(){var G=V("#logonForm"),E=G.find("#salonId"),A=G.find("#username"),F=G.find("#password");var C=V.localStorage.secure(Q);if(!R.hasErrors&&C!=null){if(!!C.expireDate){var D=rosy.getCurrentMoment();var B=moment(C.expireDate);if(D.isSameOrAfter(B)){S();V.localStorage.remove(Q);return ;}}if(!!C.salonId&&!!C.username&&!!C.password){E.val(C.salonId);A.val(C.username);F.val(C.password);if(V.url().param("auto")==false||V.url().param("auto")=="false"){S();}else{G.submit();}}else{S();}}else{S();V.localStorage.remove(Q);}}V(function(){var D=V("#logonForm"),B=D.find("#salonId"),A=D.find("#username"),C=D.find("#password");if(B.val()==="0"){B.val("");}X();});}(jQuery));