/* Minification failed. Returning unminified contents. (7655,30-61): run-time error JS5017: Syntax error in regular expression: /\p{Extended_Pictographic}+/giu */ /*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?""!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("'; var dataVideo = $m(this).attr('data-video'); if (dataVideo.includes('www.youtube.com/embed/')) { videoSRC = dataVideo; } else { videoSRC = '//www.youtube.com/embed/' + $m(this).attr('data-video') + '?autoplay=1'; } } else if ($m(this).attr('data-player') == 'brightcove') { var bnode = document.getElementById("brightcoveVideoModal"); bnode.innerHTML = bnode.innerHTML + ''; myPlayerEl = document.getElementById("videoJsId"); if (myPlayerEl) { myPlayerEl.setAttribute('data-account', $m('#videoDataAcc').val()); myPlayerEl.setAttribute('data-player', $m('#videoPlayerId').val()); myPlayerEl.setAttribute('data-video-id', $m(this).attr('data-video')); myPlayer = bc(myPlayerEl, {}); myPlayer.catalog.getVideo($m(this).attr('data-video'), function(error, video) { myPlayer.catalog.load(video); }); myPlayer.on('loadstart', function() { var info = myPlayer.mediainfo, socialOverlay = myPlayer.socialOverlay; var url = window.location.host + window.location.pathname + '?videoId=' + info.id; socialOverlay.setDirectLink(url); }); myPlayer.on('loadedmetadata', function() { myPlayer.muted(false); myPlayer.play(); }); } } } var videoTitle = 'video'; if ($m(this).attr('data-video-title') != '') { videoTitle = $m(this).attr('data-video-title'); } $m(theModal + ' iframe').attr('src', videoSRC); $m(theModal + ' button.close').on('click.close', function () { $m(theModal + ' iframe').attr('src', ''); }); }); // reset the iframe src to stop playing video if the layer gets hidden when user clicks anywhere else than layer $m('#videoModal').on('hide.bs.modal', function (e) { if (myPlayerEl) { myPlayer.pause(); var bnode = document.querySelector("video-js#videoJsId"); if (bnode) { bnode.parentNode.removeChild(bnode); } } else { $m('#videoModal iframe').attr('src', ''); var item = document.querySelector('iframe#videoIFrame'); if (item) { item.parentNode.removeChild(item); } } }); }; }).apply(mk.video); (function () { this.productmorevideo = function () { $m('div.product-more-video').iframeTracker({ blurCallback: function() { var videoTitle = 'product-more-tab-video'; var activeTab = $m('#generic-modal').find('li.resp-tab-active'); if (activeTab != null && activeTab.length > 0) videoTitle = activeTab.data('title'); } }); }; }).apply(mk.video); //**** Popover functionality (function() { this.init = function(parent, config) { $m(parent).popover(config); }; this.destroy = function(target, callback){ $m(target).popover('destroy'); (callback ? callback() : ''); }; this.closeonclick = function(parent, target, callback){ $m(parent).on('click.closepopover', target,function(){ $m(this).closest('.popover').popover('destroy'); (callback ? callback() : ''); }); }; //Popover Templates this.template1 = function(template){ return [''].join('\n'); }; }).apply(mk.popover); })(window.mk = window.mk || {}); function debouncer(func,timeout) { var timeoutID , timeout = timeout || 200; return function() { var scope = this,args = arguments; clearTimeout( timeoutID ); timeoutID = setTimeout( function () { func.apply( scope , Array.prototype.slice.call( args ) ); },timeout ); } }; // DESKTOP SUBNAVIGATION function subNavigation(){ var getNavPosition = function(index){ var curCount = 0, navOffset = 0; $m('.global-nav.sub nav > ul > li').each(function(){ if(curCount < index){ navOffset += $m(this).width() + 15; }; curCount++; }); return navOffset; }; //Adjust nav placement $m('.global-nav.sub .has-sub > a').on('mouseenter.adjustmenu focus', function(){ var _parent = $m(this).closest('li.has-sub'), menuItemWidth = ($m(this).width()), navMenu = $m('.nav-drop', _parent), gridWidth = $m('header > .container').width(), navItem = $m(this).closest('li'), navIndex = navItem.index(), navOffset = getNavPosition(navIndex), availableNavSpace = (gridWidth - navOffset), navOffset = (availableNavSpace - navMenu.width()); if(navOffset < 0){ navMenu.css({'right': '0'}); }; }); }; // MOBILE NAVIGATION function mobileNavigation(){ $m('header').off('click.togglemobile'); $m('.mobile-nav ul li.has-sub > a').off('click.togglenav'); $m('.mobile-nav > ul > li.top > a').off('click.toplevel'); $m('.mobile-nav').off('click.mainmenu'); $m('header').on('click.togglemobile','a.toggle-mobile',function() { $m('body').toggleClass('mobile'); }); var _parent = ''; $m('.mobile-nav ul li.has-sub > a').each(function(){ $m(this).on('click.togglenav', function(){ _parent = $m(this).closest('li'); if (_parent.hasClass('active')) { _parent.removeClass('active'); _parent.find('ul li.active').removeClass('active'); _parent.find('ul li').show(); _parent.siblings().removeClass('active').show(); } else { _parent.addClass('active'); _parent.siblings().hide(); } }); }); $m('.mobile-nav > ul > li.top > a').on('click.toplevel',function(){ _parent = $m(this).closest('li'); if(!_parent.hasClass('active')){ $m('.util-links').fadeIn(300); $m('a.main-menu').hide(); } else { $m('.util-links').hide(); $m('a.main-menu').css('display','block'); } }); $m('.mobile-nav').on('click.mainmenu','a.main-menu',function(){ $m(this).hide(); $m('.mobile-nav li').removeClass('active').fadeIn(300); $m('.util-links').fadeIn(300); }); }; // POPOVER PLACEMENT ON MOBILE function popTopMobileLeft(){ var width = window.innerWidth; if (width < 768) return 'top'; return 'left'; }; function popTopMobileRight(){ var width = window.innerWidth; if (width < 768) return 'top'; return 'right'; }; function expandCollapse(){ $m('.accordion-section-title').click(function(e) { var currentAttrValue = $m(this).attr('href'); if($m(e.target).is('.active')) { $m(this).removeClass('active'); $m(this).next('.accordion-section-content').slideUp(300).removeClass('open'); } else { // Add active class to section title $m(this).addClass('active'); // Open up the hidden content panel $m('.accordion ' + currentAttrValue).slideDown(300).addClass('open'); if ($m(window).width() <= 568) { $m('html,body').animate({scrollTop:$m(this).offset().top - 110}, 800); } } e.preventDefault(); }); }; function textRemaining() { var remainingText = Globalize.localize('CharacterCounter_RemainingText', mk.eSuite.language2); var maxTextLength = $m('textarea').attr('maxlength'); if (maxTextLength == null) { maxTextLength = 600; } evaluateRemaining($m('textarea'), $m('.remaining'), maxTextLength); $m('textarea').keyup(function () { evaluateRemaining($m(this), $m('.remaining'), maxTextLength); }); function evaluateRemaining($textarea, $remaining, maxLength) { var textLength = $textarea.val().length; var textRemaining = maxLength - textLength > 0 ? maxLength - textLength : 0; $remaining.html('' + textRemaining + ' ' + remainingText); }; } function productZoom() { // Instantiate EasyZoom plugin var $easyzoom = $m('.easyzoom').easyZoom({ onShow: function () { if (Modernizr.touch) { $m('.easyzoom').addClass('flyout-show'); } }, onHide: function () { $m('.easyzoom').removeClass('flyout-show'); $m('.awards-badges').css('display', 'block'); if (Modernizr.touch) { $easyzoom.data('easyZoom').teardown(); } } }); // Add click event listeners to thumbnails $m('.thumbnails').on('click', 'li:not(.video) a', function (e) { e.preventDefault(); var $this = $m(this); var $parent = $this.parent(); $parent.siblings().removeClass('active'); $parent.addClass('active'); $easyzoom.data('easyZoom').swap($this.data('standard'), $this.attr('href')); }); } function clearZoom(api) { $m('.easyzoom').removeClass('flyout-show'); $m('.easyzoom').removeClass('easyzoom-zoomed'); api.hide(); } function responsiveTabs(container, id) { $m(container).easyResponsiveTabs(); if ($m(window).width() <= 568) { $m('body:not(.modal-open) .tabbed h2').on('click',function(){ var self = $m(this); setTimeout(function() { var theOffset = $m(self).offset(); $m('body,html').animate({ scrollTop: theOffset.top - 110 }); }, 500); }); $m('body.modal-open .tabbed h2').on('click',function(){ var self = $m(this); setTimeout(function() { var theOffset = $m(self).offset(); $m('.modal').animate({ scrollTop: theOffset.top }); }, 500); }); } $m('.modal-body .resp-tab-item').removeClass('resp-tab-active'); $m('.modal-body .resp-tabs-list .resp-tab-item:eq(' + (id-1) + ')').addClass('resp-tab-active'); $m('.modal-body .resp-accordion').removeClass('resp-tab-active'); $m('.modal-body .resp-tab-content.resp-tab-content-active').removeAttr('style').removeClass('resp-tab-content-active'); $m('.modal-body .resp-tabs-container .resp-tab-content:eq(' + (id-1) + ')').addClass('resp-tab-content-active').prev('h2').addClass('resp-tab-active'); } // EQUAL HEIGHT COLUMNS equalheight = function(container){ var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $m(container).each(function() { $el = $m(this); // go to the next iteration if element is hidden. // we can't get top position and height of the hidden elements, so such elements should be skipped. if ($el.is(':hidden')) { return; } $m($el).height('auto'); topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } function filterBar(){ $m('.filter-category').off('click.opencategory'); $m('.filter-toggle').off('click.showfilters'); $m('.filter-category:not(.selected)').on('click.opencategory',function(){ $m(this).siblings().find('.filter-listing').hide(); $m(this).find('.filter-listing').toggle(); }); if ($m(window).width() <= 768) { $m('.filter-wrapper').hide(); $m('.filter-toggle').on('click.showfilters',function(){ $m(this).toggleClass('active'); $m('.filter-wrapper').slideToggle(); }); } else { $m('.filter-wrapper').show(); $m('.filter-toggle').removeClass('active'); } }; function colorSwatch(){ var _activeColor = $m('.color-list li.active a').data('swatch'), _activeName = $m('.color-list li.active a').data('name'); if(!Modernizr.touch){ $m('.color-list li a').on({ mouseenter: function() { var _currentColor = $m(this).data('swatch'), _currentName = $m(this).data('name'); $m(this).closest('div.content').find('p.color-name').html(_currentName); $m(this).closest('div.content').find('img.swatch').attr('src',_currentColor); }, mouseleave: function() { $m(this).closest('div.content').find('p.color-name').html(_activeName); $m(this).closest('div.content').find('img.swatch').attr('src',_activeColor); } }); } } function colorSwatchClickAndShip() { var colorLists = $m('.color-list'); colorLists.each(function (index) { var colors = $m(this).find('.color-link'); var plusBtn = $m(this).find('.expand-colors'); var ulWidth = $m(this).outerWidth(); if (!plusBtn || plusBtn.length == 0) return; var gap = parseInt($m(this).css('column-gap')) || 0; function calculateSpace() { const plusBtnWidth = plusBtn.closest('li').outerWidth(); let totalWidth = plusBtnWidth; let colorsInRow = 0; colors.each(function (index) { const liWidth = $m(this).closest('li').outerWidth() + gap; totalWidth += liWidth; if (totalWidth - gap <= ulWidth) { colorsInRow++; } }); // Hide colors that don't fit in the first row colors.each(function (index) { if (index >= colorsInRow) { $m(this).closest('li').css('display', 'none'); } else { $m(this).closest('li').css('display', 'block'); } }); // Show/hide plus button based on whether colors wrap to new row if (colorsInRow < colors.length) { plusBtn.closest('li').css('display', 'block'); } else { plusBtn.closest('li').hide(); } } // Call calculateSpace function initially calculateSpace(); // Function to toggle visibility of hidden elements plusBtn.click(function () { colors.closest('li').css('display', 'block'); $m(this).closest('li').hide(); }); }); $m('.color-list li a.color-link').on({ click: function () { var _currentName = $m(this).data('name'); var _currentImage = $m(this).data('image'); var isdiscounted = $m(this).data('isdiscounted'); var price = $m(this).data('price'); var pricethrough = $m(this).data('pricethrough'); $parentElem = $m(this).closest('div.product-detail'); $parentElem.find('.img-wrap img').attr('src', _currentImage); $parentElem.find('p.color-name').html(_currentName); $parentElem.find('p.price').html(price); if (isdiscounted === 'True') { $parentElem.find('p.strike-through').html(pricethrough); $parentElem.find('p.strike-through').show(); } else { $parentElem.find('p.strike-through').hide(); } var quickViewUrl = $m(this).data('quickviewurl'); $parentElem.find('.img-wrap .quick-view').attr('data-url', quickViewUrl); var itemUrl = $m(this).data('itemurl'); $parentElem.find('.img-wrap .item-url').attr('href', itemUrl); $parentElem.find('a.product-name').attr('href', itemUrl); var productId = $m(this).data('productid'); $parentElem.attr('data-productid', productId); $parentElem.find('.price-bag').attr('data-productid', productId); $parentElem.find('.color-list li.active').removeClass('active'); $m(this).closest('li').addClass('active'); } }); } function bindColorSwatchClickAndShipQV() { $m('#quickview-modal .color-list li a.color-link').on({ click: function () { var _currentName = $m(this).data('name'); var _currentImage = $m(this).data('image'); var isdiscounted = $m(this).data('isdiscounted'); var pricethrough = $m(this).data('pricethrough'); $parentElem = $m(this).closest('div.product-detail'); $parentElem.find('.img-wrap img').attr('src', _currentImage); $parentElem.find('p.color-name').html(_currentName); if (isdiscounted === 'True') { $parentElem.find('p.strike-through').html(pricethrough); $parentElem.find('p.strike-through').show(); } else { $parentElem.find('p.strike-through').hide(); } var quickViewUrl = $m(this).data('quickviewurl'); $parentElem.find('.img-wrap .quick-view').attr('data-url', quickViewUrl); var itemUrl = $m(this).data('itemurl'); $parentElem.find('.img-wrap .item-url').attr('href', itemUrl); $parentElem.find('a.product-name').attr('href', itemUrl); var productId = $m(this).data('productid'); $parentElem.attr('data-productid', productId); $parentElem.find('.price-bag').attr('data-productid', productId); $parentElem.find('.color-list li.active').removeClass('active'); $m(this).closest('li').addClass('active'); } }); } function printModalButtonInit() { $m('#printButton').on('click',function(){ try{ var oIframe = document.getElementById('iframe-print-modal'); var oProduct = $m('.container.module.product.product-detail .row').clone(); oProduct.find('.quantity.shadow-box.cf').hide(); oProduct.find('.more-to-explore.shadow-box').hide(); oProduct.find('.product-list').hide(); oProduct.find('.thumbnails').hide(); oProduct.find('.toggle-zoom').hide(); oProduct.find('.easyzoom a').removeAttr("href"); oProduct.find('.col-sm-5').addClass('col-xs-5'); oProduct.find('.col-sm-7').addClass('col-xs-7'); oProduct.find('.col-wrapper.color.cf .col.lg').addClass('col sm'); var oContent = $m('.remote-modal .modal-body').clone(); oContent.find('.resp-tab-content').show(); oContent.find('.resp-tabs-list.cf').hide(); var oDoc = (oIframe.contentWindow || oIframe.contentDocument); if (oDoc.document) oDoc = oDoc.document; var headerStyleSheets = $m( "
" ).append( $m( "head" ).clone() ); oDoc.open(); oDoc.write( "" ); oDoc.write( "" ); oDoc.write( headerStyleSheets.html() ); oDoc.write(""); //oDoc.write(""); broken link!!! oDoc.write("

"); oDoc.write('
'); oDoc.write('
'); oDoc.write( '
' ); oDoc.write(oProduct.html()); oDoc.write('
'); oDoc.write('
'); oDoc.write('
'); oDoc.write(oContent.html()); oDoc.write( "" ); oDoc.write( "" ); oDoc.close(); } catch(e){ self.print(); } }); } function imgChooserOptions(){ $m('.controlcontainer.img-chooser .option').off('click.selectOption'); $m('.controlcontainer.img-chooser').each(function(){ $m('.option').on('click.selectOption',function() { var _this = $m(this), _parent = _this.parents('.controlcontainer'), _activeItem = _this.data('text'); _this.siblings().removeClass('selected'); _this.addClass('selected'); _parent.find('p.question span.answer').html(_activeItem); }); }); } function countrySelector(){ $m('.country-list li a').off('click.countryToggle'); $m('.country-list select').off('click.countryChange'); if ($m(window).width() > 767) { $m('.country-list li a').on('click.countryToggle',function(){ var _country = $m(this).data('country'); $m('.country-list li a').removeClass('active'); $m(this).addClass('active'); $m('.country, .default').hide(); $m('.country[data-country='+ _country +']').show(); }); } else { $m('.country-list select').on('change.countryChange',function(){ var _country = $m(this).find(':selected').data('country'); $m('.country-list li a').removeClass('active'); $m('.country, .default').hide(); $m('.country[data-country='+ _country +']').show(); $m('.country-list li a[data-country='+ _country +']').addClass('active'); $m('html,body').animate({scrollTop:$m(this).offset().top - 155}, 300); }); } } function checkoutToggle(){ $m('.checkout-toggle').off('click.toggle'); if ($m(window).width() < 768) { $m('.checkout-toggle').on('click.toggle',function(){ var _this = $m(this), _parent = _this.parent(); _gparent = _parent.parent(); _parent.toggleClass('open').next('.toggler').slideToggle(300); equalheight('.edit-bag-body .product'); }); $m('.edit-bag .checkout-toggle').on('click.toggle',function(){ $m('.estimated-mobile').toggle(); }); } } function popMiniBag() { if ($m(window).width() > 768) { var scrollTop = $m(document).scrollTop() if (scrollTop && scrollTop > 90) { try { $m('.minibag-wrapper').css('position', 'fixed'); $m('.minibag-wrapper').css('left', $m('.header-minibag').offset().left - 188 - $m('.header-minibag').width()); $m('.minibag-wrapper').css('top', '0px'); } catch (e) { } } else { $m('.minibag-wrapper').css('position', 'absolute'); $m('.minibag-wrapper').css('left', ''); $m('.minibag-wrapper').css('top', ''); } } } $m(document).on('scroll', function () { popMiniBag(); }); var miniBagHoverTimeoutId; var miniBagTimeoutLengthInMilliSeconds = 5000; function miniBagTimer(buttonClicked) { buttonClicked = buttonClicked || false; var miniBagSel = '.minibag-wrapper'; var miniBagButtonSel = '.bag-button'; var miniBagHeader = '.header-minibag'; var mobileBagSearch = '.mobile-bag-search'; if (!buttonClicked) { setMiniBagTimeout(); } $m(miniBagSel + ', ' + miniBagButtonSel).off('mouseenter mouseleave'); $m(miniBagSel + ', ' + miniBagButtonSel).on('mouseenter', function () { clearTimeout(miniBagHoverTimeoutId); }); $m(miniBagSel + ', ' + miniBagButtonSel).on('mouseleave', setMiniBagTimeout); function setMiniBagTimeout() { clearTimeout(miniBagHoverTimeoutId); miniBagHoverTimeoutId = setTimeout(function () { $m(miniBagSel + ', ' + miniBagHeader + ', ' + mobileBagSearch).removeClass('open'); }, miniBagTimeoutLengthInMilliSeconds); } } function miniBagToggle() { $m('.header-minibag a.bag-button').off('click.toggle'); $m('.minibag-wrapper a.close-bag').off('click.close'); $m('.minibag-wrapper img.close-bag').off('click.close'); $m('.mobile-bag-search a.toggle-bag').off('click.toggleBag'); popMiniBag(); miniBagTimer(); if ($m(window).width() > 568) { $m('.header-minibag a.bag-button').on('click.toggle',function() { var _this = $m(this); _parent = _this.parent(); if (_parent.hasClass('open')) { _parent.removeClass('open'); } else { _parent.addClass('open'); miniBagTimer(true); } }); } else { $m('.mobile-bag-search a.toggle-bag').on('click.toggleBag',function(){ $m('.header-minibag,.mobile-bag-search').toggleClass('open'); }); } $m('.minibag-wrapper a.close-bag').on('click.close',function(){ $m('.header-minibag').removeClass('open'); $m('.mobile-bag-search').removeClass('open'); }); $m('.minibag-wrapper img.close-bag').on('click.close', function () { $m('.header-minibag').removeClass('open'); $m('.mobile-bag-search').removeClass('open'); }); } function suggestedSearchClose(){ $m('.suggested-search-wrapper a.close-search').on('click',function(){ $m('.header-suggested-search').removeClass('open'); }); } function accountNavToggle(){ $m('body').off('click.toggleAccountNav'); $m('.account-nav').each(function(){ var _accountDrop = $m('ul.nav-wrap', this); $m('body').on('click.toggleAccountNav',function(e){ if ($m(e.target).is('a.select')) { _accountDrop.slideToggle(200); } }); }); } function personalProfile(){ $m('.pp-header').off('click.toggle'); if ($m(window).width() < 768) { $m('.pp-header').on('click.toggle',function(){ var _this = $m(this), _parent = _this.parent(); _parent.toggleClass('open').find('.pp-body').slideToggle(300); }); } } function swapImage(element, notSelect) { var elem = element.find('a'); var standartImage = elem.data('standard'); var enlargedImage = elem.attr('href'); if (notSelect === undefined) { var parent = elem.parent(); parent.siblings().removeClass('active'); parent.addClass('active'); } $m('.easyzoom a').attr('href', enlargedImage); $m('.easyzoom a img').attr('src', standartImage); $m('.product-image_mobile a img').attr('src', standartImage); } function recommendationsToggle() { $m('a.view-all').off('click.showAll'); if ($m(window).width() >= 768) { $m('.recommendation-section').each(function() { var productListing = $m('.product-listing', this), hiddenElements = productListing.children('.product:gt(7)', this); if(productListing.children('.product').size() >= 8) { hiddenElements.hide(); } $m('a.view-all', this).on('click.showAll',function(){ hiddenElements.slideToggle(300); }); }); } $m('a.view-all').on('click.showAll',function(){ var _this = $m(this); _this.toggleClass('open'); if (_this.hasClass('open')) { _this.find('.view-all-text').hide(); _this.find('.view-less-text').show(); } else { _this.find('.view-all-text').show(); _this.find('.view-less-text').hide(); } }); } function orderHistoryToggle() { $m('a.view-all').off('click.showAll'); $m('.order-wrapper').each(function() { var productListing = $m('.product-listing', this), hiddenElements = productListing.children('.product:gt(1)', this); if(productListing.children('.product').size() >= 3) { hiddenElements.hide(); } $m('a.view-all', this).on('click.showAll',function(){ hiddenElements.slideToggle(300); }); }); $m('a.view-all').on('click.showAll',function(){ var _this = $m(this); if (_this.hasClass('open')) { _this.removeClass('open'); _this.html(Window.OrderHistoryViewMore); } else { _this.addClass('open'); _this.html(Window.OrderHistoryViewLess); } }); } function searchToggles(){ $m('.filter-list .filter-type strong').off('click.toggleFilters'); $m('a.filter-by-toggle').off('click.toggleMobileFilters'); $m('a.close-filters').off('click.closeFilters'); if ($m(window).width() >= 768) { $m('.filter-type').addClass('open'); } else { $m('.filter-type').removeClass('open'); } $m('.filter-list .filter-type strong').on('click.toggleFilters',function(){ var _this = $m(this), _parent = _this.parent(); if (_parent.hasClass('open')) { _parent.removeClass('open'); _this.next('ul').slideUp(300); } else { _parent.addClass('open'); _this.next('ul').slideDown(300); } }); $m('a.filter-by-toggle').on('click.toggleMobileFilters',function(){ $m('.container-fluid.search-products').addClass('filters-open'); }); $m('a.close-filters').on('click.closeFilters',function(){ $m('.container-fluid.search-products').removeClass('filters-open'); }); } function expandableAd(elm){ var _this = $m(elm); var expandAd = function(){ var imgHeight = $m('.ad-banner', _this).css('height'), imgWidth = $m('.ad-banner', _this).css('width'); $m('.ad-banner', _this).css({height: imgHeight, width: imgWidth}); _this.css({height: imgHeight, width: imgWidth}).addClass('item-expanded'); }; var collapseAd = function(){ _this.css({width:'100%'}); setTimeout(function(){ $m('.ad-banner', _this).removeAttr('style'); _this.removeAttr('style').removeClass('item-expanded'); }, 300); }; return{ expand: expandAd, collapse: collapseAd } }; // MODAL/POPOVER CASE STATEMENTS function bootstrapEventMatching(key,data){ var callbackFn, configType switch(key){ case 'generic-modal': callbackFn = function(){ $m('.btn-default.ok').on('click',function() { $m('.modal-body').html('

Your message was sent successfully.

'); $m('.modal-footer').hide(); }); }; configType = 'modal'; break; case 'quickview-modal': callbackFn = function(){ // Triggering a Modal within a Modal - BT initstackmodal(); }; configType = 'modal'; break; case 'modal-popup': callbackFn = function () { }; configType = 'modal'; break; case 'tabbed-modal': callbackFn = function(){ }; configType = 'modal'; break; case 'color-modal': callbackFn = function(){ }; // Targeting a modal within a modal configType = 'modal-quickview'; break; case 'reorder-modal': callbackFn = function(){ }; configType = 'modal'; break; case 'email-modal': callbackFn = function(){ }; configType = 'modal'; break; case 'email-wishlist-modal': callbackFn = function(){ }; configType = 'modal'; break; case 'brightcove-modal': callbackFn = function(){ brightcove.createExperiences(); }; configType = 'modal'; break; }; return { callback: callbackFn, type: configType } }; // Target the .external-click-modal-stack class after the DOM loads and a modal is triggered - BT var initstackmodal = function () { $m('.external-click-modal-stack').on('click', function(e){ // start - Fix to prevent modals from being disabled in mobile view - BT/Randy $m('.remote-modal').appendTo("body"); // end var href = $m(this).data('url'), bootstrapkey = $m(this).data('bootstrapkey'); ajaxHandler(href,bootstrapkey); e.preventDefault(); }); }; // AJAX HANDLER FOR MODALS/POPOVERS function ajaxHandler(href,bootstrapkey){ if (href == undefined || href == '') return; //Get popover HTML var tabID; if (href.indexOf('#') != -1) { tabID = href.split('#')[1].replace(/tabbed/gi,''); } var request = $m.ajax({ cache: false, url: href }) request.success(function(data,textSts,jqXHR){ var defaultEventsToBind = bootstrapEventMatching(bootstrapkey,data); // var extensionEventsToBind = mkEventMatching(bootstrapkey,data); //Init Modal if (defaultEventsToBind['type'] == 'modal') { $m('.remote-modal').html(data); $m('.remote-modal').show(); $m('.remote-modal .modal').modal(); if ($m.exists('.remote-modal .tabbed')) { responsiveTabs('.remote-modal .tabbed', tabID); $m('#generic-modal').on('hidden.bs.modal', function(e){ $m('div.video-container iframe').attr('src', ''); }); mk.video.productmorevideo(); }; if($m.exists('.product-detail.color')){ colorSwatch(); }; if($m.exists('.more-to-explore')){ //initialize the print button on Modals printModalButtonInit(); }; } // Targeting a modal within a modal - BT else if (defaultEventsToBind['type'] == 'modal-quickview') { $m('.remote-modal-stack').insertAfter(".remote-modal"); $m('.modal-backdrop').last().css('z-index','1051'); $m('.remote-modal-stack').html(data); $m('.remote-modal-stack').show(); $m('.remote-modal-stack .modal').modal(); $m('#generic-modal-stack').on('hidden.bs.modal', function(e){ $m('.modal-backdrop').css('z-index','1040'); $m("body").addClass("modal-open"); }); } //Callback (defaultEventsToBind['callback'] ? defaultEventsToBind['callback']() : ''); }) }; function loadEasyzoom() { // PRODUCT ZOOMS if ($m.exists('.product-image_mobile')) { if ($m(window).width() <= 768) { $m('.product-image .toggle-mobile').delay(3000).animate({ opacity: 0 }, 1000); var swipeNext = false; $m(".toggle-mobile").on("swipeleft swiperight", function (e) { if (e.type === "swiperight") { swipeNext = $m('.product-image_mobile + .thumbnails li.active:not(".video")').prev(':not(".video")'); if (!swipeNext.length) { swipeNext = $m('.product-image_mobile + .thumbnails li:not(".video")').last(); } } else if (e.type === "swipeleft") { swipeNext = $m('.product-image_mobile + .thumbnails li.active:not(".video")').next(':not(".video")'); if (!swipeNext.length) { swipeNext = $m('.product-image_mobile + .thumbnails li:not(".video")').first(); } } if ($m('.product-image_mobile .ellipses .ellipses__item').length) { var ellipse = $m('.product-image_mobile .ellipses .ellipses__item'); var activeEllipse = $m('.product-image_mobile .ellipses .ellipses__item.ellipses__item_active'); if (e.type === "swiperight") { if (activeEllipse.prev().length) { activeEllipse.prev().addClass('ellipses__item_active'); } else { ellipse.last().addClass('ellipses__item_active'); } } else if (e.type === "swipeleft") { if (activeEllipse.next().length) { activeEllipse.next().addClass('ellipses__item_active'); } else { ellipse.first().addClass('ellipses__item_active'); } } activeEllipse.removeClass('ellipses__item_active'); } swapImage(swipeNext); swipeNext = false; }); } if (Modernizr.touch) { $m('.product-image_mobile .toggle-mobile').on('click', function (e) { mk.eSuite.utility.productView(); $m('.product-image .toggle-mobile').css("opacity", "1").delay(3000).animate({ opacity: 0 }, 1000); }); $m(".product-expanded__back").on("click", function () { $m(".qv-product-image").css("display", "none"); $m("#main-product-view").css("display", "block"); }); } } if ($m.exists('.easyzoom')) { $m('.product-zoom', 'a').off('click.showflyout'); if (!Modernizr.touch) { productZoom(); var easyzoomImage = $m('.product-zoom .easyzoom.product-image'); easyzoomImage.on('click', function () { if (easyzoomImage.hasClass('flyout-show')) { easyzoomImage.removeClass('flyout-show'); $m('.awards-badges').css('display', 'block'); } else { easyzoomImage.addClass('flyout-show'); $m('.awards-badges').css('display', 'none'); } }); $m('.product-zoom .thumbnails li:not(".video")').hover( function () { if ($m(this).hasClass('active')) { return false; } else { $m('.easyzoom a').attr('href', $m(this).find('a').attr('href')); $m('.easyzoom a img').attr('src', $m(this).find('a').data('standard')); } }, function () { if ($m(this).hasClass('active')) { return false; } else { var active = $m('.product-zoom .thumbnails li:not(".video").active').find('a'); $m('.easyzoom a').attr('href', active.attr('href')); $m('.easyzoom a img').attr('src', active.data('standard')); } } ); } if (Modernizr.touch) { function mobileProductZoom(reset) { var mobileEasyZoom = $m('.easyzoom').easyZoom(); var api = mobileEasyZoom.data('easyZoom'); if (reset) { api.teardown(); clearZoom(api); } else { $m('.easyzoom .toggle-mobile').on('doubletap', function (e) { $m('.easyzoom').addClass('flyout-show'); $m('.awards-badges').css('display', 'none'); api.isMouseOver = true; api.show(e); $m('.easyzoom-flyout').on('tap touchend', function (event) { clearZoom(api); event.preventDefault(); }); $m('.product-image.easyzoom').addClass('easyzoom-zoomed'); e.preventDefault(); }); } } mobileProductZoom(); $m('.thumbnails li').on('tap', function (e) { e.preventDefault(); $m('.awards-badges').css('display', 'block'); swapImage($m(this)); var count = $m(this).prevAll().length; $m('.product-image .ellipses .ellipses__item').removeClass('ellipses__item_active'); $m('.product-image .ellipses .ellipses__item:eq("' + count + '")').addClass('ellipses__item_active'); mobileProductZoom(true); mobileProductZoom(); }); } if ($m(window).width() <= 768) { $m('.easyzoom').addClass('easyzoom--overlay'); $m('.product-image .toggle-mobile').delay(3000).animate({ opacity: 0 }, 1000); var swipeNext = false; $m(".toggle-mobile").on("swipeleft swiperight", function (e) { if (e.type === "swiperight") { swipeNext = $m('.easyzoom + .thumbnails li.active:not(".video")').prev(':not(".video")'); if (!swipeNext.length) { swipeNext = $m('.easyzoom + .thumbnails li:not(".video")').last(); } } else if (e.type === "swipeleft") { swipeNext = $m('.easyzoom + .thumbnails li.active:not(".video")').next(':not(".video")'); if (!swipeNext.length) { swipeNext = $m('.easyzoom + .thumbnails li:not(".video")').first(); } } if ($m('.easyzoom .ellipses .ellipses__item').length) { var ellipse = $m('.easyzoom .ellipses .ellipses__item'); var activeEllipse = $m('.easyzoom .ellipses .ellipses__item.ellipses__item_active'); if (activeEllipse.prev().length) { activeEllipse.prev().addClass('ellipses__item_active'); } else { ellipse.last().addClass('ellipses__item_active'); } activeEllipse.removeClass('ellipses__item_active'); } swapImage(swipeNext); swipeNext = false; mobileProductZoom(true); mobileProductZoom(); }); } else { $m('.easyzoom').addClass('easyzoom--overlay'); } } } //Document Ready Calls (function ($) { // $ sign can be used without any conflict inside this function $(document).ready(function () { // AJAX MODALS /* Onclick events to open popover/modal */ $('.external-click').on('click', function (e) { // start - Fix to prevent modals from being disabled in mobile view - BT/Randy $('.remote-modal').appendTo("body"); // end var href = $(this).data('url'), bootstrapkey = $(this).data('bootstrapkey'); ajaxHandler(href, bootstrapkey); e.preventDefault(); }); /* Hover events to open popover/modal */ $('.external-hover').each(function (e) { var href = $(this).data('url'), bootstrapkey = $(this).data('bootstrapkey'); ajaxHandler(href, bootstrapkey); }); // GLOBAL SUB-NAVIGATION if ($.exists('.global-nav.sub.desktop')) { subNavigation(); } // GLOBAL MOBILE NAVIGATION if ($.exists('nav.mobile-nav')) { mobileNavigation(); } // STICKY NAV FOR MOBILE if ($.exists('header')) { if ($(window).width() <= 959) { if (!$.exists('.sticky-wrapper')) { $('header').waypoint('sticky', { stuckClass: 'stuck', offset: -10, wrapper: '
' }); } } else if ($(window).width() >= 960) { if ($('header').waypoints != undefined) { $('header').waypoint('unsticky'); } } } // HEADER IBC if ($.exists('.header-ibc.ibc-selected')) { $('.header-ibc.ibc-selected').on('click.openibc', 'a.consultant-toggle, a.close-ibc', function () { var _parent = $(this).closest('.header-ibc'); _parent.toggleClass('open'); }); $(document).on('click', function (event) { if (!$(event.target).closest('.header-ibc').length) { $('.header-ibc.ibc-selected').removeClass('open'); } }); }; $(document).click(function () { var _parent = $('.header-ibc.ibc-selected').closest('.header-ibc'); if (!_parent.find(':hover')) { _parent.removeClass('open'); } }); // SEARCH TOGGLE ON MOBILE if ($.exists('.mobile-bag-search')) { $('.mobile-bag-search').on('click.searchtoggle', 'a.toggle-search', function () { if ($(window).width() <= 568) { $('.header-search').slideToggle(300); $('.mobile-bag-search').toggleClass('active'); }; }); }; //YouTube Video if ($.exists('[data-toggle="modal"]')) { mk.video.autoplayyoutubemodal('body'); }; //Example carousel if ($.exists('div.carousel')) { mk.carousels.init('div.carousel'); $('.carousel-inner').each(function () { if ($(this).children('div').length === 1) $(this).siblings('.carousel-control, .carousel-indicators').hide(); }); }; //Example swipe functionality if ($.exists('.carousel')) { mk.carousels.swipe('.carousel', { left: true, right: true }); }; // POPOVERS $('.popper').popover({ container: 'body', trigger: 'hover click', template: mk.popover.template1(), content: function () { return $(this).next('.popper-content').html(); }, placement: popTopMobileLeft, html: true, }); // EMAIL SIGNUP POPOVER if ($.exists('a.email-toggle')) { $('a.email-toggle').on('click.toggle', function () { $(this).toggleClass('active'); if ($(window).width() < 768) { $('html,body').animate({ scrollTop: $(this).offset().top - 335 }, 800); }; pageload.specialUrls(); }); mk.popover.init('.featured-utility', { selector: '.email-toggle.show-popover', trigger: 'click', content: $('#email-signup').html(), template: mk.popover.template1(), placement: 'top', html: true }); mk.popover.closeonclick('body', '.popover a.close-popover', function () { $('a.email-toggle').removeClass('active'); }); }; // EXPAND/COLLAPSE if ($.exists('.accordion')) { expandCollapse(); }; // TABBED CONTENT if ($.exists('.tabbed')) { responsiveTabs('.tabbed'); }; // PRODUCT FILTER BAR if ($.exists('.filter-bar')) { filterBar(); }; // AD EXPANDABLE if ($.exists('.ad-wrapper')) { if ($(window).width() >= 479) { if (!Modernizr.touch) { $('.ad-wrapper .expandable-wrapper').on('mouseenter', function () { if (!$(this).hasClass('item-expanded')) { expandableAd(this).expand(); }; }).on('mouseleave', function () { expandableAd(this).collapse(); }); }; }; }; //loadEasyzoom(); // PRODUCT OPTIONS "SELECT" if ($.exists('.product-add-optional')) { var _productList = $('.product-list'); $('body').on('click', function (e) { if ($(e.target).is('a.select')) { _productList.slideToggle(200); } else { _productList.slideUp(200); } }); }; // PRODUCT COLOR OPTIONS if ($.exists('.product-detail .color-options') && !$.exists('body.click-and-ship-body')) { colorSwatch(); }; if ($.exists('body.click-and-ship-body .product-detail .color-options')) { colorSwatchClickAndShip(); }; // IBC PROFILE SIDEBAR TOGGLES var mq = window.matchMedia("(max-width: 767px)"); if (mq.matches) { if ($.exists('.container.ibc-profile')) { $('.ibc-sidebar .mod h3').on('click', function () { $(this).parent('.mod').toggleClass('open'); $(this).next('.content').slideToggle(300); }); }; } // COUNTRY SELECTOR if ($.exists('.country-picker')) { countrySelector(); }; // MY MK // PERSONAL PROFILE TOGGLE if ($.exists('.pp-module')) { personalProfile(); }; if ($.exists('.my-mk .recommendations')) { recommendationsToggle(); }; if ($.exists('.my-mk.order-history')) { orderHistoryToggle(); }; // PRODUCT FILTER BAR if ($.exists('.my-mk.address-book')) { $('.add-new .intro').on('click', function () { $(this).next('.address-wrapper').slideDown(300); }); $('.add-new a.cancel').on('click', function () { $(this).parents('.address-wrapper').slideUp(300); }); }; // ACCOUNT INFO - PERSONAL PROFILE if ($.exists('.my-mk.account-info.personal-profile')) { imgChooserOptions() }; // PRODUCT OPTIONS "SELECT" if ($.exists('.account-nav')) { accountNavToggle(); }; // TEXTAREA COUNT if ($.exists('textarea')) { textRemaining(); }; // SEARCH RESULTS if ($.exists('.search-results .filter-list')) { searchToggles(); } // CHECKOUT // CHECKOUT STEP TOGGLES if ($.exists('.checkout-steps')) { checkoutToggle(); } // HEADER MINI BAG TOGGLE if ($.exists('.header-minibag')) { miniBagToggle(); } // DATEPICKER if ($.exists('.datepicker')) { $('.datepicker').each(function () { $(this).datepicker({ showOn: "button", buttonImage: "/content/MK/eSuite/Images/ui/calendar.png", buttonImageOnly: true }); }); } $(window).on("load", function() { if ($(window).width() >= 768) { equalheight('.product-listing:not(.no-equal) .product-sample, .optional-4 .col-sm-3, .equal-height .col-xs-4,.equal-height .col-xs-6, .product-listing:not(.no-equal) .product, .search-connect-find .col-sm-6, .about-mary-kay .module.chooser .chooser-row, .start-bar .col-sm-4, .my-mk.personal-profile .option'); } }); }); })(jQuery); //Window Resize Calls (function ($) { // $ sign can be used without any conflict inside this function $(window).resize(debouncer(function () { //Popover on resize (function () { mk.popover.destroy('.popover', function () { $('a.email-toggle').removeClass('active'); }); }()); // STICKY NAV ON MOBILE - RESIZES (function () { if ($.exists('header')) { if ($(window).width() <= 959) { if (!$.exists('.sticky-wrapper')) { $('header').waypoint('sticky', { stuckClass: 'stuck', wrapper: '
' }); } } else if ($(window).width() >= 960) { $('header').waypoint('unsticky'); } } }()); // HIDE MOBILE SEARCH ON WINDOW RESIZE FROM MOBILE (function () { // we want to make sure the window.width has really changed if (mk.browserSize != $(window).width()) { mk.browserSize = $(window).width(); if ($(window).width() > 568) { $('.header-search').show(); } else { $('.header-search').hide(); } } }()); (function () { if ($.exists('.easyzoom')) { if ($(window).width() <= 768) { $('.easyzoom').removeClass('easyzoom--adjacent'); $('.easyzoom').addClass('easyzoom--overlay'); $('.product-image .toggle-mobile').delay(3000).animate({ opacity: 0 }, 1000); } else { $('.easyzoom').removeClass('easyzoom--overlay'); $('.easyzoom').addClass('easyzoom--adjacent'); } } }()); // CLOSE PRODUCT ADDITONAL DROPDOWN SELECT (function () { if ($.exists('.product-add-optional')) { $('.product-list').slideUp(200); }; }()); // CLOSE PRODUCT FILTER BAR (function () { if ($.exists('.filter-bar')) { filterBar(); $('.filter-listing').hide(); }; }()); // AD EXPANDABLE (function () { if ($(window).width() >= 479) { $('.ad-wrapper .expandable-wrapper').on('mouseenter', function () { if (!$(this).hasClass('item-expanded')) { expandableAd(this).expand(); }; }).on('mouseleave', function () { expandableAd(this).collapse(); }); }; }()); // COUNTRY SELECTOR (function () { if ($.exists('.country-picker')) { countrySelector(); }; }()); // SEARCH TOGGLES (function () { if ($.exists('.search-results .filter-list')) { }; }()); // SEARCH RESULTS (function () { if ($.exists('.search-results .filter-list')) { searchToggles(); $('.container-fluid.search-products').removeClass('filters-open'); }; }()); // CHECKOUT // CHECKOUT STEP TOGGLES (function () { if ($.exists('.checkout-steps')) { checkoutToggle(); // $('.toggle-wrapper').removeClass('open'); // if ($(window).width() >= 768) { // $('.toggler').show(); // } else { // $('.toggler').hide(); // } }; }()); // MINIBAG TOGGLES (function () { if ($.exists('.header-minibag')) { miniBagToggle(); }; }()); // MY MK // ACCOUNT TOGGLE (function () { if ($.exists('.account-nav')) { accountNavToggle(); }; }()); // PERSONAL PROFILE TOGGLE (function () { if ($.exists('.pp-module')) { personalProfile(); if ($(window).width() >= 768) { $('.pp-module').removeClass('open'); $('.pp-body').show(); } }; }()); (function () { if ($.exists('.my-mk .recommendations')) { recommendationsToggle(); $('a.view-all').removeClass('open'); $('a.view-all').text('View All'); }; }()); // EQUAL HEIGHTS FOR PRODUCT LISTING PRODUCTS (function () { equalheight('.product-listing:not(.no-equal) .product, .search-connect-find .col-sm-6, .about-mary-kay .module.chooser .chooser-row, .start-bar .col-sm-4, .edit-bag-body .product, .my-mk.personal-profile .option'); }()); })); })(jQuery); // Easy Responsive Tabs Plugin // Author: Samson.Onna (function ($) { $.fn.extend({ easyResponsiveTabs: function (options) { //Set the default values, use comma to separate the settings, example: var defaults = { type: 'default', //default, vertical, accordion; width: 'auto', fit: true, closed: false, activate: function () { } } //Variables var options = $.extend(defaults, options); var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion', jheight = 0; var hash = window.location.hash; var historyApi = !!(window.history && history.replaceState); //Events $(this).bind('tabactivate', function (e, currentTab) { if (typeof options.activate === 'function') { options.activate.call(currentTab, e) } }); //Main function this.each(function () { var $respTabs = $(this); var $respTabsList = $respTabs.find('ul.resp-tabs-list'); var respTabsId = $respTabs.attr('id'); $respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item'); $respTabs.css({ 'display': 'block', 'width': jwidth }); $respTabs.find('ul.resp-tabs-list li').each(function() { if ($(this).height() > jheight) { jheight = $(this).height(); } }); $respTabs.find('ul.resp-tabs-list li').each(function () { $(this).height(jheight); }); $respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content'); jtab_options(); //Properties Function function jtab_options() { if (jtype == vtabs) { $respTabs.addClass('resp-vtabs'); } if (jfit == true) { $respTabs.css({ width: '100%', margin: '0px' }); } if (jtype == accord) { $respTabs.addClass('resp-easy-accordion'); $respTabs.find('.resp-tabs-list').css('display', 'none'); } } //Assigning the h2 markup to accordion title var $tabItemh2; $respTabs.find('.resp-tab-content').before(""); var itemCount = 0; $respTabs.find('.resp-accordion').each(function () { $tabItemh2 = $(this); var $tabItem = $respTabs.find('.resp-tab-item:eq(' + itemCount + ')'); var $accItem = $respTabs.find('.resp-accordion:eq(' + itemCount + ')'); $accItem.append($tabItem.data('title')); $accItem.data($tabItem.data()); $tabItemh2.attr('aria-controls', 'tab_item-' + (itemCount)); $tabItemh2.attr('data-tab-id', 'tab_item-' + (count)); itemCount++; }); //Assigning the 'aria-controls' to Tab items var count = 0, $tabContent; $respTabs.find('.resp-tab-item').each(function () { $tabItem = $(this); $tabItem.attr('aria-controls', 'tab_item-' + (count)); $tabItem.attr('id', 'tab_item-' + (count)); $tabItem.attr('data-tab-id', 'tab_item-' + (count)); //Assigning the 'aria-labelledby' attr to tab-content var tabcount = 0; $respTabs.find('.resp-tab-content').each(function () { $tabContent = $(this); $tabContent.attr('aria-labelledby', 'tab_item-' + (tabcount)); tabcount++; }); count++; }); // Show correct content area var tabNum = 0; if (hash != '') { var matches = hash.match(new RegExp(respTabsId + "([0-9]+)")); if (matches !== null && matches.length === 2) { tabNum = parseInt(matches[1], 10) - 1; if (tabNum > count) { tabNum = 0; } } } //Active correct tab $($respTabs.find('.resp-tab-item')[tabNum]).addClass('resp-tab-active'); //keep closed if option = 'closed' or option is 'accordion' and the element is in accordion mode if (options.closed !== true && !(options.closed === 'accordion' && !$respTabsList.is(':visible')) && !(options.closed === 'tabs' && $respTabsList.is(':visible'))) { $($respTabs.find('.resp-accordion')[tabNum]).addClass('resp-tab-active'); $($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active').attr('style', 'display:block'); } //assign proper classes for when tabs mode is activated before making a selection in accordion mode else { $($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active resp-accordion-closed') } //Tab Click action function $respTabs.find("[data-tab-id^='tab_item-']").each(function () { var $currentTab = $(this); $currentTab.click(function () { var $currentTab = $(this); var $tabAria = $currentTab.attr('aria-controls'); if ($currentTab.hasClass('resp-accordion') && $currentTab.hasClass('resp-tab-active')) { $respTabs.find('.resp-tab-content-active').slideUp('', function () { $(this).addClass('resp-accordion-closed'); }); $currentTab.removeClass('resp-tab-active'); return false; } if (!$currentTab.hasClass('resp-tab-active') && $currentTab.hasClass('resp-accordion')) { $respTabs.find('.resp-tab-active').removeClass('resp-tab-active'); $respTabs.find('.resp-tab-content-active').slideUp().removeClass('resp-tab-content-active resp-accordion-closed'); $respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active'); $respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').slideDown().addClass('resp-tab-content-active'); } else { $respTabs.find('.resp-tab-active').removeClass('resp-tab-active'); $respTabs.find('.resp-tab-content-active').removeAttr('style').removeClass('resp-tab-content-active').removeClass('resp-accordion-closed'); $respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active'); $respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').addClass('resp-tab-content-active').attr('style', 'display:block'); } //Trigger tab activation event $currentTab.trigger('tabactivate', $currentTab); //Update Browser History if (historyApi) { var currentHash = window.location.hash; var newHash = respTabsId + (parseInt($tabAria.substring(9), 10) + 1).toString(); if (currentHash != "") { var re = new RegExp(respTabsId + "[0-9]+"); if (currentHash.match(re) != null) { newHash = currentHash.replace(re, newHash); } else { newHash = currentHash + "|" + newHash; } } else { newHash = '#' + newHash; } history.replaceState(null, null, newHash); } // Fix for product modules height issue inside of Tab module - BT/RLA equalheight('.product'); // reset the src for video iframes for non-active tabs $('div.resp-tabs-container div.resp-tab-content').not('.resp-tab-content-active').find('div.video-container iframe').each(function () { $(this).attr('src', ''); }); // set the src of the video iframe for the active tab $('div.resp-tabs-container div.resp-tab-content-active').find('div.video-container iframe').each(function () { $(this).attr('src', $(this).data('videourl')); }); }); //Window resize function $(window).resize(function () { $respTabs.find('.resp-accordion-closed').removeAttr('style'); }); }); }); } }); })(jQuery); /** * Basic structure: TC_Class is the public class that is returned upon being called * * So, if you do * var tc = $(".timer").TimeCircles(); * * tc will contain an instance of the public TimeCircles class. It is important to * note that TimeCircles is not chained in the conventional way, check the * documentation for more info on how TimeCircles can be chained. * * After being called/created, the public TimerCircles class will then- for each element * within it's collection, either fetch or create an instance of the private class. * Each function called upon the public class will be forwarded to each instance * of the private classes within the relevant element collection **/ (function ($) { var useWindow = window; // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys if (!Object.keys) { Object.keys = (function () { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ], dontEnumsLength = dontEnums.length; return function (obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } // Used to disable some features on IE8 var limited_mode = false; var tick_duration = 200; // in ms var debug = (location.hash === "#debug"); function debug_log(msg) { if (debug) { console.log(msg); } } var allUnits = ["Days", "Hours", "Minutes", "Seconds"]; var nextUnits = { Seconds: "Minutes", Minutes: "Hours", Hours: "Days", Days: "Years" }; var secondsIn = { Seconds: 1, Minutes: 60, Hours: 3600, Days: 86400, Months: 2678400, Years: 31536000 }; /** * Converts hex color code into object containing integer values for the r,g,b use * This function (hexToRgb) originates from: * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb * @param {string} hex color code */ function hexToRgb(hex) { // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, function (m, r, g, b) { return r + r + g + g + b + b; }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } function isCanvasSupported() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); } /** * Function s4() and guid() originate from: * http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript */ function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } /** * Creates a unique id * @returns {String} */ function guid() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } /** * Array.prototype.indexOf fallback for IE8 * @param {Mixed} mixed * @returns {Number} */ if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (elt /*, from*/) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } function parse_date(str) { var match = str.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{1,2}:[0-9]{2}:[0-9]{2}$/); if (match !== null && match.length > 0) { var parts = str.split(" "); var date = parts[0].split("-"); var time = parts[1].split(":"); return new Date(date[0], date[1] - 1, date[2], time[0], time[1], time[2]); } // Fallback for different date formats var d = Date.parse(str); if (!isNaN(d)) return d; d = Date.parse(str.replace(/-/g, '/').replace('T', ' ')); if (!isNaN(d)) return d; // Cant find anything return new Date(); } function parse_times(diff, old_diff, total_duration, units, floor) { var raw_time = {}; var raw_old_time = {}; var time = {}; var pct = {}; var old_pct = {}; var old_time = {}; var greater_unit = null; for (var i = 0; i < units.length; i++) { var unit = units[i]; var maxUnits; if (greater_unit === null) { maxUnits = total_duration / secondsIn[unit]; } else { maxUnits = secondsIn[greater_unit] / secondsIn[unit]; } var curUnits = (diff / secondsIn[unit]); var oldUnits = (old_diff / secondsIn[unit]); if (floor) { if (curUnits > 0) curUnits = Math.floor(curUnits); else curUnits = Math.ceil(curUnits); if (oldUnits > 0) oldUnits = Math.floor(oldUnits); else oldUnits = Math.ceil(oldUnits); } if (unit !== "Days") { curUnits = curUnits % maxUnits; oldUnits = oldUnits % maxUnits; } raw_time[unit] = curUnits; time[unit] = Math.abs(curUnits); raw_old_time[unit] = oldUnits; old_time[unit] = Math.abs(oldUnits); pct[unit] = Math.abs(curUnits) / maxUnits; old_pct[unit] = Math.abs(oldUnits) / maxUnits; greater_unit = unit; } return { raw_time: raw_time, raw_old_time: raw_old_time, time: time, old_time: old_time, pct: pct, old_pct: old_pct }; } var TC_Instance_List = {}; function updateUsedWindow() { if (typeof useWindow.TC_Instance_List !== "undefined") { TC_Instance_List = useWindow.TC_Instance_List; } else { useWindow.TC_Instance_List = TC_Instance_List; } initializeAnimationFrameHandler(useWindow); }; function initializeAnimationFrameHandler(w) { var vendors = ['webkit', 'moz']; for (var x = 0; x < vendors.length && !w.requestAnimationFrame; ++x) { w.requestAnimationFrame = w[vendors[x] + 'RequestAnimationFrame']; w.cancelAnimationFrame = w[vendors[x] + 'CancelAnimationFrame']; } if (!w.requestAnimationFrame || !w.cancelAnimationFrame) { w.requestAnimationFrame = function (callback, element, instance) { if (typeof instance === "undefined") instance = { data: { last_frame: 0 } }; var currTime = new Date().getTime(); var timeToCall = Math.max(0, 16 - (currTime - instance.data.last_frame)); var id = w.setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); instance.data.last_frame = currTime + timeToCall; return id; }; w.cancelAnimationFrame = function (id) { clearTimeout(id); }; } }; var TC_Instance = function (element, options) { this.element = element; this.container; this.listeners = null; this.data = { paused: false, last_frame: 0, animation_frame: null, interval_fallback: null, timer: false, total_duration: null, prev_time: null, drawn_units: [], text_elements: { Days: null, Hours: null, Minutes: null, Seconds: null }, attributes: { canvas: null, context: null, item_size: null, line_width: null, radius: null, outer_radius: null }, state: { fading: { Days: false, Hours: false, Minutes: false, Seconds: false } } }; this.config = null; this.setOptions(options); this.initialize(); }; TC_Instance.prototype.clearListeners = function () { this.listeners = { all: [], visible: [] }; }; TC_Instance.prototype.addTime = function (seconds_to_add) { if (this.data.attributes.ref_date instanceof Date) { var d = this.data.attributes.ref_date; d.setSeconds(d.getSeconds() + seconds_to_add); } else if (!isNaN(this.data.attributes.ref_date)) { this.data.attributes.ref_date += (seconds_to_add * 1000); } }; TC_Instance.prototype.initialize = function (clear_listeners) { // Initialize drawn units this.data.drawn_units = []; for (var i = 0; i < Object.keys(this.config.time).length; i++) { var unit = Object.keys(this.config.time)[i]; if (this.config.time[unit].show) { this.data.drawn_units.push(unit); } } // Avoid stacking $(this.element).children('div.time_circles').remove(); if (typeof clear_listeners === "undefined") clear_listeners = true; if (clear_listeners || this.listeners === null) { this.clearListeners(); } this.container = $("
"); this.container.addClass('time_circles'); this.container.appendTo(this.element); // Determine the needed width and height of TimeCircles var height = this.element.offsetHeight; var width = this.element.offsetWidth; if (height === 0) height = $(this.element).height(); if (width === 0) width = $(this.element).width(); if (height === 0 && width > 0) height = width / this.data.drawn_units.length; else if (width === 0 && height > 0) width = height * this.data.drawn_units.length; // Create our canvas and set it to the appropriate size var canvasElement = document.createElement('canvas'); canvasElement.width = width; canvasElement.height = height; // Add canvas elements this.data.attributes.canvas = $(canvasElement); this.data.attributes.canvas.appendTo(this.container); // Check if the browser has browser support var canvasSupported = isCanvasSupported(); // If the browser doesn't have browser support, check if explorer canvas is loaded // (A javascript library that adds canvas support to browsers that don't have it) if (!canvasSupported && typeof G_vmlCanvasManager !== "undefined") { G_vmlCanvasManager.initElement(canvasElement); limited_mode = true; canvasSupported = true; } if (canvasSupported) { this.data.attributes.context = canvasElement.getContext('2d'); } this.data.attributes.item_size = Math.min(width / this.data.drawn_units.length, height); this.data.attributes.line_width = this.data.attributes.item_size * this.config.fg_width; this.data.attributes.radius = ((this.data.attributes.item_size * 0.8) - this.data.attributes.line_width) / 2; this.data.attributes.outer_radius = this.data.attributes.radius + 0.5 * Math.max(this.data.attributes.line_width, this.data.attributes.line_width * this.config.bg_width); // Prepare Time Elements var i = 0; for (var key in this.data.text_elements) { if (!this.config.time[key].show) continue; var textElement = $("
"); textElement.addClass('textDiv_' + key); textElement.css("top", Math.round(0.35 * this.data.attributes.item_size)); textElement.css("left", Math.round(i++ * this.data.attributes.item_size)); textElement.css("width", this.data.attributes.item_size); textElement.appendTo(this.container); var headerElement = $("

"); headerElement.text(this.config.time[key].text); // Options headerElement.css("font-size", Math.round(this.config.text_size * this.data.attributes.item_size)); headerElement.css("line-height", Math.round(this.config.text_size * this.data.attributes.item_size) + "px"); headerElement.appendTo(textElement); var numberElement = $(""); numberElement.css("font-size", Math.round(3 * this.config.text_size * this.data.attributes.item_size)); numberElement.css("line-height", Math.round(this.config.text_size * this.data.attributes.item_size) + "px"); numberElement.appendTo(textElement); this.data.text_elements[key] = numberElement; } this.start(); if (!this.config.start) { this.data.paused = true; } // Set up interval fallback var _this = this; this.data.interval_fallback = useWindow.setInterval(function () { _this.update.call(_this, true); }, 100); }; TC_Instance.prototype.update = function (nodraw) { if (typeof nodraw === "undefined") { nodraw = false; } else if (nodraw && this.data.paused) { return; } if (limited_mode) { //Per unit clearing doesn't work in IE8 using explorer canvas, so do it in one time. The downside is that radial fade cant be used this.data.attributes.context.clearRect(0, 0, this.data.attributes.canvas[0].width, this.data.attributes.canvas[0].hright); } var diff, old_diff; var prevDate = this.data.prev_time; var curDate = new Date(); this.data.prev_time = curDate; if (prevDate === null) prevDate = curDate; // If not counting past zero, and time < 0, then simply draw the zero point once, and call stop if (!this.config.count_past_zero) { if (curDate > this.data.attributes.ref_date) { for (var i = 0; i < this.data.drawn_units.length; i++) { var key = this.data.drawn_units[i]; // Set the text value this.data.text_elements[key].text("0"); var x = (i * this.data.attributes.item_size) + (this.data.attributes.item_size / 2); var y = this.data.attributes.item_size / 2; var color = this.config.time[key].color; this.drawArc(x, y, color, 0); } this.stop(); return; } } // Compare current time with reference diff = (this.data.attributes.ref_date - curDate) / 1000; old_diff = (this.data.attributes.ref_date - prevDate) / 1000; var floor = this.config.animation !== "smooth"; var visible_times = parse_times(diff, old_diff, this.data.total_duration, this.data.drawn_units, floor); var all_times = parse_times(diff, old_diff, secondsIn["Years"], allUnits, floor); var i = 0; var j = 0; var lastKey = null; var cur_shown = this.data.drawn_units.slice(); for (var i in allUnits) { var key = allUnits[i]; // Notify (all) listeners if (Math.floor(all_times.raw_time[key]) !== Math.floor(all_times.raw_old_time[key])) { this.notifyListeners(key, Math.floor(all_times.time[key]), Math.floor(diff), "all"); } if (cur_shown.indexOf(key) < 0) continue; // Notify (visible) listeners if (Math.floor(visible_times.raw_time[key]) !== Math.floor(visible_times.raw_old_time[key])) { this.notifyListeners(key, Math.floor(visible_times.time[key]), Math.floor(diff), "visible"); } if (!nodraw) { // Set the text value this.data.text_elements[key].text(Math.floor(Math.abs(visible_times.time[key]))); var x = (j * this.data.attributes.item_size) + (this.data.attributes.item_size / 2); var y = this.data.attributes.item_size / 2; var color = this.config.time[key].color; if (this.config.animation === "smooth") { if (lastKey !== null && !limited_mode) { if (Math.floor(visible_times.time[lastKey]) > Math.floor(visible_times.old_time[lastKey])) { this.radialFade(x, y, color, 1, key); this.data.state.fading[key] = true; } else if (Math.floor(visible_times.time[lastKey]) < Math.floor(visible_times.old_time[lastKey])) { this.radialFade(x, y, color, 0, key); this.data.state.fading[key] = true; } } if (!this.data.state.fading[key]) { this.drawArc(x, y, color, visible_times.pct[key]); } } else { this.animateArc(x, y, color, visible_times.pct[key], visible_times.old_pct[key], (new Date()).getTime() + tick_duration); } } lastKey = key; j++; } // Dont request another update if we should be paused if (this.data.paused || nodraw) { return; } // We need this for our next frame either way var _this = this; var update = function () { _this.update.call(_this); }; // Either call next update immediately, or in a second if (this.config.animation === "smooth") { // Smooth animation, Queue up the next frame this.data.animation_frame = useWindow.requestAnimationFrame(update, _this.element, _this); } else { // Tick animation, Don't queue until very slightly after the next second happens var delay = (diff % 1) * 1000; if (delay < 0) delay = 1000 + delay; delay += 50; _this.data.animation_frame = useWindow.setTimeout(function () { _this.data.animation_frame = useWindow.requestAnimationFrame(update, _this.element, _this); }, delay); } }; TC_Instance.prototype.animateArc = function (x, y, color, target_pct, cur_pct, animation_end) { if (this.data.attributes.context === null) return; var diff = cur_pct - target_pct; if (Math.abs(diff) > 0.5) { if (target_pct === 0) { this.radialFade(x, y, color, 1); } else { this.radialFade(x, y, color, 0); } } else { var progress = (tick_duration - (animation_end - (new Date()).getTime())) / tick_duration; if (progress > 1) progress = 1; var pct = (cur_pct * (1 - progress)) + (target_pct * progress); this.drawArc(x, y, color, pct); //var show_pct = if (progress >= 1) return; var _this = this; useWindow.requestAnimationFrame(function () { _this.animateArc(x, y, color, target_pct, cur_pct, animation_end); }, this.element); } }; TC_Instance.prototype.drawArc = function (x, y, color, pct) { if (this.data.attributes.context === null) return; var clear_radius = Math.max(this.data.attributes.outer_radius, this.data.attributes.item_size / 2); if (!limited_mode) { this.data.attributes.context.clearRect( x - clear_radius, y - clear_radius, clear_radius * 2, clear_radius * 2 ); } if (this.config.use_background) { this.data.attributes.context.beginPath(); this.data.attributes.context.arc(x, y, this.data.attributes.radius, 0, 2 * Math.PI, false); this.data.attributes.context.lineWidth = this.data.attributes.line_width * this.config.bg_width; // line color this.data.attributes.context.strokeStyle = this.config.circle_bg_color; this.data.attributes.context.stroke(); } // Direction var startAngle, endAngle, counterClockwise; var defaultOffset = (-0.5 * Math.PI); var fullCircle = 2 * Math.PI; startAngle = defaultOffset + (this.config.start_angle / 360 * fullCircle); var offset = (2 * pct * Math.PI); if (this.config.direction === "Both") { counterClockwise = false; startAngle -= (offset / 2); endAngle = startAngle + offset; } else { if (this.config.direction === "Clockwise") { counterClockwise = false; endAngle = startAngle + offset; } else { counterClockwise = true; endAngle = startAngle - offset; } } this.data.attributes.context.beginPath(); this.data.attributes.context.arc(x, y, this.data.attributes.radius, startAngle, endAngle, counterClockwise); this.data.attributes.context.lineWidth = this.data.attributes.line_width; // line color this.data.attributes.context.strokeStyle = color; this.data.attributes.context.stroke(); }; TC_Instance.prototype.radialFade = function (x, y, color, from, key) { // TODO: Make fade_time option var rgb = hexToRgb(color); var _this = this; // We have a few inner scopes here that will need access to our instance var step = 0.2 * ((from === 1) ? -1 : 1); var i; for (i = 0; from <= 1 && from >= 0; i++) { // Create inner scope so our variables are not changed by the time the Timeout triggers (function () { var delay = 50 * i; var rgba = "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + (Math.round(from * 10) / 10) + ")"; useWindow.setTimeout(function () { _this.drawArc(x, y, rgba, 1); }, delay); }()); from += step; } if (typeof key !== undefined) { useWindow.setTimeout(function () { _this.data.state.fading[key] = false; }, 50 * i); } }; TC_Instance.prototype.timeLeft = function () { if (this.data.paused && typeof this.data.timer === "number") { return this.data.timer; } var now = new Date(); return ((this.data.attributes.ref_date - now) / 1000); }; TC_Instance.prototype.start = function () { useWindow.cancelAnimationFrame(this.data.animation_frame); useWindow.clearTimeout(this.data.animation_frame) // Check if a date was passed in html attribute or jquery data var attr_data_date = $(this.element).data('date'); if (typeof attr_data_date === "undefined") { attr_data_date = $(this.element).attr('data-date'); } if (typeof attr_data_date === "string") { this.data.attributes.ref_date = parse_date(attr_data_date); } // Check if this is an unpause of a timer else if (typeof this.data.timer === "number") { if (this.data.paused) { this.data.attributes.ref_date = (new Date()).getTime() + (this.data.timer * 1000); } } else { // Try to get data-timer var attr_data_timer = $(this.element).data('timer'); if (typeof attr_data_timer === "undefined") { attr_data_timer = $(this.element).attr('data-timer'); } if (typeof attr_data_timer === "string") { attr_data_timer = parseFloat(attr_data_timer); } if (typeof attr_data_timer === "number") { this.data.timer = attr_data_timer; this.data.attributes.ref_date = (new Date()).getTime() + (attr_data_timer * 1000); } else { // data-timer and data-date were both not set // use config date this.data.attributes.ref_date = this.config.ref_date; } } // Start running this.data.paused = false; this.update.call(this); }; TC_Instance.prototype.restart = function () { this.data.timer = false; this.start(); }; TC_Instance.prototype.stop = function () { if (typeof this.data.timer === "number") { this.data.timer = this.timeLeft(this); } // Stop running this.data.paused = true; useWindow.cancelAnimationFrame(this.data.animation_frame); }; TC_Instance.prototype.destroy = function () { this.clearListeners(); this.stop(); useWindow.clearInterval(this.data.interval_fallback); this.data.interval_fallback = null; this.container.remove(); $(this.element).removeAttr('data-tc-id'); $(this.element).removeData('tc-id'); }; TC_Instance.prototype.setOptions = function (options) { if (this.config === null) { this.default_options.ref_date = new Date(); this.config = $.extend(true, {}, this.default_options); } $.extend(true, this.config, options); // Use window.top if use_top_frame is true if (this.config.use_top_frame) { useWindow = window.top; } else { useWindow = window; } updateUsedWindow(); this.data.total_duration = this.config.total_duration; if (typeof this.data.total_duration === "string") { if (typeof secondsIn[this.data.total_duration] !== "undefined") { // If set to Years, Months, Days, Hours or Minutes, fetch the secondsIn value for that this.data.total_duration = secondsIn[this.data.total_duration]; } else if (this.data.total_duration === "Auto") { // If set to auto, total_duration is the size of 1 unit, of the unit type bigger than the largest shown for (var i = 0; i < Object.keys(this.config.time).length; i++) { var unit = Object.keys(this.config.time)[i]; if (this.config.time[unit].show) { this.data.total_duration = secondsIn[nextUnits[unit]]; break; } } } else { // If it's a string, but neither of the above, user screwed up. this.data.total_duration = secondsIn["Years"]; console.error("Valid values for TimeCircles config.total_duration are either numeric, or (string) Years, Months, Days, Hours, Minutes, Auto"); } } }; TC_Instance.prototype.addListener = function (f, context, type) { if (typeof f !== "function") return; if (typeof type === "undefined") type = "visible"; this.listeners[type].push({ func: f, scope: context }); }; TC_Instance.prototype.notifyListeners = function (unit, value, total, type) { for (var i = 0; i < this.listeners[type].length; i++) { var listener = this.listeners[type][i]; listener.func.apply(listener.scope, [unit, value, total]); } }; TC_Instance.prototype.default_options = { ref_date: new Date(), start: true, animation: "smooth", count_past_zero: true, circle_bg_color: "#60686F", use_background: true, fg_width: 0.1, bg_width: 1.2, text_size: 0.07, total_duration: "Auto", direction: "Clockwise", use_top_frame: false, start_angle: 0, time: { Days: { show: true, text: "Days", color: "#FC6" }, Hours: { show: true, text: "Hours", color: "#9CF" }, Minutes: { show: true, text: "Minutes", color: "#BFB" }, Seconds: { show: true, text: "Seconds", color: "#F99" } } }; // Time circle class var TC_Class = function (elements, options) { this.elements = elements; this.options = options; this.foreach(); }; TC_Class.prototype.getInstance = function (element) { var instance; var cur_id = $(element).data("tc-id"); if (typeof cur_id === "undefined") { cur_id = guid(); $(element).attr("data-tc-id", cur_id); } if (typeof TC_Instance_List[cur_id] === "undefined") { var options = this.options; var element_options = $(element).data('options'); if (typeof element_options === "string") { element_options = JSON.parse(element_options); } if (typeof element_options === "object") { options = $.extend(true, {}, this.options, element_options); } instance = new TC_Instance(element, options); TC_Instance_List[cur_id] = instance; } else { instance = TC_Instance_List[cur_id]; if (typeof this.options !== "undefined") { instance.setOptions(this.options); } } return instance; }; TC_Class.prototype.addTime = function (seconds_to_add) { this.foreach(function (instance) { instance.addTime(seconds_to_add); }); }; TC_Class.prototype.foreach = function (callback) { var _this = this; this.elements.each(function () { var instance = _this.getInstance(this); if (typeof callback === "function") { callback(instance); } }); return this; }; TC_Class.prototype.start = function () { this.foreach(function (instance) { instance.start(); }); return this; }; TC_Class.prototype.stop = function () { this.foreach(function (instance) { instance.stop(); }); return this; }; TC_Class.prototype.restart = function () { this.foreach(function (instance) { instance.restart(); }); return this; }; TC_Class.prototype.rebuild = function () { this.foreach(function (instance) { instance.initialize(false); }); return this; }; TC_Class.prototype.getTime = function () { return this.getInstance(this.elements[0]).timeLeft(); }; TC_Class.prototype.addListener = function (f, type) { if (typeof type === "undefined") type = "visible"; var _this = this; this.foreach(function (instance) { instance.addListener(f, _this.elements, type); }); return this; }; TC_Class.prototype.destroy = function () { this.foreach(function (instance) { instance.destroy(); }); return this; }; TC_Class.prototype.end = function () { return this.elements; }; $.fn.TimeCircles = function (options) { return new TC_Class(this, options); }; }(jQuery)); /*! * @name image-zoom * @author Matt Hinchliffe * @modified Monday, September 15th, 2014 * @version 2.2.1 */!function (a) { "use strict"; function b(b, c) { return this.$target = a(b), this.opts = a.extend({}, i, c), void 0 === this.isOpen && this._init(), this } var c, d, e, f, g, h, i = { loadingNotice: "Loading image", errorNotice: "The image could not be loaded", errorDuration: 2500, preventClicks: !0, onShow: void 0, onHide: void 0 }; b.prototype._init = function () { var b = this; this.$link = this.$target.find("a"), this.$image = this.$target.find("img"), this.$flyout = a('
'), this.$notice = a('
'), this.$target.on("mouseenter.easyzoom touchstart.easyzoom", function (a) { b.isMouseOver = !0, a.originalEvent.touches && 1 !== a.originalEvent.touches.length || (a.preventDefault(), b.show(a, !0)) }).on("mousemove.easyzoom touchmove.easyzoom", function (a) { b.isOpen && (a.preventDefault(), b._move(a)) }).on("mouseleave.easyzoom touchend.easyzoom", function () { b.isMouseOver = !1, b.isOpen && b.hide() }), this.opts.preventClicks && this.$target.on("click.easyzoom", "a", function (a) { a.preventDefault() }) }, b.prototype.show = function (a, b) { var g, h, i, j, k = this; return this.isReady ? (this.$target.append(this.$flyout), g = this.$target.width(), h = this.$target.height(), i = this.$flyout.width(), j = this.$flyout.height(), c = this.$zoom.width() - (i), d = this.$zoom.height() - (j), e = c / g, f = d / h, this.isOpen = !0, this.opts.onShow && this.opts.onShow.call(this), void (a && this._move(a))) : void this._load(this.$link.attr("href"), function () { (k.isMouseOver || !b) && k.show(a) }) }, b.prototype._load = function (b, c) { var d = new Image; this.$target.addClass("is-loading").append(this.$notice.text(this.opts.loadingNotice)), this.$zoom = a(d), d.onerror = a.proxy(function () { var a = this; this.$notice.text(this.opts.errorNotice), this.$target.removeClass("is-loading").addClass("is-error"), this.detachNotice = setTimeout(function () { a.$notice.detach(), a.detachNotice = null }, this.opts.errorDuration) }, this), d.onload = a.proxy(function () { d.width && (this.isReady = !0, this.$notice.detach(), this.$flyout.html(this.$zoom), this.$target.removeClass("is-loading").addClass("is-ready"), c()) }, this), d.style.position = "absolute", d.src = b }, b.prototype._move = function (a) { if (0 === a.type.indexOf("touch")) { var b = a.touches || a.originalEvent.touches; g = b[0].pageX, h = b[0].pageY } else g = a.pageX || g, h = a.pageY || h; var i = this.$target.offset(), j = h - i.top, k = g - i.left, l = Math.ceil(j * f), m = Math.ceil(k * e); 0 > m || 0 > l || m > c || l > d ? this.hide() : this.$zoom.css({ top: "" + -1 * l + "px", left: "" + -1 * m + "px" }) }, b.prototype.hide = function () { this.isOpen && (this.$flyout.detach(), this.isOpen = !1, this.opts.onHide && this.opts.onHide.call(this)) }, b.prototype.swap = function (b, c, d) { this.hide(), this.isReady = !1, this.detachNotice && clearTimeout(this.detachNotice), this.$notice.parent().length && this.$notice.detach(), a.isArray(d) && (d = d.join()), this.$target.removeClass("is-loading is-ready is-error"), this.$image.attr({ src: b, srcset: d }), this.$link.attr("href", c) }, b.prototype.teardown = function () { this.hide(), this.$target.removeClass("is-loading is-ready is-error").off(".easyzoom"), this.detachNotice && clearTimeout(this.detachNotice), delete this.$link, delete this.$zoom, delete this.$image, delete this.$notice, delete this.$flyout, delete this.isOpen, delete this.isReady }, a.fn.easyZoom = function (c) { return this.each(function () { var d = a.data(this, "easyZoom"); d ? void 0 === d.isOpen && d._init() : a.data(this, "easyZoom", new b(this, c)) }) }, "function" == typeof define && define.amd ? define(function () { return b }) : "undefined" != typeof module && module.exports && (module.exports = b) }(jQuery); /*! jquery.finger - v0.1.2 - 2014-10-01 * https://github.com/ngryman/jquery.finger * Copyright (c) 2014 Nicolas Gryman; Licensed MIT */ (function (e, t) { var b = /chrome/i.exec(t), x = /android/i.exec(t), w = "ontouchstart" in window && !(b && !x), q = w ? "touchstart" : "mousedown", u = w ? "touchend touchcancel" : "mouseup mouseleave", c = w ? "touchmove" : "mousemove", m = "finger", j = e("html")[0], f = {}, r = {}, p, d, v, k, o, h, a = e.Finger = { pressDuration: 300, doubleTapInterval: 300, flickDuration: 150, motionThreshold: 5 }; function i(z) { z.preventDefault(); e.event.remove(j, "click", i) } function g(A, z) { return (w ? z.originalEvent.touches[0] : z)["page" + A.toUpperCase()] } function n(B, C, z) { var A = e.Event(C, r); e.event.trigger(A, { originalEvent: B }, B.target); if (A.isDefaultPrevented()) { if (~C.indexOf("tap") && !w) { e.event.add(j, "click", i) } else { B.preventDefault() } } if (z) { e.event.remove(j, c + "." + m, s); e.event.remove(j, u + "." + m, l) } } function y(A) { var z = A.timeStamp || +new Date(); if (v == z) { return } v = z; f.x = r.x = g("x", A); f.y = r.y = g("y", A); f.time = z; f.target = A.target; r.orientation = null; r.end = false; p = false; d = false; k = setTimeout(function () { d = true; n(A, "press") }, e.Finger.pressDuration); e.event.add(j, c + "." + m, s); e.event.add(j, u + "." + m, l); if (a.preventDefault) { A.preventDefault(); e.event.add(j, "click", i) } } function s(z) { r.x = g("x", z); r.y = g("y", z); r.dx = r.x - f.x; r.dy = r.y - f.y; r.adx = Math.abs(r.dx); r.ady = Math.abs(r.dy); p = r.adx > a.motionThreshold || r.ady > a.motionThreshold; if (!p) { return } clearTimeout(k); if (!r.orientation) { if (r.adx > r.ady) { r.orientation = "horizontal"; r.direction = r.dx > 0 ? +1 : -1 } else { r.orientation = "vertical"; r.direction = r.dy > 0 ? +1 : -1 } } while (z.target && z.target !== f.target) { z.target = z.target.parentNode } if (z.target !== f.target) { z.target = f.target; l.call(this, e.Event(u + "." + m, z)); return } n(z, "drag") } function l(C) { var z = C.timeStamp || +new Date(), B = z - f.time, D; clearTimeout(k); if (!p && !d && C.target === f.target) { var A = o === C.target && z - h < a.doubleTapInterval; D = A ? "doubletap" : "tap"; o = A ? null : f.target; h = z } else { C.target = f.target; if (B < a.flickDuration) { n(C, "flick") } r.end = true; D = "drag" } n(C, D, true) } e.event.add(j, q + "." + m, y); e.each(["tap", "doubletap", "press", "drag", "flick"], function (A, z) { e.fn[z] = function (B) { return B ? this.on(z, B) : this.trigger(z) } }) })(jQuery, navigator.userAgent);; //! moment.js //! version : 2.10.3 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com !function (a, b) { "object" == typeof exports && "undefined" != typeof module ? module.exports = b() : "function" == typeof define && define.amd ? define(b) : a.moment = b() }(this, function () { "use strict"; function a() { return Dc.apply(null, arguments) } function b(a) { Dc = a } function c(a) { return "[object Array]" === Object.prototype.toString.call(a) } function d(a) { return a instanceof Date || "[object Date]" === Object.prototype.toString.call(a) } function e(a, b) { var c, d = []; for (c = 0; c < a.length; ++c) d.push(b(a[c], c)); return d } function f(a, b) { return Object.prototype.hasOwnProperty.call(a, b) } function g(a, b) { for (var c in b) f(b, c) && (a[c] = b[c]); return f(b, "toString") && (a.toString = b.toString), f(b, "valueOf") && (a.valueOf = b.valueOf), a } function h(a, b, c, d) { return za(a, b, c, d, !0).utc() } function i() { return { empty: !1, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: !1, invalidMonth: null, invalidFormat: !1, userInvalidated: !1, iso: !1 } } function j(a) { return null == a._pf && (a._pf = i()), a._pf } function k(a) { if (null == a._isValid) { var b = j(a); a._isValid = !isNaN(a._d.getTime()) && b.overflow < 0 && !b.empty && !b.invalidMonth && !b.nullInput && !b.invalidFormat && !b.userInvalidated, a._strict && (a._isValid = a._isValid && 0 === b.charsLeftOver && 0 === b.unusedTokens.length && void 0 === b.bigHour) } return a._isValid } function l(a) { var b = h(0 / 0); return null != a ? g(j(b), a) : j(b).userInvalidated = !0, b } function m(a, b) { var c, d, e; if ("undefined" != typeof b._isAMomentObject && (a._isAMomentObject = b._isAMomentObject), "undefined" != typeof b._i && (a._i = b._i), "undefined" != typeof b._f && (a._f = b._f), "undefined" != typeof b._l && (a._l = b._l), "undefined" != typeof b._strict && (a._strict = b._strict), "undefined" != typeof b._tzm && (a._tzm = b._tzm), "undefined" != typeof b._isUTC && (a._isUTC = b._isUTC), "undefined" != typeof b._offset && (a._offset = b._offset), "undefined" != typeof b._pf && (a._pf = j(b)), "undefined" != typeof b._locale && (a._locale = b._locale), Fc.length > 0) for (c in Fc) d = Fc[c], e = b[d], "undefined" != typeof e && (a[d] = e); return a } function n(b) { m(this, b), this._d = new Date(+b._d), Gc === !1 && (Gc = !0, a.updateOffset(this), Gc = !1) } function o(a) { return a instanceof n || null != a && null != a._isAMomentObject } function p(a) { var b = +a, c = 0; return 0 !== b && isFinite(b) && (c = b >= 0 ? Math.floor(b) : Math.ceil(b)), c } function q(a, b, c) { var d, e = Math.min(a.length, b.length), f = Math.abs(a.length - b.length), g = 0; for (d = 0; e > d; d++) (c && a[d] !== b[d] || !c && p(a[d]) !== p(b[d])) && g++; return g + f } function r() { } function s(a) { return a ? a.toLowerCase().replace("_", "-") : a } function t(a) { for (var b, c, d, e, f = 0; f < a.length;) { for (e = s(a[f]).split("-"), b = e.length, c = s(a[f + 1]), c = c ? c.split("-") : null; b > 0;) { if (d = u(e.slice(0, b).join("-"))) return d; if (c && c.length >= b && q(e, c, !0) >= b - 1) break; b-- } f++ } return null } function u(a) { var b = null; if (!Hc[a] && "undefined" != typeof module && module && module.exports) try { b = Ec._abbr, require("./locale/" + a), v(b) } catch (c) { } return Hc[a] } function v(a, b) { var c; return a && (c = "undefined" == typeof b ? x(a) : w(a, b), c && (Ec = c)), Ec._abbr } function w(a, b) { return null !== b ? (b.abbr = a, Hc[a] || (Hc[a] = new r), Hc[a].set(b), v(a), Hc[a]) : (delete Hc[a], null) } function x(a) { var b; if (a && a._locale && a._locale._abbr && (a = a._locale._abbr), !a) return Ec; if (!c(a)) { if (b = u(a)) return b; a = [a] } return t(a) } function y(a, b) { var c = a.toLowerCase(); Ic[c] = Ic[c + "s"] = Ic[b] = a } function z(a) { return "string" == typeof a ? Ic[a] || Ic[a.toLowerCase()] : void 0 } function A(a) { var b, c, d = {}; for (c in a) f(a, c) && (b = z(c), b && (d[b] = a[c])); return d } function B(b, c) { return function (d) { return null != d ? (D(this, b, d), a.updateOffset(this, c), this) : C(this, b) } } function C(a, b) { return a._d["get" + (a._isUTC ? "UTC" : "") + b]() } function D(a, b, c) { return a._d["set" + (a._isUTC ? "UTC" : "") + b](c) } function E(a, b) { var c; if ("object" == typeof a) for (c in a) this.set(c, a[c]); else if (a = z(a), "function" == typeof this[a]) return this[a](b); return this } function F(a, b, c) { for (var d = "" + Math.abs(a), e = a >= 0; d.length < b;) d = "0" + d; return (e ? c ? "+" : "" : "-") + d } function G(a, b, c, d) { var e = d; "string" == typeof d && (e = function () { return this[d]() }), a && (Mc[a] = e), b && (Mc[b[0]] = function () { return F(e.apply(this, arguments), b[1], b[2]) }), c && (Mc[c] = function () { return this.localeData().ordinal(e.apply(this, arguments), a) }) } function H(a) { return a.match(/\[[\s\S]/) ? a.replace(/^\[|\]$/g, "") : a.replace(/\\/g, "") } function I(a) { var b, c, d = a.match(Jc); for (b = 0, c = d.length; c > b; b++) Mc[d[b]] ? d[b] = Mc[d[b]] : d[b] = H(d[b]); return function (e) { var f = ""; for (b = 0; c > b; b++) f += d[b] instanceof Function ? d[b].call(e, a) : d[b]; return f } } function J(a, b) { return a.isValid() ? (b = K(b, a.localeData()), Lc[b] || (Lc[b] = I(b)), Lc[b](a)) : a.localeData().invalidDate() } function K(a, b) { function c(a) { return b.longDateFormat(a) || a } var d = 5; for (Kc.lastIndex = 0; d >= 0 && Kc.test(a) ;) a = a.replace(Kc, c), Kc.lastIndex = 0, d -= 1; return a } function L(a, b, c) { _c[a] = "function" == typeof b ? b : function (a) { return a && c ? c : b } } function M(a, b) { return f(_c, a) ? _c[a](b._strict, b._locale) : new RegExp(N(a)) } function N(a) { return a.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (a, b, c, d, e) { return b || c || d || e }).replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") } function O(a, b) { var c, d = b; for ("string" == typeof a && (a = [a]), "number" == typeof b && (d = function (a, c) { c[b] = p(a) }), c = 0; c < a.length; c++) ad[a[c]] = d } function P(a, b) { O(a, function (a, c, d, e) { d._w = d._w || {}, b(a, d._w, d, e) }) } function Q(a, b, c) { null != b && f(ad, a) && ad[a](b, c._a, c, a) } function R(a, b) { return new Date(Date.UTC(a, b + 1, 0)).getUTCDate() } function S(a) { return this._months[a.month()] } function T(a) { return this._monthsShort[a.month()] } function U(a, b, c) { var d, e, f; for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), d = 0; 12 > d; d++) { if (e = h([2e3, d]), c && !this._longMonthsParse[d] && (this._longMonthsParse[d] = new RegExp("^" + this.months(e, "").replace(".", "") + "$", "i"), this._shortMonthsParse[d] = new RegExp("^" + this.monthsShort(e, "").replace(".", "") + "$", "i")), c || this._monthsParse[d] || (f = "^" + this.months(e, "") + "|^" + this.monthsShort(e, ""), this._monthsParse[d] = new RegExp(f.replace(".", ""), "i")), c && "MMMM" === b && this._longMonthsParse[d].test(a)) return d; if (c && "MMM" === b && this._shortMonthsParse[d].test(a)) return d; if (!c && this._monthsParse[d].test(a)) return d } } function V(a, b) { var c; return "string" == typeof b && (b = a.localeData().monthsParse(b), "number" != typeof b) ? a : (c = Math.min(a.date(), R(a.year(), b)), a._d["set" + (a._isUTC ? "UTC" : "") + "Month"](b, c), a) } function W(b) { return null != b ? (V(this, b), a.updateOffset(this, !0), this) : C(this, "Month") } function X() { return R(this.year(), this.month()) } function Y(a) { var b, c = a._a; return c && -2 === j(a).overflow && (b = c[cd] < 0 || c[cd] > 11 ? cd : c[dd] < 1 || c[dd] > R(c[bd], c[cd]) ? dd : c[ed] < 0 || c[ed] > 24 || 24 === c[ed] && (0 !== c[fd] || 0 !== c[gd] || 0 !== c[hd]) ? ed : c[fd] < 0 || c[fd] > 59 ? fd : c[gd] < 0 || c[gd] > 59 ? gd : c[hd] < 0 || c[hd] > 999 ? hd : -1, j(a)._overflowDayOfYear && (bd > b || b > dd) && (b = dd), j(a).overflow = b), a } function Z(b) { a.suppressDeprecationWarnings === !1 && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + b) } function $(a, b) { var c = !0, d = a + "\n" + (new Error).stack; return g(function () { return c && (Z(d), c = !1), b.apply(this, arguments) }, b) } function _(a, b) { kd[a] || (Z(b), kd[a] = !0) } function aa(a) { var b, c, d = a._i, e = ld.exec(d); if (e) { for (j(a).iso = !0, b = 0, c = md.length; c > b; b++) if (md[b][1].exec(d)) { a._f = md[b][0] + (e[6] || " "); break } for (b = 0, c = nd.length; c > b; b++) if (nd[b][1].exec(d)) { a._f += nd[b][0]; break } d.match(Yc) && (a._f += "Z"), ta(a) } else a._isValid = !1 } function ba(b) { var c = od.exec(b._i); return null !== c ? void (b._d = new Date(+c[1])) : (aa(b), void (b._isValid === !1 && (delete b._isValid, a.createFromInputFallback(b)))) } function ca(a, b, c, d, e, f, g) { var h = new Date(a, b, c, d, e, f, g); return 1970 > a && h.setFullYear(a), h } function da(a) { var b = new Date(Date.UTC.apply(null, arguments)); return 1970 > a && b.setUTCFullYear(a), b } function ea(a) { return fa(a) ? 366 : 365 } function fa(a) { return a % 4 === 0 && a % 100 !== 0 || a % 400 === 0 } function ga() { return fa(this.year()) } function ha(a, b, c) { var d, e = c - b, f = c - a.day(); return f > e && (f -= 7), e - 7 > f && (f += 7), d = Aa(a).add(f, "d"), { week: Math.ceil(d.dayOfYear() / 7), year: d.year() } } function ia(a) { return ha(a, this._week.dow, this._week.doy).week } function ja() { return this._week.dow } function ka() { return this._week.doy } function la(a) { var b = this.localeData().week(this); return null == a ? b : this.add(7 * (a - b), "d") } function ma(a) { var b = ha(this, 1, 4).week; return null == a ? b : this.add(7 * (a - b), "d") } function na(a, b, c, d, e) { var f, g, h = da(a, 0, 1).getUTCDay(); return h = 0 === h ? 7 : h, c = null != c ? c : e, f = e - h + (h > d ? 7 : 0) - (e > h ? 7 : 0), g = 7 * (b - 1) + (c - e) + f + 1, { year: g > 0 ? a : a - 1, dayOfYear: g > 0 ? g : ea(a - 1) + g } } function oa(a) { var b = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1; return null == a ? b : this.add(a - b, "d") } function pa(a, b, c) { return null != a ? a : null != b ? b : c } function qa(a) { var b = new Date; return a._useUTC ? [b.getUTCFullYear(), b.getUTCMonth(), b.getUTCDate()] : [b.getFullYear(), b.getMonth(), b.getDate()] } function ra(a) { var b, c, d, e, f = []; if (!a._d) { for (d = qa(a), a._w && null == a._a[dd] && null == a._a[cd] && sa(a), a._dayOfYear && (e = pa(a._a[bd], d[bd]), a._dayOfYear > ea(e) && (j(a)._overflowDayOfYear = !0), c = da(e, 0, a._dayOfYear), a._a[cd] = c.getUTCMonth(), a._a[dd] = c.getUTCDate()), b = 0; 3 > b && null == a._a[b]; ++b) a._a[b] = f[b] = d[b]; for (; 7 > b; b++) a._a[b] = f[b] = null == a._a[b] ? 2 === b ? 1 : 0 : a._a[b]; 24 === a._a[ed] && 0 === a._a[fd] && 0 === a._a[gd] && 0 === a._a[hd] && (a._nextDay = !0, a._a[ed] = 0), a._d = (a._useUTC ? da : ca).apply(null, f), null != a._tzm && a._d.setUTCMinutes(a._d.getUTCMinutes() - a._tzm), a._nextDay && (a._a[ed] = 24) } } function sa(a) { var b, c, d, e, f, g, h; b = a._w, null != b.GG || null != b.W || null != b.E ? (f = 1, g = 4, c = pa(b.GG, a._a[bd], ha(Aa(), 1, 4).year), d = pa(b.W, 1), e = pa(b.E, 1)) : (f = a._locale._week.dow, g = a._locale._week.doy, c = pa(b.gg, a._a[bd], ha(Aa(), f, g).year), d = pa(b.w, 1), null != b.d ? (e = b.d, f > e && ++d) : e = null != b.e ? b.e + f : f), h = na(c, d, e, g, f), a._a[bd] = h.year, a._dayOfYear = h.dayOfYear } function ta(b) { if (b._f === a.ISO_8601) return void aa(b); b._a = [], j(b).empty = !0; var c, d, e, f, g, h = "" + b._i, i = h.length, k = 0; for (e = K(b._f, b._locale).match(Jc) || [], c = 0; c < e.length; c++) f = e[c], d = (h.match(M(f, b)) || [])[0], d && (g = h.substr(0, h.indexOf(d)), g.length > 0 && j(b).unusedInput.push(g), h = h.slice(h.indexOf(d) + d.length), k += d.length), Mc[f] ? (d ? j(b).empty = !1 : j(b).unusedTokens.push(f), Q(f, d, b)) : b._strict && !d && j(b).unusedTokens.push(f); j(b).charsLeftOver = i - k, h.length > 0 && j(b).unusedInput.push(h), j(b).bigHour === !0 && b._a[ed] <= 12 && b._a[ed] > 0 && (j(b).bigHour = void 0), b._a[ed] = ua(b._locale, b._a[ed], b._meridiem), ra(b), Y(b) } function ua(a, b, c) { var d; return null == c ? b : null != a.meridiemHour ? a.meridiemHour(b, c) : null != a.isPM ? (d = a.isPM(c), d && 12 > b && (b += 12), d || 12 !== b || (b = 0), b) : b } function va(a) { var b, c, d, e, f; if (0 === a._f.length) return j(a).invalidFormat = !0, void (a._d = new Date(0 / 0)); for (e = 0; e < a._f.length; e++) f = 0, b = m({}, a), null != a._useUTC && (b._useUTC = a._useUTC), b._f = a._f[e], ta(b), k(b) && (f += j(b).charsLeftOver, f += 10 * j(b).unusedTokens.length, j(b).score = f, (null == d || d > f) && (d = f, c = b)); g(a, c || b) } function wa(a) { if (!a._d) { var b = A(a._i); a._a = [b.year, b.month, b.day || b.date, b.hour, b.minute, b.second, b.millisecond], ra(a) } } function xa(a) { var b, e = a._i, f = a._f; return a._locale = a._locale || x(a._l), null === e || void 0 === f && "" === e ? l({ nullInput: !0 }) : ("string" == typeof e && (a._i = e = a._locale.preparse(e)), o(e) ? new n(Y(e)) : (c(f) ? va(a) : f ? ta(a) : d(e) ? a._d = e : ya(a), b = new n(Y(a)), b._nextDay && (b.add(1, "d"), b._nextDay = void 0), b)) } function ya(b) { var f = b._i; void 0 === f ? b._d = new Date : d(f) ? b._d = new Date(+f) : "string" == typeof f ? ba(b) : c(f) ? (b._a = e(f.slice(0), function (a) { return parseInt(a, 10) }), ra(b)) : "object" == typeof f ? wa(b) : "number" == typeof f ? b._d = new Date(f) : a.createFromInputFallback(b) } function za(a, b, c, d, e) { var f = {}; return "boolean" == typeof c && (d = c, c = void 0), f._isAMomentObject = !0, f._useUTC = f._isUTC = e, f._l = c, f._i = a, f._f = b, f._strict = d, xa(f) } function Aa(a, b, c, d) { return za(a, b, c, d, !1) } function Ba(a, b) { var d, e; if (1 === b.length && c(b[0]) && (b = b[0]), !b.length) return Aa(); for (d = b[0], e = 1; e < b.length; ++e) b[e][a](d) && (d = b[e]); return d } function Ca() { var a = [].slice.call(arguments, 0); return Ba("isBefore", a) } function Da() { var a = [].slice.call(arguments, 0); return Ba("isAfter", a) } function Ea(a) { var b = A(a), c = b.year || 0, d = b.quarter || 0, e = b.month || 0, f = b.week || 0, g = b.day || 0, h = b.hour || 0, i = b.minute || 0, j = b.second || 0, k = b.millisecond || 0; this._milliseconds = +k + 1e3 * j + 6e4 * i + 36e5 * h, this._days = +g + 7 * f, this._months = +e + 3 * d + 12 * c, this._data = {}, this._locale = x(), this._bubble() } function Fa(a) { return a instanceof Ea } function Ga(a, b) { G(a, 0, 0, function () { var a = this.utcOffset(), c = "+"; return 0 > a && (a = -a, c = "-"), c + F(~~(a / 60), 2) + b + F(~~a % 60, 2) }) } function Ha(a) { var b = (a || "").match(Yc) || [], c = b[b.length - 1] || [], d = (c + "").match(td) || ["-", 0, 0], e = +(60 * d[1]) + p(d[2]); return "+" === d[0] ? e : -e } function Ia(b, c) { var e, f; return c._isUTC ? (e = c.clone(), f = (o(b) || d(b) ? +b : +Aa(b)) - +e, e._d.setTime(+e._d + f), a.updateOffset(e, !1), e) : Aa(b).local(); return c._isUTC ? Aa(b).zone(c._offset || 0) : Aa(b).local() } function Ja(a) { return 15 * -Math.round(a._d.getTimezoneOffset() / 15) } function Ka(b, c) { var d, e = this._offset || 0; return null != b ? ("string" == typeof b && (b = Ha(b)), Math.abs(b) < 16 && (b = 60 * b), !this._isUTC && c && (d = Ja(this)), this._offset = b, this._isUTC = !0, null != d && this.add(d, "m"), e !== b && (!c || this._changeInProgress ? $a(this, Va(b - e, "m"), 1, !1) : this._changeInProgress || (this._changeInProgress = !0, a.updateOffset(this, !0), this._changeInProgress = null)), this) : this._isUTC ? e : Ja(this) } function La(a, b) { return null != a ? ("string" != typeof a && (a = -a), this.utcOffset(a, b), this) : -this.utcOffset() } function Ma(a) { return this.utcOffset(0, a) } function Na(a) { return this._isUTC && (this.utcOffset(0, a), this._isUTC = !1, a && this.subtract(Ja(this), "m")), this } function Oa() { return this._tzm ? this.utcOffset(this._tzm) : "string" == typeof this._i && this.utcOffset(Ha(this._i)), this } function Pa(a) { return a = a ? Aa(a).utcOffset() : 0, (this.utcOffset() - a) % 60 === 0 } function Qa() { return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() } function Ra() { if (this._a) { var a = this._isUTC ? h(this._a) : Aa(this._a); return this.isValid() && q(this._a, a.toArray()) > 0 } return !1 } function Sa() { return !this._isUTC } function Ta() { return this._isUTC } function Ua() { return this._isUTC && 0 === this._offset } function Va(a, b) { var c, d, e, g = a, h = null; return Fa(a) ? g = { ms: a._milliseconds, d: a._days, M: a._months } : "number" == typeof a ? (g = {}, b ? g[b] = a : g.milliseconds = a) : (h = ud.exec(a)) ? (c = "-" === h[1] ? -1 : 1, g = { y: 0, d: p(h[dd]) * c, h: p(h[ed]) * c, m: p(h[fd]) * c, s: p(h[gd]) * c, ms: p(h[hd]) * c }) : (h = vd.exec(a)) ? (c = "-" === h[1] ? -1 : 1, g = { y: Wa(h[2], c), M: Wa(h[3], c), d: Wa(h[4], c), h: Wa(h[5], c), m: Wa(h[6], c), s: Wa(h[7], c), w: Wa(h[8], c) }) : null == g ? g = {} : "object" == typeof g && ("from" in g || "to" in g) && (e = Ya(Aa(g.from), Aa(g.to)), g = {}, g.ms = e.milliseconds, g.M = e.months), d = new Ea(g), Fa(a) && f(a, "_locale") && (d._locale = a._locale), d } function Wa(a, b) { var c = a && parseFloat(a.replace(",", ".")); return (isNaN(c) ? 0 : c) * b } function Xa(a, b) { var c = { milliseconds: 0, months: 0 }; return c.months = b.month() - a.month() + 12 * (b.year() - a.year()), a.clone().add(c.months, "M").isAfter(b) && --c.months, c.milliseconds = +b - +a.clone().add(c.months, "M"), c } function Ya(a, b) { var c; return b = Ia(b, a), a.isBefore(b) ? c = Xa(a, b) : (c = Xa(b, a), c.milliseconds = -c.milliseconds, c.months = -c.months), c } function Za(a, b) { return function (c, d) { var e, f; return null === d || isNaN(+d) || (_(b, "moment()." + b + "(period, number) is deprecated. Please use moment()." + b + "(number, period)."), f = c, c = d, d = f), c = "string" == typeof c ? +c : c, e = Va(c, d), $a(this, e, a), this } } function $a(b, c, d, e) { var f = c._milliseconds, g = c._days, h = c._months; e = null == e ? !0 : e, f && b._d.setTime(+b._d + f * d), g && D(b, "Date", C(b, "Date") + g * d), h && V(b, C(b, "Month") + h * d), e && a.updateOffset(b, g || h) } function _a(a) { var b = a || Aa(), c = Ia(b, this).startOf("day"), d = this.diff(c, "days", !0), e = -6 > d ? "sameElse" : -1 > d ? "lastWeek" : 0 > d ? "lastDay" : 1 > d ? "sameDay" : 2 > d ? "nextDay" : 7 > d ? "nextWeek" : "sameElse"; return this.format(this.localeData().calendar(e, this, Aa(b))) } function ab() { return new n(this) } function bb(a, b) { var c; return b = z("undefined" != typeof b ? b : "millisecond"), "millisecond" === b ? (a = o(a) ? a : Aa(a), +this > +a) : (c = o(a) ? +a : +Aa(a), c < +this.clone().startOf(b)) } function cb(a, b) { var c; return b = z("undefined" != typeof b ? b : "millisecond"), "millisecond" === b ? (a = o(a) ? a : Aa(a), +a > +this) : (c = o(a) ? +a : +Aa(a), +this.clone().endOf(b) < c) } function db(a, b, c) { return this.isAfter(a, c) && this.isBefore(b, c) } function eb(a, b) { var c; return b = z(b || "millisecond"), "millisecond" === b ? (a = o(a) ? a : Aa(a), +this === +a) : (c = +Aa(a), +this.clone().startOf(b) <= c && c <= +this.clone().endOf(b)) } function fb(a) { return 0 > a ? Math.ceil(a) : Math.floor(a) } function gb(a, b, c) { var d, e, f = Ia(a, this), g = 6e4 * (f.utcOffset() - this.utcOffset()); return b = z(b), "year" === b || "month" === b || "quarter" === b ? (e = hb(this, f), "quarter" === b ? e /= 3 : "year" === b && (e /= 12)) : (d = this - f, e = "second" === b ? d / 1e3 : "minute" === b ? d / 6e4 : "hour" === b ? d / 36e5 : "day" === b ? (d - g) / 864e5 : "week" === b ? (d - g) / 6048e5 : d), c ? e : fb(e) } function hb(a, b) { var c, d, e = 12 * (b.year() - a.year()) + (b.month() - a.month()), f = a.clone().add(e, "months"); return 0 > b - f ? (c = a.clone().add(e - 1, "months"), d = (b - f) / (f - c)) : (c = a.clone().add(e + 1, "months"), d = (b - f) / (c - f)), -(e + d) } function ib() { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ") } function jb() { var a = this.clone().utc(); return 0 < a.year() && a.year() <= 9999 ? "function" == typeof Date.prototype.toISOString ? this.toDate().toISOString() : J(a, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]") : J(a, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]") } function kb(b) { var c = J(this, b || a.defaultFormat); return this.localeData().postformat(c) } function lb(a, b) { return this.isValid() ? Va({ to: this, from: a }).locale(this.locale()).humanize(!b) : this.localeData().invalidDate() } function mb(a) { return this.from(Aa(), a) } function nb(a, b) { return this.isValid() ? Va({ from: this, to: a }).locale(this.locale()).humanize(!b) : this.localeData().invalidDate() } function ob(a) { return this.to(Aa(), a) } function pb(a) { var b; return void 0 === a ? this._locale._abbr : (b = x(a), null != b && (this._locale = b), this) } function qb() { return this._locale } function rb(a) { switch (a = z(a)) { case "year": this.month(0); case "quarter": case "month": this.date(1); case "week": case "isoWeek": case "day": this.hours(0); case "hour": this.minutes(0); case "minute": this.seconds(0); case "second": this.milliseconds(0) } return "week" === a && this.weekday(0), "isoWeek" === a && this.isoWeekday(1), "quarter" === a && this.month(3 * Math.floor(this.month() / 3)), this } function sb(a) { return a = z(a), void 0 === a || "millisecond" === a ? this : this.startOf(a).add(1, "isoWeek" === a ? "week" : a).subtract(1, "ms") } function tb() { return +this._d - 6e4 * (this._offset || 0) } function ub() { return Math.floor(+this / 1e3) } function vb() { return this._offset ? new Date(+this) : this._d } function wb() { var a = this; return [a.year(), a.month(), a.date(), a.hour(), a.minute(), a.second(), a.millisecond()] } function xb() { return k(this) } function yb() { return g({}, j(this)) } function zb() { return j(this).overflow } function Ab(a, b) { G(0, [a, a.length], 0, b) } function Bb(a, b, c) { return ha(Aa([a, 11, 31 + b - c]), b, c).week } function Cb(a) { var b = ha(this, this.localeData()._week.dow, this.localeData()._week.doy).year; return null == a ? b : this.add(a - b, "y") } function Db(a) { var b = ha(this, 1, 4).year; return null == a ? b : this.add(a - b, "y") } function Eb() { return Bb(this.year(), 1, 4) } function Fb() { var a = this.localeData()._week; return Bb(this.year(), a.dow, a.doy) } function Gb(a) { return null == a ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (a - 1) + this.month() % 3) } function Hb(a, b) { if ("string" == typeof a) if (isNaN(a)) { if (a = b.weekdaysParse(a), "number" != typeof a) return null } else a = parseInt(a, 10); return a } function Ib(a) { return this._weekdays[a.day()] } function Jb(a) { return this._weekdaysShort[a.day()] } function Kb(a) { return this._weekdaysMin[a.day()] } function Lb(a) { var b, c, d; for (this._weekdaysParse || (this._weekdaysParse = []), b = 0; 7 > b; b++) if (this._weekdaysParse[b] || (c = Aa([2e3, 1]).day(b), d = "^" + this.weekdays(c, "") + "|^" + this.weekdaysShort(c, "") + "|^" + this.weekdaysMin(c, ""), this._weekdaysParse[b] = new RegExp(d.replace(".", ""), "i")), this._weekdaysParse[b].test(a)) return b } function Mb(a) { var b = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); return null != a ? (a = Hb(a, this.localeData()), this.add(a - b, "d")) : b } function Nb(a) { var b = (this.day() + 7 - this.localeData()._week.dow) % 7; return null == a ? b : this.add(a - b, "d") } function Ob(a) { return null == a ? this.day() || 7 : this.day(this.day() % 7 ? a : a - 7) } function Pb(a, b) { G(a, 0, 0, function () { return this.localeData().meridiem(this.hours(), this.minutes(), b) }) } function Qb(a, b) { return b._meridiemParse } function Rb(a) { return "p" === (a + "").toLowerCase().charAt(0) } function Sb(a, b, c) { return a > 11 ? c ? "pm" : "PM" : c ? "am" : "AM" } function Tb(a) { G(0, [a, 3], 0, "millisecond") } function Ub() { return this._isUTC ? "UTC" : "" } function Vb() { return this._isUTC ? "Coordinated Universal Time" : "" } function Wb(a) { return Aa(1e3 * a) } function Xb() { return Aa.apply(null, arguments).parseZone() } function Yb(a, b, c) { var d = this._calendar[a]; return "function" == typeof d ? d.call(b, c) : d } function Zb(a) { var b = this._longDateFormat[a]; return !b && this._longDateFormat[a.toUpperCase()] && (b = this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (a) { return a.slice(1) }), this._longDateFormat[a] = b), b } function $b() { return this._invalidDate } function _b(a) { return this._ordinal.replace("%d", a) } function ac(a) { return a } function bc(a, b, c, d) { var e = this._relativeTime[c]; return "function" == typeof e ? e(a, b, c, d) : e.replace(/%d/i, a) } function cc(a, b) { var c = this._relativeTime[a > 0 ? "future" : "past"]; return "function" == typeof c ? c(b) : c.replace(/%s/i, b) } function dc(a) { var b, c; for (c in a) b = a[c], "function" == typeof b ? this[c] = b : this["_" + c] = b; this._ordinalParseLenient = new RegExp(this._ordinalParse.source + "|" + /\d{1,2}/.source) } function ec(a, b, c, d) { var e = x(), f = h().set(d, b); return e[c](f, a) } function fc(a, b, c, d, e) { if ("number" == typeof a && (b = a, a = void 0), a = a || "", null != b) return ec(a, b, c, e); var f, g = []; for (f = 0; d > f; f++) g[f] = ec(a, f, c, e); return g } function gc(a, b) { return fc(a, b, "months", 12, "month") } function hc(a, b) { return fc(a, b, "monthsShort", 12, "month") } function ic(a, b) { return fc(a, b, "weekdays", 7, "day") } function jc(a, b) { return fc(a, b, "weekdaysShort", 7, "day") } function kc(a, b) { return fc(a, b, "weekdaysMin", 7, "day") } function lc() { var a = this._data; return this._milliseconds = Rd(this._milliseconds), this._days = Rd(this._days), this._months = Rd(this._months), a.milliseconds = Rd(a.milliseconds), a.seconds = Rd(a.seconds), a.minutes = Rd(a.minutes), a.hours = Rd(a.hours), a.months = Rd(a.months), a.years = Rd(a.years), this } function mc(a, b, c, d) { var e = Va(b, c); return a._milliseconds += d * e._milliseconds, a._days += d * e._days, a._months += d * e._months, a._bubble() } function nc(a, b) { return mc(this, a, b, 1) } function oc(a, b) { return mc(this, a, b, -1) } function pc() { var a, b, c, d = this._milliseconds, e = this._days, f = this._months, g = this._data, h = 0; return g.milliseconds = d % 1e3, a = fb(d / 1e3), g.seconds = a % 60, b = fb(a / 60), g.minutes = b % 60, c = fb(b / 60), g.hours = c % 24, e += fb(c / 24), h = fb(qc(e)), e -= fb(rc(h)), f += fb(e / 30), e %= 30, h += fb(f / 12), f %= 12, g.days = e, g.months = f, g.years = h, this } function qc(a) { return 400 * a / 146097 } function rc(a) { return 146097 * a / 400 } function sc(a) { var b, c, d = this._milliseconds; if (a = z(a), "month" === a || "year" === a) return b = this._days + d / 864e5, c = this._months + 12 * qc(b), "month" === a ? c : c / 12; switch (b = this._days + Math.round(rc(this._months / 12)), a) { case "week": return b / 7 + d / 6048e5; case "day": return b + d / 864e5; case "hour": return 24 * b + d / 36e5; case "minute": return 1440 * b + d / 6e4; case "second": return 86400 * b + d / 1e3; case "millisecond": return Math.floor(864e5 * b) + d; default: throw new Error("Unknown unit " + a) } } function tc() { return this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * p(this._months / 12) } function uc(a) { return function () { return this.as(a) } } function vc(a) { return a = z(a), this[a + "s"]() } function wc(a) { return function () { return this._data[a] } } function xc() { return fb(this.days() / 7) } function yc(a, b, c, d, e) { return e.relativeTime(b || 1, !!c, a, d) } function zc(a, b, c) { var d = Va(a).abs(), e = fe(d.as("s")), f = fe(d.as("m")), g = fe(d.as("h")), h = fe(d.as("d")), i = fe(d.as("M")), j = fe(d.as("y")), k = e < ge.s && ["s", e] || 1 === f && ["m"] || f < ge.m && ["mm", f] || 1 === g && ["h"] || g < ge.h && ["hh", g] || 1 === h && ["d"] || h < ge.d && ["dd", h] || 1 === i && ["M"] || i < ge.M && ["MM", i] || 1 === j && ["y"] || ["yy", j]; return k[2] = b, k[3] = +a > 0, k[4] = c, yc.apply(null, k) } function Ac(a, b) { return void 0 === ge[a] ? !1 : void 0 === b ? ge[a] : (ge[a] = b, !0) } function Bc(a) { var b = this.localeData(), c = zc(this, !a, b); return a && (c = b.pastFuture(+this, c)), b.postformat(c) } function Cc() { var a = he(this.years()), b = he(this.months()), c = he(this.days()), d = he(this.hours()), e = he(this.minutes()), f = he(this.seconds() + this.milliseconds() / 1e3), g = this.asSeconds(); return g ? (0 > g ? "-" : "") + "P" + (a ? a + "Y" : "") + (b ? b + "M" : "") + (c ? c + "D" : "") + (d || e || f ? "T" : "") + (d ? d + "H" : "") + (e ? e + "M" : "") + (f ? f + "S" : "") : "P0D" } var Dc, Ec, Fc = a.momentProperties = [], Gc = !1, Hc = {}, Ic = {}, Jc = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g, Kc = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, Lc = {}, Mc = {}, Nc = /\d/, Oc = /\d\d/, Pc = /\d{3}/, Qc = /\d{4}/, Rc = /[+-]?\d{6}/, Sc = /\d\d?/, Tc = /\d{1,3}/, Uc = /\d{1,4}/, Vc = /[+-]?\d{1,6}/, Wc = /\d+/, Xc = /[+-]?\d+/, Yc = /Z|[+-]\d\d:?\d\d/gi, Zc = /[+-]?\d+(\.\d{1,3})?/, $c = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, _c = {}, ad = {}, bd = 0, cd = 1, dd = 2, ed = 3, fd = 4, gd = 5, hd = 6; G("M", ["MM", 2], "Mo", function () { return this.month() + 1 }), G("MMM", 0, 0, function (a) { return this.localeData().monthsShort(this, a) }), G("MMMM", 0, 0, function (a) { return this.localeData().months(this, a) }), y("month", "M"), L("M", Sc), L("MM", Sc, Oc), L("MMM", $c), L("MMMM", $c), O(["M", "MM"], function (a, b) { b[cd] = p(a) - 1 }), O(["MMM", "MMMM"], function (a, b, c, d) { var e = c._locale.monthsParse(a, d, c._strict); null != e ? b[cd] = e : j(c).invalidMonth = a }); var id = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), jd = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), kd = {}; a.suppressDeprecationWarnings = !1; var ld = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, md = [["YYYYYY-MM-DD", /[+-]\d{6}-\d{2}-\d{2}/], ["YYYY-MM-DD", /\d{4}-\d{2}-\d{2}/], ["GGGG-[W]WW-E", /\d{4}-W\d{2}-\d/], ["GGGG-[W]WW", /\d{4}-W\d{2}/], ["YYYY-DDD", /\d{4}-\d{3}/]], nd = [["HH:mm:ss.SSSS", /(T| )\d\d:\d\d:\d\d\.\d+/], ["HH:mm:ss", /(T| )\d\d:\d\d:\d\d/], ["HH:mm", /(T| )\d\d:\d\d/], ["HH", /(T| )\d\d/]], od = /^\/?Date\((\-?\d+)/i; a.createFromInputFallback = $("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.", function (a) { a._d = new Date(a._i + (a._useUTC ? " UTC" : "")) }), G(0, ["YY", 2], 0, function () { return this.year() % 100 }), G(0, ["YYYY", 4], 0, "year"), G(0, ["YYYYY", 5], 0, "year"), G(0, ["YYYYYY", 6, !0], 0, "year"), y("year", "y"), L("Y", Xc), L("YY", Sc, Oc), L("YYYY", Uc, Qc), L("YYYYY", Vc, Rc), L("YYYYYY", Vc, Rc), O(["YYYY", "YYYYY", "YYYYYY"], bd), O("YY", function (b, c) { c[bd] = a.parseTwoDigitYear(b) }), a.parseTwoDigitYear = function (a) { return p(a) + (p(a) > 68 ? 1900 : 2e3) }; var pd = B("FullYear", !1); G("w", ["ww", 2], "wo", "week"), G("W", ["WW", 2], "Wo", "isoWeek"), y("week", "w"), y("isoWeek", "W"), L("w", Sc), L("ww", Sc, Oc), L("W", Sc), L("WW", Sc, Oc), P(["w", "ww", "W", "WW"], function (a, b, c, d) { b[d.substr(0, 1)] = p(a) }); var qd = { dow: 0, doy: 6 }; G("DDD", ["DDDD", 3], "DDDo", "dayOfYear"), y("dayOfYear", "DDD"), L("DDD", Tc), L("DDDD", Pc), O(["DDD", "DDDD"], function (a, b, c) { c._dayOfYear = p(a) }), a.ISO_8601 = function () { }; var rd = $("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548", function () { var a = Aa.apply(null, arguments); return this > a ? this : a }), sd = $("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548", function () { var a = Aa.apply(null, arguments); return a > this ? this : a }); Ga("Z", ":"), Ga("ZZ", ""), L("Z", Yc), L("ZZ", Yc), O(["Z", "ZZ"], function (a, b, c) { c._useUTC = !0, c._tzm = Ha(a) }); var td = /([\+\-]|\d\d)/gi; a.updateOffset = function () { }; var ud = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/, vd = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/; Va.fn = Ea.prototype; var wd = Za(1, "add"), xd = Za(-1, "subtract"); a.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ"; var yd = $("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function (a) { return void 0 === a ? this.localeData() : this.locale(a) }); G(0, ["gg", 2], 0, function () { return this.weekYear() % 100 }), G(0, ["GG", 2], 0, function () { return this.isoWeekYear() % 100 }), Ab("gggg", "weekYear"), Ab("ggggg", "weekYear"), Ab("GGGG", "isoWeekYear"), Ab("GGGGG", "isoWeekYear"), y("weekYear", "gg"), y("isoWeekYear", "GG"), L("G", Xc), L("g", Xc), L("GG", Sc, Oc), L("gg", Sc, Oc), L("GGGG", Uc, Qc), L("gggg", Uc, Qc), L("GGGGG", Vc, Rc), L("ggggg", Vc, Rc), P(["gggg", "ggggg", "GGGG", "GGGGG"], function (a, b, c, d) { b[d.substr(0, 2)] = p(a) }), P(["gg", "GG"], function (b, c, d, e) { c[e] = a.parseTwoDigitYear(b) }), G("Q", 0, 0, "quarter"), y("quarter", "Q"), L("Q", Nc), O("Q", function (a, b) { b[cd] = 3 * (p(a) - 1) }), G("D", ["DD", 2], "Do", "date"), y("date", "D"), L("D", Sc), L("DD", Sc, Oc), L("Do", function (a, b) { return a ? b._ordinalParse : b._ordinalParseLenient }), O(["D", "DD"], dd), O("Do", function (a, b) { b[dd] = p(a.match(Sc)[0], 10) }); var zd = B("Date", !0); G("d", 0, "do", "day"), G("dd", 0, 0, function (a) { return this.localeData().weekdaysMin(this, a) }), G("ddd", 0, 0, function (a) { return this.localeData().weekdaysShort(this, a) }), G("dddd", 0, 0, function (a) { return this.localeData().weekdays(this, a) }), G("e", 0, 0, "weekday"), G("E", 0, 0, "isoWeekday"), y("day", "d"), y("weekday", "e"), y("isoWeekday", "E"), L("d", Sc), L("e", Sc), L("E", Sc), L("dd", $c), L("ddd", $c), L("dddd", $c), P(["dd", "ddd", "dddd"], function (a, b, c) { var d = c._locale.weekdaysParse(a); null != d ? b.d = d : j(c).invalidWeekday = a }), P(["d", "e", "E"], function (a, b, c, d) { b[d] = p(a) }); var Ad = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), Bd = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), Cd = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"); G("H", ["HH", 2], 0, "hour"), G("h", ["hh", 2], 0, function () { return this.hours() % 12 || 12 }), Pb("a", !0), Pb("A", !1), y("hour", "h"), L("a", Qb), L("A", Qb), L("H", Sc), L("h", Sc), L("HH", Sc, Oc), L("hh", Sc, Oc), O(["H", "HH"], ed), O(["a", "A"], function (a, b, c) { c._isPm = c._locale.isPM(a), c._meridiem = a }), O(["h", "hh"], function (a, b, c) { b[ed] = p(a), j(c).bigHour = !0 }); var Dd = /[ap]\.?m?\.?/i, Ed = B("Hours", !0); G("m", ["mm", 2], 0, "minute"), y("minute", "m"), L("m", Sc), L("mm", Sc, Oc), O(["m", "mm"], fd); var Fd = B("Minutes", !1); G("s", ["ss", 2], 0, "second"), y("second", "s"), L("s", Sc), L("ss", Sc, Oc), O(["s", "ss"], gd); var Gd = B("Seconds", !1); G("S", 0, 0, function () { return ~~(this.millisecond() / 100) }), G(0, ["SS", 2], 0, function () { return ~~(this.millisecond() / 10) }), Tb("SSS"), Tb("SSSS"), y("millisecond", "ms"), L("S", Tc, Nc), L("SS", Tc, Oc), L("SSS", Tc, Pc), L("SSSS", Wc), O(["S", "SS", "SSS", "SSSS"], function (a, b) { b[hd] = p(1e3 * ("0." + a)) }); var Hd = B("Milliseconds", !1); G("z", 0, 0, "zoneAbbr"), G("zz", 0, 0, "zoneName"); var Id = n.prototype; Id.add = wd, Id.calendar = _a, Id.clone = ab, Id.diff = gb, Id.endOf = sb, Id.format = kb, Id.from = lb, Id.fromNow = mb, Id.to = nb, Id.toNow = ob, Id.get = E, Id.invalidAt = zb, Id.isAfter = bb, Id.isBefore = cb, Id.isBetween = db, Id.isSame = eb, Id.isValid = xb, Id.lang = yd, Id.locale = pb, Id.localeData = qb, Id.max = sd, Id.min = rd, Id.parsingFlags = yb, Id.set = E, Id.startOf = rb, Id.subtract = xd, Id.toArray = wb, Id.toDate = vb, Id.toISOString = jb, Id.toJSON = jb, Id.toString = ib, Id.unix = ub, Id.valueOf = tb, Id.year = pd, Id.isLeapYear = ga, Id.weekYear = Cb, Id.isoWeekYear = Db, Id.quarter = Id.quarters = Gb, Id.month = W, Id.daysInMonth = X, Id.week = Id.weeks = la, Id.isoWeek = Id.isoWeeks = ma, Id.weeksInYear = Fb, Id.isoWeeksInYear = Eb, Id.date = zd, Id.day = Id.days = Mb, Id.weekday = Nb, Id.isoWeekday = Ob, Id.dayOfYear = oa, Id.hour = Id.hours = Ed, Id.minute = Id.minutes = Fd, Id.second = Id.seconds = Gd, Id.millisecond = Id.milliseconds = Hd, Id.utcOffset = Ka, Id.utc = Ma, Id.local = Na, Id.parseZone = Oa, Id.hasAlignedHourOffset = Pa, Id.isDST = Qa, Id.isDSTShifted = Ra, Id.isLocal = Sa, Id.isUtcOffset = Ta, Id.isUtc = Ua, Id.isUTC = Ua, Id.zoneAbbr = Ub, Id.zoneName = Vb, Id.dates = $("dates accessor is deprecated. Use date instead.", zd), Id.months = $("months accessor is deprecated. Use month instead", W), Id.years = $("years accessor is deprecated. Use year instead", pd), Id.zone = $("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779", La); var Jd = Id, Kd = { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" }, Ld = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY LT", LLLL: "dddd, MMMM D, YYYY LT" }, Md = "Invalid date", Nd = "%d", Od = /\d{1,2}/, Pd = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }, Qd = r.prototype; Qd._calendar = Kd, Qd.calendar = Yb, Qd._longDateFormat = Ld, Qd.longDateFormat = Zb, Qd._invalidDate = Md, Qd.invalidDate = $b, Qd._ordinal = Nd, Qd.ordinal = _b, Qd._ordinalParse = Od, Qd.preparse = ac, Qd.postformat = ac, Qd._relativeTime = Pd, Qd.relativeTime = bc, Qd.pastFuture = cc, Qd.set = dc, Qd.months = S, Qd._months = id, Qd.monthsShort = T, Qd._monthsShort = jd, Qd.monthsParse = U, Qd.week = ia, Qd._week = qd, Qd.firstDayOfYear = ka, Qd.firstDayOfWeek = ja, Qd.weekdays = Ib, Qd._weekdays = Ad, Qd.weekdaysMin = Kb, Qd._weekdaysMin = Cd, Qd.weekdaysShort = Jb, Qd._weekdaysShort = Bd, Qd.weekdaysParse = Lb, Qd.isPM = Rb, Qd._meridiemParse = Dd, Qd.meridiem = Sb, v("en", { ordinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function (a) { var b = a % 10, c = 1 === p(a % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th"; return a + c } }), a.lang = $("moment.lang is deprecated. Use moment.locale instead.", v), a.langData = $("moment.langData is deprecated. Use moment.localeData instead.", x); var Rd = Math.abs, Sd = uc("ms"), Td = uc("s"), Ud = uc("m"), Vd = uc("h"), Wd = uc("d"), Xd = uc("w"), Yd = uc("M"), Zd = uc("y"), $d = wc("milliseconds"), _d = wc("seconds"), ae = wc("minutes"), be = wc("hours"), ce = wc("days"), de = wc("months"), ee = wc("years"), fe = Math.round, ge = { s: 45, m: 45, h: 22, d: 26, M: 11 }, he = Math.abs, ie = Ea.prototype; ie.abs = lc, ie.add = nc, ie.subtract = oc, ie.as = sc, ie.asMilliseconds = Sd, ie.asSeconds = Td, ie.asMinutes = Ud, ie.asHours = Vd, ie.asDays = Wd, ie.asWeeks = Xd, ie.asMonths = Yd, ie.asYears = Zd, ie.valueOf = tc, ie._bubble = pc, ie.get = vc, ie.milliseconds = $d, ie.seconds = _d, ie.minutes = ae, ie.hours = be, ie.days = ce, ie.weeks = xc, ie.months = de, ie.years = ee, ie.humanize = Bc, ie.toISOString = Cc, ie.toString = Cc, ie.toJSON = Cc, ie.locale = pb, ie.localeData = qb, ie.toIsoString = $("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", Cc), ie.lang = yd, G("X", 0, 0, "unix"), G("x", 0, 0, "valueOf"), L("x", Xc), L("X", Zc), O("X", function (a, b, c) { c._d = new Date(1e3 * parseFloat(a, 10)) }), O("x", function (a, b, c) { c._d = new Date(p(a)) }), a.version = "2.10.3", b(Aa), a.fn = Jd, a.min = Ca, a.max = Da, a.utc = h, a.unix = Wb, a.months = gc, a.isDate = d, a.locale = v, a.invalid = l, a.duration = Va, a.isMoment = o, a.weekdays = ic, a.parseZone = Xb, a.localeData = x, a.isDuration = Fa, a.monthsShort = hc, a.weekdaysMin = kc, a.defineLocale = w, a.weekdaysShort = jc, a.normalizeUnits = z, a.relativeTimeThreshold = Ac; var je = a; return je });; mk.eSuite = (function ($) { var self = {}; self.isPWSMode = (consultantId != undefined && consultantId.length > 0) ? true : false; self.isCustomerLogged = isCustomerLogged === "True" ? true : false; self.isCustomerRemember = isCustomerRemember === "True" ? true : false; self.rememberCustomerId = rememberCustomerId; self.customerId = customerId; self.consultantId = consultantId; self.moniker = moniker; self.consultantSubsidiaryCode = consultantSubsidiaryCode; self.TimeoutInterval = 700; self.language2 = language2; self.applyPhoneAutoFormat = applyPhoneAutoFormat; self.phoneMask = phoneMask; self.homePhoneMask = homePhoneMask; self.workPhoneMask = workPhoneMask; self.phoneMaskRegex = phoneMaskRegex; self.homePhoneRegex = homePhoneRegex; self.workPhoneRegex = workPhoneRegex; self.postalCodeMask = postalCodeMask; self.postalCodeMaskRegex = postalCodeMaskRegex; self.applyMyMKAddressVerification = applyMyMKAddressVerification.toLowerCase() === "true" ? true : false; // Checkout specific config values self.applyCheckoutAddressVerification = applyCheckoutAddressVerification === "True" ? true : false; self.availableNameRegex = availableNameRegex; self.googleTagManagerIsEnabled = googleTagManagerIsEnabled.toLowerCase() === "true" ? true : false; self.yandexAnalyticIsEnabled = yandexAnalyticIsEnabled.toLowerCase() === "true" ? true : false; self.expressCheckoutEmptyCart = expressCheckoutEmptyCart.toLowerCase() === "true" ? true : false; self.maxQntyPerProduct = parseInt(maxQntyPerProduct) || 99; self.currencyCode = currencyCode; //Re init Send Me Message, needed for minibag IBC module self.reInitSendEmailMessage = function () { self.sendEmailMessage.init(); } /* * Call all the initialization functions here */ self.init = function () { // initialize all modules self.product.init(); self.wishlist.init(); self.myMK.init(); self.shoppingBag.init(); self.siteSearch.init(); self.sendEmailMessage.init(); self.profileQuestions.init(); self.signup.init(); self.checkoutoptions.init(); self.validateaddress.init(); self.beautevite.init(); self.pageLoad.init(); self.subscription.init(); self.rememberme.init(); self.checkout.init(); self.sitedisclaimer.init(); self.searchIBC.init(); self.deleteCustomerData.init(); }; return self; })(jQuery); jQuery(document).ready(function () { mk.eSuite.init(); });; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.deleteCustomerData = (function ($) { message = {}; /* * private methods */ bindDeleteCustomerDataClick = function () { $('.delete-customer-data-link').on('click', function () { var url = '/layers/Delete-Customer-Data/Delete-Customer-Data-Request' console.log("BIND!!"); mk.eSuite.utility.bindModalAjaxHandler(url, "", false).done(function () { bindSubmitDeleteCustomerDataForm(); }); }); }; bindSubmitDeleteCustomerDataForm = function () { $(document).off('submit', 'form#delete-customer-data-form'); $(document).on('submit', 'form#delete-customer-data-form', function (e) { e.preventDefault(); var form = this; if ($(form).guard()) { //disable button to prevent multiple click $('button[type="submit"]', form).prop('disabled', true); $.ajax({ url: form.action, type: 'POST', data: $(form).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #delete-customer-data-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/Delete-Customer-Data/Delete-Customer-Data-Success'); }); $('.remote-modal #delete-customer-data-modal').modal('hide'); } else { $('.remote-modal #delete-customer-data-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandlerWithData(data); }); $('.remote-modal #delete-customer-data-modal').modal('hide'); } }, error: function () { }, complete: function () { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); } }); }; submitDeleteCustomerDataForm = function () { //$(document).off('submit', 'form#delete-customer-data-form'); $(document).on('submit', 'form#delete-customer-data-form', function (e) { e.preventDefault(); var form = this; if ($(form).guard()) { //disable button to prevent multiple click $('button[type="submit"]', form).prop('disabled', true); $.ajax({ url: form.action, type: 'POST', data: $(form).serialize(), success: function (data) { if (data.Status == 'Success') { console.log('Success'); mk.eSuite.utility.bindModalAjaxHandler('/layers/Delete-Customer-Data/Delete-Customer-Data-Success'); }; }, error: function () {}, complete: function () { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); } }); }; markAllCheckboxes = function () { $('#selectall').change(function () { var status = $(this).is(":checked") ? true : false; $(".website input:checkbox").prop("checked", status); }) }; submitDataToDelete = function () { $('.submit-consultants .submit').on('click', function () { if ($('input:checkbox:checked:not(#selectall)').length == 0) { $('.website.checkbox:not(#selectall_div)').addClass('error'); $('.website input:not(#selectall)').addClass('error'); $('.error').css('display', 'block'); } else { $('.website.checkbox').removeClass('error'); $('.website input').removeClass('error'); var url = '/layers/Delete-Customer-Data/Submit-Delete-Customer-Data-Request' mk.eSuite.utility.bindModalAjaxHandler(url, "", false); } }); $('.website input:checkbox').click(function () { if ($('input:checkbox:checked').length > 0) { $('.website.checkbox').removeClass('error'); $('.website input').removeClass('error'); } }) $(document).on('submit', 'form#submit-delete-customer-data-form', function (e) { e.preventDefault(); var form = this; //disable button to prevent multiple click $('button[type="submit"]', form).prop('disabled', true); var checkboxesChecked = []; var checkboxes = $('input:checkbox:checked:not(#selectall)'); for (var index = 0; index < checkboxes.length; index++) { if (checkboxes[index].checked) { checkboxesChecked.push(checkboxes[index].value); console.log(checkboxes[index].value); } } $.ajax({ url: '/MK-eSuite/SendConsultantsToDelete', type: 'POST', data: { email: $('#Email').val(), consultants: checkboxesChecked, t: $('#Token').val() }, success: function (data) { $('.remote-modal #submit-delete-customer-data-modal').modal('hide'); console.log(data); var url = '/layers/Delete-Customer-Data/Submit-Delete-Customer-Data-Success' mk.eSuite.utility.bindModalAjaxHandler(url, "", false); $('.remote-modal #submit-delete-customer-data-modal').on('hidden.bs.modal', function () { }); }, error: function () { }, complete: function () { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); }); }; /* * public methods */ message.init = function () { bindDeleteCustomerDataClick(); submitDeleteCustomerDataForm(); markAllCheckboxes(); submitDataToDelete(); //selectConsultant(); }; return message; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * My MK related functions live in below module */ mk.eSuite.myMK = (function ($) { myMK = {}; /* * private methods */ bindImageUpload = function () { if ($().fileupload != undefined) { $('#uniqueImageUploader').fileupload({ url: $('#uniqueImageUploader').data('uploadurl') + '?mk_moniker=' + mk.eSuite.moniker, dataType: 'json', done: function (e, data) { var result = data.response().result; if (result) { if (result.Status === 'Success') { $('.customer-image').attr('src', result.Results.imageSource); $('.percent').text(result.Results.percent); $('.progress').css('width', result.Results.percent + '%'); $('#image-error').text(''); } if (result.Status === 'Error') { $('#image-error').text(result.Message); } } } }); } } bindContactInformation = function () { $('#top-submit-contact').click(function () { $('#bottom-submit-contact').click(); }); $('span.validation-error').each(function () { if ($(this).text().trim().length > 0) { var scrollPos = $(this).offset().top; $(window).scrollTop(scrollPos - 50); } }); $('div.validation-error').each(function () { if ($(this).text().trim().length > 0) { var scrollPos = $(this).offset().top; $(window).scrollTop(scrollPos - 50); } }); $('div.upcoming-events span.validation-error').each(function () { if ($(this).text().trim().length > 0) { $(this).parent().find('input.datepicker.upcoming-events-other').css("border-color", "red"); if ($(this).parent().find('input.other-optional').length > 0 && $(this).parent().find('input.other-optional').val().length === 0) { $(this).parent().find('input.other-optional').css("border-color", "red"); } } }); } bindTipsAndTrends = function () { $('.save-tips-and-trends').on("click", function () { var pageId = $(this).attr('page-id'); var moniker = $(this).attr('moniker'); if (pageId) { myMK.addTipsAndTrendBookmark(pageId, moniker, function () { mk.eSuite.utility.bindModalAjaxHandler('/Layers/Tips-And-Trends/Tips-And-Trends-Saved-Success').done(function () { $('.save-link').toggle(); }); }); } }); }; myMK.removeTipsTrendsFromList = function (key) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/RemoveTipsAndTrends?mk_moniker=' + mk.eSuite.moniker, data: { customerId: mk.eSuite.customerId, hyperLinkKey: key, consultantId: mk.eSuite.consultantId }, timeout: 6000 }); request.success(function (data) { if (data != undefined && data.Status == "Success") { window.location.reload(); } else { alert("Couldn't remove the Bookmark"); } }); }; bindRemoveTipsTrendsClick = function () { $(".tips-trends-remove-link").on('click', function () { var key = $(this).data('hyperlink-key'); var url = $(this).attr('data-urlmodal') + '?mk_moniker=' + mk.eSuite.moniker; mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { myMK.bindremoveTipsTrendsFromList(key); }); }); }; myMK.bindremoveTipsTrendsFromList = function (key) { $('#btnOk').on('click', function () { if (mk.eSuite.isPWSMode && mk.eSuite.isCustomerLogged) { myMK.removeTipsTrendsFromList(key); } }); }; bindSendWishlistEmailClick = function () { //$("#send-wishlist-form button[type='submit']").on('click', function () { $("#wishlist-email-link").on('click', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/myMK/SavedWishlistEmail' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId).done(function () { sendWishlistEmailForm(); }); }); }; sendWishlistEmailForm = function () { $('form#send-wishlist-email-form').on('submit', function (e) { if (mk.eSuite.myMK.validateForm()) { e.preventDefault(); $.ajax({ url: this.action + '?mk_moniker=' + mk.eSuite.moniker, type: 'POST', data: $('form#send-wishlist-email-form').serialize(), success: function (data) { $('.remote-modal #email-wishlist-modal').modal('hide'); $(".modal-backdrop").remove(); if (data) { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Success'); } else { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Failure'); } }, error: function (e) { } }); } }); }; bindCreateNewAddressClick = function () { $('#mymk-add-new-address .intro').on('click', function () { var url = $('.intro').data('url'); window.location.href = url; }); } preventBtnDoubleClick = function () { $('form#CreateAddress').submit(function () { if ($(this).guard()) { $('#createAddressBtn', this).prop('disabled', true); } }); $('form#freeSamplesForm').submit(function () { if ($(this).guard()) { $('#freeSamplesSubmitBtn', this).prop('disabled', true); } }); } bindEmailUnsubcribeFormSubmit = function () { $(document).on("submit", "#unsubscribe-email-form", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($("#unsubscribe-email-form").guard()) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/EmailUnsubscribe?mk_moniker=' + moniker, data: { emailAddress: $('#txt-email-unsubscribe').val() }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { // check for response type and if it 2 then show the user doesn't exist in the system $('#email-unsubscribe-container').hide(); $('#email-unsubscribe-confirmation-container').show(); }); } }); } bindAddressNameChange = function () { $(document).ready(function () { mk.eSuite.utility.onlyAlphaAndDiacritical('.name input' +''); }); } /* * public methods */ myMK.validateForm = function () { var isValid = true; $(":input").each(function (index, element) { if ($(this).attr('mkrequired')) { var str = $(this).val(); if (!str || 0 === str.length) { $(this).css('border', 'solid 2px red'); $('#' + $(this).attr('required-error-holder-id')).text($(this).attr('required-error')); $(this).focus(function () { $(this).removeAttr("style"); $('#' + $(this).attr('required-error-holder-id')).text(''); }); isValid = false; } if ($(this).is(':checkbox') && !$(this).is(':checked')) { $(this).css('outline', 'solid 2px red'); $(this).focus(function () { $(this).removeAttr("style"); }); isValid = false; } } //if ($(this).attr('mkemail')) { if (this.type == "email") { if (!(/\S+@\S+\.\S+/.test($(this).val()))) { $(this).css('border', 'solid 2px red'); $(this).focus(function () { $(this).removeAttr("style"); }); isValid = false; } } }); return isValid; }; myMK.addTipsAndTrendBookmark = function (pageId, moniker, callback) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/AddTipsAndTrends?mk_moniker=' + moniker, data: { customerId: mk.eSuite.customerId, pageId: pageId, consultantId: mk.eSuite.consultantId }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (callback) callback(); }); }; myMK.init = function () { bindTipsAndTrends(); bindSendWishlistEmailClick(); bindImageUpload(); bindContactInformation(); bindCreateNewAddressClick(); bindEmailUnsubcribeFormSubmit(); preventBtnDoubleClick(); bindRemoveTipsTrendsClick(); bindAddressNameChange(); }; return myMK; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * reserved for any function calls that cannot be tied to a sepcific site section and has to be initialized on page load */ mk.eSuite.pageLoad = (function ($) { pageload = {}; /* * private methods */ bindFooterEmailBtnClick = function () { $("a.email-toggle").on("click", function () { $(document).on("submit", "#footer-email-subscription", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(this)) { console.log("language:" + language); var emailAddress = encodeURI($("#FooterEmailAddress").val()); var request = $.ajax({ url: "/MK-eSuite/EmailSubscription/" + language + '?mk_moniker=' + mk.eSuite.moniker, type: "POST", data: { emailaddress: emailAddress }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { $("#emailSignUpError").text(""); $('#email-signup').css({ 'display': 'none' }); mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Added-Success'); } else if (data != undefined && data.Message.indexOf("EmailSingUp_CustomerWithEmailIsExist") > -1) { $("#emailSignUpError").text(""); $('#email-signup').css({ 'display': 'none' }); mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Already-Exist'); } else { $('#emailSignUpError').show(); $("#emailSignUpError").text(data.Message); } }); } }); }); }; simpleValidation = function () { $('.client-simple-validation').on("click", function () { if (mk.eSuite.myMK.validateForm()) $(this).closest('form').submit(); }); }; bindSkinTypeOptionsClick = function () { $('div.col-wrapper.product-options.cf div.col.lg fieldset div.controlcontainer.cf input').on("click", function () { window.location = $(this).next().attr('href'); }); }; makeSecondNavTabActive = function (element) { $(element).css('webkit-box-shadow', '0 3px 5px rgba(0, 0, 0, 0.5)'); $(element).css('-moz-box-shadow', '0 3px 5px rgba(0, 0, 0, 0.5)'); $(element).css('box-shadow', '0 3px 5px rgba(0, 0, 0, 0.5)'); $(element).css('background', '#FFF'); $(element).css('border-left', '1px solid #C5C5C5'); $(element).css('border-right', '1px solid #C5C5C5'); $(element).css('z-index', '11'); } makeSecondNavTabInActive = function (element) { $(element).css('webkit-box-shadow', ''); $(element).css('-moz-box-shadow', ''); $(element).css('box-shadow', ''); $(element).css('background', ''); $(element).css('border-left', ''); $(element).css('border-right', ''); $(element).css('z-index', ''); $('.thirdNavLink').css('color', ''); } bindSecondNavTab = function () { $('.has-sub').mouseenter(function (event) { if ($(event.target).hasClass('secondNavLink')) { $('.secondNavLink').siblings('.nav-drop').css('display', ''); makeSecondNavTabInActive($('.secondNavLink')); $(event.target).siblings('.nav-drop').css('display', 'block'); makeSecondNavTabActive($(event.target)); } }).mouseleave(function (event) { setTimeout(function () { $(event.target).closest('.has-sub').children('.nav-drop').css('display', ''); makeSecondNavTabInActive($(event.target).closest('.has-sub').children('.secondNavLink')); }, 1000); }); $('body').on('focusin click', function (event) { if ($(event.target).hasClass('thirdNavLink') || $(event.target).hasClass('secondNavLink')) { makeSecondNavTabInActive($('.secondNavLink')); if ($(event.target).hasClass('secondNavLink')) { $('.secondNavLink').not('#' + event.target.id).siblings('.nav-drop').css('display', ''); $(event.target).siblings('.nav-drop').css('display', 'block'); makeSecondNavTabActive($(event.target)); } else { $(event.target).parents('.nav-drop').css('display', 'block'); makeSecondNavTabActive($(event.target).parents('.nav-drop').siblings('.secondNavLink')); $(event.target).css('color', '#000'); } } else { $('.secondNavLink').siblings('.nav-drop').css('display', ''); makeSecondNavTabInActive($('.secondNavLink')); } }); } //bind mobile pagination redirects bindMobilePaginationSelectChange = function () { $('div.pagination-mobile select').change(function () { window.location = $(this).val(); }); }; // bind Hero Banner Caoursel Slide event and check for first slide bindHeroBannerSlideChange = function () { // check for the first slide if white arrow needs to be set on page load $('div.carousel-slider.responsive div.carousel-inner').each(function () { // for responsive hero banner if ($(this).find('div.content').first().hasClass('use_white_arrow')) { $(this).parents('div.carousel-slider.responsive').find(".carousel-control .icon").addClass("arrow-white"); } // for extra large hero banner if ($(this).find('div.XLBannerItem').first().hasClass('use_white_dot')) { $(this).parents('div.carousel-slider.responsive').find("ol.carousel-indicators").removeClass("points-black"); } }); // bind the hero banner/extra large slide change event to set the arrow color $('div.carousel-slider.responsive').on('slid.bs.carousel', function (e) { // extra large hero banner check in page if ($(e.target).find(".XLBannerItem").length > 0) { if ($(e.target).find(".XLBannerItem.active").hasClass('use_white_dot')) { $(e.target).find("ol.carousel-indicators").removeClass("points-black"); } else { $(e.target).find("ol.carousel-indicators").addClass("points-black"); } } if ($(e.target).find(".active .content").length > 0) { var hasWhiteArrow = $(e.target).find(".active .content").hasClass('use_white_arrow'); if (hasWhiteArrow) $(e.target).find(".carousel-control .icon").addClass("arrow-white"); else $(e.target).find(".carousel-control .icon").removeClass("arrow-white"); } }); }; bindEmailSignupModalForClick = function () { $("a.email_signup_layer").on("click", function (e) { e.preventDefault(); e.stopImmediatePropagation(); var url = $(this).attr('href') var deferred = $.Deferred(); var request = $.ajax({ url: url }); request.success(function (data, textSts, jqXHR) { // Prevent twice open the same modal (double click or multiple click events ) if (!$('.modal-backdrop').length) { //Init Modal $('.remote-modal').html(data); $('.remote-modal').show(); $('.remote-modal .modal').modal(); } deferred.resolve(); }); }); $(document).on('submit', 'form#email-singup-form', function (e) { e.preventDefault(); if ($(this).guard()) { $("#email-signup-modal-error").text(""); $.ajax({ url: this.action + '?mk_moniker=' + moniker + '&language=' + language, type: 'POST', data: $(this).serialize(), success: function (data) { if (data != undefined && data.Status == "Success") { $("#email-signup-modal-error").text(""); $("#email-signup-modal button.close").click(); setTimeout(function () { mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Added-Success'); }, 600); } else { $('#email-signup-modal-error').show(); $("#email-signup-modal-error").text(data.Message); } }, error: function () { } }); } }); }; joinMe = function () { $('.mk-join-me').on('click', function (e) { e.preventDefault(); if (e.currentTarget && e.currentTarget.getAttribute('href')) { var redirectUrl = e.currentTarget.getAttribute('href'); if (mk.eSuite.consultantId) { redirectUrl = redirectUrl.replace('agreements-welcome', 'agreements-login'); redirectUrl += redirectUrl.includes('?') ? '&' : '?'; redirectUrl += 'country=' + mk.eSuite.consultantSubsidiaryCode + '&exkey=' + mk.eSuite.consultantId + '&recruitsource=PWS'; } if (e.currentTarget.getAttribute('target') === '_blank') { window.open(redirectUrl, '_blank'); } else { window.location.href = redirectUrl; } } }); }; const LAST_REQUEST_TIME_KEY = 'lastCookieRequestTime'; const COOLDOWN_MS = 5 * 60 * 1000; manageCookies = function () { const lastRequestTime = localStorage.getItem(LAST_REQUEST_TIME_KEY); const currentTime = Date.now(); if (lastRequestTime && (currentTime - parseInt(lastRequestTime)) < COOLDOWN_MS) { return; } setTimeout(function () { $.ajax({ url: '/mk-esuite/removedisabledcookies?mk_moniker=' + mk.eSuite.moniker, type: 'POST', success: function (data) { localStorage.setItem(LAST_REQUEST_TIME_KEY, currentTime.toString()); }, error: function () { } }); }, 2000); setTimeout(function () { $.ajax({ url: '/mk-esuite/removedisabledcookies?mk_moniker=' + mk.eSuite.moniker, type: 'POST', success: function (data) { localStorage.setItem(LAST_REQUEST_TIME_KEY, currentTime.toString()); }, error: function () { } }); }, 300); }; bindLegalImprintClick = function () { $('.legal-imprint-link').on('click', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/PWS/Legal-Imprint' + '?mk_moniker=' + mk.eSuite.moniker + '&consultant_id=' + mk.eSuite.consultantId).done(function () { bindSubmitLegalImprintForm(mk.eSuite.moniker); }); }); }; bindSubmitLegalImprintForm = function (moniker) { $(document).off('submit', 'form#legal-imprint-form'); $(document).on('submit', 'form#legal-imprint-form', function (e) { e.preventDefault(); var form = this; if ($(form).guard()) { //disable button to prevent multiple click $('button[type="submit"]', form).prop('disabled', true); var cid = getParameterByName('cid'); $.ajax({ url: form.action + '?cid=' + cid + '&mk_moniker=' + moniker, type: 'POST', data: $(form).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #legal-imprint-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/PWS/Legal-Imprint?validated=true' + '&cid=' + cid + '&mk_moniker=' + moniker); }); $('.remote-modal #legal-imprint-modal').modal('hide'); } else { $('.remote-modal #legal-imprint-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandlerWithData(data); }); $('.remote-modal #legal-imprint-modal').modal('hide'); } }, error: function () { }, complete: function () { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); } }); }; /* * public methods */ pageload.specialUrls = function () { $.ajax({ url: '/mk-esuite/specialurls?mk_moniker=' + mk.eSuite.moniker, type: 'GET', success: function (data) { if (data.Results) { data.Results.forEach(function (result) { $('.' + result.name).attr('href', result.link); }); } }, error: function () { } }); }; bindShowHelpToolTip = function () { var is_touch_device = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch; if (!is_touch_device) { $('body').on('mouseover mouseout', '.profile.question-circle', function () { $(this).parent().next('.alert').fadeToggle(300); }); } $('body').on('touchstart', '.profile.question-circle', function () { $(this).parent().next('.alert').fadeToggle(300); }); $('body').on('click', '.close-alert-js', function () { $(this).parent().fadeToggle(300); }); $('body').on('click', '.question-circle', function (e) { e.stopPropagation(); e.preventDefault(); var profile = $(this).data('profile'); if (!profile) { $(this).parent().next('.alert').fadeToggle(300); } }); }; preventDoubleOrderSubmission = function () { $('#standardSubmitOrderForm').on('submit', function (e) { var $form = $(this); if ($form.data('submitted') === true) { e.preventDefault(); } else { $form.data('submitted', true); } }); }; pageload.init = function () { bindFooterEmailBtnClick(); simpleValidation(); bindShowHelpToolTip(); bindSkinTypeOptionsClick(); bindMobilePaginationSelectChange(); pageload.specialUrls(); bindHeroBannerSlideChange(); bindSecondNavTab(); bindEmailSignupModalForClick(); joinMe(); manageCookies(); bindLegalImprintClick(); preventDoubleOrderSubmission(); }; return pageload; })(jQuery); jQuery(document).ready(function () { (function ($) { function getTextWidth($element) { var tester = $("
").text($element.text()) .css({ "position": "absolute", "float": "left", "white-space": "nowrap", "visibility": "hidden", "font": $element.css("font"), "text-transform": $element.css("text-transform"), "letter-spacing": $element.css("letter-spacing") }) .appendTo($element.parent()), width = tester.innerWidth(); tester.remove(); return width; } function AutoShrinker($element) { this.$element = $element; this.$parent = $element.parent(); this.initialFontSize = parseFloat($element.css("fontSize")); this.currentFontSize = this.initialFontSize; this.leftMarginRatio = parseFloat($element.css("marginLeft")) / this.initialFontSize; this.resize = function () { var maxWidth = this.$parent.width(), newSize = this.currentFontSize * ((maxWidth - 15) / getTextWidth(this.$element)); newSize = newSize > this.initialFontSize ? this.initialFontSize : newSize; this.$element.css({ "fontSize": newSize, "marginLeft": newSize * this.leftMarginRatio }); this.currentFontSize = newSize; }; } $.fn.autoshrink = function () { return this.each(function () { var shrinker, $this = $(this); $this.data("autoshrinker", shrinker = new AutoShrinker($this)); shrinker.resize(); $(window).on("resize", function () { shrinker.resize(); }); }); }; $(".ibc-name h1").autoshrink(); })(jQuery); });; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * About MK Press release functionality */ mk.eSuite.pressReleases = (function ($) { press = {}; /* * private methods */ bindPressReleasesSearchBar = function () { // bind filter selection event $("div.controlcontainer.date select").on("change", function () { $this = $(this); var filter_value = $this.val(); var filter_name = "year"; var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'topic', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'keyword', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, filter_value); }); $("div.controlcontainer.topic select").on("change", function () { $this = $(this); var filter_value = $this.val(); var filter_name = "topic"; var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'year', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'keyword', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, filter_value); }); $("div.controlcontainer.search.cf input").keypress(function (event) { if (event.which == 13) { event.preventDefault(); doPRKeywordSearch(); } }); $("div.controlcontainer.search.cf input[type='submit']").on("click", function () { doPRKeywordSearch(); }); $("div.results-returned a.clear-search").on("click", function () { var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'year', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'keyword', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'topic', null); window.location = newurl; }); }; doPRKeywordSearch = function () { var filter_value = $("div.controlcontainer.search.cf input").val(); var filter_name = "keyword"; var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'year', null); newurl = mk.eSuite.utility.setQueryStringParam(newurl, 'topic', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, filter_value); }; /* * public methods */ press.init = function () { bindPressReleasesSearchBar(); }; return press; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * Product Module for the site. Add all product related functions in the below module and if they need to initilized * on page load then call the function on product.init() function */ mk.eSuite.product = (function ($) { product = {}; /* * private methods */ productSpotlightMobilePage = function () { $("div.container.module.product-listing.product-spotlight div.controlcontainer.pagination-mobile > select").on("change", function () { window.location = $(this).val(); }); }; bindProductFilterBar = function () { // bind filter selection event $("div.container.module.products.filter-bar div.filter-wrapper div.filter-listing > ul > li").on("click", function () { $this = $(this); var filter_value = $this.attr("data-id"); var filter_name = $this.parents("div.filter-category").attr("data-id"); var product_filter_name = filter_name + ":" + filter_value; var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); var newurl = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, filter_value); window.location = mk.eSuite.utility.setQueryStringParam(newurl, 'product-filter', product_filter_name); }); // bind filter removal (desktop) $("div.container.module.products.filter-bar div.filter-wrapper div.filter-category.selected > span.active-filter").on("click", function () { $this = $(this); var filter_name = $this.parents("div.filter-category").attr("data-id"); var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, null); }); // bind filter removal (mobile) $("div.container.module.products.filter-bar div.filter-by-mobile > p > a.active-filter").on("click", function () { $this = $(this); var filter_name = $this.attr("data-id"); var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, filter_name, null); }); }; bindSorting = function () { $('.sorting-select').click(function () { $('.sorting-listing').toggle(); }); // bind filter selection event $("div.container.module.products.sorting div.sorting-category div.sorting-listing > ul > li").on("click", function () { $this = $(this); var sort_value = $this.attr("data-id"); var selectedText = $this.text(); // Update button text $(".sorting-select > span").text(selectedText); // Remove selected class from all options and add it to the clicked one $(".sorting-listing li").removeClass("active"); $(this).addClass("active"); // Hide the dropdown content $(".sorting-listing").hide(); var newurl = mk.eSuite.utility.setQueryStringParam(window.location, 'page', null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, 'sorting', sort_value); }); }; changeProducsCountValue = function () { $('a.view-all').on('click.showAll', function () { var productCount = 2; var orderNumber = $(this).data('order-number'); if ($(this).hasClass('open')) { productCount = $(this).attr('data-prod-count'); if (productCount != null) { $('#' + orderNumber).find('#productsView').text(productCount.toString()); } } else { if (productCount != null) { $('#' + orderNumber).find('#productsView').text(productCount.toString()); } } }); } bindFoundationDropdownClick = function () { $("div.product-add-optional div.product-dropdown div.product-list div.item a.cf").on("click", function () { var pid = $(this).attr('data-productid'); var desc = $(this).find('span').html(); setTimeout(function () { $.ajax({ url: "/" + language + "/layers/product/product-detail-foundation-colors?productid=" + pid + '&mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, type: "POST", data: {}, success: function (data) { $('#ajax-div-foundation-colors').html(data); if ($.exists('.product-detail.color')) { $('div.product-dropdown a.select').html(desc); colorSwatch(); mk.eSuite.utility.bindColorBoxesClick('div.color-options.cf ul.color-list.cf li a'); mk.eSuite.utility.bindColorBoxRemoveClick(); $('#ajax-div-foundation-colors a.external-click.color-names').on('click', function () { mk.eSuite.utility.bindModalAjaxHandler($(this).attr('data-url'), 'color-modal'); }); }; } }); }, 700); }); }; bindThumbnailsMobileClick = function() { // Add click event listeners to thumbnails-mobile $('.thumbnails-mobile').on('click', 'li:not(.video) a', function (e) { var $this = $(this); var $parent = $this.parent(); e.preventDefault(); $parent.siblings().removeClass('active'); $parent.addClass('active'); $('div.product-image_mobile > a > img').attr('src', $this.data('src')); $('div.product-image_mobile > a').data('url', $this.data('url')); }); } resizeProductImagesOnLoad = function () { $('.product:first img').one('load', function () { equalheight('.product'); }); $('.product:last img').one('load', function () { equalheight('.product'); }); }; bindTryOnProduct = function () { $('.try-it-on').on('click', function () { $('.header-minibag').css('z-index', 3000); $('.sticky-wrapper header').css('z-index', 3000); }); $('body').on('hidden.bs.modal', $("#modal-try-on").closest(".remote-modal"), function () { $('.header-minibag').css('z-index', ""); $('.sticky-wrapper header').css('z-index', 90); }); }; /* * public methods */ product.init = function () { productSpotlightMobilePage(); bindProductFilterBar(); changeProducsCountValue(); bindFoundationDropdownClick(); bindThumbnailsMobileClick(); resizeProductImagesOnLoad(); bindTryOnProduct(); bindSorting(); }; return product; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.profileQuestions = (function ($) { questions = {}; /* * private methods */ bindProfileQuestionsSubmitForm = function () { $('.profile-questions-submit').on('click', function (e) { if ($('.checkbox input:text')[0] && $('.checkbox input:text').val().trim().length === 0) { $('.checkbox input:checkbox').last().prop("checked", false); } e.preventDefault(); var _this = $('form#profile-questions-form'); $.ajax({ url: _this.data('action') + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, type: 'POST', data: $(_this).serialize(), success: function (data) { if (data.Status == 'Success') { if (data.Results.percent) { $('.percent').text(data.Results.percent); $('.progress').css('width', data.Results.percent + '%'); } if (data.Results.nextGroupId) mk.eSuite.utility.bindModalAjaxHandler('/layers/myMK/PersonalProfileNext?' + 'mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId + '&nextGroupUrl=' + _this.data('url') + '?groupId=' + data.Results.nextGroupId); else { mk.eSuite.utility.bindModalAjaxHandler('/layers/myMK/PersonalProfileSuccess'); } } }, error: function () { } }); }); }; bindProfileQuestionsImageClick = function () { $('.option.selected').each(function () { var _this = $(this), _parent = _this.parents('.controlcontainer'), _activeItem = _this.data('text'); _parent.find('p.question span.answer').html(_activeItem); }); $('.img-chooser').on('click', function (e) { var key = $(e.target).data('answer'); $('#' + key).click(); }); } resizeImagesOnLoad = function() { $('.option img').one('load', function () { equalheight(this.closest('.option')); }); }; //markAnswerCheckedWhenAddOtherText = function () { // $('.checkbox input:text').on("change paste keyup", function () { // var length = $(".checkbox input:text").val().length; // var parent = $(".checkbox input:text").parents('.cf'); // var textboxId = $(".checkbox input:text").attr('id') // var checkbox = $('#' + textboxId); // if (length > 0) { // checkbox.prop( "checked", true ); // } // else { // checkbox.prop("checked", false); // } // }); //}; markAnswerCheckedWhenAddOtherText = function () { $('.checkbox input:text').on("change paste keyup", function () { var length = $(this).val().length; var textboxId = $(this).attr('id') var checkbox = $('#' + textboxId); if (length > 0) { checkbox.prop("checked", true); } else { checkbox.prop("checked", false); } }); }; /* * public methods */ questions.init = function () { bindProfileQuestionsSubmitForm(); bindProfileQuestionsImageClick(); resizeImagesOnLoad(); markAnswerCheckedWhenAddOtherText(); }; return questions; })(jQuery); ; mk = mk || {} mk.eSuite = mk.eSuite || {}; mk.eSuite.propay = (function ($) { processor = {}; /* * private methods */ GetParameters = function () { var nameOnCard = $("#NameOnCard").val(); var postUrl = $("#mkppids-url")[0].innerHTML; var params = []; params.push({ "Key": "PaymentTypeId", "Value": translateCardType($("#CardTypes").val()) }); params.push({ "Key": "CardNumber", "Value": $("#CardNumber").val() }); params.push({ "Key": "ExpMonth", "Value": getFormattedMonth($("#CardExpiryMonth").val()) }); params.push({ "Key": "ExpYear", "Value": getFormattedYear($("#CardExpiryYear").val()) }); params.push({ "Key": "CID", "Value": $("#mkappids-cid")[0].innerHTML }); params.push({ "Key": "SettingsCipher", "Value": encodeURIComponent($("#mkappids-sc")[0].innerHTML) }); params.push({ "Key": "CVV", "Value": $("#CvvNumber").val() }); params.push({ "Key": "Country", "Value": $("#mkappids-Country")[0].innerHTML }); params.push({ "Key": "CardHolderName", "Value": $("#NameOnCard").val() }); var billingIsDelivery = jQuery("#IsBillingSameAsDelivery").is(':checked'); if (billingIsDelivery) { params.push({ "Key": "Address1", "Value": $("#mkappids-street")[0].innerHTML }); params.push({ "Key": "Address2", "Value": $("#mkappids-unit")[0].innerHTML }); params.push({ "Key": "City", "Value": $("#mkappids-city")[0].innerHTML }); params.push({ "Key": "State", "Value": $("#mkappids-State")[0].innerHTML }); params.push({ "Key": "PostalCode", "Value": $("#mkappids-Zip")[0].innerHTML }); } else { params.push({ "Key": "Address1", "Value": $("#c-address-input").val() }); params.push({ "Key": "Address2", "Value": $("#c-unit-input").val() }); params.push({ "Key": "City", "Value": $("#c-city-input").val() }); params.push({ "Key": "State", "Value": $("#BillingState").val() }); params.push({ "Key": "PostalCode", "Value": $("#c-zip-input").val() }); } $("#submitOrderFormPropayCC").hide() $("#SubmitOrderProcessing").show() //var fullUrl = "https://protectpaytest.propay.com/pmi/spr.aspx" + "?"; var fullUrl = postUrl + "?"; for (var i = 0; i < params.length; i++) { var p = params[i].Key + "=" + params[i].Value; if (i != params.length - 1) { p += "&"; } fullUrl += p; } $.ajax({ type: "POST", url: fullUrl, success: getCipher, error: function (sender, args) { displayError("There was an error communicating with the credit card processor. Please try your request later"); } }); }; getCipher = function (sender, args) { var cleanSender = sender.replace(/(img[^>]+src=(?:"|'))([^\/][^'"]+)/g, "$1//:#"); var cipher = $(cleanSender).find('#ResponseCipher')[0].value; var cvv = $("#CvvNumber").val(); var tnc = $("#AgreeToTermsOfUse").is(':checked'); var pwd = $("#RegisterPassword").val(); var pwd2 = $("#RegisterReEnterPassword").val(); var registerUser = false; var registerPwd = "NONE"; if (tnc && pwd != "" && pwd2 != "") { registerUser = true; registerPwd = pwd; } $.ajax({ type: "POST", url: "/" + mk.eSuite.moniker + '/MK-eSuite/ProPayCipher', data: { "responseCipher": cipher, "cvv": cvv, "register": registerUser, "registerPwd": registerPwd }, success: function (sender, args) { if (sender.Results) { } window.location = sender.Message; }, error: function (sender, args) { var errorResponse = JSON.parse(sender.responseText.substring(0, sender.responseText.indexOf('}')) + '}') displayError(errorResponse); } }); } displayError = function (error) { var msg = error.Message; jQuery("#MKPP-error").html(msg); jQuery("#MKPP-error-container").show(); } getFormattedMonth = function (month) { if (month.length == 1) { return "0" + month.toString(); } else { return month; } } getFormattedYear = function (year) { return year.substring(2, 4) } translateCardType = function (cardDDLB) { switch (cardDDLB) { case "American Express": return "AMEX"; case "Master Card": return "MasterCard"; case "Discover Card": return "Discover"; default: return cardDDLB; } } evalErrorState = function () { if (jQuery("#MKPP-error").html() != "" || jQuery("#MKPP-error").html() != null) { jQuery("#MKPP-error-container").show(); } } valtest = function () { debugger; if ($.isGuardsValid(this)) { alert('case1'); } if ($.isGuardsValid("#submitOrderFormPropayCC")) { alert('case2'); } } setCvvLength = function () { // we need to clear card number field and cvv field if card type was changed $("#CvvNumber").val(''); $m("#CardNumber").val(''); //Visa, MC, and Discover should only allow 3 digits; AMEX should allow 4 var cardType = $('#CardTypes').val(); if (cardType == "1") { $("#CvvNumber").attr('maxlength', 4); $("#CvvNumber").attr('class', 'cvv4digits'); } else { $("#CvvNumber").attr('maxlength', 3); $("#CvvNumber").attr('class', 'cvv3digits'); } } /* * public methods */ processor.init = function () { evalErrorState(); $("#SubmitOrderProcessing").hide() $(document).ready( function () { $(document).on("submit", "#submitOrderFormPropayCC", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid("#submitOrderFormPropayCC")) { GetParameters(); } }); $(document).on("change", '#CardTypes', function (e) { setCvvLength(); }); }); }; return processor; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.rememberme = (function ($) { var rememberme = {}; var bindRememberMePopup = function () { $('.no-consultant').on("click", function () { var queryString = $(this).data('querystring'); var url = '/layers/Consultant-Locator/Consultant-Locator-Remember-Me'; if (queryString) { url = url + queryString; } mk.eSuite.utility.bindModalAjaxHandler(url); }); } rememberme.bindRembmerMeModalLinks = function () { $(".find-new-consultant-link").on("click", function (event) { event.preventDefault(); $(".find-new-consultant-button").click(); }); $(".js-one-day-delay").on("click", function (event) { var currentDate = new Date(); var endOfToday = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + 1, 0, 0, 0, 0); var expires = endOfToday.toUTCString(); document.cookie = "__mkibcremdelay=True; expires=" + expires + "; path=/"; }); } rememberme.init = function () { bindRememberMePopup(); }; return rememberme; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.beautevite = (function ($) { beautevite = {}; beautevite.firstcall = function () { function BindNBAttending() { $m(document).ready(function () { mk.eSuite.utility.onlyNumber('#rsvpNbAttending'); }); } beautevite.ShowScPopup = function (pForm, pController, pAction, successLayer) { $(document).ready(function () { $(document).on("click",pForm, function () { $(document).on("submit", pForm, function (e) { SubmitForm(e, pForm, pController, pAction, successLayer); }); }); }); } function SubmitForm(e, pForm, pController, pAction, successLayer) { e.preventDefault(); e.stopImmediatePropagation(); $("#rsvpErrorMessage").text(""); $("#rsvpErrorMessage").hide(); if ($.isGuardsValid(pForm)) { //// incase of formhandler. //$(pForm + ":input[id='scController']").val(pController); //$(pForm + ":input[id='scAction']").val(pAction); var mForm = $(pForm).serializeArray(); mForm.push({ name: "scController", value: pController }); mForm.push({ name: "scAction", value: pAction }); mForm.push({ name: "ID", value: beautevite.getParameterByName("ID") }); mForm.push({ name: "Invitee", value: beautevite.getParameterByName("Invitee") }); var request = $.ajax({ context: this, type: "POST", data: mForm, timeout: 60000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.ResponseStatus != "Success") { if (data.MessageStatus == "AlreadyInvited") { $("#ErrorMessage").attr("class", "s-hpf-msg-info"); } if (data.MessageStatus == "Error") { $("#ErrorMessage").attr("class", "s-hpf-msg-error"); } if (data.MessageStatus == "Success") { $("#ErrorMessage").attr("class", "s-hpf-msg-success"); } $("#ErrorMessage").text(data.Message); $("#ErrorMessage").show(); } else { if (successLayer != undefined) { $(pForm).closest(".modal.fade").on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler(successLayer).done(function () { $('#bev_success').on('hidden.bs.modal', function () { window.location.href = data.Url; }) }); }); $(pForm).closest(".modal.fade").modal('hide'); } else { window.location.href = data.Url; } } }); } } beautevite.BindRsvpPopup = function () { $(document).ready(function () { $("#rsvpButton").on("click", function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/BeauteVite/Rsvp').done(function () { $("#rsvp-modal").on("hidden.bs.modal", function () { location.reload(true); }); }); }); }); } beautevite.BindInviteMoreFriendsPopup = function () { $(document).ready(function () { $("#inviteFriendsButton").on("click", function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/BeauteVite/InviteMoreFriends').done(function () { $("#rsvp-modal").on("hidden.bs.modal", function () { location.reload(true); }); }); }); }); } beautevite.getAllEventParams = function () { var queryParams = window.location.href.split('?'); var eventParams = ""; if (queryParams.length > 0) { eventParams = "?" + queryParams[1]; } return eventParams; } beautevite.getParameterByName = function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } beautevite.closeInviteMore = function () { $(document).ready(function () { $(document).on("click", "#invite-close", function () { location.reload(true); }); }); } beautevite.maxAttendance = function () { $(document).ready(function () { $(document).on('input', "#rsvpNbAttending", function () { if (this.value.length > 2) { this.value = this.value.slice(0, 2); } }); }); } beautevite.ShowScPopup("#rsvpForm", "BeauteVite", "RsvpSubmit", "/Layers/BeauteVite/Rsvp-Success"); beautevite.ShowScPopup("#inviteFriendsForm", "BeauteVite", "InviteMoreFriendsSubmit"); beautevite.BindInviteMoreFriendsPopup(); beautevite.BindRsvpPopup(); beautevite.closeInviteMore(); beautevite.maxAttendance(); BindNBAttending(); } beautevite.init = function () { beautevite.firstcall(); }; return beautevite; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.searchIBC = (function ($) { var searchIBC = {}; searchIBC.bindRegionSelectAnyValues = function (regionDropDownId, cityDropDownId, statesLoadingProgress, cityField) { $(regionDropDownId).on("change", function (event) { event.preventDefault(); var sattr = $(regionDropDownId + " option:selected").val(); if (sattr == "") { $(cityDropDownId + ' option[value!=""]').remove(); $(cityField).hide(); } else { var ddlCities = $(cityDropDownId); var statesProgress = $(statesLoadingProgress); statesProgress.show(); ddlCities.hide(); $.ajax({ type: "GET", url: "/" + language + "/MK-eSuite/GlobalLocatorSearch/GetCityByRegion", data: { "regionCode": sattr }, timeout: 6000, success: function (data) { ddlCities.html(''); $.each(data, function (id, option) { ddlCities.append($('').val(option.CityCode).html(option.DisplayName)); }); statesProgress.hide(); ddlCities.show(); $(cityField).show(); }, error: function () { ddlCities.show(); console.warn("error loading city/town"); statesProgress.hide(); } }); } }); } bindMatchedAddressSearchLogic = function () { //$(document).on("click", "#submitNosForm", function (e) { searchByNOS(e, this); }); //$(document).on("click", "#submitSasForm", function (e) { searchByNOS(e, this); }); $(document).on("click", "#useThisAddress", function (e) { searchWithUsingAddress(e, this); }); function searchWithUsingAddress(e, element) { e.preventDefault(); var form = $(element).parents("form"); form.find("#matchedAddressesarea").css('display', 'none'); form.submit(); } function searchByNOS(e, element) { e.preventDefault(); var form = $(element).parents("form"); form.submit(); } //$(document).on("submit", "#ibcSearchByNOSForm", function (e) { searchByNOS(e, this); }); //function searchByNOS(e, element) { // e.preventDefault(); // //e.stopImmediatePropagation(); // var ddlAddresses = $(element).find("#addressDropDown"); // var optionValue = $(element).find('input[type=radio]').val(); // var actionLink = $(element)[0].action; // var formData = $(element)[0].serialize(); // if (ddlAddresses.is(":visible")) { // } // if (optionValue == "Name" && $.isGuardsValid(this)) { // var suburbValue = $(element).find("#Suburb").val(); // var streetValue = $(element).find("#Street").val(); // var request = $.ajax({ // type: "GET", // url: "/" + language + "/mk-esuite/getmatchedaddresses", // data: { "suburb": suburbValue, "street": streetValue }, // timeout: 500, // success: function (data) { // if (data.length < 2) { // ddlAddresses.html(''); // $.each(data, function (id, option) { // ddlAddresses.append($('').val(option.City + option.street).html(option.DisplayName)); // }); // $(element).find("#matchedAddressesarea").css('display', 'block'); // } // else { // $m.ajax({ // url: actionLink + '?mk_moniker=' + mk.eSuite.moniker, // type: 'POST', // data: formData, // success: function () { // }, // error: function () { // } // }); // } // }, // error: function () { // } // }); // } //} } searchIBC.init = function () { bindMatchedAddressSearchLogic(); }; return searchIBC; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.sendEmailMessage = (function ($) { message = {}; /* * private methods */ bindSendMeAMessageClick = function () { $('.send-me-a-message-link').on('click', function () { var type = $(this).data('type'); var orderNumber = $(this).data('order-number'); if (type == 'base') { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Contact-Your-Consultant' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId).done(function () { bindContactYourConsultantForm(mk.eSuite.moniker, orderNumber); mk.eSuite.sendEmailMessage.bindKeyUpTextAreaRemaining(); }); } else { var url = '/layers/Send-Me-A-Message/Send-Me-A-Message' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId; var classList = $(this).attr('class').split(/\s+/); var interests = []; $.each(classList, function (index, item) { if (item.indexOf('interest') !== -1) { interests.push(item.substring(item.indexOf('-') + 1, item.length)); } }); if (interests.length > 0) { url = url + '&Interests=' + interests.join(','); } mk.eSuite.utility.bindModalAjaxHandler(url, "", false).done(function () { bindSubmitSendMeAMessageForm(mk.eSuite.moniker); mk.eSuite.sendEmailMessage.bindKeyUpTextAreaRemaining(); }); } }); }; getParameterByName = function (name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.search); if (results == null) return null; else return decodeURIComponent(results[1].replace(/\+/g, " ")); } bindSubmitSendMeAMessageForm = function (moniker) { $(document).off('submit', 'form#send-me-a-message-form'); $(document).on('submit', 'form#send-me-a-message-form', function (e) { e.preventDefault(); var form = this; if ($(form).guard()) { //disable button to prevent multiple click $('button[type="submit"]', form).prop('disabled', true); var cid = getParameterByName('cid'); if (mk.eSuite.googleTagManagerIsEnabled) { var buyMKProducts = $('#BuyMKProducts').is(':checked'); var checkLearning = $('#CheckLearning').is(':checked'); var checkLatestMakeup = $('#CheckLatestMakeup').is(':checked'); var hostingParty = $('#HostingParty').is(':checked'); var becomeIBC = $('#BecomeIBC').is(':checked'); var contactInterests = ""; if (buyMKProducts) { contactInterests = contactInterests + "Buy MK Products,"; } if (checkLearning) { contactInterests = contactInterests + "Learning,"; } if (checkLatestMakeup) { contactInterests = contactInterests + "Latest Makeup,"; } if (hostingParty) { contactInterests = contactInterests + "Hosting A Party,"; } if (becomeIBC) { contactInterests = contactInterests + "Become IBC"; } dataLayer.push({ 'event': 'contactIbc', 'contactInterests': contactInterests }); } $.ajax({ url: form.action + '?cid=' + cid + '&mk_moniker=' + moniker, type: 'POST', data: $(form).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #send-me-a-message-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Success'); }); $('.remote-modal #send-me-a-message-modal').modal('hide'); } else { $('.remote-modal #send-me-a-message-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandlerWithData(data); }); $('.remote-modal #send-me-a-message-modal').modal('hide'); } }, error: function () { }, complete: function() { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); } }); }; bindReferAFriendClick = function () { $('.refer-a-friend-link').on('click', function () { var url = '/layers/PWS/Refer-A-Friend' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId; mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { bindSubmitReferAFriendForm(mk.eSuite.moniker); }); }); }; bindSubmitReferAFriendForm = function (moniker) { $(document).off('submit', '#referAFriendForm'); $(document).on('submit', '#referAFriendForm', function (e) { e.preventDefault(); var cid = getParameterByName('cid'); if ($(this).guard()) { $.ajax({ url: this.action + '?mk_moniker=' + moniker + '&cid=' + cid, type: 'POST', data: $(this).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #refer-a-friend-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Success'); }); $('.remote-modal #refer-a-friend-modal').modal('hide'); } else { $('.remote-modal #refer-a-friend-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandlerWithData(data); }); $('.remote-modal #refer-a-friend-modal').modal('hide'); } }, error: function () { } }); } }); }; binConcernFormClick = function () { $('.report-concerns-link').on('click', function () { var url = '/layers/PWS/report-concerns' + '?mk_moniker=' + mk.eSuite.moniker; mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { bindSubmitConcernForm(mk.eSuite.moniker); }); }); }; bindSubmitConcernForm = function (moniker) { $(document).off('submit', '#reportConcernsForm'); $(document).on('submit', '#reportConcernsForm', function (e) { e.preventDefault(); var cid = getParameterByName('cid'); if ($(this).guard()) { $.ajax({ url: this.action + '?cid=' + cid + '&mk_moniker=' + moniker, type: 'POST', data: $(this).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #reportConcernsModal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Success'); }); $('.remote-modal #reportConcernsModal').modal('hide'); } else { $('.remote-modal #reportConcernsModal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandlerWithData(data); }); $('.remote-modal #reportConcernsModal').modal('hide'); } }, error: function () { } }); } }); }; bindSubmitContactUsForm = function () { $(document).on('submit', function (e) { if (e.target.id === "contactUsForm") { e.preventDefault(); var form = $('#contactUsForm'); if (form.guard()) { //disable submit button to prevent multiple click $('#contantUsBtn', form).prop('disabled', true); $.ajax({ url: '/MK-eSuite/ContactMKForm?mk_moniker=' + mk.eSuite.moniker, type: 'POST', data: form.serialize(), success: function (data, textSts, jqXHR) { if (data != undefined) { if (data.Status == "Success") { mk.eSuite.utility.bindModalAjaxHandler('/layers/ContactMK/Confirm-Submission'); } else { form.replaceWith(data); } } }, error: function () { }, complete: function () { //enable button after request $('#contantUsBtn', form).prop('disabled', false); } }); } } }); }; bindSubmitConfirmSubmission = function () { $(document).on('click', '.okconfirmsubmission', function (e) { e.preventDefault(); location.reload(); }); }; bindContactYourConsultantForm = function (moniker, orderNumber) { $(document).off('submit', 'form#contact-your-consultant-form'); $(document).on('submit', 'form#contact-your-consultant-form', function (e) { e.preventDefault(); var form = this; $('button[type="submit"]', form).prop('disabled', true); $.ajax({ url: form.action + '?mk_moniker=' + moniker, type: 'POST', data: $(form).serialize(), success: function () { $('.remote-modal #contact-your-consultant-modal').modal('hide'); mk.eSuite.utility.bindModalAjaxHandler('/layers/Send-Me-A-Message/Send-Me-A-Message-Success'); }, error: function () { }, complete: function () { //enable button after request $('button[type="submit"]', form).prop('disabled', false); } }); }); // HACK: It's looks like hack but I didn't find another way to set orderNumber to the subject field for the selected order. if (!$('#orderNumber').val()) $('#orderNumber').val(orderNumber); }; bindFreeSamplesForm = function () { // $(document).off('submit', 'form#freeSamplesForm'); $(document).ready(function () { if (!mk.eSuite.applyMyMKAddressVerification) { $(document).on('submit', 'form#freeSamplesForm', function (e) { e.preventDefault(); e.stopImmediatePropagation(); var isValid = $('form#freeSamplesForm').guard(); if (isValid) { $.ajax({ url: this.action + '?mk_moniker=' + mk.eSuite.moniker, type: 'POST', data: $(this).serialize(), success: function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/myMK/FreeSamplesEmail-Success'); }, error: function () { console.log('send freesamples message error'); } }); } return false; }); } }); }; /* * public methods */ // TODO: We need to use global.js for this purpose but it's not available for modal popup message.bindKeyUpTextAreaRemaining = function () { var text_max = $('textarea').attr('maxlength') ? $('textarea').attr('maxlength') : 500; var text = Globalize.localize('CharacterCounter_RemainingText', mk.eSuite.language2); $('.remaining').html('' + text_max + '' + ' ' + text); $('textarea').keyup(function () { if ($(this).attr('maxlength')) { text_max = $(this).attr('maxlength'); } var text_length = $('textarea').val().length; var text_remaining = text_max - text_length; $('.remaining').html('' + text_remaining + ' ' + text); }); }; message.init = function () { bindSendMeAMessageClick(); bindFreeSamplesForm(); bindReferAFriendClick(); binConcernFormClick(); bindSubmitContactUsForm(); bindSubmitConfirmSubmission(); }; return message; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * Shopping bad or add to cart functions */ mk.eSuite.shoppingBag = (function ($) { bag = {}; /* * private methods */ updateProductInBag = function (prodId, qty, prQty) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/UpdateProductInBag' + '?mk_moniker=' + self.moniker + '&customer_id=' + self.customerId, data: { productId: prodId, quantity: qty }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { if (mk.eSuite.googleTagManagerIsEnabled && data.Products.Quantity > prQty) { dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': mk.eSuite.currencyCode, 'add': { 'products': [ { "id": data.Products.EnterpriseMarketingPartID.toString(), "name": data.Products.ProductTitle.toString(), "price": parseFloat(data.Products.ProductPrice).toFixed(2), "quantity": data.Products.Quantity - prQty }] } } }); } window.location.reload(); } else { alert("Product couldn't be updated"); } }); }; removeProductFromBag = function (prodId) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/RemoveProductFromBag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { productId: prodId }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { if (mk.eSuite.yandexAnalyticIsEnabled) { window.dataLayer.push({ 'ecommerce': { "remove": { "products": [ { "id": +data.Products.ProductSKU, "name": data.Products.ProductTitle, "price": +data.Products.ProductPrice }] } } }); } setTimeout(function () { window.location.reload(); }, 1000); } else { alert("Product couldn't be removed"); } }); }; removeAllProductsFromBag = function () { var request = $.ajax({ type: "POST", url: '/MK-eSuite/RemoveAllProductsFromBag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, timeout: 6000 }); }; addAllProductsToBag = function (arrProds) { var prods = ''; $.each(arrProds, function (key, value) { prods = prods + value[0] + ';' + value[1] + ';'; }); getCountOfProductsInBag().then(function (bagCount) { if (bagCount.Products != null) { JSON.parse(bagCount.Products).forEach(function(p) { arrProds.forEach(function(prod) { if (p.ProducId == prod[0]) { var leftQuantity = mk.eSuite.maxQntyPerProduct - p.Quantity > 0 ? mk.eSuite.maxQntyPerProduct - p.Quantity : 0; if (prod[1] > leftQuantity) prod[1] = leftQuantity; } }); }); } var request = $.ajax({ type: "POST", url: '/MK-eSuite/AddAllProductsToBag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { products: arrProds }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { if (mk.eSuite.yandexAnalyticIsEnabled) { var products = []; for (var i = 0; i < data.Products.length; i++) { products.push({ "id": +data.Products[i].ProductSKU, "name": data.Products[i].ProductTitle, "price": +data.Products[i].ProductPrice }); } window.dataLayer.push({ 'ecommerce': { "add": { "products": products } } }); } if (mk.eSuite.googleTagManagerIsEnabled) { var gtmProducts = []; for (var k = 0; k < data.Products.length; k++) { gtmProducts.push({ "id": data.Products[k].EnterpriseMarketingPartID.toString(), "name": data.Products[k].ProductTitle.toString(), "price": parseFloat(data.Products[k].ProductPrice).toFixed(2), "quantity": +data.Products[k].Quantity }); } dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': mk.eSuite.currencyCode, 'add': { 'products': gtmProducts } } }); } //alert("Products added to bag"); if (typeof (isCartPage) !== 'undefined' && isCartPage == true) setTimeout(function () { window.location.reload(); }, 1000); else refreshHeaderMiniBag(true); } else { alert("Product couldn't be added"); } }); request.error(function (jqXHR, textStatus, error) { console.log("addAllProductsToBag method:" + error); }); }); }; updateAllProductsInBag = function (arrProds) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/UpdateAllProductsInBag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { products: arrProds }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { //alert("Products added to bag"); if (typeof (isCartPage) !== 'undefined' && isCartPage == true) window.location.reload(); else refreshHeaderMiniBag(); } else { alert("Product couldn't be updated"); } }); }; function getCountOfProductsInBag() { return $.ajax({ url: '/mk-esuite/getcountofproductsinbag?mk_moniker=' + mk.eSuite.moniker, type: 'POST', success: function (result) { if (result.Status === "Success") { console.log(result.Results); return result.Results; } else { console.log('GetCountOfProductsInBag unsuccessful.'); } }, error: function () { console.log('GetCountOfProductsInBag error.'); } }); }; function getProductsInBag(callback, prodId, qty, refresh, openMiniBag) { var request = $.ajax({ type: "POST", url: '/mk-esuite/getcountofproductsinbag?mk_moniker=' + mk.eSuite.moniker, timeout: 6000 }); request.success(function(result) { if (result.Results !== 0) { var products = JSON.parse(result.Products); if (products !== null && products !== undefined) { for (var i = 0; i < products.length; i++) { if (prodId === products[i].ProducId) { if ((Number(qty) + products[i].Quantity) > 99) { console.log("Product couldn't be added, because quantity is more than 99"); return; } } } } } callback(prodId, qty, refresh, openMiniBag); }); }; addProductToBag = function (prodId, qty, refresh, openMiniBag) { var callback = function (prodId, qty, refresh, openMiniBag) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/AddProductToBag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { productId: prodId, quantity: qty }, timeout: 6000 }); request.success(function(data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { if (mk.eSuite.yandexAnalyticIsEnabled) { window.dataLayer.push({ 'ecommerce': { "add": { "products": [ { "id": +data.Products.ProductSKU, "name": data.Products.ProductTitle, "price": +data.Products.ProductPrice }] } } }); } if (mk.eSuite.googleTagManagerIsEnabled) { dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': mk.eSuite.currencyCode, 'add': { 'products': [ { "id": data.Products.EnterpriseMarketingPartID.toString(), "name": data.Products.ProductTitle.toString(), "price": parseFloat(data.Products.ProductPrice).toFixed(2), "quantity": data.Products.Quantity }] } } }); } if (refresh != null && refresh == true) { if (openMiniBag == null || openMiniBag == true) { localStorage.OpenMiniBag = "true"; } setTimeout(function () { window.location.reload(); }, 1000); } else { if (!isMobile()) { window.scrollTo(0, 0); } refreshHeaderMiniBag(true); } $('#quickview-modal').modal('hide'); } else { console.log("Product couldn't be added"); } }); /* Check if this is a mobile device */ function isMobile() { var width = $(window).width(); var result = false; if (width < 769) { result = true; } return result; } }; getProductsInBag(callback, prodId, qty, refresh, openMiniBag); }; var loading = false; refreshHeaderMiniBag = function (showAddedMessage) { var nocache = new Date().getTime(); // This forces every AJAX call to return updated values instead of the internally cached value. var link = '/' + language + '/layers/shopping-bag/headerminibag' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId + '&nocache=' + nocache; if (showAddedMessage !== undefined) { link += '&showAddedMessage=' + showAddedMessage; } var request = $.ajax({ type: "GET", url: link, timeout: 6000 }); request.success(function (data) { // It's needed for Mirror me feature to have minibag accessible var zIndex = $('div.header-minibag').css('z-index'); $('div.header-minibag').replaceWith(data); if (zIndex > 0) { $('div.header-minibag').css('z-index', zIndex); } $('div.header-minibag').addClass("open"); //Mobile. Unsubscribe for click event(as element still exists) and remove class $('.mobile-bag-search a.toggle-bag.js-non-loaded-minibag').off("click"); $('.mobile-bag-search a.toggle-bag').removeClass("js-non-loaded-minibag"); // update product Count for mobile var productCount = $('.header-minibag span.count').text(); $('.mobile-bag-search span.cart-count').text(productCount); $('div.mobile-bag-search').addClass("open"); mk.eSuite.reInitSendEmailMessage(); bindShareBagClick(); miniBagToggle(); loading = false; }); }; bindShoppingBagEmailClick = function () { $('.shopping-bag-email-ibc').on('click', function () { var url = '/Layers/myMK/ShoppingBagEmail' + '?mk_moniker=' + mk.eSuite.moniker; mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { bindShoppingBagEmailFormWithIBC(mk.eSuite.moniker); }); }); $('.shopping-bag-email-noibc').on('click', function () { var url = '/Layers/myMK/ShoppingBagEmail' + '?mk_moniker=' + mk.eSuite.moniker; mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { bindShoppingBagEmailFormWithNoIBC(); }); }); }; bindLoadMiniBagClick = function () { // HEADER MINI BAG LOADING $('.js-non-loaded-minibag').on('click', function () { mk.eSuite.shoppingBag.loadHeaderMiniBag(); }); }; bindExpressCheckoutClick = function () { $(document).on('click', '.expresscheckout-btn', function (e) { e.preventDefault(); if (mk.eSuite.googleTagManagerIsEnabled) { dataLayer.push({ 'event': 'expressConnectClick' }); } if (mk.eSuite.expressCheckoutEmptyCart) { removeAllProductsFromBag(); } window.location.href = $(this).attr('href'); }); }; bindFindIBCClick = function () { $(document).on('click', '.findibc-btn', function (e) { e.preventDefault(); window.location.href = $(this).attr('href'); }); }; var sendingEmail = false; bindShoppingBagEmailFormWithIBC = function (moniker) { $(document).on('submit', 'form#send-shoppingbag-email-form', function (e) { e.preventDefault(); var isValid = $.isGuardsValid('form#send-shoppingbag-email-form'); if (isValid && !sendingEmail && $.isGuardsValid(this)) { sendingEmail = true; $.ajax({ url: this.action + '?mk_moniker=' + moniker, type: 'POST', data: $(this).serialize(), success: function () { $('.remote-modal #email-shoppingbag-modal').modal('hide'); mk.eSuite.utility.bindModalAjaxHandler('/layers/Shopping-Bag/ShoppingBagEmail-Success'); sendingEmail = false; }, error: function () { console.log('send shoppingbag message error'); sendingEmail = false; } }); } return false; }); }; bindShoppingBagEmailFormWithNoIBC = function () { $(document).on('submit', 'form#send-shoppingbag-email-form', function (e) { e.preventDefault(); var isValid = $.isGuardsValid('form#send-shoppingbag-email-form'); if (isValid && !sendingEmail && $.isGuardsValid(this)) { sendingEmail = true; $.ajax({ url: this.action, type: 'POST', data: $(this).serialize(), success: function (data) { if (data.Status == 'Success') { $('.remote-modal #email-shoppingbag-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('/layers/Shopping-Bag/ShoppingBagEmail-Success'); }); $('.remote-modal #email-shoppingbag-modal').modal('hide'); } sendingEmail = false; }, error: function () { console.log('send shoppingbag message error'); sendingEmail = false; } }); } return false; }); }; bindShoppingCartPageEvents = function () { $('div.product-qty a.remove').on("click", function () { var prodId = $(this).closest('fieldset').attr('data-productid'); removeProductFromBag(prodId); }); $('div.product-qty a.wishlist').on("click", function () { var prodId = $(this).closest('fieldset').attr('data-productid'); if (mk.eSuite.isPWSMode && mk.eSuite.isCustomerLogged) { mk.eSuite.wishlist.addProductToWishlist(prodId, mk.eSuite.wishlist.updateWishlistStatesFromSB, $(this).closest('fieldset')); } }); $('div.product-qty a.update').on("click", function () { var prodId = $(this).closest('fieldset').attr('data-productid'); var qty = $(this).closest('div').find("input[type=text]").val(); var prQty = $(this).closest('div').find(".pr-qty").text(); updateProductInBag(prodId, qty, prQty, mk.eSuite.wishlist.wishlistAddSimpleMessage); }); $('div.bag-wrapper.cf .ibc-area a.js-update-bag').on("click", function () { var arrProds = new Array(); var i = 0; $('div.product-qty fieldset').each(function () { var prodId = $(this).attr('data-productid'); var qty; var input = $(this).find("input[type=text]"); if (input.length > 0) qty = input.val(); else qty = $(this).find("span").text(); arrProds[i++] = [prodId, qty]; }); updateAllProductsInBag(arrProds); }); //$("#send-shoppingbag-email-button").on('click', function () { // //mk.eSuite.utility.bindModalAjaxHandler('/layers/myMK/SavedWishlistEmail').done(function () { // bindShoppingBagEmailForm(); // //}); //}); }; bindGlobalAddToBagEvents = function () { $(document).click(function (event) { if ($(event.target).closest('div.header-minibag').length) return; if ($(event.target).closest('a.cart-items').length) return; if ($(event.target).children('span.cart-count').length) return; if ($('div.header-minibag').has("open")) { $('div.header-minibag').removeClass("open"); $('div.mobile-bag-search').removeClass("open"); } }); $('div.add-all.cf a.button').on("click", function () { var arrProds = new Array(); var i = 0; $(this).parents('.container.module.product-listing').find('.product.cf').each(function () { arrProds[i++] = [$(this).attr('data-productid'), 1]; }); addAllProductsToBag(arrProds); }); $('div#addToBagBtn').on("click tapstart", function (e) { var myform = $('form#addToBagForm'); if (!$.isGuardsValid(myform)) return; e.preventDefault(); var qty = 1; var productId = $($(myform).find('fieldset.product-quantity-add')).attr('data-productid'); if ($('div.product-options').length > 0) { qty = $('div.product-options input[type=text]').val(); } else { qty = $(myform).find("div.quantity.cf").find("input[type=text]").val(); } var i = 0; var arrProds = new Array(); if (qty >= 0) { arrProds[i++] = [productId, qty]; } //add color/shade product if ($('#ajax-div-foundation-colors li.active').length > 0) { var colProductId = $('#ajax-div-foundation-colors li.active >a').attr("data-productid"); var colProductQty = $('#ajax-div-foundation-colors input[type=text]').val(); if (colProductQty >= 0) { arrProds[i++] = [colProductId, colProductQty]; //console.log('colors: ' + colProductId + ': ' + colProductQty); } } if (arrProds.length > 0) addAllProductsToBag(arrProds); }); $(document).on("click", "div.price-bag>a.cf", function () { var qty = 1; var productId = $(this).parents('.price-bag').attr('data-productid'); var refresh = $(this).children('span.add-to-bag').data("refreshpage"); addProductToBag(productId, qty, refresh); }); } updatePrice = function (el, price) { var priceFormat = '{1}{2}{3}'; var curSymbol = $('#PDP-CurrencySymbol').val(); var intPrice = price.substring(0, price.indexOf(".")); var supPrice = price.substring(price.indexOf(".") + 1); priceFormat = priceFormat.replace('{1}', curSymbol).replace('{2}', intPrice).replace('{3}', supPrice); $(el).html(priceFormat); } /* * public methods */ bag.AddProductToBag = function (prodId, qty, refresh, openMiniBag) { addProductToBag(prodId, qty, refresh, openMiniBag); } bag.bindColorBoxClickToCart = function (box) { var $colorBoxCartDiv = $('div.col-wrapper.color .col.sm'); $colorBoxCartDiv.css({ 'display': 'block' }); $colorBoxCartDiv.find('h5').html($(box).attr('data-displayname')); $colorBoxCartDiv.find('fieldset.quantity input').val('1'); updatePrice($colorBoxCartDiv.find('.price'), $(box).attr('data-price')); $('#foundationPrice').val($(box).attr('data-price')); // estimated total var productPrice = 0; if ($(box).attr('data-price')) { productPrice = $(box).attr('data-price'); } var mainProductPrice = 0; if ($('#PDP-ProductPrice').val()) { mainProductPrice = $('#PDP-ProductPrice').val(); } var mainProductQty = $('#setQuantity').val(); if (!mainProductQty || isNaN(mainProductQty) || +mainProductQty < 0 || mainProductQty.indexOf('.') >= 0) { mainProductQty = 0; } var estTotal = ((+productPrice) + (+mainProductPrice * +mainProductQty)).toFixed(2); updatePrice($('.product-quantity-add >p.price'), estTotal.toString()); }; bag.ColorBoxRemove = function () { var mainProductPrice = 0; if ($('#PDP-ProductPrice').val()) { mainProductPrice = $('#PDP-ProductPrice').val(); } var mainProductQty = $('#setQuantity').val(); if (!mainProductQty || isNaN(mainProductQty) || +mainProductQty < 0 || mainProductQty.indexOf('.') >= 0) { mainProductQty = 0; } updatePrice($('.product-quantity-add >p.price'), (+mainProductPrice * +mainProductQty).toFixed(2)); } bag.bindModalAddToBagEvents = function () { $(document).off('submit', '#qvProductAddToBadForm'); $(document).on('submit', '#qvProductAddToBadForm', function (e) { e.preventDefault(); if ($("#qvProductAddToBadForm").guard()) { var qty = $(this).closest("div.quantity.cf").find("input[type=text]").val(); // var productId = $(this).find('.product-quantity-add').attr('data-productid'); var productId = $('ul.color-list.cf li.active >a').attr("data-productid"); if (productId == null) { productId = $(this).find('.product-quantity-add').attr('data-productid'); } var refresh = $(this).data('refreshpage'); addProductToBag(productId, qty, refresh); } }); } bag.productQtyChanged = function () { var foundationPrice = 0; if ($("#foundationPrice").val()) { foundationPrice = $("#foundationPrice").val(); } var foundationQty = $('#foundationQuantity').val(); if (!foundationQty || isNaN(foundationQty) || +foundationQty < 0 || foundationQty.indexOf('.') >= 0) { foundationQty = 0; } var mainProductPrice = 0; if ($('#PDP-ProductPrice').val()) { mainProductPrice = $('#PDP-ProductPrice').val(); } var mainProductQty = $('#setQuantity').val(); if (!mainProductQty || isNaN(mainProductQty) || +mainProductQty < 0 || mainProductQty.indexOf('.') >= 0) { mainProductQty = 0; } var estTotal = ((+foundationPrice * +foundationQty) + (+mainProductPrice * +mainProductQty)).toFixed(2); updatePrice($('.product-quantity-add >p.price'), estTotal.toString()); }; fallbackCopyTextToClipboard = function (text) { var textArea = document.createElement("textarea"); textArea.value = text; // Avoid scrolling to bottom textArea.style.top = "0"; textArea.style.left = "0"; textArea.style.position = "fixed"; $('#share-bag').append(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); } catch (err) { console.error('Fallback: Oops, unable to copy', err); } $('#share-bag textarea').remove(); }; copyTextToClipboard = function (text) { if (!navigator.clipboard) { fallbackCopyTextToClipboard(text); return; } navigator.clipboard.writeText(text).then(function () { }, function (err) { console.error('Async: Could not copy text: ', err); }); }; bindShareBagClick = function () { $('.js-share-bag').on('click', function (e) { e.preventDefault(); $('.header-minibag').removeClass('open'); if (navigator.share) { navigator.share({ title: $(this).data('title'), text: $(this).data('text'), url: $(this).attr('href') }); } else { mk.eSuite.utility.bindModalAjaxHandler('/layers/Shopping-Bag/ShareBagModal').done(function () { $('.btn-copy-share-link').on('click', function (e) { e.preventDefault(); var link = $('#ShareLink').val(); copyTextToClipboard(link); }); }); } }); }; bag.init = function () { bindShoppingCartPageEvents(); bindGlobalAddToBagEvents(); bindShoppingBagEmailClick(); bindLoadMiniBagClick(); bindExpressCheckoutClick(); bindFindIBCClick(); bindShareBagClick(); if (localStorage.OpenMiniBag == 'true') { localStorage.OpenMiniBag = 'false'; window.scrollTo(0, 0); refreshHeaderMiniBag(); } }; bag.loadHeaderMiniBag = function () { if (!loading) { loading = true; $('div.header-minibag').html(""); refreshHeaderMiniBag(); } }; return bag; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.checkoutoptions = (function ($) { checkoutoptions = {}; ////Forgot Password Link Click Event. checkoutOptions_ForgotPasswordClick = function () { $('#forgotPassword').on("click", function () { ///reset field values and hide error message. $('#pwdemail').val(""); $("#pwdresetError").text(""); $("#pwdresetError").hide(); /// hide signin form and password reset container $('#checkoutSignInForm').hide(); $('#PasswordResetMessageContainer').hide(); $('#signinForgotPasswordContainer').show(); $('#CheckoutPwdReset').show(); }); } ////Back To SignIn Link Click Event. checkoutOptions_BackToSignInClick = function () { $("a[id^='backToSignIn']").on("click", function () { //// reset error message text and input values - task 61765 $("#emailSigninError").text(""); if (!$("#CheckoutRememberMe").is(":checked")) { $("#CheckoutEmailAddress").val(""); } $("#CheckoutEmailPassword").val(""); $('#checkoutSignInForm').show(); $('#CheckoutPwdReset').hide(); }); } ////SignIn Submit Button Click Event. checkoutOptions_SignInSubmit = function () { $(document).ready(function () { $(document).on("submit", "#checkoutSignInForm", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(this)) { var mForm = $("#checkoutSignInForm").serializeArray(); mForm.push({ name: "scController", value: "CheckoutOptions" }); mForm.push({ name: "scAction", value: "CheckoutSignIn" }); var request = $.ajax({ context: this, type: "POST", data: mForm }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { window.location.assign(data.RedirectUrl); } else { $("#emailSigninError").text(data.Message); $("#emailSigninError").show(); } }); } }); }); } ////Reset Password Submit Button Click Event. checkoutOptions_ResetPasswordSubmit = function () { $(document).ready(function () { $(document).on("submit", "#CheckoutPwdReset", function (e) { e.preventDefault(); e.stopImmediatePropagation(); $("#pwdresetError").text(''); if ($.isGuardsValid(this)) { var mForm = $("#CheckoutPwdReset").serializeArray(); mForm.push({ name: "scController", value: "CheckoutOptions" }); mForm.push({ name: "scAction", value: "ChecoutResetPassword" }); var request = $.ajax({ context: this, type: "POST", data: mForm }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { //$('#pwdresetemail-field').hide(); //$("#pwdresetError").hide(); $('#signinForgotPasswordContainer').hide(); $('#PasswordResetMessageContainer').show(); } else { $("#pwdresetError").text(data.Message); $("#pwdresetError").show(); } }); } }); }); } ////Checkout Locate Consultant by Zipcode Submit Button Event. checkoutOptions_CheckRememberMeConsultantForGuestCheckoutServiceAndShowPopup = function () { var request = $.ajax({ context: this, type: "POST", async: false, data: { scController: "CheckoutOptions", scAction: "IsGuestCheckoutAvailableForRememberMeConsultant" }, success: (function (data, textSts, jqXHR) { if (data != undefined && data.Status == "success") { //mk.eSuite.utility.bindModalAjaxHandler("layers/Consultant-Locator/Consultant-Locator-Remember-Me"); mk.eSuite.utility.displayIbcRecommendation("?returnUrl=" + data.nextStep); return true; } else { console.log(data.Message); return false; } }) }); //request.success(function (data, textSts, jqXHR) { // if (data != undefined && data.Status == "success") { // //mk.eSuite.utility.bindModalAjaxHandler("layers/Consultant-Locator/Consultant-Locator-Remember-Me"); // mk.eSuite.utility.displayIbcRecommendation("?returnUrl=" + data.nextStep); // return true; // } else { // console.log(data.Message); // return false; // } //}); } GuestCheckoutLocatorStreetSuburbStateSubmit = function () { $(function () { $(document).on("click", "#guestCheckoutLocatorStreetSubrubStateSubmit", function (e) { e.preventDefault(); e.stopImmediatePropagation(); var form = $("#guestCheckoutLocatorStreetSubrubStateForm"); // #1 form validation if (form.guard()) { // #2 show rememeberMe if it's avaiable for guest checkout if (form.data("showrememberme") === "True" && location.search.toLowerCase().indexOf("hiderecommendedpwsdisplay=true") === -1) { mk.eSuite.utility.displayIbcRecommendation("?returnUrl=" + form.data("nextstep")); // don't display second time remeber me popup if close button on the popup was clicked window.history.pushState("", "", "?hiderecommendedpwsdisplay=true"); } else { GuestCheckoutLocatorStreetSuburbStatePost(); } } }); }); } GuestCheckoutAddressSelected = function() { $(function() { $(document).on("click", "#matchedAddressSubmit", function (e) { e.preventDefault(); e.stopImmediatePropagation(); GuestCheckoutLocatorStreetSuburbStatePost(); }); }); } GuestCheckoutLocatorStreetSuburbStatePost = function () { $("#LocatorCheckoutErrorMessage").hide(); var suburbValue = $('#Suburb').val(); var streetValue = $('#Street').val(); var request = $.ajax({ contenType: "application/json; charset=utf-8", url: "/mk-esuite/postguestcheckoutlocatorform", dataType: "json", type: "POST", data: {City: suburbValue, Street: streetValue} }); request.success(function (data) { if (data != undefined && data.Status === "Success") { window.location.href = data.RedirectUrl; } else { if (data) { $("#LocatorCheckoutErrorMessage").text(data.Message); $("#LocatorCheckoutErrorMessage").show(); } } }); } checkoutOptions_LocatorSubmit = function () { $(document).ready(function () { ///var FirstCall = true; $(document).on("submit", "#guestCheckoutWithLocatorForm", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(this)) { ///////////////// Task 53093 - Step 13 - Start ////////////////// //// move this whole section below field validation if required. //// moving back donw after validation var hideRecommendedPwsDisplay = "?returnUrl=/&HideRecommendedPwsDisplay=False"; var modalCalled = false; var showRecommendedIbc = $("#LocatorSubmit").attr("data-showRecommendedIbc"); if (showRecommendedIbc.toLowerCase() == "true" && ($(this).data("FirstCall") == null || ($(this).data("FirstCall") == false))) { //// Making non-aysnc call to check if the consultant from rememberme cookie has guest checkout service available. var request = $.ajax({ context: this, type: "POST", async: false, /// need to make non-async call so that we can stop further execution on modal display. data: { scController: "CheckoutOptions", scAction: "IsGuestCheckoutAvailableForRememberMeConsultant" }, success: function (data, textSts, jqXHR) { if (data != undefined && data.Status == "success") { window.history.pushState('', '', hideRecommendedPwsDisplay); // window.location.href + window.location.href.indexOf("?") > -1 ? hideRecommendedPwsDisplay : hideRecommendedPwsDisplay.replace("&", "?") + "#"; mk.eSuite.utility.displayIbcRecommendation("?returnUrl=" + data.NextStep); modalCalled = true; } else { console.log(data.Message); modalCalled = false; } } }); $(this).data("FirstCall", true); } if (modalCalled) return; $("#LocatorCheckoutErrorMessage").hide(); ///////////////// Task 53093 - Step 13 - End ////////////////// var ZipCode = $("#GuestLocatorZipCode").val(); //// making ajax call to consultant locator based on zip code. var request = $.ajax({ context: this, type: "POST", data: ////mForm, { scController: "CheckoutOptions", scAction: "GuestCheckOutWithLocator", zipCode: ZipCode, } }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { window.location.href = data.RedirectUrl; } else { $("#LocatorCheckoutErrorMessage").text(data.Message); $("#LocatorCheckoutErrorMessage").show(); } }); } }); }); } ////Express Checkout Submit Event. checkoutOptions_ExpressSubmit = function () { $(document).ready(function () { $("#ExpressSubmit").on("click", function (e) { e.preventDefault(); e.stopImmediatePropagation(); ////if ($.isGuardsValid(this)) { var mUrl = '/' + language + '/CheckoutOptions/ExpressCheckout' + '?mk_moniker=' + mk.eSuite.moniker; var request = $.ajax({ context: this, type: "POST", data: { scController: "CheckoutOptions", scAction: "GuestCheckOutExpress" }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { console.log(data.Status + ":" + data.Message + ":" + data.RedirectUrl); if (data != undefined && data.Status == "Success") { return window.location.href = data.RedirectUrl; } else { $("#ExpressCheckoutErrorMessage").text(data.Message); $("#ExpressCheckoutErrorMessage").show(); } }); ////} }); }); } ////Mobile Panel expand/collapse script from UX panel_Clicks = function () { $(document).ready(function () { $(".coo-box-js .panel .p-heading #GuestLocatorZipCode").click(function (e) { e.stopPropagation(); }); $('.coo-box-js .panel .p-heading').on('click', function () { /* If mobile open or close the login boxes on touch */ if (isMobile()) { var closeDiv = { 'max-height': '55px' }; var openDiv = { 'max-height': '600px' }; if ($(this).closest(".coo-box-js").height() != 55) { $(this).closest('.coo-box-js').find('.p-heading-right').fadeOut(300); $(this).closest(".coo-box-js").css(closeDiv); $(this).closest('.coo-box-js').find('.p-heading-arrow-mobile ').removeClass('open'); $('.info-link').popover('hide'); console.log('no 55'); } else { $(this).closest(".coo-box-js").css(openDiv); $(this).closest('.coo-box-js').find('.p-heading-right').fadeIn(300); $(this).closest('.coo-box-js').find('.p-heading-arrow-mobile').addClass('open'); } } }); /* Check if this is a mobile device */ function isMobile() { var width = $(window).width(); var result = false; if (width < 769) { result = true; } return result; } var prev_width = $(window).width(); $(window).resize(function () { // to make sure it is a real resize, mobile device tends to report lots of fake resize if (prev_width == $(window).width()) return; prev_width = $(window).width(); if (!isMobile()) { resetCooBox(600); $('.coo-box-js').find('.p-heading-right').show(); $('.coo-box-js').find('.p-heading-arrow-mobile').addClass('open'); } else { resetCooBox(55); $('.coo-box-js').find('.p-heading-right').hide(); $('.coo-box-js').find('.p-heading-arrow-mobile ').removeClass('open'); } }); /* Reset the login boxes height */ function resetCooBox(height) { var maxHeight = { 'max-height': height + 'px' }; $(".coo-box-js").css(maxHeight); } }); } ////Mobile Info icon popover script from UX anchor_Popover = function () { /* Popover function for Guest checkout info */ var popOverInView = false; /* Check if this is a mobile/touch device */ var is_touch_device = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch; /* Initialize the bootstrap popover */ $(".info-link").popover(); if (is_touch_device) { var user_Action = "tap"; $('a.info-link').on(user_Action, function () { if (!popOverInView) { /* Show popover if it is not in view */ $('.info-link').popover('show'); /* Dismiss the popover on close button */ $('.popover-close-js').on(user_Action, function () { $('.info-link').popover('hide'); }); } }); } else { $('a.info-link').hover(function () { if (!popOverInView) { /* Show popover if it is not in view */ $('.info-link').popover('show'); /* Dismiss the popover on close button */ $('.popover-close-js').on('click', function () { $('.info-link').popover('hide'); }); /* Dismiss the popover on click if the popover is in view */ $('body').on('click', function () { $('.info-link').popover('hide'); }); } }); } /* Set the popOverInView flag to false when popover is dismissed */ $('.info-link').on('hidden.bs.popover', function () { popOverInView = false; }); /* Set the popOverInView flag to true when popover is in view */ $('.info-link').on('shown.bs.popover', function () { popOverInView = true; }); } bindAddressNameChange = function () { $(document).ready(function () { mk.eSuite.utility.onlyAlphaAndDiacritical('.first-name input, .last-name input'); }); } ////Initializtion functions checkoutoptions.init = function () { checkoutOptions_ForgotPasswordClick(); checkoutOptions_BackToSignInClick(); checkoutOptions_SignInSubmit(); checkoutOptions_ResetPasswordSubmit(); checkoutOptions_LocatorSubmit(); checkoutOptions_ExpressSubmit(); panel_Clicks(); anchor_Popover(); GuestCheckoutLocatorStreetSuburbStateSubmit(); GuestCheckoutAddressSelected(); bindAddressNameChange(); }; return checkoutoptions; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.signup = (function ($) { signup = {}; signUpEmailBtnClick = function () { $("#signupformcontainera").on("click", function () { $(document).on("submit", "#signup-email-subscriptiona", function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(this)) { console.log("language:" + language); var request = $.ajax({ url: "/MK-eSuite/EmailSubscription/" + language + '?mk_moniker=' + mk.eSuite.moniker, type: "POST", data: { emailaddress: encodeURI($("#signupEmailAddress").val()) }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { $("#emailSignUpError").text("" ); mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Added-Success'); } else if (data != undefined && data.Message.indexOf("EmailSingUp_CustomerWithEmailIsExist") > -1) { $("#emailSignUpError").text(""); $('#email-signup').css({ 'display': 'none' }); mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Already-Exist'); } else { $("#emailSignUpError").text(data.Message); } }); } return false; }); }); }; signup.init = function () { signUpEmailBtnClick(); }; return signup; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * reserved for any function calls that cannot be tied to a sepcific site section and has to be initialized on page load */ mk.eSuite.sitedisclaimer = (function ($) { sitedisclaimer = {}; /* * private methods */ acceptCookieDisclaimerBind = function () { $('#acceptcookiedisclaimertext').on('click', function () { var request = $.ajax({ type: "POST", url: '/mk-esuite/acceptcookiedisclaimer?mk_moniker=' + mk.eSuite.moniker, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data.Status == "Success") { $(".cookie-container").hide(); } }); }); } closeCookieDisclaimerBind = function () { $('#closedisclaimercontainer').on('click', function () { var request = $.ajax({ type: "POST", url: '/mk-esuite/acceptcookiedisclaimer?mk_moniker=' + mk.eSuite.moniker, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data.Status == "Success") { $(".cookie-container").hide(); } }); }); } cookiesSettingsBind = function () { $('a.open-cookies-settings').on("click", function (e) { e.preventDefault(); mk.eSuite.utility.bindModalAjaxHandler('/Layers/Cookie-Disclaimers/Manage-Cookies'); }); } sitedisclaimer.init = function () { acceptCookieDisclaimerBind(); closeCookieDisclaimerBind(); cookiesSettingsBind(); }; return sitedisclaimer; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.siteSearch = (function ($) { search = {}; /* * private methods */ bindSearchTermEnter = function () { var url = $("div.header-suggested-search").data("search-page-url") + '?searchTerm='; $("#header-search-submit-button").on('click', function (event) { window.location.href = url + encodeURI($("#header-suggested-search").val()); }); // bind the input enter even on the search results page $("#search-results-search-term").on('keyup', function (event) { if (event.which == 13) { window.location.href = url + encodeURI($("#search-results-search-term").val()); } }); }; removeFilter = function () { $('.filtered-by').on("click", function (event) { //remove filter var url = window.location.href.split('?')[0] + '?+seearchTerm='; window.open(url, '_self', false); }); }; // Suggested search dropdown suggestedSearch = function () { $('#header-suggested-search').on("keyup", function (event) { var $this = $(this); if (event.which == 13) { window.location.href = $("div.header-suggested-search").data("search-page-url") + '?searchTerm=' + encodeURI($this.val()); } if ($this.val().length >= 3) { var urlPrefix = (moniker != '' ? ('/' + moniker) : '') + "/" + (language != '' ? language : ''); var url = urlPrefix + "/Layers/Search/Suggested-Search?queryTerm=" + encodeURI($this.val()); if ($("body.about-mary-kay").length) { url = urlPrefix + "/Layers/Search/About-Mk-Suggested-Search?queryTerm=" + encodeURI($this.val()); } $.ajax({ url: url }).done(function (html) { $("div.header-suggested-search div.suggested-search-wrapper").html(html); $('.header-suggested-search').addClass('open'); // defined in global.js suggestedSearchClose(); }); } else { $('.header-suggested-search').removeClass('open'); } }); }; bindSugestedSearchClick = function () { $(document).on("click", function (e) { if ($('div.suggested-search-wrapper').has(e.target).length <= 0) { $('.header-suggested-search').removeClass('open'); } }); }; // bind suggested search blur event bindMobileTabSelectChange = function () { $('div.results-mobile-wrapper select').change(function () { var url = $(this).val(); if (url != "") window.location = url; }); }; /* * public methods */ search.init = function () { bindSearchTermEnter(); removeFilter(); suggestedSearch(); bindMobileTabSelectChange(); bindSugestedSearchClick(); }; return search; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.stepfive = (function ($) { stepfive = {}; stepfive.firstcall = function () { function BindNumberOnlyTextBoxes() { $m(document).ready(function () { mk.eSuite.utility.onlyNumber('#CvvNumber'); // mk.eSuite.utility.onlyNumber('#CardNumber'); }); } $("#CardTypes").on("change", function (e) { // we need to clear card number field and cvv field if card type was changed $m("#CvvNumber").val('').removeClass("error").closest("div").removeClass("error").children(".error-message").remove(); $m("#CardNumber").val('').removeClass("error").closest("div").removeClass("error").children(".error-message").remove(); $m("#CardMonths").val(''); $m("#CardYears").val(''); var cardType = $(this).val(); $("#CardType").val(cardType); }); $("#CardMonths").on("change", function (e) { var cardMonth = $(this).val(); $("#CardExpiryMonth").val(cardMonth); }); $("#CardYears").on("change", function (e) { var cardYear = $(this).val(); $("#CardExpiryYear").val(cardYear); }); $(".paytype").on("change", function (e) { // disable submit button when switching from propay form to the standard payment page and back $("#SubmitOrderButton").prop("disabled", true); $("#SubmitOrderButtonPPC").prop("disabled", true); $(".paytype").closest("form").submit(); }); $('.bill-address-checkbox').on('click', function () { if ($(this).prop('checked')) { addressOpen = false; $('.ext-address-js').hide('fast'); } else { addressOpen = true; $('.ext-address-js').show('fast'); } }); $('#cvvInformation').on('click', function () { mk.eSuite.utility.bindModalAjaxHandler('layers/Checkout/PaymentStepCvvInformationModal'); }); BindNumberOnlyTextBoxes(); } stepfive.init = function () { stepfive.firstcall(); }; return stepfive; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.checkout = (function ($) { checkout = {}; /* * private methods */ bindFreeSamplesInterestedCheckedRemaining = function () { $('#freesamplesinterested').on("change", function () { var request = $.ajax({ type: "POST", url: '/mk-esuite/UpdateFreeSamplesInterested' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { isChecked: $(this).is(":checked") }, timeout: 6000 }); request.success(function (data) { if (data != undefined && data.Status === "Success") { } }); }); }; bindGWPInterestedCheckedRemaining = function() { $('#gwpinterested').on("change", function () { var request = $.ajax({ type: "POST", url: '/mk-esuite/UpdateGWPInterested' + '?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: { isChecked: $(this).is(":checked") }, timeout: 6000 }); request.success(function (data) { if (data != undefined && data.Status === "Success") { } }); }); }; function bindCheckoutStep2SubmitBtn (applyGooglePhoneFormat) { $('#checkoutStep2SubmitBtn').on("click", function (e) { e.preventDefault(); // check if cutomer selected saved address(es) if ($("#selectedAddress").length !== 0) { $("#noSavedAddress").hide(); var selectedAddressKey = $('#selectedAddress:checked').val(); var originAddress = $('#editNewAddressForm-' + selectedAddressKey).clone(); originAddress[0].reset(); if (applyGooglePhoneFormat != "true" && applyGooglePhoneFormat != undefined && originAddress.serialize() !== $('#editNewAddressForm-' + selectedAddressKey).serialize()) { var url = 'layers/Checkout/ConfirmAddressChange' + '?mk_moniker=' +mk.eSuite.moniker + '&customer_id=' +mk.eSuite.customerId; mk.eSuite.utility.bindModalAjaxHandler(url); } else { if (checkout.validateShippingOptions()) { checkout.validateAddress(); } } } else { if ($('#new-address-wrapper').is(':hidden')) { $m('#new-address-wrapper').show(); } if ($('#addNewAddressForm').guard()) { $("#noSavedAddress").show(); document.getElementById("add-new-address").scrollIntoView(); } } }); }; bindAddressNameChange = function () { $(document).ready(function () { mk.eSuite.utility.onlyAlphaAndDiacritical('.name input' + ''); }); } checkout.validateShippingOptions = function () { if ($('#shipToAddrAboveRadioBtn:checked').length !== 0) { if ($('input[name=SelectedShippingOption]').length !== 0) { var selectedShippingOptionKey = $('input[name=SelectedShippingOption]:checked').val(); if (typeof selectedShippingOptionKey === 'undefined') { $('#shipping-options-error').show(); $('body').animate({ scrollTop: $('.delivery-pref').offset().top }, 500); return false; } } } $('#shipping-options-error').hide(); return true; } hideAddresses = function () { if ($('.addressForm:visible').length > 0) { $('.addressForm:visible')[0].reset(); $('.addressForm:visible input:has-error').clearErrors(); $('.addressForm:visible select:has-error').clearErrors(); $('.edit-address-wrapper').hide(); $('.address-item').removeClass('editing'); } } /* * public methods */ checkout.toggleAddress = function (addressKey) { var addressDiv = (addressKey === undefined) ? $("#new-address-wrapper") : $('#edit-address-wrapper-' + addressKey); var addressFieldset = (addressKey === undefined) ? $('.new-address-item') : $('#fieldset-' + addressKey); if (addressDiv.is(':hidden')) { hideAddresses(); $(addressDiv).show(); // add class only for the existing address if (addressKey !== undefined) { $(addressFieldset).addClass('editing'); } } else { hideAddresses(); } } checkout.validateAddress = function (saveUpdatedAddress) { var selectedAddressKey = $('#selectedAddress:checked').val(); if ($('#editNewAddressForm-' + selectedAddressKey).guard()) { if (saveUpdatedAddress) { var request = $m.ajax({ type: 'POST', url: '/mk-esuite/updateaddress?mk_moniker=' + mk.eSuite.moniker + '&customer_id=' + mk.eSuite.customerId, data: $('#editNewAddressForm-' + selectedAddressKey).serialize(), timeout: 6000 }); request.success(function (data) { if (data != undefined && data.Status === "Success") { $('#continueToStep3Form').submit(); } }); } else { $('#continueToStep3Form').submit(); } } else { var $address = $('#editNewAddressForm-' + selectedAddressKey); if ($address.is(':hidden')) { checkout.toggleAddress(selectedAddressKey); } $('body').animate({ scrollTop: $address.find('.error').offset().top }, 500); } } function getGooglePhoneFormatConfig() { return $m.ajax({ type: 'GET', url: '/mk-esuite/ApplyGooglePhoneFormat' }); request.success(function (data) { if (data != undefined && data != null && data != "") { return data; } }); }; checkout.init = function () { bindAddressNameChange(); bindFreeSamplesInterestedCheckedRemaining(); bindGWPInterestedCheckedRemaining(); getGooglePhoneFormatConfig().then(function (applyGooglePhoneFormat) { bindCheckoutStep2SubmitBtn(applyGooglePhoneFormat) }); }; return checkout; })(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.subscription = (function ($) { subscription = {}; checkSingleConsultantSubscriptions = function () { $('#cbx_subsc_selectAll').on("click", function () { $('.cbx_subsc').prop('checked', $(this).is(':checked')); }); } checkAllConsultantSubscriptions = function () { $('.cbx_subsc').on("click", function () { $('.cbx_subsc').each(function () { var allChecked = true; if (!$(this).is(':checked')) { $('#cbx_subsc_selectAll').prop('checked', false); allChecked = false; return false; } if (allChecked) { $('#cbx_subsc_selectAll').prop('checked', true); } }); }); } checkAllSubscriptions = function () { var boxes = $('.consultant_chk_advance'); for (var i = 0; i < boxes.length; i++) { var currentConsultant = $(boxes[i]).attr("data-consultant"); $(boxes[i]).on("click", function (e) { var selectedConsultant = this.attributes["data-consultant"].value $('[data-consultant="' + selectedConsultant + '"]').prop('checked', $(this).is(':checked')); //$('.cbx_subsc').prop('checked', $(this).is(':checked'));// }); } } unsubscribeSubscriptions = function () { $('#btn_Unsubscribe').on("click", function (e) { //e.preventDefault(); $('.cbx_subsc').prop('checked', false); var _this = $('form#form_accountsubscriptions'); _this.submit(); }); } saveSubscriptions = function(e, pForm, pController, pAction) { //$("#scController").val(pController); //$("#scAction").val(pAction); // $(pForm + ":input[id='scController']").val(pController); // $(pForm + ":input[id='scAction']").val(pAction); var mForm = $(pForm).serializeArray(); mForm.push({ name: "scController", value: pController }); mForm.push({ name: "scAction", value: pAction }); var request = $.ajax({ context: $(pForm)[0], type: "POST", data: mForm, timeout: 60000 }); request.success(function (data, textSts, jqXHR) { if (data.Status == "success") { var modelType = "?ModalType=SubscriptionSuccess"; var NextStep = "&NextStep=" + data.NextStep; mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Added-Success' + modelType + NextStep); //window.location.href = data.NextStep; } else if (data.Status == "error" || data.Status == 'redirect') { var modelType = "?ModalType=SubscriptionError"; var NextStep = "&NextStep=" + data.NextStep; mk.eSuite.utility.bindModalAjaxHandler('layers/Subscription/Subscription-Added-Success' + modelType + NextStep); } }); } bindSaveSubscriptionsClick = function (pButton, pForm, pController, pAction) { $(document).ready(function () { $(document).on("submit", pForm, function (e) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(pForm)) { saveSubscriptions(e, pForm, pController, pAction); } }); }); } bindUnSubscriptionsClick = function (pButton, pForm, pController, pAction) { $(document).ready(function () { $(pButton).on("click", function (e) { e.preventDefault(); e.stopImmediatePropagation(); saveSubscriptions(e, pForm, pController, pAction); }); }); } subscription.init = function () { checkAllSubscriptions(); checkSingleConsultantSubscriptions(); checkAllConsultantSubscriptions(); //unsubscribeSubscriptions(); bindSaveSubscriptionsClick("#accountSubscriptionBtn", "#accountSubscriptionForm", "MyMK", "AccountSubscriptions"); bindSaveSubscriptionsClick("#accountSubscriptionAdvanceBtn", "#accountSubscriptionAdvanceForm", "MyMK", "AccountSubscriptionsAdvance"); bindUnSubscriptionsClick("#btn_Unsubscribe", "#accountSubscriptionForm", "MyMK", "AccountUnSubscribeAll"); bindUnSubscriptionsClick("#btn_UnsubscribeAdvance", "#accountSubscriptionAdvanceForm", "MyMK", "AccountUnSubscribeAllAdvance"); }; return subscription; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * utility or helper fucntions that can be used in the modules in mk.eSuite namespace. Utility module/namespace is doesn't have any init function */ mk.eSuite.utility = function ($) { var utility = {}; /* * public methods */ utility.stripHtml = function (val) { // remove html tags and space chars return val.replace(/<.[^<>]*?>/g, " ").replace(/ | /gi, " ") // remove punctuation .replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g, ""); }; utility.productView = function () { $(".qv-product-image").css("display", "block"); $("#main-product-view").css("display", "none"); }; utility.setQueryStringParam = function (windowurl, name, value) { windowurl = windowurl + ''; var hashTag = windowurl.split('#')[1]; var rest = windowurl.split('#')[0]; var queryString = rest.split('?')[1]; var url = rest.split('?')[0]; var vars = [], hash; if (queryString != undefined) { var q = queryString.split('&'); for (var i = 0; i < q.length; i++) { hash = q[i].split('='); vars.push(decodeURIComponent(hash[0])); vars[hash[0]] = decodeURIComponent(hash[1]); } } var index = vars.indexOf(name); if (value == undefined || value == null || value == '') { // remove value if (index > -1) { vars.splice(index, 1); } } else { // add/modify value if (index < 0) { vars.push(name); } vars[name] = value; } if (vars.length > 0) { url = url + '?' for (var i = 0; i < vars.length; i++) { url = url + vars[i] + '=' + encodeURIComponent(vars[vars[i]]); if (i + 1 < vars.length) { url = url + '&'; } } } if (hashTag != undefined) { url = url + '#' + hashTag; } return url; }; /// get parameter from query string utility.getQueryStringParam = function (name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } utility.bindColorBoxesClick = function (path) { $(path).on('click', function (e) { if ($('img.swatch').length == 0) { $('').insertAfter('div.color-options .color-name'); } else { $('img.swatch').attr('src', $(this).data('swatch')); } var productId = $(this).data('itemid'); utility.bindColorBoxesClearActive(); if ($(this).parents('div.modal-content').length > 0) { e.preventDefault(); var $box = $('div.color-options.cf ul.color-list.cf').find('>li a[data-itemid="' + productId + '"]'); $box.parent().addClass('active'); //$('.remote-modal .modal').modal('hide'); } else { $($(this).parent()).addClass('active'); } //Update product image var imgElement = $('div.modal-content div.cf a'); if (imgElement != null) { imgElement.attr('href', $(this).data('imageurl')); } var productId = $(this).data('itemid'); $("#productQVImage").load("/MK-eSuite/QuickProductImage?mk_moniker=" + mk.eSuite.moniker, { productId: productId }); $("#productQVDetailHhader").load("/MK-eSuite/QuickProductHeader?mk_moniker=" + mk.eSuite.moniker, { productId: productId }); // below function is defined in global.js colorSwatch(); mk.eSuite.shoppingBag.bindColorBoxClickToCart(this); var isDetailColors = $(this).data('detailcolor'); if (isDetailColors != null && isDetailColors == true) { $('#generic-modal-stack').modal('hide'); } }); }; utility.bindColorBoxesClearActive = function () { $('div.color-options.cf ul.color-list.cf li').each(function () { $(this).removeClass('active'); }); }; utility.dynamicHeightforChooser = function () { var imgs = $("div.tips-trends-chooser").find("img"); var maxHeight = 1; $.each(imgs, function () { if (this.height > maxHeight) { maxHeight = this.height; } }); $.each(imgs, function () { $(this).height(maxHeight); }); }; utility.bindColorBoxRemoveClick = function () { $('div.col.sm a.remove').on("click", function () { var priceFormat = ''; var $colorBoxCartDiv = $('div.col-wrapper.color .col.sm'); $colorBoxCartDiv.css({ 'display': 'none' }); $colorBoxCartDiv.find('h5').html(''); $colorBoxCartDiv.find('.price').html(priceFormat); $colorBoxCartDiv.find('fieldset.quantity input').val('0'); utility.bindColorBoxesClearActive(); mk.eSuite.shoppingBag.ColorBoxRemove(); }); }; utility.bindModalAjaxHandler = function (href, bootstrapkey, cache) { var deferred = $.Deferred(); if (href.indexOf('mk_moniker') === -1) { var separator = href.indexOf('?') === -1 ? '?' : '&'; href += separator + 'mk_moniker=' + mk.eSuite.moniker; } if (cache === undefined) { cache = true; } var request = $.ajax({ url: "/" + language + "/" + href, cache: cache }); request.success(function (data, textSts, jqXHR) { // Prevent twice open the same modal (double click or multiple click events ) if (!$('.modal-backdrop').length) { //Init Modal $('.remote-modal').html(data); $('.remote-modal').show(); $('.remote-modal .modal').modal({ backdrop: 'static' }); } if (bootstrapkey == 'color-modal') { utility.bindColorBoxesClick('div.modal-content ul.color-list.cf li a'); } deferred.resolve(); pageload.specialUrls(); mk.eSuite.rememberme.bindRembmerMeModalLinks(); }); return deferred.promise(); }; utility.bindModalAjaxHandlerNoMoniker = function (href, data) { var deferred = $.Deferred(); var request = $.ajax({ url: "/" + language + "/" + href, data: data }); request.success(function (data, textSts, jqXHR) { // Prevent twice open the same modal (double click or multiple click events ) if (!$('.modal-backdrop').length) { //Init Modal $('.remote-modal').html(data); $('.remote-modal').show(); $('.remote-modal .modal').modal(); } deferred.resolve(); }); return deferred.promise(); }; utility.bindModalAjaxHandlerDontRemember = function (href, bootstrapkey) { var deferred = $.Deferred(); if (href.indexOf('mk_moniker') === -1) { var separator = href.indexOf('?') === -1 ? '?' : '&'; href += separator + 'mk_moniker=' + mk.eSuite.moniker; } var request = $.ajax({ url: "/" + language + "/" + href }); request.success(function (data, textSts, jqXHR) { // Prevent twice open the same modal (double click or multiple click events ) if (!$('.modal-backdrop').length) { //Init Modal $('.remote-modal').html(data); $('.remote-modal').show(); $('.remote-modal .modal').modal(); } if (bootstrapkey == 'color-modal') { utility.bindColorBoxesClick('div.modal-content ul.color-list.cf li a'); } deferred.resolve(); }); return deferred.promise(); }; utility.bindModalAjaxHandlerWithData = function (data) { var deferred = $.Deferred(); $('.remote-modal').html(data); $('.remote-modal').show(); $('.remote-modal .modal').modal(); deferred.resolve(); pageload.specialUrls(); mk.eSuite.rememberme.bindRembmerMeModalLinks(); return deferred.promise(); }; utility.bindPromotionModal = function (Id) { var deferred = $.Deferred(); var modalData = $(Id)[0].outerHTML; $('.remote-modal').html(modalData); $('.remote-modal').show(); $('.remote-modal .modal').modal(); deferred.resolve(); return deferred.promise(); }; utility.displayIbcRecommendation = function (urlParam) { if (location.search.toLowerCase().indexOf("hiderecommendedpwsdisplay=true") >= 0) return; //if (typeof $('input[name=HideRecommendedPwsDisplayValue]').val() != "undefined" && $('input[name=HideRecommendedPwsDisplayValue]').val().toLowerCase() === "true") if ( ( //// incasae hiderecommendedpws is true on fist call. typeof $('input[name=HideRecommendedPwsDisplayValue]').val() != "undefined" && $('input[name=HideRecommendedPwsDisplayValue]').length == 1 && $('input[name=HideRecommendedPwsDisplayValue]').val().toLowerCase() == "true" ) || ( typeof $('input[name=HideRecommendedPwsDisplayValue]').val() != "undefined" && $('input[name=HideRecommendedPwsDisplayValue]').length > 1 && $('input[name=HideRecommendedPwsDisplayValue]')[1].value.toLowerCase().indexOf("true") > -1 ) ) return; this.bindModalAjaxHandler("layers/Consultant-Locator/Consultant-Locator-Remember-Me" + urlParam); }; utility.name = function () { if (this.value) { // TODO: We have to refactor this regexp to add special characters as they are not allowed for names if (this.value != this.value.replace(/[^\D]/g, '')) { this.value = this.value.replace(/[^\D]/g, ''); } } }; utility.phoneNumber = function () { if (this.value) { if (this.value != this.value.replace(/[^0-9()\-+\s]/g, '')) { this.value = this.value.replace(/[^0-9()\-+\s]/g, ''); } } } utility.onlyNumber = function (element) { $('body').on('keydown keypress', element, function (e) { // Adding html5 attributes to force displaying numeric keyboard for mobile devices $(element).attr('inputmode', 'numeric'); // Allow: backspace, delete, tab, shift, escape, enter, f5 if ($.inArray(e.which, [0, 8, 9, 13, 16, 27, 46, 110, 116]) !== -1 || // Allow: Ctrl+A, Command+A, Ctrl+C, Command+C, Ctrl+V, Command+V ((e.which === 65 || e.which === 67 || e.which === 86) && (e.ctrlKey === true || e.metaKey === true)) || // Allow: shift + 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ((e.which >= 48 && e.which <= 57) && (e.shiftKey === true)) || // Allow: home, end, left, right, down, up (e.which >= 35 && e.which <= 40)) { // let it happen, don't do anything return; } // Ensure that it is a number and stop the keypress if (((e.which < 48 || e.which > 57)) && (e.which < 96 || e.which > 105)) { e.preventDefault(); } }); // In case if html5 attributes or keycode prevent logic pass the invalid inputed value - remove non digits $(element).on('keyup', function () { if (this.value && this.value !== this.value.replace(/[^0-9]/g, '')) { this.value = this.value.replace(/[^0-9]/g, ''); } }); } utility.onlyAlphaAndDiacritical = function (element) { var regex = new RegExp("[^A-Za-zà-ŽА-Яа-яёЁÀ-ÿЬЮЯҐЄІЇа-щьюяґєії,.\\s'’-]", 'g'); if (self.availableNameRegex) { regex = new RegExp(self.availableNameRegex, 'g'); } $('body').on('keydown keypress', element, function (e) { if (e.key.match(regex)) { e.preventDefault(); } }); // In case if html5 attributes or keycode prevent logic pass the invalid inputed value - remove non digits $(element).on('keyup', function () { this.value = updateValue(this.value); }); function updateValue(value) { if (value && value !== value.replace(regex, '')) { return value.replace(regex, ''); } return value; } } utility.applyPhoneAutoFormat = function (element) { var value = $(element).val(); if (value) { $(element).val(getMask(element, value)); } else { value = $(element).text(); if (value) { $(element).text(getMask(element, value)); } } } function getMask(element, value) { var regexMobile = new RegExp(self.phoneMaskRegex); var regexHome = new RegExp(self.homePhoneRegex); var regexWork = new RegExp(self.workPhoneRegex); value = value.replace(/[^\/\d]/g, ''); if (phoneType(element) === "Mobile" && !isNullOrEmpty(self.phoneMaskRegex) && !isNullOrEmpty(self.phoneMask)) { value = value.replace(regexMobile, self.phoneMask); } else if (phoneType(element) === "Home" && !isNullOrEmpty(self.homePhoneRegex) && !isNullOrEmpty(self.homePhoneMask)) { value = value.replace(regexHome, self.homePhoneMask); } else if (phoneType(element) === "Work" && !isNullOrEmpty(self.workPhoneRegex) && !isNullOrEmpty(self.workPhoneMask)) { value = value.replace(regexWork, self.workPhoneMask); } else { if (!isNullOrEmpty(self.workPhoneRegex) && regexWork.test(value)) { value = value.replace(regexWork, self.workPhoneMask); } else if (!isNullOrEmpty(self.homePhoneRegex) && regexHome.test(value)) { value = value.replace(regexHome, self.homePhoneMask); } else if (!isNullOrEmpty(self.phoneMaskRegex) && regexMobile.test(value)) { value = value.replace(regexMobile, self.phoneMask); } } return value; } function isNullOrEmpty(value) { if (value == "" || value == null) { return true; } else { return false; } } function phoneType(input) { var value = $(input).data("phone-type"); switch (value) { case "Home": return "Home"; case "Work": return "Work"; case "Mobile": return "Mobile"; default: return "Default"; } } utility.bindPhoneAutoFormat = function (element) { utility.applyPhoneAutoFormat(element); $('body').on('focusout', element, function () { utility.applyPhoneAutoFormat(element); }); $('body').on('focusin', element, function () { var value = $(element).val(); if (value) { var unmasked = value.replace(/[^\/\d]/g, ''); $(element).val(unmasked); } }); }; utility.removeEmoji = function (element) { $m(element).on('focusout', function () { regexFirstName = /\p{Extended_Pictographic}+/giu; var newValue = this.value.replace(regexFirstName, ''); this.value = newValue; }) }; utility.bindGoogleFormattedPhoneNum = function (inputElementId) { $(inputElementId).focusin(function () { var value = $(inputElementId).val(); if (value) { var unmasked = value.replace(/[^\/\d]/g, ''); $(inputElementId).val(unmasked); } }); }; utility.applyPostalCodeAutoFormat = function (element) { var value = $(element).val(); if (value) { var masked = value.replace(new RegExp(self.postalCodeMaskRegex), self.postalCodeMask); $(element).val(masked); } } utility.bindPostalCodeAutoFormat = function (element) { utility.applyPostalCodeAutoFormat(element); $('body').on('focusout', element, function () { utility.applyPostalCodeAutoFormat(element); }); }; utility.initPWPModal = function () { var pwpModals = $(".MkPwpModal"); var id = "#" if (pwpModals.length > 0) { for (var i = 0; i < pwpModals.length; i++) { var popUp = $(pwpModals[i]).attr("data-pwppop") if (popUp.toUpperCase() == "TRUE") { id += $(pwpModals[i]).attr("id"); break; } } if (id != "#") { mk.eSuite.utility.bindPromotionModal(id); } } }; utility.showMkToPwsNotification = function (url) { if ($('#rememberme-modal').hasClass('in')) { $('#rememberme-modal').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler('Layers/PWS/MkToPwsNotification').done(function () { $('#mk-to-pws-modal').on('shown.bs.modal', function (e) { $('#mkToPwsNotificationOkButton').attr('href', url); }); }); }); } else { mk.eSuite.utility.bindModalAjaxHandler('Layers/PWS/MkToPwsNotification').done(function () { $('#mk-to-pws-modal').on('shown.bs.modal', function (e) { $('#mkToPwsNotificationOkButton').attr('href', url); }); }); } }; utility.getSuburbBySubsidiary = function (id) { $(id).autocomplete({ source: function (request, response) { $.ajax({ url: '/MK-eSuite/GlobalLocatorSearch/GetCityByRegion', data: { city: request.term }, success: function (data) { response($.map(data, function (item) { return { label: item.DisplayName, value: item.DisplayName } })); } }); }, minLength: 3 }); } utility.getPostalCode = function (zip, region, city, subsidiaryId) { $.ajax({ url: '/MK-eSuite/GetPostalCodes?SubsidiaryID=' + subsidiaryId, method: "GET", success: function (data) { $(zip).autocomplete({ source: data, close: function (event, ui) { var code = $(zip).val(); if (code.length == 4) { utility.getRegionByZip(region, city, code, subsidiaryId); } } }); } }); $(zip).on('focusout', function () { var postalCodeVal = $(zip).val(); if (!postalCodeVal || postalCodeVal.length !== 4) { var emptyOptionhtml = ''; $(city).html(emptyOptionhtml); $(region).html(emptyOptionhtml); } else { utility.getRegionByZip(region, city, postalCodeVal, subsidiaryId); } }); } utility.getRegionByZip = function (region, city, postalCode, subsidiaryId) { $.ajax({ method: "GET", url: '/MK-eSuite/getRegionNameByPostalCode?postalCode=' + postalCode + '&SubsidiaryID=' + subsidiaryId, success: function (data) { if (data) { var optionhtml = ''; $(region).html(optionhtml).trigger('change'); utility.getSuburbByZip(postalCode, city, data); } else { var emptyOptionhtml = ''; $(city).html(emptyOptionhtml); $(region).html(emptyOptionhtml); } } }); } utility.getSuburbByZip = function (postalCode, city, region) { $.ajax({ type: "GET", url: '/MK-eSuite/GetSuburbsByStateAndPostalCode?postalCode=' + postalCode + "&state=" + region, success: function (data) { if (data) { $(city).empty(); $.each(data, function (i, data) { $(city).append($(''; $(city).html(optionhtml); } } }); } utility.getCity = function (region, city) { $(region).on('change', function () { var state = this.value; $.ajax({ type: "GET", url: '/MK-eSuite/GetSuburbsByState?state=' + state, success: function (data) { if (data) { $(city).empty(); $.each(data, function (i, data) { $(city).append($(''; $(city).html(optionhtml); } } }); }) } utility.isMobile = function () { var width = $(window).width(); var result = false; if (width < 769) { result = true; } return result; } utility.bindAutoMovingCursorBetweenEventDatasFields = function () { $m(".upcoming-events .datepicker:input").on("change", function () { var mthis = this; MoveFn(mthis); }); $m(".upcoming-events .datepicker:input").on("keyup", function () { var mthis = this; MoveFn(mthis); }); var dateIsValid = function (date) { if (!date) return true; var DateLength = date.length === 10 ? true : false; if (typeof date === 'string') { date = Globalize.parseDate(date, Globalize.culture().calendar.patterns.d); } if (!date) return false; var minDate = new Date(1900, 0, 1); return (date >= minDate) && DateLength; } var MoveFn = function (mthis) { for (var i = 0; i < $m(".upcoming-events .text-box:input").length; i++) { if (mthis.id === $m(".upcoming-events .text-box:input")[i].id && dateIsValid($m(mthis).val()) === true && $m(mthis).val() !== "") { if (i + 1 !== $m(".upcoming-events .text-box:input").length) { $m(".upcoming-events .text-box:input")[i + 1].focus(); } } } } } utility.getAddressesBySuburbStreet = function (suburbValue, streetValue, addressesList, addressesArea) { return $.ajax({ type: "GET", url: '/mk-esuite/GlobalLocatorSearch/getmatchedaddresses', data: { "suburb": suburbValue, "street": streetValue }, timeout: 2000, success: function (data) { if (data.length >= 1) { addressesList.html(''); $.each(data, function (id, option) { addressesList.append($('').val(JSON.stringify(option)).html(option.DisplayName)); }); if (data.length > 1) addressesArea.css('display', 'block'); } } }); } utility.showExceedCharactersError = function (element, message) { var maxLength = parseInt($(element).attr('maxlength')); $(element).attr('maxlength', (maxLength + 1)); var timeout = { }; var errMsg; $(element).on('input', function () { var input = this; if ($(input).val().length > maxLength) { if (errMsg) { errMsg.remove(); } $(input).val($(input).val().substr(0, maxLength)); $(input).after('' + message + ''); errMsg = $(input).next('.error-message.maxlength'); $(input).addClass("error"); $(input).parent('div').addClass('error'); clearTimeout(timeout); timeout = setTimeout(function () { if (errMsg) { errMsg.remove(); $(input).removeClass("error"); $(input).parent('div').removeClass('error'); } }, 1000); } else { clearTimeout(timeout); if (errMsg) { errMsg.remove(); $(input).removeClass("error"); $(input).parent('div').removeClass('error'); } } }); } utility.checkValidationPromoCode = function () { $(".promo-code form").on("submit", function () { var promoCode = $("#PromoOrEventCode").val().trim(); if (promoCode) { $(".promo-code .error-message").css("display", "none"); $(".promo-code .controlcontainer").removeClass("error"); $("#PromoOrEventCode").removeClass("error"); return true; } else { $(".promo-code .error-message").css("display", "block"); $(".promo-code .controlcontainer").addClass("error"); $("#PromoOrEventCode").addClass("error"); return false; } }); } utility.loadEZ = function () { loadEasyzoom(); } function zeroField(val, numSize) { var outZero = ""; var zeroCount = numSize - String(val).length; for (var x = 0; x < zeroCount; ++x) outZero += "0"; return outZero + val; } utility.countdownComplete = function (unit, value, total) { if (total <= 0) { window.location.href = $(this).data('promourl'); } } return utility; }(jQuery); ; mk = mk || {}; mk.eSuite = mk.eSuite || {}; mk.eSuite.validateaddress = (function ($) { address = {}; address.regexpPO = ""; address.firstcall = function () { function showAddressValidationPopup(e, formId, controller, action) { e.preventDefault(); e.stopImmediatePropagation(); if ($(formId).guard()) { $('#AddressErrorMessage').text(""); var request = $.ajax({ context: this, type: "POST", data: { scController: "Validation", scAction: "IsAddressValid", street: $(formId + " :input[id^='Street']").val(), unitNumber: $(formId + " :input[id^='UnitNumber']").val(), city: $(formId + " :input[id^='City']").val(), regionCode: $(formId + " :input[id^='RegionCode']").val(), postalCode: $(formId + " :input[id^='PostalCode']").val(), acceptButtonId: $(formId + ' #acceptButtonId').val(), originalButtonId: $(formId + ' #originalButtonId').val(), editButtonId: $(formId + ' #editButtonId').val() }, timeout: 60000 }); request.success(function (data) { // HACK: to prevent multiple submitting form we disable create new address button on the Address book. // When address verification popup appears we need to enable the button. if ($('#createAddressBtn')) { $('#createAddressBtn').prop('disabled', false); } if (data) { if (data.Status === "Success") { $('#freeSamplesSubmitBtn').prop('disabled', false); if (data.Message === "ShowPopup") { $('.remote-modal').html(data.NextStep); $('.remote-modal').show(); $('.remote-modal .modal').modal(); } else { popupToNextStep(e, formId, controller, action); } } else { $('#AddressErrorMessage').text(data.Message); } } }); } } function popupToNextStep(e, pForm, pController, pAction) { $('#AddressErrorMessage').text(""); var mForm = $(pForm).serializeArray(); mForm.push({ name: "scController", value: pController }); mForm.push({ name: "scAction", value: pAction }); var request = $.ajax({ context: this, type: "POST", data: mForm, timeout: 60000 }); request.success(function (data) { if (data.Status === "Failure") { $('.remote-modal #address-verify').modal('hide'); $('#AddressErrorMessage').text(data.Message); } else if (data && data.Message === "ShowModal") { if (($m("#address-verify").data('bs.modal') || {}).isShown) { $('.remote-modal #address-verify').on('hidden.bs.modal', function () { mk.eSuite.utility.bindModalAjaxHandler(data.NextStep); }); $('.remote-modal #address-verify').modal('hide'); } else { mk.eSuite.utility.bindModalAjaxHandler(data.NextStep); } } else { window.location.href = data.NextStep; } }); } function updateFieldsAndGotoNextStep(e, pForm, pController, pAction, pUpdateFields) { e.preventDefault(); e.stopImmediatePropagation(); if ($.isGuardsValid(pForm)) { if (pUpdateFields) { $(pForm + " :input[id^='Street']").val($("#recommendedStreet").text()); $(pForm + " :input[id^='UnitNumber']").val($("#recommendedUnitNumber").text()); $(pForm + " :input[id^='City']").val($("#recommendedCity").text()); $(pForm + " :input[id^='RegionCode']").val($("#recommendedState").text()); $(pForm + " :input[id^='PostalCode']").val($("#recommendedPostalCode").text()); } popupToNextStep(e, pForm, pController, pAction); } } ////Calling Address Validation before submit Locate Consultant by Zipcode Submit Button Event. address.ValidateAddress = function (pForm, pController, pAction) { $(document).ready(function () { $(document).on("submit", pForm, function (e) { showAddressValidationPopup(e, pForm, pController, pAction); }); }); } //// Modal Needs to submit the form data back to controller action based on user actions address.NextStepAfterAddressValidation = function (pForm, pController, pAction, editButtonId, acceptButtonId, originalButtonId) { $(document).ready(function () { $(document).on("click", acceptButtonId, function (e) { address.preventeDoubleClick(acceptButtonId); updateFieldsAndGotoNextStep(e, pForm, pController, pAction, true); }); $(document).on("click", editButtonId, function (e) { $('.remote-modal #address-verify').modal('hide'); }); $(document).on("click", originalButtonId, function (e) { address.preventeDoubleClick(originalButtonId); updateFieldsAndGotoNextStep(e, pForm, pController, pAction, false); }); }); } } address.onEditAddressFormLinkClick = function (addressKey, count) { if (mk.eSuite.applyCheckoutAddressVerification) { address.ValidateAddress('#editNewAddressForm-' + addressKey, 'DeliveryStep', 'SaveEditAddress'); address.NextStepAfterAddressValidation('#editNewAddressForm-' + addressKey, 'DeliveryStep', 'SaveEditAddress', '#editButton' + count, '#acceptButton' + count, '#originalButton' + count); } } address.preventeDoubleClick = function (anchorId) { if ($(this).guard()) { $(anchorId).css("pointer-events", "none"); } } address.GoTonextStepWithoutValidation = function (formId, controller, action) { if ($(this).guard()) { $(document).ready(function () { $(document).on("submit", formId, function (e) { address.GoToNextStep(e, formId, controller, action); }); }); } } address.GoToNextStep = function (e, pForm, pController, pAction) { e.preventDefault(); e.stopImmediatePropagation(); var mForm = $(pForm).serializeArray(); mForm.push({ name: "scController", value: pController }); mForm.push({ name: "scAction", value: pAction }); var request = $.ajax({ context: this, type: "POST", data: mForm, timeout: 60000 }); request.success(function (data) { if (data.Status == "Success") { window.location.href = data.NextStep; } else { $('#AddressErrorMessage').text(data.Message); } }); } address.disableAddresses = function (isDisabled, options) { if (mk.eSuite.consultantSubsidiaryCode === "US") { $('input[type="radio"]').each(function () { var fieldset = $(this).closest('fieldset'); var addressSpan = fieldset.find('span.address'); var addressText = addressSpan.text().trim(); const pattern = new RegExp(address.regexpPO, 'g'); var hasPOBox = pattern.test(addressText.toLowerCase()); var unitSpan = fieldset.find('span.apt-unit'); var unitText = unitSpan.text().trim(); hasPOBox = !hasPOBox ? pattern.test(unitText.toLowerCase()) : hasPOBox; var error = fieldset.find('span.pobox-error'); if ($(this).attr('id') === 'selectedAddress') { if (isDisabled && options && hasPOBox) { $(this).attr('disabled', 'disabled'); $(this).prop('disabled', true); error.css('display', 'block'); } else { $(this).removeAttr('disabled'); $(this).prop('disabled', false); error.css('display', 'none'); } } }); } $('#selectedAddress:not(:disabled)').first().prop('checked', true).attr('checked', 'checked'); } address.init = function () { $('#selectedAddress:not(:disabled)').first().prop('checked', true).attr('checked', 'checked'); if (mk.eSuite.applyCheckoutAddressVerification || mk.eSuite.applyMyMKAddressVerification) { address.firstcall(); } else { address.GoTonextStepWithoutValidation("#continueToStep3FormForGuest", "GuestCheckoutDeliveryStep", "ContinueToNextStep"); } if (mk.eSuite.applyCheckoutAddressVerification) { address.ValidateAddress("#continueToStep3FormForGuest", "GuestCheckoutDeliveryStep", "ContinueToNextStep"); address.NextStepAfterAddressValidation("#continueToStep3FormForGuest", "GuestCheckoutDeliveryStep", "ContinueToNextStep", "#guestEditId", "#guestAcceptId", "#guestOriginalId"); address.ValidateAddress("#addNewAddressForm", "DeliveryStep", "SaveAddNewAddress"); address.NextStepAfterAddressValidation("#addNewAddressForm", "DeliveryStep", "SaveAddNewAddress", "#editButtonNew", "#acceptButtonNew", "#originalButtonNew"); } if (mk.eSuite.applyMyMKAddressVerification) { address.ValidateAddress("#UpdateAddress", "MyMKAddressBook", "UpdateAddress"); address.NextStepAfterAddressValidation("#UpdateAddress", "MyMKAddressBook", "UpdateAddress", "#editButtonAddressBook", "#acceptButtonAddressBook", "#originalButtonAddressBook"); address.ValidateAddress("#CreateAddress", "MyMKAddressBook", "CreateNewAddress"); address.NextStepAfterAddressValidation("#CreateAddress", "MyMKAddressBook", "CreateNewAddress", "#editButtonAddressBookNew", "#acceptButtonAddressBookNew", "#originalButtonAddressBookNew"); address.ValidateAddress("#freeSamplesForm", "FreeSamples", "FreeSamples"); address.NextStepAfterAddressValidation("#freeSamplesForm", "FreeSamples", "FreeSamples", "#freeSamplesEditId", "#freeSamplesAcceptId", "#freeSamplesOriginalId"); } }; return address; })(jQuery);; mk = mk || {}; mk.eSuite = mk.eSuite || {}; /* * Wish list related functionality */ mk.eSuite.wishlist = (function ($) { wishlist = {}; /* * private methods */ bindSaveToWishlistClick = function () { $('a.external-click.save-to-wishlist').on("click", function () { if (mk.eSuite.isPWSMode && mk.eSuite.isCustomerLogged) { wishlist.addProductToWishlist($("#PDP-ProductID").val(), wishlist.updateWishlistStates); } else { mk.eSuite.utility.bindModalAjaxHandler('/layers/wishlist/wishlist-unauthenticated'); } }); }; bindMyMKWishlistPageEvents = function () { $('div.container.wishlist .sort select').on("change", function () { $this = $(this); var sort_value = $this.val(); var sort_name = "sortby"; var newurl = mk.eSuite.utility.setQueryStringParam(window.location, sort_name, null); window.location = mk.eSuite.utility.setQueryStringParam(newurl, sort_name, sort_value); }); $('.wishlist-content .remove-product .inner-wrapper a.remove').on("click", function () { var productId = $(this).attr('data-productid'); if (mk.eSuite.isPWSMode && mk.eSuite.isCustomerLogged) { wishlist.removeProductFromWishlist(productId); } }); }; /* * public methods */ wishlist.wishlistAddSimpleMessage = function (data) { if (data != undefined && data.Status == "Success") { $('#product-added-wishlist-modal').modal('toggle'); } else { $('#product-cant-added-wishlist-modal').modal('toggle'); } }; wishlist.removeProductFromWishlist = function (prodId, callback) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/RemoveProductFromWishlist?mk_moniker=' + mk.eSuite.moniker, data: { customerId: mk.eSuite.customerId, productId: prodId, consultantId: mk.eSuite.consultantId }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { if (data != undefined && data.Status == "Success") { window.location.reload(); } else { console.log("could not remove wishlist item"); } }); }; wishlist.updateWishlistStates = function (data, object) { if (data != undefined && data.Status == "Success") { $('a.external-click.save-to-wishlist').toggle(); $('a.added-to-wishlist').toggle(); mk.eSuite.utility.bindModalAjaxHandler('/layers/wishlist/wishlist-product-added?mk_moniker=' + mk.eSuite.moniker); } else { alert("Product couldn't be added to wishlist"); } }; wishlist.updateWishlistStatesFromSB = function (data, object) { if (data != undefined && data.Status == "Success") { object.find('a.wishlist').toggle(); object.find('a.saved-to-wishlist').toggle(); mk.eSuite.utility.bindModalAjaxHandler('/layers/wishlist/wishlist-product-added?mk_moniker=' + mk.eSuite.moniker); } else { alert("Product couldn't be added to wishlist"); } }; wishlist.addProductToWishlist = function (prodId, callback, obj) { var request = $.ajax({ type: "POST", url: '/MK-eSuite/AddProductIdToWishlist?mk_moniker=' + mk.eSuite.moniker, data: { customerId: mk.eSuite.customerId, productId: prodId, consultantId: mk.eSuite.consultantId }, timeout: 6000 }); request.success(function (data, textSts, jqXHR) { callback(data, obj); }); }; bindRemoveWishlistProductClick = function () { $('.wishlist-remove-product-link').on('click', function () { var url = $(this).attr('data-urlmodal') + '?mk_moniker=' + mk.eSuite.moniker; var productId = $(this).attr('data-productid'); mk.eSuite.utility.bindModalAjaxHandler(url).done(function () { wishlist.bindRemoveProductsFromWishlist(productId); }); }); }; wishlist.bindRemoveProductsFromWishlist = function (productId) { $('#btnOk').on('click', function () { if (mk.eSuite.isPWSMode && mk.eSuite.isCustomerLogged) { wishlist.removeProductFromWishlist(productId); } }) }; wishlist.init = function () { bindSaveToWishlistClick(); bindMyMKWishlistPageEvents(); bindRemoveWishlistProductClick(); }; return wishlist; })(jQuery); ;