﻿function UserServer(){this.isScriptAlive=t;this.isServerAlive=u;this.addJsNode=g;this.login=F;this.createUser=y;this.getUserDetails=q;this.updateUser=A;this.sendVerificationEmail=m;this.forgotPassword=o;this.logout=E;this.getToken=C;this.getUserName=w;this.getEmail=B;this.getMailStatus=s;this.getPermissions=p;this.isSessionNew=v;this.isSessionValid=r;this.setCookies=z;this.deleteCookies=j;this.setUserType=x;var f="wixSession",e="wixClient",D="https://"+usersDomain+"/wix-auth/api/",l=usersDomain.substring(usersDomain.indexOf("."));serverLife="dead";g("https://"+usersDomain+"/wix-auth/jsIsAlive.jsp");function t(){return "alive"}function u(){return serverLife}function b(d,b){var a="";for(var c in b)a+="&"+c+"="+encodeURIComponent(b[c]);g(D+d+"?"+a.substring(1))}function g(b){var a=document.createElement("script");a.type="text/javascript";a.src=b;document.getElementsByTagName("head")[0].appendChild(a)}function F(e,d,a,c){b("login",{email:e,password:d,rememberMe:a,orgDocID:c})}function y(d,c,e,a){b("createUser",{userName:d,password:c,email:e,orgDocID:a})}function q(a){b("getUserDetails",{wsess:a})}function A(f,c,a,e,d,g){b("updateUser",{password:f,newUserName:c,newPassword:a,newEmail:e,optInMail:d,wsess:g})}function m(a){b("sendVerificationEmail",{email:a})}function o(a){b("forgotPassword",{email:a})}function E(){j();handleUserServerResponse("logout",true)}function C(){return h(f)}function w(){return a(0)}function B(){return a(1)}function s(){return a(2)}function p(){return a(3)}function v(){var b=a(4);return b&&b>(new Date).getTime()-2e4}function r(){var b=a(5);return b&&b>(new Date).getTime()}function a(b){var a=n();return a?a[b]:null}function n(){var a=h(e);return a?a.split("|"):null}function z(j,g,h,d,c,a){i(f,j,a);var b=(new Date).getTime();i(e,g+"|"+h+"|"+d+"|"+c+"|"+b+"|"+(b+8.64e7),a)}function j(){d(f);d(e);d(k.cookieName)}function i(b,a,d){c.setCookie(b,a,d,l)}function h(a){return c.getCookie(a)}function d(a){c.deleteCookie(a,l)}function x(a){k.setUserType(a)}var c={setCookie:function(d,c,e,b,g,f){window[d]=c;var a=d+"="+c;if(e)a+=";expires="+(new Date((new Date).getTime()+e)).toGMTString();a+=";path="+(g||"/");if(b)a+=";domain="+b;if(f)a+=";secure";document.cookie=a},getCookie:function(a){if(window[a])return window[a];if(document.cookie){var c=document.cookie.split(/;\s*/);for(var b=0,e=c.length;b<e;b++){var d=c[b];if(d.indexOf(a+"=")==0)return d.substring(a.length+1)}}return null},deleteCookie:function(c,a,d,b){this.setCookie(c,"",-1,a,d,b)}},k={cookieName:"userType",expiration:157784630000,ANONYMOUS:0,REGISTERED:1,PREMIUM_MONTHLY:2,PREMIUM_YEARLY:3,setUserType:function(b){var a=h(this.cookieName);if(!a||this[b]>this[a])i(this.cookieName,b,this.expiration)}}}var userServer=new UserServer
