Skip to content

Instantly share code, notes, and snippets.

@adardesign
Last active August 17, 2016 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adardesign/9a3e856934cd918b900648688022129d to your computer and use it in GitHub Desktop.
Save adardesign/9a3e856934cd918b900648688022129d to your computer and use it in GitHub Desktop.
/*! jQuery v2.1.0 | (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 = "".trim,
l = {},
m = a.document,
n = "2.1.0",
o = function(a, b) {
return new o.fn.init(a, b)
},
p = /^-ms-/,
q = /-([\da-z])/gi,
r = function(a, b) {
return b.toUpperCase()
};
o.fn = o.prototype = {
jquery: n,
constructor: o,
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 = o.merge(this.constructor(), a);
return b.prevObject = this, b.context = this.context, b
},
each: function(a, b) {
return o.each(this, a, b)
},
map: function(a) {
return this.pushStack(o.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
}, o.extend = o.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 || o.isFunction(g) || (g = {}), h === i && (g = this, h--); i > h; h++)
if (null != (a = arguments[h]))
for (b in a) c = g[b], d = a[b], g !== d && (j && d && (o.isPlainObject(d) || (e = o.isArray(d))) ? (e ? (e = !1, f = c && o.isArray(c) ? c : []) : f = c && o.isPlainObject(c) ? c : {}, g[b] = o.extend(j, f, d)) : void 0 !== d && (g[b] = d));
return g
}, o.extend({
expando: "jQuery" + (n + Math.random()).replace(/\D/g, ""),
isReady: !0,
error: function(a) {
throw new Error(a)
},
noop: function() {},
isFunction: function(a) {
return "function" === o.type(a)
},
isArray: Array.isArray,
isWindow: function(a) {
return null != a && a === a.window
},
isNumeric: function(a) {
return a - parseFloat(a) >= 0
},
isPlainObject: function(a) {
if ("object" !== o.type(a) || a.nodeType || o.isWindow(a)) return !1;
try {
if (a.constructor && !j.call(a.constructor.prototype, "isPrototypeOf")) return !1
} catch (b) {
return !1
}
return !0
},
isEmptyObject: function(a) {
var b;
for (b in a) return !1;
return !0
},
type: function(a) {
return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? h[i.call(a)] || "object" : typeof a
},
globalEval: function(a) {
var b, c = eval;
a = o.trim(a), a && (1 === a.indexOf("use strict") ? (b = m.createElement("script"), b.text = a, m.head.appendChild(b).parentNode.removeChild(b)) : c(a))
},
camelCase: function(a) {
return a.replace(p, "ms-").replace(q, r)
},
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 = s(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 ? "" : k.call(a)
},
makeArray: function(a, b) {
var c = b || [];
return null != a && (s(Object(a)) ? o.merge(c, "string" == typeof a ? [a] : a) : f.call(c, a)), c
},
inArray: function(a, b, c) {
return null == b ? -1 : g.call(b, a, c)
},
merge: function(a, b) {
for (var c = +b.length, d = 0, e = a.length; c > d; 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 = s(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 && (c = a[b], b = a, a = c), o.isFunction(a) ? (e = d.call(arguments, 2), f = function() {
return a.apply(b || this, e.concat(d.call(arguments)))
}, f.guid = a.guid = a.guid || o.guid++, f) : void 0
},
now: Date.now,
support: l
}), o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(a, b) {
h["[object " + b + "]"] = b.toLowerCase()
});
function s(a) {
var b = a.length,
c = o.type(a);
return "function" === c || o.isWindow(a) ? !1 : 1 === a.nodeType && b ? !0 : "array" === c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a
}
var t = function(a) {
var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s = "sizzle" + -new Date,
t = a.document,
u = 0,
v = 0,
w = eb(),
x = eb(),
y = eb(),
z = function(a, b) {
return a === b && (j = !0), 0
},
A = "undefined",
B = 1 << 31,
C = {}.hasOwnProperty,
D = [],
E = D.pop,
F = D.push,
G = D.push,
H = D.slice,
I = D.indexOf || function(a) {
for (var b = 0, c = this.length; c > b; b++)
if (this[b] === a) return b;
return -1
},
J = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
K = "[\\x20\\t\\r\\n\\f]",
L = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
M = L.replace("w", "w#"),
N = "\\[" + K + "*(" + L + ")" + K + "*(?:([*^$|!~]?=)" + K + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + M + ")|)|)" + K + "*\\]",
O = ":(" + L + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + N.replace(3, 8) + ")*)|.*)\\)|)",
P = new RegExp("^" + K + "+|((?:^|[^\\\\])(?:\\\\.)*)" + K + "+$", "g"),
Q = new RegExp("^" + K + "*," + K + "*"),
R = new RegExp("^" + K + "*([>+~]|" + K + ")" + K + "*"),
S = new RegExp("=" + K + "*([^\\]'\"]*?)" + K + "*\\]", "g"),
T = new RegExp(O),
U = new RegExp("^" + M + "$"),
V = {
ID: new RegExp("^#(" + L + ")"),
CLASS: new RegExp("^\\.(" + L + ")"),
TAG: new RegExp("^(" + L.replace("w", "w*") + ")"),
ATTR: new RegExp("^" + N),
PSEUDO: new RegExp("^" + O),
CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + K + "*(even|odd|(([+-]|)(\\d*)n|)" + K + "*(?:([+-]|)" + K + "*(\\d+)|))" + K + "*\\)|)", "i"),
bool: new RegExp("^(?:" + J + ")$", "i"),
needsContext: new RegExp("^" + K + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + K + "*((?:-\\d)?\\d*)" + K + "*\\)|)(?=[^-]|$)", "i")
},
W = /^(?:input|select|textarea|button)$/i,
X = /^h\d$/i,
Y = /^[^{]+\{\s*\[native \w/,
Z = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
$ = /[+~]/,
_ = /'|\\/g,
ab = new RegExp("\\\\([\\da-f]{1,6}" + K + "?|(" + K + ")|.)", "ig"),
bb = 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 {
G.apply(D = H.call(t.childNodes), t.childNodes), D[t.childNodes.length].nodeType
} catch (cb) {
G = {
apply: D.length ? function(a, b) {
F.apply(a, H.call(b))
} : function(a, b) {
var c = a.length,
d = 0;
while (a[c++] = b[d++]);
a.length = c - 1
}
}
}
function db(a, b, d, e) {
var f, g, h, i, j, m, p, q, u, v;
if ((b ? b.ownerDocument || b : t) !== l && k(b), b = b || l, d = d || [], !a || "string" != typeof a) return d;
if (1 !== (i = b.nodeType) && 9 !== i) return [];
if (n && !e) {
if (f = Z.exec(a))
if (h = f[1]) {
if (9 === i) {
if (g = b.getElementById(h), !g || !g.parentNode) return d;
if (g.id === h) return d.push(g), d
} else if (b.ownerDocument && (g = b.ownerDocument.getElementById(h)) && r(b, g) && g.id === h) return d.push(g), d
} else {
if (f[2]) return G.apply(d, b.getElementsByTagName(a)), d;
if ((h = f[3]) && c.getElementsByClassName && b.getElementsByClassName) return G.apply(d, b.getElementsByClassName(h)), d
}
if (c.qsa && (!o || !o.test(a))) {
if (q = p = s, u = b, v = 9 === i && a, 1 === i && "object" !== b.nodeName.toLowerCase()) {
m = ob(a), (p = b.getAttribute("id")) ? q = p.replace(_, "\\$&") : b.setAttribute("id", q), q = "[id='" + q + "'] ", j = m.length;
while (j--) m[j] = q + pb(m[j]);
u = $.test(a) && mb(b.parentNode) || b, v = m.join(",")
}
if (v) try {
return G.apply(d, u.querySelectorAll(v)), d
} catch (w) {} finally {
p || b.removeAttribute("id")
}
}
}
return xb(a.replace(P, "$1"), b, d, e)
}
function eb() {
var a = [];
function b(c, e) {
return a.push(c + " ") > d.cacheLength && delete b[a.shift()], b[c + " "] = e
}
return b
}
function fb(a) {
return a[s] = !0, a
}
function gb(a) {
var b = l.createElement("div");
try {
return !!a(b)
} catch (c) {
return !1
} finally {
b.parentNode && b.parentNode.removeChild(b), b = null
}
}
function hb(a, b) {
var c = a.split("|"),
e = a.length;
while (e--) d.attrHandle[c[e]] = b
}
function ib(a, b) {
var c = b && a,
d = c && 1 === a.nodeType && 1 === b.nodeType && (~b.sourceIndex || B) - (~a.sourceIndex || B);
if (d) return d;
if (c)
while (c = c.nextSibling)
if (c === b) return -1;
return a ? 1 : -1
}
function jb(a) {
return function(b) {
var c = b.nodeName.toLowerCase();
return "input" === c && b.type === a
}
}
function kb(a) {
return function(b) {
var c = b.nodeName.toLowerCase();
return ("input" === c || "button" === c) && b.type === a
}
}
function lb(a) {
return fb(function(b) {
return b = +b, fb(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 mb(a) {
return a && typeof a.getElementsByTagName !== A && a
}
c = db.support = {}, f = db.isXML = function(a) {
var b = a && (a.ownerDocument || a).documentElement;
return b ? "HTML" !== b.nodeName : !1
}, k = db.setDocument = function(a) {
var b, e = a ? a.ownerDocument || a : t,
g = e.defaultView;
return e !== l && 9 === e.nodeType && e.documentElement ? (l = e, m = e.documentElement, n = !f(e), g && g !== g.top && (g.addEventListener ? g.addEventListener("unload", function() {
k()
}, !1) : g.attachEvent && g.attachEvent("onunload", function() {
k()
})), c.attributes = gb(function(a) {
return a.className = "i", !a.getAttribute("className")
}), c.getElementsByTagName = gb(function(a) {
return a.appendChild(e.createComment("")), !a.getElementsByTagName("*").length
}), c.getElementsByClassName = Y.test(e.getElementsByClassName) && gb(function(a) {
return a.innerHTML = "<div class='a'></div><div class='a i'></div>", a.firstChild.className = "i", 2 === a.getElementsByClassName("i").length
}), c.getById = gb(function(a) {
return m.appendChild(a).id = s, !e.getElementsByName || !e.getElementsByName(s).length
}), c.getById ? (d.find.ID = function(a, b) {
if (typeof b.getElementById !== A && n) {
var c = b.getElementById(a);
return c && c.parentNode ? [c] : []
}
}, d.filter.ID = function(a) {
var b = a.replace(ab, bb);
return function(a) {
return a.getAttribute("id") === b
}
}) : (delete d.find.ID, d.filter.ID = function(a) {
var b = a.replace(ab, bb);
return function(a) {
var c = typeof a.getAttributeNode !== A && a.getAttributeNode("id");
return c && c.value === b
}
}), d.find.TAG = c.getElementsByTagName ? function(a, b) {
return typeof b.getElementsByTagName !== A ? 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 !== A && n ? b.getElementsByClassName(a) : void 0
}, p = [], o = [], (c.qsa = Y.test(e.querySelectorAll)) && (gb(function(a) {
a.innerHTML = "<select t=''><option selected=''></option></select>", a.querySelectorAll("[t^='']").length && o.push("[*^$]=" + K + "*(?:''|\"\")"), a.querySelectorAll("[selected]").length || o.push("\\[" + K + "*(?:value|" + J + ")"), a.querySelectorAll(":checked").length || o.push(":checked")
}), gb(function(a) {
var b = e.createElement("input");
b.setAttribute("type", "hidden"), a.appendChild(b).setAttribute("name", "D"), a.querySelectorAll("[name=d]").length && o.push("name" + K + "*[*^$|!~]?="), a.querySelectorAll(":enabled").length || o.push(":enabled", ":disabled"), a.querySelectorAll("*,:x"), o.push(",.*:")
})), (c.matchesSelector = Y.test(q = m.webkitMatchesSelector || m.mozMatchesSelector || m.oMatchesSelector || m.msMatchesSelector)) && gb(function(a) {
c.disconnectedMatch = q.call(a, "div"), q.call(a, "[s!='']:x"), p.push("!=", O)
}), o = o.length && new RegExp(o.join("|")), p = p.length && new RegExp(p.join("|")), b = Y.test(m.compareDocumentPosition), r = b || Y.test(m.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
}, z = b ? function(a, b) {
if (a === b) return j = !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 === t && r(t, a) ? -1 : b === e || b.ownerDocument === t && r(t, b) ? 1 : i ? I.call(i, a) - I.call(i, b) : 0 : 4 & d ? -1 : 1)
} : function(a, b) {
if (a === b) return j = !0, 0;
var c, d = 0,
f = a.parentNode,
g = b.parentNode,
h = [a],
k = [b];
if (!f || !g) return a === e ? -1 : b === e ? 1 : f ? -1 : g ? 1 : i ? I.call(i, a) - I.call(i, b) : 0;
if (f === g) return ib(a, b);
c = a;
while (c = c.parentNode) h.unshift(c);
c = b;
while (c = c.parentNode) k.unshift(c);
while (h[d] === k[d]) d++;
return d ? ib(h[d], k[d]) : h[d] === t ? -1 : k[d] === t ? 1 : 0
}, e) : l
}, db.matches = function(a, b) {
return db(a, null, null, b)
}, db.matchesSelector = function(a, b) {
if ((a.ownerDocument || a) !== l && k(a), b = b.replace(S, "='$1']"), !(!c.matchesSelector || !n || p && p.test(b) || o && o.test(b))) try {
var d = q.call(a, b);
if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType) return d
} catch (e) {}
return db(b, l, null, [a]).length > 0
}, db.contains = function(a, b) {
return (a.ownerDocument || a) !== l && k(a), r(a, b)
}, db.attr = function(a, b) {
(a.ownerDocument || a) !== l && k(a);
var e = d.attrHandle[b.toLowerCase()],
f = e && C.call(d.attrHandle, b.toLowerCase()) ? e(a, b, !n) : void 0;
return void 0 !== f ? f : c.attributes || !n ? a.getAttribute(b) : (f = a.getAttributeNode(b)) && f.specified ? f.value : null
}, db.error = function(a) {
throw new Error("Syntax error, unrecognized expression: " + a)
}, db.uniqueSort = function(a) {
var b, d = [],
e = 0,
f = 0;
if (j = !c.detectDuplicates, i = !c.sortStable && a.slice(0), a.sort(z), j) {
while (b = a[f++]) b === a[f] && (e = d.push(f));
while (e--) a.splice(d[e], 1)
}
return i = null, a
}, e = db.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 = db.selectors = {
cacheLength: 50,
createPseudo: fb,
match: V,
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(ab, bb), a[3] = (a[4] || a[5] || "").replace(ab, bb), "~=" === 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] || db.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] && db.error(a[0]), a
},
PSEUDO: function(a) {
var b, c = !a[5] && a[2];
return V.CHILD.test(a[0]) ? null : (a[3] && void 0 !== a[4] ? a[2] = a[4] : c && T.test(c) && (b = ob(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(ab, bb).toLowerCase();
return "*" === a ? function() {
return !0
} : function(a) {
return a.nodeName && a.nodeName.toLowerCase() === b
}
},
CLASS: function(a) {
var b = w[a + " "];
return b || (b = new RegExp("(^|" + K + ")" + a + "(" + K + "|$)")) && w(a, function(a) {
return b.test("string" == typeof a.className && a.className || typeof a.getAttribute !== A && a.getAttribute("class") || "")
})
},
ATTR: function(a, b, c) {
return function(d) {
var e = db.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(),
t = !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 && t) {
k = q[s] || (q[s] = {}), j = k[a] || [], n = j[0] === u && j[1], m = j[0] === u && 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] = [u, n, m];
break
}
} else if (t && (j = (b[s] || (b[s] = {}))[a]) && j[0] === u) 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 && (t && ((l[s] || (l[s] = {}))[a] = [u, 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()] || db.error("unsupported pseudo: " + a);
return e[s] ? e(b) : e.length > 1 ? (c = [a, a, "", b], d.setFilters.hasOwnProperty(a.toLowerCase()) ? fb(function(a, c) {
var d, f = e(a, b),
g = f.length;
while (g--) d = I.call(a, f[g]), a[d] = !(c[d] = f[g])
}) : function(a) {
return e(a, 0, c)
}) : e
}
},
pseudos: {
not: fb(function(a) {
var b = [],
c = [],
d = g(a.replace(P, "$1"));
return d[s] ? fb(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: fb(function(a) {
return function(b) {
return db(a, b).length > 0
}
}),
contains: fb(function(a) {
return function(b) {
return (b.textContent || b.innerText || e(b)).indexOf(a) > -1
}
}),
lang: fb(function(a) {
return U.test(a || "") || db.error("unsupported lang: " + a), a = a.replace(ab, bb).toLowerCase(),
function(b) {
var c;
do
if (c = n ? 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 === m
},
focus: function(a) {
return a === l.activeElement && (!l.hasFocus || l.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 X.test(a.nodeName)
},
input: function(a) {
return W.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: lb(function() {
return [0]
}),
last: lb(function(a, b) {
return [b - 1]
}),
eq: lb(function(a, b, c) {
return [0 > c ? c + b : c]
}),
even: lb(function(a, b) {
for (var c = 0; b > c; c += 2) a.push(c);
return a
}),
odd: lb(function(a, b) {
for (var c = 1; b > c; c += 2) a.push(c);
return a
}),
lt: lb(function(a, b, c) {
for (var d = 0 > c ? c + b : c; --d >= 0;) a.push(d);
return a
}),
gt: lb(function(a, b, c) {
for (var d = 0 > c ? c + b : c; ++d < b;) a.push(d);
return a
})
}
}, d.pseudos.nth = d.pseudos.eq;
for (b in {
radio: !0,
checkbox: !0,
file: !0,
password: !0,
image: !0
}) d.pseudos[b] = jb(b);
for (b in {
submit: !0,
reset: !0
}) d.pseudos[b] = kb(b);
function nb() {}
nb.prototype = d.filters = d.pseudos, d.setFilters = new nb;
function ob(a, b) {
var c, e, f, g, h, i, j, k = x[a + " "];
if (k) return b ? 0 : k.slice(0);
h = a, i = [], j = d.preFilter;
while (h) {
(!c || (e = Q.exec(h))) && (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = R.exec(h)) && (c = e.shift(), f.push({
value: c,
type: e[0].replace(P, " ")
}), h = h.slice(c.length));
for (g in d.filter) !(e = V[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({
value: c,
type: g,
matches: e
}), h = h.slice(c.length));
if (!c) break
}
return b ? h.length : h ? db.error(a) : x(a, i).slice(0)
}
function pb(a) {
for (var b = 0, c = a.length, d = ""; c > b; b++) d += a[b].value;
return d
}
function qb(a, b, c) {
var d = b.dir,
e = c && "parentNode" === d,
f = v++;
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 = [u, 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[s] || (b[s] = {}), (h = i[d]) && h[0] === u && h[1] === f) return j[2] = h[2];
if (i[d] = j, j[2] = a(b, c, g)) return !0
}
}
}
function rb(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 sb(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 tb(a, b, c, d, e, f) {
return d && !d[s] && (d = tb(d)), e && !e[s] && (e = tb(e, f)), fb(function(f, g, h, i) {
var j, k, l, m = [],
n = [],
o = g.length,
p = f || wb(b || "*", h.nodeType ? [h] : h, []),
q = !a || !f && b ? p : sb(p, m, a, h, i),
r = c ? e || (f ? a : o || d) ? [] : g : q;
if (c && c(q, r, h, i), d) {
j = sb(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 ? I.call(f, l) : m[k]) > -1 && (f[j] = !(g[j] = l))
}
} else r = sb(r === g ? r.splice(o, r.length) : r), e ? e(null, g, r, i) : G.apply(g, r)
})
}
function ub(a) {
for (var b, c, e, f = a.length, g = d.relative[a[0].type], i = g || d.relative[" "], j = g ? 1 : 0, k = qb(function(a) {
return a === b
}, i, !0), l = qb(function(a) {
return I.call(b, a) > -1
}, i, !0), m = [function(a, c, d) {
return !g && (d || c !== h) || ((b = c).nodeType ? k(a, c, d) : l(a, c, d))
}]; f > j; j++)
if (c = d.relative[a[j].type]) m = [qb(rb(m), c)];
else {
if (c = d.filter[a[j].type].apply(null, a[j].matches), c[s]) {
for (e = ++j; f > e; e++)
if (d.relative[a[e].type]) break;
return tb(j > 1 && rb(m), j > 1 && pb(a.slice(0, j - 1).concat({
value: " " === a[j - 2].type ? "*" : ""
})).replace(P, "$1"), c, e > j && ub(a.slice(j, e)), f > e && ub(a = a.slice(e)), f > e && pb(a))
}
m.push(c)
}
return rb(m)
}
function vb(a, b) {
var c = b.length > 0,
e = a.length > 0,
f = function(f, g, i, j, k) {
var m, n, o, p = 0,
q = "0",
r = f && [],
s = [],
t = h,
v = f || e && d.find.TAG("*", k),
w = u += null == t ? 1 : Math.random() || .1,
x = v.length;
for (k && (h = g !== l && g); q !== x && null != (m = v[q]); q++) {
if (e && m) {
n = 0;
while (o = a[n++])
if (o(m, g, i)) {
j.push(m);
break
}
k && (u = w)
}
c && ((m = !o && m) && p--, f && r.push(m))
}
if (p += q, c && q !== p) {
n = 0;
while (o = b[n++]) o(r, s, g, i);
if (f) {
if (p > 0)
while (q--) r[q] || s[q] || (s[q] = E.call(j));
s = sb(s)
}
G.apply(j, s), k && !f && s.length > 0 && p + b.length > 1 && db.uniqueSort(j)
}
return k && (u = w, h = t), r
};
return c ? fb(f) : f
}
g = db.compile = function(a, b) {
var c, d = [],
e = [],
f = y[a + " "];
if (!f) {
b || (b = ob(a)), c = b.length;
while (c--) f = ub(b[c]), f[s] ? d.push(f) : e.push(f);
f = y(a, vb(e, d))
}
return f
};
function wb(a, b, c) {
for (var d = 0, e = b.length; e > d; d++) db(a, b[d], c);
return c
}
function xb(a, b, e, f) {
var h, i, j, k, l, m = ob(a);
if (!f && 1 === m.length) {
if (i = m[0] = m[0].slice(0), i.length > 2 && "ID" === (j = i[0]).type && c.getById && 9 === b.nodeType && n && d.relative[i[1].type]) {
if (b = (d.find.ID(j.matches[0].replace(ab, bb), b) || [])[0], !b) return e;
a = a.slice(i.shift().value.length)
}
h = V.needsContext.test(a) ? 0 : i.length;
while (h--) {
if (j = i[h], d.relative[k = j.type]) break;
if ((l = d.find[k]) && (f = l(j.matches[0].replace(ab, bb), $.test(i[0].type) && mb(b.parentNode) || b))) {
if (i.splice(h, 1), a = f.length && pb(i), !a) return G.apply(e, f), e;
break
}
}
}
return g(a, m)(f, b, !n, e, $.test(a) && mb(b.parentNode) || b), e
}
return c.sortStable = s.split("").sort(z).join("") === s, c.detectDuplicates = !!j, k(), c.sortDetached = gb(function(a) {
return 1 & a.compareDocumentPosition(l.createElement("div"))
}), gb(function(a) {
return a.innerHTML = "<a href='#'></a>", "#" === a.firstChild.getAttribute("href")
}) || hb("type|href|height|width", function(a, b, c) {
return c ? void 0 : a.getAttribute(b, "type" === b.toLowerCase() ? 1 : 2)
}), c.attributes && gb(function(a) {
return a.innerHTML = "<input/>", a.firstChild.setAttribute("value", ""), "" === a.firstChild.getAttribute("value")
}) || hb("value", function(a, b, c) {
return c || "input" !== a.nodeName.toLowerCase() ? void 0 : a.defaultValue
}), gb(function(a) {
return null == a.getAttribute("disabled")
}) || hb(J, function(a, b, c) {
var d;
return c ? void 0 : a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null
}), db
}(a);
o.find = t, o.expr = t.selectors, o.expr[":"] = o.expr.pseudos, o.unique = t.uniqueSort, o.text = t.getText, o.isXMLDoc = t.isXML, o.contains = t.contains;
var u = o.expr.match.needsContext,
v = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
w = /^.[^:#\[\.,]*$/;
function x(a, b, c) {
if (o.isFunction(b)) return o.grep(a, function(a, d) {
return !!b.call(a, d, a) !== c
});
if (b.nodeType) return o.grep(a, function(a) {
return a === b !== c
});
if ("string" == typeof b) {
if (w.test(b)) return o.filter(b, a, c);
b = o.filter(b, a)
}
return o.grep(a, function(a) {
return g.call(b, a) >= 0 !== c
})
}
o.filter = function(a, b, c) {
var d = b[0];
return c && (a = ":not(" + a + ")"), 1 === b.length && 1 === d.nodeType ? o.find.matchesSelector(d, a) ? [d] : [] : o.find.matches(a, o.grep(b, function(a) {
return 1 === a.nodeType
}))
}, o.fn.extend({
find: function(a) {
var b, c = this.length,
d = [],
e = this;
if ("string" != typeof a) return this.pushStack(o(a).filter(function() {
for (b = 0; c > b; b++)
if (o.contains(e[b], this)) return !0
}));
for (b = 0; c > b; b++) o.find(a, e[b], d);
return d = this.pushStack(c > 1 ? o.unique(d) : d), d.selector = this.selector ? this.selector + " " + a : a, d
},
filter: function(a) {
return this.pushStack(x(this, a || [], !1))
},
not: function(a) {
return this.pushStack(x(this, a || [], !0))
},
is: function(a) {
return !!x(this, "string" == typeof a && u.test(a) ? o(a) : a || [], !1).length
}
});
var y, z = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
A = o.fn.init = function(a, b) {
var c, d;
if (!a) return this;
if ("string" == typeof a) {
if (c = "<" === a[0] && ">" === a[a.length - 1] && a.length >= 3 ? [null, a, null] : z.exec(a), !c || !c[1] && b) return !b || b.jquery ? (b || y).find(a) : this.constructor(b).find(a);
if (c[1]) {
if (b = b instanceof o ? b[0] : b, o.merge(this, o.parseHTML(c[1], b && b.nodeType ? b.ownerDocument || b : m, !0)), v.test(c[1]) && o.isPlainObject(b))
for (c in b) o.isFunction(this[c]) ? this[c](b[c]) : this.attr(c, b[c]);
return this
}
return d = m.getElementById(c[2]), d && d.parentNode && (this.length = 1, this[0] = d), this.context = m, this.selector = a, this
}
return a.nodeType ? (this.context = this[0] = a, this.length = 1, this) : o.isFunction(a) ? "undefined" != typeof y.ready ? y.ready(a) : a(o) : (void 0 !== a.selector && (this.selector = a.selector, this.context = a.context), o.makeArray(a, this))
};
A.prototype = o.fn, y = o(m);
var B = /^(?:parents|prev(?:Until|All))/,
C = {
children: !0,
contents: !0,
next: !0,
prev: !0
};
o.extend({
dir: function(a, b, c) {
var d = [],
e = void 0 !== c;
while ((a = a[b]) && 9 !== a.nodeType)
if (1 === a.nodeType) {
if (e && o(a).is(c)) break;
d.push(a)
}
return d
},
sibling: function(a, b) {
for (var c = []; a; a = a.nextSibling) 1 === a.nodeType && a !== b && c.push(a);
return c
}
}), o.fn.extend({
has: function(a) {
var b = o(a, this),
c = b.length;
return this.filter(function() {
for (var a = 0; c > a; a++)
if (o.contains(this, b[a])) return !0
})
},
closest: function(a, b) {
for (var c, d = 0, e = this.length, f = [], g = u.test(a) || "string" != typeof a ? o(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 && o.find.matchesSelector(c, a))) {
f.push(c);
break
}
return this.pushStack(f.length > 1 ? o.unique(f) : f)
},
index: function(a) {
return a ? "string" == typeof a ? g.call(o(a), this[0]) : g.call(this, a.jquery ? a[0] : a) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1
},
add: function(a, b) {
return this.pushStack(o.unique(o.merge(this.get(), o(a, b))))
},
addBack: function(a) {
return this.add(null == a ? this.prevObject : this.prevObject.filter(a))
}
});
function D(a, b) {
while ((a = a[b]) && 1 !== a.nodeType);
return a
}
o.each({
parent: function(a) {
var b = a.parentNode;
return b && 11 !== b.nodeType ? b : null
},
parents: function(a) {
return o.dir(a, "parentNode")
},
parentsUntil: function(a, b, c) {
return o.dir(a, "parentNode", c)
},
next: function(a) {
return D(a, "nextSibling")
},
prev: function(a) {
return D(a, "previousSibling")
},
nextAll: function(a) {
return o.dir(a, "nextSibling")
},
prevAll: function(a) {
return o.dir(a, "previousSibling")
},
nextUntil: function(a, b, c) {
return o.dir(a, "nextSibling", c)
},
prevUntil: function(a, b, c) {
return o.dir(a, "previousSibling", c)
},
siblings: function(a) {
return o.sibling((a.parentNode || {}).firstChild, a)
},
children: function(a) {
return o.sibling(a.firstChild)
},
contents: function(a) {
return a.contentDocument || o.merge([], a.childNodes)
}
}, function(a, b) {
o.fn[a] = function(c, d) {
var e = o.map(this, b, c);
return "Until" !== a.slice(-5) && (d = c), d && "string" == typeof d && (e = o.filter(d, e)), this.length > 1 && (C[a] || o.unique(e), B.test(a) && e.reverse()), this.pushStack(e)
}
});
var E = /\S+/g,
F = {};
function G(a) {
var b = F[a] = {};
return o.each(a.match(E) || [], function(a, c) {
b[c] = !0
}), b
}
o.Callbacks = function(a) {
a = "string" == typeof a ? F[a] || G(a) : o.extend({}, a);
var b, c, d, e, f, g, h = [],
i = !a.once && [],
j = function(l) {
for (b = a.memory && l, c = !0, g = e || 0, e = 0, f = h.length, d = !0; h && f > g; g++)
if (h[g].apply(l[0], l[1]) === !1 && a.stopOnFalse) {
b = !1;
break
}
d = !1, h && (i ? i.length && j(i.shift()) : b ? h = [] : k.disable())
},
k = {
add: function() {
if (h) {
var c = h.length;
! function g(b) {
o.each(b, function(b, c) {
var d = o.type(c);
"function" === d ? a.unique && k.has(c) || h.push(c) : c && c.length && "string" !== d && g(c)
})
}(arguments), d ? f = h.length : b && (e = c, j(b))
}
return this
},
remove: function() {
return h && o.each(arguments, function(a, b) {
var c;
while ((c = o.inArray(b, h, c)) > -1) h.splice(c, 1), d && (f >= c && f--, g >= c && g--)
}), this
},
has: function(a) {
return a ? o.inArray(a, h) > -1 : !(!h || !h.length)
},
empty: function() {
return h = [], f = 0, this
},
disable: function() {
return h = i = b = void 0, this
},
disabled: function() {
return !h
},
lock: function() {
return i = void 0, b || k.disable(), this
},
locked: function() {
return !i
},
fireWith: function(a, b) {
return !h || c && !i || (b = b || [], b = [a, b.slice ? b.slice() : b], d ? i.push(b) : j(b)), this
},
fire: function() {
return k.fireWith(this, arguments), this
},
fired: function() {
return !!c
}
};
return k
}, o.extend({
Deferred: function(a) {
var b = [
["resolve", "done", o.Callbacks("once memory"), "resolved"],
["reject", "fail", o.Callbacks("once memory"), "rejected"],
["notify", "progress", o.Callbacks("memory")]
],
c = "pending",
d = {
state: function() {
return c
},
always: function() {
return e.done(arguments).fail(arguments), this
},
then: function() {
var a = arguments;
return o.Deferred(function(c) {
o.each(b, function(b, f) {
var g = o.isFunction(a[b]) && a[b];
e[f[1]](function() {
var a = g && g.apply(this, arguments);
a && o.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 ? o.extend(a, d) : d
}
},
e = {};
return d.pipe = d.then, o.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 && o.isFunction(a.promise) ? e : 0,
g = 1 === f ? a : o.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] && o.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;
o.fn.ready = function(a) {
return o.ready.promise().done(a), this
}, o.extend({
isReady: !1,
readyWait: 1,
holdReady: function(a) {
a ? o.readyWait++ : o.ready(!0)
},
ready: function(a) {
(a === !0 ? --o.readyWait : o.isReady) || (o.isReady = !0, a !== !0 && --o.readyWait > 0 || (H.resolveWith(m, [o]), o.fn.trigger && o(m).trigger("ready").off("ready")))
}
});
function I() {
m.removeEventListener("DOMContentLoaded", I, !1), a.removeEventListener("load", I, !1), o.ready()
}
o.ready.promise = function(b) {
return H || (H = o.Deferred(), "complete" === m.readyState ? setTimeout(o.ready) : (m.addEventListener("DOMContentLoaded", I, !1), a.addEventListener("load", I, !1))), H.promise(b)
}, o.ready.promise();
var J = o.access = function(a, b, c, d, e, f, g) {
var h = 0,
i = a.length,
j = null == c;
if ("object" === o.type(c)) {
e = !0;
for (h in c) o.access(a, b, h, c[h], !0, f, g)
} else if (void 0 !== d && (e = !0, o.isFunction(d) || (g = !0), j && (g ? (b.call(a, d), b = null) : (j = b, b = function(a, b, c) {
return j.call(o(a), c)
})), b))
for (; i > h; 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
};
o.acceptData = function(a) {
return 1 === a.nodeType || 9 === a.nodeType || !+a.nodeType
};
function K() {
Object.defineProperty(this.cache = {}, 0, {
get: function() {
return {}
}
}), this.expando = o.expando + Math.random()
}
K.uid = 1, K.accepts = o.acceptData, K.prototype = {
key: function(a) {
if (!K.accepts(a)) return 0;
var b = {},
c = a[this.expando];
if (!c) {
c = K.uid++;
try {
b[this.expando] = {
value: c
}, Object.defineProperties(a, b)
} catch (d) {
b[this.expando] = c, o.extend(a, b)
}
}
return this.cache[c] || (this.cache[c] = {}), c
},
set: function(a, b, c) {
var d, e = this.key(a),
f = this.cache[e];
if ("string" == typeof b) f[b] = c;
else if (o.isEmptyObject(f)) o.extend(this.cache[e], b);
else
for (d in b) f[d] = b[d];
return f
},
get: function(a, b) {
var c = this.cache[this.key(a)];
return void 0 === b ? c : c[b]
},
access: function(a, b, c) {
var d;
return void 0 === b || b && "string" == typeof b && void 0 === c ? (d = this.get(a, b), void 0 !== d ? d : this.get(a, o.camelCase(b))) : (this.set(a, b, c), void 0 !== c ? c : b)
},
remove: function(a, b) {
var c, d, e, f = this.key(a),
g = this.cache[f];
if (void 0 === b) this.cache[f] = {};
else {
o.isArray(b) ? d = b.concat(b.map(o.camelCase)) : (e = o.camelCase(b), b in g ? d = [b, e] : (d = e, d = d in g ? [d] : d.match(E) || [])), c = d.length;
while (c--) delete g[d[c]]
}
},
hasData: function(a) {
return !o.isEmptyObject(this.cache[a[this.expando]] || {})
},
discard: function(a) {
a[this.expando] && delete this.cache[a[this.expando]]
}
};
var L = new K,
M = new K,
N = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
O = /([A-Z])/g;
function P(a, b, c) {
var d;
if (void 0 === c && 1 === a.nodeType)
if (d = "data-" + b.replace(O, "-$1").toLowerCase(), c = a.getAttribute(d), "string" == typeof c) {
try {
c = "true" === c ? !0 : "false" === c ? !1 : "null" === c ? null : +c + "" === c ? +c : N.test(c) ? o.parseJSON(c) : c
} catch (e) {}
M.set(a, b, c)
} else c = void 0;
return c
}
o.extend({
hasData: function(a) {
return M.hasData(a) || L.hasData(a)
},
data: function(a, b, c) {
return M.access(a, b, c)
},
removeData: function(a, b) {
M.remove(a, b)
},
_data: function(a, b, c) {
return L.access(a, b, c)
},
_removeData: function(a, b) {
L.remove(a, b)
}
}), o.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.get(f), 1 === f.nodeType && !L.get(f, "hasDataAttrs"))) {
c = g.length;
while (c--) d = g[c].name, 0 === d.indexOf("data-") && (d = o.camelCase(d.slice(5)), P(f, d, e[d]));
L.set(f, "hasDataAttrs", !0)
}
return e
}
return "object" == typeof a ? this.each(function() {
M.set(this, a)
}) : J(this, function(b) {
var c, d = o.camelCase(a);
if (f && void 0 === b) {
if (c = M.get(f, a), void 0 !== c) return c;
if (c = M.get(f, d), void 0 !== c) return c;
if (c = P(f, d, void 0), void 0 !== c) return c
} else this.each(function() {
var c = M.get(this, d);
M.set(this, d, b), -1 !== a.indexOf("-") && void 0 !== c && M.set(this, a, b)
})
}, null, b, arguments.length > 1, null, !0)
},
removeData: function(a) {
return this.each(function() {
M.remove(this, a)
})
}
}), o.extend({
queue: function(a, b, c) {
var d;
return a ? (b = (b || "fx") + "queue", d = L.get(a, b), c && (!d || o.isArray(c) ? d = L.access(a, b, o.makeArray(c)) : d.push(c)), d || []) : void 0
},
dequeue: function(a, b) {
b = b || "fx";
var c = o.queue(a, b),
d = c.length,
e = c.shift(),
f = o._queueHooks(a, b),
g = function() {
o.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 L.get(a, c) || L.access(a, c, {
empty: o.Callbacks("once memory").add(function() {
L.remove(a, [b + "queue", c])
})
})
}
}), o.fn.extend({
queue: function(a, b) {
var c = 2;
return "string" != typeof a && (b = a, a = "fx", c--), arguments.length < c ? o.queue(this[0], a) : void 0 === b ? this : this.each(function() {
var c = o.queue(this, a, b);
o._queueHooks(this, a), "fx" === a && "inprogress" !== c[0] && o.dequeue(this, a)
})
},
dequeue: function(a) {
return this.each(function() {
o.dequeue(this, a)
})
},
clearQueue: function(a) {
return this.queue(a || "fx", [])
},
promise: function(a, b) {
var c, d = 1,
e = o.Deferred(),
f = this,
g = this.length,
h = function() {
--d || e.resolveWith(f, [f])
};
"string" != typeof a && (b = a, a = void 0), a = a || "fx";
while (g--) c = L.get(f[g], a + "queueHooks"), c && c.empty && (d++, c.empty.add(h));
return h(), e.promise(b)
}
});
var Q = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
R = ["Top", "Right", "Bottom", "Left"],
S = function(a, b) {
return a = b || a, "none" === o.css(a, "display") || !o.contains(a.ownerDocument, a)
},
T = /^(?:checkbox|radio)$/i;
! function() {
var a = m.createDocumentFragment(),
b = a.appendChild(m.createElement("div"));
b.innerHTML = "<input type='radio' checked='checked' name='t'/>", l.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, b.innerHTML = "<textarea>x</textarea>", l.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue
}();
var U = "undefined";
l.focusinBubbles = "onfocusin" in a;
var V = /^key/,
W = /^(?:mouse|contextmenu)|click/,
X = /^(?:focusinfocus|focusoutblur)$/,
Y = /^([^.]*)(?:\.(.+)|)$/;
function Z() {
return !0
}
function $() {
return !1
}
function _() {
try {
return m.activeElement
} catch (a) {}
}
o.event = {
global: {},
add: function(a, b, c, d, e) {
var f, g, h, i, j, k, l, m, n, p, q, r = L.get(a);
if (r) {
c.handler && (f = c, c = f.handler, e = f.selector), c.guid || (c.guid = o.guid++), (i = r.events) || (i = r.events = {}), (g = r.handle) || (g = r.handle = function(b) {
return typeof o !== U && o.event.triggered !== b.type ? o.event.dispatch.apply(a, arguments) : void 0
}), b = (b || "").match(E) || [""], j = b.length;
while (j--) h = Y.exec(b[j]) || [], n = q = h[1], p = (h[2] || "").split(".").sort(), n && (l = o.event.special[n] || {}, n = (e ? l.delegateType : l.bindType) || n, l = o.event.special[n] || {}, k = o.extend({
type: n,
origType: q,
data: d,
handler: c,
guid: c.guid,
selector: e,
needsContext: e && o.expr.match.needsContext.test(e),
namespace: p.join(".")
}, f), (m = i[n]) || (m = i[n] = [], m.delegateCount = 0, l.setup && l.setup.call(a, d, p, g) !== !1 || a.addEventListener && a.addEventListener(n, g, !1)), l.add && (l.add.call(a, k), k.handler.guid || (k.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, k) : m.push(k), o.event.global[n] = !0)
}
},
remove: function(a, b, c, d, e) {
var f, g, h, i, j, k, l, m, n, p, q, r = L.hasData(a) && L.get(a);
if (r && (i = r.events)) {
b = (b || "").match(E) || [""], j = b.length;
while (j--)
if (h = Y.exec(b[j]) || [], n = q = h[1], p = (h[2] || "").split(".").sort(), n) {
l = o.event.special[n] || {}, n = (d ? l.delegateType : l.bindType) || n, m = i[n] || [], h = h[2] && new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)"), g = f = m.length;
while (f--) k = m[f], !e && q !== k.origType || c && c.guid !== k.guid || h && !h.test(k.namespace) || d && d !== k.selector && ("**" !== d || !k.selector) || (m.splice(f, 1), k.selector && m.delegateCount--, l.remove && l.remove.call(a, k));
g && !m.length && (l.teardown && l.teardown.call(a, p, r.handle) !== !1 || o.removeEvent(a, n, r.handle), delete i[n])
} else
for (n in i) o.event.remove(a, n + b[j], c, d, !0);
o.isEmptyObject(i) && (delete r.handle, L.remove(a, "events"))
}
},
trigger: function(b, c, d, e) {
var f, g, h, i, k, l, n, p = [d || m],
q = j.call(b, "type") ? b.type : b,
r = j.call(b, "namespace") ? b.namespace.split(".") : [];
if (g = h = d = d || m, 3 !== d.nodeType && 8 !== d.nodeType && !X.test(q + o.event.triggered) && (q.indexOf(".") >= 0 && (r = q.split("."), q = r.shift(), r.sort()), k = q.indexOf(":") < 0 && "on" + q, b = b[o.expando] ? b : new o.Event(q, "object" == typeof b && b), b.isTrigger = e ? 2 : 3, b.namespace = r.join("."), b.namespace_re = b.namespace ? new RegExp("(^|\\.)" + r.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, b.result = void 0, b.target || (b.target = d), c = null == c ? [b] : o.makeArray(c, [b]), n = o.event.special[q] || {}, e || !n.trigger || n.trigger.apply(d, c) !== !1)) {
if (!e && !n.noBubble && !o.isWindow(d)) {
for (i = n.delegateType || q, X.test(i + q) || (g = g.parentNode); g; g = g.parentNode) p.push(g), h = g;
h === (d.ownerDocument || m) && p.push(h.defaultView || h.parentWindow || a)
}
f = 0;
while ((g = p[f++]) && !b.isPropagationStopped()) b.type = f > 1 ? i : n.bindType || q, l = (L.get(g, "events") || {})[b.type] && L.get(g, "handle"), l && l.apply(g, c), l = k && g[k], l && l.apply && o.acceptData(g) && (b.result = l.apply(g, c), b.result === !1 && b.preventDefault());
return b.type = q, e || b.isDefaultPrevented() || n._default && n._default.apply(p.pop(), c) !== !1 || !o.acceptData(d) || k && o.isFunction(d[q]) && !o.isWindow(d) && (h = d[k], h && (d[k] = null), o.event.triggered = q, d[q](), o.event.triggered = void 0, h && (d[k] = h)), b.result
}
},
dispatch: function(a) {
a = o.event.fix(a);
var b, c, e, f, g, h = [],
i = d.call(arguments),
j = (L.get(this, "events") || {})[a.type] || [],
k = o.event.special[a.type] || {};
if (i[0] = a, a.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, a) !== !1) {
h = o.event.handlers.call(this, a, j), b = 0;
while ((f = h[b++]) && !a.isPropagationStopped()) {
a.currentTarget = f.elem, c = 0;
while ((g = f.handlers[c++]) && !a.isImmediatePropagationStopped())(!a.namespace_re || a.namespace_re.test(g.namespace)) && (a.handleObj = g, a.data = g.data, e = ((o.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, i), void 0 !== e && (a.result = e) === !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 (i.disabled !== !0 || "click" !== a.type) {
for (d = [], c = 0; h > c; c++) f = b[c], e = f.selector + " ", void 0 === d[e] && (d[e] = f.needsContext ? o(e, this).index(i) >= 0 : o.find(e, this, null, [i]).length), d[e] && d.push(f);
d.length && g.push({
elem: i,
handlers: d
})
}
return h < b.length && g.push({
elem: this,
handlers: b.slice(h)
}), g
},
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function(a, b) {
return null == a.which && (a.which = null != b.charCode ? b.charCode : b.keyCode), a
}
},
mouseHooks: {
props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function(a, b) {
var c, d, e, f = b.button;
return null == a.pageX && null != b.clientX && (c = a.target.ownerDocument || m, d = c.documentElement, e = c.body, a.pageX = b.clientX + (d && d.scrollLeft || e && e.scrollLeft || 0) - (d && d.clientLeft || e && e.clientLeft || 0), a.pageY = b.clientY + (d && d.scrollTop || e && e.scrollTop || 0) - (d && d.clientTop || e && e.clientTop || 0)), a.which || void 0 === f || (a.which = 1 & f ? 1 : 2 & f ? 3 : 4 & f ? 2 : 0), a
}
},
fix: function(a) {
if (a[o.expando]) return a;
var b, c, d, e = a.type,
f = a,
g = this.fixHooks[e];
g || (this.fixHooks[e] = g = W.test(e) ? this.mouseHooks : V.test(e) ? this.keyHooks : {}), d = g.props ? this.props.concat(g.props) : this.props, a = new o.Event(f), b = d.length;
while (b--) c = d[b], a[c] = f[c];
return a.target || (a.target = m), 3 === a.target.nodeType && (a.target = a.target.parentNode), g.filter ? g.filter(a, f) : a
},
special: {
load: {
noBubble: !0
},
focus: {
trigger: function() {
return this !== _() && this.focus ? (this.focus(), !1) : void 0
},
delegateType: "focusin"
},
blur: {
trigger: function() {
return this === _() && this.blur ? (this.blur(), !1) : void 0
},
delegateType: "focusout"
},
click: {
trigger: function() {
return "checkbox" === this.type && this.click && o.nodeName(this, "input") ? (this.click(), !1) : void 0
},
_default: function(a) {
return o.nodeName(a.target, "a")
}
},
beforeunload: {
postDispatch: function(a) {
void 0 !== a.result && (a.originalEvent.returnValue = a.result)
}
}
},
simulate: function(a, b, c, d) {
var e = o.extend(new o.Event, c, {
type: a,
isSimulated: !0,
originalEvent: {}
});
d ? o.event.trigger(e, null, b) : o.event.dispatch.call(b, e), e.isDefaultPrevented() && c.preventDefault()
}
}, o.removeEvent = function(a, b, c) {
a.removeEventListener && a.removeEventListener(b, c, !1)
}, o.Event = function(a, b) {
return this instanceof o.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.getPreventDefault && a.getPreventDefault() ? Z : $) : this.type = a, b && o.extend(this, b), this.timeStamp = a && a.timeStamp || o.now(), void(this[o.expando] = !0)) : new o.Event(a, b)
}, o.Event.prototype = {
isDefaultPrevented: $,
isPropagationStopped: $,
isImmediatePropagationStopped: $,
preventDefault: function() {
var a = this.originalEvent;
this.isDefaultPrevented = Z, a && a.preventDefault && a.preventDefault()
},
stopPropagation: function() {
var a = this.originalEvent;
this.isPropagationStopped = Z, a && a.stopPropagation && a.stopPropagation()
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = Z, this.stopPropagation()
}
}, o.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function(a, b) {
o.event.special[a] = {
delegateType: b,
bindType: b,
handle: function(a) {
var c, d = this,
e = a.relatedTarget,
f = a.handleObj;
return (!e || e !== d && !o.contains(d, e)) && (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c
}
}
}), l.focusinBubbles || o.each({
focus: "focusin",
blur: "focusout"
}, function(a, b) {
var c = function(a) {
o.event.simulate(b, a.target, o.event.fix(a), !0)
};
o.event.special[b] = {
setup: function() {
var d = this.ownerDocument || this,
e = L.access(d, b);
e || d.addEventListener(a, c, !0), L.access(d, b, (e || 0) + 1)
},
teardown: function() {
var d = this.ownerDocument || this,
e = L.access(d, b) - 1;
e ? L.access(d, b, e) : (d.removeEventListener(a, c, !0), L.remove(d, b))
}
}
}), o.fn.extend({
on: function(a, b, c, d, e) {
var f, g;
if ("object" == typeof a) {
"string" != typeof b && (c = c || b, b = void 0);
for (g in a) this.on(g, b, c, a[g], e);
return this
}
if (null == c && null == d ? (d = b, c = b = void 0) : null == d && ("string" == typeof b ? (d = c, c = void 0) : (d = c, c = b, b = void 0)), d === !1) d = $;
else if (!d) return this;
return 1 === e && (f = d, d = function(a) {
return o().off(a), f.apply(this, arguments)
}, d.guid = f.guid || (f.guid = o.guid++)), this.each(function() {
o.event.add(this, a, d, c, b)
})
},
one: function(a, b, c, d) {
return this.on(a, b, c, d, 1)
},
off: function(a, b, c) {
var d, e;
if (a && a.preventDefault && a.handleObj) return d = a.handleObj, o(a.delegateTarget).off(d.namespace ? d.origType + "." + d.namespace : d.origType, d.selector, d.handler), this;
if ("object" == typeof a) {
for (e in a) this.off(e, b, a[e]);
return this
}
return (b === !1 || "function" == typeof b) && (c = b, b = void 0), c === !1 && (c = $), this.each(function() {
o.event.remove(this, a, c, b)
})
},
trigger: function(a, b) {
return this.each(function() {
o.event.trigger(a, b, this)
})
},
triggerHandler: function(a, b) {
var c = this[0];
return c ? o.event.trigger(a, b, c, !0) : void 0
}
});
var ab = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
bb = /<([\w:]+)/,
cb = /<|&#?\w+;/,
db = /<(?:script|style|link)/i,
eb = /checked\s*(?:[^=]|=\s*.checked.)/i,
fb = /^$|\/(?:java|ecma)script/i,
gb = /^true\/(.*)/,
hb = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
ib = {
option: [1, "<select multiple='multiple'>", "</select>"],
thead: [1, "<table>", "</table>"],
col: [2, "<table><colgroup>", "</colgroup></table>"],
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
_default: [0, "", ""]
};
ib.optgroup = ib.option, ib.tbody = ib.tfoot = ib.colgroup = ib.caption = ib.thead, ib.th = ib.td;
function jb(a, b) {
return o.nodeName(a, "table") && o.nodeName(11 !== b.nodeType ? b : b.firstChild, "tr") ? a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")) : a
}
function kb(a) {
return a.type = (null !== a.getAttribute("type")) + "/" + a.type, a
}
function lb(a) {
var b = gb.exec(a.type);
return b ? a.type = b[1] : a.removeAttribute("type"), a
}
function mb(a, b) {
for (var c = 0, d = a.length; d > c; c++) L.set(a[c], "globalEval", !b || L.get(b[c], "globalEval"))
}
function nb(a, b) {
var c, d, e, f, g, h, i, j;
if (1 === b.nodeType) {
if (L.hasData(a) && (f = L.access(a), g = L.set(b, f), j = f.events)) {
delete g.handle, g.events = {};
for (e in j)
for (c = 0, d = j[e].length; d > c; c++) o.event.add(b, e, j[e][c])
}
M.hasData(a) && (h = M.access(a), i = o.extend({}, h), M.set(b, i))
}
}
function ob(a, b) {
var c = a.getElementsByTagName ? a.getElementsByTagName(b || "*") : a.querySelectorAll ? a.querySelectorAll(b || "*") : [];
return void 0 === b || b && o.nodeName(a, b) ? o.merge([a], c) : c
}
function pb(a, b) {
var c = b.nodeName.toLowerCase();
"input" === c && T.test(a.type) ? b.checked = a.checked : ("input" === c || "textarea" === c) && (b.defaultValue = a.defaultValue)
}
o.extend({
clone: function(a, b, c) {
var d, e, f, g, h = a.cloneNode(!0),
i = o.contains(a.ownerDocument, a);
if (!(l.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || o.isXMLDoc(a)))
for (g = ob(h), f = ob(a), d = 0, e = f.length; e > d; d++) pb(f[d], g[d]);
if (b)
if (c)
for (f = f || ob(a), g = g || ob(h), d = 0, e = f.length; e > d; d++) nb(f[d], g[d]);
else nb(a, h);
return g = ob(h, "script"), g.length > 0 && mb(g, !i && ob(a, "script")), h
},
buildFragment: function(a, b, c, d) {
for (var e, f, g, h, i, j, k = b.createDocumentFragment(), l = [], m = 0, n = a.length; n > m; m++)
if (e = a[m], e || 0 === e)
if ("object" === o.type(e)) o.merge(l, e.nodeType ? [e] : e);
else if (cb.test(e)) {
f = f || k.appendChild(b.createElement("div")), g = (bb.exec(e) || ["", ""])[1].toLowerCase(), h = ib[g] || ib._default, f.innerHTML = h[1] + e.replace(ab, "<$1></$2>") + h[2], j = h[0];
while (j--) f = f.lastChild;
o.merge(l, f.childNodes), f = k.firstChild, f.textContent = ""
} else l.push(b.createTextNode(e));
k.textContent = "", m = 0;
while (e = l[m++])
if ((!d || -1 === o.inArray(e, d)) && (i = o.contains(e.ownerDocument, e), f = ob(k.appendChild(e), "script"), i && mb(f), c)) {
j = 0;
while (e = f[j++]) fb.test(e.type || "") && c.push(e)
}
return k
},
cleanData: function(a) {
for (var b, c, d, e, f, g, h = o.event.special, i = 0; void 0 !== (c = a[i]); i++) {
if (o.acceptData(c) && (f = c[L.expando], f && (b = L.cache[f]))) {
if (d = Object.keys(b.events || {}), d.length)
for (g = 0; void 0 !== (e = d[g]); g++) h[e] ? o.event.remove(c, e) : o.removeEvent(c, e, b.handle);
L.cache[f] && delete L.cache[f]
}
delete M.cache[c[M.expando]]
}
}
}), o.fn.extend({
text: function(a) {
return J(this, function(a) {
return void 0 === a ? o.text(this) : this.empty().each(function() {
(1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && (this.textContent = 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 = jb(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 = jb(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 ? o.filter(a, this) : this, e = 0; null != (c = d[e]); e++) b || 1 !== c.nodeType || o.cleanData(ob(c)), c.parentNode && (b && o.contains(c.ownerDocument, c) && mb(ob(c, "script")), c.parentNode.removeChild(c));
return this
},
empty: function() {
for (var a, b = 0; null != (a = this[b]); b++) 1 === a.nodeType && (o.cleanData(ob(a, !1)), a.textContent = "");
return this
},
clone: function(a, b) {
return a = null == a ? !1 : a, b = null == b ? a : b, this.map(function() {
return o.clone(this, a, b)
})
},
html: function(a) {
return J(this, function(a) {
var b = this[0] || {},
c = 0,
d = this.length;
if (void 0 === a && 1 === b.nodeType) return b.innerHTML;
if ("string" == typeof a && !db.test(a) && !ib[(bb.exec(a) || ["", ""])[1].toLowerCase()]) {
a = a.replace(ab, "<$1></$2>");
try {
for (; d > c; c++) b = this[c] || {}, 1 === b.nodeType && (o.cleanData(ob(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, o.cleanData(ob(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,
k = this.length,
m = this,
n = k - 1,
p = a[0],
q = o.isFunction(p);
if (q || k > 1 && "string" == typeof p && !l.checkClone && eb.test(p)) return this.each(function(c) {
var d = m.eq(c);
q && (a[0] = p.call(this, c, d.html())), d.domManip(a, b)
});
if (k && (c = o.buildFragment(a, this[0].ownerDocument, !1, this), d = c.firstChild, 1 === c.childNodes.length && (c = d), d)) {
for (f = o.map(ob(c, "script"), kb), g = f.length; k > j; j++) h = c, j !== n && (h = o.clone(h, !0, !0), g && o.merge(f, ob(h, "script"))), b.call(this[j], h, j);
if (g)
for (i = f[f.length - 1].ownerDocument, o.map(f, lb), j = 0; g > j; j++) h = f[j], fb.test(h.type || "") && !L.access(h, "globalEval") && o.contains(i, h) && (h.src ? o._evalUrl && o._evalUrl(h.src) : o.globalEval(h.textContent.replace(hb, "")))
}
return this
}
}), o.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(a, b) {
o.fn[a] = function(a) {
for (var c, d = [], e = o(a), g = e.length - 1, h = 0; g >= h; h++) c = h === g ? this : this.clone(!0), o(e[h])[b](c), f.apply(d, c.get());
return this.pushStack(d)
}
});
var qb, rb = {};
function sb(b, c) {
var d = o(c.createElement(b)).appendTo(c.body),
e = a.getDefaultComputedStyle ? a.getDefaultComputedStyle(d[0]).display : o.css(d[0], "display");
return d.detach(), e
}
function tb(a) {
var b = m,
c = rb[a];
return c || (c = sb(a, b), "none" !== c && c || (qb = (qb || o("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement), b = qb[0].contentDocument, b.write(), b.close(), c = sb(a, b), qb.detach()), rb[a] = c), c
}
var ub = /^margin/,
vb = new RegExp("^(" + Q + ")(?!px)[a-z%]+$", "i"),
wb = function(a) {
return a.ownerDocument.defaultView.getComputedStyle(a, null)
};
function xb(a, b, c) {
var d, e, f, g, h = a.style;
return c = c || wb(a), c && (g = c.getPropertyValue(b) || c[b]), c && ("" !== g || o.contains(a.ownerDocument, a) || (g = o.style(a, b)), vb.test(g) && ub.test(b) && (d = h.width, e = h.minWidth, f = h.maxWidth, h.minWidth = h.maxWidth = h.width = g, g = c.width, h.width = d, h.minWidth = e, h.maxWidth = f)), void 0 !== g ? g + "" : g
}
function yb(a, b) {
return {
get: function() {
return a() ? void delete this.get : (this.get = b).apply(this, arguments)
}
}
}! function() {
var b, c, d = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",
e = m.documentElement,
f = m.createElement("div"),
g = m.createElement("div");
g.style.backgroundClip = "content-box", g.cloneNode(!0).style.backgroundClip = "", l.clearCloneStyle = "content-box" === g.style.backgroundClip, f.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", f.appendChild(g);
function h() {
g.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%", e.appendChild(f);
var d = a.getComputedStyle(g, null);
b = "1%" !== d.top, c = "4px" === d.width, e.removeChild(f)
}
a.getComputedStyle && o.extend(l, {
pixelPosition: function() {
return h(), b
},
boxSizingReliable: function() {
return null == c && h(), c
},
reliableMarginRight: function() {
var b, c = g.appendChild(m.createElement("div"));
return c.style.cssText = g.style.cssText = d, c.style.marginRight = c.style.width = "0", g.style.width = "1px", e.appendChild(f), b = !parseFloat(a.getComputedStyle(c, null).marginRight), e.removeChild(f), g.innerHTML = "", b
}
})
}(), o.swap = function(a, b, c, d) {
var e, f, g = {};
for (f in b) g[f] = a.style[f], a.style[f] = b[f];
e = c.apply(a, d || []);
for (f in b) a.style[f] = g[f];
return e
};
var zb = /^(none|table(?!-c[ea]).+)/,
Ab = new RegExp("^(" + Q + ")(.*)$", "i"),
Bb = new RegExp("^([+-])=(" + Q + ")", "i"),
Cb = {
position: "absolute",
visibility: "hidden",
display: "block"
},
Db = {
letterSpacing: 0,
fontWeight: 400
},
Eb = ["Webkit", "O", "Moz", "ms"];
function Fb(a, b) {
if (b in a) return b;
var c = b[0].toUpperCase() + b.slice(1),
d = b,
e = Eb.length;
while (e--)
if (b = Eb[e] + c, b in a) return b;
return d
}
function Gb(a, b, c) {
var d = Ab.exec(b);
return d ? Math.max(0, d[1] - (c || 0)) + (d[2] || "px") : b
}
function Hb(a, b, c, d, e) {
for (var f = c === (d ? "border" : "content") ? 4 : "width" === b ? 1 : 0, g = 0; 4 > f; f += 2) "margin" === c && (g += o.css(a, c + R[f], !0, e)), d ? ("content" === c && (g -= o.css(a, "padding" + R[f], !0, e)), "margin" !== c && (g -= o.css(a, "border" + R[f] + "Width", !0, e))) : (g += o.css(a, "padding" + R[f], !0, e), "padding" !== c && (g += o.css(a, "border" + R[f] + "Width", !0, e)));
return g
}
function Ib(a, b, c) {
var d = !0,
e = "width" === b ? a.offsetWidth : a.offsetHeight,
f = wb(a),
g = "border-box" === o.css(a, "boxSizing", !1, f);
if (0 >= e || null == e) {
if (e = xb(a, b, f), (0 > e || null == e) && (e = a.style[b]), vb.test(e)) return e;
d = g && (l.boxSizingReliable() || e === a.style[b]), e = parseFloat(e) || 0
}
return e + Hb(a, b, c || (g ? "border" : "content"), d, f) + "px"
}
function Jb(a, b) {
for (var c, d, e, f = [], g = 0, h = a.length; h > g; g++) d = a[g], d.style && (f[g] = L.get(d, "olddisplay"), c = d.style.display, b ? (f[g] || "none" !== c || (d.style.display = ""), "" === d.style.display && S(d) && (f[g] = L.access(d, "olddisplay", tb(d.nodeName)))) : f[g] || (e = S(d), (c && "none" !== c || !e) && L.set(d, "olddisplay", e ? c : o.css(d, "display"))));
for (g = 0; h > g; g++) d = a[g], d.style && (b && "none" !== d.style.display && "" !== d.style.display || (d.style.display = b ? f[g] || "" : "none"));
return a
}
o.extend({
cssHooks: {
opacity: {
get: function(a, b) {
if (b) {
var c = xb(a, "opacity");
return "" === c ? "1" : c
}
}
}
},
cssNumber: {
columnCount: !0,
fillOpacity: !0,
fontWeight: !0,
lineHeight: !0,
opacity: !0,
order: !0,
orphans: !0,
widows: !0,
zIndex: !0,
zoom: !0
},
cssProps: {
"float": "cssFloat"
},
style: function(a, b, c, d) {
if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) {
var e, f, g, h = o.camelCase(b),
i = a.style;
return b = o.cssProps[h] || (o.cssProps[h] = Fb(i, h)), g = o.cssHooks[b] || o.cssHooks[h], void 0 === c ? g && "get" in g && void 0 !== (e = g.get(a, !1, d)) ? e : i[b] : (f = typeof c, "string" === f && (e = Bb.exec(c)) && (c = (e[1] + 1) * e[2] + parseFloat(o.css(a, b)), f = "number"), null != c && c === c && ("number" !== f || o.cssNumber[h] || (c += "px"), l.clearCloneStyle || "" !== c || 0 !== b.indexOf("background") || (i[b] = "inherit"), g && "set" in g && void 0 === (c = g.set(a, c, d)) || (i[b] = "", i[b] = c)), void 0)
}
},
css: function(a, b, c, d) {
var e, f, g, h = o.camelCase(b);
return b = o.cssProps[h] || (o.cssProps[h] = Fb(a.style, h)), g = o.cssHooks[b] || o.cssHooks[h], g && "get" in g && (e = g.get(a, !0, c)), void 0 === e && (e = xb(a, b, d)), "normal" === e && b in Db && (e = Db[b]), "" === c || c ? (f = parseFloat(e), c === !0 || o.isNumeric(f) ? f || 0 : e) : e
}
}), o.each(["height", "width"], function(a, b) {
o.cssHooks[b] = {
get: function(a, c, d) {
return c ? 0 === a.offsetWidth && zb.test(o.css(a, "display")) ? o.swap(a, Cb, function() {
return Ib(a, b, d)
}) : Ib(a, b, d) : void 0
},
set: function(a, c, d) {
var e = d && wb(a);
return Gb(a, c, d ? Hb(a, b, d, "border-box" === o.css(a, "boxSizing", !1, e), e) : 0)
}
}
}), o.cssHooks.marginRight = yb(l.reliableMarginRight, function(a, b) {
return b ? o.swap(a, {
display: "inline-block"
}, xb, [a, "marginRight"]) : void 0
}), o.each({
margin: "",
padding: "",
border: "Width"
}, function(a, b) {
o.cssHooks[a + b] = {
expand: function(c) {
for (var d = 0, e = {}, f = "string" == typeof c ? c.split(" ") : [c]; 4 > d; d++) e[a + R[d] + b] = f[d] || f[d - 2] || f[0];
return e
}
}, ub.test(a) || (o.cssHooks[a + b].set = Gb)
}), o.fn.extend({
css: function(a, b) {
return J(this, function(a, b, c) {
var d, e, f = {},
g = 0;
if (o.isArray(b)) {
for (d = wb(a), e = b.length; e > g; g++) f[b[g]] = o.css(a, b[g], !1, d);
return f
}
return void 0 !== c ? o.style(a, b, c) : o.css(a, b)
}, a, b, arguments.length > 1)
},
show: function() {
return Jb(this, !0)
},
hide: function() {
return Jb(this)
},
toggle: function(a) {
return "boolean" == typeof a ? a ? this.show() : this.hide() : this.each(function() {
S(this) ? o(this).show() : o(this).hide()
})
}
});
function Kb(a, b, c, d, e) {
return new Kb.prototype.init(a, b, c, d, e)
}
o.Tween = Kb, Kb.prototype = {
constructor: Kb,
init: function(a, b, c, d, e, f) {
this.elem = a, this.prop = c, this.easing = e || "swing", this.options = b, this.start = this.now = this.cur(), this.end = d, this.unit = f || (o.cssNumber[c] ? "" : "px")
},
cur: function() {
var a = Kb.propHooks[this.prop];
return a && a.get ? a.get(this) : Kb.propHooks._default.get(this)
},
run: function(a) {
var b, c = Kb.propHooks[this.prop];
return this.pos = b = this.options.duration ? o.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : a, this.now = (this.end - this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : Kb.propHooks._default.set(this), this
}
}, Kb.prototype.init.prototype = Kb.prototype, Kb.propHooks = {
_default: {
get: function(a) {
var b;
return null == a.elem[a.prop] || a.elem.style && null != a.elem.style[a.prop] ? (b = o.css(a.elem, a.prop, ""), b && "auto" !== b ? b : 0) : a.elem[a.prop]
},
set: function(a) {
o.fx.step[a.prop] ? o.fx.step[a.prop](a) : a.elem.style && (null != a.elem.style[o.cssProps[a.prop]] || o.cssHooks[a.prop]) ? o.style(a.elem, a.prop, a.now + a.unit) : a.elem[a.prop] = a.now
}
}
}, Kb.propHooks.scrollTop = Kb.propHooks.scrollLeft = {
set: function(a) {
a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now)
}
}, o.easing = {
linear: function(a) {
return a
},
swing: function(a) {
return .5 - Math.cos(a * Math.PI) / 2
}
}, o.fx = Kb.prototype.init, o.fx.step = {};
var Lb, Mb, Nb = /^(?:toggle|show|hide)$/,
Ob = new RegExp("^(?:([+-])=|)(" + Q + ")([a-z%]*)$", "i"),
Pb = /queueHooks$/,
Qb = [Vb],
Rb = {
"*": [function(a, b) {
var c = this.createTween(a, b),
d = c.cur(),
e = Ob.exec(b),
f = e && e[3] || (o.cssNumber[a] ? "" : "px"),
g = (o.cssNumber[a] || "px" !== f && +d) && Ob.exec(o.css(c.elem, a)),
h = 1,
i = 20;
if (g && g[3] !== f) {
f = f || g[3], e = e || [], g = +d || 1;
do h = h || ".5", g /= h, o.style(c.elem, a, g + f); while (h !== (h = c.cur() / d) && 1 !== h && --i)
}
return e && (g = c.start = +g || +d || 0, c.unit = f, c.end = e[1] ? g + (e[1] + 1) * e[2] : +e[2]), c
}]
};
function Sb() {
return setTimeout(function() {
Lb = void 0
}), Lb = o.now()
}
function Tb(a, b) {
var c, d = 0,
e = {
height: a
};
for (b = b ? 1 : 0; 4 > d; d += 2 - b) c = R[d], e["margin" + c] = e["padding" + c] = a;
return b && (e.opacity = e.width = a), e
}
function Ub(a, b, c) {
for (var d, e = (Rb[b] || []).concat(Rb["*"]), f = 0, g = e.length; g > f; f++)
if (d = e[f].call(c, b, a)) return d
}
function Vb(a, b, c) {
var d, e, f, g, h, i, j, k = this,
l = {},
m = a.style,
n = a.nodeType && S(a),
p = L.get(a, "fxshow");
c.queue || (h = o._queueHooks(a, "fx"), null == h.unqueued && (h.unqueued = 0, i = h.empty.fire, h.empty.fire = function() {
h.unqueued || i()
}), h.unqueued++, k.always(function() {
k.always(function() {
h.unqueued--, o.queue(a, "fx").length || h.empty.fire()
})
})), 1 === a.nodeType && ("height" in b || "width" in b) && (c.overflow = [m.overflow, m.overflowX, m.overflowY], j = o.css(a, "display"), "none" === j && (j = tb(a.nodeName)), "inline" === j && "none" === o.css(a, "float") && (m.display = "inline-block")), c.overflow && (m.overflow = "hidden", k.always(function() {
m.overflow = c.overflow[0], m.overflowX = c.overflow[1], m.overflowY = c.overflow[2]
}));
for (d in b)
if (e = b[d], Nb.exec(e)) {
if (delete b[d], f = f || "toggle" === e, e === (n ? "hide" : "show")) {
if ("show" !== e || !p || void 0 === p[d]) continue;
n = !0
}
l[d] = p && p[d] || o.style(a, d)
}
if (!o.isEmptyObject(l)) {
p ? "hidden" in p && (n = p.hidden) : p = L.access(a, "fxshow", {}), f && (p.hidden = !n), n ? o(a).show() : k.done(function() {
o(a).hide()
}), k.done(function() {
var b;
L.remove(a, "fxshow");
for (b in l) o.style(a, b, l[b])
});
for (d in l) g = Ub(n ? p[d] : 0, d, k), d in p || (p[d] = g.start, n && (g.end = g.start, g.start = "width" === d || "height" === d ? 1 : 0))
}
}
function Wb(a, b) {
var c, d, e, f, g;
for (c in a)
if (d = o.camelCase(c), e = b[d], f = a[c], o.isArray(f) && (e = f[1], f = a[c] = f[0]), c !== d && (a[d] = f, delete a[c]), g = o.cssHooks[d], g && "expand" in g) {
f = g.expand(f), delete a[d];
for (c in f) c in a || (a[c] = f[c], b[c] = e)
} else b[d] = e
}
function Xb(a, b, c) {
var d, e, f = 0,
g = Qb.length,
h = o.Deferred().always(function() {
delete i.elem
}),
i = function() {
if (e) return !1;
for (var b = Lb || Sb(), c = Math.max(0, j.startTime + j.duration - b), d = c / j.duration || 0, f = 1 - d, g = 0, i = j.tweens.length; i > g; g++) j.tweens[g].run(f);
return h.notifyWith(a, [j, f, c]), 1 > f && i ? c : (h.resolveWith(a, [j]), !1)
},
j = h.promise({
elem: a,
props: o.extend({}, b),
opts: o.extend(!0, {
specialEasing: {}
}, c),
originalProperties: b,
originalOptions: c,
startTime: Lb || Sb(),
duration: c.duration,
tweens: [],
createTween: function(b, c) {
var d = o.Tween(a, j.opts, b, c, j.opts.specialEasing[b] || j.opts.easing);
return j.tweens.push(d), d
},
stop: function(b) {
var c = 0,
d = b ? j.tweens.length : 0;
if (e) return this;
for (e = !0; d > c; c++) j.tweens[c].run(1);
return b ? h.resolveWith(a, [j, b]) : h.rejectWith(a, [j, b]), this
}
}),
k = j.props;
for (Wb(k, j.opts.specialEasing); g > f; f++)
if (d = Qb[f].call(j, a, k, j.opts)) return d;
return o.map(k, Ub, j), o.isFunction(j.opts.start) && j.opts.start.call(a, j), o.fx.timer(o.extend(i, {
elem: a,
anim: j,
queue: j.opts.queue
})), j.progress(j.opts.progress).done(j.opts.done, j.opts.complete).fail(j.opts.fail).always(j.opts.always)
}
o.Animation = o.extend(Xb, {
tweener: function(a, b) {
o.isFunction(a) ? (b = a, a = ["*"]) : a = a.split(" ");
for (var c, d = 0, e = a.length; e > d; d++) c = a[d], Rb[c] = Rb[c] || [], Rb[c].unshift(b)
},
prefilter: function(a, b) {
b ? Qb.unshift(a) : Qb.push(a)
}
}), o.speed = function(a, b, c) {
var d = a && "object" == typeof a ? o.extend({}, a) : {
complete: c || !c && b || o.isFunction(a) && a,
duration: a,
easing: c && b || b && !o.isFunction(b) && b
};
return d.duration = o.fx.off ? 0 : "number" == typeof d.duration ? d.duration : d.duration in o.fx.speeds ? o.fx.speeds[d.duration] : o.fx.speeds._default, (null == d.queue || d.queue === !0) && (d.queue = "fx"), d.old = d.complete, d.complete = function() {
o.isFunction(d.old) && d.old.call(this), d.queue && o.dequeue(this, d.queue)
}, d
}, o.fn.extend({
fadeTo: function(a, b, c, d) {
return this.filter(S).css("opacity", 0).show().end().animate({
opacity: b
}, a, c, d)
},
animate: function(a, b, c, d) {
var e = o.isEmptyObject(a),
f = o.speed(b, c, d),
g = function() {
var b = Xb(this, o.extend({}, a), f);
(e || L.get(this, "finish")) && b.stop(!0)
};
return g.finish = g, e || f.queue === !1 ? this.each(g) : this.queue(f.queue, g)
},
stop: function(a, b, c) {
var d = function(a) {
var b = a.stop;
delete a.stop, b(c)
};
return "string" != typeof a && (c = b, b = a, a = void 0), b && a !== !1 && this.queue(a || "fx", []), this.each(function() {
var b = !0,
e = null != a && a + "queueHooks",
f = o.timers,
g = L.get(this);
if (e) g[e] && g[e].stop && d(g[e]);
else
for (e in g) g[e] && g[e].stop && Pb.test(e) && d(g[e]);
for (e = f.length; e--;) f[e].elem !== this || null != a && f[e].queue !== a || (f[e].anim.stop(c), b = !1, f.splice(e, 1));
(b || !c) && o.dequeue(this, a)
})
},
finish: function(a) {
return a !== !1 && (a = a || "fx"), this.each(function() {
var b, c = L.get(this),
d = c[a + "queue"],
e = c[a + "queueHooks"],
f = o.timers,
g = d ? d.length : 0;
for (c.finish = !0, o.queue(this, a, []), e && e.stop && e.stop.call(this, !0), b = f.length; b--;) f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1));
for (b = 0; g > b; b++) d[b] && d[b].finish && d[b].finish.call(this);
delete c.finish
})
}
}), o.each(["toggle", "show", "hide"], function(a, b) {
var c = o.fn[b];
o.fn[b] = function(a, d, e) {
return null == a || "boolean" == typeof a ? c.apply(this, arguments) : this.animate(Tb(b, !0), a, d, e)
}
}), o.each({
slideDown: Tb("show"),
slideUp: Tb("hide"),
slideToggle: Tb("toggle"),
fadeIn: {
opacity: "show"
},
fadeOut: {
opacity: "hide"
},
fadeToggle: {
opacity: "toggle"
}
}, function(a, b) {
o.fn[a] = function(a, c, d) {
return this.animate(b, a, c, d)
}
}), o.timers = [], o.fx.tick = function() {
var a, b = 0,
c = o.timers;
for (Lb = o.now(); b < c.length; b++) a = c[b], a() || c[b] !== a || c.splice(b--, 1);
c.length || o.fx.stop(), Lb = void 0
}, o.fx.timer = function(a) {
o.timers.push(a), a() ? o.fx.start() : o.timers.pop()
}, o.fx.interval = 13, o.fx.start = function() {
Mb || (Mb = setInterval(o.fx.tick, o.fx.interval))
}, o.fx.stop = function() {
clearInterval(Mb), Mb = null
}, o.fx.speeds = {
slow: 600,
fast: 200,
_default: 400
}, o.fn.delay = function(a, b) {
return a = o.fx ? o.fx.speeds[a] || a : a, b = b || "fx", this.queue(b, function(b, c) {
var d = setTimeout(b, a);
c.stop = function() {
clearTimeout(d)
}
})
},
function() {
var a = m.createElement("input"),
b = m.createElement("select"),
c = b.appendChild(m.createElement("option"));
a.type = "checkbox", l.checkOn = "" !== a.value, l.optSelected = c.selected, b.disabled = !0, l.optDisabled = !c.disabled, a = m.createElement("input"), a.value = "t", a.type = "radio", l.radioValue = "t" === a.value
}();
var Yb, Zb, $b = o.expr.attrHandle;
o.fn.extend({
attr: function(a, b) {
return J(this, o.attr, a, b, arguments.length > 1)
},
removeAttr: function(a) {
return this.each(function() {
o.removeAttr(this, a)
})
}
}), o.extend({
attr: function(a, b, c) {
var d, e, f = a.nodeType;
if (a && 3 !== f && 8 !== f && 2 !== f) return typeof a.getAttribute === U ? o.prop(a, b, c) : (1 === f && o.isXMLDoc(a) || (b = b.toLowerCase(), d = o.attrHooks[b] || (o.expr.match.bool.test(b) ? Zb : Yb)), void 0 === c ? d && "get" in d && null !== (e = d.get(a, b)) ? e : (e = o.find.attr(a, b), null == e ? void 0 : e) : null !== c ? d && "set" in d && void 0 !== (e = d.set(a, c, b)) ? e : (a.setAttribute(b, c + ""), c) : void o.removeAttr(a, b))
},
removeAttr: function(a, b) {
var c, d, e = 0,
f = b && b.match(E);
if (f && 1 === a.nodeType)
while (c = f[e++]) d = o.propFix[c] || c, o.expr.match.bool.test(c) && (a[d] = !1), a.removeAttribute(c)
},
attrHooks: {
type: {
set: function(a, b) {
if (!l.radioValue && "radio" === b && o.nodeName(a, "input")) {
var c = a.value;
return a.setAttribute("type", b), c && (a.value = c), b
}
}
}
}
}), Zb = {
set: function(a, b, c) {
return b === !1 ? o.removeAttr(a, c) : a.setAttribute(c, c), c
}
}, o.each(o.expr.match.bool.source.match(/\w+/g), function(a, b) {
var c = $b[b] || o.find.attr;
$b[b] = function(a, b, d) {
var e, f;
return d || (f = $b[b], $b[b] = e, e = null != c(a, b, d) ? b.toLowerCase() : null, $b[b] = f), e
}
});
var _b = /^(?:input|select|textarea|button)$/i;
o.fn.extend({
prop: function(a, b) {
return J(this, o.prop, a, b, arguments.length > 1)
},
removeProp: function(a) {
return this.each(function() {
delete this[o.propFix[a] || a]
})
}
}), o.extend({
propFix: {
"for": "htmlFor",
"class": "className"
},
prop: function(a, b, c) {
var d, e, f, g = a.nodeType;
if (a && 3 !== g && 8 !== g && 2 !== g) return f = 1 !== g || !o.isXMLDoc(a), f && (b = o.propFix[b] || b, e = o.propHooks[b]), void 0 !== c ? e && "set" in e && void 0 !== (d = e.set(a, c, b)) ? d : a[b] = c : e && "get" in e && null !== (d = e.get(a, b)) ? d : a[b]
},
propHooks: {
tabIndex: {
get: function(a) {
return a.hasAttribute("tabindex") || _b.test(a.nodeName) || a.href ? a.tabIndex : -1
}
}
}
}), l.optSelected || (o.propHooks.selected = {
get: function(a) {
var b = a.parentNode;
return b && b.parentNode && b.parentNode.selectedIndex, null
}
}), o.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() {
o.propFix[this.toLowerCase()] = this
});
var ac = /[\t\r\n\f]/g;
o.fn.extend({
addClass: function(a) {
var b, c, d, e, f, g, h = "string" == typeof a && a,
i = 0,
j = this.length;
if (o.isFunction(a)) return this.each(function(b) {
o(this).addClass(a.call(this, b, this.className))
});
if (h)
for (b = (a || "").match(E) || []; j > i; i++)
if (c = this[i], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(ac, " ") : " ")) {
f = 0;
while (e = b[f++]) d.indexOf(" " + e + " ") < 0 && (d += e + " ");
g = o.trim(d), c.className !== g && (c.className = g)
}
return this
},
removeClass: function(a) {
var b, c, d, e, f, g, h = 0 === arguments.length || "string" == typeof a && a,
i = 0,
j = this.length;
if (o.isFunction(a)) return this.each(function(b) {
o(this).removeClass(a.call(this, b, this.className))
});
if (h)
for (b = (a || "").match(E) || []; j > i; i++)
if (c = this[i], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(ac, " ") : "")) {
f = 0;
while (e = b[f++])
while (d.indexOf(" " + e + " ") >= 0) d = d.replace(" " + e + " ", " ");
g = a ? o.trim(d) : "", c.className !== g && (c.className = g)
}
return this
},
toggleClass: function(a, b) {
var c = typeof a;
return "boolean" == typeof b && "string" === c ? b ? this.addClass(a) : this.removeClass(a) : this.each(o.isFunction(a) ? function(c) {
o(this).toggleClass(a.call(this, c, this.className, b), b)
} : function() {
if ("string" === c) {
var b, d = 0,
e = o(this),
f = a.match(E) || [];
while (b = f[d++]) e.hasClass(b) ? e.removeClass(b) : e.addClass(b)
} else(c === U || "boolean" === c) && (this.className && L.set(this, "__className__", this.className), this.className = this.className || a === !1 ? "" : L.get(this, "__className__") || "")
})
},
hasClass: function(a) {
for (var b = " " + a + " ", c = 0, d = this.length; d > c; c++)
if (1 === this[c].nodeType && (" " + this[c].className + " ").replace(ac, " ").indexOf(b) >= 0) return !0;
return !1
}
});
var bc = /\r/g;
o.fn.extend({
val: function(a) {
var b, c, d, e = this[0]; {
if (arguments.length) return d = o.isFunction(a), this.each(function(c) {
var e;
1 === this.nodeType && (e = d ? a.call(this, c, o(this).val()) : a, null == e ? e = "" : "number" == typeof e ? e += "" : o.isArray(e) && (e = o.map(e, function(a) {
return null == a ? "" : a + ""
})), b = o.valHooks[this.type] || o.valHooks[this.nodeName.toLowerCase()], b && "set" in b && void 0 !== b.set(this, e, "value") || (this.value = e))
});
if (e) return b = o.valHooks[e.type] || o.valHooks[e.nodeName.toLowerCase()], b && "get" in b && void 0 !== (c = b.get(e, "value")) ? c : (c = e.value, "string" == typeof c ? c.replace(bc, "") : null == c ? "" : c)
}
}
}), o.extend({
valHooks: {
select: {
get: function(a) {
for (var b, c, d = a.options, e = a.selectedIndex, f = "select-one" === a.type || 0 > e, g = f ? null : [], h = f ? e + 1 : d.length, i = 0 > e ? h : f ? e : 0; h > i; i++)
if (c = d[i], !(!c.selected && i !== e || (l.optDisabled ? c.disabled : null !== c.getAttribute("disabled")) || c.parentNode.disabled && o.nodeName(c.parentNode, "optgroup"))) {
if (b = o(c).val(), f) return b;
g.push(b)
}
return g
},
set: function(a, b) {
var c, d, e = a.options,
f = o.makeArray(b),
g = e.length;
while (g--) d = e[g], (d.selected = o.inArray(o(d).val(), f) >= 0) && (c = !0);
return c || (a.selectedIndex = -1), f
}
}
}
}), o.each(["radio", "checkbox"], function() {
o.valHooks[this] = {
set: function(a, b) {
return o.isArray(b) ? a.checked = o.inArray(o(a).val(), b) >= 0 : void 0
}
}, l.checkOn || (o.valHooks[this].get = function(a) {
return null === a.getAttribute("value") ? "on" : a.value
})
}), o.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function(a, b) {
o.fn[b] = function(a, c) {
return arguments.length > 0 ? this.on(b, null, a, c) : this.trigger(b)
}
}), o.fn.extend({
hover: function(a, b) {
return this.mouseenter(a).mouseleave(b || a)
},
bind: function(a, b, c) {
return this.on(a, null, b, c)
},
unbind: function(a, b) {
return this.off(a, null, b)
},
delegate: function(a, b, c, d) {
return this.on(b, a, c, d)
},
undelegate: function(a, b, c) {
return 1 === arguments.length ? this.off(a, "**") : this.off(b, a || "**", c)
}
});
var cc = o.now(),
dc = /\?/;
o.parseJSON = function(a) {
return JSON.parse(a + "")
}, o.parseXML = function(a) {
var b, c;
if (!a || "string" != typeof a) return null;
try {
c = new DOMParser, b = c.parseFromString(a, "text/xml")
} catch (d) {
b = void 0
}
return (!b || b.getElementsByTagName("parsererror").length) && o.error("Invalid XML: " + a), b
};
var ec, fc, gc = /#.*$/,
hc = /([?&])_=[^&]*/,
ic = /^(.*?):[ \t]*([^\r\n]*)$/gm,
jc = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
kc = /^(?:GET|HEAD)$/,
lc = /^\/\//,
mc = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
nc = {},
oc = {},
pc = "*/".concat("*");
try {
fc = location.href
} catch (qc) {
fc = m.createElement("a"), fc.href = "", fc = fc.href
}
ec = mc.exec(fc.toLowerCase()) || [];
function rc(a) {
return function(b, c) {
"string" != typeof b && (c = b, b = "*");
var d, e = 0,
f = b.toLowerCase().match(E) || [];
if (o.isFunction(c))
while (d = f[e++]) "+" === d[0] ? (d = d.slice(1) || "*", (a[d] = a[d] || []).unshift(c)) : (a[d] = a[d] || []).push(c)
}
}
function sc(a, b, c, d) {
var e = {},
f = a === oc;
function g(h) {
var i;
return e[h] = !0, o.each(a[h] || [], function(a, h) {
var j = h(b, c, d);
return "string" != typeof j || f || e[j] ? f ? !(i = j) : void 0 : (b.dataTypes.unshift(j), g(j), !1)
}), i
}
return g(b.dataTypes[0]) || !e["*"] && g("*")
}
function tc(a, b) {
var c, d, e = o.ajaxSettings.flatOptions || {};
for (c in b) void 0 !== b[c] && ((e[c] ? a : d || (d = {}))[c] = b[c]);
return d && o.extend(!0, a, d), a
}
function uc(a, b, c) {
var d, e, f, g, h = a.contents,
i = a.dataTypes;
while ("*" === i[0]) i.shift(), void 0 === d && (d = a.mimeType || b.getResponseHeader("Content-Type"));
if (d)
for (e in h)
if (h[e] && h[e].test(d)) {
i.unshift(e);
break
}
if (i[0] in c) f = i[0];
else {
for (e in c) {
if (!i[0] || a.converters[e + " " + i[0]]) {
f = e;
break
}
g || (g = e)
}
f = f || g
}
return f ? (f !== i[0] && i.unshift(f), c[f]) : void 0
}
function vc(a, b, c, d) {
var e, f, g, h, i, j = {},
k = a.dataTypes.slice();
if (k[1])
for (g in a.converters) j[g.toLowerCase()] = a.converters[g];
f = k.shift();
while (f)
if (a.responseFields[f] && (c[a.responseFields[f]] = b), !i && d && a.dataFilter && (b = a.dataFilter(b, a.dataType)), i = f, f = k.shift())
if ("*" === f) f = i;
else if ("*" !== i && i !== f) {
if (g = j[i + " " + f] || j["* " + f], !g)
for (e in j)
if (h = e.split(" "), h[1] === f && (g = j[i + " " + h[0]] || j["* " + h[0]])) {
g === !0 ? g = j[e] : j[e] !== !0 && (f = h[0], k.unshift(h[1]));
break
}
if (g !== !0)
if (g && a["throws"]) b = g(b);
else try {
b = g(b)
} catch (l) {
return {
state: "parsererror",
error: g ? l : "No conversion from " + i + " to " + f
}
}
}
return {
state: "success",
data: b
}
}
o.extend({
active: 0,
lastModified: {},
etag: {},
ajaxSettings: {
url: fc,
type: "GET",
isLocal: jc.test(ec[1]),
global: !0,
processData: !0,
async: !0,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
accepts: {
"*": pc,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
converters: {
"* text": String,
"text html": !0,
"text json": o.parseJSON,
"text xml": o.parseXML
},
flatOptions: {
url: !0,
context: !0
}
},
ajaxSetup: function(a, b) {
return b ? tc(tc(a, o.ajaxSettings), b) : tc(o.ajaxSettings, a)
},
ajaxPrefilter: rc(nc),
ajaxTransport: rc(oc),
ajax: function(a, b) {
"object" == typeof a && (b = a, a = void 0), b = b || {};
var c, d, e, f, g, h, i, j, k = o.ajaxSetup({}, b),
l = k.context || k,
m = k.context && (l.nodeType || l.jquery) ? o(l) : o.event,
n = o.Deferred(),
p = o.Callbacks("once memory"),
q = k.statusCode || {},
r = {},
s = {},
t = 0,
u = "canceled",
v = {
readyState: 0,
getResponseHeader: function(a) {
var b;
if (2 === t) {
if (!f) {
f = {};
while (b = ic.exec(e)) f[b[1].toLowerCase()] = b[2]
}
b = f[a.toLowerCase()]
}
return null == b ? null : b
},
getAllResponseHeaders: function() {
return 2 === t ? e : null
},
setRequestHeader: function(a, b) {
var c = a.toLowerCase();
return t || (a = s[c] = s[c] || a, r[a] = b), this
},
overrideMimeType: function(a) {
return t || (k.mimeType = a), this
},
statusCode: function(a) {
var b;
if (a)
if (2 > t)
for (b in a) q[b] = [q[b], a[b]];
else v.always(a[v.status]);
return this
},
abort: function(a) {
var b = a || u;
return c && c.abort(b), x(0, b), this
}
};
if (n.promise(v).complete = p.add, v.success = v.done, v.error = v.fail, k.url = ((a || k.url || fc) + "").replace(gc, "").replace(lc, ec[1] + "//"), k.type = b.method || b.type || k.method || k.type, k.dataTypes = o.trim(k.dataType || "*").toLowerCase().match(E) || [""], null == k.crossDomain && (h = mc.exec(k.url.toLowerCase()), k.crossDomain = !(!h || h[1] === ec[1] && h[2] === ec[2] && (h[3] || ("http:" === h[1] ? "80" : "443")) === (ec[3] || ("http:" === ec[1] ? "80" : "443")))), k.data && k.processData && "string" != typeof k.data && (k.data = o.param(k.data, k.traditional)), sc(nc, k, b, v), 2 === t) return v;
i = k.global, i && 0 === o.active++ && o.event.trigger("ajaxStart"), k.type = k.type.toUpperCase(), k.hasContent = !kc.test(k.type), d = k.url, k.hasContent || (k.data && (d = k.url += (dc.test(d) ? "&" : "?") + k.data, delete k.data), k.cache === !1 && (k.url = hc.test(d) ? d.replace(hc, "$1_=" + cc++) : d + (dc.test(d) ? "&" : "?") + "_=" + cc++)), k.ifModified && (o.lastModified[d] && v.setRequestHeader("If-Modified-Since", o.lastModified[d]), o.etag[d] && v.setRequestHeader("If-None-Match", o.etag[d])), (k.data && k.hasContent && k.contentType !== !1 || b.contentType) && v.setRequestHeader("Content-Type", k.contentType), v.setRequestHeader("Accept", k.dataTypes[0] && k.accepts[k.dataTypes[0]] ? k.accepts[k.dataTypes[0]] + ("*" !== k.dataTypes[0] ? ", " + pc + "; q=0.01" : "") : k.accepts["*"]);
for (j in k.headers) v.setRequestHeader(j, k.headers[j]);
if (k.beforeSend && (k.beforeSend.call(l, v, k) === !1 || 2 === t)) return v.abort();
u = "abort";
for (j in {
success: 1,
error: 1,
complete: 1
}) v[j](k[j]);
if (c = sc(oc, k, b, v)) {
v.readyState = 1, i && m.trigger("ajaxSend", [v, k]), k.async && k.timeout > 0 && (g = setTimeout(function() {
v.abort("timeout")
}, k.timeout));
try {
t = 1, c.send(r, x)
} catch (w) {
if (!(2 > t)) throw w;
x(-1, w)
}
} else x(-1, "No Transport");
function x(a, b, f, h) {
var j, r, s, u, w, x = b;
2 !== t && (t = 2, g && clearTimeout(g), c = void 0, e = h || "", v.readyState = a > 0 ? 4 : 0, j = a >= 200 && 300 > a || 304 === a, f && (u = uc(k, v, f)), u = vc(k, u, v, j), j ? (k.ifModified && (w = v.getResponseHeader("Last-Modified"), w && (o.lastModified[d] = w), w = v.getResponseHeader("etag"), w && (o.etag[d] = w)), 204 === a || "HEAD" === k.type ? x = "nocontent" : 304 === a ? x = "notmodified" : (x = u.state, r = u.data, s = u.error, j = !s)) : (s = x, (a || !x) && (x = "error", 0 > a && (a = 0))), v.status = a, v.statusText = (b || x) + "", j ? n.resolveWith(l, [r, x, v]) : n.rejectWith(l, [v, x, s]), v.statusCode(q), q = void 0, i && m.trigger(j ? "ajaxSuccess" : "ajaxError", [v, k, j ? r : s]), p.fireWith(l, [v, x]), i && (m.trigger("ajaxComplete", [v, k]), --o.active || o.event.trigger("ajaxStop")))
}
return v
},
getJSON: function(a, b, c) {
return o.get(a, b, c, "json")
},
getScript: function(a, b) {
return o.get(a, void 0, b, "script")
}
}), o.each(["get", "post"], function(a, b) {
o[b] = function(a, c, d, e) {
return o.isFunction(c) && (e = e || d, d = c, c = void 0), o.ajax({
url: a,
type: b,
dataType: e,
data: c,
success: d
})
}
}), o.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(a, b) {
o.fn[b] = function(a) {
return this.on(b, a)
}
}), o._evalUrl = function(a) {
return o.ajax({
url: a,
type: "GET",
dataType: "script",
async: !1,
global: !1,
"throws": !0
})
}, o.fn.extend({
wrapAll: function(a) {
var b;
return o.isFunction(a) ? this.each(function(b) {
o(this).wrapAll(a.call(this, b))
}) : (this[0] && (b = o(a, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && b.insertBefore(this[0]), b.map(function() {
var a = this;
while (a.firstElementChild) a = a.firstElementChild;
return a
}).append(this)), this)
},
wrapInner: function(a) {
return this.each(o.isFunction(a) ? function(b) {
o(this).wrapInner(a.call(this, b))
} : function() {
var b = o(this),
c = b.contents();
c.length ? c.wrapAll(a) : b.append(a)
})
},
wrap: function(a) {
var b = o.isFunction(a);
return this.each(function(c) {
o(this).wrapAll(b ? a.call(this, c) : a)
})
},
unwrap: function() {
return this.parent().each(function() {
o.nodeName(this, "body") || o(this).replaceWith(this.childNodes)
}).end()
}
}), o.expr.filters.hidden = function(a) {
return a.offsetWidth <= 0 && a.offsetHeight <= 0
}, o.expr.filters.visible = function(a) {
return !o.expr.filters.hidden(a)
};
var wc = /%20/g,
xc = /\[\]$/,
yc = /\r?\n/g,
zc = /^(?:submit|button|image|reset|file)$/i,
Ac = /^(?:input|select|textarea|keygen)/i;
function Bc(a, b, c, d) {
var e;
if (o.isArray(b)) o.each(b, function(b, e) {
c || xc.test(a) ? d(a, e) : Bc(a + "[" + ("object" == typeof e ? b : "") + "]", e, c, d)
});
else if (c || "object" !== o.type(b)) d(a, b);
else
for (e in b) Bc(a + "[" + e + "]", b[e], c, d)
}
o.param = function(a, b) {
var c, d = [],
e = function(a, b) {
b = o.isFunction(b) ? b() : null == b ? "" : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b)
};
if (void 0 === b && (b = o.ajaxSettings && o.ajaxSettings.traditional), o.isArray(a) || a.jquery && !o.isPlainObject(a)) o.each(a, function() {
e(this.name, this.value)
});
else
for (c in a) Bc(c, a[c], b, e);
return d.join("&").replace(wc, "+")
}, o.fn.extend({
serialize: function() {
return o.param(this.serializeArray())
},
serializeArray: function() {
return this.map(function() {
var a = o.prop(this, "elements");
return a ? o.makeArray(a) : this
}).filter(function() {
var a = this.type;
return this.name && !o(this).is(":disabled") && Ac.test(this.nodeName) && !zc.test(a) && (this.checked || !T.test(a))
}).map(function(a, b) {
var c = o(this).val();
return null == c ? null : o.isArray(c) ? o.map(c, function(a) {
return {
name: b.name,
value: a.replace(yc, "\r\n")
}
}) : {
name: b.name,
value: c.replace(yc, "\r\n")
}
}).get()
}
}), o.ajaxSettings.xhr = function() {
try {
return new XMLHttpRequest
} catch (a) {}
};
var Cc = 0,
Dc = {},
Ec = {
0: 200,
1223: 204
},
Fc = o.ajaxSettings.xhr();
a.ActiveXObject && o(a).on("unload", function() {
for (var a in Dc) Dc[a]()
}), l.cors = !!Fc && "withCredentials" in Fc, l.ajax = Fc = !!Fc, o.ajaxTransport(function(a) {
var b;
return l.cors || Fc && !a.crossDomain ? {
send: function(c, d) {
var e, f = a.xhr(),
g = ++Cc;
if (f.open(a.type, a.url, a.async, a.username, a.password), a.xhrFields)
for (e in a.xhrFields) f[e] = a.xhrFields[e];
a.mimeType && f.overrideMimeType && f.overrideMimeType(a.mimeType), a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest");
for (e in c) f.setRequestHeader(e, c[e]);
b = function(a) {
return function() {
b && (delete Dc[g], b = f.onload = f.onerror = null, "abort" === a ? f.abort() : "error" === a ? d(f.status, f.statusText) : d(Ec[f.status] || f.status, f.statusText, "string" == typeof f.responseText ? {
text: f.responseText
} : void 0, f.getAllResponseHeaders()))
}
}, f.onload = b(), f.onerror = b("error"), b = Dc[g] = b("abort"), f.send(a.hasContent && a.data || null)
},
abort: function() {
b && b()
}
} : void 0
}), o.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
},
converters: {
"text script": function(a) {
return o.globalEval(a), a
}
}
}), o.ajaxPrefilter("script", function(a) {
void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = "GET")
}), o.ajaxTransport("script", function(a) {
if (a.crossDomain) {
var b, c;
return {
send: function(d, e) {
b = o("<script>").prop({
async: !0,
charset: a.scriptCharset,
src: a.url
}).on("load error", c = function(a) {
b.remove(), c = null, a && e("error" === a.type ? 404 : 200, a.type)
}), m.head.appendChild(b[0])
},
abort: function() {
c && c()
}
}
}
});
var Gc = [],
Hc = /(=)\?(?=&|$)|\?\?/;
o.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var a = Gc.pop() || o.expando + "_" + cc++;
return this[a] = !0, a
}
}), o.ajaxPrefilter("json jsonp", function(b, c, d) {
var e, f, g, h = b.jsonp !== !1 && (Hc.test(b.url) ? "url" : "string" == typeof b.data && !(b.contentType || "").indexOf("application/x-www-form-urlencoded") && Hc.test(b.data) && "data");
return h || "jsonp" === b.dataTypes[0] ? (e = b.jsonpCallback = o.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback, h ? b[h] = b[h].replace(Hc, "$1" + e) : b.jsonp !== !1 && (b.url += (dc.test(b.url) ? "&" : "?") + b.jsonp + "=" + e), b.converters["script json"] = function() {
return g || o.error(e + " was not called"), g[0]
}, b.dataTypes[0] = "json", f = a[e], a[e] = function() {
g = arguments
}, d.always(function() {
a[e] = f, b[e] && (b.jsonpCallback = c.jsonpCallback, Gc.push(e)), g && o.isFunction(f) && f(g[0]), g = f = void 0
}), "script") : void 0
}), o.parseHTML = function(a, b, c) {
if (!a || "string" != typeof a) return null;
"boolean" == typeof b && (c = b, b = !1), b = b || m;
var d = v.exec(a),
e = !c && [];
return d ? [b.createElement(d[1])] : (d = o.buildFragment([a], b, e), e && e.length && o(e).remove(), o.merge([], d.childNodes))
};
var Ic = o.fn.load;
o.fn.load = function(a, b, c) {
if ("string" != typeof a && Ic) return Ic.apply(this, arguments);
var d, e, f, g = this,
h = a.indexOf(" ");
return h >= 0 && (d = a.slice(h), a = a.slice(0, h)), o.isFunction(b) ? (c = b, b = void 0) : b && "object" == typeof b && (e = "POST"), g.length > 0 && o.ajax({
url: a,
type: e,
dataType: "html",
data: b
}).done(function(a) {
f = arguments, g.html(d ? o("<div>").append(o.parseHTML(a)).find(d) : a)
}).complete(c && function(a, b) {
g.each(c, f || [a.responseText, b, a])
}), this
}, o.expr.filters.animated = function(a) {
return o.grep(o.timers, function(b) {
return a === b.elem
}).length
};
var Jc = a.document.documentElement;
function Kc(a) {
return o.isWindow(a) ? a : 9 === a.nodeType && a.defaultView
}
o.offset = {
setOffset: function(a, b, c) {
var d, e, f, g, h, i, j, k = o.css(a, "position"),
l = o(a),
m = {};
"static" === k && (a.style.position = "relative"), h = l.offset(), f = o.css(a, "top"), i = o.css(a, "left"), j = ("absolute" === k || "fixed" === k) && (f + i).indexOf("auto") > -1, j ? (d = l.position(), g = d.top, e = d.left) : (g = parseFloat(f) || 0, e = parseFloat(i) || 0), o.isFunction(b) && (b = b.call(a, c, h)), null != b.top && (m.top = b.top - h.top + g), null != b.left && (m.left = b.left - h.left + e), "using" in b ? b.using.call(a, m) : l.css(m)
}
}, o.fn.extend({
offset: function(a) {
if (arguments.length) return void 0 === a ? this : this.each(function(b) {
o.offset.setOffset(this, a, b)
});
var b, c, d = this[0],
e = {
top: 0,
left: 0
},
f = d && d.ownerDocument;
if (f) return b = f.documentElement, o.contains(b, d) ? (typeof d.getBoundingClientRect !== U && (e = d.getBoundingClientRect()), c = Kc(f), {
top: e.top + c.pageYOffset - b.clientTop,
left: e.left + c.pageXOffset - b.clientLeft
}) : e
},
position: function() {
if (this[0]) {
var a, b, c = this[0],
d = {
top: 0,
left: 0
};
return "fixed" === o.css(c, "position") ? b = c.getBoundingClientRect() : (a = this.offsetParent(), b = this.offset(), o.nodeName(a[0], "html") || (d = a.offset()), d.top += o.css(a[0], "borderTopWidth", !0), d.left += o.css(a[0], "borderLeftWidth", !0)), {
top: b.top - d.top - o.css(c, "marginTop", !0),
left: b.left - d.left - o.css(c, "marginLeft", !0)
}
}
},
offsetParent: function() {
return this.map(function() {
var a = this.offsetParent || Jc;
while (a && !o.nodeName(a, "html") && "static" === o.css(a, "position")) a = a.offsetParent;
return a || Jc
})
}
}), o.each({
scrollLeft: "pageXOffset",
scrollTop: "pageYOffset"
}, function(b, c) {
var d = "pageYOffset" === c;
o.fn[b] = function(e) {
return J(this, function(b, e, f) {
var g = Kc(b);
return void 0 === f ? g ? g[c] : b[e] : void(g ? g.scrollTo(d ? a.pageXOffset : f, d ? f : a.pageYOffset) : b[e] = f)
}, b, e, arguments.length, null)
}
}), o.each(["top", "left"], function(a, b) {
o.cssHooks[b] = yb(l.pixelPosition, function(a, c) {
return c ? (c = xb(a, b), vb.test(c) ? o(a).position()[b] + "px" : c) : void 0
})
}), o.each({
Height: "height",
Width: "width"
}, function(a, b) {
o.each({
padding: "inner" + a,
content: b,
"": "outer" + a
}, function(c, d) {
o.fn[d] = function(d, e) {
var f = arguments.length && (c || "boolean" != typeof d),
g = c || (d === !0 || e === !0 ? "margin" : "border");
return J(this, function(b, c, d) {
var e;
return o.isWindow(b) ? b.document.documentElement["client" + a] : 9 === b.nodeType ? (e = b.documentElement, Math.max(b.body["scroll" + a], e["scroll" + a], b.body["offset" + a], e["offset" + a], e["client" + a])) : void 0 === d ? o.css(b, c, g) : o.style(b, c, d, g)
}, b, f ? d : void 0, f, null)
}
})
}), o.fn.size = function() {
return this.length
}, o.fn.andSelf = o.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function() {
return o
});
var Lc = a.jQuery,
Mc = a.$;
return o.noConflict = function(b) {
return a.$ === o && (a.$ = Mc), b && a.jQuery === o && (a.jQuery = Lc), o
}, typeof b === U && (a.jQuery = a.$ = o), o
});;
window.adrma = window.adrma || {};
window.$ = jQuery;
adrma.performance = {
mark: function mark(a) {
if (performance.mark === undefined) {
return
}
performance.mark(a)
}
};
window.adrma = adrma || {};
(function() {
var e = /\+/g;
function f(g) {
return g
}
function d() {
for (var g = 1; g < arguments.length; g++) {
for (var h in arguments[g]) {
if (arguments[g].hasOwnProperty(h)) {
arguments[0][h] = arguments[g][h]
}
}
}
return arguments[0]
}
function c(g) {
return decodeURIComponent(g.replace(e, " "))
}
function b(h) {
if (h.indexOf('"') === 0) {
h = h.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")
}
try {
return a.json ? JSON.parse(h) : h
} catch (g) {}
}
var a = adrma.cookie = function(n, v, q) {
if (v === null) {
adrma.removeCookie(n, q);
return
}
if (v !== undefined) {
q = d({}, a.defaults, q);
if (typeof q.expires === "number") {
var j = q.expires,
u = q.expires = new Date();
u.setMilliseconds(u.getMilliseconds() + (j * 86400000))
}
v = a.json ? JSON.stringify(v) : String(v);
return (document.cookie = [a.raw ? n : encodeURIComponent(n), "=", a.raw ? v : encodeURIComponent(v), q.expires ? "; expires=" + q.expires.toUTCString() : "", q.path ? "; path=" + q.path : "", q.domain ? "; domain=" + q.domain : "", q.secure ? "; secure" : ""].join(""))
}
var k = a.raw || (q && q.raw) ? f : c;
var h = document.cookie.split("; ");
var s = n ? undefined : {};
for (var m = 0, o = h.length; m < o; m++) {
var r = h[m].split("=");
var p = k(r.shift());
var g = k(r.join("="));
if (n && n === p) {
s = b(g);
break
}
if (!n) {
s[p] = b(g)
}
}
return s
};
a.defaults = {};
adrma.removeCookie = function(g, h) {
if (adrma.cookie(g) !== undefined) {
adrma.cookie(g, "", d({}, h, {
expires: -1
}));
return true
}
return false
}
})();
document.cookie = "a=b; path=/"; /* matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
window.matchMedia || (window.matchMedia = function windowMatchMedia() {
var d = (window.styleMedia || window.media);
if (!d) {
var c = document.createElement("style"),
b = document.getElementsByTagName("script")[0],
a = null;
c.type = "text/css";
c.id = "matchmediajs-test";
b.parentNode.insertBefore(c, b);
a = ("getComputedStyle" in window) && window.getComputedStyle(c, null) || c.currentStyle;
d = {
matchMedium: function(e) {
var f = "@media " + e + "{ #matchmediajs-test { width: 1px; } }";
if (c.styleSheet) {
c.styleSheet.cssText = f
} else {
c.textContent = f
}
return a.width === "1px"
}
}
}
return function(e) {
return {
matches: d.matchMedium(e || "all"),
media: e || "all"
}
}
}());
adrma.mediaQuery = {
init: function() {
this.setup()
},
breakpoints: {
small: {
id: "rwdSmall",
query: "screen and (max-width:599px)"
},
mediumOnly: {
id: "rwd-only-medium",
query: "screen and (max-width:801px) and (min-width:599px)"
},
smallMedium: {
id: "rwd-small-medium",
query: "screen and (max-width:760px) and (min-width:599px)"
},
largeMedium: {
id: "rwd-large-medium",
query: "screen and (max-width:801px) and (min-width:760px)"
},
fullnarrower: {
id: "rwd-full-narrower",
query: "screen and (max-width:1020px) and (min-width:801px)"
},
full: {
id: "rwd-full",
query: "screen and (min-width:801px)"
}
},
setup: function setup() {
var c = this;
c.isTouch = ("ontouchstart" in window) || navigator.msMaxTouchPoints;
$.each(c.breakpoints, function a(f, d) {
d.matches = c.matchMedia(d.query)
});
if (c.isTouch) {
$(function b() {
$("body").addClass("isTouch")
})
}
},
matchMedia: function matchMedia(b, a) {
if (!window.matchMedia) {
return false
}
return window.matchMedia(b).matches
},
matches: function matches(c) {
var f = this,
d = false,
a = c && $.type(c) === "array" ? c : Array.prototype.slice.call(arguments, 0),
b;
$.each(a, function e(h, g) {
if (d) {
return false
}
b = f.breakpoints[g];
if (b) {
d = b.matches
}
});
return d
}
};
adrma.mediaQuery.init();
if (typeof console === "undefined") {
console = {};
console.log = function(a) {}
}
adrma.log = function(a) {
if (!window.console) {
return
}
console.log(a)
};
Object.keys = Object.keys || function(b, a, c) {
c = [];
for (a in b) {
c.hasOwnProperty.call(b, a) && c.push(a)
}
return c
};
window.requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(a) {
window.setTimeout(a, 1000 / 60)
}
})();
adrma = window.adrma || {};
adrma.getDescendantProp = function getDescendantProp(b, c) {
c = c || window;
if (typeof b !== "string") {
return b
}
var a = b.split(".");
while (a.length && (c = c[a.shift()])) {}
return c
};
adrma.executeDescendantFn = function executeDescendantFn(d, b, a) {
var c = adrma.getDescendantProp(d);
b = b || window;
a = a || [];
return c.apply(b, a)
};
if (typeof Array.prototype.compare !== "function") {
Array.prototype.compare = function(a) {
if (!a) {
return false
}
if (this.length != a.length) {
return false
}
for (var b = 0; b < this.length; b++) {
if (this[b] instanceof Array && a[b] instanceof Array) {
if (!this[b].compare(a[b])) {
return false
}
} else {
if (this[b] != a[b]) {
return false
}
}
}
return true
}
}
adrma.renameObjKeys = function(c, a) {
var d = {};
for (var b in c) {
if (c.hasOwnProperty(b)) {
d[a(b)] = c[b]
}
}
return d
};
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "")
}
adrma.getServerDate = function getServerDate() {
var a = new Date(),
b = adrma.siteSettings.ServerUtcOffset,
c = a.getTime() + (a.getTimezoneOffset() * 60000);
originServerDate = new Date(c + (3600000 * b));
return originServerDate
};
adrma.getDateRange = function getDateRange() {
var a = adrma.cookie("Range"),
d, c, g, e, f, b = {};
if (!a) {
return b
}
d = a.split("&");
$.each(d, function(j, h) {
if (h.indexOf("FromDate=") !== -1) {
c = h.replace("FromDate=", "")
}
if (h.indexOf("ToDate=") !== -1) {
g = h.replace("ToDate=", "")
}
if (h.indexOf("PickupBuildingCode=") !== -1) {
e = h.replace("PickupBuildingCode=", "")
}
if (h.indexOf("ReturnBuildingCode=") !== -1) {
f = h.replace("ReturnBuildingCode=", "")
}
});
if (c.length || g.length || e.length || f.length) {
b = {
fromDate: c,
toDate: g,
pickupBuildingCode: e,
returnBuildingCode: f
}
}
return b
};
adrma.parseNextPage = function parseNextPage(c) {
var a, c = c || {},
d = c.search || location.search.substring(1),
b = ("&nextpage="),
a, e;
if (!d) {
return a
}
d = d.replace(/NextPage/, "nextpage");
if (d.indexOf("nextpage") != -1) {
if (d.indexOf(b) == -1) {
b = "nextpage="
}
splittArr = d.split(b);
a = splittArr[splittArr.length - 1]
}
if (a) {
a = a + location.hash
}
return a
};
adrma.verticalScrollTo = function verticalScrollTo(e) {
var a = e.container || $("body"),
c = a.find(e.element) || "",
d = e.offset || 0,
b = new $.Deferred();
if (!c.length || c.length > 1) {
return
}
a.animate({
scrollTop: c.position().top + d
}, function() {
b.resolve()
});
return b
};
adrma.addPrerender = function addPrerender(a) {
if (a.absoluteUrl) {
$("<link rel='prerender' href='" + a.absoluteUrl + "'>").appendTo("head")
} else {
$("<link rel='prerender' href='" + a.protocol + "://" + location.hostname + a.url + "'>").appendTo("head")
}
};
adrma.setInvalidatePrerender = function setInvalidatePrerender() {
if (adrma.pageInfo.siteId === "ADR" || !adrma.siteSettings.enableCheckoutPrerender) {
return
}
adrma.cookie("InvalidatePrerender", 1, {
path: "/"
});
console.log("setInvalidatePrerender cookie")
};
adrma.resetInvalidatePrerender = function resetInvalidatePrerender() {
adrma.removeCookie("InvalidatePrerender", {
path: "/"
})
};
adrma.decodeURLToJSON = function decodeURLToJSON(f) {
f = f || location.href;
var a, b, c, d, e;
e = {};
b = document.createElement("a");
b.href = f;
a = b.search.substring(1).split("&");
if (a[0] === "") {
return e
}
for (c = 0; c < a.length; c++) {
a[c].replace(/\+/g, " ");
d = a[c].split("=", 2);
e[decodeURIComponent(d[0])] = decodeURIComponent(d[1])
}
return e
};
adrma.decodeJSONToURL = function decodeJSONToURL(b, c) {
var d, c = c || {},
a = c.isEncode || false;
d = Object.keys(b).map(function(e) {
if (a) {
return encodeURIComponent(e) + "=" + encodeURIComponent(b[e])
} else {
return e + "=" + b[e]
}
}).join("&");
return d
};
adrma.getCleanUrl = function(b) {
if (!b) {
return ""
}
var a = b.match(/^([^?#]+)/);
return a ? a[0] : ""
};
adrma.getHash = function(b) {
if (!b) {
return ""
}
var a = b.match(/(#.+)$/);
return a ? a[0] : ""
};
adrma.getTimezoneStamp = function() {
var a = new Date();
return (a.getTime() - (a.getTimezoneOffset() * 60000))
};
if (typeof Object.prototype.size !== "function") {
Object.size = function(b) {
var c = 0,
a;
for (a in b) {
if (b.hasOwnProperty(a)) {
c++
}
}
return c
}
}
adrma.undupForm = function undupForm(b, c) {
var a = {
className: "disabled",
timeout: 2000
};
c = $.extend(a, c);
if (b.hasClass(c.className)) {
return false
}
b.addClass(c.className);
setTimeout(function() {
b.removeClass(c.className)
}, c.timeout);
return true
};
String.prototype.sanitize = String.prototype.sanitize || function() {
var a = document.createElement("span"),
b = document.createTextNode(this);
a.appendChild(b);
return a.innerHTML
};
String.prototype.htmlEncode = function() {
return String(this).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
};
adrma.encode = function encode(a) {
if (!a) {
return a
}
return a.htmlEncode()
};
adrma.decode = function decode(a) {
return $("<i/>").html(a).text()
};
adrma.stringMath = function stringMath(string) {
string = string.sanitize();
return eval(string)
};
adrma.disableScroll = function disableScroll(a) {
if (adrma.mediaQuery.matches("small", "smallMedium")) {
adrma.disableScrollRWD(a)
} else {
$(document).on("touchmove." + a.namespace + " scroll." + a.namespace, function(b) {
if ($(b.target).closest("ul").hasClass("ui-autocomplete")) {
return
}
b.preventDefault()
});
$(a.ele).on("touchmove." + a.namespace + " scroll." + a.namespace, function(b) {
if (navigator.userAgent.match(/iPad/)) {
adrma.disableScrollRWD(a)
} else {
return
}
})
}
};
adrma.disableScrollRWD = function(b) {
var a = b.namespace ? "touchmove." + b.namespace + " scroll." + b.namespace : "touchmove scroll";
if (navigator.userAgent.match(/iPad/)) {
adrma.iPadOrientationChange(b)
}
$(document).on(a, function(c) {
if ($(c.target).closest("ul").hasClass("ui-autocomplete")) {
return
}
c.preventDefault()
});
$(b.ele).on(a, b, function(c) {
adrma.allowRWDPopupScroll(c)
})
};
adrma.allowRWDPopupScroll = function allowPopupScroll(a, b) {
if ($(document.activeElement).is("input:not(:checkbox)") || $(document.activeElement).is("textarea")) {
return
}
a.stopPropagation()
};
adrma.enableScroll = function enableScroll(b) {
var a = b.namespace ? "touchmove." + b.namespace + " scroll." + b.namespace : "touchmove scroll";
$(document).off(a);
$("body").removeClass("overflow-hidden").css("paddingRight", 0);
if (b.savedPos && $(document).scrollTop() != b.savedPos) {
window.scrollTo(0, b.savedPos)
}
};
adrma.iPadOrientationChange = function(a) {
$(window).on("orientationchange", function(c) {
var b = $("body");
if (!a.isPopup) {
adrma.enableScroll(a);
if (orientation === 90 || orientation === -90) {
b.removeClass("overflow-hidden")
} else {
if (!b.hasClass("overflow-hidden")) {
b.addClass("overflow-hidden")
}
}
}
})
};
adrma.compare = function compare(c, d) {
return c >= d
};
adrma.invalidateStorage = function invalidateStorage() {
adrma.storage.clearAll("local");
adrma.storage.clearAll("local");
adrma.cookie("invalidateStorage", 1, {
path: "/"
})
};
adrma.clearAllUserDataWithoutSession = function clearAllUserDataWithoutSession() {
var a = adrma.storage.get("local", "session");
adrma.storage.clearAll("session");
adrma.storage.clearAll("local");
if (a) {
adrma.storage.set("local", "session", a)
}
};
adrma.getDigits = function getDigits(a) {
return a ? a.replace(/\D/g, "") : ""
};
adrma.getObjProperty = function getObjProperty(c, a) {
var b, d = "";
for (b in c) {
if (c.hasOwnProperty(b) && new RegExp(a).test(b)) {
d = c[b]
}
}
return d
};
adrma.getKeyValuesFromObj = function(c, e, b) {
var d = [],
b = b || [];
function a(j) {
var g = 0,
h = "",
k;
if (j instanceof Array) {
for (g = 0; g < j.length; g++) {
if (b.indexOf(h) !== -1) {
continue
}
a(j[g])
}
} else {
if (j instanceof Object) {
for (h in j) {
if (j.hasOwnProperty(h)) {
if (b.indexOf(h) !== -1) {
continue
}
if (h === e) {
d.push(j[h])
} else {
if (typeof(j[h]) === "string") {
try {
k = JSON.parse(j[h])
} catch (f) {
continue
}
if (!(k instanceof Object)) {
continue
}
a(k)
} else {
a(j[h])
}
}
}
}
}
}
}
a(c);
return d
};
adrma.showGlobalLoading = function showGlobalLoading(a) {
var b = $("#loading");
if (!b.length) {
b = $("<div id='loading'><span class='loading-img'><p class='globalMessage'>" + a + "</p></span></div>").prependTo("body")
}
b.find(".globalMessage").text(a);
b.addClass("show")
};
adrma.hideGlobalLoading = function hideGlobalLoading() {
$("#loading").removeClass("show")
};
adrma.cacheString = function cacheString() {
return "?cacheVersion=" + adrma.pageInfo.cacheVersion + "&svfor=7day"
};
adrma.ratingStarsClass = function ratingStarsClass(a) {
a = a || "";
return "review-stars-" + a.replace(".", "_")
};
adrma.encodeObject = function encodeObject(c) {
var a = {};
for (var b in c) {
a[b] = encodeURIComponent(c[b])
}
return a
};
adrma.escapeDoubleQuoteAndBackSlash = function escapeDoubleQuoteAndBackSlash(c) {
var a = {};
for (var b in c) {
if ($.type(c[b]) === "string") {
a[b] = c[b].replace(/\\/g, "\\\\");
a[b] = a[b].replace(/\"/g, '\\"')
} else {
a[b] = c[b]
}
}
return a
};
adrma.getProductDataObj = function getProductDataObj(d) {
var a = $.Deferred(),
b = false,
c;
if (adrma.pageInfo.pageType === "cartPage") {
return adrma.cartPage.gotCartPageSummary
}
c = adrma.productData && adrma.productData[d];
if (c) {
if (c.type === "regular" || (c.type === "configurable" && c.configurations) || (c.type === "package" && c.components)) {
b = true
}
}
if (b) {
return a.resolve()
} else {
return adrma.getProductData(d)
}
};
adrma.isElementInViewport = function isElementInViewport(a) {
if (typeof jQuery === "function" && a instanceof jQuery) {
a = a[0]
}
var b = a.getBoundingClientRect();
return (b.top >= 0 && b.left >= 0 && b.bottom <= (window.innerHeight || document.documentElement.clientHeight) && b.right <= (window.innerWidth || document.documentElement.clientWidth))
};
adrma.getObjectsByPropertyValue = function getObjectsByPropertyValue(a, b, c) {
return $.grep(a, function(d) {
return d[b] == c
})
};
adrma.getNestedObjectsWithPropertyValue = function getNestedObjectsWithPropertyValue(d, b, g, c) {
var a, e = Object.prototype,
f = e.toString;
("[object Array]" !== f.call(c)) && (c = []);
for (a in d) {
if (e.hasOwnProperty.call(d, a)) {
if (a === b && d[a] == g) {
c.push(d);
continue
} else {
if ("[object Array]" === f.call(d[a]) || "[object Object]" === f.call(d[a])) {
adrma.getNestedObjectsWithPropertyValue(d[a], b, g, c)
}
}
}
}
return c
};
adrma.clearCreditCartField = function clearCreditCartField(a, b) {
var d = b.val(),
c = /[^0-9]+/g;
if (a.type === "paste") {
d = adrma.is.IE ? window.clipboardData.getData("Text") : a.originalEvent.clipboardData.getData("Text")
}
if (d.match(c)) {
d = d.replace(c, "");
b.val(d);
a.preventDefault()
}
};
adrma.editPhoneNumberField = function editPhoneNumberField(b, d) {
b.preventDefault();
if (b.keyCode === 8 || b.keyCode === 37 || b.keyCode === 38 || b.keyCode === 39 || b.keyCode === 40) {
return
}
var h = d.val(),
g = /[^\d]/g,
f = d.attr("maxlength"),
a = d.attr("data-country"),
c = ((a === "US") || (a === "CA")) ? true : false;
if (b.type === "paste") {
h = adrma.is.IE ? window.clipboardData.getData("Text") : b.originalEvent.clipboardData.getData("Text")
}
h = h.replace(/\s/g, "");
h = h.replace(g, "");
if (a === "US" || a === "CA" && h.length > f - 2) {
h = h.slice(0, f - 2)
}
if (c) {
if (b.type === "paste") {
h = adrma.sliceString({
value: h,
slicePoints: [3, 7]
})
}
if (h.length >= 3 && h[3] !== " ") {
h = adrma.sliceString({
value: h,
slicePoints: [3]
})
}
if (h.length >= 7 && h[7] !== " ") {
h = adrma.sliceString({
value: h,
slicePoints: [7]
})
}
} else {
if (h.length > f) {
h = h.slice(0, f)
}
}
d.val(h)
};
adrma.sliceString = function sliceString(b) {
var d = b.value,
c = b.slicePoints;
for (var a = 0; a < c.length; a++) {
d = [d.slice(0, c[a]), " ", d.slice(c[a])].join("")
}
return d
};
adrma.convertDataSrcToSrc = function convertDataSrcToSrc(a) {
a = $(a);
var c = a.is("img, iframe") ? a : a.find("img[data-src], iframe[data-src]"),
b;
c.each(function(e, d) {
d = $(d);
b = d.attr("data-src");
if (b) {
d.attr("src", b);
d.removeAttr("data-src")
}
});
adrma.convertBgDataToStyle(a)
};
adrma.convertBgDataToStyle = function convertBgDataToStyle(a) {
a = $(a);
var c = a.attr("data-bg-src") ? a : a.find("[data-bg-src]"),
b, d;
c.each(function(f, e) {
e = $(e);
b = e.attr("data-bg-src");
d = e.attr("style") || "";
if (b) {
e.attr("style", d + "background-image:url(" + b + ")");
e.removeAttr("data-bg-src")
}
})
};
adrma.onUpdateCartCount = function onUpdateCartCount(a) {
var b = $(".cart-count"),
c = adrma.storage.get("local", "session");
if (c) {
c.cartCount = a;
adrma.storage.set("local", "session", c)
}
if (!b.length && $(".cartCount").length) {
b = $(".cartCount");
b.text("(" + a + ")")
} else {
if (!a) {
b.remove();
return
}
b = b.length ? b : $("<span class='cart-count'>").appendTo(".head-cart");
b.text(a)
}
};
adrma.cutFromString = function(c) {
var d = c.string,
a = c.cutFrom,
b = c.cutLength;
return d.replace(d.substring(a), d.substring(a + b))
};
adrma.checkDisableCookie = function(b) {
var a = (navigator && !navigator.cookieEnabled),
c = "<a href='/i/Privacy#priv-cookies'>Learn more</a>";
if (a) {
adrma.notify.add({
html: (b || "Your browser is set to disallow session cookies. ") + c,
type: "error",
autoClose: false
});
return a
}
};
adrma.isRevisedSessionHandling = adrma.siteSettings.RevisedSessionHandling || adrma.cookie("RevisedSessionHandling");
adrma.getSortedArrayFromObj = function getSortedArrayFromObj(b) {
var c = [],
b = b || {};
for (var a in b) {
if (b.hasOwnProperty(a)) {
c.push({
key: a,
data: b[a]
})
}
}
c.sort(function(d, e) {
return d.data.index - e.data.index
});
return c
};
adrma.getGuid = function getGuid() {
function a() {
return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1)
}
return a() + a() + a()
};
adrma.sortByLowestPrice = function(c, d) {
return c.price - d.price
};
adrma.sortByHighestPrice = function(c, d) {
return d.price - c.price
};
adrma.setInvisibleParameterChange = function(g) {
var c = adrma.cookie("InvisibleParameterChanger");
var f = g.split("=");
var a = f[0];
var d = f[1];
if (c) {
if (c.search(a) !== -1) {
var e = "http://www.adorama.com?" + c;
var b = adrma.decodeURLToJSON(e);
if (b[a]) {
b[a] = d
}
c = adrma.decodeJSONToURL(b)
} else {
c += "&" + g
}
} else {
c = g
}
adrma.cookie("InvisibleParameterChanger", c, {
path: "/"
})
};
adrma.removeDuplicatedItemsFromArr = function(a) {
var c = a,
e = [],
d = {},
b;
for (b = 0; b < c.length; b++) {
if (!d[c[b]]) {
d[c[b]] = true;
e.push(c[b])
}
}
return e
};
adrma.truthyNoop = function() {
return true
};
adrma.hasMiniCartData = function hasMiniCartData() {
var a = adrma.miniCart ? adrma.miniCart.data : null;
return (a && a.cartCount) ? true : false
};
adrma.parseObjectToArray = function parseObjectToArray(a) {
return $.map(a, function(c, b) {
return [c]
})
};
adrma.filterArrayByPropertyVal = function(a, b, c) {
filteredObj = a.filter(function(d) {
return (d[b] === c)
});
return filteredObj[0]
};
adrma.ifBoolParse = function ifBoolParse(a) {
if (typeof a === "string") {
a = a.toLowerCase()
}
if (a === "true") {
a = true
}
if (a === "false") {
a = false
}
return a
};
adrma.getPrivacyModalLink = function getPrivacyModalLink() {
var b = adrma.pageInfo.siteId,
a = {
AD: "ADO",
LP: "LP",
SNS: "SNS",
ADR: "ARC"
};
return "/sup/static/" + a[b] + "/privacy-policy.html"
};
adrma.init = function() {
var a;
adrma.init.initilized = true;
adrma.appStarted = $.now();
for (a in this.init.queue) {
adrma.init.processInit(a)
}
adrma.init.triggerDeferredInit = function() {
if (!adrma.init.initilizedDeferred) {
adrma.init.processDeferredInit()
}
};
adrma.init.loadTimeout = window.setTimeout(function() {
adrma.init.triggerDeferredInit()
}, adrma.is && adrma.is.mobile ? 12000 : 10000);
$(window).load(function b() {
adrma.performance.mark("windowLoadEvent");
setTimeout(function c() {
adrma.init.triggerDeferredInit();
adrma.isPageLoad = true;
adrma.init.loadDfd.resolve("loaded");
adrma.init.dfd.resolve("loaded")
}, 10)
})
};
adrma.init.dfd = $.Deferred();
adrma.init.loadDfd = $.Deferred();
adrma.init.processDeferredInit = function() {
adrma.init.initilizedDeferred = true;
window.clearTimeout(adrma.init.loadTimeout);
for (var a in adrma.init.deferredQueue) {
adrma.init.processInit(a)
}
};
adrma.init.require = function(b) {
if (!$.isArray(b)) {
$.error("...adrma.init.require, wrong dependencies")
}
var a = $.map(b, function(c, d) {
return adrma.getDescendantProp(c.name) ? true : $.getScript("/sup/js/" + c.resource, function() {})
});
return $.when.apply($, a)
};
adrma.init.processInit = function processInit(e) {
var a = adrma.init,
b = a.queue[e] || adrma.init.deferredQueue[e],
c, f = function(h) {
return {
cb: adrma.getDescendantProp(h.cb),
context: h.context,
args: h.args
}
},
d;
if (b.require && b.require.length) {
d = adrma.init.require(b.require)
} else {
d = $.Deferred();
d.resolve()
}
d.done(function g() {
setTimeout(function() {
c = f(b);
c.cb.apply(adrma.getDescendantProp(c.context), [c.args]);
b.done = true
}, b.delay || 0)
})
};
adrma.init.queue = {};
adrma.init.processed = {};
adrma.init.deferredQueue = {};
adrma.init.anonymousCount = 0;
adrma.init.add = function(b) {
if (!b) {
return
}
if (b.hasOwnProperty("beforeInit")) {
var a = b.beforeInit,
c;
if ($.isFunction(a)) {
c = a()
} else {
c = b.beforeInit
}
if (!c) {
return
}
}
if ($.isFunction(b)) {}
var d = {
name: b.name ? b.name : "anonymous-" + (adrma.init.anonymousCount++),
cb: b.cb,
context: b.context ? b.context : adrma,
args: b.args,
require: b.require,
delay: b.delay
};
if (!b.defer && !b.defered) {
this.queue[d.name] = d
} else {
this.deferredQueue[d.name] = d
}
if (adrma.init.initilized) {
if (!b.defer || adrma.init.initilizedDeferred) {
adrma.init.processInit(d.name)
} else {}
}
};
adrma.init.add({
name: "mobileRouter",
cb: function() {
if (!adrma.siteSettings.enableMobileRouting) {
return
}
var b, a;
if (adrma.is.mobile) {
b = adrma.pageInfo.mobileUrl;
a = adrma.cookie("MobileRedirect");
if (b && a !== "1") {
$("body").addClass("pageRedirecting");
location.href = b
}
}
}
});
if (!adrma.isRevisedSessionHandling) {
adrma.init.add({
name: "cacheVersion",
cb: function cacheVersioning() {
var c = adrma.storage.get("local", "cacheVersion"),
b = adrma.pageInfo,
a = b.cacheVersion;
if (c && !adrma.compare(a, c)) {
b.cacheVersion = c;
adrma.invalidateStorage()
}
$.subscribe("gotAsyncData", function d(g, h) {
if (!h.data.cacheVersion) {
return
}
var f = h.data.cacheVersion;
if (f && !adrma.compare(a, f)) {
b.cacheVersion = f;
adrma.invalidateStorage();
adrma.storage.set("local", "cacheVersion", f)
}
})
}
})
}
$.ajaxSetup({
cache: true
});
$(document).ajaxStop(function() {
adrma.hideGlobalLoading()
});
adrma.fetchData = function(g) {
var h, d, l = this.fetchData,
e, j = $.Deferred();
adrma.fetchData.defualts = {
returnPromise: false,
showGlobalLoader: true,
globalLoaderMessage: "Loading...",
beforeSend: function b() {
var m = true;
if (adrma.siteSettings.EnableGlobalLoader === false) {
m = false
}
if (g.showGlobalLoader && m) {
adrma.showGlobalLoading(g.globalLoaderMessage)
}
},
data: "",
dataType: "",
type: "GET",
timeout: 50000,
resolveWithCache: true,
ifCachedStillCallback: false,
passParams: true,
showTimoutError: false,
showSlowMessage: false,
notifyTimeout: adrma.mediaQuery.matches("small", "smallMedium") ? 40000 : 25000,
timeOutMessage: "Oops! We seem to be having some issues, this is not your fault. Please refresh the page. If you are still getting this error please contact us at " + adrma.siteSettings.CompanyCallFreePhone,
slowMessage: "still working on it...",
abortIfNotifyTimeout: false,
error: function(m) {
if (g.returnPromise) {}
adrma.log(m)
},
contentType: "",
checkTimeout: function c(n, m) {
if (!/^\/(sup|api|col|searchSite)/i.test(g.url)) {
return
}
setTimeout(function o() {
if ($(".ajax-slow").length) {
return
}
if (n.state() === "pending") {
if (g.abortIfNotifyTimeout) {
n.reject()
}
if (g.showSlowMessage && adrma.notify) {
adrma.notify.add({
html: "<p data-timestamp='" + g.id + "'>" + g.slowMessage + "</p>",
autoClose: false,
type: "slow-message ajax-slow secondary"
})
}
adrma.analytics.addEvent({
category: "ajax responses",
action: "slow|" + g.url,
label: adrma.pageInfo.pageType,
noninteraction: 1
})
}
}, m)
}
};
g = $.extend(this.fetchData.defualts, g);
g.id = (+new Date());
if (g.contentType === "json") {
g.contentType = "application/json; charset=utf-8"
}
if (g.type.toLowerCase() === "post" && !g.preserveContentType) {
g.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
}
g.url = adrma.cacheParam(g.url, g);
if (g.type !== "POST" && g.dataType === "script" || g.dataType === "JSON") {
var k;
$["get" + (g.dataType === "script" ? "Script" : "JSON")](g.url, function(m) {
adrma.noop = $.isFunction(g.callback) && g.callback(m);
j.resolve(m)
})
} else {
$.ajax({
url: g.url,
beforeSend: g.beforeSend,
data: g.data,
type: g.type,
timeout: g.type,
dataType: g.dataType,
contentType: g.contentType,
success: function(n, o, m) {
adrma.noop = $.isFunction(g.callback) && g.callback(n);
j.resolve(n, o, m)
},
error: g.error
}).always(function a(p) {
var m = $("." + g.id),
o, n;
if (m.length) {
o = parseInt(m.find("p").attr("data-timestamp"));
m.remove();
n = (+new Date()) - o;
adrma.analytics.addEvent({
category: "ajax responses",
action: "resolved|" + g.url,
label: adrma.pageInfo.pageType,
value: n / 60,
noninteraction: 1
})
}
}).fail(function f(n, p, m) {
j.reject(n, p, m);
if (!/^\/(sup|api|col|searchSite)/i.test(g.url)) {
return
}
var o = $("slow-message");
if (o.length) {
o.filter("data-timestamp", g.id).remove()
}
if (g.showTimoutError && adrma.notify && !adrma.notify.disableErrorMessages) {
adrma.notify.add({
html: "<p data-timestamp='" + g.id + "'>" + g.timeOutMessage + "</p>",
autoClose: false,
type: "error ajax-fail"
})
}
adrma.analytics.addEvent({
category: "ajax responses",
action: "fail|" + g.url,
label: adrma.pageInfo.pageType,
noninteraction: 1
})
})
}
g.checkTimeout(j, g.notifyTimeout);
return j
};
adrma.uploadFiles = function uploadFiles(d) {
var c = new FormData(),
a = function(e) {
for (i = 0; i < e.arr.length; i++) {
c.append(e.key, e.arr[i])
}
},
b = function() {
for (var e in d.data) {
if (d.data.hasOwnProperty(e)) {
if (d.data[e] instanceof Array) {
a({
key: e,
arr: d.data[e]
})
} else {
c.append(e, d.data[e])
}
}
}
};
b();
return $.ajax({
url: d.url,
type: "POST",
data: c,
cache: false,
dataType: "json",
processData: false,
contentType: false,
})
};
adrma.cacheParam = function cacheParam(q, n) {
if (n.type && n.type.toLowerCase() !== "get") {
return q
}
var o = adrma.pageInfo,
m = /\/sup\//i.test(q),
k = new RegExp("//api//", "i").test(q),
l = /\/searchsite\/popups\//i.test(q),
p = n.productVersion || false,
e = n.cacheRemoteKey || "svfor",
f = n.length || "7day",
b = n.cacheLocalKey || "svcfor",
c = "5m",
d = n.cacheLocal ? true : n.cacheRemote,
a = n.cacheLocal,
j = /\?/.test(q),
h = j && /svfor/.test(q),
g = n.data && n.data[e];
if (k) {
if (q.indexOf("/user/") !== -1) {
return q
}
if (q.search(/^\/api\//i) !== 0) {
if (q.search(location.origin) !== 0) {
return q
}
}
}
if (h || g) {
return q
}
if (d || m || k || l) {
q = q + (j ? "&" : "?") + e + "=" + f + "&cacheVersion=" + o.cacheVersion
}
if (k || n.productVersion) {
q = q + "&productVersion=" + o.productVersion
}
if (a || m) {
q = q + "&" + b + "=" + c
}
return q
};
(function() {
var a = {};
this.tmpl = function b(e, c) {
var d = !/\W/.test(e) ? a[e] = a[e] || b(document.getElementById(e).innerHTML) : new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('" + e.replace(/[\r\t\n]/g, " ").replace(/'(?=[^%]*%>)/g, "\t").split("'").join("\\'").split("\t").join("'").replace(/<%=(.+?)%>/g, "',$1,'").split("<%").join("');").split("%>").join("p.push('") + "');}return p.join('');");
return c ? d(c) : d
}
})();
adrma.template = {
get: function(d, b) {
var c = this,
a = $.Deferred(),
e = document.getElementById(d);
if (e) {
a.resolve()
} else {
if (c.tempCache[d]) {
return c.tempCache[d]
}
c.tempCache[d] = a;
c.fetch(d).done(function f() {
setTimeout(function g() {
delete c.tempCache[d];
a.resolve()
}, 1)
}).fail(a.reject)
}
return a
},
fetch: function(a) {
return adrma.fetchData({
url: "/sup/views/" + a + ".html"
}).done(function(b) {
$("body").append(b)
})
},
render: function render(a) {
var c = {
mode: "dynamic",
template: "",
ele: "",
data: {},
returnContent: false
},
d = $.extend({}, c, a),
b = (d.mode && d.mode === "static") ? $("#" + d.template).html() : tmpl(d.template, d.data);
if (d.returnContent) {
return b
}
d.ele = $(d.ele).removeClass("loading");
d.ele[d.method](b)
},
tempCache: {}
};
if (!adrma.isRevisedSessionHandling) {
adrma.session = {
init: function(f) {
var d = this,
e = adrma.storage.get("local", "session");
var b = adrma.cookie("IsLoggedIn"),
a = b && b.toLowerCase() === "true";
if (f !== "new") {
if (e && a === e.isLoggedIn) {
d.gotSession({
data: e
});
return
}
}
if (adrma.siteSettings.enableDdosMode && !a && adrma.pageInfo.siteId === "AD") {
var c = d.mockSession;
d.gotSession({
data: d.mockSession
});
return
}
adrma.fetchData({
url: "/api/user/GetSession",
type: "POST",
data: {
referrer: document.referrer
},
dataType: "json"
}).done(d.gotSession)
},
mockSession: {
sid: "0",
isLoggedIn: false,
cartCount: 0,
isSubcribed: false,
isSocialLogin: false,
cookieSid: "0",
userAgent: ""
},
getSession: $.Deferred(),
gotSession: function(c, f) {
var e = adrma.session,
b = c.data,
d = adrma.session;
d.requestIndex = d.requestIndex ? d.requestIndex + 1 : 1;
if (f) {
e.encodeResponseData(b)
}
e.storeSession(b);
e.decodeResponseData(b);
$.publish("session/gotSession", b);
if (d.requestIndex === 1) {
var a = /iPhone|iPad|iPod/.test(navigator.platform) ? 1000 : 0;
setTimeout(function() {
adrma.getAsyncData.init()
}, a)
}
e.getSession.resolve(b)
},
encodeResponseData: function(a) {
if (a.firstName && a.lastName) {
a.firstName = adrma.encode(a.firstName);
a.lastName = adrma.encode(a.lastName)
}
},
decodeResponseData: function(a) {
if (a.firstName && a.lastName) {
a.firstName = adrma.decode(a.firstName);
a.lastName = adrma.decode(a.lastName)
}
},
storeSession: function(a) {
if (adrma.analytics) {
adrma.analytics.setLoginDimention(a)
}
this.session = a;
return adrma.storage.set("local", "session", a)
},
clearStoredSession: function() {
adrma.storage["delete"]("local", "session")
},
restartSession: function() {
var a = this;
a.getSession = $.Deferred();
a.init("new");
return a.getSession
},
updateSession: function updateSession(a) {
var b = this;
if (!a) {
b.restartSession();
return
}
b.storeSession(a);
b.decodeResponseData(a);
$.publish("session/gotSession", a)
}
}
}
if (adrma.isRevisedSessionHandling) {
adrma.session = {
init: function(h) {
var e = this,
g = adrma.storage.get("local", "session"),
d = adrma.cookie("AJAXrefby");
e.initSessionKeys();
if (d && d === "napp") {
h = "new"
}
if (e.isProtocolChangad()) {
h = "new";
e.invalidateLocalStorage()
}
if (!g) {
h = "new"
}
if (adrma.pageInfo.pageType === "cartPage" || adrma.pageInfo.pageType === "checkoutPage") {
h = "new"
}
if (g && e.isSessionKeysChanged()) {
h = "new"
}
e.setSidAndAspNetCookies();
var b = adrma.cookie("IsLoggedIn"),
a = b && b.toLowerCase() === "true";
if (h !== "new") {
if (g && (a === g.isLoggedIn || !b)) {
e.gotSession({
data: g
});
return
}
if (!g) {
var c = e.mockSession,
f = adrma.cookie("sid3");
if (f) {
c.cookieSid = f
}
e.gotSession({
data: e.mockSession
});
return
}
}
adrma.fetchData({
url: "/api/user/GetSession",
type: "POST",
data: {
referrer: document.referrer,
pageType: adrma.pageInfo.pageType
},
dataType: "json"
}).done(e.gotSession)
},
setSidAndAspNetCookies: function(c) {
var b = this,
d = adrma.cookie("sid3"),
a = adrma.cookie("ASP.NET_SessionId");
if (!d) {
b.createJSSession()
}
if (!a) {
b.createASPNetSessionId()
}
},
isProtocolChangad: function() {
var c = this,
b = false,
a = adrma.cookie("lastPrtcl");
if (a) {
if (a !== location.protocol) {
b = true
}
}
adrma.cookie("lastPrtcl", location.protocol, {
path: "/"
});
return b
},
isSessionKeysChanged: function() {
var d = this,
c = false,
e = adrma.storage.get("local", "sessionKeys"),
f = JSON.parse(adrma.siteSettings.SessionKeys);
if (!e) {
return c = true
}
for (var a = 0; a < f.length; a++) {
var b = f[a];
if (adrma.cookie(b) !== e[b]) {
return c = true
}
}
return c
},
invalidateLocalStorage: function() {
adrma.storage["delete"]("local", "miniCart");
adrma.storage["delete"]("local", "session")
},
mockSession: {
sid: "0",
isLoggedIn: false,
cartCount: 0,
isSubcribed: false,
isSocialLogin: false,
cookieSid: "0",
userAgent: ""
},
getSession: $.Deferred(),
gotSession: function(c, f) {
var e = adrma.session,
b = c.data,
d = adrma.session;
d.requestIndex = d.requestIndex ? d.requestIndex + 1 : 1;
if (f) {
e.encodeResponseData(b)
}
e.storeSession(b);
e.decodeResponseData(b);
$.publish("session/gotSession", b);
if (d.requestIndex === 1) {
var a = /iPhone|iPad|iPod/.test(navigator.platform) ? 1000 : 0;
setTimeout(function() {
adrma.getAsyncData.init()
}, a)
}
e.getSession.resolve(b)
},
encodeResponseData: function(a) {
if (a && a.firstName && a.lastName) {
a.firstName = adrma.encode(a.firstName);
a.lastName = adrma.encode(a.lastName)
}
},
decodeResponseData: function(a) {
if (a && a.firstName && a.lastName) {
a.firstName = adrma.decode(a.firstName);
a.lastName = adrma.decode(a.lastName)
}
},
storeSession: function(b) {
var a = this;
if (adrma.analytics && adrma.analytics.setLoginDimention) {
adrma.analytics.setLoginDimention(b)
}
a.session = b;
a.updateSessionKeys();
return adrma.storage.set("local", "session", b)
},
clearStoredSession: function() {
adrma.storage["delete"]("local", "session")
},
restartSession: function() {
var a = this;
a.getSession = $.Deferred();
a.init("new");
return a.getSession
},
getFormattedDate: function getFormattedDate() {
var a = new Date();
a = a.getFullYear() + "" + ("0" + (a.getMonth() + 1)).slice(-2) + "" + ("0" + a.getDate()).slice(-2) + "" + ("0" + a.getHours()).slice(-2) + "" + ("0" + a.getMinutes()).slice(-2) + "" + ("0" + a.getSeconds()).slice(-2) + "" + ("0" + a.getMilliseconds()).slice(-3);
return a
},
createJSSession: function createJSSession() {
generatedSessionId = this.getFormattedDate() + Math.floor(Math.random() * 100);
adrma.cookie("sid3", generatedSessionId, {
path: "/",
expires: 10950
});
adrma.cookie("js_sid", 1, {
path: "/",
expires: 10950
});
return generatedSessionId
},
createASPNetSessionId: function createASPNetSessionId() {
var a = this.getFormattedDate(),
b = "abcdefghijklmnopqrstuvwxyz012345",
c = "",
e = {
"6": "w",
"7": "x",
"8": "y",
"9": "z"
};
for (var d = 0; d < 7; d++) {
c += b.charAt(Math.floor(Math.random() * b.length))
}
a = a.replace(/6|7|8|9/gi, function(f) {
return e[f]
});
a = a + c;
adrma.cookie("ASP.NET_SessionId", a, {
path: "/"
});
adrma.cookie("js_sid.net", 1, {
path: "/"
});
return a
},
updateSession: function updateSession(a) {
var b = this;
if (!a) {
b.restartSession();
return
}
b.storeSession(a);
b.decodeResponseData(a);
$.publish("session/gotSession", a)
},
initSessionKeys: function initSessionKeys() {
var a = this;
if (!adrma.storage.get("local", "sessionKeys")) {
a.setSessionKeys()
}
},
setSessionKeys: function setSessionKeys() {
var b = {},
c = JSON.parse(adrma.siteSettings.SessionKeys);
for (var a = 0; a < c.length; a++) {
cookieKey = c[a];
b[cookieKey] = adrma.cookie(cookieKey)
}
adrma.storage.set("local", "sessionKeys", b)
},
updateSessionKeys: function updateSessionKeys() {
var a = this;
a.setSessionKeys()
}
}
}
adrma.actions = {
init: function() {
var b = this,
a = adrma.mediaQuery.isTouch;
$(document).on("click submit change focusin focus blur", ".action", function(h) {
var l = $(this),
c = l.attr("data-action") || "",
f = l.attr("data-action-type") || "click",
m = (l.attr("data-prevent-default") === "false") ? false : true,
j = h.type,
o = function(r) {
var e = (r.action) ? b[r.action] : "",
s = r.actionType;
if (s && j !== s) {
return
}
if (e && $.isFunction(e)) {
e.apply(b, [h, l])
}
if (m) {
h.preventDefault()
}
};
c = c.split(",");
if ($.inArray(f, ["change", "focusin", "focus", "blur"]) > -1) {
m = false
}
f = f.split(",");
if ($.inArray(j, f) < 0) {
return
}
if (l.hasClass("disable")) {
if (j === "submit") {
h.preventDefault()
}
return false
}
if (j == f && !a) {
l.addClass("disable");
var q = l.attr("data-action-timeout") || 300;
q = parseInt(q, 10);
if (j === "submit") {
var p = l.find("button[type=submit]").addClass("disable")
}
setTimeout(function n() {
l.removeClass("disable");
if (p) {
p.removeClass("disable")
}
}, q)
}
for (var k = 0, d = c.length, g = f.length; k < d; k++) {
o({
action: c[(d > 1) ? k : 0],
actionType: f[(k < g) ? k : 0],
preventDefault: m
})
}
})
},
add: function add(a) {
$.extend(this, a)
},
remove: function remove(a) {
try {
delete this[a]
} catch (b) {}
},
toggleInAction: function toggleInAction(b, a) {
b[(a ? a : "toggle") + "Class"]("in-action")
}
};
(function() {
function b(e, c) {
for (var d in e) {
c.apply(this, [d, e[d]]);
if (typeof(e[d]) == "object") {
b(e[d], c)
}
}
}
adrma.query = {
json: function(c, d, e) {
if ($.isArray(c)) {
for (var f in c) {
if (c.hasOwnProperty(f)) {
if (c[f][d] === e) {
return [c[f], f]
}
}
}
}
},
array: function(c, d, e) {
return this.json.apply(null, arguments)
},
findIndex: function a(c, d) {
var e = -1;
$.each(c, function(h, g) {
var f = d(h, g);
if (f) {
e = h;
return false
}
});
return e
}
}
})();
adrma = window.adrma || {};
adrma.storage = {
supported: function() {
try {
localStorage.setItem("localStorage", "");
localStorage.removeItem("localStorage");
return "localStorage" in window && window.localStorage !== null
} catch (a) {
return false
}
},
toType: function(a) {
return ({}).toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
},
get: function(f, c, d) {
if (!this.isSupported) {
return
}
var b = window[f + "Storage"].getItem(c);
try {
b = JSON.parse(b)
} catch (a) {}
return b
},
set: function(c, b, d) {
if (!this.isSupported) {
return
}
var e = this.toType(d);
if (/object|array/.test(e)) {
d = JSON.stringify(d)
}
try {
window[c + "Storage"].setItem(b, d);
return true
} catch (a) {
return false
}
},
add: function(e) {
if (!this.isSupported) {
return
}
if (typeof e === "string") {
e = {
key: e,
value: arguments[1]
}
}
var a = {
type: "local",
key: "",
val: "",
propsAreObjs: false,
wrapperType: "array",
comparePropName: "",
limit: null,
addDirection: "push"
};
e = $.extend({}, a, e);
var f = adrma.storage.get(e.type, e.key),
g = $.type(f),
h = $.type(e.val),
b = function b() {
if (!f) {
f = []
}
if ($.type(f) === "object") {
f = [f]
}
if (h === "object") {
var j = $.grep(f, function(k) {
return (e.val[e.comparePropName] === k[e.comparePropName])
});
if (j.length) {
e.val = f;
return false
}
} else {
isInArray = $.inArray(e.val, f);
if (isInArray !== -1) {
f.push(e.val)
}
}
if (e.limit && f.length >= e.limit) {
f[e.addDirection === "push" ? "shift" : "pop"]()
}
f[e.addDirection](e.val);
e.val = f
},
c = function c() {
f = f || {};
f = $.extend(f, e.val);
e.val = f
},
d = function d() {};
if (f) {
if (e.wrapperType === "array") {
b()
} else {
switch (g) {
case "object":
c();
break;
case "array":
b();
break;
case "string":
d();
break
}
}
} else {
if (e.wrapperType === "array") {
b()
} else {
switch (h) {
case "object":
c();
break;
case "array":
b();
break;
case "string":
d();
break
}
}
}
return adrma.storage.set(e.type, e.key, e.val, e.isObj)
},
remove: function(d, b, e) {
if (!this.isSupported) {
return
}
var c = adrma.storage.get(d, b),
a;
if (c) {
if ($.isArray(c)) {
a = $.inArray(e, c);
adrma.noop = a !== -1 && c.splice(a, 1);
e = c;
adrma.storage.set(b, e)
}
}
},
"delete": function(b, a) {
if (!this.isSupported) {
return
}
window[b + "Storage"].removeItem(a)
},
sync: function(b, c, a) {},
compare: function(a, b) {},
getAll: function(c, a) {
if (!this.isSupported) {
return
}
var b = window[c + "Storage"];
if (a === "string") {
return JSON.stringify(b)
}
return b
},
clearAll: function(a) {
if (!this.isSupported) {
return
}
window[a + "Storage"].clear()
}
};
adrma.storage.isSupported = (function() {
return adrma.storage.supported()
})();
adrma.EventIntent = function() {
if (!this instanceof adrma.EventIntent) {
return new adrma.EventIntent()
}
return this
};
adrma.EventIntent.prototype = {
init: function(d) {
var e = this;
$.extend(e, d);
e.ele = (typeof d.ele === "string") ? $(d.ele) : d.ele;
var a = e.eventNamespace || "eventIntent",
b = navigator.userAgent.match(/iPad/i) !== null,
c = b ? "touchend" : "mouseleave";
e.ele.on("mouseenter." + a + " mouseleave." + a, function(f) {
var g = f.type,
j = $(this),
h = j.data("inIntentTimeout"),
k = j.data("outIntentTimeout");
if (g === "mouseenter") {
e.clearTimeout(h, j, "in", f);
e.clearTimeout(k, j, "out", f);
e.setTimeout(j, "in", f)
} else {
e.clearTimeout(h, j, "in", f);
e.clearTimeout(k, j, "out", f);
e.setTimeout(j, "out", f)
}
})
},
sensitivity: 250,
activeClass: "hover",
setTimeout: function(d, b, c) {
var g = this,
h = function() {
g.onTimeout.apply(g, [d, b, c])
},
a = d.attr("data-sensitivity-" + b) ? d.attr("data-sensitivity-" + b) : this.sensitivity,
f = setTimeout(h, a);
d.data(b + "IntentTimeout", f);
if (b === "out") {
this.intentActiveFn = h
}
},
clearTimeout: function(c, b, a) {
if (!c) {
return
}
clearTimeout(c);
$.removeData(b, a + "IntentTimeout");
if (a === "out") {
self.intentActiveFn = null
}
},
onTimeout: function(c, a, b) {
if (a === "in") {
c.addClass(this.activeClass);
this.inIntentCallback(c, b)
} else {
c.removeClass(this.activeClass);
this.outIntentCallback(c, b);
this.intentActiveFn = null
}
},
intentActiveFn: null,
inIntentCallback: $.noop,
outIntentCallback: $.noop
};
adrma.popup = {
init: function() {
var b = this;
$(document).on("click", ".popup", function(d) {
var g = $(this),
h = g.attr("data-popup-options"),
f = g.attr("href");
if (!g.attr("data-popup-class") && !g.attr("rel")) {
return
}
if (g.hasClass("window-open")) {
b.popWindow({
url: f,
width: g.attr("data-window-width"),
height: g.attr("data-window-height")
});
return false
}
if (g.closest(".popupContent").length || g.closest(".nestedPopupContainer").length) {
b.nested(g);
return false
}
setTimeout(function() {
var e = $(d.target).closest(".hoverTips");
if (e.length) {
e.hide()
}
}, 100);
if (g.hasClass("action")) {
g.removeAttr("href");
setTimeout(function c() {
g.attr("href", f) || g.attr("data-href", f);
if (!d.isDefaultPrevented()) {
b.getEleData(g);
b.buildFrags()
}
}, 10);
return
}
b.getEleData(g);
b.buildFrags();
return false
});
adrma.actions.add({
closePopup: function a(c, d) {
b.triggerClose()
}
});
adrma.init.add({
name: "touchPopupScrolling",
cb: function() {
$(document).on("blur", ".popupContent :input", function() {
setTimeout(function() {
window.scrollTo(document.body.scrollLeft, document.body.scrollTop)
}, 0)
})
},
beforeInit: adrma.is.touch
});
$("body").addClass("popup-init")
},
properties: {
popupPageFill: "popupPageFill",
popupBorder: "popupBorder",
popupContainer: "popupContainer",
popupExit: "popupExit",
popupHeader: "popupHeader",
popupContent: "popupContent",
nestedContainer: "nestedPopupContainer",
nestedTitle: "nestedPopupTitle",
nestedClose: "nestedPopupClose",
nestedContent: "nestedPopupContent"
},
getEleData: function getEleData(a) {
var d = this,
b = a.attr("data-popup-options"),
c = b ? JSON.parse(b) : {};
d.eleData = {
jThis: a,
href: a.attr("href") || a.attr("data-href"),
title: a.attr("title"),
popupClass: (a.attr("data-popup-class") || a.attr("rel")),
callback: a.attr("data-callback"),
closeCallback: a.attr("data-close-callback"),
callbackArgs: a.attr("data-callback-arguments") || "",
callbackContext: adrma.getDescendantProp(a.attr("data-callback-context")) || window,
cacheResponse: a.attr("data-cache-response") === "false" ? false : true,
options: c,
pubId: a.attr("data-popup-pubId"),
popupScrollSelector: a.attr("data-popup-scroll") || "",
disableClose: c.disableClose
}
},
buildFrags: function() {
var a = this;
if (this.cachedFrags) {
this.customize();
return
}
this.popupPageFill = $("<div class='" + this.properties.popupPageFill + "'>").on("click", $.proxy(a.close, a));
this.popupBorder = $("<div/>");
this.popupContainer = $("<div/>").addClass(this.properties.popupContainer);
this.popupHeader = $("<h2/>").addClass(this.properties.popupHeader);
this.popupExit = $("<div/>").addClass(this.properties.popupExit);
this.popupContent = $("<div/>").addClass(this.properties.popupContent);
this.popupPageFill.append(this.popupBorder);
this.popupBorder.append(this.popupContainer);
this.popupBorder.append(this.popupExit);
this.popupContainer.append(this.popupHeader);
this.popupContainer.append(this.popupContent);
this.cachedFrags = true;
this.customize()
},
isImage: function(a) {
return (/(?:jpg|gif|png)/.test(a))
},
handleImage: function() {
var a = this;
return "<div class='imageWrapper'><img src='" + a.eleData.href + "'/></div>"
},
customize: function() {
var b = this;
b.applyClassesToPopUpWindow(b.eleData);
b.popupBorder.removeAttr("class").addClass(b.properties.popupBorder);
b.popupHeader.text(b.eleData.title || "");
b.popupContent.removeClass("loaded");
b.addToPage();
b.fixPosition();
b.show();
setTimeout(function a() {
$.publish("popup/loaded", b)
}, 100)
},
addToPage: function() {
if ($("." + this.properties.popupPageFill).length) {
return
}
$("body").append(this.popupPageFill)
},
fixPosition: function() {
var a = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
if (a < 650) {
this.popupBorder.addClass("viewPortLessThen650");
return
}
if (a < 800) {
this.popupBorder.addClass("viewPortLessThen800");
return
}
},
show: function() {
var a = this;
a.popupPageFill.fadeIn(300, function() {
a.load()
});
$(document).on("keydown.adrmaPop", function(b) {
adrma.noop = ((b.keyCode ? b.keyCode : b.which) === 27) && a.close(b)
});
a.scrollOptions = {
savedPos: $(document).scrollTop(),
namespace: "adrmaPop",
ele: $(".popupContent")
};
if (navigator.userAgent.match(/iPad/)) {
a.popupBorder.addClass("iPadPopup")
}
a.disablePopupScroll();
if (adrma.getScrollWidth) {
$("body, html").addClass("overflow-hidden").not("html").css("paddingRight", adrma.getScrollWidth())
}
},
load: function(c) {
var e = this,
b = $.Deferred(),
a = !c ? e.eleData : c.eleData;
staticHtml = a.jThis.attr("data-html");
if (staticHtml) {
b.resolve(staticHtml)
} else {
if (e.isImage(a.href)) {
b.resolve(e.handleImage())
} else {
var f = a.href || "",
d = (f && f.indexOf("?") === -1) ? "?" : "&";
if (!f) {
b.reject()
}
f += d + "cacheVersion=" + adrma.pageInfo.cacheVersion + "&svfor=7day";
adrma.fetchData({
url: f
}).done(function(g) {
b.resolve(g)
})
}
}
b.done(function(h) {
if (c) {
c.content.html(h).addClass("loaded").removeAttr("style");
e.callback(c.eleData);
if (c.eleData.popupScrollSelector) {
e.scrollToElement(c.eleData)
}
$.publish("content/added", c.content);
return false
}
var j = e.popupContent;
if (h.search(/rel="stylesheet"|data-fouc-rendering/i) !== -1) {
j.addClass("fouc-rendering");
setTimeout(function g(k) {
j.removeClass("fouc-rendering")
}, 800)
}
j.html(h).addClass("loaded");
e.callback(e.eleData);
if (e.eleData.pubId) {
$.publish(e.eleData.pubId + "/popupLoaded")
}
$.publish("content/added", j);
if (e.eleData.popupScrollSelector) {
e.scrollToElement(e.eleData)
}
}).fail(function() {
e.popupContent.html("<div class='errorLoadingPopup'> Sorry! The content of this popup failed to load</div>").addClass("loaded");
if (e.eleData.pubId) {
$.publish(e.eleData.pubId + "/popupFailed")
}
})
},
close: function(a) {
var d = $(a.target),
c = this,
b = this.eleData ? this.eleData.options : {};
if (!this.eleData) {
return
}
if (b && b.disableClose && !d.hasClass("force-enable-close")) {
return
}
c.forceClose(a)
},
forceClose: function(b) {
var j = $(b.target),
h = this,
g = $("." + h.properties.nestedContainer),
d = g.last(),
f = $("." + h.properties.popupContent),
c = false,
a = h.eleData;
if (h.hasNested) {
if (b.type !== "keydown" && j.closest("." + this.properties.nestedContainer).length && !j.is("." + this.properties.nestedClose)) {
return
}
if (g.length > 1) {
g.eq(g.length - 2).fadeIn(300);
h.hasNested = true;
h.nestedArray.splice(h.nestedArray.length - 1, 1);
a = h.nestedArray[h.nestedArray.length - 1].eleData
} else {
c = true;
f.fadeIn(300);
h.hasNested = false
}
h.applyClassesToPopUpWindow(a);
d.fadeOut(300, function() {
d.remove();
h.closeNested()
});
if (!j.is("." + this.properties.popupExit)) {
return
}
}
if (b.type !== "keydown" && j.closest("." + this.properties.popupBorder).length && !j.is("." + this.properties.popupExit)) {
return
}
h.closeCallback(h.eleData);
this.popupPageFill.fadeOut(300, function() {
h.popupContent.empty();
$(document).off("keydown.adrmaPop");
adrma.enableScroll({
ele: h.scrollOptions.ele,
namespace: h.scrollOptions.namespace,
savedPos: h.scrollOptions.savedPos
});
$("body, html").removeClass("overflow-hidden").not("html").css("paddingRight", 0);
h.hasNested = false;
g.remove();
f.fadeIn(100);
h.nestedArray = [];
h.eleData = null
})
},
callback: function(a) {
var b = this;
setTimeout(function() {
var c = a.callback,
d;
if (!c) {
return
}
var e = adrma.getDescendantProp(c);
c = e ? e : c;
d = $.isFunction(c) ? c : adrma[c];
d = $.isFunction(d) ? d : d.init;
adrma.noop = $.isFunction(d) && d.apply(a.callbackContext, [a.callbackArgs])
}, 1)
},
closeCallback: function(c) {
var d = this,
a = c.closeCallback,
b;
var e = adrma.getDescendantProp(a);
a = e ? e : a;
b = $.isFunction(a) ? a : adrma[a];
if (!a && !$.isFunction(b)) {
return
}
b.apply(c.closeCallbackContext, [c.closeCallbackArgs])
},
hasNested: false,
nested: function(a) {
self = this;
self.nestedArray = self.nestedArray || [];
self.hasNested = true;
var b = {};
b.eleData = {
jThis: a,
href: a.attr("href") || a.attr("data-href"),
title: a.attr("title"),
popupClass: a.attr("data-popup-class"),
callback: a.attr("data-callback"),
callbackArgs: a.attr("data-callback-arguments") || "",
popupScrollSelector: a.attr("data-popup-scroll") || "",
options: a.attr("data-popup-options")
};
self.nestedArray.push(b);
this.buildNested(b);
this.disablePopupScroll(true)
},
buildNested: function(a) {
var b = this;
a.container = $("<div/>").addClass(b.properties.nestedContainer);
a.content = $("<div/>").addClass(b.properties.nestedContent).css({
maxHeight: "300px",
minHeight: "300px"
});
a.close = $("<div/>").addClass(b.properties.nestedClose + " button button-gray").text("Back");
a.title = $("<h2/>").addClass(b.properties.nestedTitle).html(a.eleData.title);
a.title.append(a.close);
a.container.append(a.title);
a.container.append(a.content);
$("." + b.properties.nestedContainer).removeClass("active");
a.container.addClass("active");
b.popupContainer.append(a.container);
a.container.fadeIn(250, function() {
b.applyClassesToPopUpWindow(a.eleData)
});
b.hideAllOtherNested();
b.load(a)
},
applyClassesToPopUpWindow: function appliedClassesToPopUpWindow(a) {
var b = this;
b.popupPageFill.removeAttr("class").addClass(b.properties.popupPageFill + " " + (a.popupClass || "")).addClass(a.disableClose ? "popupExit-disabled" : "")
},
hideAllOtherNested: function(c) {
var a = $("." + self.properties.popupContent),
b = $("." + self.properties.nestedContainer + ":not(.active)");
b.fadeOut(300);
a.fadeOut(300)
},
closeNested: function() {},
trigger: function triggerPop(e) {
var h = e.href ? "href='" + e.href + "' " : "",
f = e.html ? "data-html='" + adrma.encode(e.html) + "'" : "",
k = e.popupClass ? "data-popup-class='" + e.popupClass + "' " : "",
g = e.callback ? "data-callback='" + e.callback + "' " : "",
d = e.closeCallback ? "data-close-callback='" + e.closeCallback + "' " : "",
b = e.callbackArguments ? "data-callback-arguments='" + e.callbackArguments + "' " : "",
c = e.callbackContext ? "data-callback-context='" + e.callbackContext + "' " : "",
m = e.title ? "title='" + e.title + "' " : "",
n = "class='popup' ",
j = e.options ? "data-popup-options='" + JSON.stringify(e.options) + "'" : "",
l = e.pubId ? "data-popup-pubId='" + e.pubId + "'" : "",
a = n + h + k + g + d + b + c + m + f + j + l;
$("<a " + a + "> </a>").appendTo("body").trigger("click").remove()
},
triggerClose: function triggerClose() {
$(".popupPageFill").find(".popupExit").trigger("click")
},
popWindow: function popWindow(b) {
var a = {
url: "",
name: "",
width: "",
height: "",
extraConfig: "status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=yes,addressbar=no"
};
b = $.extend(a, b);
b.name = b.name ? b.name : "rand-" + (+new Date());
b.name = (adrma.mediaQuery.isTouch) ? "_blank" : b.name;
if (window.open) {
var c = (screen.width / 2) - (b.width / 2),
d = (screen.height / 2) - (b.height / 2);
poppedWindow = window.open(b.url, b.name, "width=" + b.width + ",height=" + b.height + ",top=" + d + ",left=" + c + "," + b.extraConfig + "");
poppedWindow.focus()
} else {
alert("Your security settings are not allowing our popup windows to function. Please make sure your security software allows popup windows to be opened by this web application.")
}
},
disablePopupScroll: function disablePopupScroll(b) {
var a = b ? $(".nestedPopupContent") : this.scrollOptions.ele;
adrma.disableScroll({
ele: a,
namespace: this.scrollOptions.namespace,
isPopup: true
})
},
scrollToElement: function scrollToElement(a) {
var d = this,
c = d.popupContainer.find(a.popupScrollSelector),
b;
if (!c.length) {
return
}
b = c.parents(".loaded").scrollTop(0);
adrma.scrollTo(c, {
container: b,
offset: 10
})
}
};
window.popWindow = window.popWindow || window.open;
adrma.getScrollWidth = function() {
var a = adrma.getScrollWidth;
if (a.width) {
return a.width
}
var c = document.createElement("div");
c.className = "getScrollWidth";
document.body.appendChild(c);
var b = c.offsetWidth - c.clientWidth;
document.body.removeChild(c);
adrma.getScrollWidth.width = b;
return b
};
(function(a) {
var b = a({});
a.subscribe = function() {
b.on.apply(b, arguments)
};
a.unsubscribe = function() {
b.off.apply(b, arguments)
};
a.publish = function() {
b.trigger.apply(b, arguments)
}
}(jQuery)); /* * jQuery hashchange event - v1.3 - 7/21/2010 * http://benalman.com/projects/jquery-hashchange-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */
(function($, j, h) {
var f = "hashchange",
a = document,
c, e = $.event.special,
b = a.documentMode,
g = "on" + f in j && (b === h || b > 7);
function d(k) {
k = k || location.href;
return "#" + k.replace(/^[^#]*#?(.*)$/, "$1")
}
$.fn[f] = function(k) {
return k ? this.bind(f, k) : this.trigger(f)
};
$.fn[f].delay = 50;
e[f] = $.extend(e[f], {
setup: function() {
if (g) {
return false
}
$(c.start)
},
teardown: function() {
if (g) {
return false
}
$(c.stop)
}
});
c = (function() {
var p = {},
q, n = d(),
k = function(r) {
return r
},
m = k,
l = k;
p.start = function() {
q || o()
};
p.stop = function() {
q && clearTimeout(q);
q = h
};
function o() {
var r = d(),
s = l(n);
if (r !== n) {
m(n = r, s);
$(j).trigger(f)
} else {
if (s !== n) {
location.href = location.href.replace(/#.*/, "") + s
}
}
q = setTimeout(o, $.fn[f].delay)
}
return p
})()
})(jQuery, this);
$.fn.serializeObject = function(a) {
var f = this.serializeArray(),
e = {},
b, c, d;
for (b = 0, c = f.length; b < c; b++) {
d = f[b];
if (typeof a === "function") {
a(d)
}
if (e.hasOwnProperty(d.name)) {
if (!(e[d.name] instanceof Array)) {
e[d.name] = [e[d.name]]
}
e[d.name].push(d.value)
} else {
e[d.name] = d.value
}
}
return e
};
adrma.router = {
init: function(d) {
if (adrma.router.initialized) {
return
}
this.initialized = true;
this.enabled = true;
var g = this,
c = adrma.router.cleanHash(),
b, a;
if (d && d.settings) {
this.settings = $.extend(this.settings, d.settings)
}
if (this.settings.silentRoutes) {
$(document).on("click", "a", function(h) {
var l = $(this);
if (!g.settings.silentRoutes || l.attr("data-hashRoute") === "false") {
return
}
var j = l.attr("href") || "",
k = j.indexOf("#") === 0 ? true : false;
if (k && g.isRoute(g.cleanHash(j), "split")) {
adrma.router.triggerRoute(adrma.router.cleanHash(j));
h.preventDefault()
}
if (f === "noop") {
return false
}
})
}
if (d && d.defaultRoute) {
b = d.defaultRoute, a = d.alwaysFire || false
}
if (c === "") {}
var f = b && this.triggerRoute(b),
e = adrma.decodeURLToJSON();
if (e && e.route && !g.isRoute(g.cleanHash())) {
g.triggerRoute(e.route)
}
$(window).hashchange(this.onHashChange).trigger("hashchange")
},
settings: {
silentRoutes: true
},
changeHash: function(a, b) {
location.hash = b;
return false
},
cleanUrl: function(a) {
if (a) {
return a.toString().replace(/\#/, "")
}
return location.origin + location.pathname
},
cleanHash: function(a) {
if (a) {
return a.toString().replace(/\#/, "")
}
return location.hash.toString().replace(/\#/, "")
},
splitRoute: function(a) {
return a.split("/")
},
hasSubRoute: function() {
return !!adrma.router.currentSubRoute
},
routes: {},
isRoute: function(a, b) {
if (b) {
a = this.splitRoute(a)[0]
}
a = a.toLowerCase();
return (a in this.routes)
},
add: function(b, a) {
var c = adrma.router;
if (b in c.routes && !a) {
return
}
b.name = b.name.toLowerCase();
c.routes[b.name] = b
},
remove: function(a) {
if (typeof a === "object") {
a = a.name
}
a = a.toLowerCase();
a = adrma.router.routes[a];
if (a) {
delete adrma.router.routes[a.name]
}
},
addRoute: function(b, a) {
this.add(b, a)
},
removeRoute: function(b, a) {
this.remove(b, a)
},
currentRoute: "default",
currentSubRoute: null,
triggerRoute: function(d) {
if (!d) {
return
}
if (d === "noop") {
return
}
d = d.toLowerCase();
var e = adrma.router.splitRoute(d),
g = e.length,
f, a = function(j) {
return j.indexOf("\\?") === -1 ? false : true
},
b = adrma.router.isRoute(e[0]);
if (b && adrma.router.currentRoute === adrma.router.routes[e[0]].name) {
if (!g || adrma.router.currentSubRoute === e[1]) {
if (!adrma.router.routes[e[0]].alwaysFire) {
return "isActiveRoute"
}
}
}
adrma.router.currentRoute = d;
adrma.router.currentSubRoute = null;
if (e[0] === "") {
return false
}
var h = adrma.router.routes;
if (h[e[0]] && h[e[0]].title) {
$(document).attr("title", h[e[0]].title)
}
if (g === 1) {
f = b && adrma.router.routes[e[0]].callback;
adrma.noop = $.isFunction(f) && f();
return
} else {
if (adrma.router.isRoute(d)) {
f = adrma.router.routes[d].callback;
adrma.noop = $.isFunction(f) && f();
return
}
if (!b) {
return
}
adrma.router.currentRoute = e[0];
adrma.router.currentSubRoute = e[1];
f = adrma.router.routes[e[0]].callback;
if (g === 2) {
adrma.noop = $.isFunction(f) && f(e[1])
} else {
if (g === 3) {
var c = {
action: e[1],
parameter: e[2]
};
adrma.noop = $.isFunction(f) && f(c)
}
}
}
},
cleanUp: function() {},
scrollToSubRoute: function() {
adrma.scrollTo($("#" + adrma.router.currentSubRoute), {
offset: -20
})
},
scrollToHash: function(b, f) {
var d = $(b.target),
c = d.attr("href"),
a = adrma.router.cleanHash(c),
g = $("#" + a);
g.removeAttr("id");
adrma.scrollTo(g, {
offset: -20,
speed: 200,
callback: function() {
g.attr("id", a)
}
})
},
disable: function(b) {
var a = this;
a.enabled = false;
var c;
if (b) {
c = setTimeout(function() {
a.enable()
}, b)
}
},
enable: function enable() {
var a = this;
a.enabled = true
},
onHashChange: function(a) {
if (!adrma.router.enabled) {
return
}
var b = adrma.router.cleanHash();
if (adrma.Validate.prototype.test(b, "allowedRouteChar") && $("#" + b).length) {
adrma.scrollTo("#" + b)
}
if (!b) {
return
}
$.publish("router/hashChange", [a, b]);
adrma.router.triggerRoute(b)
}
};
adrma.invisibleParams = {
get: function() {
return adrma.cookie("invisibleParams")
},
set: function(a) {
adrma.cookie("invisibleParams", a)
}
};
if (!adrma.isRevisedSessionHandling) {
adrma.getAsyncData = {
init: function() {
this.get()
},
getData: $.Deferred(),
get: function() {
var k = this,
d = $.Deferred(),
g = adrma.pageInfo,
h = g.pageType,
j = g.productVersion,
c = {
pageType: h,
clientTimeStamp: g.timestamp,
pageReferrer: document.referrer
},
l = adrma.storage.get("local", "settings"),
a = k.getAsyncDataApiUrl(),
e = (adrma.siteSettings.enableDdosMode && g.siteId !== "ADR" && (h !== "checkoutPage" && h !== "cartPage" && h !== "account")),
f = function(u) {
if (u.status === "success") {
if (u.data.redirectUrl) {
if (adrma.notify) {
adrma.notify.disableErrorMessages = true
}
var p = adrma.router.cleanHash();
if (p) {
window.location = u.data.redirectUrl + "#" + p
} else {
window.location = u.data.redirectUrl
}
return
}
adrma.session.getSession.done(function o() {
var y = adrma.session.session;
if (!e && y.cookieSid && u.data.userSession && y.cookieSid !== u.data.userSession.cookieSid) {
adrma.session.clearStoredSession();
adrma.session.restartSession()
}
});
$.publish("gotAsyncData", u);
c = u.data
} else {
if (adrma.iterateProducts) {
adrma.iterateProducts(null, ["configure"])
}
k.getData.reject(u);
return
}
if (c.tempScript && c.tempScript.length) {
setTimeout(function v() {
var y = $("head");
$.each(c.tempScript, function z(B, A) {
y.append(A)
})
}, 1000)
}
if (c.referrerPhoneNumber) {
$(".tel-tollfree").remove();
$(".tel-local").html(c.referrerPhoneNumber)
}
var x = c.siteSettings;
if (x) {
var w = new Date(c.serverTime);
x.serverYear = w.getFullYear() - 2000;
x.serverMonth = w.getMonth() + 1;
x.serverTime = w;
adrma.siteSettings = x
}
var r = adrma.pageInfo,
m = [],
t = false;
r.calendarVersion = c.calendarVersion;
r.productVersion = c.productVersion;
if ((r.pageGroup === "product" || r.pageType === "homePage") && (c.priceMode && c.priceMode !== r.priceMode) || c.withoutInsivibleParam || j !== c.productVersion) {
if (!adrma.getProductData) {
return
}
var q = adrma.invisibleParams.get() || {},
n = $("[data-sku]"),
s = adrma.productData && !$.isEmptyObject(adrma.productData) && n.length && adrma.productData[n[0].getAttribute("data-sku")] ? Object.keys(adrma.productData).join(",") : $.map(n, function(y) {
return y.getAttribute("data-sku")
}).join(",");
if (adrma.arc) {
q.dateRange = adrma.arc.dateRange
}
d = adrma.getProductData(s, q).done(function() {
$.publish("arc/gotProductDataResouces");
d.resolve()
});
t = true;
m.push("repaint");
r.priceMode = c.priceMode
} else {
$.publish("arc/gotProductDataResouces");
d.resolve()
}
d.done(function() {
m.push("configure");
if (!adrma.iterateProducts) {
k.getData.resolve(c);
return
}
adrma.iterateProducts(null, m).done(function() {
c.repaintNeeded = t;
k.getData.resolve(c)
})
})
};
if (h === "productPage") {
c.sku = g.id
}
if (l && (l.country || l.zip || l.isPob)) {
c.shipToCountry = l.country;
c.shipToZip = l.zip;
c.isPob = l.isPob
}
if (h === "listPage") {
c.perPage = adrma.pageInfo.perPage;
c.sort = adrma.pageInfo.sort;
c.hasDescSort = adrma.pageInfo.descSort
}
if (e) {
var b = {
responseType: "json",
status: "success",
type: "GetAsyncData",
params: {
clientTimeStamp: g.timestamp,
pageType: g.pageType
},
data: {
cacheVersion: g.cacheVersion,
calendarVersion: g.calendarVersion,
siteSettings: adrma.siteSettings,
priceMode: g.priceMode,
productVersion: g.productVersion,
userSession: adrma.session.mockSession
}
};
if (g.pageType === "productPage") {
b.params.sku = g.id
}
d.resolve();
f(b);
return
}
adrma.fetchData({
url: a,
type: "POST",
data: c,
showTimoutError: false,
dataType: "json"
}).done(f)
},
getAsyncDataApiUrl: function() {
var a = "/api/user/GetAsyncData";
if (adrma.pageInfo.siteId == "AD" && adrma.pageInfo.urlParams) {
var b = [];
if (adrma.pageInfo.urlParams.emailprice) {
b.push({
name: "emailprice",
value: adrma.pageInfo.urlParams.emailprice
})
}
if (adrma.pageInfo.urlParams.set) {
b.push({
name: "set",
value: adrma.pageInfo.urlParams.set
})
}
if (adrma.pageInfo.urlParams.rememberme) {
b.push({
name: "rememberme",
value: adrma.pageInfo.urlParams.rememberme
})
}
if (b.length) {
a += "?" + jQuery.param(b)
}
}
return a
}
}
}
if (adrma.isRevisedSessionHandling) {
adrma.getAsyncData = {
init: function() {
this.get()
},
getData: $.Deferred(),
get: function get() {
var e = this,
b = adrma.pageInfo,
c = b.pageType,
d = b.productVersion,
f = adrma.storage.get("local", "settings"),
a = function a(h) {
if (h.status === "success") {
$.publish("gotAsyncData", h);
data = h.data
} else {
if (adrma.iterateProducts) {
adrma.iterateProducts(null, ["configure"])
}
e.getData.reject(h);
return
}
if (data.referrerPhoneNumber) {
$(".tel-tollfree").remove();
$(".tel-local").html(data.referrerPhoneNumber)
}
adrma.siteSettings = data.siteSettings;
e.setInvisibleParam(h.data.cKeys);
e.checkCkeys(h.data.cKeys);
if (adrma.pageInfo.siteId !== "AD") {
var g = false;
if (b.pageGroup === "product" && e.isPagePriceModeDifferent(h.data.cKeys) || h.data.withoutInsivibleParam || adrma.pageInfo.cKeys.productVersion !== data.cKeys.productVersion) {
g = true
}
data.repaintNeeded = g;
e.resolveProductData(data).done(function() {
e.resolveProductConfig(data).done(function() {
return e.getData.resolve(data)
})
})
} else {
return e.getData.resolve(data)
}
};
if (adrma.siteSettings.IsUseClientUtcOffset) {
e.setTimeZone()
}
adrma.fetchData({
url: "/api/GetAsyncData2",
data: {
svfor: "5m"
},
type: "Get",
showTimoutError: false,
dataType: "json"
}).done(a)
},
resolveProductConfig: function resolveProductConfig(b) {
var d = this,
c = $.Deferred(),
a = [];
if (!adrma.iterateProducts) {
c.resolve();
return c
}
if (b.repaintNeeded) {
a.push("repaint")
}
a.push("configure");
adrma.iterateProducts(null, a).done(function() {
c.resolve()
});
return c
},
resolveProductData: function resolveProductData(a) {
var e = this,
b = $.Deferred(),
c = adrma.invisibleParams.get() || {};
if (!a.repaintNeeded || !adrma.getProductData) {
$.publish("arc/gotProductDataResouces");
b.resolve();
return b
}
var d = e.getProductSkus();
if (adrma.arc) {
c.dateRange = adrma.arc.dateRange
}
adrma.getProductData(d, c).done(function() {
$.publish("arc/gotProductDataResouces");
b.resolve()
});
return b
},
getProductSkus: function getProductSkus() {
var d = this;
var b = adrma.invisibleParams.get() || {},
a = $("[data-sku]"),
c;
if (adrma.productData && !$.isEmptyObject(adrma.productData) && a.length && adrma.productData[a[0].getAttribute("data-sku")]) {
c = Object.keys(adrma.productData).join(",")
} else {
c = $.map(a, function(f) {
return f.getAttribute("data-sku")
}).join(",")
}
return c
},
isPagePriceModeDifferent: function(a) {
var c = this,
b = false;
if (a.pagePriceMode && a.pagePriceMode !== adrma.pageInfo.cKeys.pagePriceMode) {
b = true
}
return b
},
setTimeZone: function() {
var a = this,
b = -(new Date()).getTimezoneOffset() / 60;
adrma.setInvisibleParameterChange("ClientUtcOffset=" + b)
},
setInvisibleParam: function setInvisibleParam(a) {
var d = this,
c = "";
var b = 0;
for (key in a) {
if (a.hasOwnProperty(key)) {
var e = a[key];
if (b !== 0) {
c += "&"
}
c += key + "=" + e;
b++
}
}
if (c.length) {
adrma.cookie("InvisibleParameter", c, {
path: "/",
expires: 0.020833333
})
}
},
checkCkeys: function checkCkeys(b) {
var p = this,
a = [],
m = adrma.pageInfo.cKeys,
o = 0,
l = false,
g = adrma.cookie("activeUser"),
d = true;
if (m && b) {
for (key in b) {
if (b.hasOwnProperty(key)) {
var k = b[key];
var n = m[key];
if (key === "priceMode" && b.pagePriceMode) {
continue
}
if (k !== n) {
a.push(key)
}
}
}
}
if (a.length) {
l = true;
if (a.length == 1 && a[0] == "mode") {
if (adrma.modeRouter) {
adrma.modeRouter.showConfirmation(m.mode)
}
l = false
}
if (a.length == 1 && a[0] == "clientUtcOffset") {
l = false
}
o = adrma.storage.get("session", "reloadCount");
if (!o) {
o = 0
}
if (a.length === 1 && a[0] === "productVersion") {
return
}
if (a.length <= 3) {
var h = true;
function j(q) {
var r = false;
if (q === "perPage" || q === "sort" || q === "descSort") {
r = true
}
return r
}
for (var f = 0; f < a.length; f++) {
h = j(a[0])
}
if (h) {
l = false
}
}
if (l && o < 4) {
adrma.storage.set("session", "reloadCount", o + 1);
if (adrma.pageInfo.pageType === "homePage") {
$.ajax({
url: window.location.href,
headers: {
Pragma: "no-cache",
Expires: -1,
"Cache-Control": "no-cache"
}
}).done(function() {
window.location.reload(true)
})
} else {
location.reload(true)
}
return
}
}
if (!a.length) {
adrma.storage.set("session", "reloadCount", 0)
}
if (d) {
var c = new Date();
var e = 5;
c.setTime(c.getTime() + (e * 60 * 1000));
adrma.cookie("activeUser", "1", {
path: "/",
expires: c
})
}
}
}
}
if (adrma.isRevisedSessionHandling) {
$(document).on("click", ".cKeys", function(a) {
var b = $(this).attr("data-keys");
adrma.setInvisibleParameterChange(b)
})
}
if (adrma.isRevisedSessionHandling) {
adrma.affiliateSrc = {
init: function init() {
var a = adrma.cookie("AffiliateSrcId");
var b = adrma.cookie("AffiliateSrcSub");
if (b === null || b === "") {
b = ""
}
if (a) {
$.getScript("//d3cxv97fi8q177.cloudfront.net/foundation-A28763-e0eb-4151-9a08-f7f9b21222531.js");
adrma.cookie("AffiliateSrcId", null);
adrma.cookie("AffiliateSrcSub", null)
}
}
};
adrma.init.add({
name: "AffiliateSrcInt",
cb: adrma.affiliateSrc.init,
context: adrma.affiliateSrc,
defer: true
})
}
adrma.init.add({
name: "updateActivity",
cb: function() {
var b, a, c = (function() {
if (adrma.siteSettings.enableDdosMode) {
return true
}
var d = false;
if (adrma.pageInfo.siteId === "AD") {
if (!adrma.siteSettings.IsUseNewProductActivityUpdater || adrma.pageInfo.pageType !== "productPage") {
d = true
}
}
return d
})();
if (c) {
return
}
b = adrma.siteSettings.session2point0 ? adrma.getAsyncData.getData : adrma.session.getSession;
if (adrma.pageInfo.siteId === "AD") {
a = {
pageType: adrma.pageInfo.pageType,
sku: adrma.pageInfo.id
}
}
b.done(function b(e) {
setTimeout(function d() {
adrma.fetchData({
url: "/api/user/updateActivity",
type: "POST",
dataType: "json",
data: a
})
}, 2000)
})
},
defer: true
});
adrma.getProductData = function(g, d) {
var b = $.Deferred(),
e = adrma.pageInfo,
f = e.pageType || "",
c = (d && d.directData),
a = {
sku: g,
pageType: f,
directData: c,
version: e.productVersion,
isEmailPrice: adrma.pageInfo.isEmailPrice,
svfor: "7day"
};
if (d && d.dateRange) {
a.dateRange = d.dateRange;
a.startRentalDate = d.dateRange.fromDate;
a.endRentalDate = d.dateRange.toDate
}
if (e.siteId === "AD") {
a.mode = (e.mode) || "AD"
}
if (e.siteId === "ADR" && adrma.isRevisedSessionHandling) {
a.fillOnlyPrices = true
}
adrma.fetchData({
url: "/api/catalog/GetProductData",
data: a,
dataType: "json"
}).done(function(h) {
adrma.productData = adrma.productData || {};
$.extend(true, adrma.productData, h.data);
b.resolve(h)
});
return b
};
adrma.init.add({
name: "storageManager",
cb: function() {
var g = adrma.storage.get("local", "storeTimestamp"),
f = location.protocol === "https:",
h = g || false,
a = (new Date()).getTime(),
d = adrma.cookie("invalidateStorage"),
b = adrma.cookie("clearSettings"),
c = 300000,
e = (function() {
if (!h) {
return false
}
return (g + c) < a
})();
if (!adrma.isRevisedSessionHandling) {
if (f) {
adrma.cookie("invalidateStorage", 1, {
path: "/"
});
return
}
}
if (b) {
adrma.storage["delete"]("local", "settings");
adrma.removeCookie("clearSettings", {
path: "/"
})
}
if (e || d) {
adrma.storage["delete"]("local", "miniCart");
adrma.storage["delete"]("local", "session");
adrma.removeCookie("invalidateStorage", {
path: "/"
});
adrma.storage.set("local", "storeTimestamp", a)
}
if (!h) {
adrma.storage.set("local", "storeTimestamp", a)
}
}
});
adrma.init.add({
name: "common",
cb: function() {
adrma.pageInfo.timestamp = adrma.getTimezoneStamp();
adrma.actions.init();
adrma.session.init();
$(".hoverInfo").hoverTip();
adrma.popup.init()
}
});
adrma.init.add({
name: "commonDeferred",
cb: function commonDeferred() {
adrma.router.init();
adrma.scriptStrings()
},
defer: true
});
(function adrmaIs() {
if (navigator.userAgent.match(/MSIE 10./i)) {
document.documentElement.classList.add("ie10")
} else {
if (navigator.userAgent.match(/rv:11./i)) {
document.documentElement.classList.add("ie11")
}
}
var c = !!$(".ie9").length,
a = !!$(".ie10").length,
b = !!$(".ie11").length;
adrma.is = {
IE9: c,
IE10: a,
IE11: b
};
adrma.is.IE = c || a || b;
if (adrma.is.IE) {
$("html").add("ie")
}(function(d) {
adrma.is.mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(d) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(d.substr(0, 4))
})(navigator.userAgent || navigator.vendor || window.opera);
adrma.is.touch = ("ontouchstart" in window) || navigator.msMaxTouchPoints || false;
if (adrma.is.touch) {
$("body").addClass("isTouch")
}
})();
(function(f, g) {
var d = f.jQuery || f.Cowboy || (f.Cowboy = {}),
e;
d.throttle = e = function(b, c, n, m) {
var l, a = 0;
if (typeof c !== "boolean") {
m = n;
n = c;
c = g
}
function k() {
var r = this,
p = +new Date() - a,
q = arguments;
function j() {
a = +new Date();
n.apply(r, q)
}
function h() {
l = g
}
if (m && !l) {
j()
}
l && clearTimeout(l);
if (m === g && p > b) {
j()
} else {
if (c !== true) {
l = setTimeout(m ? h : j, m === g ? b - p : b)
}
}
}
if (d.guid) {
k.guid = n.guid = n.guid || d.guid++
}
return k
};
d.debounce = function(a, b, c) {
return c === g ? e(a, b, false) : e(a, c, b !== false)
}
})(this);
adrma.positionPortals = {
defualts: {
throttle: true,
container: window
},
positions: {},
stringMath: function(a) {
var b = 0,
a = a.match(/[+\-]*(\.\d+|\d+(\.\d+)?)/g) || [];
while (a.length) {
b += parseFloat(a.shift())
}
return b
},
init: function(b) {
var c = this,
a;
c.opts = $.extend({}, c.defualts, b);
if (c.initlizedOn === c.opts.container) {
return
}
c.initlizedOn = c.opts.container;
a = $(c.opts.container);
c.containerHeight = a.height();
c.scrollTop = a.scrollTop();
if (c.opts.throttle && $.throttle) {
a.on("scroll", $.throttle(250, function(d, f) {
requestAnimFrame(function() {
c.onScroll.call(c, d, f)
})
}))
} else {
a.on("scroll", function(d, f) {
requestAnimFrame(function() {
c.onScroll.call(c, d, f)
})
})
}
c.triggerScroll()
},
triggerScroll: function triggerScroll() {
var b = this;
if (b.triggeredScroll) {
return
}
b.triggeredScroll = true;
adrma.init.loadDfd.done(function a() {
setTimeout(function() {
$(window).trigger("scroll", "initial")
}, 500)
})
},
calcPosition: function calcPosition(a) {
var d = this,
c, b = $(a.breakpointEle);
if (!b.length || !b.offset()) {
return
}
c = b.offset().top + d.stringMath(a.offset || "0");
return c
},
add: function add(b) {
b.breakpointEle = b.breakpoint;
var h = this,
a = b.activeClass,
c = $(b.breakpoint),
e = b.onReach,
j = b.unReach,
g = b.scrollDirection,
d = h.calcPosition(b),
f = (function() {
return function(m) {
var l = this,
n = l.targetEle ? $(l.targetEle) : null;
if (n && n.hasClass(l.activeClass)) {
return
}
if (l.reachCondition.apply(h, [c, d, n, a, m])) {
if (n && n.length) {
n.addClass(l.activeClass)
}
if (l.onReachFn) {
l.onReachFn.apply(h, [c, d, n, a, m])
}
}
}
})(),
k = (function() {
return function(m) {
var l = this,
n = l.targetEle ? $(l.targetEle) : null;
if (n && !n.hasClass(l.activeClass)) {
return
}
if (l.unReachCondition.apply(h, [c, d, n, a, m])) {
if (n && n.length) {
n.removeClass(l.activeClass)
}
if (l.unReachFn) {
l.unReachFn.apply(h, [c, d, n, a, m])
}
}
}
})();
this.positions[b.name] = {
name: b.name,
breakpoint: d,
breakpointEle: c,
offset: b.offset || "0",
reCalc: b.reCalc,
scrollDirection: g,
onReach: f,
onReachFn: e,
reachCondition: b.reachCondition ? b.reachCondition : adrma.truthyNoop,
activeClass: a,
targetEle: b.targetEle,
unReach: k,
unReachFn: j,
unReachCondition: b.unReachCondition ? b.unReachCondition : adrma.truthyNoop
}
},
remove: function(a) {
if (!this.positions[a]) {
return
}
delete this.positions[a]
},
onScroll: function(b, c) {
var g = this,
f = $(b.target).scrollTop(),
d = f > g.scrollTop ? "down" : "up",
a;
g.scrollTop = f;
$.publish("onScroll", {
e: b,
scrollTop: f,
scrollDirection: d
});
$.each(g.positions, function(e, h) {
if (h == null) {
return
}
if (h.reCalc) {
return
}
if (h.scrollDirection && h.scrollDirection != d) {
return
}
a = h.breakpoint;
if (f >= a) {
h.onReach([d, f]);
return
}
if (f < a) {
h.unReach([d, f]);
return
}
})
},
recalculate: function recalculate(a) {
var d = this,
b, c = d.positions;
if (a) {
b = d.positions[a];
b.breakpoint = d.calcPosition(b);
return
}
$.each(c, function(g, f) {
if (!g || !f || !f.name) {
return
}
f.breakpoint = d.calcPosition(f)
})
}
};
adrma.format = {
elipses: function(d, c, a) {
if (!d) {
return ""
}
a = a || "";
var b = d.length;
if (b > c) {
return d.substr(0, b + c - b) + a
}
return d
},
tel: function(a) {
if (!a) {
return ""
}
return a.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3")
},
currency: function(b, c) {
var e = this,
a = {
decorator: "$",
free: false,
fractionDigits: 2
};
c = $.extend(a, c);
var d = b;
if (typeof b === "string") {
b = b.replace(",", "")
}
b = new Number(b);
b = e.decimalAdjust("round", b, -2);
b = b.toFixed(c.fractionDigits);
if (isNaN(b)) {
return d
}
if (parseFloat(b) === 0 && c.free) {
return "FREE"
}
b = b.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
return c.decorator + "" + b
},
capitalize: function(a) {
return a.replace(/\w\S*/g, function(b) {
return b.charAt(0).toUpperCase() + b.substr(1).toLowerCase()
})
},
uppercase: function(a) {
return a.toUpperCase()
},
lowercase: function(a) {
return a.toLowerCase()
},
decimalAdjust: function(b, c, a) {
if (typeof a === "undefined" || +a === 0) {
return Math[b](c)
}
c = +c;
a = +a;
if (isNaN(c) || !(typeof a === "number" && a % 1 === 0)) {
return NaN
}
c = c.toString().split("e");
c = Math[b](+(c[0] + "e" + (c[1] ? (+c[1] - a) : -a)));
c = c.toString().split("e");
return +(c[0] + "e" + (c[1] ? (+c[1] + a) : a))
},
pluralize: function pluralize(a, b) {
return a === 1 ? b : b + "s"
}
};
(function() {
var selectUi, doc = $(document);
adrma.actions.add({
bindToggleEle: function(e, jThis) {
var toggleEle = jThis.attr("data-target"),
togglerClass = jThis.attr("data-toggler-class") || "shown",
toggleClass = jThis.attr("data-toggled-class") || "show",
targetExpression = jThis.attr("data-target-expression"),
lightExpression, guid;
jThis.toggleClass(togglerClass);
if (toggleEle) {
lightExpression = toggleEle.match(/^\:([^\(\)]+)\((.+)?\).*/);
if (lightExpression) {
toggleEle = jThis[lightExpression[1]]((lightExpression[2]) ? lightExpression[2] : "")
}
}
if (targetExpression) {
guid = adrma.getGuid();
jThis.attr("data-guid", guid);
toggleEle = eval('$("[data-guid="+guid+"]")' + targetExpression)
}
$(toggleEle).toggleClass(toggleClass)
},
selectUI: function(e, jThis) {
var self = this;
adrma.selectUi.onClick.apply(self, [e, jThis])
},
scrollTo: function(e, jThis) {
var target = jThis.attr("data-target");
disableScroll = jThis.attr("disable-scroll");
if (!target || disableScroll) {
return
}
adrma.scrollTo($(target))
},
followLink: function(e, jThis) {
var href = jThis.find("a").attr("href");
location.href = href
},
printPage: function printPage(e, jThis) {
window.print()
},
toggleAttrVal: function(e, jThis) {
var target = jThis.attr("data-target") || "",
attrKey = jThis.attr("data-attr-key") || "",
attrValue = jThis.attr("data-attr-val") || "";
if (!target || !attrKey) {
return
}
if (!attrValue) {
$(target).removeAttr(attrKey);
return
}
$(target).attr(attrKey, attrValue)
}
});
adrma.selectUi = selectUi = {
onClick: function selectUi_OnClick(e, jThis) {
var self = this,
eTarget = $(e.target),
openSelectEle = $(".select-open"),
options = jThis.find(".select-ui-options");
if (jThis.hasClass("disabled")) {
return
}
if (eTarget.closest(".select-ui-options").length) {
return
}
if (openSelectEle.length) {
selectUi.close(openSelectEle);
return
}
selectUi.open(jThis);
options.on("click.selectUI", function(e) {
selectUi.onChange.apply(self, [{
e: e,
selectEle: jThis
}])
});
setTimeout(function() {
doc.on("click.selectUI", function(e) {
if (e.originalEvent === "undefined" || $(e.target).closest(".select-ui-options").length) {
return
}
selectUi.close(jThis)
})
}, 1)
},
onChange: function selectUi_onChange(config) {
var e = config.e,
eTarget = $(e ? e.target : ""),
selectEle = config.selectEle,
optionEle = eTarget.length ? eTarget.closest("[data-value]") : config.optionEle,
selectVal = selectEle.find(".select-ui-val"),
selectedClass = "selected",
onSelect = selectEle.attr("data-onSelect"),
value = config.changeValue || optionEle.attr("data-value"),
isTriggered = !eTarget.length,
isStopPropagation = eTarget.hasClass("stop-propagation");
if (optionEle.hasClass("disabled") || isStopPropagation) {
return false
}
if (!isTriggered && !eTarget.closest("[data-value]").not(".select-ui").length) {
if (eTarget.is("a")) {
selectUi.close(selectEle)
}
return
}
if (!optionEle.length) {
selectUi.close(selectEle);
return
}
optionEle.closest(".select-ui-options").find("[data-value]").removeClass(selectedClass);
if (value) {
optionEle.addClass(selectedClass)
}
selectEle.removeClass("select-open").attr("data-value", value);
selectVal.html(optionEle.html());
if (onSelect && !config.silent) {
onSelect = adrma.actions[onSelect];
if ($.isFunction(onSelect)) {
onSelect.apply(self, [e, optionEle, value])
}
}
selectUi.close(selectEle);
if (selectEle.attr("data-widget") === "true") {
var closeRefine = adrma.actions.toggleRefine;
closeRefine.apply()
}
},
open: function selectUi_open(ele) {
ele.addClass("select-open")
},
close: function selectUi_close(ele) {
ele.removeClass("select-open");
this.unBind(ele)
},
unBind: function selectUi_unBind(ele) {
ele.find(".select-ui-options").unbind(".selectUI");
doc.unbind(".selectUI")
},
set: function selectUi_set(ele, val, silent) {
this.onChange({
selectEle: ele,
optionEle: ele.find("[data-value='" + val + "']"),
silent: silent
})
},
reset: function selectUi_reset(ele, silent) {
selectUi.onChange({
selectEle: ele,
optionEle: ele.find(".initial-select"),
silent: silent
});
ele.attr("data-value", undefined)
}
}
})();
adrma.actions.add({
closeNotify: function(a, b) {
var c = b.closest(".alert-box");
c.fadeOut(300, function() {
c.remove()
})
}
});
adrma.router.add({
name: "notify",
callback: function(a) {
var b;
a ? b = decodeURIComponent(a) : b = a;
adrma.notify.add({
html: b,
autoClose: false
})
}
});
adrma.notify = {
defaults: {
placeholder: ".alert-placeholder",
closeEle: "<a class='close-alert action' data-action='closeNotify' data-icon='x' title='Hide Message'></a>",
html: "",
defaultClass: "alert-box",
type: "default",
autoClose: true,
delay: 10000
},
add: function add(a) {
a = $.extend({}, this.defaults, a);
if (a.placeholder === this.defaults.placeholder && !$(a.placeholder).length) {
$("body").prepend("<div class='alert-placeholder'> </div>")
}
var c = this,
b = $("<div>", {
"class": a.defaultClass + " " + a.type,
html: a.closeEle + "" + a.html
}).appendTo(a.placeholder).on("mouseenter mouseleave", function(f) {
if (f.type === "mouseenter") {
clearTimeout(e)
} else {
d(1000)
}
}),
e, d = function(f) {
if (!a.autoClose) {
return
}
e = setTimeout(function() {
c.remove(b)
}, f || a.delay)
};
d()
},
remove: function remove(a) {
a.find(".close-alert").trigger("click")
},
removeAllNotifications: function removeAllNotifications() {
$(".alert-box").remove()
},
renderApiMessages: function renderApiMessages(d) {
if (!d) {
return
}
var e = adrma.notify,
c = d.messages || "",
b, f;
if (!c) {
c = d.responseText ? JSON.parse(d.responseText) : "";
c = c ? c.messages : []
}
$.each(c, function a(h, g) {
f = g.type ? g.type : "default";
e.add({
html: "<p>" + g.text + "</p>",
type: f,
autoClose: false
})
})
},
removeOldNotification: function removeOldNotification(a) {
if (!a || (!a.id && !a.text)) {
return
}
var c = $(".alert-box.error"),
b = a.id ? a.id : a.text;
if (c.length) {
if (a.id) {
c.find("[data-notify-id='" + a.id + "']").parent().remove()
} else {
c.find(":contains('" + a.text + "'):last").parent().remove()
}
}
}
};
adrma.scriptStrings = function() {
var scriptString = $(".scriptString").not(".processedScript");
if (scriptString.length) {
scriptString.each(function() {
var jThis = $(this).addClass("processedScript"),
thisScript = jThis.html();
if (!thisScript) {
return
}
try {
eval(thisScript)
} catch (err) {}
})
}
};
(function(a) {
a.fn.hoverTip = function(c) {
if (a.fn.hoverTip.inilized) {
return this
}
a.fn.hoverTip.inilized = true;
var b = {
defualtClassName: "hoverTips",
seconderyClassName: "",
defualtTriggerer: "hoverInfo",
hasTooltip: false,
allowMouseIn: true,
prefferedPosition: "auto",
centerPosition: "true",
buildFragment: function(d) {
this.frag = a("<div>", {
"class": c.defualtClassName,
mouseleave: function(e) {
if (a(e.relatedTarget).hasClass(c.defualtTriggerer)) {
return false
}
c.fadeOut(d.e)
}
}).appendTo("body");
this.hasTooltip = true
},
createToolTip: function(d) {
var g = this,
j, f, e;
if (!g.hasTooltip) {
g.buildFragment(d)
}
g.frag = a("body > ." + c.defualtClassName).attr("class", c.defualtClassName + " loading " + d.relClass).removeAttr("style").html(function() {
return c.allowMouseIn ? "<div class='linkHelper'></div>" : ""
});
if (c.seconderyClassName) {
a(g.frag).addClass(c.seconderyClassName)
}
if (d.isStaticData) {
a(g.frag).append(d.data);
c.postiotionTip(d);
return
}
if (d.isSourceGlobal || d.isDirectUrlSource) {
j = d.isDirectUrlSource ? d.data : "/api/some/api/" + d.data;
f = {}
} else {
if (e = a.fn.hoverTip.dataLocations) {
j = e[d.data];
if (!j) {
return
}
} else {
return
}
}
var h = a(d.e.currentTarget);
if (!h.hasClass("requesting")) {
g.requestingContent(d, j, f, h)
}
},
requestingContent: function(d, h, e, g) {
var f = this;
g.addClass("requesting");
adrma.fetchData({
url: h,
cacheResponse: true,
data: e
}).done(function(j) {
a(f.frag).append(j);
g.removeClass("requesting");
c.postiotionTip(d);
return
})
},
postiotionTip: function(h) {
this.frag.removeClass("loading");
var e = a("body > ." + c.defualtClassName),
o = this,
q = {
width: e.outerWidth(true),
height: e.outerHeight(true)
},
g = e.outerWidth(true),
f = e.outerHeight(true),
n = {
left: a(window).scrollLeft(),
top: a(window).scrollTop()
},
w = {
x: a(window).width(),
y: a(window).height()
},
d = 18,
u = a(h.e.target).closest(".hoverInfo"),
t = {
width: u.outerWidth(),
height: u.outerHeight()
},
s = {
x: t.width / 2,
y: t.height / 2
},
v = {
x: u.offset().left,
y: u.offset().top
},
k = h.e.pageX,
l = h.e.pageY,
r = function(x, y) {
return e[x + "Class"](y)
},
j = function(y, x) {
switch (x) {
case "right":
return (y > w.x + n.left);
case "left":
return (y < 0 + n.left);
case "top":
return (y < 0 + n.top);
case "bottom":
return (y > w.y + n.top)
}
},
p = function() {
tipY = (function() {
if (j((v.y + q.height), "bottom")) {
r("add", "tipSideBottom");
return (v.y - q.height) + 40
} else {
r("add", "tipSideTop");
return v.y - 20
}
})()
},
m = adrma.mediaQuery.isTouch ? "auto" : u.attr("data-tooltipPrefferedPosition") || h.prefferedPosition;
switch (m) {
case "auto":
tipX = (function() {
if (j((v.x + s.x + q.width / 2), "right")) {
r("add", "tipRight");
return v.x + t.width - q.width
} else {
if (j((v.x + s.x - q.width / 2), "left")) {
r("add", "tipLeft");
return v.x
} else {
return ((v.x + s.x) - q.width / 2)
}
}
})(), tipY = (function() {
if (j((v.y + q.height), "bottom")) {
r("add", "tipBottom");
return v.y - (q.height + t.height)
} else {
if (!adrma.mediaQuery.isTouch && j((v.y - q.height), "top")) {
h.prefferedPosition = "top";
o.postiotionTip(h);
return
}
r("add", "tipIsTop");
return v.y + t.height + 12
}
})();
break;
case "top":
tipX = (function() {
if (j((v.x + s.x + q.width / 2), "right")) {
r("add", "tipRight");
return v.x + t.width - q.width
} else {
if (j((v.x + s.x + q.width / 2), "left")) {
r("add", "tipLeft");
return v.x
} else {
return ((v.x + s.x) - g / 2)
}
}
})(), tipY = (function() {
if (j((v.y - q.height), "top")) {
r("add", "tipIsTop");
return v.y + t.height + 12
} else {
r("add", "tipBottom");
return v.y - (q.height + 12)
}
})();
break;
case "right":
tipX = (function() {
if (j((v.x + t.width + q.width), "right")) {
r("add", "tipSideRight");
return (v.x - q.width - 12)
} else {
r("add", "tipSideLeft");
return (v.x + t.width) + 12
}
})();
p();
break;
case "bottom":
break;
case "left":
tipX = (function() {
if (j((v.x - q.width), "left")) {
r("add", "tipSideLeft");
return (v.x + t.width) + 12
} else {
r("add", "tipSideRight");
return (v.x - q.width - 12)
}
})(), p();
break
}
e.css({
top: (tipY >= 0) ? tipY : 0,
left: (tipX >= 0) ? tipX : 0
}).fadeTo(300, 1).addClass("hoverShow")
},
stopAll: function() {
a("." + c.defualtClassName).stop(true, true)
},
fadeOut: function(d) {
a("body > ." + c.defualtClassName).fadeTo(0, 0, function() {
a(this).removeClass("hoverShow");
a(d.target).closest(".hoverInfo").removeClass("hoverActive")
})
}
};
c = a.extend(b, c), triggerSelector = this.selector;
a(document).on("mouseover mouseout click touchstart", triggerSelector, function(f) {
var h = a(f.target).closest(".hoverInfo"),
o, n, m, g, d, l, k, j, p;
function r(e) {
if (e.type !== "touchmove" && a(e.target).closest(".hoverTips").length) {
return
}
h.trigger("mouseout");
a(document).off("touchstart touchmove", r)
}
if (f.type === "touchstart") {
a(document).on("touchstart touchmove", r)
}
p = Number(h.attr("data-hover-timeout") || 300);
if (h.attr("data-tooltip-click")) {
if (f.type === "click") {
p = 0;
a(document).one("click", function q(e) {
if (h.hasClass("hoverActive") && !a(f.relatedTarget).closest("." + c.defualtClassName).length) {
c.stopAll();
c.fadeOut(f);
return false
}
})
} else {
return false
}
}
if (f.type === "mouseover") {
p = 0
}
c.timeoutID = setTimeout(function() {
if (h.hasClass("hoverActive")) {
return
}
h.addClass("hoverActive");
o = h.attr("data-tooltip-content"), directUrlSource = h.attr("data-tooltip-source-url"), n = h.attr("data-tooltip-source-type"), showTooltipForTouch = h.attr("data-touch-tooltip"), showTooltipForTouch = showTooltipForTouch ? showTooltipForTouch === "true" : true, isTouch = adrma.mediaQuery.isTouch, m = h.attr("data-tooltip-preffered-position") || "auto";
g = h.attr("data-tooltip-class");
g = g || "";
if (isTouch && !showTooltipForTouch) {
return
}
if (o) {
d = o;
l = true
}
if (n) {
d = n;
k = true
}
if (directUrlSource) {
d = directUrlSource;
j = true
}
if (!o && !n && !directUrlSource) {
if (h.attr("title")) {
h.data("elTitle", h.attr("title"))
}
d = a.data(h[0], "elTitle");
h.removeAttr("title")
}
c.stopAll();
c.createToolTip({
data: d,
relClass: g,
e: f,
isStaticData: l,
isSourceGlobal: k,
prefferedPosition: m,
isDirectUrlSource: j
});
a.publish("tooltip/shown", h)
}, p);
if (f.type === "mouseout") {
clearTimeout(c.timeoutID);
if (!a(f.relatedTarget).closest("." + c.defualtClassName).length) {
c.stopAll();
c.fadeOut(f);
return false
}
}
});
return this
}
}(jQuery));
adrma.scrollTo = function(b, d) {
b = $(b);
if (!b.length) {
return
}
d = $.extend({}, {
offset: 0,
speed: 300,
container: $("html, body"),
dir: "top",
callback: $.noop
}, d);
var c = d.container ? b.position()[d.dir] : b.offset()[d.dir],
a = $.Deferred(),
e = d.dir === "top" ? "scrollTop" : "scrollLeft";
anim = {};
anim[e] = (c) + (d.offset || -90);
d.container.stop(true, true).animate(anim, d.speed, function() {
d.callback();
a.resolve()
});
return a
};
adrma.init.add({
name: "storePageVisit",
cb: function() {
var a = {
topCategory: 1,
productPage: 1,
topBrands: 1,
listPage: 1
},
b = adrma.pageInfo.shortTitle;
if (!a[adrma.pageInfo.pageType] || !b) {
return
}
adrma.storage.add({
type: "local",
key: "pageVisitLog",
ifFoundStillUpdate: true,
val: {
title: b,
url: location.href
},
wrapperType: "array",
isObj: true,
comparePropName: "title",
propsAreObjs: true,
limit: 5,
addDirection: "unshift"
})
},
defered: true
});
$(document).ready(function() {
adrma.init()
});
adrma.Validate = function() {
if (this instanceof adrma.Validate) {
return this
} else {
return new adrma.Validate()
}
};
adrma.Validate.prototype = {
defaults: {
errorClass: "error",
formEle: "",
method: "after",
fieldContainer: ".input-wrap, .aweform-input"
},
init: function init(a) {
var b = this;
$.extend(this, this.defaults, a);
b.formEle = $(b.formEle);
if (b.hasFormValidation()) {}
if (!b.nonBind) {
b.formEle.on("submit", function() {
return b.validate(b.formEle)
})
}
return this
},
validate: function validate(a, e) {
var g = this,
a = a || g.formEle || $(),
c = a.find(":input:visible"),
f = a.find("select[type='dropDown']"),
b, d, h = true;
g.clearValidationErrors(a);
c.each(function(k, j) {
d = g.validateInput(j, e);
if (!d) {
h = false
}
});
f.each(function(k, j) {
dropDownValid = g.validateDropDown(j);
if (!dropDownValid) {
h = false
}
});
return h
},
clearValidationErrors: function clearValidationErrors(a) {
a = a || this.formEle;
a.removeClass("error");
a.find("form").removeClass("error");
a.find("span.input-wrap").removeClass("error");
a.find(":input").removeClass("error");
a.find(".message.error").remove()
},
validateDropDown: function validateDropDown(c) {
var j = this,
e = $(c),
k = e.val(),
l = true,
g = e.attr("data-regexp-ref"),
f = e.find("option:first-child").text(),
h = e.attr("required"),
b = e.attr("data-required-error"),
a = e.attr("data-validate-error") || j.messages[g] || "",
m = a,
d;
if (h && k === f) {
l = false;
m = b || "required"
}
d = e.closest(j.fieldContainer);
d.find(".message.error").remove();
if (!l) {
d.append("<span class='message error'>" + m + "</span>")
}
d[(l ? "remove" : "add") + "Class"](j.errorClass);
return l
},
validateUploadedFiles: function validateUploadedFiles(a) {
var b = this,
c = a.find("input[type=file]:visible");
if (!c.length) {
return true
}
return b.validateFileFormats(c) && b.validateFileSizes(c)
},
validateFileSizes: function validateFileSizes(e) {
var a = true,
b = adrma.siteSettings.MaxFileUploadSize || 2097152,
c = ((b / 1024) / 1024).toFixed(2),
d;
e.each(function(g, f) {
d = $(f).get(0).files[0];
if (d.size > b) {
adrma.notify.add({
html: "The maximum file upload size is " + c + " MB. File '" + d.name + "' exceeds maximum size limit.",
type: "error"
});
a = false
}
});
return a
},
validateFileFormats: function validateFileFormats(f) {
var d = true,
b, c, a, e;
f.each(function(h, g) {
var g = $(g);
b = g.attr("data-format-regexp");
a = new RegExp(b, "i");
e = g.get(0).files[0];
c = g.attr("data-format-error") || ("File '" + e.name + "' not supported. Please upload either " + g.attr("accept"));
if (b && !e.name.match(a)) {
adrma.notify.add({
html: c,
type: "error"
});
d = false
}
});
return d
},
validateInput: function validateInput(e, m) {
var t = this;
m = m || {};
if (!(t instanceof adrma.Validate)) {
$.extend(this, this.defaults, m)
}
var f = $(e),
w = f.val(),
u = f.attr("type"),
k = f.attr("name") || m.name,
n = f.attr("pattern"),
g = f.attr("data-max-length"),
j = f.attr("data-min-length"),
s = f.attr("required"),
x = true,
r = f.attr("data-regexp-ref"),
c = f.is("[data-disable-default-text-validation]"),
a = f.attr("data-validate-error") || t.messages[r] || "",
b = f.attr("data-required-error"),
y = a,
q = r,
o, p = adrma.regExp,
v = f.attr("data-unique-property-id"),
d = f.closest(t.fieldContainer);
d = d.length ? d : f;
if (s && (!w || w.length === 0 || !$.trim(w))) {
x = false;
y = b || "required"
} else {
if ((s || w) && u === "text" && !n && !q && !p.text.test(w) && !c) {
x = false;
y = a || "Standard US Characters Required"
} else {
if ((s || w) && (p[u] || n || q)) {
if (n) {
q = new RegExp(n)
} else {
q = p[q] || p[u]
}
if (u === "zip" && !r) {
q = p.usZip
}
if (q && q.test) {
x = q.test(w)
}
if (u === "text" && c && !n && !r) {
x = true
}
if (!x) {
y = y || "Invalid value"
}
} else {
x = true
}
}
}
if (k == "phone") {
w = w.match(/\d/g)
}
if (x && g) {
x = w.length <= g;
y = "Value shouldn't be longer than " + g + " chars"
}
if (x && j) {
x = w.length >= j;
y = "Value shouldn't be shorter than " + j + " chars"
}
if (m.silent) {
return x
}
d.find(".message.error").remove();
if (!x) {
d.append("<span class='message error'>" + y + "</span>")
}
if (!x && !m.trackValidationDisabled) {
t.setTrackValidation(f)
}
if (m.isNotifyMessageNeeded) {
var l = v ? {
id: v
} : {
text: k
};
adrma.notify.removeOldNotification(l);
if (!x) {
var h = v ? "data-notify-id='" + v + "'" : "";
adrma.notify.add({
html: "<p " + h + ">" + k + " " + y + "</p>",
type: "error",
autoClose: false
})
}
}
d[(x ? "remove" : "add") + "Class"](t.errorClass);
return x
},
setTrackValidation: function setTrackValidation(a) {
var d = this,
h = a.val(),
g = "",
e = "",
b = a.closest("form"),
c = b.attr("track-validation"),
f = b.attr("track-category");
if (!c) {
return
}
e = a.attr("id") ? a.attr("id") : a.attr("name");
if (!e) {
return
}
if (!h || h.length === 0 || !$.trim(h)) {
g = "blank"
} else {
g = "invalid|" + h
}
adrma.analytics.addEvent({
category: f,
action: e,
label: g,
noninteraction: "noninteraction"
})
},
hasFormValidation: function hasFormValidation() {
return (typeof document.createElement("input").checkValidity == "function")
},
onValidationError: function onValidationError(c, f) {
var g = this,
b, d = (f && f.messages) ? f.messages : "";
if (!d) {
try {
d = JSON.parse(f.responseText);
d = d ? d.messages : ""
} catch (a) {}
}
if (!d) {
return
}
c = $(c ? c : g.formEle);
c.find(".message.error").remove();
c.find(".error").removeClass("error");
$.each(d, function(j, h) {
if (h.field === "general") {
b = c
} else {
b = c.find("[name='" + h.field + "']")
}
g.applyFeildError(b, h.text)
})
},
applyFeildError: function applyFeildError(a, b, d) {
b = b || "";
var c = a.closest("label");
c = c.length ? c : a;
c.addClass("error");
d = d || "after";
c[d]("<p class='message error'>" + b + "</p>")
},
messages: {
usCurrency: "please have valid US currency"
},
test: function test(b, a) {
if (b && adrma.regExp[a]) {
return adrma.regExp[a].test(b)
}
return false
}
};
adrma.actions.add({
validateForm: function validateForm(a, b) {
var c = new adrma.Validate();
c.init({
nonBind: true,
formEle: b
});
return c.validate()
},
validateInput: function validateInput(a, b) {
var c = new adrma.Validate();
return c.validateInput(b)
}
});
adrma.regExp = {
url: /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/,
supUrl: /^[-A-Za-z0-9_-]*$/,
cc: /^[0-9]{16}$/,
datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
email: /^([_])?(([a-zA-Z0-9]+(([_]{1,2}|[\.\-\+])[a-zA-Z0-9]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
tel: /^((\+|1)?((\d{2}[-.\s]?(\d{4}))|(\d{3}[-.\s]?(\d{3}))|(\(\d{2}\)[-.\s]?(\d{4}))|(\(\d{3}\)[-.\s]?(\d{3}))))[-.\s]?(\d{4})(( x| ext)\d{1,5}){0,1}$/,
intlTel: /^((\+|1)?((\d{2}[-.\s]?(\d{4}))|(\d{3}[-.\s]?)|(\(\d{2}\)[-.\s]?(\d{4}))|(\(\d{3}\)[-.\s]?)))([0-9\s-]{1,18})$/,
zip: {
us: /^(\d{5}([\-]\d{4})?)$/
},
usZip: /^((\d{5}(((\s\-\s)|(\s)|(\-))\d{4})?)|(\d{9}))$/,
caZip: /^[ABCEGHJKLMNPRSTVXY][0-9][A-Z][\s-]?[0-9][A-Z][0-9]$/i,
otherZip: /^[a-zA-Z0-9-]{3,}$/,
usCurrency: /^[+-]?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]{1,2})?$/,
text: /^[a-zA-Z0-9\xC0-\xFF\s&@-_'"(),.#\/+-]+$/,
optionalText: /^[a-zA-Z0-9\s&@-_`'"!?;:(),.#\/+-]+$/,
feedbackText: /^[a-zA-Z0-9\s&@\-_'"!?;:(),.#^\/\\+-]+$/,
allowedRouteChar: /^[-A-Za-z0-9_.]*$/,
address: /^[a-zA-Z0-9\xC0-\xFF\s&@-_'"(),.#\/+-:]+$/,
country: /^[a-zA-Z0-9\xC0-\xFF\s&@-_'`"(),.#\/+-]+$/,
decimal: /^\d+(\.\d{1,2})?$/,
intDecimal: /^-?\d*(\.\d{2})?$/,
giftRegExp: /^[A-Za-z0-9]*$/
};
(function(d, j, f, c, h, b, e) {
d.GoogleAnalyticsObject = h;
d[h] = d[h] || function() {
(d[h].q = d[h].q || []).push(arguments)
}, d[h].l = 1 * new Date();
adrma.init.loadDfd.done(function() {
adrma.performance.mark("load analytics script");
b = j.createElement(f);
e = j.getElementsByTagName(f)[0];
b.async = 1;
b.src = "https://www.google-analytics.com/analytics.js";
e.parentNode.insertBefore(b, e)
})
})(window, document, "script", "", "ga");
ga("create", adrma.siteSettings.GoogleAnalyticsID, "auto");
var isLoggedIn = adrma.cookie("IsLoggedIn"),
cKeys = adrma.pageInfo.cKeys || {},
pageInfo = adrma.pageInfo;
if (cKeys) {
isLoggedIn = cKeys.isLoggedIn
}
if (pageInfo.siteId === "AD") {
ga("set", "dimension1", cKeys.mode || "Ado");
if (isLoggedIn) {
var session = adrma.storage.get("local", "session"),
custId = session ? session.custId : ""
}
if (custId) {
ga("set", "&uid", custId)
}
}(function sendPageView() {
var a = pageInfo.pageType;
if (adrma.siteSettings.EnableEnhancedECommerce && (a === "productPage" || a === "checkoutPage" || a === "receiptPage")) {} else {
ga("send", "pageview")
}
})();
adrma.analytics = {
init: function() {
$.publish("ga/loaded");
adrma.analytics.loadPlugins();
this.bindActions()
},
types: {
pageView: "pageview",
trackEvent: "event",
setCustomVar: "_setCustomVar"
},
add: function add(b) {
var c = this;
if (!b.type) {
return
}
var a = {};
b = $.each(b, function(d, f) {
if (b[d] === "null") {
b[d] = null
}
});
switch (b.type) {
case "pageview":
c.addPageView(b);
break;
case "event":
c.addEvent(b)
}
},
plugins: [],
loadPlugins: function loadPlugins() {
$.each(this.plugins, function a(c, b) {
if ($.isFunction(b)) {
b()
}
})
},
addPageView: function addPageView(a) {
if (!window.ga) {
return
}
var b = {};
if (a.path) {
b.page = a.path
}
if (a.title) {
b.title = a.title
}
if (JSON.stringify(b) != "{}") {
ga("send", "pageview", b)
} else {
ga("send", "pageview")
}
},
addEvent: function addEvent(e) {
var a = {
hitType: "event"
},
c, f = this,
d;
if (!window.ga) {
d = e;
c = setInterval(function b() {
if (window.ga) {
clearInterval(c);
f.addEvent(d)
}
}, 100);
return
}
if (e.category) {
a.eventCategory = e.category
}
if (e.action) {
a.eventAction = e.action
}
if (e.label) {
a.eventLabel = e.label
}
if (e.value !== undefined) {
a.eventValue = e.value
}
if (e.noninteraction) {
a.nonInteraction = 1
}
ga("send", a)
},
setDimension: function addCustomVar(b) {
var a = "dimension" + b.index,
c = b.value;
ga("set", a, c)
},
trackEvents: function trackEvents(b) {
var d = this;
var c = $(b),
a = c.attr("data-trackData") || c.attr("data-track-data");
if (!a) {
return true
}
a = a.split(",");
d.sendEventData(a)
},
bindActions: function bindActions() {
var a = this;
$(document).on("click", ".trackEvent", function(b) {
a.trackEvents($(this))
});
$.subscribe("tooltip/shown", function(c, f) {
var d = $(f);
if (d.attr("data-track-tooltip")) {
var b = d.attr("data-trackData") || d.attr("data-track-data");
if (!b) {
return
}
b = b.split(",");
b[0] = "TT|" + b[0];
a.sendEventData(b)
}
})
},
trackView: function trackView(a) {
var e = this,
b, c = 1000,
d;
a = a ? $(a) : $("body");
a.find("[data-track-view]").each(function(g, f) {
c = c + 1001;
d = $(f);
b = d.attr("data-track-view");
d.remove();
if (b) {
(function(h) {
setTimeout(function() {
var j = h.split(",");
j[4] = true;
e.sendEventData(j)
}, c)
})(b)
}
})
},
sendEventData: function sendEventData(a) {
if (!a[3]) {
a[3] = 0
}
a[4] = a[4] || false;
adrma.analytics.add({
type: "event",
category: a[0],
action: a[1],
label: a[2],
value: a[3],
noninteraction: a[4]
})
},
setCustId: function seCustId() {
var b = adrma.storage.get("local", "session"),
a = b ? b.custId : "";
if (a) {
ga("set", "&uid", a)
}
},
setLoginDimention: function setLoginDimention(a) {
var b = adrma.storage.get("local", "session");
if (!b || b.isLoggedIn !== a.isLoggedIn || b.isVip !== a.isVip) {
adrma.analytics.setDimension({
index: 6,
value: a.isLoggedIn ? "logged in" : "not logged in"
});
adrma.analytics.setDimension({
index: 7,
value: a.isVip ? "vip" : "non-vip"
})
}
}
};
adrma.init.add({
name: "GA",
cb: function() {
adrma.analytics.init();
adrma.analytics.trackEvents()
},
defer: true
});
adrma.actions.add({
toggleRwd: function toggleRwd(a, c) {
var f = c.text("reloading...").attr("data-rwd-mode") === "true",
d = location,
b = location.search;
adrma.cookie("rwd", f ? "rwd" : "full", {
path: "/",
expires: 14
});
if (f) {
adrma.storage["delete"]("local", "settings")
}
location.href = location.href.replace(location.hash, "").replace(/&rwdReload=true|\?rwdReload=true/, "") + (b ? "&" : "?") + "rwdReload=true" + location.hash;
location.reload()
}
});
adrma.init.add({
name: "toggleHover",
cb: function toggleHover() {
$(".sp-hol-guide.toggle-hover").on("click", function a(b) {
$(this).toggleClass("rwd-active")
})
},
beforeInit: adrma.mediaQuery.isTouch
});
(function() {
var a, b, c;
if (typeof document.hidden !== "undefined") {
a = "hidden";
c = "visibilitychange";
b = "visibilityState"
} else {
if (typeof document.mozHidden !== "undefined") {
a = "mozHidden";
c = "mozvisibilitychange";
b = "mozVisibilityState"
} else {
if (typeof document.msHidden !== "undefined") {
a = "msHidden";
c = "msvisibilitychange";
b = "msVisibilityState"
} else {
if (typeof document.webkitHidden !== "undefined") {
a = "webkitHidden";
c = "webkitvisibilitychange";
b = "webkitVisibilityState"
}
}
}
}
if (document[b] === "prerender") {
adrma.pageInfo.loadedViaPrerender = true
}
document.addEventListener(c, function() {
$.publish("visibilityChange", document[b]);
adrma.visibleState = document[b]
}, false);
adrma.visibleState = document[b]
})();
adrma.actions.add({
disLinkWithoutCookie: function disLinkWithoutCookie(a, b) {
if (!adrma.checkDisableCookie()) {
window.location.href = b.attr("href")
}
}
});
adrma.lazyLoadImages = {
init: function init(c) {
c = c || {};
c.container = $(c.container || "[data-lazyload-images]");
if (!c.container.length) {
return
}
var d = this;
d.positions = adrma.positionPortals;
d.positions.init({
throttle: true
});
var b = c.offset || $(window).height() + 300;
c.container.each(function a(j, g) {
var m = $(g),
n = "lazyLoadImages_" + Math.floor(Math.random() * 1000) + j,
h = m.find("img[data-src], iframe[data-src], [data-bg-src]"),
f = m.attr("data-lazyload-images"),
l = f && f.indexOf("!") !== -1,
k, f = f ? f.replace("!", "").split(",") : null;
h = h.length ? h : m.is("img, iframe, [data-bg-src]") ? m : [];
if (f) {
if (adrma.mediaQuery.matches(f)) {
if (l) {
return true
}
} else {
if (!l) {
return true
}
}
}
if (h.length) {
d.positions.add({
name: n,
breakpoint: m,
offset: "-" + b,
onReach: function(o, p, q, e) {
m.removeAttr("data-lazyload-images");
d.removePositions(n);
adrma.convertDataSrcToSrc(o);
d.positions.recalculate()
}
})
}
})
},
removePositions: function removePositions(a) {
var b = this;
b.positions.remove(a)
}
};
adrma.init.add({
name: "initLazyLoadImages",
cb: function initLazyLoadImages() {
adrma.lazyLoadImages.init()
}
});
adrma.config = {
turnTo: true,
googleRetargeting: true,
contextin: true,
socialLinks: true,
needleChat: true,
miniCart: true,
RR: true,
showStock: false,
NLC: true,
SM: true,
c: true
};
adrma.config.ab = {
needleChat: {
threshold: 0
},
miniCart: {
threshold: 0
},
RR: {
threshold: 0
},
showStock: {
threshold: 80,
callback: function() {
$("body").addClass("showStock")
}
},
NLC: {
threshold: 0,
callback: function() {
if (document.getElementById("mainBody2012")) {
$("body").addClass("showNewLeafCartPage")
}
}
},
SM: {
threshold: 50
},
c: {
threshold: 0
}
};
adrma.config.cacheSettings = {
navTabData: {
v: "1.0",
svfor: "1day"
},
getProducts: {
v: "1.0",
svfor: "1day"
}
};
(function(a) {
a.fn.hoverIntent = function(j, k) {
var b = {
sensitivity: 7,
interval: 100,
timeout: 0
};
b = a.extend(b, k ? {
over: j,
out: k
} : j);
var d, e, m, n;
var o = function(f) {
d = f.pageX;
e = f.pageY
};
var c = function(f, g) {
g.hoverIntent_t = clearTimeout(g.hoverIntent_t);
if ((Math.abs(m - d) + Math.abs(n - e)) < b.sensitivity) {
a(g).unbind("mousemove", o);
g.hoverIntent_s = 1;
return b.over.apply(g, [f])
} else {
m = d;
n = e;
g.hoverIntent_t = setTimeout(function() {
c(f, g)
}, b.interval)
}
};
var h = function(f, g) {
g.hoverIntent_t = clearTimeout(g.hoverIntent_t);
g.hoverIntent_s = 0;
return b.out.apply(g, [f])
};
var l = function(f) {
var g = jQuery.extend({}, f);
var p = this;
if (p.hoverIntent_t) {
p.hoverIntent_t = clearTimeout(p.hoverIntent_t)
}
if (f.type == "mouseenter") {
m = g.pageX;
n = g.pageY;
a(p).bind("mousemove", o);
if (p.hoverIntent_s != 1) {
p.hoverIntent_t = setTimeout(function() {
c(g, p)
}, b.interval)
}
} else {
a(p).unbind("mousemove", o);
if (p.hoverIntent_s == 1) {
p.hoverIntent_t = setTimeout(function() {
h(g, p)
}, b.timeout)
}
}
};
return this.bind("mouseenter", l).bind("mouseleave", l)
}
})(jQuery);
$.fn.hoverTip.dataLocations = {
"bml-over250": "/searchsite/popups/global.aspx?type=bml-over250&svfor=1day",
"bml-under250": "/searchsite/popups/global.aspx?type=bml-under250&svfor=1day",
freeShipping: "/searchsite/popups/global.aspx?type=freeshipping&svfor=1day",
freeONshipping: "/searchsite/popups/global.aspx?type=freeONshipping&svfor=1day",
free2dayshipping: "/searchsite/popups/global.aspx?type=free2dayshipping&svfor=1day",
recommendedAccessories: "/searchsite/popups/global.aspx?type=recommendedAccessories&svfor=1day",
requiredAccessories: "/searchsite/popups/global.aspx?type=requiredAccessories&svfor=1day",
used: "/searchsite/popups/global.aspx?type=used&svfor=1day",
valuePrivacy: "/searchsite/popups/global.aspx?type=valuePrivacy&svfor=1day",
greyMarket: "/searchsite/popups/greymarket.aspx&svfor=1day",
refurbished: "/searchsite/popups/global.aspx?type=refurbished&svfor=1day",
openBox: "/searchsite/popups/openbox.aspx?svfor=1day",
whiteGlove: "/searchsite/popups/global.aspx?type=whiteGlove&svfor=1day",
InStoreOnlyapple_NotLoggedIn: "/searchsite/popups/InStoreRestriction.aspx?brand=apple&svfor=1day",
InStoreOnlyapple_LoggedIn: "/searchsite/popups/InStoreRestriction.aspx?loggedin=t&brand=apple&svfor=1day",
InStoreOnlysamsung_NotLoggedIn: "/searchsite/popups/InStoreRestriction.aspx?brand=samsung&svfor=1day",
InStoreOnlysamsung_LoggedIn: "/searchsite/popups/InStoreRestriction.aspx?loggedin=t&brand=samsung&svfor=1day",
AddToCart: "/searchsite/popups/AddToCart.aspx?svfor=1day",
freeShipping_byui: "/searchsite/popups/global.aspx?type=freeShipping_byui&svfor=1day",
freeShipping_fed: "/searchsite/popups/global.aspx?type=freeShipping_fed&svfor=1day"
};
adrma.templateManager = {
hasTemplate: function(b) {
if (b) {
var a = /Tmpl$/.test(b) ? "" : "Tmpl";
return !!document.getElementById(b + a)
}
if ("tmpl" in window) {
return true
} else {
return false
}
},
getTemplate: function(e, c) {
var d = this,
a = new $.Deferred(),
b = function(j) {
c = c || {};
var g = j ? "" : "script",
f = c.cache ? "svfor=" + c.cache : "",
k = c.version ? (c.cache ? "&" : "") + "v=" + c.version : "",
h = f || k ? "?" : "";
return adrma.fetchData({
url: j ? "/col/views/" + j + ".htm" + h + f + k : "/col/js/lib/microTemplating.js",
dataType: g,
returnPromise: true
}).done(function(l) {
if (j) {
$("body").append(l)
}
})
};
if (!e && !this.hasTemplate()) {
return b()
}
if (this.hasTemplate() && (!e || e && this.hasTemplate(e))) {
return a.resolve()
}
if (this.hasTemplate() && (e && !this.hasTemplate(e))) {
return b(e)
}
return b().pipe(function() {
return b(e)
})
}
};
if (adrma.isRevisedSessionHandling) {
adrma.session.getSession.done(function gotSession(a) {
$(".PricingTest > input[name$=Sid]").attr("value", a.cookieSid);
$(".Pricing > input[name$=Sid]").attr("value", a.cookieSid);
adrma.cookie("PUID", (a.custId ? a.custId : a.cookieSid), {
path: "/",
expires: 730
});
if (a.isLoggedIn) {
$("body").addClass("isLoggedIn");
$(".hoverInfo").attr("title", function() {
if (this.title.match(/^InStoreOnly ()/)) {
var b = this.title.match(/^InStoreOnly (.*)/);
return "InStoreOnly" + b[1] + "_LoggedIn"
} else {
return this.title
}
})
} else {
$("body").removeClass("isLoggedIn");
$(".hoverInfo").attr("title", function() {
if (this.title.match(/^InStoreOnly/)) {
var b = this.title.match(/^InStoreOnly (.*)/);
return "InStoreOnly" + b[1] + "_NotLoggedIn"
} else {
return this.title
}
})
}
});
adrma.getAsyncData.getData.done(function gotAsyncData(c) {
var d = c.siteSettings.LocalPhoneNumber,
b = c.siteSettings.CompanyCallFreePhone;
var a = "<span>" + b;
if (d && d !== b) {
a = " " + d
}
a += "</span>";
$("#phoneContact, #PhoneNumber").html(a);
if (adrma.cookie("refby") !== null) {
adrma.cookie("sub", null);
adrma.cookie("sterm", null);
adrma.cookie("refby", null);
adrma.cookie("ETjobid", null)
}
})
}
adrma.init.add({
name: "paramsToPageInfo",
cb: function() {
if (!adrma || !adrma.pageInfo || !adrma.pageInfo.params) {
adrma = window.adrma || {};
adrma.pageInfo = adrma.pageInfo || {};
adrma.pageInfo.params = adrma.pageInfo.params || {}
}
adrma.pageInfo.params = adrma.decodeURLToJSON(location);
adrma.pageInfo.params.sku = adrma.pageInfo.pageId;
adrma.pageInfo.params.parentItem = adrma.pageInfo.parentItem;
adrma.pageInfo.params.version = adrma.pageInfo.version
}
});
adrma.modeRouter = {
init: function() {
var d = this,
e = d.checkUrl(),
a = d.checkCookie(),
c = d.modes[e];
if (location.hash === "#clearMode") {
d.deleteStorage();
d.removeCookie();
if (history.pushState) {
window.history.replaceState("", document.title, window.location.href.split("#")[0])
} else {
location.hash = ""
}
adrma.session.clearStoredSession();
adrma.session.restartSession();
return
}
if (adrma.pageInfo.mode) {
d.setLinksClickEvent()
}
if (!adrma.siteSettings.EnabledClienSideModeRouter) {
return
}
if (e === "clear") {
d.redirect(e);
return
}
if (d.modes[e]) {
if (a === e) {} else {
d.deleteStorage();
d.setCookie(e)
}
}
if (d.modes[a]) {
if (a === e) {} else {
if (d.modes[e]) {
return
}
if (!adrma.isRevisedSessionHandling) {
d.redirect(a)
}
}
}
if (adrma.isRevisedSessionHandling && !adrma.siteSettings.UseModeFromInvisibleParameter) {
adrma.getAsyncData.getData.done(function b(f) {
var g = f.cKeys.mode;
if (g && !e) {
d.redirect(g)
}
})
}
},
modes: {
fed: {
name: "Federal",
phone: "888-209-5558"
},
state: {
name: "State & Local",
phone: "888-582-2500"
},
edu: {
name: "Education",
phone: "888-582-2500"
},
byui: {
name: "Education",
phone: "888-582-2500"
}
},
showConfirmation: function showConfirmation(a) {
var c = this,
b = c.modes[a];
if (b) {
c.removeConfirmation();
adrma.notify.add({
html: "<div class='mode-confirmation'>You are on the Adorama " + b.name + " portal.<a class='button small action cKeys' data-prevent-default='false' data-keys='Mode=" + a + "' data-action='closeNotify'>Stay in " + b.name + " Portal</a> <a href='/' class='button small inverse cKeys' data-keys='Mode='> Go to Main Site </a></div>",
autoClose: false,
type: "inverse"
})
} else {}
},
removeConfirmation: function removeConfirmation() {
$(".mode-confirmation").parents(".alert-box").remove()
},
checkUrl: function(a) {
var b = adrma.pageInfo.urlParams.mode || adrma.decodeURLToJSON("")["mode"];
return b
},
checkCookie: function() {
var a = adrma.cookie("mode");
return a
},
setCookie: function(a) {
adrma.cookie("mode", a, {
path: "/"
})
},
removeCookie: function() {
adrma.cookie("mode", null, {
path: "/"
})
},
deleteStorage: function() {
adrma.storage["delete"]("session", "cartSummery")
},
redirect: function(e) {
var h = this,
a = window.location,
d = a.search,
c = a.href.split("#"),
b = c[1] ? "#" + c[1] : "",
g, f;
c = c[0];
if (!d) {
if (!/\?/.test(location.href)) {
c += "?"
}
c += "mode=" + e
} else {
f = adrma.decodeURLToJSON("");
if (f.mode) {
if (f.mode === e) {
return
}
g = new RegExp(f.mode);
c.replace(/regEx/, e)
} else {
c += "&mode=" + e
}
}
h.removeCookie();
h.deleteStorage();
document.location = c + b
},
setLinksClickEvent: function() {
$(document).on("mouseenter click contextmenu mousedown", "a:not(.cKeys)", adrma.modeRouter.addModeToLink)
},
addModeToLink: function() {
if (!adrma.pageInfo.mode || !this.href || /((\?|&)mode=[^&]+)/gi.test(this.href) || !/adorama\.com/gi.test(this.href) || /#clearMode/gi.test(this.href)) {
return
}
var a = this.href.split("#");
var b = a[0];
if (adrma.pageInfo.siteId === "AD") {
b += /NextPage=/.test(b) ? ("?mode=" + adrma.pageInfo.mode) : adrma.modeRouter.addMode(b)
} else {
b += adrma.modeRouter.addMode(b)
}
this.href = b
},
addMode: function addMode(a) {
return (/\?/.test(a) ? "&" : "?") + "mode=" + adrma.pageInfo.mode
}
};
adrma.init.add({
name: "modeRouter",
cb: adrma.modeRouter.init,
context: adrma.modeRouter,
defer: true
});
adrma.analytics.ec = {
getList: function getList(c) {
var a = function a(n) {
var o, f = n ? n : window.location.href,
k = adrma.pageInfo,
j;
o = adrma.renameObjKeys(adrma.decodeURLToJSON(n), function(g) {
return g.toLowerCase()
});
var d = adrma.analytics.ec.getAccessoryList(c);
if (d) {
return d
}
if (o.searchinfo || o.term) {
return "search results"
}
if (f.indexOf("/specials") !== -1) {
return "specials"
}
if (o.sel) {
j = "";
var m = o.sel.toLowerCase();
if (m === "condition_ob|itemcondition_useditems" || m === "condition_ob") {
j = "open box"
}
if (m === "filterby_refurbished") {
j = "refurbished"
}
if (m === "condition_f_x|itemcondition_useditems" || m === "condition_f_x") {
j = "used clearance"
}
return j
}
if (o.promotype && o.promotype === "overstock") {
return "overstock"
}
if (f.indexOf("/overstock") !== -1) {
return "overstock"
}
if (f.indexOf("/rebates") !== -1) {
return "rebates"
}
if (f.indexOf("/MyAccount#wishlist") !== -1) {
return "wishlist"
}
if (f.indexOf("/results/vip") !== -1) {
return "vip"
}
if (f.indexOf("/results") != -1) {
var l = f.slice(f.indexOf("/results") + 9, f.length);
return "promo-" + l
}
if (f.indexOf("/l/") !== -1) {
return "list page"
}
if (f.indexOf("/g/") !== -1) {
var n = f.split("?")[0],
e = n.split("/"),
h = e.indexOf("g");
return "glp-" + e[h + 1]
}
if (o.rrref) {
j = "rr";
switch (o.rrref) {
case "productPage":
j = "rr-pdp";
break;
case "cartPage":
j = "rr-cart";
break;
case "listPage":
j = "rr-list";
break
}
return j
}
};
var b = a(window.location.href);
if (!b && document.referrer) {
b = a(document.referrer)
}
return b
},
getAccessoryList: function getAccessoryList(a) {
if (!a) {
return ""
}
if ($(".addToCartPopup .RR-widget").find("[data-sku='" + a + "']").length) {
return "accessories minicart"
}
if ($(".accessoriesContainer").find("[data-sku='" + a + "']").length) {
return "accessories tab pdp"
}
if ($(".recommended-accessories").find("[data-sku='" + a + "']").length) {
return "recommended accessories pdp"
}
return ""
},
getBundle: function getBundle(a) {
var b = "not bundle";
if (a.isBundle) {
b = "bundle"
}
return b
},
hasRRTitle: function getRRType() {
return false
},
getPrice: function getPrice(b) {
var a = "";
if (b.cartPrice) {
a = b.cartPrice;
return a
}
if (b.price) {
a = a;
return a
}
if (b.prices && b.prices.price) {
a = b.prices.price;
return a
}
},
getStock: function getStock(a) {
var b = "";
if (a.AdoramaStockStatus) {
b = a.AdoramaStockStatus.title
} else {
if (a.stock) {
a.stock.indexOf("Stock") !== -1 ? b = a.stock : b = a.stock + "Stock"
}
}
return b
},
getBadges: function getBadges(a) {
if (a.badge && a.badge.text) {
return a.badge.text
}
return a.badges ? a.badges.join(" ") : "N/A"
},
collectDataObj: function collectDataObj(c) {
var d = this,
b = c.sku ? c.sku : c.id,
a = {
id: b,
name: c.title.slice(0, 50),
category: c.category,
brand: c.brand ? c.brand : c.title.split(" ")[0],
price: d.getPrice(c),
quantity: c.quantity ? c.quantity : 1,
dimension4: d.getStock(c),
dimension8: d.getBundle(c),
dimension9: d.getBadges(c),
dimension10: c.priceType ? c.priceType : "N/A",
dimension11: c.condition ? c.condition : "N/A"
};
if (adrma.pageInfo.pageType === "productPage" && location.hash.indexOf("source=productOptions") !== -1) {
a.dimension5 = b
}
return a
},
addProducts: function addProduct(b) {
$.each(b, function a(d, c) {
ga("ec:addProduct", c)
})
},
send: function sendAddProduct(a, e, c) {
var d = this,
b = {};
if (c !== false) {
c = c || d.getList(e);
if (c) {
b.list = c
}
}
ga("ec:setAction", a, b);
ga("send", "event", "ec", a)
},
};
(function analyticsEC() {
var g = adrma.analytics.ec,
d = adrma.pageInfo;
if (!adrma.siteSettings.EnableEnhancedECommerce) {
return
}
if (!ga) {
return
}
ga("require", "ec");
switch (d.pageType) {
case "productPage":
var e = adrma.productData[adrma.pageInfo.id],
f = g.collectDataObj(e),
a = {},
c = g.getList();
g.addProducts([f]);
if (c) {
a.list = c
}
ga("ec:setAction", "detail", a);
ga("send", "pageview");
break;
case "checkoutPage":
break;
case "receiptPage":
break
}
$.subscribe("addToCart", function b(j, h) {
var m = [],
k;
if (!h.processedItems) {
return
}
for (var l = 0; l < h.processedItems.length; l++) {
m.push(g.collectDataObj(h.processedItems[l]))
}
k = m[0].id;
g.addProducts(m);
g.send("add", k, h.ecList ? h.ecList : null)
});
$.subscribe("removeFromCart", function b(j, h) {
var m = [],
l = h.processedItems || h.data.processedItems;
if (!l || !l.length) {
return
}
for (var k = 0; k < l.length; k++) {
m.push(g.collectDataObj(l[k]))
}
g.addProducts(m);
g.send("remove", "", false)
});
$.subscribe("gotData/GetCheckoutSummary", function b(j, h) {
var m = h.data.items,
q, t, l;
if (m) {
var r = $.map(m, function(u) {
return u.sku
}),
s = adrma.storage.get("session", "inCartSkus");
if (s && s.compare(r)) {
return
} else {
adrma.storage.set("session", "inCartSkus", r)
}
}
for (l in m) {
q = [];
t = m[l];
product = g.collectDataObj(adrma.productData[m[l].sku]);
product.price = t.unitPrice;
product.quantity = t.qty;
q.push(product);
if (t["package"] && t["package"].length) {
var k = 0,
p = t["package"],
o = p.length,
n;
for (; k < o; k++) {
n = p[k];
product = g.collectDataObj(adrma.productData[n.sku]);
product.price = n.unitPrice;
product.quantity = n.qty;
q.push(product)
}
}
g.addProducts(q)
}
ga("ec:setAction", "checkout");
ga("send", "pageview")
})
})();
adrma.init.add({
name: "searchLog",
cb: function searchLog() {
var d = adrma.siteSettings;
if (!d.enableEndecaSearchLogging || d.enableDdosMod) {
return
}
$("#globalSearch").on("submit", function(f) {
self.jThis = $(this);
self.value = $.trim(self.jThis.find("#searchinfo").val());
if (!self.value) {
return false
}
adrma.cookie("HumanSrch", self.value, {
path: "/"
});
return true
});
var b = adrma.pageInfo,
c = b.pageType;
if (c === "listPage" || c === "productPage") {
adrma.session.getSession.done(function a(g) {
if (c === "listPage") {
var j = b.urlParams || {},
f = j.searchinfo || "",
h = j.term || "",
e = j.category || "";
f = f || h || "";
if (f) {
adrma.fetchData({
type: "POST",
url: "/searchsite/AjaxHelperService.asmx/AddToSearchPageSearchLogTable",
data: "{'searchinfo': '" + f.replace(/'/g, "\\'") + "', 'sid': '" + g.cookieSid + "', 'EndecaLogString':'', 'totrecs':'0', 'category_id':'', 'prefix':'', 'pos':''}",
contentType: "application/json; charset=utf-8",
preserveContentType: true,
dataType: "json"
});
$(document).on("click", ".item a", function() {
var k = $(this).closest(".item").index(),
l = f + "|" + k + "|" + e;
adrma.cookie("searchinfo", l, {
path: "/"
})
})
}
}
if (c === "productPage") {
if (!adrma.cookie("searchinfo") && !adrma.cookie("redirectedToSku" + adrma.pageInfo.pageId)) {
return
}
adrma.fetchData({
type: "POST",
url: "/searchsite/AjaxHelperService.asmx/AddToSearchLogTable",
data: "{Sku:'" + adrma.pageInfo.pageId + "', Sid:'" + g.cookieSid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
preserveContentType: true
})
}
})
}
}
});
adrma.init.add({
name: "headerFunc",
cb: function() {
$("#context-shop").addClass("show");
var a = new adrma.EventIntent().init({
ele: ".toggle-hover"
});
var b = adrma.pageInfo.pageType;
if (b === "homepage" || b === "FSE-homepages") {
$(".departments-nav").addClass("force-hover")
}
$("#headerLevel1").on("mouseover", ".headerEco li", function(d) {
var f = $(this),
c = f.attr("data-context");
f.addClass("active").siblings().removeClass("active");
$("#context-" + c).addClass("show").siblings().removeClass("show")
});
$("#headerLevel1, #headerLevel2").on("mouseout", function(c) {
var d = $(c.target),
g = $(c.relatedTarget),
f = $(this);
if (g.closest("#headerLevel1").length || g.closest("#headerLevel2").length) {
return
}
if (adrma.pageInfo.searchCategory !== "") {
$(".eco-used").trigger("mouseover")
} else {
$(".eco-shop").trigger("mouseover")
}
});
if (adrma.pageInfo.searchCategory !== "") {
$(".headerEco").find(".active").removeClass("active");
$(".eco-used").trigger("mouseover")
}
adrma.getAsyncData.getData.done(function(c) {
var g, h = $(".tel-tollfree"),
f = $(".tel-local"),
e = $(".head-tollfree"),
d = $(".head-local-tel");
if (c.siteSettings.LocalPhoneNumber) {
f.text(adrma.siteSettings.LocalPhoneNumber)
}
if (c.siteSettings.CompanyCallFreePhone) {
h.text(c.siteSettings.CompanyCallFreePhone)
}
if (e.text() === d.text()) {
d.remove()
}
});
$("#globalSearch").removeAttr("onsubmit").submit(function(c) {
if (c) {
c.stopPropagation();
c.preventDefault()
}
form = $("#globalSearch");
var l = form.find("#searchinfo"),
j = l.val(),
h = l.attr("name") || "searchinfo";
if (j) {
var k = {
name: h,
value: j
};
var e = [k];
if (adrma.pageInfo.searchCategory) {
var g = {
name: "category",
value: adrma.pageInfo.searchCategory
};
e.push(g)
}
if (adrma.pageInfo.mode) {
var d = {
name: "mode",
value: adrma.pageInfo.mode
};
e.push(d)
}
if (!adrma.typeAhead.isTypeAheadSearchPerformed) {
ga("set", "dimension12", "standard search");
ga("set", "metric1", 1)
}
ga("set", "dimension13", j);
var f = "http://" + location.host + "/searchsite/default.aspx?" + jQuery.param(e);
document.location.href = f.toLowerCase()
}
return false
})
}
});
adrma.actions.add({
dismissLevel0: function dismissLevel0(a, b) {
adrma.storage.set("session", "hideLevel0", true)
},
toggleDeprtment: function toggleDeprtment(a, b) {
$("body").toggleClass("drawer-opened")
}
});
adrma.init.add({
name: "injectFooterTel",
cb: function injectFooterTel() {
$("#footerInner").prepend('<div class="col_phone tel-tollfree" data-icon="!"/>')
},
beforeInit: adrma.mediaQuery.matches("small")
});
adrma.init.add({
name: "toggleFooterColumn",
cb: function toggleFooterColumn() {
$("#footer .col_1 > h4:first-of-type, #footer .col_2 > h4:first-of-type, #footer .col_3 > h4:first-of-type").on("click", function(a) {
$(this).siblings().toggle()
})
},
beforeInit: adrma.mediaQuery.isTouch
});
if (!adrma.isRevisedSessionHandling) {
adrma.init.add({
name: "siteSettingsTel",
cb: function siteSettingsTel() {
var d = adrma.siteSettings,
e = $(".tel-tollfree"),
c = $(".tel-local"),
b = $(".head-tollfree"),
a = $(".head-local-tel");
e.text(d.CompanyCallFreePhone);
c.text(d.LocalPhoneNumber);
if (b.text() === a.text()) {
a.remove()
}
},
defer: true
})
}
adrma.init.add({
name: "headerToggle",
cb: function globaMessage() {
$(".toggle-department").on("click", function() {
$("html").toggleClass("drawer-opened");
$(".departments-nav").toggleClass("hover")
});
$(".head-deals-toggle").on("click", function() {
$(".head-deals").toggleClass("hover")
})
},
defer: true,
beforeInit: adrma.mediaQuery.isTouch
});
adrma.init.add({
name: "sessionStateClasses",
cb: function sessionStateClasses() {
var a = function a(d) {
var c = $("body");
if (d.isLoggedIn) {
c.addClass("logged-in").removeClass("logged-out");
$("#accountGreet").html("Hello, <strong title=" + d.firstName + ">" + adrma.format.elipses(d.firstName, 8, "..") + "!</strong>")
} else {
c.addClass("logged-out").removeClass("logged-in")
}
};
var b = function b(d) {
var c = $(".cart-count");
if (!d.cartCount) {
c.remove();
return
}
c = c.length ? c : $("<span class='cart-count'>").appendTo(".head-cart");
c.text(d.cartCount)
};
adrma.session.getSession.done(function(c) {
a(c);
b(c);
$.subscribe("session/gotSession", function(d, f) {
a(f);
b(f)
})
})
},
defered: true
});
adrma.typeAhead = {
isTypeAheadSearchPerformed: false,
isImpressionSend: false,
init: function init() {
if (adrma.siteSettings.enableDdosMode) {
return
}
$.when($.fn.typeahead ? true : adrma.fetchData({
url: "/sup/js/plugins/typeahead.js",
dataType: "script"
})).done(function() {
$("#searchinfo").typeahead({
limit: 6,
minLength: 3,
classNames: {
menu: "tt-dropdown-menu"
}
}, {
source: function(c, d, a) {
if (!c) {
return
}
c = c.toLowerCase();
var b = adrma.pageInfo;
adrma.fetchData({
url: "/searchsite/newdesign/controls/StaticPage/PostBackMethods.asmx/GetSearchSuggestions?SearchTerm=" + c,
cacheLocal: true,
productVersion: true
}).done(function(f) {
var e = f.data.suggestions || [],
g;
if (e.length > 0 && !adrma.typeAhead.isImpressionSend) {
adrma.analytics.add({
type: "event",
category: "site search",
action: "type-ahead",
label: "impression",
value: 0,
noninteraction: true
});
adrma.typeAhead.isImpressionSend = true
}
g = $.map(e, function(h) {
return h[0]
});
a(g)
})
}
});
$(document).on("keyup", "#globalSearch #searchinfo", function(a) {
var b = $(this);
b.attr("data-original-val", b.val())
});
$(document).on("click", "#globalSearch .tt-suggestion.tt-selectable", function() {
var a = $("#globalSearch"),
c = $(this),
b = c.index(),
d = a.find("#searchinfo").attr("data-original-val");
adrma.cookie("typeAheadData", d + "," + b);
adrma.analytics.add({
type: "event",
category: "site search",
action: "type-ahead",
label: "search",
value: 0,
noninteraction: true
});
ga("set", "dimension12", "type-ahead search");
ga("set", "metric1", "1");
adrma.typeAhead.isTypeAheadSearchPerformed = true;
a.trigger("submit")
})
})
}
};
adrma.init.add({
cb: function() {
if (adrma.siteSettings && adrma.siteSettings.IsTypeAheadEnabled) {
adrma.typeAhead.init()
}
},
defer: true
});
(function() {
adrma.actions.add({
dismissLevel0: function a(b, c) {
adrma.cookie("hideLevel0", 1, {
path: "/"
})
}
});
adrma.init.add({
name: "globaMessage",
cb: function() {
var c = $(".level0"),
b = adrma.cookie("hideLevel0");
if (c.length && !b) {
$("body").addClass("globalMessageOn")
}
},
defer: true,
delay: 500
})
})();
adrma.init.add({
name: "footerFunc",
cb: function() {
adrma.performance.mark("fbFooter");
$('<iframe id="fbFooter" src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FAdorama&send=false&layout=button_count&width=150&show_faces=false&font&colorscheme=light&action=like&height=25&appId=220021344703215" scrolling="no" frameborder="0" style="border: none; overflow: hidden; width: 150px; height: 25px;" allowtransparency="true"></iframe>').prependTo(".social_facebook .socialAction")
},
defer: true,
delay: 2000
});
adrma.emailSubscribe = {
init: function() {
var a = this;
$(document).on("submit", ".emailOptin", function(b) {
a.jThis = $(this);
a.emailInput = a.jThis.find("[name='Email']");
a.sourceType = a.jThis.find("[name='Page_Source']").val();
a.value = a.emailInput.val();
if (!a.value) {
return false
}
if (adrma.Validate.prototype.validate(a.jThis)) {
a.postData()
} else {
a.onInvalidEmail()
}
return false
})
},
onInvalidEmail: function onInvalidEmail() {
var a = this;
$("<span class='message error'>&#x2716; Your email address is not valid</span>").appendTo(a.jThis);
a.emailInput.addClass("error")
},
postData: function() {
var b = this,
c = b.sourceType || "Quick Optin",
d = new Date().getTime();
var a = {
email: this.value,
emailSourceType: c,
svfor: 0
};
return $.ajax({
url: "/api/user/SubscribeToEmail",
data: a,
type: "POST",
dataType: "jsonp"
}).always(function(e) {
b.updateUI(e)
})
},
updateUI: function(b) {
var c = this,
b = JSON.parse(b.responseText).status,
a;
c.jThis.find(".message").remove();
if (b === "success") {
a = $("<span class='message success'>&#x2713; Your email is updated</span>").appendTo(c.jThis);
this.resetUI();
$.publish("subscribedToEmail")
} else {
c.onInvalidEmail()
}
},
resetUI: function(a) {
var b = this;
if (a) {
b.emailInput.removeClass("error");
return false
}
setTimeout(function() {
b.emailInput.val("");
b.jThis.find(".message").remove()
}, 4000)
}
};
adrma.init.add({
name: "emaiSubscribe",
cb: adrma.emailSubscribe.init,
context: adrma.emailSubscribe,
defered: true
});
(function(a) {
a.fn.beltRotate = function(c) {
var b = {
speed: 1000,
moveBy: 1,
autoRotate: false,
autoRotateIntervalTime: 8000,
wrapWith: "<div class='belt'>",
addControlsTo: "beltContainer",
beforeSetupCallback: function() {},
afterSetupCallback: function() {},
moveCallback: function() {},
substarctLastMarginPadding: false
};
c = a.extend(b, c);
return this.each(function(s, p) {
var d = a(p).addClass("beltRotateContainer"),
v = a(p).attr("data-dir") == "vertical",
m = d.find("ul").length ? d.find("ul") : d.wrapInner(c.wrapWith).find(".belt"),
f = m.children(),
e = f.length,
r = f.outerWidth(true),
q = f.outerHeight(true),
A = !v ? r * c.moveBy : q * c.moveBy,
l = (e * r),
k = (e * q),
n = 0,
C = (function() {
if (d.closest(".beltRotateContainer").parent().find(".thumbRightArrow").length) {
return d.closest(".beltRotateContainer").parent().find(".thumbRightArrow")
} else {
if (c.addControlsTo === "beltContainer") {
return d.append("<a href='#' class='thumbRightArrow'></a>").find(".thumbRightArrow")
} else {
return a(c.addControlsTo).append("<a href='#' class='thumbRightArrow'></a>").find(".thumbRightArrow")
}
}
})(),
w = (function() {
if (d.closest(".beltRotateContainer").parent().find(".thumbLeftArrow").length) {
return d.closest(".beltRotateContainer").parent().find(".thumbLeftArrow")
} else {
if (c.addControlsTo === "beltContainer") {
return d.append("<a href='#' class='thumbLeftArrow'></a>").find(".thumbLeftArrow")
} else {
return a(c.addControlsTo).prepend("<a href='#' class='thumbLeftArrow'></a>").find(".thumbLeftArrow")
}
}
})(),
j = parseFloat(m.parent().width()),
h = parseFloat(m.parent().height()),
y = (-l + j),
z = (-k + h),
o, x, D, u = false,
t = true,
B = false;
var g = {
setUpBelt: function() {
if (!v) {
m.width(l);
c.beltUL = m;
C.bind("moveRight", function(E, F) {
if (F === "clicked") {
clearInterval(D)
}
if (n > y && !m.is(":animated")) {
m.animate({
left: "-=" + A + "px"
}, c.speed, function() {
n = parseFloat(m.css("left"));
g.updateArrowsState();
c.moveCallback()
})
}
return false
}).bind("click", function() {
a(this).trigger("moveRight", ["clicked"]);
return false
});
if (l < j) {
C.addClass("inActive")
}
w.addClass("inActive").bind("moveLeft", function(E, F) {
if (F === "clicked") {
clearInterval(D)
}
if (n < 0 && !m.is(":animated")) {
m.animate({
left: "+=" + A + "px"
}, c.speed, function() {
n = parseFloat(m.css("left"));
g.updateArrowsState();
c.moveCallback()
})
}
return false
}).bind("click", function() {
a(this).trigger("moveLeft", ["clicked"]);
return false
})
} else {
m.height(k);
c.beltUL = m;
C.bind("moveRight", function(E, F) {
if (F === "clicked") {
clearInterval(D)
}
if (n > z && !m.is(":animated")) {
m.animate({
top: "-=" + A + "px"
}, c.speed, function() {
n = parseFloat(m.css("top"));
g.updateArrowsState();
c.moveCallback()
})
}
return false
}).bind("click", function() {
a(this).trigger("moveRight", ["clicked"]);
return false
});
if (k < h) {
C.addClass("inActive")
}
w.addClass("inActive").bind("moveLeft", function(E, F) {
if (F === "clicked") {
clearInterval(D)
}
if (n < 0 && !m.is(":animated")) {
m.animate({
top: "+=" + A + "px"
}, c.speed, function() {
n = parseFloat(m.css("top"));
g.updateArrowsState();
c.moveCallback()
})
}
return false
}).bind("click", function() {
a(this).trigger("moveLeft", ["clicked"]);
return false
})
}
},
updateArrowsState: function() {
o = Math.abs(n);
x = !v ? Math.abs(y) : Math.abs(z);
d.data("beltData").curPos = n;
if (o >= x) {
w.removeClass("inActive");
C.addClass("inActive");
t = false;
u = true
}
if (n >= 0) {
C.removeClass("inActive");
w.addClass("inActive");
u = false;
t = true
}
if (o < x && n < 0) {
w.removeClass("inActive");
C.removeClass("inActive");
u = false;
t = false
}
},
simulateClick: function() {
if (!B) {
C.trigger("moveRight", ["triggered"]);
B = u ? true : false;
if (B) {
w.trigger("moveLeft", ["triggered"])
}
} else {
w.trigger("moveLeft", ["triggered"]);
B = t ? false : true;
if (!B) {
C.trigger("moveRight", ["triggered"])
}
}
}
};
g.setUpBelt();
d.data("beltData", {
beltUL: m,
eleWidth: r,
eleHeight: q,
beltLength: e
});
noop = c.autoRotate && (c.autoRotateInterval = setInterval(g.simulateClick, c.autoRotateIntervalTime))
})
}
})(jQuery);
adrma.init.add({
name: "beltinizeBrandComponents",
cb: function() {
var c = $(".nav-brands").addClass("non-visible");
if (adrma.pageInfo.pageType === "homePage" && !adrma.mediaQuery.matches("full")) {
c.remove()
}
var b, a = function a() {
c.beltRotate({
wrapWith: "<div class='beltWrapper'><div class='belt'></div></div>",
speed: 320,
moveBy: 2
}).removeClass("non-visible")
};
if (c.find("[data-src]").length) {
adrma.convertDataSrcToSrc(c);
setTimeout(a, 100)
} else {
a()
}
$(".aquaviews-highlight").beltRotate({
wrapWith: "<div class='beltWrapper'><div class='belt'></div></div>",
addControlsTo: ".home-aquaviews-widget",
speed: 320,
moveBy: 1
})
}
});
adrma.ThumbsViewer = function() {
return this
};
adrma.ThumbsViewer.prototype = {
defaults: {
container: "",
largeImage: ".largeImage",
thumbsContainer: ".thumbsContainer",
imgTitle: ".img-title",
activeClass: "active",
thumbSource: /Thumb/,
largeSource: "Large",
videoDimentions: {
width: "350",
height: "350"
},
videoWidth: "400",
beforeInit: $.noop,
afterInit: $.noop,
productImageContainer: "",
toggleActiveClass: function(a) {
a.addClass(this.activeClass).siblings().removeClass(this.activeClass)
},
onHover: function(b, d) {
if (d.hasClass("thumb-video") || this.mode === "video") {
return
}
this.toggleActiveClass(d);
var g = d,
h = g.attr("src"),
c = g.attr("data-thumb-title"),
a = g.attr("data-has-zoom"),
f = (a === "True") ? "XLarge" : "Large";
largeSrc = h.replace(this.thumbSource, f), thumbIndex = g.index();
largeImage = this.largeImage;
largeImage.attr("src", largeSrc);
largeImage.attr("data-has-zoom", g.attr("data-has-zoom"));
largeImage.load(function() {
return;
largeImage.css("max-width", largeImage.width());
largeImage.css("max-height", largeImage.height())
});
this.imgTitle.html(c);
this.largeImage.parent().attr("data-callback-arguments", thumbIndex)
},
mode: "image",
onClick: function(a, c) {
var h = this;
var d = h.largeImage;
if (c.is(".thumb-video")) {
$(".popupContainer").find(".largeImage").hide();
if (c.hasClass(".active")) {
return
}
var g = c.attr("data-media-type"),
f = c.attr("data-media-id"),
b = c.attr("data-thumb-title");
h.imgTitle.html(b);
h.toggleActiveClass(c);
if (!this.media) {
h.media = new adrma.Media();
var j = h.container;
if (h.productImageContainer) {
j = h.container.hasClass(h.productImageContainer) ? h.container : h.container.find(h.productImageContainer)
} else {
j = j.find(".product-img-container")
}
h.media.init({
container: j,
dimentions: {
width: h.videoDimentions.width,
height: h.videoDimentions.height
}
})
}
h.mode = "video";
h.media.remove();
h.media.play(g, f);
d.addClass("non-visible");
return
} else {
if (h.mode === "video") {
h.mode = "image";
c.trigger("mouseenter");
h.media.remove();
d.removeClass("non-visible")
}
$(".popupContainer").find(".largeImage").show();
h.largeImage.trigger("mouseenter")
}
}
},
init: function(a) {
var b = this;
$.extend(b, this.defaults, a);
b.container = $(b.container);
if (!b.container.length) {
return
}
b.largeImage = b.container.find(b.largeImage);
b.beforeInit();
b.thumbsContainer = b.container.find(b.thumbsContainer);
b.imgTitle = b.container.find(b.imgTitle);
if (b.shouldBelt && b.beltIf()) {
b.belt()
}
b.bindActions();
b.afterInit();
if (b.container.find(".thumb-video").length && b.container.find("img").length > 1) {
b.container.find(".large-img a").attr("data-callback-arguments", 1);
if (!adrma.Media) {
adrma.fetchData({
url: "/sup/js/adrma.media.js",
dataType: "script"
})
}
}
},
bindActions: function() {
var a = this;
a.thumbsContainer.on("mouseenter click", "img", function(b) {
var d = $(this),
c = b.type;
if (c === "mouseenter") {
a.onHover.apply(a, [b, d])
} else {
a.onClick.apply(a, [b, d])
}
})
}
};
adrma.cart = {
defaults: {},
serializeForm: function(b) {
var j = this,
c = b.closest("form"),
h = b.closest("[data-sku]"),
a = {},
k, g, d, f = j.resolveConfigSku(h.attr("data-sku")),
e, l = true;
a[f] = a[f] || {};
if (c.length) {
e = c.find("input.itemData");
$.each(e, function(o, m) {
d = $(m);
k = j.resolveConfigSku(m.name);
g = m.value;
d.removeClass("error");
if (isNaN(g) || g < 1 || g.indexOf(".") > -1) {
l = false;
j.tempDisable = true;
setTimeout(function n() {
j.tempDisable = false
}, 2000);
adrma.notify.add({
html: "<p>Please change the quantity to a valid number</p>",
type: "error"
});
d.addClass("error")
}
if (d.hasClass("component")) {
a[f].components = a[f].components || [];
a[f].components.push({
id: k,
qty: g
})
} else {
a[f].qty = g
}
})
} else {
k = j.resolveConfigSku(h.attr("data-sku"));
a[k] = {
qty: 1
}
}
if (!l) {
c.removeClass("in-action");
a = {}
}
return a
},
storeData: function storeData(a) {
var b = this;
b.data = a
},
resolveConfigSku: function resolveConfigSku(b) {
if (!b) {
return
}
if (!adrma.productData) {
return b
}
var a = adrma.productData[b];
if (a && a.type && (a.type === "configurable") && a.config && a.id && a.config.id) {
b = a.config.id
}
return b
},
getProductData: function(b) {
var a = {};
b = this.resolveConfigSku(b);
a[b] = {
qty: 1
};
return a
},
addToCart: function(b, f) {
var g = this,
d = $.Deferred();
if (g.tempDisable) {
return d.reject()
}
f = $.extend({}, this.defaults, f);
if (b instanceof jQuery) {
if (b.hasClass("disabled")) {
return d.reject()
}
var e = b.closest("form").length;
b = e ? this.serializeForm(b) : this.getProductData(b.closest("[data-sku]").attr("data-sku"))
}
if (!b || $.isEmptyObject(b)) {
return d.reject()
}
var h = (function c(j) {
if (j === "cartPage") {
return j
}
return "miniCart"
})(adrma.pageInfo.pageType);
b = {
clientTimeStamp: adrma.getTimezoneStamp(),
cartItems: b,
type: h,
isEmailPrice: adrma.pageInfo.isEmailPrice
};
var a = g.beforeAddToCart(b, f);
if (!a) {
return d.reject()
}
g.updateStorage();
g.postData(b).done(function(j) {
if (j.status === "success") {
g.storeData(j.data);
g.afterAddToCart(j, f);
d.resolve(j)
} else {
g.failedAddToCart(j, f);
d.reject(j)
}
}).fail(function(j) {
g.failedAddToCart(j, f);
d.reject(j)
});
return d
},
postData: function(a) {
a = JSON.stringify(a);
return adrma.fetchData({
url: "/api/user/order/addToCart",
data: a,
type: "POST",
contentType: "json",
dataType: "json"
})
},
beforeAddToCart: function(a, b) {
$.publish("cart/beforeAddingItem", a);
return true
},
afterAddToCart: function(c, b) {
$.publish("cart/addedItem", c);
if (b && b.configEleCollection) {
adrma.actions.toggleInAction(b.configEleCollection, "remove")
}
var a = c.messages;
if (a) {
$.each(a, function(f, d) {
adrma.notify.add({
html: "<p>" + d.text + "</p>",
autoClose: false
})
})
}
},
failedAddToCart: function(b, a) {
$.publish("cart/addedItem/", b);
$.publish("cart/addItemFailed", b);
if (adrma.pageInfo.siteId !== "ADR" || !adrma.siteSettings.IsLocationsEnabled) {
adrma.notify.renderApiMessages(b)
}
if (a && a.configEleCollection) {
adrma.actions.toggleInAction(a.configEleCollection, "remove")
}
},
updateStorage: function() {
adrma.storage["delete"]("local", "miniCart");
if (!adrma.isRevisedSessionHandling) {
adrma.storage["delete"]("local", "session")
}
},
removeFromCart: function(b, f) {
f = $.extend({}, this.defaults, f);
var g = this,
e = $.Deferred(),
h = (function d(j) {
if (j === "cartPage") {
return j
}
return "miniCart"
})(adrma.pageInfo.pageType),
c = {
CartDetailID: b,
type: h
},
a = g.beforeRemoveFromCart(b, f);
g.updateStorage();
if (!a) {
return e.reject()
}
adrma.fetchData({
url: "/api/user/order/RemoveFromCart",
data: c,
type: "POST",
dataType: "json"
}).done(function(j) {
if (j.status === "success") {
g.storeData(j.data);
g.afterRemoveFromCart(j, f);
e.resolve(j)
} else {
g.failedRemoveFromCart(j, f);
e.reject(j)
}
}).fail(function(j) {
g.failedRemoveFromCart(j, f);
e.reject(j)
});
return e
},
beforeRemoveFromCart: function(a, b) {
$.publish("cart/active", {});
return true
},
afterRemoveFromCart: function(b, a) {
$.publish("cart/removedItem", b);
$.publish("cart/removedItem/", b)
},
failedRemoveFromCart: function(b, a) {
adrma.notify.renderApiMessages(b);
$.publish("cart/failedRemovingItem", b)
}
};
adrma.inCart = {
classInCart: "in-cart",
valInCart: "In Cart",
valAddToCart: "Add To Cart",
init: function init(a) {
var c = this,
b = true;
c.updateInCartObj(a);
c.updateButtons(a, b);
c.updateInHeaderCart();
c.wishlistUpdateAllToCart()
},
addItemToInCartObj: function addItemToInCartObj(b) {
var e = this,
d = b.inCart,
c = adrma.storage.get("local", "inCart") || {},
a;
if (adrma.pageInfo.siteId === "AD") {
a = d[0]
} else {
a = d[d.length - 1]
}
c[a] = e.processInCartItem(a);
adrma.storage.set("local", "inCart", c)
},
storeInCartItems: function storeInCartItems(a, h) {
var g = this,
b = adrma.storage.get("local", "inCart") || {},
d = a.inCart,
c = {},
e;
if (h === "add") {
g.addItemToInCartObj(a)
} else {
e = (function() {
var j = {};
$.each(d, function(l, k) {
j[k] = k
});
return j
}());
for (var f in b) {
if (b.hasOwnProperty(f)) {
if (!e[f]) {
delete b[f]
}
}
}
adrma.storage.set("local", "inCart", b)
}
},
updateInCartObj: function updateInCartObj(b) {
var f = this,
e = b.inCart,
d = adrma.storage.get("local", "inCart") || {},
c, a = {};
adrma.storage.set("local", "inCart", {});
if (e.length) {
$.each(e, function(g, h) {
a[h] = f.processInCartItem(h)
});
adrma.storage.set("local", "inCart", a)
}
},
updateInHeaderCart: function updateInHeaderCart() {
var d = this,
b = $("#stickyHeaderContainer"),
c;
if (b.length) {
c = b.find(".button");
if (c.length) {
var b = $(".product-info-container"),
a = b.find("[data-action='addToCart']");
if (!a.length) {
a = b.find("[data-action='configAddToCart']").length ? b.find("[data-action='configAddToCart']") : b.find("[data-action='packageAddToCart']")
}
if (a.length) {
if (a.hasClass(d.classInCart)) {
c.val(d.valInCart).addClass(d.classInCart)
} else {
c.val(d.valAddToCart).removeClass(d.classInCart)
}
}
}
}
},
updateButtons: function updateButtons(a, d) {
var h = this,
c = adrma.storage.get("local", "inCart") || {},
g = a.inCartConfigLabels,
e = d || false,
b = Object.keys(c).map(function(j) {
return c[j]
}),
f = $("[data-sku]:not(#priceAlertForm)");
if (b && b.length) {
$.each(b, function(o, p) {
var q = g[o],
r = q ? q.productID : p.parentSku,
n = adrma.pageInfo.siteId === "AD" ? ".button" : "[type='submit']",
j, m, k, l;
if (r !== p.sku) {
j = $("[data-sku='" + r + "']").find("form");
m = (q && q.configurationLabel && q.configurationLabel.length) ? q.configurationLabel : "";
if (adrma.pageInfo.pageType === "listPage" && m.length) {
j.prepend("<span data-icon='V' class='incart-child'><strong>" + m + "</strong> in cart</span>")
} else {
if (!e) {
l = h.classInCart === "in-cart" ? "in-cart redirect-to-cart" : h.classInCart;
k = f.filter("[data-sku='" + r + "']").find(n).addClass(l);
h.onChangeBtnValue(k)
}
}
}
l = h.classInCart === "in-cart" ? "in-cart redirect-to-cart" : h.classInCart;
k = f.filter("[data-sku='" + p.sku + "']").find(n).addClass(l);
if (k.length) {
h.onChangeBtnValue(k)
}
})
}
},
onAddRemoveAction: function onAddRemoveAction(a, c) {
var b = this;
b.storeInCartItems(a, c);
b.inputsAttrUpdates();
b.updateButtons(a);
b.updateInHeaderCart();
b.wishlistUpdateAllToCart()
},
wishlistUpdateAllToCart: function wishlistUpdateAllToCart() {
if (window.location.href.indexOf("#wishlist") !== -1 && adrma.account) {
adrma.account.wishlistUpdateAllToCart()
}
},
inputsAttrUpdates: function inputsAttrUpdates() {
var c = this,
a = $("[data-sku]:not(#priceAlertForm)");
a.find(".add-to-cart.in-cart").each(function b() {
jThis = $(this);
if (jThis.is("input")) {
jThis.removeClass(c.classInCart).val(jThis.attr("data-orig-val"))
} else {
jThis.text(jThis.attr("data-orig-val"))
}
});
a.find(".incart-child").remove()
},
processInCartItem: function processInCartItem(e) {
var f = this,
d = false,
c = {},
a = {},
b = adrma.productData || {};
if (Object.keys(b).length) {
$.each(b, function(g, h) {
(function(j) {
if (j.sku) {
a = j
} else {
a = {
sku: e
}
}
}(f.processConfigurations(h, e)))
})
} else {
a = {
sku: e
}
}
return a
},
processConfigurations: function processConfigurations(d, c) {
var b = d.configurations,
a = {};
if (!b) {
return {}
}
if (d.configLevels > 1) {
$.each(b, function(f, e) {
$.each(e, function(h, g) {
if (c === g.id) {
a = {
sku: c,
parentSku: d.id,
configuration: f + " and " + h
};
return false
}
})
})
} else {
$.each(b, function(g, f) {
if (c === f.id) {
a = {
sku: c,
parentSku: d.id,
configuration: g
};
return false
}
})
}
return a
},
onConfigureItem: function onConfigureItem(b) {
var g = this,
f = adrma.storage.get("local", "miniCart") || "",
d = f ? f.inCart : [],
h = b.skuData.sku,
c = b.configData.id,
j = $("[data-sku='" + h + "']"),
a = j.find(".add-to-cart.configAddToCart:visible, .product-info-container .add-to-cart:visible"),
e;
if (!a) {
return
}
e = a.attr("data-action") == "addToQuote";
if (f && d && d.length && c && $.inArray(c, d) !== -1 && !e && !a.hasClass("applyConfigSubmit")) {
a.addClass(g.classInCart);
g.onChangeBtnValue(a)
} else {
if (!e) {
if (a.hasClass(g.classInCart)) {
a.removeClass(g.classInCart);
if (a.is("input")) {
a.val(a.attr("data-orig-val"))
} else {
a.text(a.attr("data-orig-val"))
}
}
}
}
g.updateInHeaderCart()
},
onChangeBtnValue: function onChangeBtnValue(b) {
var c = this,
a = b;
if (a.is("input")) {
a.val(c.valInCart)
} else {
a.text(c.valInCart)
}
}
};
adrma.init.add({
name: "inCartSubscribe",
cb: function() {
$.subscribe("cartData", function d(g, f) {
adrma.inCart.init(f)
});
$.subscribe("cart/addedItem", function a(f, g) {
adrma.inCart.onAddRemoveAction(g.data, "add")
});
$.subscribe("cart/removedItem", function e(f, g) {
adrma.inCart.onAddRemoveAction(g.data, "remove")
});
$.subscribe("UpdateButtonMoveToCartForWishList", function c(g, f) {
adrma.inCart.onAddRemoveAction(f, "add")
});
$.subscribe("RevertInWishListItem", function c(g, f) {
adrma.inCart.onAddRemoveAction(f, "remove")
});
$.subscribe("product/configured/item", function b(g, f) {
adrma.inCart.onConfigureItem(f)
})
}
});
adrma.iterateProducts = function(d, b) {
d = $(d || "body");
var f = $.Deferred(),
e, j, k, a, h;
this.repaint = function(m) {
j = m.prices;
e = d.find("[data-sku='" + m.id + "']");
if (!e || !e.length) {
return
}
e.find(".itemData").not(".component").attr("data-price", j.price);
e.find(".your-price").text(adrma.format.currency(j.price));
priceListEle = e.find(".price-list");
priceYouSaveEle = e.find(".price-you-save");
hasListPrice = j.list ? true : false;
hasYouSavePrice = j.youSave ? true : false;
if (hasListPrice) {
priceListEle.text(adrma.format.currency(j.list))
}
if (hasYouSavePrice) {
priceYouSaveEle.text(adrma.format.currency(j.youSave.dollar) + " (" + j.youSave.percent + "%)")
}
priceListEle.parent().toggleClass("hide", !hasListPrice);
priceYouSaveEle.parent().toggleClass("hide", !hasYouSavePrice);
if (adrma.pageInfo.siteId !== "AD") {
e.find("#free-shipping-logo").toggleClass("hide", !m.freeShipping);
e.find("#ship-calc-message").toggleClass("hide", m.freeShipping)
}
};
this.configure = function(n) {
if (n.type !== "regular" && adrma.pageInfo.siteId !== "AD") {
var m = new adrma.ProductConfig();
m.init({
sku: k,
container: "[data-sku='" + n.id + "']"
});
adrma.productData[k].configObj = m
}
};
var g = 0,
c = b.length;
for (k in adrma.productData) {
var l = adrma.productData[k];
for (; g < c; g++) {
this[b[g]].call(null, l)
}
g = 0
}
f.resolve();
return f
};
(function productJS() {
adrma.product = {
isMultipleInStock: function b(k) {
var l = false,
m = this,
n = k.attr("data-sku"),
o = adrma.productData[n] || {},
p = o.type || "";
if (p === "configurable") {
var j = 0;
if (o.configLevels === "1") {
for (configKay in o.configurations) {
if (o.configurations.hasOwnProperty(configKay)) {
var g = o.configurations[configKay];
if (g.stock && g.stock.toLowerCase() === "out") {
j++
}
}
}
} else {
for (configKay in o.configurations) {
if (o.configurations.hasOwnProperty(configKay)) {
var h = o.configurations[configKay];
for (kay in h) {
if (h.hasOwnProperty(kay)) {
var g = h[kay];
if (g.stock && g.stock.toLowerCase() === "out") {
j++
}
}
}
}
}
}
if (j > 1) {
l = true
}
}
return l
},
findCheckedSkuOptions: function c(h) {
var g = this,
j = adrma.productData[h] || {};
selectedOptions = {};
container = $(".product-options").find(".options-container");
if (j.configLevels === "1") {
selectedValue = container.find("[data-id].selected").attr("data-value");
selectedOptions = {
selectedValue: selectedValue
}
} else {
selectedValue = container.find("[data-id].selected").attr("data-value");
selectedSize = container.find("[data-value].selected").attr("data-value");
selectedOptions = {
selectedValue: selectedValue,
selectedSize: selectedSize
}
}
return selectedOptions
},
initNotifyInStock: function e(g) {
$.when(adrma.notifyStock ? true : adrma.fetchData({
url: "/sup/js/adrma.notifyStock.js",
dataType: "script"
})).then(function() {
var h = g.attr("data-sku");
adrma.notifyStock.init(h, g)
})
},
initMultipleInStock: function d(g) {
$.when(adrma.multipleNotifyInStock ? true : adrma.fetchData({
url: "/sup/js/adrma.multipleNotifyInStock.js",
dataType: "script"
})).then(function() {
var j = g.attr("data-sku"),
h = adrma.product.findCheckedSkuOptions(j);
options = {
sku: j,
selectedOptions: h
};
adrma.multipleNotifyInStock.init(options, g)
})
},
setStartPrice: function f(g, h) {
if ($("#free-shipping-logo").hasClass("hide") && !g) {
$("#ship-calc-message").removeClass("hide");
return
}
if (!g) {
return
}
$("#ship-calc-message").addClass("hide");
$("#shipStartAt").text(adrma.format.currency(h));
if (h > 0) {
$("#start-ship-price").removeClass("hide");
$("#free-shipping-logo").addClass("hide")
} else {
$("#start-ship-price").addClass("hide");
$("#free-shipping-logo").removeClass("hide")
}
}
};
adrma.actions.add({
addToCart: function(g, h) {
if (adrma.checkDisableCookie()) {
return
}
h.addClass("in-action");
g.stopPropagation();
g.preventDefault();
adrma[adrma.pageInfo.siteId === "AD" ? "atc" : "cart"].addToCart(h).always(function() {
h.removeClass("in-action")
});
return false
},
addToQuote: function a(g, h) {
g.preventDefault();
var j = h.closest("[data-sku]"),
k = j.attr("data-sku");
window.opener.SetChosenProductID(k);
window.close()
},
addToWish: function(g, h) {
var j = h.closest("[data-sku]").attr("data-sku") || "";
if (adrma.session.session.isLoggedIn) {
adrma.notify.add({
html: "<p>We added it to the wish list <a href='#wishlist'>See wishlist</a></p>",
autoClose: false
})
} else {
var k = $("<a href='/static/wishListConfirm.html?sku" + j + "' class='popup' data-popup-class='popupAlert' title='Add to Wish List'></a>");
k.appendTo("body").trigger("click");
k.remove()
}
},
notifyStock: function(g, h) {
isOutOfStock = adrma.product.isMultipleInStock(h);
if (adrma.siteSettings.IsRevisedNotifyMeInStockEnabled && isOutOfStock) {
adrma.product.initMultipleInStock(h)
} else {
adrma.product.initNotifyInStock(h)
}
},
addToCartLoginRequired: function(g, j) {
var l = "https://www.adorama.com/Als.Mvc/nspc/MyAccount?loginMessage=ATCloginRequired&nextpage=%2Fals.mvc%2Fcartview%2Faddtocartexternal%3F",
h = j.closest("form"),
k = h.find("input.itemData.hoverInfo").eq(0),
m = true;
qty = k.val();
if (isNaN(qty) || qty < 1 || qty.indexOf(".") > -1) {
adrma.notify.add({
html: "<p>Please change the quantity to a valid number</p>",
type: "error"
});
k.addClass("error");
m = false
}
if (!m) {
return
}
if (!adrma.session.session.isLoggedIn) {
window.location = l + k.attr("name") + "%3D" + qty;
return
}
adrma.actions.addToCart(g, j)
},
addToPackage: function(h, j) {
var k = this,
l = adrma.decodeURLToJSON(),
g = {
sku: adrma.pageInfo.pageId,
packageCategoryIDs: l.PackageCategoryID,
packageTypeUrlKey: l.PackageTypeUrlKey
};
if (!l.AnyCategory) {
g.anyCategory = true
}
adrma.fetchData({
url: "/api/user/addPackageItem",
data: g,
type: "POST",
dataType: "json"
}).done(function(m) {
if (m.status !== "success") {
adrma.notify.renderApiMessages(m);
return
}
window.location = adrma.siteSettings.Base + l.PackageTypeUrlKey
})
}
})
})();
adrma.router.add({
name: "addToWishList",
callback: function(a) {
a = a ? adrma.router.splitRoute(adrma.router.cleanHash())[1] : adrma.pageInfo.id;
$.when(adrma.session.getSession, adrma.getAsyncData.getData).then(function() {
var b = (adrma.pageInfo.pageType !== "cartPage") ? "miniCart" : "cartPage";
adrma.popup.trigger({
href: "/sup/static/wishListConfirm.html",
title: "Add to wish list",
popupClass: "popupAlert popup-add-to-wishlist",
callback: "initAddToWishlist",
callbackArguments: a + "," + b,
callbackContext: "adrma"
})
})
}
});
adrma.router.add({
name: "pricealert",
callback: function(a) {
a = a ? adrma.router.splitRoute(adrma.router.cleanHash())[1] : adrma.pageInfo.id;
$.when(adrma.session.getSession, adrma.getAsyncData.getData, adrma.init.require([{
name: "adrma.Validate",
resource: "adrma.validate.js"
}])).then(function() {
adrma.popup.trigger({
href: "/sup/views/priceAlertForm.html",
title: "Price Alert",
popupClass: "popup600",
callback: "initPriceAlert",
callbackArguments: a,
callbackContext: "adrma"
})
})
}
});
adrma.router.add({
name: "notifyStock",
callback: function(a) {
a = a ? adrma.router.splitRoute(adrma.router.cleanHash())[1] : adrma.pageInfo.id;
$.when(adrma.session.getSession, adrma.getAsyncData.getData, (adrma.notifyStock ? true : adrma.fetchData({
url: "/sup/js/adrma.notifyStock.js",
dataType: "script"
}))).then(function() {
adrma.notifyStock.init(a, $(".stockNotify"))
})
}
});
adrma.ProductConfig = function() {
if (!this instanceof adrma.ProductConfig) {
return new adrma.ProductConfig()
}
return this
};
adrma.ProductConfig.prototype = {
defaults: {
container: "",
configContainer: ".product-options",
sku: "",
template: "productOptionsTmpl",
mode: "product"
},
init: function(a) {
var c = this,
b = $.Deferred();
$.extend(c, this.defaults, a);
c.bindActions();
c.container = $(c.container);
c.sku = c.sku;
if (!c.container.length) {
return b.resolve()
}
$.when(c.getData(c.sku), adrma.template.get(c.template)).done(function() {
var d = adrma.productData[c.sku];
if (d.type === "regular") {
b.resolve();
return b.resolve()
}
c.rebindAtcAction();
if (d.type === "package") {
return b.resolve()
}
d.config = d.config || {};
d.config.path = d.config.path || [];
c.initRenderOptions();
c.toggleStockMessageToggler();
b.resolve()
});
return b
},
toggleStockMessageToggler: function() {
if (!$(".stock-msg span").length) {
$(".stock-msg a").hide()
}
},
initRenderOptions: function() {
var b = this,
a = adrma.productData[b.sku];
optionSelector = b.container.find(b.configContainer).find(".options-select");
if (!optionSelector.length) {
return
}
b.container.removeClass("config-applied");
b.renderConfigOptions(optionSelector[0].id, a.configurations);
setTimeout(function() {
$.publish("productConfig/initOptionsRendered")
}, 100)
},
configToString: function(f) {
var a = adrma.productData[this.sku].config,
d = a.path,
e = d.length,
g = "",
b = 0,
c;
if (!a) {
return ""
}
for (; b < e; b++) {
g += d[b];
c = b + 1;
if (f && c < e) {
g += f
}
}
return g
},
getConfigData: function(f) {
f = f || this.sku;
var g = adrma.productData[f],
a = g.config,
b = 0,
d = a.path,
e = d.length,
c = g.configurations;
if (g.config.status === true) {
for (; b < e; b++) {
c = c[d[b]]
}
} else {
c = g
}
return c
},
onConfig: function(d, f) {
var q = this;
if (adrma.inProgress === true) {
return
}
adrma.inProgress = true;
setTimeout(function() {
adrma.inProgress = false
}, 1000);
if (d.status) {
$("body").addClass("updating-dom")
}
if ($(".quickViewProduct:visible").length || $(".nestedPopupContent:visible").length) {
this.container = $(".quickViewProduct[data-sku='" + d.sku + "']")
}
var r = adrma.productData[d.sku],
b = r.config;
b.status = d.status;
var m = r.type,
l = d.status,
c = q.getConfigData(),
h = l ? c : r,
n = (function() {
var e = c.prices;
return e.price
})(),
o = (function() {
var e = "";
if (l) {
e = q.configToString(", ") + ":";
if (adrma.pageInfo.pageType === "listPage") {
e = "Your Price: "
}
} else {
e = "Starting at:"
}
return e
})(),
p = (function() {
var e = {},
s = h.prices;
if (s.list) {
e.list = h.prices.list
}
if (s.youSave) {
e.dollar = h.prices.youSave.dollar;
e.percent = h.prices.youSave.percent
}
return e
})(),
k = (function() {
var e;
if (l) {
if (c.imageId) {
e = adrma.query.json(r.images, "id", c.imageId)
}
}
return e || ""
})(),
g = (function() {
var e = h.prices;
return e.saleExp
})(),
a = (function() {
var e;
if (l) {
e = "addToCart"
} else {
if (m === "configurable") {
e = "configAddToCart"
}
}
return e
})(),
j = c.id;
b.id = j;
q.updateAddCartAction(a);
q.updateItemSkuValue(j);
q.updateMfg(h);
q.updateName(c);
q.updatePrice(n);
q.updatePriceLabel(o);
q.updatePriceSavings(p);
q.updateImage(k);
q.updateStock(h);
q.updateStockNotification(h.stock);
q.updateSummary();
q.updateTags(h);
q.updateSaleExpiration(g);
q.updateShippingTag();
q.updateOtherOptionSelects(r, f);
q.updateStickyHeaderSection(c, n, k);
$.publish("product/configured/item", {
skuData: d,
configData: b
});
setTimeout(function() {
$("body").removeClass("updating-dom")
}, 360)
},
updateStickyHeaderSection: function(a, e, c) {
var f = adrma.productData[adrma.pageInfo.pageId];
if (f && f.type !== "package") {
var b = $("#stickyHeaderContainer");
if (b) {
var d = (!a.name) ? a.shortTitle : a.name;
b.find(".nav-title").text(d);
b.find(".price-final").html(adrma.format.currency(e));
if (c) {
b.find(".productImage").attr("src", "/image/Product/large/" + c[0].name)
}
}
}
},
resolveStockName: function(a) {
var b = a.subStatus;
return b ? b.name : a.stock
},
updateAddCartAction: function(a) {},
updateItemSkuValue: function(a) {
if ($(".popup-add-to-wishlist:visible").length) {
return
}
if (a === "config") {
return
}
if (!this.container.find(".product-sku").length) {
var b = $(".main-product-section");
b.find("[data-callback='initPriceAlert']").attr("data-callback-arguments", a);
b.find(".save-item a").attr("data-callback-arguments", a);
b.find(".product-sku span").text(a)
} else {
this.container.find("[data-callback='initPriceAlert']").attr("data-callback-arguments", a);
this.container.find(".save-item a").attr("data-callback-arguments", a);
this.container.find(".product-sku span").text(a)
}
},
updateName: function(a) {
var b = (!a.name) ? a.shortTitle : a.name;
this.container.find(".col1 h1 span").html(b)
},
updateMfg: function(d) {
if ($(".popup-add-to-wishlist:visible").length) {
return
}
var b = this.container.find(".product-sku[itemprop='mpn']");
if (!d.mfgPart) {
b.remove();
return
}
var c = "<i content='" + d.mfgPart + "' itemprop='mpn' class='product-sku'>MFR: <span>" + d.mfgPart + "</span></i>";
if (b.length) {
b.replaceWith(c)
} else {
if (!this.container.find(".product-sku").length) {
var a = $(".main-product-section");
a.find(".product-sku[itemprop='mpn']").remove();
a.find(".product-sku").after(c)
} else {
this.container.find(".product-sku[itemprop='mpn']").remove();
this.container.find(".product-sku").after(c)
}
}
},
updatePrice: function(a) {
this.container.find(".your-price").html(adrma.format.currency(a));
this.container.find(".itemData").not(".component").attr("data-price", a)
},
updatePriceSavings: function(a) {
hasPriceSavings = !$.isEmptyObject(a);
priceListEle = this.container.find(".price-list");
priceYouSaveEle = this.container.find(".price-you-save");
priceListEle.parent().toggleClass("hide", !hasPriceSavings);
priceYouSaveEle.parent().toggleClass("hide", !hasPriceSavings);
if (!hasPriceSavings) {
return
}
priceListEle.html(adrma.format.currency(a.list));
priceYouSaveEle.html(adrma.format.currency(a.dollar) + " (" + a.percent + "%)")
},
updatePriceLabel: function(a) {
this.container.find(".price-label").html(a)
},
updateSaleExpiration: function(a) {
var b = this.container.find(".price-expires").addClass("hide"),
c = this.container.find(".price-list");
if (a) {
if (!b.length) {
b = $("<span class='price-expires'>Exp. <time></time></span>");
b.insertAfter(c)
}
b.removeClass("hide").find("time").text(a)
}
},
updateImage: function(a) {
if (!a) {
return
}
if (adrma.mediaQuery.matches("small", "smallMedium")) {
var b = $(".product-img-container");
adrma.scrollTo(b.find("img[src*='" + a[0].name + "']"), {
dir: "left",
container: b,
offset: 20
});
return
}
var d = a[0].label,
c = a[1],
e = this.container.find(".thumbsContainer img");
if (!e.length) {
return
}
if (e.eq(0).hasClass("thumb-video")) {
c++
}
e.eq(c).trigger({
type: "mouseover",
afterConfig: true
})
},
updateStock: function(b, a) {
var c = adrma.stockFormatter.getStock(b),
a = a || this.container.find(".shipping-stock .stock");
a.attr("class", c.className).text(c.value);
if (!this.container.find(".stock-msg").length) {
a.parent(".save-actions").append("<span class='stock-msg'></span>")
}
this.container.find(".stock-msg").text(c.subStatusMessage)
},
updateStockNotification: function(e) {
var c = this.container.find(".shipping-stock .save-actions"),
d = c.closest("[data-sku]").attr("data-sku"),
g = c.find(".stockNotify"),
f = c.find(".stock-msg"),
b = c.find(".save-item");
if (e !== "Out") {
b.addClass("hide");
return
}
if (!g.length) {
var a = '<span class="save-item"><a href="#" class="action stockNotify" data-action="notifyStock" data-sku="' + d + '"> Notify me when in stock</a>';
if (f.length) {
$(a).insertBefore(f)
} else {
c.append(a)
}
} else {
b.removeClass("hide")
}
},
updateOtherOptionSelects: function(g, b) {
var j = this,
a = g.config,
c = 0,
d = $("[data-sku =" + j.sku + "]").find(".product-options").not(".active"),
h, f;
if (a && a.status) {
f = a.path;
d.each(function(l, k) {
h = $(k).find(".options-select");
for (; l < f.length; l++) {
adrma.selectUi.set(h.eq(l), f[l], l == (f.length - 1) ? true : false)
}
})
}
},
updateSummary: function() {},
updateTags: function(c) {
var a = this.container.find(".primary-info");
a.find(".item-tag").remove();
if (c.badge) {
var b = tmpl("itemTagTmpl", {
tagType: c.badge.link,
tagLabel: c.badge.text
});
a.find(".item-tag-price").append(b)
}
},
updateShippingTag: function() {},
applyPackageConfigs: function() {
var j = this,
c = j.getConfigData(),
h, a, g = adrma.productData[this.sku],
f = $(".package").find(".package-item[data-sku='" + j.sku + "']"),
e = adrma.query.json(g.images, "id", c.imageId);
if (e) {
img = f.find(".productImage").attr("src", "/image/Product/Medium/" + e[0].name)
}
var b = f.find(".selectSummary, .button").hide(),
d = b.attr("href");
f.find(".pkg-details").append("<p class='selectSummary'><strong>" + adrma.format.capitalize(j.configToString(", ")) + "</strong> <a href='" + d + "' data-popup-class='quickView quickViewPkg viewConfigureApply' title='Update selection' class='popup'>Edit</a>");
j.updateStock(c, (f.find(".shipping-stock .stock")));
f.attr("data-requires-config", false).removeClass("error");
f.find("input.itemData")[0].name = c.id;
h = this.container.closest(".buy-section.package").find(".package-item[data-requires-config = 'true']");
a = f.closest(".product").find(".add-to-cart");
if (!h.length) {
a.removeClass("disabled")
} else {
a.addClass("disabled")
}
},
updateConfigError: function updateConfigError(c, h) {
h = h || this.sku;
c = c || this.container;
var g = this,
b = adrma.productData[h].config.path;
var f = c.find(".product-options"),
e = f.find(".options-container"),
a = b.length,
d;
e.filter(function(k, j) {
d = a === 1 ? 0 : a - 1;
return k > d
}).addClass("error")
},
validateConfiguration: function validateConfiguration(b) {
var f = this,
c = true,
a = adrma.productData[f.sku].config.path || [],
e = b.find(".product-options"),
d = e.find(".options-container > .options-select:visible"),
g = [];
d.each(function(j, h) {
if ($(h).attr("data-value")) {
g.push(a[j])
} else {
c = false;
return false
}
});
adrma.productData[f.sku].config.path = g;
return c
},
rebindAtcAction: function() {
var d = adrma.productData[this.sku],
e = d.type,
a = this.container.find(".add-to-cart"),
c, b;
if (e === "configurable") {
return
}
if (e === "package") {
c = this.container.find(".package-item[data-requires-config = 'true']");
if (c.length) {
a.attr("data-action", "packageAddToCart").addClass("disabled")
}
}
},
bindActions: function() {
var a = this;
$.subscribe("product/configured/" + a.sku, function(c, b) {
a.onConfig(b, c)
});
$.subscribe("productConfig/initOptionsRendered", function() {
a.triggerSingleEnabledOptions()
});
$.subscribe("configAddedToCart", function() {
if (!$(".viewConfigureATC").length) {
a.triggerSingleEnabledOptions()
}
})
},
getData: function(b) {
var c = this,
a = $.Deferred();
if (adrma.productData[b]) {
return a.resolve(adrma.productData[b])
} else {
return adrma.fetchData({
url: "/API/productData",
data: {
sku: c.sku
},
dataType: "json"
}).done(function() {})
}
},
renderConfigOptions: function(e, a) {
var f = this;
prodSku = $("#" + e).closest("[data-sku]").attr("data-sku");
a = adrma.renameObjKeys(a, function(h) {
return h.replace(/"/mg, "\u201F\u000A")
});
f.container.find(".large-img .productImage").attr("src", adrma.siteSettings.Base + "Image/Product/Large/" + adrma.productData[prodSku].images[0].name);
function g() {
$.each(a, function(k, j) {
if (!j.id) {
var h = 0;
var l = 0;
$.each(j, function(n, m) {
if (typeof m === "object") {
l++
}
if (m.stock === "Discontinued") {
h++
}
});
if (h > 0 && h === l) {
a[k].stock = "Discontinued"
}
}
})
}
delete a.index;
g();
var f = this,
c = $(".package").find(".package-item[data-sku='" + f.sku + "']"),
b = c.attr("data-requires-config"),
d = f.container.find("#" + e).find(".select-ui-options ul").html(tmpl(f.template, {
data: adrma.getSortedArrayFromObj(a)
})).find("[data-imageid]").off(".updateImage").on("mouseenter.updateImage", function(h) {
if (adrma.mediaQuery.matches("small", "smallMedium")) {
return
}
var l = $(this),
j = l.attr("data-imageid"),
m = l.closest("[data-sku]"),
n = m.attr("data-sku"),
k = adrma.query.json(adrma.productData[n].images, "id", j);
k = k ? k[0].name : adrma.siteSettings.DefaultNoPicImageName;
if (k) {
m.find(".large-img .productImage").attr("src", "/image/Product/large/" + k)
}
});
if (c.length && b === "false" && !f.container.hasClass("config-applied")) {
f.setAlreadyConfiguredForPackage(e, a, c)
}
return d
},
setAlreadyConfiguredForPackage: function setAlreadyConfiguredForPackage(g, a, d) {
var h = this,
c = d.find("input.itemData")[0].name;
function b() {
for (var l in a) {
var j = a[l];
if (a.hasOwnProperty(l) && j.id) {
if (j.id === c) {
return e = {
value: l,
level: 1
};
return
}
} else {
for (var k in j) {
var m = j[k];
if (j.hasOwnProperty(k) && m.id) {
if (m.id === c) {
return e = {
value: l,
level: 2
};
return
}
}
}
}
}
}
var e = b();
var f = h.container.find("#" + g);
if (e) {
if (e.level == 1) {
h.container.addClass("config-applied")
}
adrma.selectUi.onChange.apply(this, [{
optionEle: f.find("li[data-value='" + e.value + "']"),
selectEle: f
}])
}
},
markActive: function(b) {
var a = b.closest(".product-options");
a.addClass("active");
setTimeout(function() {
a.removeClass("active")
}, 1000)
},
resolveConfigSku: function resolveConfigSku(b) {
if (!b) {
return
}
var a = adrma.productData[b];
if (a && a.type && (a.type === "configurable") && a.config && a.config.id) {
b = a.config.id
}
return b
},
resetProductConfig: function resetProductConfig(c, a) {
var b = a.closest("form").find(".select-ui");
b.each(function() {
var d = $(this);
adrma.selectUi.reset(d)
});
adrma.productData[c].config = {
path: []
}
},
triggerSingleEnabledOptions: function triggerSingleEnabledOptions() {
if ($(".viewItemDescription").length) {
return
}
var d = this,
c = $(d.configContainer).find(".select-ui");
for (var b = 0; b < c.length; b++) {
var a = c.eq(b).find("li:not(.initial-select, .disabled)");
if (a.length === 1) {
if (adrma.inProgress === true) {
adrma.inProgress = false
}
adrma.selectUi.set(a.closest(".select-ui"), a.attr("data-value"), false)
} else {
if (!$(".popup-add-to-wishlist").length) {
return
} else {
return
}
}
}
}
};
adrma.actions.add({
configAddToCart: function(c, f) {
var d;
c.preventDefault();
if (adrma.checkDisableCookie()) {
return
}
f = f.closest("form"), d = f.add(".configAddToCart");
c.configEleCollection = d;
if (d.hasClass("in-action")) {
return false
}
var g = f.closest("[data-sku]"),
j = g.attr("data-sku"),
h = adrma.productData[j],
a = h.config,
b = adrma.productData[j].configObj;
if (h.configLabels.length) {
if (b.validateConfiguration(g) && a && a.status) {
adrma.actions.toggleInAction(d, "add");
adrma.cart.addToCart(f, c).done(function() {
adrma.ProductConfig.prototype.resetProductConfig(j, f);
$.publish("configAddedToCart")
}).fail(function() {
adrma.actions.toggleInAction(d, "remove")
});
return false
} else {
b.updateConfigError(g, j)
}
} else {
adrma.actions.toggleInAction(d, "add");
adrma.cart.addToCart(f, c).done(function() {
adrma.ProductConfig.prototype.resetProductConfig(j, f)
}).fail(function() {
adrma.actions.toggleInAction(d, "remove")
})
}
},
packageAddToCart: function(c, d) {
c.preventDefault();
if (adrma.checkDisableCookie()) {
return
}
d = d.closest("form");
var f = d.closest("[data-sku]"),
h = f.attr("data-sku"),
g = adrma.productData[h],
a = g.config,
b = adrma.productData[h].configObj,
j = true;
if (g.configLabels && g.configLabels.length) {
if (!a.status) {
b.updateConfigError();
return false
}
}
if (!g.components) {
return false
}
$.each(g.components, function(m, l) {
var k = adrma.productData[l.id];
if ((k.type === "configurable" && k.allConfigurationsCount && k.allConfigurationsCount > 1) && (!k.config || !k.config.status || !k.config.isApplied)) {
j = false;
d.find("[data-sku = " + l.id + "]").addClass("error")
}
});
if (!j) {
return false
}
adrma.cart.addToCart(d, c)
},
productConfigure1: function(f, g, o) {
o = o.replace(/\u201F\u000A/mg, '"');
var k = adrma.ProductConfig.prototype,
m = g.closest(".select-ui"),
h = m.attr("data-linked-select-id"),
j = h ? m.closest(".product-options").find("#" + h) : "",
n = g.closest("[data-sku]").attr("data-sku"),
l = adrma.productData[n],
a = l.configObj,
b = adrma.productData[n].config.path,
c = b.slice(0),
d = true;
k.markActive(g);
b = [];
b.push(o);
adrma.productData[n].config.path = b;
if (j.length) {
adrma.selectUi.reset(j, "silent");
if (!o) {
b.pop();
j.addClass("disabled")
} else {
a.container = g.closest(".product-options").parent();
a.renderConfigOptions(h, l.configurations[o]);
m.closest(".options-container").removeClass("error");
j.removeClass("disabled")
}
if (!d) {
return
}
$.publish("product/configured/" + n, {
sku: n,
status: false
})
} else {
if (!o) {
b.pop();
$.publish("product/configured/" + n, {
sku: n,
status: false
})
} else {
m.closest(".options-container").removeClass("error");
$.publish("product/configured/" + n, {
sku: n,
status: true
})
}
}
if (o) {
m.closest(".options-container").removeClass("error")
}
},
productConfigure2: function(f, g, m) {
m = m.replace(/\u201F\u000A/mg, '"');
var h = adrma.ProductConfig.prototype,
k = g.closest(".select-ui"),
l = g.closest("[data-sku]").attr("data-sku"),
j = adrma.productData[l],
a = j.configObj,
b = adrma.productData[l].config.path,
c = b.slice(0),
d = true;
a.container = g.closest("[data-sku]");
h.markActive(g);
if (m) {
j.config.path[1] = m;
$.publish("product/configured/" + l, {
sku: l,
status: true
});
k.closest(".options-container").removeClass("error")
} else {
if (j.config.path.length > 1) {
adrma.productData[l].config.path.pop()
}
$.publish("product/configured/" + l, {
sku: l,
status: false
})
}
}
});
$.fn.equalHeights = function(f) {
var a = arguments,
e = false,
b, c = 0,
d = $(this);
f = f || {};
f.addAmmount = f.addAmmount || 0;
if (f.child) {
e = true;
b = f.child
}
if (f.addAmmount) {
addAmmount = f.addAmmount
}
d.each(function(m, j) {
if (e) {
var k = $(j),
g = k.find(b),
h = g.outerHeight() + f.addAmmount;
if (h > c) {
c = h
}
} else {
var k = $(j),
l = k.outerHeight() + f.addAmmount;
if (l > c) {
c = l
}
}
});
d.each(function() {
if (e) {
$(this).find(b).css({
"min-height": c
})
} else {
$(this).css({
"min-height": c
})
}
});
return this
}; /* jQuery UI - v1.10.3 - 2013-06-11 * http://jqueryui.com * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.slider.js * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
(function(c, h) {
function d(p, j) {
var e, k, m, l = p.nodeName.toLowerCase();
return "area" === l ? (e = p.parentNode, k = e.name, p.href && k && "map" === e.nodeName.toLowerCase() ? (m = c("img[usemap=#" + k + "]")[0], !!m && g(m)) : !1) : (/input|select|textarea|button|object/.test(l) ? !p.disabled : "a" === l ? p.href || j : j) && g(p)
}
function g(a) {
return c.expr.filters.visible(a) && !c(a).parents().addBack().filter(function() {
return "hidden" === c.css(this, "visibility")
}).length
}
var b = 0,
f = /^ui-id-\d+$/;
c.ui = c.ui || {}, c.extend(c.ui, {
version: "1.10.3",
keyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
}
}), c.fn.extend({
focus: function(a) {
return function(e, j) {
return "number" == typeof e ? this.each(function() {
var k = this;
setTimeout(function() {
c(k).focus(), j && j.call(k)
}, e)
}) : a.apply(this, arguments)
}
}(c.fn.focus),
scrollParent: function() {
var a;
return a = c.ui.ie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? this.parents().filter(function() {
return /(relative|absolute|fixed)/.test(c.css(this, "position")) && /(auto|scroll)/.test(c.css(this, "overflow") + c.css(this, "overflow-y") + c.css(this, "overflow-x"))
}).eq(0) : this.parents().filter(function() {
return /(auto|scroll)/.test(c.css(this, "overflow") + c.css(this, "overflow-y") + c.css(this, "overflow-x"))
}).eq(0), /fixed/.test(this.css("position")) || !a.length ? c(document) : a
},
zIndex: function(j) {
if (j !== h) {
return this.css("zIndex", j)
}
if (this.length) {
for (var l, e, k = c(this[0]); k.length && k[0] !== document;) {
if (l = k.css("position"), ("absolute" === l || "relative" === l || "fixed" === l) && (e = parseInt(k.css("zIndex"), 10), !isNaN(e) && 0 !== e)) {
return e
}
k = k.parent()
}
}
return 0
},
uniqueId: function() {
return this.each(function() {
this.id || (this.id = "ui-id-" + ++b)
})
},
removeUniqueId: function() {
return this.each(function() {
f.test(this.id) && c(this).removeAttr("id")
})
}
}), c.extend(c.expr[":"], {
data: c.expr.createPseudo ? c.expr.createPseudo(function(a) {
return function(e) {
return !!c.data(e, a)
}
}) : function(j, a, e) {
return !!c.data(j, e[3])
},
focusable: function(a) {
return d(a, !isNaN(c.attr(a, "tabindex")))
},
tabbable: function(k) {
var j = c.attr(k, "tabindex"),
e = isNaN(j);
return (e || j >= 0) && d(k, !e)
}
}), c("<a>").outerWidth(1).jquery || c.each(["Width", "Height"], function(j, p) {
function e(r, o, q, n) {
return c.each(k, function() {
o -= parseFloat(c.css(r, "padding" + this)) || 0, q && (o -= parseFloat(c.css(r, "border" + this + "Width")) || 0), n && (o -= parseFloat(c.css(r, "margin" + this)) || 0)
}), o
}
var k = "Width" === p ? ["Left", "Right"] : ["Top", "Bottom"],
m = p.toLowerCase(),
l = {
innerWidth: c.fn.innerWidth,
innerHeight: c.fn.innerHeight,
outerWidth: c.fn.outerWidth,
outerHeight: c.fn.outerHeight
};
c.fn["inner" + p] = function(a) {
return a === h ? l["inner" + p].call(this) : this.each(function() {
c(this).css(m, e(this, a) + "px")
})
}, c.fn["outer" + p] = function(n, a) {
return "number" != typeof n ? l["outer" + p].call(this, n) : this.each(function() {
c(this).css(m, e(this, n, !0, a) + "px")
})
}
}), c.fn.addBack || (c.fn.addBack = function(a) {
return this.add(null == a ? this.prevObject : this.prevObject.filter(a))
}), c("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (c.fn.removeData = function(a) {
return function(e) {
return arguments.length ? a.call(this, c.camelCase(e)) : a.call(this)
}
}(c.fn.removeData)), c.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), c.support.selectstart = "onselectstart" in document.createElement("div"), c.fn.extend({
disableSelection: function() {
return this.bind((c.support.selectstart ? "selectstart" : "mousedown") + ".ui-disableSelection", function(a) {
a.preventDefault()
})
},
enableSelection: function() {
return this.unbind(".ui-disableSelection")
}
}), c.extend(c.ui, {
plugin: {
add: function(m, j, l) {
var e, k = c.ui[m].prototype;
for (e in l) {
k.plugins[e] = k.plugins[e] || [], k.plugins[e].push([j, l[e]])
}
},
call: function(k, n, l) {
var m, j = k.plugins[n];
if (j && k.element[0].parentNode && 11 !== k.element[0].parentNode.nodeType) {
for (m = 0; j.length > m; m++) {
k.options[j[m][0]] && j[m][1].apply(k.element, l)
}
}
}
},
hasScroll: function(l, j) {
if ("hidden" === c(l).css("overflow")) {
return !1
}
var k = j && "left" === j ? "scrollLeft" : "scrollTop",
e = !1;
return l[k] > 0 ? !0 : (l[k] = 1, e = l[k] > 0, l[k] = 0, e)
}
})
})(jQuery);
(function(a, f) {
var b = 0,
d = Array.prototype.slice,
c = a.cleanData;
a.cleanData = function(j) {
for (var g, h = 0; null != (g = j[h]); h++) {
try {
a(g).triggerHandler("remove")
} catch (e) {}
}
c(j)
}, a.widget = function(j, t, m) {
var e, q, p, g, k = {},
v = j.split(".")[0];
j = j.split(".")[1], e = v + "-" + j, m || (m = t, t = a.Widget), a.expr[":"][e.toLowerCase()] = function(h) {
return !!a.data(h, e)
}, a[v] = a[v] || {}, q = a[v][j], p = a[v][j] = function(h, l) {
return this._createWidget ? (arguments.length && this._createWidget(h, l), f) : new p(h, l)
}, a.extend(p, q, {
version: m.version,
_proto: a.extend({}, m),
_childConstructors: []
}), g = new t, g.options = a.widget.extend({}, g.options), a.each(m, function(h, l) {
return a.isFunction(l) ? (k[h] = function() {
var n = function() {
return t.prototype[h].apply(this, arguments)
},
o = function(r) {
return t.prototype[h].apply(this, r)
};
return function() {
var u, w = this._super,
r = this._superApply;
return this._super = n, this._superApply = o, u = l.apply(this, arguments), this._super = w, this._superApply = r, u
}
}(), f) : (k[h] = l, f)
}), p.prototype = a.widget.extend(g, {
widgetEventPrefix: q ? g.widgetEventPrefix : j
}, k, {
constructor: p,
namespace: v,
widgetName: j,
widgetFullName: e
}), q ? (a.each(q._childConstructors, function(n, h) {
var l = h.prototype;
a.widget(l.namespace + "." + l.widgetName, p, h._proto)
}), delete q._childConstructors) : t._childConstructors.push(p), a.widget.bridge(j, p)
}, a.widget.extend = function(j) {
for (var k, e, m = d.call(arguments, 1), l = 0, g = m.length; g > l; l++) {
for (k in m[l]) {
e = m[l][k], m[l].hasOwnProperty(k) && e !== f && (j[k] = a.isPlainObject(e) ? a.isPlainObject(j[k]) ? a.widget.extend({}, j[k], e) : a.widget.extend({}, e) : e)
}
}
return j
}, a.widget.bridge = function(g, h) {
var e = h.prototype.widgetFullName || g;
a.fn[g] = function(n) {
var m = "string" == typeof n,
j = d.call(arguments, 1),
k = this;
return n = !m && j.length ? a.widget.extend.apply(null, [n].concat(j)) : n, m ? this.each(function() {
var o, l = a.data(this, e);
return l ? a.isFunction(l[n]) && "_" !== n.charAt(0) ? (o = l[n].apply(l, j), o !== l && o !== f ? (k = o && o.jquery ? k.pushStack(o.get()) : o, !1) : f) : a.error("no such method '" + n + "' for " + g + " widget instance") : a.error("cannot call methods on " + g + " prior to initialization; attempted to call method '" + n + "'")
}) : this.each(function() {
var l = a.data(this, e);
l ? l.option(n || {})._init() : a.data(this, e, new h(n, this))
}), k
}
}, a.Widget = function() {}, a.Widget._childConstructors = [], a.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: !1,
create: null
},
_createWidget: function(g, e) {
e = a(e || this.defaultElement || this)[0], this.element = a(e), this.uuid = b++, this.eventNamespace = "." + this.widgetName + this.uuid, this.options = a.widget.extend({}, this.options, this._getCreateOptions(), g), this.bindings = a(), this.hoverable = a(), this.focusable = a(), e !== this && (a.data(e, this.widgetFullName, this), this._on(!0, this.element, {
remove: function(h) {
h.target === e && this.destroy()
}
}), this.document = a(e.style ? e.ownerDocument : e.document || e), this.window = a(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger("create", null, this._getCreateEventData()), this._init()
},
_getCreateOptions: a.noop,
_getCreateEventData: a.noop,
_create: a.noop,
_init: a.noop,
destroy: function() {
this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName + "-disabled ui-state-disabled"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus")
},
_destroy: a.noop,
widget: function() {
return this.element
},
option: function(g, l) {
var h, e, k, j = g;
if (0 === arguments.length) {
return a.widget.extend({}, this.options)
}
if ("string" == typeof g) {
if (j = {}, h = g.split("."), g = h.shift(), h.length) {
for (e = j[g] = a.widget.extend({}, this.options[g]), k = 0; h.length - 1 > k; k++) {
e[h[k]] = e[h[k]] || {}, e = e[h[k]]
}
if (g = h.pop(), l === f) {
return e[g] === f ? null : e[g]
}
e[g] = l
} else {
if (l === f) {
return this.options[g] === f ? null : this.options[g]
}
j[g] = l
}
}
return this._setOptions(j), this
},
_setOptions: function(g) {
var h;
for (h in g) {
this._setOption(h, g[h])
}
return this
},
_setOption: function(g, h) {
return this.options[g] = h, "disabled" === g && (this.widget().toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !!h).attr("aria-disabled", h), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus")), this
},
enable: function() {
return this._setOption("disabled", !1)
},
disable: function() {
return this._setOption("disabled", !0)
},
_on: function(g, k, h) {
var e, j = this;
"boolean" != typeof g && (h = k, k = g, g = !1), h ? (k = e = a(k), this.bindings = this.bindings.add(k)) : (h = k, k = this.element, e = this.widget()), a.each(h, function(r, s) {
function p() {
return g || j.options.disabled !== !0 && !a(this).hasClass("ui-state-disabled") ? ("string" == typeof s ? j[s] : s).apply(j, arguments) : f
}
"string" != typeof s && (p.guid = s.guid = s.guid || p.guid || a.guid++);
var q = r.match(/^(\w+)\s*(.*)$/),
t = q[1] + j.eventNamespace,
m = q[2];
m ? e.delegate(m, t, p) : k.bind(t, p)
})
},
_off: function(g, h) {
h = (h || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace, g.unbind(h).undelegate(h)
},
_delay: function(g, k) {
function h() {
return ("string" == typeof g ? j[g] : g).apply(j, arguments)
}
var j = this;
return setTimeout(h, k || 0)
},
_hoverable: function(e) {
this.hoverable = this.hoverable.add(e), this._on(e, {
mouseenter: function(g) {
a(g.currentTarget).addClass("ui-state-hover")
},
mouseleave: function(g) {
a(g.currentTarget).removeClass("ui-state-hover")
}
})
},
_focusable: function(e) {
this.focusable = this.focusable.add(e), this._on(e, {
focusin: function(g) {
a(g.currentTarget).addClass("ui-state-focus")
},
focusout: function(g) {
a(g.currentTarget).removeClass("ui-state-focus")
}
})
},
_trigger: function(l, g, k) {
var h, e, j = this.options[l];
if (k = k || {}, g = a.Event(g), g.type = (l === this.widgetEventPrefix ? l : this.widgetEventPrefix + l).toLowerCase(), g.target = this.element[0], e = g.originalEvent) {
for (h in e) {
h in g || (g[h] = e[h])
}
}
return this.element.trigger(g, k), !(a.isFunction(j) && j.apply(this.element[0], [g].concat(k)) === !1 || g.isDefaultPrevented())
}
}, a.each({
show: "fadeIn",
hide: "fadeOut"
}, function(g, e) {
a.Widget.prototype["_" + g] = function(m, j, h) {
"string" == typeof j && (j = {
effect: j
});
var l, k = j ? j === !0 || "number" == typeof j ? e : j.effect || e : g;
j = j || {}, "number" == typeof j && (j = {
duration: j
}), l = !a.isEmptyObject(j), j.complete = h, j.delay && m.delay(j.delay), l && a.effects && a.effects.effect[k] ? m[g](j) : k !== g && m[k] ? m[k](j.duration, j.easing, h) : m.queue(function(n) {
a(this)[g](), h && h.call(m[0]), n()
})
}
})
})(jQuery);
(function(a) {
var b = !1;
a(document).mouseup(function() {
b = !1
}), a.widget("ui.mouse", {
version: "1.10.3",
options: {
cancel: "input,textarea,button,select,option",
distance: 1,
delay: 0
},
_mouseInit: function() {
var c = this;
this.element.bind("mousedown." + this.widgetName, function(d) {
return c._mouseDown(d)
}).bind("click." + this.widgetName, function(d) {
return !0 === a.data(d.target, c.widgetName + ".preventClickEvent") ? (a.removeData(d.target, c.widgetName + ".preventClickEvent"), d.stopImmediatePropagation(), !1) : undefined
}), this.started = !1
},
_mouseDestroy: function() {
this.element.unbind("." + this.widgetName), this._mouseMoveDelegate && a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate)
},
_mouseDown: function(d) {
if (!b) {
this._mouseStarted && this._mouseUp(d), this._mouseDownEvent = d;
var f = this,
e = 1 === d.which,
c = "string" == typeof this.options.cancel && d.target.nodeName ? a(d.target).closest(this.options.cancel).length : !1;
return e && !c && this._mouseCapture(d) ? (this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function() {
f.mouseDelayMet = !0
}, this.options.delay)), this._mouseDistanceMet(d) && this._mouseDelayMet(d) && (this._mouseStarted = this._mouseStart(d) !== !1, !this._mouseStarted) ? (d.preventDefault(), !0) : (!0 === a.data(d.target, this.widgetName + ".preventClickEvent") && a.removeData(d.target, this.widgetName + ".preventClickEvent"), this._mouseMoveDelegate = function(g) {
return f._mouseMove(g)
}, this._mouseUpDelegate = function(g) {
return f._mouseUp(g)
}, a(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate), d.preventDefault(), b = !0, !0)) : !0
}
},
_mouseMove: function(c) {
return a.ui.ie && (!document.documentMode || 9 > document.documentMode) && !c.button ? this._mouseUp(c) : this._mouseStarted ? (this._mouseDrag(c), c.preventDefault()) : (this._mouseDistanceMet(c) && this._mouseDelayMet(c) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, c) !== !1, this._mouseStarted ? this._mouseDrag(c) : this._mouseUp(c)), !this._mouseStarted)
},
_mouseUp: function(c) {
return a(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, c.target === this._mouseDownEvent.target && a.data(c.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(c)), !1
},
_mouseDistanceMet: function(c) {
return Math.max(Math.abs(this._mouseDownEvent.pageX - c.pageX), Math.abs(this._mouseDownEvent.pageY - c.pageY)) >= this.options.distance
},
_mouseDelayMet: function() {
return this.mouseDelayMet
},
_mouseStart: function() {},
_mouseDrag: function() {},
_mouseStop: function() {},
_mouseCapture: function() {
return !0
}
})
})(jQuery);
(function(b) {
var a = 5;
b.widget("ui.slider", b.ui.mouse, {
version: "1.10.3",
widgetEventPrefix: "slide",
options: {
animate: !1,
distance: 0,
max: 100,
min: 0,
orientation: "horizontal",
range: !1,
step: 1,
value: 0,
values: null,
change: null,
slide: null,
start: null,
stop: null
},
_create: function() {
this._keySliding = !1, this._mouseSliding = !1, this._animateOff = !0, this._handleIndex = null, this._detectOrientation(), this._mouseInit(), this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget ui-widget-content ui-corner-all"), this._refresh(), this._setOption("disabled", this.options.disabled), this._animateOff = !1
},
_refresh: function() {
this._createRange(), this._createHandles(), this._setupEvents(), this._refreshValue()
},
_createHandles: function() {
var d, f, j = this.options,
g = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),
c = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
h = [];
for (f = j.values && j.values.length || 1, g.length > f && (g.slice(f).remove(), g = g.slice(0, f)), d = g.length; f > d; d++) {
h.push(c)
}
this.handles = g.add(b(h.join("")).appendTo(this.element)), this.handle = this.handles.eq(0), this.handles.each(function(k) {
b(this).data("ui-slider-handle-index", k)
})
},
_createRange: function() {
var c = this.options,
d = "";
c.range ? (c.range === !0 && (c.values ? c.values.length && 2 !== c.values.length ? c.values = [c.values[0], c.values[0]] : b.isArray(c.values) && (c.values = c.values.slice(0)) : c.values = [this._valueMin(), this._valueMin()]), this.range && this.range.length ? this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({
left: "",
bottom: ""
}) : (this.range = b("<div></div>").appendTo(this.element), d = "ui-slider-range ui-widget-header ui-corner-all"), this.range.addClass(d + ("min" === c.range || "max" === c.range ? " ui-slider-range-" + c.range : ""))) : this.range = b([])
},
_setupEvents: function() {
var c = this.handles.add(this.range).filter("a");
this._off(c), this._on(c, this._handleEvents), this._hoverable(c), this._focusable(c)
},
_destroy: function() {
this.handles.remove(), this.range.remove(), this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"), this._mouseDestroy()
},
_mouseCapture: function(g) {
var k, v, p, d, q, t, j, m, w = this,
f = this.options;
return f.disabled ? !1 : (this.elementSize = {
width: this.element.outerWidth(),
height: this.element.outerHeight()
}, this.elementOffset = this.element.offset(), k = {
x: g.pageX,
y: g.pageY
}, v = this._normValueFromMouse(k), p = this._valueMax() - this._valueMin() + 1, this.handles.each(function(c) {
var h = Math.abs(v - w.values(c));
(p > h || p === h && (c === w._lastChangedValue || w.values(c) === f.min)) && (p = h, d = b(this), q = c)
}), t = this._start(g, q), t === !1 ? !1 : (this._mouseSliding = !0, this._handleIndex = q, d.addClass("ui-state-active").focus(), j = d.offset(), m = !b(g.target).parents().addBack().is(".ui-slider-handle"), this._clickOffset = m ? {
left: 0,
top: 0
} : {
left: g.pageX - j.left - d.width() / 2,
top: g.pageY - j.top - d.height() / 2 - (parseInt(d.css("borderTopWidth"), 10) || 0) - (parseInt(d.css("borderBottomWidth"), 10) || 0) + (parseInt(d.css("marginTop"), 10) || 0)
}, this.handles.hasClass("ui-state-hover") || this._slide(g, q, v), this._animateOff = !0, !0))
},
_mouseStart: function() {
return !0
},
_mouseDrag: function(f) {
var c = {
x: f.pageX,
y: f.pageY
},
d = this._normValueFromMouse(c);
return this._slide(f, this._handleIndex, d), !1
},
_mouseStop: function(c) {
return this.handles.removeClass("ui-state-active"), this._mouseSliding = !1, this._stop(c, this._handleIndex), this._change(c, this._handleIndex), this._handleIndex = null, this._clickOffset = null, this._animateOff = !1, !1
},
_detectOrientation: function() {
this.orientation = "vertical" === this.options.orientation ? "vertical" : "horizontal"
},
_normValueFromMouse: function(j) {
var d, f, h, g, c;
return "horizontal" === this.orientation ? (d = this.elementSize.width, f = j.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0)) : (d = this.elementSize.height, f = j.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)), h = f / d, h > 1 && (h = 1), 0 > h && (h = 0), "vertical" === this.orientation && (h = 1 - h), g = this._valueMax() - this._valueMin(), c = this._valueMin() + h * g, this._trimAlignValue(c)
},
_start: function(f, c) {
var d = {
handle: this.handles[c],
value: this.value()
};
return this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()), this._trigger("start", f, d)
},
_slide: function(j, d, f) {
var h, g, c;
this.options.values && this.options.values.length ? (h = this.values(d ? 0 : 1), 2 === this.options.values.length && this.options.range === !0 && (0 === d && f > h || 1 === d && h > f) && (f = h), f !== this.values(d) && (g = this.values(), g[d] = f, c = this._trigger("slide", j, {
handle: this.handles[d],
value: f,
values: g
}), h = this.values(d ? 0 : 1), c !== !1 && this.values(d, f, !0))) : f !== this.value() && (c = this._trigger("slide", j, {
handle: this.handles[d],
value: f
}), c !== !1 && this.value(f))
},
_stop: function(f, c) {
var d = {
handle: this.handles[c],
value: this.value()
};
this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()), this._trigger("stop", f, d)
},
_change: function(f, c) {
if (!this._keySliding && !this._mouseSliding) {
var d = {
handle: this.handles[c],
value: this.value()
};
this.options.values && this.options.values.length && (d.value = this.values(c), d.values = this.values()), this._lastChangedValue = c, this._trigger("change", f, d)
}
},
value: function(c) {
return arguments.length ? (this.options.value = this._trimAlignValue(c), this._refreshValue(), this._change(null, 0), undefined) : this._value()
},
values: function(d, f) {
var h, g, c;
if (arguments.length > 1) {
return this.options.values[d] = this._trimAlignValue(f), this._refreshValue(), this._change(null, d), undefined
}
if (!arguments.length) {
return this._values()
}
if (!b.isArray(arguments[0])) {
return this.options.values && this.options.values.length ? this._values(d) : this.value()
}
for (h = this.options.values, g = arguments[0], c = 0; h.length > c; c += 1) {
h[c] = this._trimAlignValue(g[c]), this._change(null, c)
}
this._refreshValue()
},
_setOption: function(c, d) {
var g, f = 0;
switch ("range" === c && this.options.range === !0 && ("min" === d ? (this.options.value = this._values(0), this.options.values = null) : "max" === d && (this.options.value = this._values(this.options.values.length - 1), this.options.values = null)), b.isArray(this.options.values) && (f = this.options.values.length), b.Widget.prototype._setOption.apply(this, arguments), c) {
case "orientation":
this._detectOrientation(), this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation), this._refreshValue();
break;
case "value":
this._animateOff = !0, this._refreshValue(), this._change(null, 0), this._animateOff = !1;
break;
case "values":
for (this._animateOff = !0, this._refreshValue(), g = 0; f > g; g += 1) {
this._change(null, g)
}
this._animateOff = !1;
break;
case "min":
case "max":
this._animateOff = !0, this._refreshValue(), this._animateOff = !1;
break;
case "range":
this._animateOff = !0, this._refresh(), this._animateOff = !1
}
},
_value: function() {
var c = this.options.value;
return c = this._trimAlignValue(c)
},
_values: function(g) {
var c, d, f;
if (arguments.length) {
return c = this.options.values[g], c = this._trimAlignValue(c)
}
if (this.options.values && this.options.values.length) {
for (d = this.options.values.slice(), f = 0; d.length > f; f += 1) {
d[f] = this._trimAlignValue(d[f])
}
return d
}
return []
},
_trimAlignValue: function(g) {
if (this._valueMin() >= g) {
return this._valueMin()
}
if (g >= this._valueMax()) {
return this._valueMax()
}
var c = this.options.step > 0 ? this.options.step : 1,
d = (g - this._valueMin()) % c,
f = g - d;
return 2 * Math.abs(d) >= c && (f += d > 0 ? c : -c), parseFloat(f.toFixed(5))
},
_valueMin: function() {
return this.options.min
},
_valueMax: function() {
return this.options.max
},
_refreshValue: function() {
var d, g, q, k, c, m = this.options.range,
p = this.options,
f = this,
j = this._animateOff ? !1 : p.animate,
t = {};
this.options.values && this.options.values.length ? this.handles.each(function(e) {
g = 100 * ((f.values(e) - f._valueMin()) / (f._valueMax() - f._valueMin())), t["horizontal" === f.orientation ? "left" : "bottom"] = g + "%", b(this).stop(1, 1)[j ? "animate" : "css"](t, p.animate), f.options.range === !0 && ("horizontal" === f.orientation ? (0 === e && f.range.stop(1, 1)[j ? "animate" : "css"]({
left: g + "%"
}, p.animate), 1 === e && f.range[j ? "animate" : "css"]({
width: g - d + "%"
}, {
queue: !1,
duration: p.animate
})) : (0 === e && f.range.stop(1, 1)[j ? "animate" : "css"]({
bottom: g + "%"
}, p.animate), 1 === e && f.range[j ? "animate" : "css"]({
height: g - d + "%"
}, {
queue: !1,
duration: p.animate
}))), d = g
}) : (q = this.value(), k = this._valueMin(), c = this._valueMax(), g = c !== k ? 100 * ((q - k) / (c - k)) : 0, t["horizontal" === this.orientation ? "left" : "bottom"] = g + "%", this.handle.stop(1, 1)[j ? "animate" : "css"](t, p.animate), "min" === m && "horizontal" === this.orientation && this.range.stop(1, 1)[j ? "animate" : "css"]({
width: g + "%"
}, p.animate), "max" === m && "horizontal" === this.orientation && this.range[j ? "animate" : "css"]({
width: 100 - g + "%"
}, {
queue: !1,
duration: p.animate
}), "min" === m && "vertical" === this.orientation && this.range.stop(1, 1)[j ? "animate" : "css"]({
height: g + "%"
}, p.animate), "max" === m && "vertical" === this.orientation && this.range[j ? "animate" : "css"]({
height: 100 - g + "%"
}, {
queue: !1,
duration: p.animate
}))
},
_handleEvents: {
keydown: function(d) {
var h, e, c, f, g = b(d.target).data("ui-slider-handle-index");
switch (d.keyCode) {
case b.ui.keyCode.HOME:
case b.ui.keyCode.END:
case b.ui.keyCode.PAGE_UP:
case b.ui.keyCode.PAGE_DOWN:
case b.ui.keyCode.UP:
case b.ui.keyCode.RIGHT:
case b.ui.keyCode.DOWN:
case b.ui.keyCode.LEFT:
if (d.preventDefault(), !this._keySliding && (this._keySliding = !0, b(d.target).addClass("ui-state-active"), h = this._start(d, g), h === !1)) {
return
}
}
switch (f = this.options.step, e = c = this.options.values && this.options.values.length ? this.values(g) : this.value(), d.keyCode) {
case b.ui.keyCode.HOME:
c = this._valueMin();
break;
case b.ui.keyCode.END:
c = this._valueMax();
break;
case b.ui.keyCode.PAGE_UP:
c = this._trimAlignValue(e + (this._valueMax() - this._valueMin()) / a);
break;
case b.ui.keyCode.PAGE_DOWN:
c = this._trimAlignValue(e - (this._valueMax() - this._valueMin()) / a);
break;
case b.ui.keyCode.UP:
case b.ui.keyCode.RIGHT:
if (e === this._valueMax()) {
return
}
c = this._trimAlignValue(e + f);
break;
case b.ui.keyCode.DOWN:
case b.ui.keyCode.LEFT:
if (e === this._valueMin()) {
return
}
c = this._trimAlignValue(e - f)
}
this._slide(d, g, c)
},
click: function(c) {
c.preventDefault()
},
keyup: function(c) {
var d = b(c.target).data("ui-slider-handle-index");
this._keySliding && (this._keySliding = !1, this._stop(c, d), this._change(c, d), b(c.target).removeClass("ui-state-active"))
}
}
})
})(jQuery);
adrma.init.add({
name: "priceSlider",
cb: function() {
var d = $(".price-slider"),
b = parseFloat(d.attr("data-min"), 10),
a = parseFloat(d.attr("data-max"), 10),
c = parseFloat(d.attr("data-value-min"), 10);
maxSelected = parseFloat(d.attr("data-value-max"), 10);
if (c > b || maxSelected < a) {
$(".filter-price .action-remove").addClass("active")
}
values = [];
values.push(c);
values.push(maxSelected);
d.slider({
range: true,
min: b,
max: a,
values: values,
slide: function e(g, l) {
var k = l.values[0],
j = l.values[1];
$(".filter-price-selected").text("$" + k + " - $" + j);
var h = "price=[" + k + "!" + j + ")";
$("#priceRangeConfig").val(encodeURIComponent(h));
$(".filter-price .action-remove").addClass("active")
},
start: function f() {
$("#priceRangeForm").find("button.secondary").addClass("primary-dark").removeClass("secondary")
}
});
adrma.actions.add({
priceRange: function() {
var g = $("#priceRangeValue"),
h = g.val(function(j, k) {
return k.replace("%2526", "%26")
}).val();
if (h) {
h += encodeURIComponent(":")
}
h += $("#priceRangeConfig").val();
g.val(h)
}
});
adrma.actions.add({
resetPriceRange: function(h, g) {
if (!g.hasClass("active")) {
return
}
if ($("#priceRangeValue").val() == "") {
$("#priceRangeValue").removeAttr("name")
}
$("#priceRangeConfig").val("");
$("#priceRangeForm").submit()
}
})
}
});
adrma = window.adrma || {};
adrma.getRowCount = function getRowCount(b) {
var c = 0,
e = -1,
d = 0,
a = b.children();
for (i = 0; i < a.length; i++) {
d = $(a[i]).offset().top;
if (e != d) {
e = d;
c++
}
}
return c
};
adrma = window.adrma || {};
adrma.getColCount = function getColCount(b) {
var c = 0,
e = -1,
d = 0,
a = b.children();
for (i = 0; i < a.length; i++) {
d = $(a[i]).offset().left;
if (d === e) {
break
}
if (i === 0) {
e = d;
c = 1
}
if (e != d) {
c++
}
}
return c
};
adrma.ListGrid = function() {
if (!this instanceof adrma.ListGrid) {
return new adrma.ListGrid()
}
return this
};
adrma.ListGrid.prototype = {
defaults: {
store: true,
defualt: "list",
container: ".item-index .item-list",
listItems: ".item",
layoutStyles: ["grid", "list", "micro"],
transitionTime: 300
},
init: function init(a) {
$.extend(this, this.defaults, a);
this.container = $(this.container);
var b = this,
d = adrma.storage.get("local", "settings", true),
c;
if (adrma.pageInfo.pageType === "cmsSitePage") {
return
}
if (this.container.attr("data-retain-layout") && this.container.attr("data-retain-layout") === "true") {
return
}
if (d && d.listPageLayout) {
c = b[d.listPageLayout]
} else {
c = b[b.defualt]
}
if (adrma.mediaQuery.matches("full") && location.href.indexOf("layout=") !== -1) {
var e = adrma.decodeURLToJSON(),
f = e.layout;
if (f === "list" || f === "grid" || f === "micro") {
c = b[f];
b.storeLayout(f)
}
}
if (c) {
c.call(b, {
init: true
})
}
adrma.ListGrid.prototype.currentLayout = (d && d.listPageLayout) || b.defualt;
return this
},
grid: function grid(d) {
var e = this,
b = $.Deferred(),
a = e.container;
if (!e.hasClass("grid")) {
e.toggleTransition("add")
}
e.reset("grid");
a.each(function c(j, f) {
var l = $(this),
g = adrma.getColCount(l);
for (var j = 0; j < l.children().length; j += g) {
var h = j,
k = j + g,
m = l.children().slice(h, k);
m.equalHeights({
child: ".prices .price-breakdown"
});
m.equalHeights({
child: ".prices"
});
m.equalHeights({
child: ".item-img"
});
m.equalHeights({
child: ".item-actions"
});
m.equalHeights({
child: ".item-details .also-available"
});
m.equalHeights({
child: ".item-details h2"
});
m.equalHeights({
child: ".item-details"
})
}
setTimeout(function() {
e.toggleTransition()
}, d && d.init ? 0 : e.transitionTime);
e.updateButtonState("grid");
$.publish("layout/change", "grid")
});
return b.resolve()
},
list: function list(c) {
var d = this,
b = $.Deferred(),
a = d.container;
if (!d.hasClass("list")) {
d.toggleTransition("add")
}
$.publish("layout/change", "list");
d.reset("list");
d.updateButtonState("list");
setTimeout(function() {
d.toggleTransition()
}, c && c.init ? 0 : d.transitionTime)
},
micro: function micro(g) {
var j = this,
b = $.Deferred(),
a = j.container;
if (!j.hasClass("micro")) {
j.toggleTransition("add")
}
$.publish("layout/change", "micro");
j.reset("micro");
var c = adrma.getColCount(a);
for (var e = 0; e < a.children().length; e += c) {
var d = e,
f = e + c,
h = a.children().slice(d, f);
h.equalHeights({
addAmmount: 24
});
h.equalHeights({
child: ".item-img"
});
h.equalHeights({
child: ".item-actions"
});
h.equalHeights({
child: ".item-details"
})
}
j.updateButtonState("micro");
setTimeout(function() {
j.toggleTransition()
}, g && g.init ? 0 : j.transitionTime)
},
toggleTransition: function toggleTransition(a) {
a = a || "remove";
this.container[a + "Class"]("transition")
},
hasClass: function hasClass(a) {
return this.container.hasClass("style-is-" + a)
},
reset: function reset(a) {
var d = this,
b = d.container,
e = "style-is-",
c = b.find(".item");
b.find(".item").removeAttr("style");
b.find(".prices").removeAttr("style");
b.find(".item-details").removeAttr("style");
b.find(".item-actions").removeAttr("style");
b.removeClass(function() {
return e + d.layoutStyles.join(" " + e)
}).addClass(e + a)
},
updateButtonState: function updateButtonState(a) {
$(".select-list-style").find("[class*=mystyle-" + a + "]").addClass("selected").siblings().removeClass("selected")
},
storeLayout: function storeLayout(b) {
var a = this;
adrma.storage.set("local", "settings", (function() {
var d = adrma.storage.get("local", "settings"),
c = d || {};
c.listPageLayout = b;
a.currentLayout = b;
return c
})())
}
};
adrma.actions.add({
changeListStyle: function changeListStyle(a, c) {
var d = c.attr("data-style"),
b = c.closest("[data-styleSwitch]").attr("data-styleSwitch");
adrma.ListGrid.prototype.storeLayout(d);
adrma[b][d]()
}
});
adrma.listPage = adrma.listPage || {};
adrma.listPage.initCatSlider = function() {
$(".category-index .cat-list").beltRotate({
wrapWith: "<div class='beltWrapper'><div class='belt'></div></div>",
speed: 240,
moveBy: 4
})
};
adrma.init.add({
name: "catRelatedWrap",
cb: function() {
adrma.listPage.initCatSlider()
}
});
adrma.init.add({
name: "listPageLayoutManager",
cb: function() {
adrma.listPageLayoutManager = new adrma.ListGrid();
adrma.listPageLayoutManager.init();
adrma.getAsyncData.getData.done(function(a) {
if (a.repaintNeeded) {
adrma.listPageLayoutManager.init()
}
})
},
beforeInit: function listLayoutBeforeInit() {
return adrma.mediaQuery.matches("full", "fullnarrower")
},
defer: true
});
adrma.init.add({
name: "listPage_searchLinksPromoting",
cb: function() {
var c = adrma.cookie("SearchTerm"),
b;
if (c) {
adrma.cookie("SearchTerm", null, {
path: "/"
});
b = $(".pageContent a").not(".action").on("click", function a() {
adrma.cookie("SearchTerm", c, {
expires: 1,
path: "/"
});
return true
})
}
},
defer: true
});
adrma.init.add({
name: "toggleRefine",
cb: function() {
adrma.actions.add({
toggleRefine: function(a, b) {
var c = {
savedPos: $(document).scrollTop(),
ele: $("div.widget-content")
};
$("body").addClass("overflow-hidden");
$(".filter-select").toggleClass("shown");
if (b.hasClass("refine-menu-tab")) {
adrma.disableScrollRWD(c)
} else {
adrma.enableScroll(c)
}
}
})
}
});
adrma.init.add({
name: "listPageLoadPageByNumber",
cb: function() {
$(".listPageLoadPageByNumber").on("submit change", function(a) {
var b = $(this),
c = b.find(".page-input").val();
b.removeClass("error");
if (!$.isNumeric(c) || c < 1) {
b.addClass("error");
return false
}
})
},
defer: true
});
adrma.init.add({
name: "rwd-list-sortbar",
cb: function() {
var b = adrma.positionPortals;
b.init({
throttle: false
});
b.add({
name: "rwdListSortbar",
breakpoint: ".index-toolbar",
activeClass: "stick-sortbar",
targetEle: "body",
offset: "10",
onReach: function(d, e, f, c) {
f.addClass(c)
},
unReach: function(d, e, f, c) {
f.removeClass(c)
}
});
var a = $("body > footer").length ? $("body > footer") : $("#footer");
b.add({
name: "rwdListReachedFooter",
breakpoint: a,
activeClass: "reached-footer",
targetEle: "body",
offset: "10",
onReach: function(d, e, f, c) {
f.addClass(c)
},
unReach: function(d, e, f, c) {
f.removeClass(c)
}
})
},
defer: true,
beforeInit: adrma.mediaQuery.isTouch
});
adrma.init.add({
name: "searchResultTracking",
cb: function() {
var c = adrma.pageInfo.urlParams || {},
b = c.term || c.searchinfo,
a = adrma.pageInfo.siteId === "AD" && ((adrma.pageInfo.subPageType && adrma.pageInfo.subPageType === "revisedSearchPage") || b);
if (a) {
$("#productGridPlaceholder .item-list").on("click", "a, button", function(d) {
var e, f = $(".index-count-showing").text() || "";
f = f.split("-") || [];
f = f[0] || "";
e = (+f + $(this).closest(".item").index());
adrma.analytics.add({
type: "event",
category: "listing page",
action: "search results clickthru",
label: b + "|" + e
});
ga("set", "metric2", "1")
})
}
},
defer: true
});
(function(e) {
e.tinysort = {
id: "TinySort",
version: "1.1.0",
copyright: "Copyright (c) 2008-2011 Ron Valstar",
uri: "http://tinysort.sjeiti.com/",
defaults: {
order: "asc",
attr: null,
useVal: false,
data: null,
place: "start",
returns: false,
cases: false,
sortFunction: null
}
};
e.fn.extend({
tinysort: function(x, a) {
if (x && typeof(x) != "string") {
a = x;
x = null
}
var y = e.extend({}, e.tinysort.defaults, a);
if (!y.sortFunction) {
y.sortFunction = y.order == "rand" ? function() {
return Math.random() < 0.5 ? 1 : -1
} : function(k, j) {
var h = !y.cases && k.s && k.s.toLowerCase ? k.s.toLowerCase() : k.s;
var g = !y.cases && j.s && j.s.toLowerCase ? j.s.toLowerCase() : j.s;
if (f(k.s) && f(j.s)) {
h = parseFloat(k.s);
g = parseFloat(j.s)
}
return (y.order == "asc" ? 1 : -1) * (h < g ? -1 : (h > g ? 1 : 0))
}
}
var J = {};
var A = !(!x || x == "");
var B = !(y.attr === null || y.attr == "");
var F = y.data !== null;
var b = A && x[0] == ":";
var c = b ? this.filter(x) : this;
this.each(function(j) {
var k = e(this);
var g = A ? (b ? c.filter(this) : k.find(x)) : k;
var l = F ? g.data(y.data) : (B ? g.attr(y.attr) : (y.useVal ? g.val() : g.text()));
var h = k.parent();
if (!J[h]) {
J[h] = {
s: [],
n: []
}
}
if (g.length > 0) {
J[h].s.push({
s: l,
e: k,
n: j
})
} else {
J[h].n.push({
e: k,
n: j
})
}
});
for (var C in J) {
var G = J[C];
G.s.sort(y.sortFunction)
}
var w = [];
for (var C in J) {
var G = J[C];
var H = [];
var K = e(this).length;
switch (y.place) {
case "first":
e.each(G.s, function(g, h) {
K = Math.min(K, h.n)
});
break;
case "org":
e.each(G.s, function(g, h) {
H.push(h.n)
});
break;
case "end":
K = G.n.length;
break;
default:
K = 0
}
var E = [0, 0];
for (var I = 0; I < e(this).length; I++) {
var z = I >= K && I < K + G.s.length;
if (d(H, I)) {
z = true
}
var D = (z ? G.s : G.n)[E[z ? 0 : 1]].e;
D.parent().append(D);
if (z || !y.returns) {
w.push(D.get(0))
}
E[z ? 0 : 1]++
}
}
return this.pushStack(w)
}
});
function f(b) {
var a = /^\s*?[\+-]?(\d*\.?\d*?)\s*?$/.exec(b);
return a && a.length > 0 ? a[1] : false
}
function d(b, c) {
var a = false;
e.each(b, function(k, j) {
if (!a) {
a = j == c
}
});
return a
}
e.fn.TinySort = e.fn.Tinysort = e.fn.tsort = e.fn.tinysort
})(jQuery);
adrma.toggleListMoreView = {
defaults: {
limit: 4,
toggledEleClassName: "toggledHiddenList",
togglerEle: "<span>",
togglerClassName: "toggleMore",
text: ["See more..", "See less.."],
wrapThem: false,
wrapEle: "div",
addTriggerInside: false,
documentClickClose: false,
smartLimit: false,
beforeSetupEach: $.noop
},
init: function(a) {
var b = this,
c = $.extend({}, this.defaults, a);
this.buildToggler(c)
},
buildToggler: function(b) {
var a = this;
$(b.selector).each(function(f, c) {
var h = $(this),
g = h.children(),
d, j;
if (!b.smartLimit && g.length <= b.limit) {
return
}
if (b.beforeSetupEach(h, b, a) === false) {
return
}
d = g.filter(function(e) {
if (!b.smartLimit) {
return e > b.limit
}
return $(this).position().top > b.smartLimit
});
if (!d.length) {
return true
}
if (b.wrapThem) {
d.wrapAll("<" + b.wrapEle + " class=" + b.toggledEleClassName + "/>")
} else {
d.addClass(b.toggledEleClassName)
}
j = $(b.togglerEle, {
"class": b.togglerClassName,
text: b.text[0],
click: function(e, k) {
a.triggerToggle(h, b, k);
e.stopPropagation()
}
}).appendTo(h);
adrma.noop = b.addTriggerInside && (function() {
var e = j.clone(true);
h.find("." + b.toggledEleClassName).append(e)
})();
b.beforeSetupEach(c)
})
},
triggerToggle: function(a, d, e) {
var c = this;
c.attachDocClick(d);
a.find("." + d.toggledEleClassName).slideToggle(100);
a.find("." + d.togglerClassName).html(function(g, f) {
if (f === d.text[0]) {
return d.text[1]
} else {
return d.text[0]
}
});
var b = d.selector.parent().find("." + d.toggledEleClassName + ":visible").parent().not(a[0]);
if (b.length && !e) {
c.triggerToggle(b, d, "triggered")
}
},
attachDocClick: function(b) {
var a = this;
if (a.attachedDocClick) {
return false
}
adrma.noop = b.documentClickClose && (function() {
setTimeout(function() {
$(document).on("click.toggleListMoreView", function(c) {
c.stopPropagation();
a.documentClose(c, a)
})
}, 10);
a.attachedDocClick = true
})()
},
documentClose: function(b, c) {
var a = $(b.target);
$("." + c.defaults.toggledEleClassName + ":visible").find("." + c.defaults.togglerClassName).trigger("click", ["triggered"]);
return false
}
};
adrma.refineResults = {
init: function() {
adrma.toggleListMoreView.init({
selector: $("ul.filter-available"),
limit: 10,
togglerEle: "<li></li>",
togglerClassName: "filter-seemore",
wrapThem: true,
beforeSetupEach: function(d, c, e) {
var g = this,
h = function(k, j) {
k.tsort(j ? j : "")
},
a = d.children(),
f, b;
if (adrma.siteSettings.FiltersPerGroupLimit) {
g.limit = adrma.siteSettings.FiltersPerGroupLimit
}
if (a.length <= g.limit) {
return
}
f = d.addClass("original");
f.hide();
b = f.clone(true);
b.removeClass("original").addClass("cloned");
if (!f.is("[data-no-sort]")) {
h(b.find("li"), {
attr: "data-count",
order: "desc"
})
}
b.find("li:gt(" + (g.limit - 1) + ")").remove();
h(b.find("li"), {
attr: "data-sequence"
});
b.insertBefore(f).show();
$(g.togglerEle, {
"class": this.togglerClassName + " seeMore",
text: g.text[0],
click: function() {
var k = $(this),
j = k.hasClass("seeMore");
if (j) {
k.removeClass("seeMore").text(g.text[1]).siblings(".cloned").slideUp(300).siblings(".original").slideDown(300)
} else {
k.addClass("seeMore").text(g.text[0]).siblings(".original").slideUp(300).siblings(".cloned").slideDown(300)
}
}
}).insertAfter(f);
return false
}
})
}
};
adrma.init.add({
name: "refineResults",
cb: function() {
adrma.refineResults.init()
},
defer: true
});
adrma.actions.add({
scrollIntoView: function(c, f) {
if (!adrma.mediaQuery.matches("small", "smallMedium", "largeMedium") || adrma.pageInfo.siteId !== "AD") {
return
}
var a = $(".filter-select .widget-content"),
h = f.outerHeight(),
b, g, d = function() {
var j = a.find(".filter-select-grp"),
e;
for (i = 0; i < j.length; i++) {
if ($(j[i]).hasClass("scrolled")) {
e = i
}
}
return e
};
a.find(".filter-select-grp").removeClass("scrolled");
a.find(".filter-select-grp div").removeClass("show");
a.find(".filter-select-grp a").removeClass("shown");
f.next("div").addClass("show");
f.addClass("shown");
f.parents(".filter-select-grp").addClass("scrolled");
b = d();
g = b * h;
setTimeout(function() {
a.animate({
scrollTop: g
}, 300)
}, 200)
}
});
adrma.stockFormatter = {
getStock: function(a) {
if (a) {
var b = {},
d = a.subStatus,
c = a.stock;
if (c) {
b.className = "stock stockRelatedToggle stock-" + (d ? "special hoverInfo" : c.toLowerCase());
b.value = d ? d.name : c + ((c.toLowerCase() === "out") ? " of" : " ") + " Stock";
b.subStatus = d ? d.name : "";
b.subStatusMessage = d ? d.description : "";
return b
}
}
return null
}
};
adrma = window.adrma || {};
adrma.countryValueChange = function countryValueChange(d, l, g) {
var j = d.val() || "",
j = $.isArray(j) ? j[0] : j,
a = j.toLowerCase(),
e = d.find("option[value='" + j + "']").attr("data-requires-zip") === "true",
m = l.find("input"),
h = adrma.storage.get("local", "settings"),
k = "",
b = "",
f = "",
n = "",
o = l.find("label"),
p = "10",
c = {
hideIntlZipField: true,
setVal: true,
clearVal: true
};
g = $.extend(c, g);
if (e || a === "us" || a === "ca") {
switch (a) {
case "us":
case "gu":
case "as":
case "mh":
case "mp":
case "fm":
case "vi":
case "pr":
k = "Please enter a valid zip";
f = "zip code";
b = "usZip";
n = "tel";
break;
case "ca":
k = "Please enter a valid zip";
f = "postal code";
b = "caZip";
n = "text";
p = "7";
break;
default:
k = "Please enter a valid zip";
f = "zip code";
b = "otherZip";
n = "text"
}
o.text(f);
o.addClass("required");
m.attr({
"data-validate-error": k,
"data-regexp-ref": b,
maxlength: p,
required: "required"
});
if (!adrma.is.IE8 && !adrma.is.IE9) {
m.prop("type", n)
}
if (h && h.zip && g.setVal) {
if (h.country && h.country.toLowerCase() === a) {
m.val(h.zip)
} else {
m.val("")
}
}
adrma.Validate.prototype.clearValidationErrors(l);
l.removeClass("error");
l.show()
} else {
o.text("postal code").removeClass("required");
m.removeAttr("required");
if (g.clearVal) {
m.val("")
}
if (g.hideIntlZipField) {
l.hide()
}
k = "Please enter a valid zip";
m.attr("data-validate-error", k);
m.attr("data-regexp-ref", "otherZip");
m.attr("maxlength", p);
if (!adrma.is.IE8 && !adrma.is.IE9) {
m.prop("type", "text")
}
}
};
adrma.listPage = adrma.listPage || {};
adrma.listPage.lazyLoad = {
itemsPerLoading: adrma.siteSettings.LazyLoadingItemsCount,
loadedItemsCount: 0,
init: function init() {
var a = this;
if (!adrma.positionPortals || !adrma.pageInfo.perPage || !adrma.pageInfo.skus || !adrma.siteSettings.EnableListingPageLazyLoading) {
return
}
if (adrma.pageInfo.skus.length <= a.itemsPerLoading) {
a.skus = "";
a.removeCurrentBreakpoint();
return
}
a.positions = adrma.positionPortals;
a.positions.init({
throttle: false
});
$(".next-page").addClass("hide");
a.updateLoader(false);
a.setParamaters();
a.bindActions();
a.setBreakpoint()
},
bindActions: function bindActions() {
var b = this;
adrma.actions.add({
executeContentLoading: function a(c, d) {
b.onExecuteContentLoading()
}
})
},
setParamaters: function setParamaters() {
var b = this,
a = $("[data-lazy-load]");
b.loadedItemsCount = a.find(".item-list .item:not(.next-page):not(.lazy-loading)").length;
b.breakpointName = "lazyLoad-" + b.loadedItemsCount;
b.breakpointSelector = a.find(".item-list .item:eq(" + (b.loadedItemsCount - 10) + ")");
b.skus = b.getSkus()
},
setBreakpoint: function setBreakpoint() {
var a = this;
a.positions.add({
name: a.breakpointName,
breakpoint: a.breakpointSelector,
onReach: function() {
a.onExecuteContentLoading()
}
})
},
onExecuteContentLoading: function onExecuteContentLoading() {
var a = this;
a.removeCurrentBreakpoint();
a.updateLoader(true);
adrma.getProductsHTML({
skus: a.skus
}).done(function(b) {
a.updateLoader(false);
a.appendProductList(b);
a.setParamaters();
if (a.loadedItemsCount < adrma.pageInfo.skus.length) {
a.setBreakpoint()
} else {
$(".lazy-loading").addClass("hide");
$(".next-page").removeClass("hide")
}
}).fail(function() {
a.updateLoader(false)
})
},
removeCurrentBreakpoint: function removeCurrentBreakpoint() {
var b = this,
a = b.breakpointName;
if (b.positions) {
b.positions.remove(a)
}
},
getSkus: function getSkus() {
var d = this,
e = adrma.pageInfo.skus,
b = d.loadedItemsCount,
a = d.itemsPerLoading,
c = e.slice(b, b + a);
return c.toString()
},
appendProductList: function appendProductList(b) {
var c = this,
a = $(".item.next-page").length ? $(".item.next-page") : $(".item.lazy-loading");
a.before(b);
if (adrma.listPageLayoutManager) {
adrma.listPageLayoutManager.init()
}
if (adrma.mediaQuery.matches("small", "mediumOnly")) {
c.positions.recalculate("rwdListReachedFooter")
}
},
updateLoader: function appendLoader(a) {
var b = $(".lazy-loading");
b.removeClass("hide");
b.find(".loading-global").toggleClass("hide", !a);
b.find("a").toggleClass("hide", a)
}
};
adrma.init.add({
name: "adrma.listPage.lazyLoad",
cb: function() {
adrma.listPage.lazyLoad.init()
}
});
adrma.init.add({
name: "lazyLoadImages",
cb: function lazyLoadImages(a) {
if (!adrma.siteSettings.EnableLazyLoadImages) {
return
}
var b = $(".item");
adrma.convertDataSrcToSrc(b)
},
defer: true
});
adrma.getProductsHTML = function(c) {
var b = $.Deferred(),
d = adrma.pageInfo;
if (!c.skus || $.isEmptyObject(c.skus)) {
return b.reject()
}
var a = {
skus: c.skus,
pageType: c.pageType || adrma.pageInfo.pageType,
output: "html",
svfor: "7day",
version: adrma.pageInfo.productVersion
};
if (c.priceTemplate) {
a.priceTemplate = c.priceTemplate
}
a.emailPrice = c.emailPrice || adrma.getObjProperty(adrma.decodeURLToJSON(""), /^emailprice$/img);
if (d.siteId === "AD") {
a.mode = (d.mode) || "AD"
}
return adrma.fetchData({
url: "/api/GetProductListHTML?v=2",
data: a,
dataType: "html"
}).done(function(e) {
b.resolve(e)
})
};
adrma.RR = function(a) {
return this
};
adrma.RR.prototype = {
RRLayerUrl: "//media.richrelevance.com/rrserver/js/1.0/p13n.js",
apiKey: "",
baseUrl: "//RRMODE.richrelevance.com/rrserver/",
clickthruServer: window.location.protocol + "//" + window.location.host,
modes: ["", "recs", "recs", "integration", "integration"],
init: function init(b) {
var e = this,
a = $.Deferred(),
f = adrma.siteSettings,
d = e.RRSettingsMode = +f.RichRelevanceIntegrationMode,
c = adrma.pageInfo.pageType;
if (f.enableDdosMode || d === 0) {
return a.reject("disabled")
}
if (f.HideRichRelevanceOnReceipt && c === "receiptPage") {
return a.reject("disabled")
}
$.extend(e, e.defaults, b);
e.baseUrl = e.baseUrl.replace("RRMODE", e.modes[d]);
$.when(adrma.fetchData({
url: e.RRLayerUrl,
dataType: "script",
returnPromise: true
}), adrma.session.getSession, adrma.template.get("RRTmpl")).done(function() {
RR.jsonCallback = function() {
e.renderView(RR.data.JSON.placements)
};
R3_COMMON = new r3_common();
R3_COMMON.setApiKey(e.apiKey);
R3_COMMON.setBaseUrl(e.baseUrl);
R3_COMMON.setUserId(adrma.session.session.sid);
R3_COMMON.setSessionId(adrma.session.session.sid);
e.setPlacments()
});
return a.promise()
},
getPrices: function getPrices(c) {
var d = this,
b = $.Deferred(),
a = c.data || c.items;
if (!a) {
return b.reject()
}
var e = $.map((a), function(f, g) {
return f.id
}).join(",");
adrma.getProductData(e, {
directData: true
}).done(function(f) {
b.resolve(d.mashData(c, f))
});
return b
},
mashData: function mashData(b, e) {
if (e.status === "success") {
var a, g, f = this,
d = e.data,
c = $.map(b.data, function(h, j) {
a = h.id;
g = d[a];
if (f.limit && j >= f.limit) {
return
}
if (g) {
h.prices = g.prices
}
if (g && g.rating) {
h.rating = g.rating
}
if (g && g.freeShipping) {
h.freeShipping = true
}
if (h.stock === "Discontinued" || g.stock === "Discontinued") {
return
}
return h
});
b.data = c;
return b
}
},
setPlacments_BrandPage: function brandpage() {
R3_COMMON.setPageBrand(adrma.pageInfo.id);
R3_COMMON.addPlacementType("brand_page.rr1");
if (!window.r3_brand) {
return
}
R3_BRAND = new r3_brand();
rr_flush_onload();
r3()
},
setPlacments: function setPlacments() {
var d = adrma.pageInfo,
e = this,
a;
switch (d.pageType) {
case "couponsPage":
e.limit = 6;
case "homePage":
case "receiptPage":
case "topCategoryList":
if (d.pageType === "topCategoryList") {
e.limit = 5
}
if (d.pageType === "receiptPage") {
e.limit = 3
}
R3_COMMON.addPlacementType("home_page.json");
R3_COMMON.addPlacementType("home_page.json2");
R3_HOME = new r3_home();
rr_flush_onload();
r3();
break;
case "topCategory":
e.limit = 3;
R3_COMMON.addPlacementType("category_page.right_json");
R3_CATEGORY = new r3_category();
R3_CATEGORY.setId(d.id);
R3_CATEGORY.setName(d.shortTitle);
rr_flush_onload();
r3();
break;
case "listPage":
if (adrma.pageInfo.subPageType === "brandList") {
e.setPlacments_BrandPage();
break
}
var b = $(".item-list .item:visible");
if (b.length < 5) {
e.limit = 2
}
R3_COMMON.addPlacementType("category_page.right_json");
R3_CATEGORY = new r3_category();
b.each(function c(g, f) {
if (g > 14) {
return false
}
R3_CATEGORY.addItemId(f.getAttribute("data-sku"))
});
R3_CATEGORY.setId(d.id);
rr_flush_onload();
r3();
break;
case "productPage":
R3_ITEM = new r3_item();
R3_ITEM.setId(d.id);
R3_ITEM.setRecommendable(true);
R3_COMMON.addPlacementType("item_page.bottom_json");
rr_flush_onload();
r3();
break;
case "topBrands":
e.setPlacments_BrandPage();
break;
case "cartPage":
window.R3_CART = new r3_cart();
adrma.cartPage.gotCartPageSummary.done(function() {
var f = (adrma.cartPage && adrma.cartPage.data && adrma.cartPage.data.items) ? adrma.cartPage.data.items : {};
if (window.R3_CART) {
$.each(f, function(h, g) {
R3_CART.addItemId(g.sku)
})
}
R3_COMMON.addPlacementType("cart_page.json");
rr_flush_onload();
r3()
});
break
}
},
renderView: function renderView(c) {
var f = this,
a = 0,
d = c.length,
b, g, e = function e(h) {
g = tmpl("RRTmpl", h);
$("#" + h.id).html(g).removeClass("loading-RR hide");
$.publish("RR-rendered", h.id)
};
if (f.RRSettingsMode === 2) {
return
}
for (; a < d; a++) {
b = c[a];
f.getPrices(b).done(e)
}
},
saveSettings: function saveSettings(a) {
if (!a) {
return
}
adrma.storage.set("session", "showRR", a.show)
},
bindActions: function bindActions() {
var b = this;
adrma.actions.add({
rrTurnOff: function a(c, d) {
d.closest(".hoverTips").remove();
$(".rich-relevance").fadeOut(500);
b.saveSettings({
show: false
})
}
})
}
};
adrma.init.add({
name: "richRelevance",
cb: function() {
if (adrma.pageInfo.siteId === "AD" && adrma.pageInfo.pageType === "cartPage" && !adrma.siteSettings.enableRR) {
return
}
var f = adrma.pageInfo.pageType,
a = f == "homePage",
b = f == "productPage",
d = adrma.mediaQuery.matches("small"),
c = adrma.mediaQuery.matches("smallMedium"),
g, e, h;
if ((a && d) || (b && d)) {
return
}
if (adrma.storage.get("session", "showRR") === false) {
return
}
g = new adrma.RR();
g.bindActions();
g.init({
apiKey: adrma.siteSettings.RichRelevanceApiKey,
limit: e
})
},
defer: true
});
(function(c, b) {
var a = location.href;
adrma.history = {
currentLocation: c.location.pathname + c.location.search,
supported: !!(c.history && c.history.pushState),
pushState: function(d, e) {
e = e || {};
history.pushState(e, null, d);
this.notify(e)
},
replaceState: function(d, e) {
e = e || {};
history.replaceState(e, null, d)
},
notify: function(d) {
this.matcher(location.pathname + location.search, d)
},
start: function(d) {
var e = this;
this.matcher = d;
c.addEventListener("popstate", function(f) {
e.currentLocation = c.location.pathname + c.location.search;
e.notify(f.state || {})
}, false)
}
}
}(window));
adrma.Component = function Component(a) {
this.type = a.type;
this.placeholder = a.placeholder
};
adrma.Component.prototype.render = function(a) {
var b = this.placeholder;
$(b).html(a)
};
adrma.plpComponents = {
topComponent: new adrma.Component({
type: "top",
placeholder: "#topPlaceholder"
}),
heroBannerComponent: new adrma.Component({
type: "heroBanner",
placeholder: "#heroBannerPlaceholder"
}),
centerInfoComponent: new adrma.Component({
type: "centerInfo",
placeholder: "#centerInfoPlaceholder"
}),
categoriesFiltersComponent: new adrma.Component({
type: "categoriesFilters",
placeholder: "#categoriesFiltersPlaceholder"
}),
filtersComponent: new adrma.Component({
type: "filters",
placeholder: "#filtersPlaceholder"
}),
sideBannersComponent: new adrma.Component({
type: "sideBanners",
placeholder: "#sideBannersPlaceholder"
}),
productGridComponent: new adrma.Component({
type: "productGrid",
placeholder: "#productGridPlaceholder"
}),
bottomComponent: new adrma.Component({
type: "bottom",
placeholder: "#bottomPlaceholder"
}),
subcategoriesComponent: new adrma.Component({
type: "subcategories",
placeholder: "#subcategoriesPlaceholder"
})
};
adrma.plpDispatcher = {
init: function init() {
var a = this;
if (!adrma.siteSettings.UseAjaxListingPage || !adrma.history.supported) {
return
}
a.components = adrma.plpComponents;
a.bindActions();
a.setDefaultState();
a.destroySelectUI();
a.navLength = 1
},
bindActions: function bindActions() {
var a = this;
$(document).on("click", "[data-ajax-load]", function(c) {
var d = $(this),
f = d.attr("href"),
b = d.attr("data-ajax-type");
c.preventDefault();
a.applyState({
url: a.getRelativePath(f),
type: b
})
});
$(document).on("submit", ".listPageLoadPageByNumber", function(b) {
var c = $(this),
f = location.pathname,
d = c.serialize();
b.preventDefault();
a.applyState({
url: f + "?" + d,
type: "mainOnly"
})
});
adrma.history.start(function(b, c) {
a.onStateChange(b, c)
})
},
setDefaultState: function setDefaultState() {
var a = this,
b = a.getRelativePath(location.href);
a.isRoot = true;
a.applyState({
url: b
})
},
applyState: function applyState(a) {
var b = a.type || "all",
c = a.url;
adrma.history.pushState(c, {
type: b,
url: c
})
},
sendRequest: function sendRequest(d) {
var f = this,
b = $.Deferred(),
h = d.url,
g = d.type,
c = adrma.getHash(d.url) === "#dynamicList",
e = d.params || {};
f.ajaxType = g;
if (g) {
e.ajaxResultType = g
}
if (c) {
e.useGlpAnchor = true
}
e.isAjaxResult = true;
adrma.fetchData({
url: h,
data: e,
type: "GET",
dataType: "json",
cacheLocal: true,
productVersion: true,
cacheRemoteLength: "7day",
cacheLocalLength: "1day",
beforeSend: function a(j, k) {
if (d.preloadOnly) {
b.resolve(k);
return false
}
}
}).done(function(j) {
if (j.status !== "success") {
f.redirectToUrl(h);
return
}
if (j.data.redirectUrl) {
f.redirectToUrl(j.data.redirectUrl);
return
}
f.removeLoader();
f.updatePage(j.data);
b.resolve(data)
}).fail(function() {
if (d.preloadOnly) {
return b
}
f.redirectToUrl(h)
});
if (d.preloadOnly) {
return b
}
f.addLoader();
f.scrollTo();
return b
},
updatePage: function updatePage(a) {
var b = this;
b.beforeRender(a);
b.updateTitle(a.title);
b.updateComponents(a.htmlStrings)
},
updateComponents: function updateComponents(a) {
var c = this;
for (var b in a) {
c.updateComponent(b, a[b])
}
setTimeout(function() {
c.afterRender()
}, 500)
},
updateComponent: function updateComponent(c, b) {
var d = this,
a = c.replace("Html", "");
d.components[a + "Component"].render(b)
},
redirectToUrl: function redirectToUrl(a) {
window.location = a
},
updateTitle: function updateTitle(a) {
$("title").text(a)
},
onStateChange: function onStateChange(a, c) {
var b = this;
if (b.isRoot) {
b.isRoot = false;
return
}
b.sendRequest(c)
},
beforeRender: function beforeRender(a) {
$.extend(adrma.pageInfo, a.pageInfo)
},
afterRender: function afterRender() {
var a = this;
adrma.session.init();
adrma.getAsyncData.init();
if (a.ajaxType === "all" && adrma.filtersSearch) {
adrma.filtersSearch.init()
}
if (adrma.listPageLayoutManager) {
adrma.listPageLayoutManager.init()
}
if (adrma.listPage.lazyLoad) {
adrma.listPage.lazyLoad.init()
}
if (adrma.vipProducts) {
adrma.vipProducts.init()
}
if (adrma.refineResults && a.ajaxType === "all") {
adrma.refineResults.init()
}
if (adrma.lazyLoadImages) {
adrma.lazyLoadImages.init({
container: ".item-list"
})
}
adrma.listPage.initCatSlider();
a.destroySelectUI();
a.navLength++;
ga("set", "page", window.history.state.url);
ga("send", "pageview");
$.publish("listing/ajaxed/loaded")
},
getRelativePath: function getRelativePath(a) {
return a.replace(window.location.origin, "")
},
addLoader: function addLoader() {
var j = this,
c = '<div class="item item-loading"><div class="item-img"><span>&nbsp;</span></div><div class="item-details"><h2> </h2><p><span class="item-ids"><span class="item-ids"><i class="product-sku">&#x2588;&#x2588; &#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</i><i class="product-sku" style="display: none;">&#x2588;&#x2588; &#x2588;&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</i></span></span></p></div><div class="item-actions"><div class="prices"><p class="price-breakdown"><s><em></em> </s></p><em class="price-label"><br></em><strong class="your-price" itemprop="price"></strong></div><a class="button small radius add-to-cart disabled">&nbsp;</a><p class="save-actions"><span class="stock-special">&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</span><a class="wishlist-add">&#x2588;&#x2588;&#x2588;</a></p></div></div>',
b = '<section class="filter-select-grp filter-loading"><a href="" class="filter-type action shown" data-action="bindToggleEle" data-target=":next()">Loading..</a><div class="filter-options show"><ul class="filter-available "><li><a href="#">&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</a></li><li><a href="#">&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</a></li><li><a href="#">&#x2588;&#x2588;&#x2588;&#x2588; &#x2588;&#x2588;&#x2588;&#x2588;&#x2588;</a></li></ul> </div></section>',
d = "",
g = adrma.listPageLayoutManager ? adrma.listPageLayoutManager.currentLayout : "",
a = 6,
h, f = !adrma.mediaQuery.matches("full");
if (g === "micro") {
a = 5
}
for (var e = 0; e < a; e++) {
d += c
}
if (j.ajaxType === "all") {
if (f && (h = $(".highlight.filter-select")) && h.hasClass("shown")) {
h.find(".widget-header a").trigger("click")
} else {
$("#filtersPlaceholder .widget-content").html(b)
}
$("#filtersPlaceholder .filter-type.filter-search").remove()
}
$("#productGridPlaceholder .item-list").html(d);
$("#productGridPlaceholder").addClass("ajax-loading-list")
},
removeLoader: function removeLoader() {
$("#productGridPlaceholder").removeClass("ajax-loading-list")
},
scrollTo: function scrollTo() {
var a = $(".index-toolbar");
if (!adrma.isElementInViewport(a)) {
adrma.scrollTo(a, {
offset: -100
})
}
},
destroySelectUI: function destroySelectUI() {
$(".index-toolbar .select-ui").removeAttr("data-onselect")
},
isRoot: false,
ajaxType: ""
};
adrma.init.add({
name: "plpDispatcher",
cb: function() {
adrma.plpDispatcher.init()
},
defer: true
});
adrma.init.add({
name: "preloadlinks",
cb: function preloadlinks() {
if (!adrma.siteSettings.UseAjaxListingPage || adrma.siteSettings.enableDdosMode) {
return
}
function b() {
var c = $(".page-next");
if (!c.length && adrma.plpDispatcher) {
return
}
if (c.hasClass("inactive")) {
return
}
adrma.plpDispatcher.sendRequest({
url: c.attr("href"),
type: c.attr("data-ajax-type"),
preloadOnly: true
}).done(function(d) {
$("<link rel='preload' href='" + d.url + "' />").appendTo("head")
})
}
b();
$.subscribe("listing/ajaxed/loaded", function a() {
b()
})
},
defer: true,
delay: 1500
});
adrma.cart = {
defaults: {},
serializeForm: function(b) {
var j = this,
c = b.closest("form"),
h = b.closest("[data-sku]"),
a = {},
k, g, d, f = j.resolveConfigSku(h.attr("data-sku")),
e, l = true;
a[f] = a[f] || {};
if (c.length) {
e = c.find("input.itemData");
$.each(e, function(o, m) {
d = $(m);
k = j.resolveConfigSku(m.name);
g = m.value;
d.removeClass("error");
if (isNaN(g) || g < 1 || g.indexOf(".") > -1) {
l = false;
j.tempDisable = true;
setTimeout(function n() {
j.tempDisable = false
}, 2000);
adrma.notify.add({
html: "<p>Please change the quantity to a valid number</p>",
type: "error"
});
d.addClass("error")
}
if (d.hasClass("component")) {
a[f].components = a[f].components || [];
a[f].components.push({
id: k,
qty: g
})
} else {
a[f].qty = g
}
})
} else {
k = j.resolveConfigSku(h.attr("data-sku"));
a[k] = {
qty: 1
}
}
if (!l) {
c.removeClass("in-action");
a = {}
}
return a
},
storeData: function storeData(a) {
var b = this;
b.data = a
},
resolveConfigSku: function resolveConfigSku(b) {
if (!b) {
return
}
if (!adrma.productData) {
return b
}
var a = adrma.productData[b];
if (a && a.type && (a.type === "configurable") && a.config && a.id && a.config.id) {
b = a.config.id
}
return b
},
getProductData: function(b) {
var a = {};
b = this.resolveConfigSku(b);
a[b] = {
qty: 1
};
return a
},
addToCart: function(b, f) {
var g = this,
d = $.Deferred();
if (g.tempDisable) {
return d.reject()
}
f = $.extend({}, this.defaults, f);
if (b instanceof jQuery) {
if (b.hasClass("disabled")) {
return d.reject()
}
var e = b.closest("form").length;
b = e ? this.serializeForm(b) : this.getProductData(b.closest("[data-sku]").attr("data-sku"))
}
if (!b || $.isEmptyObject(b)) {
return d.reject()
}
var h = (function c(j) {
if (j === "cartPage") {
return j
}
return "miniCart"
})(adrma.pageInfo.pageType);
b = {
clientTimeStamp: adrma.getTimezoneStamp(),
cartItems: b,
type: h,
isEmailPrice: adrma.pageInfo.isEmailPrice
};
var a = g.beforeAddToCart(b, f);
if (!a) {
return d.reject()
}
g.updateStorage();
g.postData(b).done(function(j) {
if (j.status === "success") {
g.storeData(j.data);
g.afterAddToCart(j, f);
d.resolve(j)
} else {
g.failedAddToCart(j, f);
d.reject(j)
}
}).fail(function(j) {
g.failedAddToCart(j, f);
d.reject(j)
});
return d
},
postData: function(a) {
a = JSON.stringify(a);
return adrma.fetchData({
url: "/api/user/order/addToCart",
data: a,
type: "POST",
contentType: "json",
dataType: "json"
})
},
beforeAddToCart: function(a, b) {
$.publish("cart/beforeAddingItem", a);
return true
},
afterAddToCart: function(c, b) {
$.publish("cart/addedItem", c);
if (b && b.configEleCollection) {
adrma.actions.toggleInAction(b.configEleCollection, "remove")
}
var a = c.messages;
if (a) {
$.each(a, function(f, d) {
adrma.notify.add({
html: "<p>" + d.text + "</p>",
autoClose: false
})
})
}
},
failedAddToCart: function(b, a) {
$.publish("cart/addedItem/", b);
$.publish("cart/addItemFailed", b);
if (adrma.pageInfo.siteId !== "ADR" || !adrma.siteSettings.IsLocationsEnabled) {
adrma.notify.renderApiMessages(b)
}
if (a && a.configEleCollection) {
adrma.actions.toggleInAction(a.configEleCollection, "remove")
}
},
updateStorage: function() {
adrma.storage["delete"]("local", "miniCart");
if (!adrma.isRevisedSessionHandling) {
adrma.storage["delete"]("local", "session")
}
},
removeFromCart: function(b, f) {
f = $.extend({}, this.defaults, f);
var g = this,
e = $.Deferred(),
h = (function d(j) {
if (j === "cartPage") {
return j
}
return "miniCart"
})(adrma.pageInfo.pageType),
c = {
CartDetailID: b,
type: h
},
a = g.beforeRemoveFromCart(b, f);
g.updateStorage();
if (!a) {
return e.reject()
}
adrma.fetchData({
url: "/api/user/order/RemoveFromCart",
data: c,
type: "POST",
dataType: "json"
}).done(function(j) {
if (j.status === "success") {
g.storeData(j.data);
g.afterRemoveFromCart(j, f);
e.resolve(j)
} else {
g.failedRemoveFromCart(j, f);
e.reject(j)
}
}).fail(function(j) {
g.failedRemoveFromCart(j, f);
e.reject(j)
});
return e
},
beforeRemoveFromCart: function(a, b) {
$.publish("cart/active", {});
return true
},
afterRemoveFromCart: function(b, a) {
$.publish("cart/removedItem", b);
$.publish("cart/removedItem/", b)
},
failedRemoveFromCart: function(b, a) {
adrma.notify.renderApiMessages(b);
$.publish("cart/failedRemovingItem", b)
}
};
adrma.atc = {
updateCartCount: function(b) {
var a = b.data.cartCount;
adrma.onUpdateCartCount(a)
},
minicartData: {},
getProductData: function(c) {
var b = this;
var a = {};
c = this.resolveConfigSku(c);
a[c] = {
qty: 1
};
return a
},
resolveConfigSku: function resolveConfigSku(b) {
if (!b) {
return
}
if (!adrma.productData) {
return b
}
var a = adrma.productData[b];
if (a && a.type && (a.type === "configurable") && a.config && a.id) {
b = a.config.id
}
return b
},
addToCart: function(c, m) {
var q = this,
d = $.Deferred(),
e = null,
o, h;
if (c.hasClass("disabled")) {
return d.reject()
}
var l = adrma.pageInfo.urlParams.mode;
if (l && l === "byui") {
return d.reject()
}
if (q.tempDisable) {
return d.reject()
}
m = $.extend({}, this.defaults, m);
if (c instanceof jQuery) {
h = true;
e = c.closest("form")
}
o = h && e.length ? e.attr("data-price-type") : c.attr("data-price-type");
if (o && adrma.priceType[o] && !m.resolvedPriceType) {
adrma.priceType[o](c, m);
return d.reject()
}
if (e.length > 0) {
var j = e,
g = j.find("input"),
b = j.find("input[type='submit'], .AddToCart"),
c = {},
n, r = adrma.storage,
a = false,
k = j.find("[data-maxqty]"),
p = j.find(".itemData.hoverInfo").val();
if (j.find("[name = 'nextpage']").length) {
return d.reject()
}
if (k.length) {
var p = k.attr("data-maxqty");
k.removeClass("error");
j.find(".qtyLimitError").remove();
if (+k.val() > p) {
k.addClass("error");
j.find(".quantity").parent("div").append("<span class='error message qtyLimitError'>There is a limit of qty that can be purchased, the max quantity is " + p + "</span>");
return d.reject()
}
}
if (isNaN(p) || p < 1 || p.indexOf(".") > -1) {
var s = false;
q.tempDisable = true;
setTimeout(function f() {
q.tempDisable = false
}, 2000);
adrma.notify.add({
html: "<p>Please change the quantity to a valid number</p>",
type: "error"
});
g.addClass("error");
return d.reject()
}
$.each(g.get(), function(t, u) {
var v = u.name,
w;
if (/_qty$/.test(v)) {
w = v.match(/(.+?)\_qty/);
if (w[1].indexOf("_r") > 0) {
if (a) {
return true
}
w[1] = w[1].split("_")[0];
a = true
}
w = w.length && w[1] ? w[1] : "";
c[w] = {
qty: u.value
}
}
})
} else {
c = this.getProductData(c.closest("[data-sku]").attr("data-sku"))
}
if ($.isEmptyObject(c)) {
return d.reject()
}
$('[data-action="addToCart"]').addClass("disabled");
if (g) {
g.removeClass("error")
}
adrma.cart.updateStorage();
$.when(q.addItemToCart(c), q.getAddToCartProductData(Object.keys(c)[0])).done(function(t, u) {
$('[data-action="addToCart"]').removeClass("disabled");
if (t.status === "success" && u.status === "success") {
d.resolve(t, u)
} else {
d.reject(t, u);
if (t[0].status !== "success") {
adrma.notify.renderApiMessages(t[0])
}
if (u[0].status !== "success") {
adrma.notify.renderApiMessages(u[0])
}
}
if (!m.silent) {
q.handleAddToCartResult(t[0], u[0])
}
if (t.status === "success" && u.status === "success") {
q.updateCartCount(t, u);
$.publish("cart/addedItem/ADO", t)
}
adrma.storage.set("local", "inCart", t[0].data.inCart)
}).fail(function(t, u) {
d.reject(t, u);
if (!m.silent) {
location = "http://www.adorama.com/Als.Mvc/CartView"
}
$('[data-action="addToCart"]').removeClass("disabled")
}).always(function() {
$('[data-action="addToCart"]').removeClass("disabled")
});
return d
},
getAddToCartProductData: function(a) {
return adrma.fetchData({
url: "/api/getAddToCartProductData",
productVersion: true,
cacheRemote: true,
dataType: "json",
type: "GET",
data: {
sku: a,
isEmailPrice: adrma.pageInfo.isEmailPrice
}
})
},
handleAddToCartResult: function handleAddToCartResult(a, c) {
var d = this,
b = a.status === "success" && c.status === "success";
if (b) {
$.publish("addToCart", a.data)
}
if (a.data && a.data.redirectUrl) {
window.location = a.data.redirectUrl;
return
}
d.getTemplate();
if (b) {
d.minicartData.mainItem = a.data.processedItems[0];
d.minicartData.accessories = c.data.accessories;
d.minicartData.warranty = c.data.warranty;
d.minicartData.quantity = a.data.processedItems[0].quantity;
d.renderSuccessATC();
adrma.analytics.add({
type: "event",
category: "Minicart",
action: "viewed minicart",
label: "",
value: 0,
noninteraction: true
})
} else {
return;
d.renderFailedATC(a)
}
},
gotTemplate: $.Deferred(),
getTemplate: function() {
var a = this;
return adrma.template.get("miniCartPop-ADO", {
cache: "1day",
version: 1397160239875
}).done(function() {
a.gotTemplate.resolve()
})
},
renderSuccessATC: function() {
var c = this,
a = $(".addToCartPopup"),
b = c.minicartData.quantity,
d, e;
d = b < 2 ? " product has been added to the cart" : " products have been added to the cart";
c.gotTemplate.done(function() {
adrma.popup.trigger({
title: b + d,
popupClass: "popup800 minicart",
html: tmpl("miniCartPopTmpl", c.minicartData)
})
})
},
bindActions: function bindActions() {
var a = this;
if (a.boundRenderedActions) {
return
}
a.boundRenderedActions = true;
$(".addToCartPopup").on("click", ".removeMainItem", function(b) {
b.preventDefault();
var c = $(this);
c.text("removing...");
a.removeMainItemFromCart(c)
});
$(".addToCartPopup").on("click", ".continueShop", function(b) {
b.preventDefault();
$(".popupExit").trigger("click")
});
adrma.actions.add({
addWarranty: function(b, c) {
a.onAddWarranty(b, c)
},
removeWarranty: function(b, c) {
a.onRemoveWarranty(b, c)
},
accessoryAction: function(b, c) {
if (c.parents(".item").hasClass("inCart")) {
a.removeAccessory(c)
} else {
a.addAccessory(c)
}
},
seeAllAccessoriesAction: function(b, f) {
var d = adrma.pageInfo.pageType === "productPage",
g = f.attr("data-sku"),
c = adrma.router.currentRoute === "accessories";
if (d) {
adrma.popup.triggerClose()
}
if (d && !c) {
adrma.router.changeHash(null, "#accessories");
return
}
if (d && c) {
$("[data-id='tab-accessories']").trigger("click");
adrma.scrollTo($("#productTabs"));
return
}
window.location = "/" + g + ".html#accessories"
}
});
a.logEvents()
},
renderFailedATC: function(c) {
var d = this,
b, a;
if (!adrma.config.miniCart) {
d.triggerPopup()
}
if (c.messages) {
b = c.messages.map(function(e) {
return e.text
})
}
a = b ? b.join("<br>") : "";
a = a || c.message || "";
setTimeout(function() {
$(".addToCartPopup .popupContent").html("<div class='errorLoadingPopup'>Sorry, couldn't add to cart <br>" + a + "</div>")
}, 1000)
},
triggerPopup: function() {
$("<i class='popup' data-html='<center class=\"loading\" data-fouc-rendering></center>' rel='popup800 addToCartPopup'></i>").appendTo("body").trigger("click").remove()
},
removeMainItemFromCart: function(b) {
var c = this;
var a = $.map($(".itemAddedSection").find(".product"), function(d, f) {
return $(d).attr("data-cartLineID")
});
adrma.cart.updateStorage();
c.removeItemFromCart(a[0]).done(function(d) {
$.publish("removeFromCart", d.data);
if (d.status === "success") {
setTimeout(function() {
c.updateCartCount(d);
$(".popupExit").trigger("click")
}, 500)
} else {
b.text("error removing... try again!").attr("class", "button removeMainItem error message")
}
})
},
addAccessory: function(b) {
b.text("Adding...");
var d = this,
c = b.closest(".product"),
e = b.closest("[data-sku]").attr("data-sku"),
a = {};
a[e] = {
qty: 1
};
adrma.cart.updateStorage();
d.addItemToCart(a).done(function(f) {
if (f.status === "success") {
d.updateCartCount(f);
d.onAddAccSuccess(b, f.data);
f.data.ecList = "accessory minicart";
$.publish("addToCart", f.data)
} else {
d.onAddAccFail(b, f.data)
}
})
},
removeAccessory: function(b) {
b.text("Removing...");
var c = this,
a = b.attr("data-cartLineID");
adrma.cart.updateStorage();
c.removeItemFromCart(a).done(function(d) {
if (d.status === "success") {
c.updateCartCount(d);
c.onRemoveAccSuccess(b, d.data);
$.publish("removeFromCart", d.data)
} else {
c.onRemoveAccFail(b, d.data)
}
})
},
onAddAccSuccess: function(b, a) {
b.text("Remove").attr("data-cartLineID", a.processedItems[0].cartLineID).attr("data-track-data", "Minicart,Remove from Cart - Accessories," + b.closest("[data-sku]").attr("data-sku")).removeClass("addToCart highlight").addClass("button-gray removeFromCart");
b.closest(".item").addClass("inCart")
},
onAddAccFail: function(b, a) {},
onRemoveAccSuccess: function(b, a) {
b.text("Add to Cart").attr("data-cartLineID", "").removeClass("removeFromCart button-gray").addClass("highlight addToCart").attr("data-track-data", "Minicart,Add to Cart - Accessories," + b.closest("[data-sku]").attr("data-sku"));
b.parent().find(".inCartMessage").remove();
b.closest(".item").removeClass("inCart")
},
onRemoveAccFail: function() {},
logEvents: function() {
$(document).on("click", ".minicart .popupExit", function() {
adrma.analytics.add({
type: "event",
category: "Minicart",
action: "clicked close",
label: "",
value: 0,
noninteraction: false
})
})
},
onAddWarranty: function onAddWarranty(b, c) {
var f = this,
g = c.val(),
h = f.minicartData.warranty.items[+g],
d = c.parents(".popupContent"),
a = {};
c.parents(".input-wrapper").find("input, select").attr("disabled", "disabled");
d.removeClass("loaded").addClass("loading");
a[h.sku] = {
qty: 1
};
f.addItemToCart(a).done(function(j) {
var e = j.data.processedItems[0].cartLineID;
d.removeClass("loading").addClass("loaded");
adrma.template.render({
template: "miniCartPopWarrantyEditTmpl",
ele: "#warrantyPlaceholder",
method: "html",
data: {
cartLineID: e,
item: h
}
});
j.data.ecList = "warranty minicart";
$.publish("addToCart", j.data)
})
},
onRemoveWarranty: function onRemoveWarranty(b, c) {
var f = this,
a = c.attr("data-cartLineID"),
d = c.parents(".popupContent");
d.removeClass("loaded").addClass("loading");
f.removeItemFromCart(a).done(function(e) {
d.removeClass("loading").addClass("loaded");
adrma.template.render({
template: "miniCartPopWarrantyTmpl",
ele: "#warrantyPlaceholder",
method: "html",
data: f.minicartData.warranty
});
$.publish("removeFromCart", e.data)
})
},
addItemToCart: function addItemToCart(a) {
var d = this,
b = new Date(),
c;
c = {
clientTimeStamp: (b.getTime() - (b.getTimezoneOffset() * 60000)),
cartItems: a,
type: "miniCart",
isEmailPrice: adrma.pageInfo.isEmailPrice
};
return adrma.cart.postData(c).fail(function(e) {
adrma.notify.renderApiMessages(e)
})
},
removeItemFromCart: function removeItemFromCart(a) {
return adrma.fetchData({
url: "/api/user/order/removeFromCart",
type: "post",
data: {
CartDetailID: a,
Type: "miniCart"
},
dataType: "json"
})
}
};
adrma.init.add({
name: "ADO-minicart",
cb: function() {
adrma.atc.bindActions()
}
});
adrma.vipProducts = {
data: {
param: {}
},
init: function() {
var a = this;
a.updateVIPButtons();
adrma.session.getSession.done(function(b) {
if (!adrma.session.session.isLoggedIn || !adrma.session.session.isVip) {
$("[rel='vipLoginPop']").each(function() {
var d = $(this);
d.show();
var c = d.closest("[data-sku]").attr("data-sku");
d.attr({
"data-popup-class": "popup300 vipLoginPop sku-" + c
})
})
}
a.updateSellPoints();
if (!b.isLoggedIn || !b.isVip) {
$(".item-tag.vip").siblings(".deal").remove()
}
});
return;
$(document).on("vipUpdate", ".vipProduct", function(b, c) {
a.vipUpdate($(this), c)
}).on("click", ".vipProduct", function(b) {
return;
var d = $(this),
c = $(b.target);
if (d.hasClass("vipPending") || d.hasClass("vipResolved") || c.hasClass("productName") || c.hasClass("vipLink") || c.hasClass("productImage") || c.hasClass("productImgLink")) {
return
}
d.trigger("vipUpdate")
})
},
updateVIPButtons: function updateVIPButtons() {
$("[rel='vipLoginPop']").each(function() {
var a = $("[viploginpopbutton]").addClass("highlight-dark").removeClass("inverse").show();
sku = a.closest("[data-sku]").attr("data-sku");
a.html("Add to cart").addClass("popup hoverInfo button").attr({
"data-popup-class": "popup300 vipLoginPop sku-" + sku,
"data-tooltip-content": "This purchase is exclusive to existing customers."
})
})
},
updateSellPoints: function updateSellPoints() {
var a = this,
b = $(".sell-points-hr");
if (adrma.session.session.isLoggedIn && adrma.session.session.isVip) {
b.find(".for-non-vip").remove()
} else {
if (b.find(".for-vip").length) {
b.find(".for-vip").remove()
} else {
b.find("li").eq(3).remove()
}
}
b.removeClass("hide")
},
vipUpdate: function(b, c) {
var e = this,
d = b,
a = {},
f = adrma.session.session;
b.addClass("vipPending loading");
a.ele = d;
a.param = {};
a.param.SKU = b.closest("[data-sku]").attr("data-sku");
a.param.DesignType = d.attr("data-designType");
a.param.isLoggedIn = f.isLoggedIn;
a.param.isVip = f.isLoggedIn ? f.isVip : false;
a.param.pcode = adrma.pageInfo.urlParams.pcode || "";
a.param.IsGSAMode = adrma.pageInfo.urlParams.mode || "";
if (c) {
location.reload(true)
}
},
fetch: function(a) {
return adrma.fetchData({
url: "/searchsite/NewDesign/Controls/StaticPage/PostBackMethods.asmx/GetPriceContainerForVip",
data: a.param,
dataType: "json"
})
},
updateUI: function(d, a) {
var b = d.html,
c = $(d.html);
if (!d.html) {
alert("server returned NO new HTML");
return
}
c.addClass("vipPending");
$(a.ele).replaceWith(c)
},
hideVipSP: function(a) {
if (a.IsLoggedIn && a.isVipCustomer) {
var b = $(".sell-points").find("li").eq(0).hide()
}
}
};
adrma.init.add({
name: "vipProduct",
cb: adrma.vipProducts.init,
context: adrma.vipProducts
});
(function needleWraper() {
adrma.init.add({
name: "needleService",
cb: function() {
var f = adrma.pageInfo,
d = f.id,
g = f.pageType,
c = document.location.protocol === "http:" ? "http://" : "https://",
e = adrma.siteSettings.enableNeedleChat;
if (!e || g === "myAccountPage") {
return
}
var a = (f.urlParams && f.urlParams.cat1) ? f.urlParams.cat1 : "",
b = decodeURIComponent(a),
h;
b = b || $.trim($(".breadcrumbs > div").not(".confidence").find("a").eq(-1).text());
needleParam = {
productId: d,
categoryId: b
};
h = $("#FinalPrice").val();
if (h) {
needleParam.productPrice = h
}
adrma.fetchData({
url: c + "adorama.needle.com/needle_service.js",
dataType: "script"
})
},
defer: true
})
})();
adrma.actions.add({
toggleEcoWidget: function toggleEcoWidget(a, c) {
var b = c.closest(".eco-widget");
b.find("h4").removeClass("shown");
b.find(".eco-content").removeClass("show")
}
});
adrma.init.add({
name: "normilizeLinks",
cb: function() {
adrma.normilizeLinks = function(a) {
var b = new RegExp(a.searchFor, "i");
a.container.find("a").each(function() {
var c = $(this),
d = c.attr("href");
if (!d) {
return true
}
c.attr("href", d.replace(b, a.replaceWith))
})
};
adrma.normilizeLinks({
container: $(".pageContent"),
searchFor: "Redirectl",
replaceWith: "l"
})
},
defer: true,
delay: 1500
});
adrma.analytics.plugins.push(function loadLinkid() {
ga("require", "linkid", "linkid.js")
});
adrma.init.add({
name: "pingDom",
cb: function() {
return;
PRUM_EPISODES = window.PRUM_EPISODES || {};
_prum = window._prum || {};
adrma.fetchData({
url: "//rum-static.pingdom.net/prum.min.js",
dataType: "script"
})
}
});
adrma.init.add({
name: "remarketing",
cb: function() {
var a = adrma.pageInfo,
b = a.pageType,
h = "",
c, e, f = (function f() {
switch (b) {
case "homePage":
return "home";
case "topCategory":
return "category";
case "listPage":
return "category";
case "productPage":
e = adrma.productData ? adrma.productData[adrma.pageInfo.id] : "";
h = e ? e.prices.price : "";
return "product";
case "cartPage":
return "cart"
}
})(),
d = a.id || "",
g = function(j) {
if (window.google_trackConversion) {
window.google_trackConversion(j)
}
};
if (b === "receiptPage") {
return
}
adrma.performance.mark("load google conversion_async");
$.getScript("//www.googleadservices.com/pagead/conversion_async.js").done(function() {
$.subscribe("cartPage/initRender", function k(l, n) {
if (!n || n.type !== "GetCartPageSummary") {
return
}
var m = $.map(n.data.items, function(o) {
return o.sku
});
g({
google_conversion_id: adrma.siteSettings.googleConversionId,
google_conversion_label: adrma.siteSettings.googleConversionLabel,
google_remarketing_only: true,
google_custom_params: {
prodid: m,
pagetype: "cartPage",
value: n.data.summary.subTotal
}
})
});
$.subscribe("cart/addedItem cart/addedItem/ADO", function j(l, p) {
var n, m, q, o;
if (p.data.items && p.data.items.length) {
n = p.data.items[0];
m = p.data.items[0];
q = m.sku, o = m.price
}
if (p.data.processedItems && p.data.processedItems.length) {
n = p.data.processedItems;
m = p.data.processedItems[0];
q = m.id;
o = m.prices.price
}
if ($.isPlainObject(n)) {
return
}
if (q && o) {
g({
google_conversion_id: adrma.siteSettings.googleConversionId,
google_conversion_label: adrma.siteSettings.googleConversionLabel,
google_remarketing_only: true,
google_custom_params: {
prodid: q,
pagetype: "cart",
value: o
}
})
}
});
if (b === "cartPage") {
return
}
setTimeout(function() {
g({
google_conversion_id: adrma.siteSettings.googleConversionId,
google_conversion_label: adrma.siteSettings.googleConversionLabel,
google_remarketing_only: true,
google_custom_params: {
prodid: d,
pagetype: f,
value: h
}
})
}, 1500)
});
$.publish("googleConversionLoaded")
},
defer: true,
delay: 500
});
adrma.init.add({
name: "pixRemarketing",
cb: function() {
$.subscribe("googleConversionLoaded", function a() {
if (window.google_trackConversion) {
window.google_trackConversion({
google_conversion_id: 1012903565,
google_remarketing_only: true,
google_custom_params: window.google_tag_params
})
}
})
},
defer: true
});
var needleParam;
(function() {
adrma.init.dfd.done(function() {
var e = adrma.pageInfo,
d = e.pageId,
f = e.pageType,
a = document.location.protocol === "http:" ? "http://" : "https://",
b = function(j) {
if (!j) {
return ""
}
var h = "",
k = e.urlParams,
g;
if (k.cat1) {
for (g in k) {
if (g.match(/^cat/)) {
h += k[g] + j
}
}
}
return h.substr(0, h.length - j.length)
},
c;
adrma.init.add({
name: "NeedleService",
cb: function() {
if (!adrma.siteSettings.enableNeedleChat) {
return
}
if (f === "myAccountPage") {
return
}
var g = (e.urlParams && e.urlParams.cat1) ? e.urlParams.cat1 : "",
h = decodeURIComponent(g),
j;
needleParam = {
productId: d,
categoryId: h
};
j = $("#FinalPrice").val();
if (j) {
needleParam.productPrice = j
}
adrma.fetchData({
url: a + "adorama.needle.com/needle_service.js",
dataType: "script"
})
},
defer: true
})
});
adrma.init.add({
name: "sidecar",
cb: function() {
window.sidecar = window.sidecar || {};
sidecar.product_info = {
product_id: adrma.pageInfo.pageId
};
adrma.fetchData({
url: "https://d3v27wwd40f0xu.cloudfront.net/js/tracking/sidecar_adorama.js",
dataType: "script"
})
},
defer: true,
delay: 2000
})
})();
adrma.init.add({
name: "fbRemarketing",
cb: function() {
var a = window._fbq || (window._fbq = []),
c = adrma.siteSettings.fbRemarketingPixelID ? adrma.siteSettings.fbRemarketingPixelID : "621836287949794";
if (!a.loaded) {
var b = document.createElement("script");
b.async = true;
b.src = "//connect.facebook.net/en_US/fbds.js";
var d = document.getElementsByTagName("script")[0];
d.parentNode.insertBefore(b, d);
a.loaded = true
}
a.push(["addPixelId", c]);
window._fbq = window._fbq || [];
window._fbq.push(["track", "PixelInitialized", {}])
},
defer: true
});
adrma.init.add({
name: "liveEngage",
cb: function() {
if (!adrma.siteSettings.enableLiveEngage) {
return
}
window.lpTag = window.lpTag || {};
if (typeof window.lpTag._tagCount === "undefined") {
window.lpTag = {
site: "43035670" || "",
section: lpTag.section || "",
autoStart: lpTag.autoStart === false ? false : true,
ovr: lpTag.ovr || {},
_v: "1.5.1",
_tagCount: 1,
protocol: location.protocol,
events: {
bind: function(a, b, c) {
lpTag.defer(function() {
lpTag.events.bind(a, b, c)
}, 0)
},
trigger: function(a, b, c) {
lpTag.defer(function() {
lpTag.events.trigger(a, b, c)
}, 1)
}
},
defer: function(a, b) {
if (b == 0) {
this._defB = this._defB || [];
this._defB.push(a)
} else {
if (b == 1) {
this._defT = this._defT || [];
this._defT.push(a)
} else {
this._defL = this._defL || [];
this._defL.push(a)
}
}
},
load: function(c, a, b) {
var d = this;
setTimeout(function() {
d._load(c, a, b)
}, 0)
},
_load: function(d, a, b) {
var e = d;
if (!d) {
e = this.protocol + "//" + ((this.ovr && this.ovr.domain) ? this.ovr.domain : "lptag.liveperson.net") + "/tag/tag.js?site=" + this.site
}
var c = document.createElement("script");
c.setAttribute("charset", a ? a : "UTF-8");
if (b) {
c.setAttribute("id", b)
}
c.setAttribute("src", e);
document.getElementsByTagName("head").item(0).appendChild(c)
},
init: function() {
this._timing = this._timing || {};
this._timing.start = (new Date()).getTime();
var a = this;
if (window.attachEvent) {
window.attachEvent("onload", function() {
a._domReady("domReady")
})
} else {
window.addEventListener("DOMContentLoaded", function() {
a._domReady("contReady")
}, false);
window.addEventListener("load", function() {
a._domReady("domReady")
}, false)
}
if (typeof(window._lptStop) == "undefined") {
this.load()
}
},
start: function() {
this.autoStart = true
},
_domReady: function(a) {
if (!this.isDom) {
this.isDom = true;
this.events.trigger("LPT", "DOM_READY", {
t: a
})
}
this._timing[a] = (new Date()).getTime()
},
vars: lpTag.vars || [],
dbs: lpTag.dbs || [],
ctn: lpTag.ctn || [],
sdes: lpTag.sdes || [],
ev: lpTag.ev || []
};
lpTag.init()
} else {
window.lpTag._tagCount += 1
}
},
defer: true
});
(function() {
(function() {
if (!window.ADRUM && !0 !== window["adrum-disable"]) {
var b = window.ADRUM = {};
window["adrum-start-time"] = window["adrum-start-time"] || (new Date).getTime();
(function(a) {
a.beaconUrlHttp = "http://col.eum-appdynamics.com";
a.beaconUrlHttps = "https://col.eum-appdynamics.com";
a.appKey = window["adrum-app-key"] || "AD-AAB-AAA-XSH";
var f = "https:" === document.location.protocol;
if (window["adrum-geo-resolver-url"]) {
var h = window["adrum-geo-resolver-url"],
g = h.indexOf("://"); - 1 != g && (h = h.substring(g + 3));
h = (f ? "https://" : "http://") + h
} else {
h = f ? "" : ""
}
a.adrumExtUrl = (f ? "https://cdn.appdynamics.com" : "http://cdn.appdynamics.com") + "/adrum-ext.63e9f33be79086444fbb75051659bdae.js";
a.sendImageBeacon = "false";
a.geoResolverUrl = h;
a.useStrictDomainCookies = !0 === window["adrum-use-strict-domain-cookies"];
a.k;
(function(c) {
function d(e) {
return 0 <= e.location.search.indexOf("ADRUM_debug=true") || 0 <= e.cookie.search(/(^|;)\s*ADRUM_debug=true/)
}
c.xd = d;
c.iDR = d
})(a.a || (a.a = {}));
a.isDebug = a.a.xd(document);
a.conf = window["adrum-config"]
})(b || (b = {}));
(function(f) {
f.logMessages = [];
f.debug;
f.warn;
f.info;
f.error;
for (var g = ["debug", "warn", "info", "error"], j = 0; j < g.length; j++) {
(function(c) {
f[c] = function(l, e) {
f.isDebug && f.logMessages.push([c, Array.prototype.slice.call(arguments).join(" | ")])
}
})(g[j])
}
var h = 0;
(function(c) {
window.ADRUM.TPL = c;
c.ea = function(m, o, n, l) {
m = n + "/eumcollector/error.gif?version=1&appKey=" + l + "&msg=" + encodeURIComponent(m.substring(0, 500));
o && (m += "&stack=", m += encodeURIComponent(o.substring(0, 1500 - m.length)));
return m
};
c.cIEBU = c.ea;
c.p = function(d, e) {
2 <= h || ((new Image).src = c.ea(d, e, f.beaconUrlHttps, f.appKey), h++)
};
c.dumpLog = f.isDebug ? function() {
for (var n = "", m = 0; m < f.logMessages.length; m++) {
var l = f.logMessages[m],
n = n + ("[" + l[0] + "]\t" + l[1].replace(RegExp("<br/>", "g"), "\n\t") + "\n")
}
return n
} : function() {}
})(f.a || (f.a = {}));
var a = f.a,
k = f.error;
f.error = function() {
for (var c = 0; c < arguments.length - 0; c++) {}
0 < arguments.length && (c = Array.prototype.slice.call(arguments).join(" | "), k(c), a.p(c, null))
};
f.exception = function() {
if (!(1 > arguments.length)) {
var c = Array.prototype.slice.call(arguments),
d;
d = (d = c[0]) ? (d = d.stack) && "string" === typeof d ? d : null : null;
c = c.slice(1).join(" | ");
k(c);
a.p(c, d)
}
};
f.assert = function(l, c) {
l || f.error("Assert fail: " + c)
};
f.info("M0")
})(b || (b = {}));
(function(a) {
(function(d) {
var f = function() {
function c() {
this.Hb = [];
this.bb(c.lb, 0)
}
c.prototype.Za = function(e) {
this.bb(c.Tb, e)
};
c.prototype.vb = function(e) {
this.bb(c.Wb, e)
};
c.prototype.$a = function(e) {
this.bb(c.Ub, e)
};
c.prototype.bb = function(g, h) {
this.Hb.push({
Ed: (new Date).getTime(),
Dd: h,
mc: g
});
this.hd = g
};
c.prototype.getPhaseID = function(e) {
for (var g = 0; g < c.Vb.length; g++) {
if (c.Vb[g] === e) {
return g
}
}
return null
};
c.prototype.getPhaseCallbackTime = function(g) {
for (var j = this.Hb, h = 0; h < j.length; h++) {
if (j[h].mc === g) {
return j[h].Ed
}
}
return null
};
c.prototype.findPhaseAtNominalTime = function(e) {
a.assert(0 <= e);
for (var h = this.Hb, g = h.length - 1; 0 <= g; g--) {
if (e >= h[g].Dd) {
return h[g].mc
}
}
a.error("M1", e, a.EXT.Zb(h));
return c.lb
};
c.lb = "AFTER_FIRST_BYTE";
c.Tb = "AFTER_DOM_INTERACTIVE";
c.Wb = "AT_ONLOAD";
c.Ub = "AFTER_ONLOAD";
c.Vb = [c.lb, c.Tb, c.Wb, c.Ub];
return c
}();
d.Ra = f
})(a.a || (a.a = {}))
})(b || (b = {}));
(function(a) {
(function(d) {
d.sc = function(c) {
setTimeout(c, 0)
};
d.fd = function() {
a.navTiming = null;
var h = window.performance || window.f || window.g || window.i;
if (h && h.timing) {
if (h = h.timing, h.navigationStart && h.navigationStart <= h.loadEventEnd) {
var g = {},
f;
for (f in h) {
var j = h[f];
"number" === typeof j && (g[f] = j)
}
a.navTiming = g
} else {
a.debug("M2")
}
}
};
d.gd = function() {
a.resTiming = null;
var c = window.performance || window.f || window.g || window.i;
c && c.getEntriesByType && ((c = c.getEntriesByType("resource")) && c.length && 0 !== c.length && c.unshift ? (a.resTiming = c, a.navTiming ? (c = a.navTiming, c.initiatorType = "other", c.name = document.URL, c.navigationStart && !c.startTime && (c.startTime = c.navigationStart), c.isBase = !0) : c = null, c && a.resTiming.unshift(c)) : a.debug("M3"))
};
d.parseURI = function(c) {
return (c = String(c).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/)) ? {
href: c[0] || "",
protocol: c[1] || "",
na: c[2] || "",
host: c[3] || "",
hostname: c[4] || "",
port: c[5] || "",
pathname: c[6] || "",
search: c[7] || "",
hash: c[8] || ""
} : null
};
d.absolutizeURI = function(e, f) {
function c(g) {
var h = [];
g.replace(/^(\.\.?(\/|$))+/, "").replace(/\/(\.(\/|$))+/g, "/").replace(/\/\.\.$/, "/../").replace(/\/?[^\/]*/g, function(j) {
"/.." === j ? h.pop() : h.push(j)
});
return h.join("").replace(/^\//, "/" === g.charAt(0) ? "/" : "")
}
f = d.parseURI(f || "");
e = d.parseURI(e || "");
return f && e ? (f.protocol || e.protocol) + (f.protocol || f.na ? f.na : e.na) + c(f.protocol || f.na || "/" === f.pathname.charAt(0) ? f.pathname : f.pathname ? (e.na && !e.pathname ? "/" : "") + e.pathname.slice(0, e.pathname.lastIndexOf("/") + 1) + f.pathname : e.pathname) + (f.protocol || f.na || f.pathname ? f.search : f.search || e.search) + f.hash : null
};
d.getFullyQualifiedUrl = function(f) {
try {
return d.absolutizeURI(document.location.href, f)
} catch (c) {
return a.exception(c, "M4", f, document.location.href), f
}
};
d.isArray = function(c) {
return "[object Array]" === Object.prototype.toString.call(c)
}
})(a.a || (a.a = {}))
})(b || (b = {}));
(function(a) {
(function(c) {
c.Qa = 100;
c.ya = 100
})(a.a || (a.a = {}));
var f = a.a,
h = function() {
function c(d) {
this.max = d;
this.ob = 0
}
c.prototype.vd = function() {
this.Wa() || this.ob++
};
c.prototype.Wa = function() {
return this.ob >= this.max
};
c.prototype.reset = function() {
this.ob = 0
};
return c
}(),
g = function() {
function c() {
this.Ta = [];
this.Ab = new h(f.Qa);
this.ub = new h(f.ya)
}
c.prototype.submit = function(d) {
this.push(d) && a.initEXTDone && this.processQ()
};
c.prototype.processQ = function() {
for (var l = this.Ca(), k = 0; k < l.length; k++) {
var j = l[k];
"function" === typeof a.EXT.G[j[0]] ? (a.isDebug && a.debug("M5", j[0], j.slice(1).join(", ")), a.EXT.G[j[0]].apply(a, j.slice(1))) : a.error("M6", j[0])
}
};
c.prototype.zd = function(d) {
return "reportXhr" === d || "reportError" === d
};
c.prototype.push = function(m) {
var l = m[0],
k = this.zd(l),
j = k ? this.Ab : this.ub;
if (j.Wa()) {
return a.debug("M7", k ? "spontaneous" : "non spontaneous", l), !1
}
this.Ta.push(m);
j.vd();
return !0
};
c.prototype.Ca = function() {
var d = this.Ta;
this.reset();
return d
};
c.prototype.size = function() {
return this.Ta.length
};
c.prototype.reset = function() {
this.Ta = [];
this.Ab.reset();
this.ub.reset()
};
c.prototype.isSpontaneousQueueDead = function() {
return this.Ab.Wa()
};
c.prototype.isNonSpontaneousQueueDead = function() {
return this.ub.Wa()
};
return c
}();
a.Cc = g
})(b || (b = {}));
(function(a) {
a.q = new a.Cc;
a.command = function(d, f) {
a.isDebug && a.debug("M8", d, Array.prototype.slice.call(arguments).slice(1).join(", "));
a.q.submit(Array.prototype.slice.call(arguments))
}
})(b || (b = {}));
(function(a) {
(function(d) {
window.ADRUM.aop = d;
d.support = function(c) {
return !c || "apply" in c
};
d.around = function(g, f, c, h) {
a.assert(d.support(g), "aop.around called on a function which does not support interception");
g = g || function() {};
return function() {
a.isDebug && a.debug("M9", h, Array.prototype.slice.call(arguments).join(", "));
var j = Array.prototype.slice.call(arguments),
e;
try {
f && (e = f.apply(this, j))
} catch (o) {
a.exception(o, "M10", h, o)
}
a.assert(!e || "[object Array]" === Object.prototype.toString.call(e));
var k = void 0;
try {
k = g.apply(this, e || j)
} finally {
try {
c && c.apply(this, j)
} catch (p) {
a.exception(p, "M11", h, p)
}
}
return k
}
};
d.before = function(c, e) {
return d.around(c, e)
};
d.after = function(c, e) {
return d.around(c, null, e)
}
})(a.b || (a.b = {}))
})(b || (b = {}));
(function(a) {
a.initEXTDone = !1;
a.addEventListener = function(g, j, h) {
function f() {
try {
return h.apply(this, Array.prototype.slice.call(arguments))
} catch (c) {
a.exception(c, "M13", j, g, c)
}
}
a.isDebug && a.debug("M12", j, g);
g.addEventListener ? g.addEventListener(j, f, !1) : g.attachEvent && g.attachEvent("on" + j, f)
};
a.compareWindows = function(c, d) {
return c == d
};
a.lifecycle = new a.a.Ra;
a.listenForErrors = null;
(function() {
var d = !1;
a.listenForErrors = function() {
a.b.support(window.onerror) ? (window.onerror = a.b.around(window.onerror, function(g, f, c) {
d || a.command("reportError", g, f, c);
d = !0
}, function() {
d = !1
}, "onerror"), a.windowErrorHandler = window.onerror, a.info("M14")) : a.info("M15")
}
})();
a.windowErrorHandler = window.onerror;
a.navTiming = null;
a.resTiming = null;
a.j = function(d) {
a.lifecycle.vb(d && d.timeStamp);
a.a.sc(function() {
var c = (new Date).getTime();
a.lifecycle.$a(c);
a.command("mark", "onload", c);
a.a.fd();
a.a.gd();
a.command("reportOnload");
a.e()
});
a.info("M16")
};
a.h = function() {
function g(c) {
document.addEventListener ? (document.removeEventListener("DOMContentLoaded", g, !1), k(c)) : "complete" === document.readyState && (document.detachEvent("onreadystatechange", g), k(c))
}
function k(c) {
j || (a.lifecycle.Za(c && c.timeStamp), a.command("mark", "onready", (new Date).getTime()), j = !0)
}
var j = !1;
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", g, !1), window.addEventListener("load", k, !1)
} else {
document.attachEvent("onreadystatechange", g);
window.attachEvent("onload", k);
var f = null;
try {
f = null === window.frameElement ? document.documentElement : null
} catch (m) {}
null != f && f.doScroll && function l() {
try {
f.doScroll("left")
} catch (c) {
setTimeout(l, 10);
return
}
k()
}()
}
a.info("M17")
};
a.e = function() {
var d = document.createElement("script");
d.async = !0;
d.src = a.adrumExtUrl;
var f = document.getElementsByTagName("script")[0];
f ? (f.parentNode.insertBefore(d, f), a.info("M18")) : a.info("M19")
}
})(b || (b = {}));
(function(a) {
a.startTimeCookie = null;
a.cookieMetadataChunks = null;
(function(d) {
d.L = function(k, j) {
function g(c) {
var l = [],
h = E.exec(c);
if (h) {
c = h[1];
var h = h[2].replace(/^"|"$/g, ""),
h = decodeURIComponent(h).split("|"),
m = h[0].split(":");
if ("R" === m[0] && Number(m[1]) === v) {
for (o(c), c = 1; c < h.length; c++) {
l.push(h[c])
}
}
}
return l
}
function F(h) {
if (h = x.exec(h)) {
var n = h[1],
m = h[4],
l = h[5];
if (Number(h[3]) === v) {
return o(n), [Number(m), l]
}
}
return null
}
function f(h) {
var c = w.exec(h);
c && (a.debug("M22", h), 3 === c.length ? (a.startTimeCookie = {
startTime: Number(c[1]),
startPage: c[2]
}, o("ADRUM")) : a.error("M23", h))
}
function o(h) {
a.debug("M21", h);
var c = new Date;
c.setTime(c.getTime() - 1000);
document.cookie = h + "=;Expires=" + c.toUTCString()
}
a.info("M20");
for (var w = /^\s*ADRUM=s=([\d]+)&r=(.*)\s*/, v = j ? j.length : 0, x = /^\s*(ADRUM_(\d+)_(\d+)_(\d+))=(.*)\s*$/i, y = [], A = k.split(";"), B = 0; B < A.length; B++) {
var C = A[B],
D = F(C);
D ? y.push(D) : f(C)
}
Array.prototype.sort.call(y, function(c, h) {
return c[0] - h[0]
});
C = [];
for (B = 0; B < y.length; B++) {
C.push(y[B][1])
}
for (var E = /^\s*(ADRUM_BT\w*)=(.*)\s*$/i, B = 0; B < A.length; B++) {
(y = g(A[B])) && 0 < y.length && (C = C.concat(y))
}
a.cookieMetadataChunks = C
};
d.eck = d.L
})(a.a || (a.a = {}))
})(b || (b = {}));
(function(a) {
(function(c) {
c.Xb = function() {
return function(h, g) {
if (("load" === h || "error" === h) && g && this._adrumXhrData) {
var j;
j = g;
if (j.__adrumInterceptor) {
j = j.__adrumInterceptor
} else {
if (a.b.support(j)) {
var f = a.c.Yb(j, this, "XHR.invokeEventListener");
j = j.__adrumInterceptor = f
} else {
j = null
}
}
if (j) {
return f = Array.prototype.slice.call(arguments), f[1] = j, a.debug("M24"), f
}
a.debug("M25", h, g)
}
}
}
})(a.a || (a.a = {}));
var d = a.a;
(function(g) {
if (!0 === window["adrum-xhr-disable"]) {
a.info("M26")
} else {
if (window.XMLHttpRequest) {
var f = a.conf && a.conf.xhr,
c = f && f.include && f.include.urls;
if (c) {
for (var q = 0; q < c.length; q++) {
var n = c[q];
if ("regex" !== n.type || "string" !== typeof n.pattern) {
a.exception("only regex pattern type is supported in the xhr filter, pattern should be a string")
} else {
try {
n.oc = new RegExp(n.pattern)
} catch (j) {
a.exception(j, "Parse regex pattern failed.")
}
}
}
}
g.H = window.XMLHttpRequest.prototype;
if (g.H) {
if ("open" in g.H && "send" in g.H) {
if (a.b.support(g.H.open) && a.b.support(g.H.send)) {
a.info("M31");
a.xhrOpen = g.H.open;
a.xhrSend = g.H.send;
g.ec = function(l) {
var k = l._adrumXhrData;
if (k) {
var h = (new Date).getTime();
2 == l.readyState ? k.firstByteTime = k.firstByteTime || h : 4 == l.readyState && (a.assert(null === k.respAvailTime, "M32"), k.respAvailTime = k.respAvailTime || h, k.firstByteTime = k.firstByteTime || h)
}
};
g.d = function(l, k) {
var h = l.getAllResponseHeaders(),
m = l.status;
a.command("reportXhr", k, h, m, 400 <= m ? l.responseText : null)
};
g.Yb = function(h, e, k) {
return p(h, function() {
g.ec(this)
}, function() {
var l = e._adrumXhrData;
if (l && 4 == e.readyState) {
var m = (new Date).getTime();
a.assert(null === l.respProcTime, "M33");
l.respProcTime = l.respProcTime || m;
g.d(e, l);
delete e._adrumXhrData
}
}, k)
};
g.eb = function(h) {
if (h._adrumXhrData) {
var e = (new Date).getTime() + 30000,
k = function() {
g.ec(h);
var l = h._adrumXhrData;
if (l) {
var m = (new Date).getTime();
4 == h.readyState ? (a.assert(null === l.respProcTime, "M34"), l.respProcTime = l.respProcTime || m, a.debug("M35"), g.d(h, l), delete h._adrumXhrData) : m < e ? setTimeout(k, 50) : (delete h._adrumXhrData, a.debug("M36"))
}
};
k()
}
};
var p = function(m, l, k, r) {
var h = m;
m && "object" === typeof m && "toString" in m && "[xpconnect wrapped nsIDOMEventListener]" === m.toString() && "handleEvent" in m && (h = function() {
m.handleEvent.apply(this, Array.prototype.slice.call(arguments))
});
return a.b.around(h, l, k, r)
};
g.H.open = a.b.around(g.H.open, function() {
var l = 2 <= arguments.length ? String(arguments[1]) : "",
m = !0,
s = f && f.include.urls;
if (l && s) {
for (var m = !1, h = d.getFullyQualifiedUrl(l), k = 0; k < s.length; k++) {
var r = s[k];
if (r.oc && r.oc.test(h)) {
m = !0;
break
}
}
}
m && (this._adrumXhrData = {
url: l,
sendTime: null,
firstByteTime: null,
respAvailTime: null,
respProcTime: null,
parentPhase: null
})
}, null, "XHR.open");
var o = function(h) {
var k = document.createElement("a");
k.href = h;
h = document.location;
return ":" === k.protocol && "" === k.hostname && "" === k.port || k.protocol === h.protocol && k.hostname === h.hostname && k.port === h.port
};
g.H.send = a.b.around(g.H.send, function() {
var l = this,
k = l._adrumXhrData;
if (k) {
var m = (new Date).getTime();
a.assert(null === k.sendTime, "M37");
k.sendTime = k.sendTime || m;
k.parentPhase = a.lifecycle.hd;
o(k.url) ? l.setRequestHeader("ADRUM", "isAjax:true") : a.debug("M38", document.location.href, k.url);
var e = 0,
h = function() {
if (4 == l.readyState) {
a.debug("M39"), g.eb(l)
} else {
var r = null;
try {
r = l.onreadystatechange
} catch (s) {
a.debug("M40", s);
g.eb(l);
return
}
e++;
r ? a.b.support(r) ? (l.onreadystatechange = g.Yb(r, l, "XHR.onReadyStateChange"), a.debug("M41", e)) : (a.debug("M42"), g.eb(l)) : 5 > e ? a.a.sc(h) : (a.debug("M43"), g.eb(l))
}
};
h()
}
}, null, "XHR.send");
"addEventListener" in g.H && "removeEventListener" in g.H && a.b.support(g.H.addEventListener) && a.b.support(g.H.removeEventListener) ? (g.H.addEventListener = a.b.around(g.H.addEventListener, a.a.Xb(), null, "XHR.addEventListener"), g.H.removeEventListener = a.b.around(g.H.removeEventListener, function(l, k) {
if (this._adrumXhrData) {
var h = Array.prototype.slice.call(arguments);
k.__adrumInterceptor ? (h[1] = k.__adrumInterceptor, a.debug("M44")) : a.debug("M45");
return h
}
}, null, "XHR.removeEventListener")) : a.debug("M46");
a.info("M47")
} else {
a.info("M30")
}
} else {
a.info("M29")
}
} else {
a.info("M28")
}
} else {
a.info("M27")
}
}
})(a.c || (a.c = {}))
})(b || (b = {}));
(function() {
"APP_KEY_NOT_SET" === window.ADRUM.appKey && "undefined" !== typeof console && "undefined" !== typeof console.log && console.log("AppDynamics EUM cloud application key missing. Please specify window['adrum-app-key']");
var a = window.ADRUM;
a.a.L(document.cookie, document.referrer);
a.command("mark", "firstbyte", window["adrum-start-time"]);
a.listenForErrors();
a.addEventListener(window, "load", a.j);
a.h()
})(b || (b = {}))
}
})()
})();
ADRUM.command("setPageName", adrma.pageInfo.pageType);
adrma.init.add({
name: "criteo",
cb: function() {
if (adrma.siteSettings.enableCriteo === false) {
return
}
var e = adrma.pageInfo,
f = e.pageType,
d, b = true;
window.criteo_q = window.criteo_q || [];
window.criteo_q.push({
event: "setAccount",
account: 2450
}, {
event: "setSiteType",
type: adrma.is.mobile ? "m" : adrma.is.touch ? "t" : "d"
});
switch (f) {
case "homePage":
window.criteo_q.push({
event: "viewHome"
});
break;
case "productPage":
window.criteo_q.push({
event: "viewItem",
item: e.id
});
break;
case "listPage":
d = $.map($(".item-list [data-sku]:lt(3)"), function(g, h) {
return $(g).attr("data-sku")
});
window.criteo_q.push({
event: "viewList",
item: d
});
break;
case "cartPage":
b = $.Deferred();
$.subscribe("cartPage/initRender", function a() {
if (!adrma.cartPage.data || !adrma.cartPage.data.items) {
b.reject()
}
d = $.map(adrma.cartPage.data.items, function(g) {
return {
id: g.sku,
price: g.unitPrice,
quantity: g.qty
}
});
window.criteo_q.push({
event: "viewBasket",
item: d
});
b.resolve()
})
}
adrma.session.getSession.done(function c(h) {
if (h.email) {
window.criteo_q.push({
event: "setEmail",
email: h.email
})
}
$.when(b).done(function g() {
adrma.fetchData({
url: "//static.criteo.net/js/ld/ld.js",
dataType: "script"
})
})
})
},
defer: true
});
adrma.init.add({
name: "owneriq",
cb: function() {
if (adrma.siteSettings.enableOwneriq === false) {
return
}
window._oiqq = window._oiqq || [];
_oiqq.push(["oiq_addPageLifecycle", "inte"]);
_oiqq.push(["oiq_doTag"]);
(function() {
var a = document.createElement("script");
a.type = "text/javascript";
a.async = true;
a.src = document.location.protocol + "//px.owneriq.net/stas/s/adoram.js";
var b = document.getElementsByTagName("script")[0];
b.parentNode.insertBefore(a, b)
})()
},
defer: true
});
adrma.init.add({
name: "upsellit",
cb: function() {
if (adrma.siteSettings.enableUpsellit === false) {
return
}
adrma.fetchData({
url: "//www.upsellit.com/active/adorama.jsp",
dataType: "script",
})
},
defer: true,
delay: 5000
});
adrma.init.add({
cb: function init() {
if (adrma.siteSettings.enablePhoneTracking === false) {
return
}
if (adrma.pageInfo.cKeys && adrma.pageInfo.cKeys.mode) {
return
}(function(k, j, m, n, o, p) {
var l, q = {
ga_wpid: adrma.siteSettings.GoogleAnalyticsID,
replace: adrma.siteSettings.CompanyCallFreePhone
};
k[m] = k[m] || function() {
(k[m].q = k[m].q || []).push(arguments)
};
j.getElementById(o) || (l = j.createElement(p), l.id = o, l.async = 1, l.src = "//www.gstatic.com/gaphone/loader.js", j = j.getElementsByTagName(p)[0], j.parentNode.insertBefore(l, j));
k[n] = function(b, d, f) {
k[m](1, new Date, q, {
receiver: b,
destination: d
}, f)
};
k[n]()
})(window, document, "_gaPhoneImpl", "_gaReplaceNumber", "_gaPhoneLoader", "script")
},
defer: true,
delay: 2000
});
(function(a, d, g, h) {
if (adrma.siteSettings.hasOwnProperty("enableErrorception") && !adrma.siteSettings.enableErrorception) {
return
}
_errs = [h];
var b = a.onerror;
a.onerror = function() {
var c = arguments;
_errs.push(c);
b && b.apply(this, c)
};
adrma.init.add({
name: "loadErrorception",
cb: function f() {
var j = d.createElement(g),
e = d.getElementsByTagName(g)[0];
j.src = "//beacon.errorception.com/" + h + ".js";
j.async = !0;
e.parentNode.insertBefore(j, e)
},
defer: true
})
})(window, document, "script", "51c092304e91d7a77f000413");
adrma.RR = function(a) {
return this
};
adrma.RR.prototype = {
RRLayerUrl: "//media.richrelevance.com/rrserver/js/1.0/p13n.js",
apiKey: "",
baseUrl: "//RRMODE.richrelevance.com/rrserver/",
clickthruServer: window.location.protocol + "//" + window.location.host,
modes: ["", "recs", "recs", "integration", "integration"],
init: function init(b) {
var e = this,
a = $.Deferred(),
f = adrma.siteSettings,
d = e.RRSettingsMode = +f.RichRelevanceIntegrationMode,
c = adrma.pageInfo.pageType;
if (f.enableDdosMode || d === 0) {
return a.reject("disabled")
}
if (f.HideRichRelevanceOnReceipt && c === "receiptPage") {
return a.reject("disabled")
}
$.extend(e, e.defaults, b);
e.baseUrl = e.baseUrl.replace("RRMODE", e.modes[d]);
$.when(adrma.fetchData({
url: e.RRLayerUrl,
dataType: "script",
returnPromise: true
}), adrma.session.getSession, adrma.template.get("RRTmpl")).done(function() {
RR.jsonCallback = function() {
e.renderView(RR.data.JSON.placements)
};
R3_COMMON = new r3_common();
R3_COMMON.setApiKey(e.apiKey);
R3_COMMON.setBaseUrl(e.baseUrl);
R3_COMMON.setUserId(adrma.session.session.sid);
R3_COMMON.setSessionId(adrma.session.session.sid);
e.setPlacments()
});
return a.promise()
},
getPrices: function getPrices(c) {
var d = this,
b = $.Deferred(),
a = c.data || c.items;
if (!a) {
return b.reject()
}
var e = $.map((a), function(f, g) {
return f.id
}).join(",");
adrma.getProductData(e, {
directData: true
}).done(function(f) {
b.resolve(d.mashData(c, f))
});
return b
},
mashData: function mashData(b, e) {
if (e.status === "success") {
var a, g, f = this,
d = e.data,
c = $.map(b.data, function(h, j) {
a = h.id;
g = d[a];
if (f.limit && j >= f.limit) {
return
}
if (g) {
h.prices = g.prices
}
if (g && g.rating) {
h.rating = g.rating
}
if (g && g.freeShipping) {
h.freeShipping = true
}
if (h.stock === "Discontinued" || g.stock === "Discontinued") {
return
}
return h
});
b.data = c;
return b
}
},
setPlacments_BrandPage: function brandpage() {
R3_COMMON.setPageBrand(adrma.pageInfo.id);
R3_COMMON.addPlacementType("brand_page.rr1");
if (!window.r3_brand) {
return
}
R3_BRAND = new r3_brand();
rr_flush_onload();
r3()
},
setPlacments: function setPlacments() {
var d = adrma.pageInfo,
e = this,
a;
switch (d.pageType) {
case "couponsPage":
e.limit = 6;
case "homePage":
case "receiptPage":
case "topCategoryList":
if (d.pageType === "topCategoryList") {
e.limit = 5
}
if (d.pageType === "receiptPage") {
e.limit = 3
}
R3_COMMON.addPlacementType("home_page.json");
R3_COMMON.addPlacementType("home_page.json2");
R3_HOME = new r3_home();
rr_flush_onload();
r3();
break;
case "topCategory":
e.limit = 3;
R3_COMMON.addPlacementType("category_page.right_json");
R3_CATEGORY = new r3_category();
R3_CATEGORY.setId(d.id);
R3_CATEGORY.setName(d.shortTitle);
rr_flush_onload();
r3();
break;
case "listPage":
if (adrma.pageInfo.subPageType === "brandList") {
e.setPlacments_BrandPage();
break
}
var b = $(".item-list .item:visible");
if (b.length < 5) {
e.limit = 2
}
R3_COMMON.addPlacementType("category_page.right_json");
R3_CATEGORY = new r3_category();
b.each(function c(g, f) {
if (g > 14) {
return false
}
R3_CATEGORY.addItemId(f.getAttribute("data-sku"))
});
R3_CATEGORY.setId(d.id);
rr_flush_onload();
r3();
break;
case "productPage":
R3_ITEM = new r3_item();
R3_ITEM.setId(d.id);
R3_ITEM.setRecommendable(true);
R3_COMMON.addPlacementType("item_page.bottom_json");
rr_flush_onload();
r3();
break;
case "topBrands":
e.setPlacments_BrandPage();
break;
case "cartPage":
window.R3_CART = new r3_cart();
adrma.cartPage.gotCartPageSummary.done(function() {
var f = (adrma.cartPage && adrma.cartPage.data && adrma.cartPage.data.items) ? adrma.cartPage.data.items : {};
if (window.R3_CART) {
$.each(f, function(h, g) {
R3_CART.addItemId(g.sku)
})
}
R3_COMMON.addPlacementType("cart_page.json");
rr_flush_onload();
r3()
});
break
}
},
renderView: function renderView(c) {
var f = this,
a = 0,
d = c.length,
b, g, e = function e(h) {
g = tmpl("RRTmpl", h);
$("#" + h.id).html(g).removeClass("loading-RR hide");
$.publish("RR-rendered", h.id)
};
if (f.RRSettingsMode === 2) {
return
}
for (; a < d; a++) {
b = c[a];
f.getPrices(b).done(e)
}
},
saveSettings: function saveSettings(a) {
if (!a) {
return
}
adrma.storage.set("session", "showRR", a.show)
},
bindActions: function bindActions() {
var b = this;
adrma.actions.add({
rrTurnOff: function a(c, d) {
d.closest(".hoverTips").remove();
$(".rich-relevance").fadeOut(500);
b.saveSettings({
show: false
})
}
})
}
};
adrma.init.add({
name: "richRelevance",
cb: function() {
if (adrma.pageInfo.siteId === "AD" && adrma.pageInfo.pageType === "cartPage" && !adrma.siteSettings.enableRR) {
return
}
var f = adrma.pageInfo.pageType,
a = f == "homePage",
b = f == "productPage",
d = adrma.mediaQuery.matches("small"),
c = adrma.mediaQuery.matches("smallMedium"),
g, e, h;
if ((a && d) || (b && d)) {
return
}
if (adrma.storage.get("session", "showRR") === false) {
return
}
g = new adrma.RR();
g.bindActions();
g.init({
apiKey: adrma.siteSettings.RichRelevanceApiKey,
limit: e
})
},
defer: true
});
adrma.filtersSearch = {
filtersSearchSelector: "#filtersSearch",
refinedSearchTermName: "refinedSearchTerm",
limit: 6,
filtersSearchValOriginal: "",
shownSuggestions: 0,
categoriesCount: 0,
wordMatches: [],
init: function init() {
var a = this;
a.bindActions();
if (!adrma.siteSettings.AllowListingAndSearchPageSearchBoxTypeAhead) {
return
}
a.fetchTypeaheadScript().done(function() {
a.collectData();
a.initAutocomplete()
})
},
substringMatcher: function(d, b) {
var c = this;
return function a(h, e) {
var g, k, j;
if (c.shownSuggestions >= c.limit) {
return
}
g = [];
j = [];
for (var f = 0; f < d.length; f++) {
k = d[f];
if (k.value.toLowerCase().indexOf(h.toLowerCase()) === 0) {
g.push(k);
c.shownSuggestions++;
if (c.shownSuggestions >= c.limit) {
break
}
} else {
if (c.isInnerWordMatches(k.value, h)) {
j.push(k)
}
}
}
c.wordMatches.push({
cb: e,
suggestions: g,
subSuggestions: j
});
c.mapMatches()
}
},
mapMatches: function() {
var e = this,
c = e.wordMatches,
f = 0,
b = {},
d = function(g) {
var h, k;
for (h = 0; h < c.length; h++) {
if (f >= e.limit) {
break
}
b[h] = b[h] || [];
for (k = 0; k < c[h][g].length; k++) {
if (f >= e.limit) {
break
}
b[h].push(c[h][g][k]);
f++
}
}
};
d("suggestions");
d("subSuggestions");
for (var a = 0; a < c.length; a++) {
c[a].cb(b[a], true)
}
},
isInnerWordMatches: function isInnerWordMatches(d, c) {
var a;
d = d.toLowerCase();
c = c.toLowerCase();
a = d.split(" ");
for (var b = 1; b < a.length; b++) {
if (a[b].indexOf(c) === 0) {
return true
}
}
return false
},
bindActions: function bindActions() {
var b = this,
a = $(b.filtersSearchSelector);
a.on("typeahead:selected", function(f, g, d) {
b.onTypeaheadSelected(g)
});
a.on("keydown", function() {
b.shownSuggestions = 0;
b.wordMatches = [];
setTimeout(function() {
b.filtersSearchValOriginal = $(b.filtersSearchSelector).val().trim()
})
});
adrma.actions.add({
submitFilterSearch: function c(d, g) {
var f = g,
h = f.find("[name=" + b.refinedSearchTermName + "]"),
j = a.val().trim();
if (!j) {
d.preventDefault();
return
}
b.onSubmitFilterSearch({
refinedSearchTermEle: h,
filtersSearchVal: j
});
b.disableEmptyFormInputs(f)
}
})
},
fetchTypeaheadScript: function fetchTypeaheadScript() {
var a = $.Deferred();
if ($.fn.typeahead) {
return a.resolve()
}
return adrma.fetchData({
url: "/sup/js/plugins/typeahead.js",
dataType: "script",
returnPromise: true
})
},
collectData: function collectData() {
var f = this,
a = $("[data-filter-category-name]"),
b, c, d;
f.settings = {
highlight: true,
classNames: {
menu: "tt-dropdown-menu"
}
};
f.data = [];
f.categoriesCount = a.length;
for (var e = 0; e < a.length; e++) {
b = $(a[e]);
d = f.getCategoryFilters(b);
c = {
source: f.substringMatcher(d, e),
templates: {
header: '<h3 class="filter-category-title">' + b.attr("data-filter-category-name") + "</h3>",
suggestion: function(g) {
return '<p class="filter-item">' + g.value + "</p>"
}
},
display: function(g) {
return g.value
}
};
f.data.push(c)
}
},
initAutocomplete: function initAutocomplete() {
var b = this,
a = $(b.filtersSearchSelector);
a.typeahead(b.settings, b.data).closest(".filter-search").addClass("filter-search-initialized")
},
getCategoryFilters: function getCategoryFilters(a) {
var k = this,
g = a.find("[data-filter-name]:not([data-selected-filter])"),
b = a.attr("data-filter-category-name"),
e, f, h, c = [],
d = {};
for (var j = 0; j < g.length; j++) {
e = $(g[j]);
h = e.attr("data-filter-name");
if (!d[h]) {
f = {
id: e.attr("data-filterid"),
value: h,
href: e.attr("href"),
category: b
};
c.push(f);
d[h] = 1
}
}
return c
},
disableEmptyFormInputs: function disableEmptyFormInputs(a) {
a.find(':input[value=""]').attr("disabled", true)
},
onTypeaheadSelected: function onTypeaheadSelected(a) {
var g = this,
c = a.id,
j = a.value,
b = a.href,
e = adrma.decodeURLToJSON(b),
d = g.getAnalyticsKeyword(),
h, f;
if (a.category !== "Category") {
if (!e.refinedSearchCategory) {
e.refinedSearchCategory = c
} else {
e.refinedSearchCategory = e.refinedSearchCategory + "+" + c
}
h = adrma.decodeJSONToURL(e);
f = b.indexOf("?");
if (f >= 0) {
b = b.substring(0, f)
}
b = b + "?" + h
}
adrma.analytics.addEvent({
category: "listing page",
action: "search within filters",
label: (j + "|" + d).toLowerCase()
});
if (adrma.siteSettings.UseAjaxListingPage) {
adrma.plpDispatcher.applyState({
url: b
});
return
}
location.href = b
},
onSubmitFilterSearch: function onSubmitFilterSearch(a) {
var f = this,
d = a.refinedSearchTermEle,
e = d.val(),
b = f.filtersSearchValOriginal || a.filtersSearchVal,
c = f.getAnalyticsKeyword();
if (!e) {
e = b
} else {
e = e + "|" + b
}
d.val(e);
adrma.analytics.addEvent({
category: "listing page",
action: "search within filters | search",
label: (e + "|" + c).toLowerCase()
})
},
getAnalyticsKeyword: function getAnalyticsKeyword() {
var b = adrma.pageInfo.urlParams,
a = b.term;
return a || $.trim($(".breadcrumbs > div").last().text())
}
};
adrma.init.add({
cb: function() {
adrma.filtersSearch.init()
},
beforeInit: adrma.siteSettings.ShowListingAndSearchPageSearchBox,
defer: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment