﻿// Knockout JavaScript library v1.2.1
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
/*
* SimpleModal 1.4.1 - jQuery Plugin
* http://www.ericmmartin.com/projects/simplemodal/
* Copyright (c) 2010 Eric Martin (http://twitter.com/ericmmartin)
* Dual licensed under the MIT and GPL licenses
* Revision: $Id: jquery.simplemodal.js 261 2010-11-05 21:16:20Z emartin24 $
*/
function encodePassword(a, b, c) { var d = b + ".669"; while (a.length < 15) { a += a } var e = '!"$%^&*()'; var f = "0123456789"; var g = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var h = "abcdefghijklmnopqrstuvwxyz"; var i = 0; var j = ""; for (var k = 0; k < a.length; k++) { var l = a.charCodeAt(k); var m = (l / d).toFixed(5); var n = (m + "").split(".")[1]; i = i * 1 + n * 1; if ((i + "").length < 15) { i = i + "" + k } } for (var k = 0; k < 15; k++) { var o = (i + "").substr(k, 5); var p; if (c && k % 7 == 6) { p = e } else { if (k % 4 == 0) { p = f } else { if (k % 3) { p = h } else { p = g } } } var q = o % p.length; j += p.charAt(q) } return j } (function (a, b) { function h(a, b) { return a === e || typeof a in g ? a === b : !1 } function c(a) { throw a } var d = void 0, e = null, f = a.ko = {}; f.b = function (b, c) { for (var d = b.split("."), e = a, f = 0; f < d.length - 1; f++) e = e[d[f]]; e[d[d.length - 1]] = c }; f.i = function (a, b, c) { a[b] = c }; f.a = new function () { function b(a, b) { if (a.tagName != "INPUT" || !a.type) return !1; if (b.toLowerCase() != "click") return !1; var c = a.type.toLowerCase(); return c == "checkbox" || c == "radio" } var g = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, h = /MSIE 6/i.test(navigator.userAgent), i = /MSIE 7/i.test(navigator.userAgent), j = {}, k = {}; j[/Firefox\/2/i.test(navigator.userAgent) ? "KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"]; j.MouseEvents = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave"]; for (var l in j) { var n = j[l]; if (n.length) for (var q = 0, r = n.length; q < r; q++) k[n[q]] = l } return { ca: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/], g: function (a, b) { for (var c = 0, d = a.length; c < d; c++) b(a[c]) }, h: function (a, b) { if (typeof a.indexOf == "function") return a.indexOf(b); for (var c = 0, d = a.length; c < d; c++) if (a[c] === b) return c; return -1 }, xa: function (a, b, c) { for (var d = 0, f = a.length; d < f; d++) if (b.call(c, a[d])) return a[d]; return e }, N: function (a, b) { var c = f.a.h(a, b); c >= 0 && a.splice(c, 1) }, L: function (a) { for (var a = a || [], b = [], c = 0, d = a.length; c < d; c++) f.a.h(b, a[c]) < 0 && b.push(a[c]); return b }, M: function (a, b) { for (var a = a || [], c = [], d = 0, e = a.length; d < e; d++) c.push(b(a[d])); return c }, K: function (a, b) { for (var a = a || [], c = [], d = 0, e = a.length; d < e; d++) b(a[d]) && c.push(a[d]); return c }, u: function (a, b) { for (var c = 0, d = b.length; c < d; c++) a.push(b[c]) }, Q: function (a) { for (; a.firstChild; ) f.removeNode(a.firstChild) }, Xa: function (a, b) { f.a.Q(a); b && f.a.g(b, function (b) { a.appendChild(b) }) }, ka: function (a, b) { var c = a.nodeType ? [a] : a; if (c.length > 0) { for (var d = c[0], e = d.parentNode, g = 0, h = b.length; g < h; g++) e.insertBefore(b[g], d); g = 0; for (h = c.length; g < h; g++) f.removeNode(c[g]) } }, ma: function (a, b) { navigator.userAgent.indexOf("MSIE 6") >= 0 ? a.setAttribute("selected", b) : a.selected = b }, da: function (a, b) { if (!a || a.nodeType != 1) return []; var c = []; a.getAttribute(b) !== e && c.push(a); for (var d = a.getElementsByTagName("*"), f = 0, g = d.length; f < g; f++) d[f].getAttribute(b) !== e && c.push(d[f]); return c }, k: function (a) { return (a || "").replace(g, "") }, ab: function (a, b) { for (var c = [], d = (a || "").split(b), e = 0, g = d.length; e < g; e++) { var h = f.a.k(d[e]); h !== "" && c.push(h) } return c }, Za: function (a, b) { a = a || ""; if (b.length > a.length) return !1; return a.substring(0, b.length) === b }, Ha: function (a, b) { if (b === d) return (new Function("return " + a))(); return (new Function("sc", "with(sc) { return (" + a + ") }"))(b) }, Fa: function (a, b) { if (b.compareDocumentPosition) return (b.compareDocumentPosition(a) & 16) == 16; for (; a != e; ) { if (a == b) return !0; a = a.parentNode } return !1 }, P: function (a) { return f.a.Fa(a, document) }, t: function (a, d, e) { if (typeof jQuery != "undefined") { if (b(a, d)) var f = e, e = function (a, b) { var c = this.checked; if (b) this.checked = b.Aa !== !0; f.call(this, a); this.checked = c }; jQuery(a).bind(d, e) } else typeof a.addEventListener == "function" ? a.addEventListener(d, e, !1) : typeof a.attachEvent != "undefined" ? a.attachEvent("on" + d, function (b) { e.call(a, b) }) : c(Error("Browser doesn't support addEventListener or attachEvent")) }, qa: function (d, e) { (!d || !d.nodeType) && c(Error("element must be a DOM node when calling triggerEvent")); if (typeof jQuery != "undefined") { var f = []; b(d, e) && f.push({ Aa: d.checked }); jQuery(d).trigger(e, f) } else if (typeof document.createEvent == "function") typeof d.dispatchEvent == "function" ? (f = document.createEvent(k[e] || "HTMLEvents"), f.initEvent(e, !0, !0, a, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, d), d.dispatchEvent(f)) : c(Error("The supplied element doesn't support dispatchEvent")); else if (typeof d.fireEvent != "undefined") { if (e == "click" && d.tagName == "INPUT" && (d.type.toLowerCase() == "checkbox" || d.type.toLowerCase() == "radio")) d.checked = d.checked !== !0; d.fireEvent("on" + e) } else c(Error("Browser doesn't support triggering events")) }, d: function (a) { return f.C(a) ? a() : a }, Ea: function (a, b) { return f.a.h((a.className || "").split(/\s+/), b) >= 0 }, pa: function (a, b, c) { var d = f.a.Ea(a, b); if (c && !d) a.className = (a.className || "") + " " + b; else if (d && !c) { for (var c = (a.className || "").split(/\s+/), d = "", e = 0; e < c.length; e++) c[e] != b && (d += c[e] + " "); a.className = f.a.k(d) } }, Ua: function (a, b) { for (var a = f.a.d(a), b = f.a.d(b), c = [], d = a; d <= b; d++) c.push(d); return c }, U: function (a) { for (var b = [], c = 0, d = a.length; c < d; c++) b.push(a[c]); return b }, S: h, Ma: i, ea: function (a, b) { for (var c = f.a.U(a.getElementsByTagName("INPUT")).concat(f.a.U(a.getElementsByTagName("TEXTAREA"))), d = typeof b == "string" ? function (a) { return a.name === b } : function (a) { return b.test(a.name) }, e = [], g = c.length - 1; g >= 0; g--) d(c[g]) && e.push(c[g]); return e }, F: function (b) { if (typeof b == "string" && (b = f.a.k(b))) { if (a.JSON && a.JSON.parse) return a.JSON.parse(b); return (new Function("return " + b))() } return e }, Y: function (a) { (typeof JSON == "undefined" || typeof JSON.stringify == "undefined") && c(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js")); return JSON.stringify(f.a.d(a)) }, Ta: function (a, b, c) { var c = c || {}, d = c.params || {}, e = c.includeFields || this.ca, g = a; if (typeof a == "object" && a.tagName == "FORM") for (var g = a.action, h = e.length - 1; h >= 0; h--) for (var i = f.a.ea(a, e[h]), j = i.length - 1; j >= 0; j--) d[i[j].name] = i[j].value; var b = f.a.d(b), k = document.createElement("FORM"); k.style.display = "none"; k.action = g; k.method = "post"; for (var l in b) a = document.createElement("INPUT"), a.name = l, a.value = f.a.Y(f.a.d(b[l])), k.appendChild(a); for (l in d) a = document.createElement("INPUT"), a.name = l, a.value = d[l], k.appendChild(a); document.body.appendChild(k); c.submitter ? c.submitter(k) : k.submit(); setTimeout(function () { k.parentNode.removeChild(k) }, 0) } } }; f.b("ko.utils", f.a); f.b("ko.utils.arrayForEach", f.a.g); f.b("ko.utils.arrayFirst", f.a.xa); f.b("ko.utils.arrayFilter", f.a.K); f.b("ko.utils.arrayGetDistinctValues", f.a.L); f.b("ko.utils.arrayIndexOf", f.a.h); f.b("ko.utils.arrayMap", f.a.M); f.b("ko.utils.arrayPushAll", f.a.u); f.b("ko.utils.arrayRemoveItem", f.a.N); f.b("ko.utils.fieldsIncludedWithJsonPost", f.a.ca); f.b("ko.utils.getElementsHavingAttribute", f.a.da); f.b("ko.utils.getFormFields", f.a.ea); f.b("ko.utils.postJson", f.a.Ta); f.b("ko.utils.parseJson", f.a.F); f.b("ko.utils.registerEventHandler", f.a.t); f.b("ko.utils.stringifyJson", f.a.Y); f.b("ko.utils.range", f.a.Ua); f.b("ko.utils.toggleDomNodeCssClass", f.a.pa); f.b("ko.utils.triggerEvent", f.a.qa); f.b("ko.utils.unwrapObservable", f.a.d); Function.prototype.bind || (Function.prototype.bind = function (a) { var b = this, c = Array.prototype.slice.call(arguments), a = c.shift(); return function () { return b.apply(a, c.concat(Array.prototype.slice.call(arguments))) } }); f.a.e = new function () { var a = 0, b = "__ko__" + (new Date).getTime(), c = {}; return { get: function (a, b) { var c = f.a.e.getAll(a, !1); return c === d ? d : c[b] }, set: function (a, b, c) { c === d && f.a.e.getAll(a, !1) === d || (f.a.e.getAll(a, !0)[b] = c) }, getAll: function (d, e) { var f = d[b]; if (!f) { if (!e) return; f = d[b] = "ko" + a++; c[f] = {} } return c[f] }, clear: function (a) { var d = a[b]; d && (delete c[d], a[b] = e) } } }; f.a.p = new function () { function b(b) { var c = a(b, !1); if (c) for (var c = c.slice(0), d = 0; d < c.length; d++) c[d](b); f.a.e.clear(b); typeof jQuery == "function" && typeof jQuery.cleanData == "function" && jQuery.cleanData([b]) } function a(a, b) { var c = f.a.e.get(a, e); c === d && b && (c = [], f.a.e.set(a, e, c)); return c } var e = "__ko_domNodeDisposal__" + (new Date).getTime(); return { ba: function (b, d) { typeof d != "function" && c(Error("Callback must be a function")); a(b, !0).push(d) }, ja: function (b, c) { var g = a(b, !1); g && (f.a.N(g, c), g.length == 0 && f.a.e.set(b, e, d)) }, v: function (a) { if (!(a.nodeType != 1 && a.nodeType != 9)) { b(a); var c = []; f.a.u(c, a.getElementsByTagName("*")); for (var a = 0, d = c.length; a < d; a++) b(c[a]) } }, removeNode: function (a) { f.v(a); a.parentNode && a.parentNode.removeChild(a) } } }; f.v = f.a.p.v; f.removeNode = f.a.p.removeNode; f.b("ko.cleanNode", f.v); f.b("ko.removeNode", f.removeNode); f.b("ko.utils.domNodeDisposal", f.a.p); f.b("ko.utils.domNodeDisposal.addDisposeCallback", f.a.p.ba); f.b("ko.utils.domNodeDisposal.removeDisposeCallback", f.a.p.ja); f.a.Sa = function (a) { if (typeof jQuery != "undefined") a = jQuery.clean([a]); else { var b = f.a.k(a).toLowerCase(), c = document.createElement("div"), b = b.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] || !b.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!b.indexOf("<td") || !b.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || [0, "", ""]; for (c.innerHTML = b[1] + a + b[2]; b[0]--; ) c = c.lastChild; a = f.a.U(c.childNodes) } return a }; f.a.Ya = function (a, b) { f.a.Q(a); if (b !== e && b !== d) if (typeof b != "string" && (b = b.toString()), typeof jQuery != "undefined") jQuery(a).html(b); else for (var c = f.a.Sa(b), g = 0; g < c.length; g++) a.appendChild(c[g]) }; f.l = function () { function b(a, c) { if (a) if (a.nodeType == 8) { var d = f.l.ha(a.nodeValue); d != e && c.push({ Da: a, Pa: d }) } else if (a.nodeType == 1) for (var d = 0, g = a.childNodes, h = g.length; d < h; d++) b(g[d], c) } function a() { return ((1 + Math.random()) * 4294967296 | 0).toString(16).substring(1) } var g = {}; return { V: function (b) { typeof b != "function" && c(Error("You can only pass a function to ko.memoization.memoize()")); var d = a() + a(); g[d] = b; return "<!--[ko_memo:" + d + "]-->" }, ra: function (a, b) { var f = g[a]; f === d && c(Error("Couldn't find any memo with ID " + a + ". Perhaps it's already been unmemoized.")); try { return f.apply(e, b || []), !0 } finally { delete g[a] } }, sa: function (a, c) { var d = []; b(a, d); for (var e = 0, g = d.length; e < g; e++) { var h = d[e].Da, i = [h]; c && f.a.u(i, c); f.l.ra(d[e].Pa, i); h.nodeValue = ""; h.parentNode && h.parentNode.removeChild(h) } }, ha: function (a) { return (a = a.match(/^\[ko_memo\:(.*?)\]$/)) ? a[1] : e } } } (); f.b("ko.memoization", f.l); f.b("ko.memoization.memoize", f.l.V); f.b("ko.memoization.unmemoize", f.l.ra); f.b("ko.memoization.parseMemoText", f.l.ha); f.b("ko.memoization.unmemoizeDomNodeAndDescendants", f.l.sa); f.$a = function (a, b) { this.za = a; this.n = function () { this.La = !0; b() } .bind(this); f.i(this, "dispose", this.n) }; f.Z = function () { var a = []; this.$ = function (b, c) { var d = c ? b.bind(c) : b, e = new f.$a(d, function () { f.a.N(a, e) }); a.push(e); return e }; this.z = function (b) { f.a.g(a.slice(0), function (a) { a && a.La !== !0 && a.za(b) }) }; this.Ja = function () { return a.length }; f.i(this, "subscribe", this.$); f.i(this, "notifySubscribers", this.z); f.i(this, "getSubscriptionsCount", this.Ja) }; f.ga = function (a) { return typeof a.$ == "function" && typeof a.z == "function" }; f.b("ko.subscribable", f.Z); f.b("ko.isSubscribable", f.ga); f.A = function () { var a = []; return { ya: function () { a.push([]) }, end: function () { return a.pop() }, ia: function (b) { f.ga(b) || c("Only subscribable things can act as dependencies"); a.length > 0 && a[a.length - 1].push(b) } } } (); var g = { "undefined": !0, "boolean": !0, number: !0, string: !0 }; f.s = function (a) { function b() { if (arguments.length > 0) { if (!b.equalityComparer || !b.equalityComparer(c, arguments[0])) c = arguments[0], b.z(c); return this } else return f.A.ia(b), c } var c = a; b.o = f.s; b.H = function () { b.z(c) }; b.equalityComparer = h; f.Z.call(b); f.i(b, "valueHasMutated", b.H); return b }; f.C = function (a) { if (a === e || a === d || a.o === d) return !1; if (a.o === f.s) return !0; return f.C(a.o) }; f.D = function (a) { if (typeof a == "function" && a.o === f.s) return !0; if (typeof a == "function" && a.o === f.j && a.Ka) return !0; return !1 }; f.b("ko.observable", f.s); f.b("ko.isObservable", f.C); f.b("ko.isWriteableObservable", f.D); f.Ra = function (a) { arguments.length == 0 && (a = []); a !== e && a !== d && !("length" in a) && c(Error("The argument passed when initializing an observable array must be an array, or null, or undefined.")); var b = new f.s(a); f.a.g(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (a) { b[a] = function () { var c = b(), c = c[a].apply(c, arguments); b.H(); return c } }); f.a.g(["slice"], function (a) { b[a] = function () { var c = b(); return c[a].apply(c, arguments) } }); b.remove = function (a) { for (var c = b(), d = [], e = [], f = typeof a == "function" ? a : function (b) { return b === a }, g = 0, h = c.length; g < h; g++) { var i = c[g]; f(i) ? e.push(i) : d.push(i) } b(d); return e }; b.Va = function (a) { if (a === d) { var c = b(); b([]); return c } if (!a) return []; return b.remove(function (b) { return f.a.h(a, b) >= 0 }) }; b.O = function (a) { for (var c = b(), d = typeof a == "function" ? a : function (b) { return b === a }, e = c.length - 1; e >= 0; e--) d(c[e]) && (c[e]._destroy = !0); b.H() }; b.Ca = function (a) { if (a === d) return b.O(function () { return !0 }); if (!a) return []; return b.O(function (b) { return f.a.h(a, b) >= 0 }) }; b.indexOf = function (a) { var c = b(); return f.a.h(c, a) }; b.replace = function (a, c) { var d = b.indexOf(a); d >= 0 && (b()[d] = c, b.H()) }; f.i(b, "remove", b.remove); f.i(b, "removeAll", b.Va); f.i(b, "destroy", b.O); f.i(b, "destroyAll", b.Ca); f.i(b, "indexOf", b.indexOf); return b }; f.b("ko.observableArray", f.Ra); f.j = function (a, b, d) { function j() { if (arguments.length > 0) if (typeof d.write === "function") { var a = arguments[0]; d.owner ? d.write.call(d.owner, a) : d.write(a) } else c("Cannot write a value to a dependentObservable unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."); else return l || i(), f.A.ia(j), k } function i() { if (l && typeof d.disposeWhen == "function" && d.disposeWhen()) j.n(); else { try { f.A.ya(), k = d.owner ? d.read.call(d.owner) : d.read() } finally { var a = f.a.L(f.A.end()); h(a) } j.z(k); l = !0 } } function h(a) { g(); f.a.g(a, function (a) { r.push(a.$(i)) }) } function g() { f.a.g(r, function (a) { a.n() }); r = [] } var k, l = !1; a && typeof a == "object" ? d = a : (d = d || {}, d.read = a || d.read, d.owner = b || d.owner); typeof d.read != "function" && c("Pass a function that returns the value of the dependentObservable"); var m = typeof d.disposeWhenNodeIsRemoved == "object" ? d.disposeWhenNodeIsRemoved : e, n = e; if (m) { n = function () { j.n() }; f.a.p.ba(m, n); var q = d.disposeWhen; d.disposeWhen = function () { return !f.a.P(m) || typeof q == "function" && q() } } var r = []; j.o = f.j; j.Ia = function () { return r.length }; j.Ka = typeof d.write === "function"; j.n = function () { m && f.a.p.ja(m, n); g() }; f.Z.call(j); d.deferEvaluation !== !0 && i(); f.i(j, "dispose", j.n); f.i(j, "getDependenciesCount", j.Ia); return j }; f.j.o = f.s; f.b("ko.dependentObservable", f.j); (function () { function g() { var a = [], b = []; this.save = function (c, d) { var e = f.a.h(a, c); e >= 0 ? b[e] = d : (a.push(c), b.push(d)) }; this.get = function (c) { c = f.a.h(a, c); return c >= 0 ? b[c] : d } } function b(a, b) { if (a instanceof Array) for (var c = 0; c < a.length; c++) b(c); else for (c in a) b(c) } function a(c, f, h) { h = h || new g; c = f(c); if (!(typeof c == "object" && c !== e && c !== d)) return c; var i = c instanceof Array ? [] : {}; h.save(c, i); b(c, function (b) { var e = f(c[b]); switch (typeof e) { case "boolean": case "number": case "string": case "function": i[b] = e; break; case "object": case "undefined": var g = h.get(e); i[b] = g !== d ? g : a(e, f, h) } }); return i } f.oa = function (b) { arguments.length == 0 && c(Error("When calling ko.toJS, pass the object you want to convert.")); return a(b, function (a) { for (var b = 0; f.C(a) && b < 10; b++) a = a(); return a }) }; f.toJSON = function (a) { a = f.oa(a); return f.a.Y(a) } })(); f.b("ko.toJS", f.oa); f.b("ko.toJSON", f.toJSON); f.f = { m: function (a) { if (a.tagName == "OPTION") { if (a.__ko__hasDomDataOptionValue__ === !0) return f.a.e.get(a, f.c.options.W); return a.getAttribute("value") } else return a.tagName == "SELECT" ? a.selectedIndex >= 0 ? f.f.m(a.options[a.selectedIndex]) : d : a.value }, I: function (a, b) { if (a.tagName == "OPTION") switch (typeof b) { case "string": case "number": f.a.e.set(a, f.c.options.W, d); "__ko__hasDomDataOptionValue__" in a && delete a.__ko__hasDomDataOptionValue__; a.value = b; break; default: f.a.e.set(a, f.c.options.W, b), a.__ko__hasDomDataOptionValue__ = !0, a.value = "" } else if (a.tagName == "SELECT") for (var c = a.options.length - 1; c >= 0; c--) { if (f.f.m(a.options[c]) == b) { a.selectedIndex = c; break } } else { if (b === e || b === d) b = ""; a.value = b } } }; f.b("ko.selectExtensions", f.f); f.b("ko.selectExtensions.readValue", f.f.m); f.b("ko.selectExtensions.writeValue", f.f.I); f.r = function () { function a(a, c) { return a.replace(b, function (a, b) { return c[b] }) } var b = /\[ko_token_(\d+)\]/g, c = /^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i, d = ["true", "false"]; return { F: function (b) { b = f.a.k(b); if (b.length < 3) return {}; for (var c = [], d = e, g, h = b.charAt(0) == "{" ? 1 : 0; h < b.length; h++) { var i = b.charAt(h); if (d === e) switch (i) { case '"': case "'": case "/": d = h; g = i; break; case "{": d = h; g = "}"; break; case "[": d = h, g = "]" } else if (i == g) { i = b.substring(d, h + 1); c.push(i); var j = "[ko_token_" + (c.length - 1) + "]", b = b.substring(0, d) + j + b.substring(h + 1); h -= i.length - j.length; d = e } } d = {}; b = b.split(","); g = 0; for (h = b.length; g < h; g++) { var j = b[g], k = j.indexOf(":"); k > 0 && k < j.length - 1 && (i = f.a.k(j.substring(0, k)), j = f.a.k(j.substring(k + 1)), i.charAt(0) == "{" && (i = i.substring(1)), j.charAt(j.length - 1) == "}" && (j = j.substring(0, j.length - 1)), i = f.a.k(a(i, c)), j = f.a.k(a(j, c)), d[i] = j) } return d }, R: function (a) { var b = f.r.F(a), g = [], h; for (h in b) { var i = b[h], j; j = i; j = f.a.h(d, f.a.k(j).toLowerCase()) >= 0 ? !1 : j.match(c) !== e; j && (g.length > 0 && g.push(", "), g.push(h + " : function(__ko_value) { " + i + " = __ko_value; }")) } g.length > 0 && (a = a + ", '_ko_property_writers' : { " + g.join("") + " } "); return a } } } (); f.b("ko.jsonExpressionRewriting", f.r); f.b("ko.jsonExpressionRewriting.parseJson", f.r.F); f.b("ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson", f.r.R); f.c = {}; f.J = function (b, d, g, h) { function j() { return l } function i(a) { return function () { return l[a] } } var k = !0, h = h || "data-bind", l; new f.j(function () { var m; if (!(m = typeof d == "function" ? d() : d)) { var n = b.getAttribute(h); try { var q = " { " + f.r.R(n) + " } "; m = f.a.Ha(q, g === e ? a : g) } catch (r) { c(Error("Unable to parse binding attribute.\nMessage: " + r + ";\nAttribute value: " + n)) } } l = m; if (k) for (var s in l) f.c[s] && typeof f.c[s].init == "function" && (0, f.c[s].init)(b, i(s), j, g); for (s in l) f.c[s] && typeof f.c[s].update == "function" && (0, f.c[s].update)(b, i(s), j, g) }, e, { disposeWhenNodeIsRemoved: b }); k = !1 }; f.ua = function (b, g) { g && g.nodeType == d && c(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node (note: this is a breaking change since KO version 1.05)")); var g = g || a.document.body, h = f.a.da(g, "data-bind"); f.a.g(h, function (a) { f.J(a, e, b) }) }; f.b("ko.bindingHandlers", f.c); f.b("ko.applyBindings", f.ua); f.b("ko.applyBindingsToNode", f.J); f.a.g(["click"], function (a) { f.c[a] = { init: function (b, c, d, e) { return f.c.event.init.call(this, b, function () { var b = {}; b[a] = c(); return b }, d, e) } } }); f.c.event = { init: function (a, b, c, d) { var e = b() || {}, g; for (g in e) (function () { var e = g; typeof e == "string" && f.a.t(a, e, function (a) { var f, g = b()[e]; if (g) { var h = c(); try { f = g.apply(d, arguments) } finally { if (f !== !0) a.preventDefault ? a.preventDefault() : a.returnValue = !1 } if (h[e + "Bubble"] === !1) a.cancelBubble = !0, a.stopPropagation && a.stopPropagation() } }) })() } }; f.c.submit = { init: function (a, b, d, e) { typeof b() != "function" && c(Error("The value for a submit binding must be a function to invoke on submit")); f.a.t(a, "submit", function (c) { var d, f = b(); try { d = f.call(e, a) } finally { if (d !== !0) c.preventDefault ? c.preventDefault() : c.returnValue = !1 } }) } }; f.c.visible = { update: function (a, b) { var c = f.a.d(b()), d = a.style.display != "none"; if (c && !d) a.style.display = ""; else if (!c && d) a.style.display = "none" } }; f.c.enable = { update: function (a, b) { var c = f.a.d(b()); if (c && a.disabled) a.removeAttribute("disabled"); else if (!c && !a.disabled) a.disabled = !0 } }; f.c.disable = { update: function (a, b) { f.c.enable.update(a, function () { return !f.a.d(b()) }) } }; f.c.value = { init: function (a, b, c) { var d = ["change"], e = c().valueUpdate; e && (typeof e == "string" && (e = [e]), f.a.u(d, e), d = f.a.L(d)); f.a.g(d, function (d) { var e = !1; f.a.Za(d, "after") && (e = !0, d = d.substring(5)); var g = e ? function (a) { setTimeout(a, 0) } : function (a) { a() }; f.a.t(a, d, function () { g(function () { var d = b(), e = f.f.m(a); f.D(d) ? d(e) : (d = c(), d._ko_property_writers && d._ko_property_writers.value && d._ko_property_writers.value(e)) }) }) }) }, update: function (a, b) { var c = f.a.d(b()), d = f.f.m(a), e = c != d; c === 0 && d !== 0 && d !== "0" && (e = !0); e && (d = function () { f.f.I(a, c) }, d(), a.tagName == "SELECT" && setTimeout(d, 0)); a.tagName == "SELECT" && (d = f.f.m(a), d !== c && f.a.qa(a, "change")) } }; f.c.options = { update: function (a, b, g) { a.tagName != "SELECT" && c(Error("options binding applies only to SELECT elements")); var h = f.a.M(f.a.K(a.childNodes, function (a) { return a.tagName && a.tagName == "OPTION" && a.selected }), function (a) { return f.f.m(a) || a.innerText || a.textContent }), i = a.scrollTop, j = f.a.d(b()); f.a.Q(a); if (j) { var k = g(); typeof j.length != "number" && (j = [j]); if (k.optionsCaption) { var l = document.createElement("OPTION"); l.innerHTML = k.optionsCaption; f.f.I(l, d); a.appendChild(l) } g = 0; for (b = j.length; g < b; g++) { var l = document.createElement("OPTION"), n = typeof k.optionsValue == "string" ? j[g][k.optionsValue] : j[g], n = f.a.d(n); f.f.I(l, n); var q = k.optionsText; optionText = typeof q == "function" ? q(j[g]) : typeof q == "string" ? j[g][q] : n; if (optionText === e || optionText === d) optionText = ""; optionText = f.a.d(optionText).toString(); typeof l.innerText == "string" ? l.innerText = optionText : l.textContent = optionText; a.appendChild(l) } j = a.getElementsByTagName("OPTION"); g = k = 0; for (b = j.length; g < b; g++) f.a.h(h, f.f.m(j[g])) >= 0 && (f.a.ma(j[g], !0), k++); if (i) a.scrollTop = i } } }; f.c.options.W = "__ko.bindingHandlers.options.optionValueDomData__"; f.c.selectedOptions = { fa: function (a) { for (var b = [], a = a.childNodes, c = 0, d = a.length; c < d; c++) { var e = a[c]; e.tagName == "OPTION" && e.selected && b.push(f.f.m(e)) } return b }, init: function (a, b, c) { f.a.t(a, "change", function () { var a = b(); f.D(a) ? a(f.c.selectedOptions.fa(this)) : (a = c(), a._ko_property_writers && a._ko_property_writers.value && a._ko_property_writers.value(f.c.selectedOptions.fa(this))) }) }, update: function (a, b) { a.tagName != "SELECT" && c(Error("values binding applies only to SELECT elements")); var d = f.a.d(b()); if (d && typeof d.length == "number") for (var e = a.childNodes, g = 0, h = e.length; g < h; g++) { var i = e[g]; i.tagName == "OPTION" && f.a.ma(i, f.a.h(d, f.f.m(i)) >= 0) } } }; f.c.text = { update: function (a, b) { var c = f.a.d(b()); if (c === e || c === d) c = ""; typeof a.innerText == "string" ? a.innerText = c : a.textContent = c } }; f.c.html = { update: function (a, b) { var c = f.a.d(b()); f.a.Ya(a, c) } }; f.c.css = { update: function (a, b) { var c = f.a.d(b() || {}), d; for (d in c) if (typeof d == "string") { var e = f.a.d(c[d]); f.a.pa(a, d, e) } } }; f.c.style = { update: function (a, b) { var c = f.a.d(b() || {}), d; for (d in c) if (typeof d == "string") { var e = f.a.d(c[d]); a.style[d] = e || "" } } }; f.c.uniqueName = { init: function (a, b) { if (b()) a.name = "ko_unique_" + ++f.c.uniqueName.Ba, f.a.S && a.mergeAttributes(document.createElement("<input name='" + a.name + "'/>"), !1) } }; f.c.uniqueName.Ba = 0; f.c.checked = { init: function (a, b, c) { f.a.t(a, "click", function () { var d; if (a.type == "checkbox") d = a.checked; else if (a.type == "radio" && a.checked) d = a.value; else return; var e = b(); a.type == "checkbox" && f.a.d(e) instanceof Array ? (d = f.a.h(f.a.d(e), a.value), a.checked && d < 0 ? e.push(a.value) : !a.checked && d >= 0 && e.splice(d, 1)) : f.D(e) ? e() !== d && e(d) : (e = c(), e._ko_property_writers && e._ko_property_writers.checked && e._ko_property_writers.checked(d)) }); a.type == "radio" && !a.name && f.c.uniqueName.init(a, function () { return !0 }) }, update: function (a, b) { var c = f.a.d(b()); if (a.type == "checkbox") a.checked = c instanceof Array ? f.a.h(c, a.value) >= 0 : c, c && f.a.S && a.mergeAttributes(document.createElement("<input type='checkbox' checked='checked' />"), !1); else if (a.type == "radio") a.checked = a.value == c, a.value == c && (f.a.S || f.a.Ma) && a.mergeAttributes(document.createElement("<input type='radio' checked='checked' />"), !1) } }; f.c.attr = { update: function (a, b) { var c = f.a.d(b()) || {}, g; for (g in c) if (typeof g == "string") { var h = f.a.d(c[g]); h === !1 || h === e || h === d ? a.removeAttribute(g) : a.setAttribute(g, h.toString()) } } }; f.aa = function () { this.renderTemplate = function () { c("Override renderTemplate in your ko.templateEngine subclass") }; this.isTemplateRewritten = function () { c("Override isTemplateRewritten in your ko.templateEngine subclass") }; this.rewriteTemplate = function () { c("Override rewriteTemplate in your ko.templateEngine subclass") }; this.createJavaScriptEvaluatorBlock = function () { c("Override createJavaScriptEvaluatorBlock in your ko.templateEngine subclass") } }; f.b("ko.templateEngine", f.aa); f.G = function () { var a = /(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi; return { Ga: function (a, b) { b.isTemplateRewritten(a) || b.rewriteTemplate(a, function (a) { return f.G.Qa(a, b) }) }, Qa: function (b, c) { return b.replace(a, function (a, b, d, e, g, h, i) { a = f.r.R(i); return c.createJavaScriptEvaluatorBlock("ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() {                     return (function() { return { " + a + " } })()                 })") + b }) }, va: function (a) { return f.l.V(function (b, c) { b.nextSibling && f.J(b.nextSibling, a, c) }) } } } (); f.b("ko.templateRewriting", f.G); f.b("ko.templateRewriting.applyMemoizedBindingsToNextSibling", f.G.va); (function () { function a(a, d, e, g, h) { var i = f.a.d(g), h = h || {}, j = h.templateEngine || b; f.G.Ga(e, j); e = j.renderTemplate(e, i, h); (typeof e.length != "number" || e.length > 0 && typeof e[0].nodeType != "number") && c("Template engine must return an array of DOM nodes"); e && f.a.g(e, function (a) { f.l.sa(a, [g]) }); switch (d) { case "replaceChildren": f.a.Xa(a, e); break; case "replaceNode": f.a.ka(a, e); break; case "ignoreTargetNode": break; default: c(Error("Unknown renderMode: " + d)) } h.afterRender && h.afterRender(e, g); return e } var b; f.na = function (a) { a != d && !(a instanceof f.aa) && c("templateEngine must inherit from ko.templateEngine"); b = a }; f.X = function (g, h, i, j, k) { i = i || {}; (i.templateEngine || b) == d && c("Set a template engine before calling renderTemplate"); k = k || "replaceChildren"; if (j) { var l = j.nodeType ? j : j.length > 0 ? j[0] : e; return new f.j(function () { var b = typeof g == "function" ? g(h) : g, b = a(j, k, b, h, i); k == "replaceNode" && (j = b, l = j.nodeType ? j : j.length > 0 ? j[0] : e) }, e, { disposeWhen: function () { return !l || !f.a.P(l) }, disposeWhenNodeIsRemoved: l && k == "replaceNode" ? l.parentNode : l }) } else return f.l.V(function (a) { f.X(g, h, i, a, "replaceNode") }) }; f.Wa = function (b, c, d, g) { return new f.j(function () { var h = f.a.d(c) || []; typeof h.length == "undefined" && (h = [h]); h = f.a.K(h, function (a) { return d.includeDestroyed || !a._destroy }); f.a.la(g, h, function (c) { var f = typeof b == "function" ? b(c) : b; return a(e, "ignoreTargetNode", f, c, d) }, d) }, e, { disposeWhenNodeIsRemoved: g }) }; f.c.template = { update: function (a, b, c, d) { b = f.a.d(b()); c = typeof b == "string" ? b : b.name; if (typeof b.foreach != "undefined") d = f.Wa(c, b.foreach || [], { templateOptions: b.templateOptions, afterAdd: b.afterAdd, beforeRemove: b.beforeRemove, includeDestroyed: b.includeDestroyed, afterRender: b.afterRender }, a); else var e = b.data, d = f.X(c, typeof e == "undefined" ? d : e, { templateOptions: b.templateOptions, afterRender: b.afterRender }, a); (b = f.a.e.get(a, "__ko__templateSubscriptionDomDataKey__")) && typeof b.n == "function" && b.n(); f.a.e.set(a, "__ko__templateSubscriptionDomDataKey__", d) } } })(); f.b("ko.setTemplateEngine", f.na); f.b("ko.renderTemplate", f.X); f.a.w = function (a, b, c) { if (c === d) return f.a.w(a, b, 1) || f.a.w(a, b, 10) || f.a.w(a, b, Number.MAX_VALUE); else { for (var a = a || [], b = b || [], g = a, h = b, i = [], j = 0; j <= h.length; j++) i[j] = []; for (var j = 0, k = Math.min(g.length, c); j <= k; j++) i[0][j] = j; j = 1; for (k = Math.min(h.length, c); j <= k; j++) i[j][0] = j; for (var k = g.length, l, n = h.length, j = 1; j <= k; j++) { var q = Math.min(n, j + c); for (l = Math.max(1, j - c); l <= q; l++) i[l][j] = g[j - 1] === h[l - 1] ? i[l - 1][j - 1] : Math.min(i[l - 1][j] === d ? Number.MAX_VALUE : i[l - 1][j] + 1, i[l][j - 1] === d ? Number.MAX_VALUE : i[l][j - 1] + 1) } c = a.length; g = b.length; h = []; j = i[g][c]; if (j === d) i = e; else { for (; c > 0 || g > 0; ) { k = i[g][c]; l = g > 0 ? i[g - 1][c] : j + 1; n = c > 0 ? i[g][c - 1] : j + 1; q = g > 0 && c > 0 ? i[g - 1][c - 1] : j + 1; if (l === d || l < k - 1) l = j + 1; if (n === d || n < k - 1) n = j + 1; q < k - 1 && (q = j + 1); l <= n && l < q ? (h.push({ status: "added", value: b[g - 1] }), g--) : (n < l && n < q ? h.push({ status: "deleted", value: a[c - 1] }) : (h.push({ status: "retained", value: a[c - 1] }), g--), c--) } i = h.reverse() } return i } }; f.b("ko.utils.compareArrays", f.a.w); (function () { function a(a, b, c) { var d = [], a = f.j(function () { var a = b(c) || []; d.length > 0 && f.a.ka(d, a); d.splice(0, d.length); f.a.u(d, a) }, e, { disposeWhenNodeIsRemoved: a, disposeWhen: function () { return d.length == 0 || !f.a.P(d[0]) } }); return { Oa: d, j: a} } f.a.la = function (b, c, g, h) { for (var c = c || [], h = h || {}, i = f.a.e.get(b, "setDomNodeChildrenFromArrayMapping_lastMappingResult") === d, j = f.a.e.get(b, "setDomNodeChildrenFromArrayMapping_lastMappingResult") || [], k = f.a.M(j, function (a) { return a.wa }), l = f.a.w(k, c), c = [], n = 0, q = [], k = [], r = e, s = 0, t = l.length; s < t; s++) switch (l[s].status) { case "retained": var u = j[n]; c.push(u); u.B.length > 0 && (r = u.B[u.B.length - 1]); n++; break; case "deleted": j[n].j.n(); f.a.g(j[n].B, function (a) { q.push({ element: a, index: s, value: l[s].value }); r = a }); n++; break; case "added": var v = a(b, g, l[s].value), u = v.Oa; c.push({ wa: l[s].value, B: u, j: v.j }); for (var v = 0, w = u.length; v < w; v++) { var x = u[v]; k.push({ element: x, index: s, value: l[s].value }); r == e ? b.firstChild ? b.insertBefore(x, b.firstChild) : b.appendChild(x) : r.nextSibling ? b.insertBefore(x, r.nextSibling) : b.appendChild(x); r = x } } f.a.g(q, function (a) { f.v(a.element) }); g = !1; if (!i) { if (h.afterAdd) for (s = 0; s < k.length; s++) h.afterAdd(k[s].element, k[s].index, k[s].value); if (h.beforeRemove) { for (s = 0; s < q.length; s++) h.beforeRemove(q[s].element, q[s].index, q[s].value); g = !0 } } g || f.a.g(q, function (a) { a.element.parentNode && a.element.parentNode.removeChild(a.element) }); f.a.e.set(b, "setDomNodeChildrenFromArrayMapping_lastMappingResult", c) } })(); f.b("ko.utils.setDomNodeChildrenFromArrayMapping", f.a.la); f.T = function () { this.q = function () { if (typeof jQuery == "undefined" || !jQuery.tmpl) return 0; if (jQuery.tmpl.tag) { if (jQuery.tmpl.tag.tmpl && jQuery.tmpl.tag.tmpl.open && jQuery.tmpl.tag.tmpl.open.toString().indexOf("__") >= 0) return 3; return 2 } return 1 } (); this.getTemplateNode = function (a) { var b = document.getElementById(a); b == e && c(Error("Cannot find template with ID=" + a)); return b }; var a = RegExp("__ko_apos__", "g"); this.renderTemplate = function (b, d, e) { e = e || {}; this.q == 0 && c(Error("jquery.tmpl not detected.\nTo use KO's default template engine, reference jQuery and jquery.tmpl. See Knockout installation documentation for more details.")); if (this.q == 1) return b = '<script type="text/html">' + this.getTemplateNode(b).text + "</script>", d = jQuery.tmpl(b, d)[0].text.replace(a, "'"), jQuery.clean([d], document); if (!(b in jQuery.template)) { var f = this.getTemplateNode(b).text; jQuery.template(b, f) } d = [d]; d = jQuery.tmpl(b, d, e.templateOptions); d.appendTo(document.createElement("div")); jQuery.fragments = {}; return d }; this.isTemplateRewritten = function (a) { if (a in jQuery.template) return !0; return this.getTemplateNode(a).Na === !0 }; this.rewriteTemplate = function (a, b) { var c = this.getTemplateNode(a), d = b(c.text); this.q == 1 && (d = f.a.k(d), d = d.replace(/([\s\S]*?)(\${[\s\S]*?}|{{[\=a-z][\s\S]*?}}|$)/g, function (a, b, c) { return b.replace(/\'/g, "__ko_apos__") + c })); c.text = d; c.Na = !0 }; this.createJavaScriptEvaluatorBlock = function (a) { if (this.q == 1) return "{{= " + a + "}}"; return "{{ko_code ((function() { return " + a + " })()) }}" }; this.ta = function (a, b) { document.write("<script type='text/html' id='" + a + "'>" + b + "</script>") }; f.i(this, "addTemplate", this.ta); this.q > 1 && (jQuery.tmpl.tag.ko_code = { open: (this.q < 3 ? "_" : "__") + ".push($1 || '');" }) }; f.T.prototype = new f.aa; f.na(new f.T); f.b("ko.jqueryTmplTemplateEngine", f.T) })(window); (function (a) { var b = a.browser.msie && parseInt(a.browser.version) === 6 && typeof window.XMLHttpRequest !== "object", c = a.browser.msie && parseInt(a.browser.version) === 7, d = null, e = []; a.modal = function (b, c) { return a.modal.impl.init(b, c) }; a.modal.close = function () { a.modal.impl.close() }; a.modal.focus = function (b) { a.modal.impl.focus(b) }; a.modal.setContainerDimensions = function () { a.modal.impl.setContainerDimensions() }; a.modal.setPosition = function () { a.modal.impl.setPosition() }; a.modal.update = function (b, c) { a.modal.impl.update(b, c) }; a.fn.modal = function (b) { return a.modal.impl.init(this, b) }; a.modal.defaults = { appendTo: "body", focus: true, opacity: 50, overlayId: "simplemodal-overlay", overlayCss: {}, containerId: "simplemodal-container", containerCss: {}, dataId: "simplemodal-data", dataCss: {}, minHeight: null, minWidth: null, maxHeight: null, maxWidth: null, autoResize: false, autoPosition: true, zIndex: 1e3, close: true, closeHTML: '<a class="modalCloseImg" title="Close"></a>', closeClass: "simplemodal-close", escClose: true, overlayClose: false, position: null, persist: false, modal: true, onOpen: null, onShow: null, onClose: null }; a.modal.impl = { d: {}, init: function (b, c) { var e = this; if (e.d.data) return false; d = a.browser.msie && !a.boxModel; e.o = a.extend({}, a.modal.defaults, c); e.zIndex = e.o.zIndex; e.occb = false; if (typeof b === "object") { b = b instanceof jQuery ? b : a(b); e.d.placeholder = false; if (b.parent().parent().size() > 0) { b.before(a("<span></span>").attr("id", "simplemodal-placeholder").css({ display: "none" })); e.d.placeholder = true; e.display = b.css("display"); if (!e.o.persist) e.d.orig = b.clone(true) } } else if (typeof b === "string" || typeof b === "number") b = a("<div></div>").html(b); else { alert("SimpleModal Error: Unsupported data type: " + typeof b); return e } e.create(b); e.open(); a.isFunction(e.o.onShow) && e.o.onShow.apply(e, [e.d]); return e }, create: function (c) { var g = this; e = g.getDimensions(); if (g.o.modal && b) g.d.iframe = a('<iframe src="javascript:false;"></iframe>').css(a.extend(g.o.iframeCss, { display: "none", opacity: 0, position: "fixed", height: e[0], width: e[1], zIndex: g.o.zIndex, top: 0, left: 0 })).appendTo(g.o.appendTo); g.d.overlay = a("<div></div>").attr("id", g.o.overlayId).addClass("simplemodal-overlay").css(a.extend(g.o.overlayCss, { display: "none", opacity: g.o.opacity / 100, height: g.o.modal ? e[0] : 0, width: g.o.modal ? e[1] : 0, position: "fixed", left: 0, top: 0, zIndex: g.o.zIndex + 1 })).appendTo(g.o.appendTo); g.d.container = a("<div></div>").attr("id", g.o.containerId).addClass("simplemodal-container").css(a.extend(g.o.containerCss, { display: "none", position: "fixed", zIndex: g.o.zIndex + 2 })).append(g.o.close && g.o.closeHTML ? a(g.o.closeHTML).addClass(g.o.closeClass) : "").appendTo(g.o.appendTo); g.d.wrap = a("<div></div>").attr("tabIndex", -1).addClass("simplemodal-wrap").css({ height: "100%", outline: 0, width: "100%" }).appendTo(g.d.container); g.d.data = c.attr("id", c.attr("id") || g.o.dataId).addClass("simplemodal-data").css(a.extend(g.o.dataCss, { display: "none" })).appendTo("body"); g.setContainerDimensions(); g.d.data.appendTo(g.d.wrap); if (b || d) g.fixIE() }, bindEvents: function () { var c = this; a("." + c.o.closeClass).bind("click.simplemodal", function (a) { a.preventDefault(); c.close() }); c.o.modal && c.o.close && c.o.overlayClose && c.d.overlay.bind("click.simplemodal", function (a) { a.preventDefault(); c.close() }); a(document).bind("keydown.simplemodal", function (a) { if (c.o.modal && a.keyCode === 9) c.watchTab(a); else if (c.o.close && c.o.escClose && a.keyCode === 27) { a.preventDefault(); c.close() } }); a(window).bind("resize.simplemodal", function () { e = c.getDimensions(); c.o.autoResize ? c.setContainerDimensions() : c.o.autoPosition && c.setPosition(); if (b || d) c.fixIE(); else if (c.o.modal) { c.d.iframe && c.d.iframe.css({ height: e[0], width: e[1] }); c.d.overlay.css({ height: e[0], width: e[1] }) } }) }, unbindEvents: function () { a("." + this.o.closeClass).unbind("click.simplemodal"); a(document).unbind("keydown.simplemodal"); a(window).unbind("resize.simplemodal"); this.d.overlay.unbind("click.simplemodal") }, fixIE: function () { var b = this, c = b.o.position; a.each([b.d.iframe || null, !b.o.modal ? null : b.d.overlay, b.d.container], function (a, b) { if (b) { var d = b[0].style; d.position = "absolute"; if (a < 2) { d.removeExpression("height"); d.removeExpression("width"); d.setExpression("height", 'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'); d.setExpression("width", 'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"') } else { var e; if (c && c.constructor === Array) { a = c[0] ? typeof c[0] === "number" ? c[0].toString() : c[0].replace(/px/, "") : b.css("top").replace(/px/, ""); a = a.indexOf("%") === -1 ? a + ' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"' : parseInt(a.replace(/%/, "")) + ' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'; if (c[1]) { e = typeof c[1] === "number" ? c[1].toString() : c[1].replace(/px/, ""); e = e.indexOf("%") === -1 ? e + ' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"' : parseInt(e.replace(/%/, "")) + ' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"' } } else { a = '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'; e = '(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"' } d.removeExpression("top"); d.removeExpression("left"); d.setExpression("top", a); d.setExpression("left", e) } } }) }, focus: function (b) { var c = this; b = b && a.inArray(b, ["first", "last"]) !== -1 ? b : "first"; var d = a(":input:enabled:visible:" + b, c.d.wrap); setTimeout(function () { d.length > 0 ? d.focus() : c.d.wrap.focus() }, 10) }, getDimensions: function () { var b = a(window); return [a.browser.opera && a.browser.version > "9.5" && a.fn.jquery < "1.3" || a.browser.opera && a.browser.version < "9.5" && a.fn.jquery > "1.2.6" ? b[0].innerHeight : b.height(), b.width()] }, getVal: function (a, b) { return a ? typeof a === "number" ? a : a === "auto" ? 0 : a.indexOf("%") > 0 ? parseInt(a.replace(/%/, "")) / 100 * (b === "h" ? e[0] : e[1]) : parseInt(a.replace(/px/, "")) : null }, update: function (a, b) { var c = this; if (!c.d.data) return false; c.d.origHeight = c.getVal(a, "h"); c.d.origWidth = c.getVal(b, "w"); c.d.data.hide(); a && c.d.container.css("height", a); b && c.d.container.css("width", b); c.setContainerDimensions(); c.d.data.show(); c.o.focus && c.focus(); c.unbindEvents(); c.bindEvents() }, setContainerDimensions: function () { var d = this, g = b || c, h = d.d.origHeight ? d.d.origHeight : a.browser.opera ? d.d.container.height() : d.getVal(g ? d.d.container[0].currentStyle.height : d.d.container.css("height"), "h"); g = d.d.origWidth ? d.d.origWidth : a.browser.opera ? d.d.container.width() : d.getVal(g ? d.d.container[0].currentStyle.width : d.d.container.css("width"), "w"); var i = d.d.data.outerHeight(true), j = d.d.data.outerWidth(true); d.d.origHeight = d.d.origHeight || h; d.d.origWidth = d.d.origWidth || g; var l = d.o.maxHeight ? d.getVal(d.o.maxHeight, "h") : null, n = d.o.maxWidth ? d.getVal(d.o.maxWidth, "w") : null; l = l && l < e[0] ? l : e[0]; n = n && n < e[1] ? n : e[1]; var o = d.o.minHeight ? d.getVal(d.o.minHeight, "h") : "auto"; h = h ? d.o.autoResize && h > l ? l : h < o ? o : h : i ? i > l ? l : d.o.minHeight && o !== "auto" && i < o ? o : i : o; l = d.o.minWidth ? d.getVal(d.o.minWidth, "w") : "auto"; g = g ? d.o.autoResize && g > n ? n : g < l ? l : g : j ? j > n ? n : d.o.minWidth && l !== "auto" && j < l ? l : j : l; d.d.container.css({ height: h, width: g }); d.d.wrap.css({ overflow: i > h || j > g ? "auto" : "visible" }); d.o.autoPosition && d.setPosition() }, setPosition: function () { var a = this, b, c; b = e[0] / 2 - a.d.container.outerHeight(true) / 2; c = e[1] / 2 - a.d.container.outerWidth(true) / 2; if (a.o.position && Object.prototype.toString.call(a.o.position) === "[object Array]") { b = a.o.position[0] || b; c = a.o.position[1] || c } else { b = b; c = c } a.d.container.css({ left: c, top: b }) }, watchTab: function (b) { var c = this; if (a(b.target).parents(".simplemodal-container").length > 0) { c.inputs = a(":input:enabled:visible:first, :input:enabled:visible:last", c.d.data[0]); if (!b.shiftKey && b.target === c.inputs[c.inputs.length - 1] || b.shiftKey && b.target === c.inputs[0] || c.inputs.length === 0) { b.preventDefault(); c.focus(b.shiftKey ? "last" : "first") } } else { b.preventDefault(); c.focus() } }, open: function () { var b = this; b.d.iframe && b.d.iframe.show(); if (a.isFunction(b.o.onOpen)) b.o.onOpen.apply(b, [b.d]); else { b.d.overlay.show(); b.d.container.show(); b.d.data.show() } b.o.focus && b.focus(); b.bindEvents() }, close: function () { var b = this; if (!b.d.data) return false; b.unbindEvents(); if (a.isFunction(b.o.onClose) && !b.occb) { b.occb = true; b.o.onClose.apply(b, [b.d]) } else { if (b.d.placeholder) { var c = a("#simplemodal-placeholder"); if (b.o.persist) c.replaceWith(b.d.data.removeClass("simplemodal-data").css("display", b.display)); else { b.d.data.hide().remove(); c.replaceWith(b.d.orig) } } else b.d.data.hide().remove(); b.d.container.hide().remove(); b.d.overlay.hide(); b.d.iframe && b.d.iframe.hide().remove(); setTimeout(function () { b.d.overlay.remove(); b.d = {} }, 10) } } } })(jQuery);
