﻿/* Easing */
jQuery.easing["jswing"] = jQuery.easing["swing"]; jQuery.extend(jQuery.easing, { def: "easeOutQuad", swing: function (a, b, c, d, e) { return jQuery.easing[jQuery.easing.def](a, b, c, d, e) }, easeInQuad: function (a, b, c, d, e) { return d * (b /= e) * b + c }, easeOutQuad: function (a, b, c, d, e) { return -d * (b /= e) * (b - 2) + c }, easeInOutQuad: function (a, b, c, d, e) { if ((b /= e / 2) < 1) return d / 2 * b * b + c; return -d / 2 * (--b * (b - 2) - 1) + c }, easeInCubic: function (a, b, c, d, e) { return d * (b /= e) * b * b + c }, easeOutCubic: function (a, b, c, d, e) { return d * ((b = b / e - 1) * b * b + 1) + c }, easeInOutCubic: function (a, b, c, d, e) { if ((b /= e / 2) < 1) return d / 2 * b * b * b + c; return d / 2 * ((b -= 2) * b * b + 2) + c }, easeInQuart: function (a, b, c, d, e) { return d * (b /= e) * b * b * b + c }, easeOutQuart: function (a, b, c, d, e) { return -d * ((b = b / e - 1) * b * b * b - 1) + c }, easeInOutQuart: function (a, b, c, d, e) { if ((b /= e / 2) < 1) return d / 2 * b * b * b * b + c; return -d / 2 * ((b -= 2) * b * b * b - 2) + c }, easeInQuint: function (a, b, c, d, e) { return d * (b /= e) * b * b * b * b + c }, easeOutQuint: function (a, b, c, d, e) { return d * ((b = b / e - 1) * b * b * b * b + 1) + c }, easeInOutQuint: function (a, b, c, d, e) { if ((b /= e / 2) < 1) return d / 2 * b * b * b * b * b + c; return d / 2 * ((b -= 2) * b * b * b * b + 2) + c }, easeInSine: function (a, b, c, d, e) { return -d * Math.cos(b / e * (Math.PI / 2)) + d + c }, easeOutSine: function (a, b, c, d, e) { return d * Math.sin(b / e * (Math.PI / 2)) + c }, easeInOutSine: function (a, b, c, d, e) { return -d / 2 * (Math.cos(Math.PI * b / e) - 1) + c }, easeInExpo: function (a, b, c, d, e) { return b == 0 ? c : d * Math.pow(2, 10 * (b / e - 1)) + c }, easeOutExpo: function (a, b, c, d, e) { return b == e ? c + d : d * (-Math.pow(2, -10 * b / e) + 1) + c }, easeInOutExpo: function (a, b, c, d, e) { if (b == 0) return c; if (b == e) return c + d; if ((b /= e / 2) < 1) return d / 2 * Math.pow(2, 10 * (b - 1)) + c; return d / 2 * (-Math.pow(2, -10 * --b) + 2) + c }, easeInCirc: function (a, b, c, d, e) { return -d * (Math.sqrt(1 - (b /= e) * b) - 1) + c }, easeOutCirc: function (a, b, c, d, e) { return d * Math.sqrt(1 - (b = b / e - 1) * b) + c }, easeInOutCirc: function (a, b, c, d, e) { if ((b /= e / 2) < 1) return -d / 2 * (Math.sqrt(1 - b * b) - 1) + c; return d / 2 * (Math.sqrt(1 - (b -= 2) * b) + 1) + c }, easeInElastic: function (a, b, c, d, e) { var f = 1.70158; var g = 0; var h = d; if (b == 0) return c; if ((b /= e) == 1) return c + d; if (!g) g = e * .3; if (h < Math.abs(d)) { h = d; var f = g / 4 } else var f = g / (2 * Math.PI) * Math.asin(d / h); return -(h * Math.pow(2, 10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g)) + c }, easeOutElastic: function (a, b, c, d, e) { var f = 1.70158; var g = 0; var h = d; if (b == 0) return c; if ((b /= e) == 1) return c + d; if (!g) g = e * .3; if (h < Math.abs(d)) { h = d; var f = g / 4 } else var f = g / (2 * Math.PI) * Math.asin(d / h); return h * Math.pow(2, -10 * b) * Math.sin((b * e - f) * 2 * Math.PI / g) + d + c }, easeInOutElastic: function (a, b, c, d, e) { var f = 1.70158; var g = 0; var h = d; if (b == 0) return c; if ((b /= e / 2) == 2) return c + d; if (!g) g = e * .3 * 1.5; if (h < Math.abs(d)) { h = d; var f = g / 4 } else var f = g / (2 * Math.PI) * Math.asin(d / h); if (b < 1) return -.5 * h * Math.pow(2, 10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g) + c; return h * Math.pow(2, -10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g) * .5 + d + c }, easeInBack: function (a, b, c, d, e, f) { if (f == undefined) f = 1.70158; return d * (b /= e) * b * ((f + 1) * b - f) + c }, easeOutBack: function (a, b, c, d, e, f) { if (f == undefined) f = 1.70158; return d * ((b = b / e - 1) * b * ((f + 1) * b + f) + 1) + c }, easeInOutBack: function (a, b, c, d, e, f) { if (f == undefined) f = 1.70158; if ((b /= e / 2) < 1) return d / 2 * b * b * (((f *= 1.525) + 1) * b - f) + c; return d / 2 * ((b -= 2) * b * (((f *= 1.525) + 1) * b + f) + 2) + c }, easeInBounce: function (a, b, c, d, e) { return d - jQuery.easing.easeOutBounce(a, e - b, 0, d, e) + c }, easeOutBounce: function (a, b, c, d, e) { if ((b /= e) < 1 / 2.75) { return d * 7.5625 * b * b + c } else if (b < 2 / 2.75) { return d * (7.5625 * (b -= 1.5 / 2.75) * b + .75) + c } else if (b < 2.5 / 2.75) { return d * (7.5625 * (b -= 2.25 / 2.75) * b + .9375) + c } else { return d * (7.5625 * (b -= 2.625 / 2.75) * b + .984375) + c } }, easeInOutBounce: function (a, b, c, d, e) { if (b < e / 2) return jQuery.easing.easeInBounce(a, b * 2, 0, d, e) * .5 + c; return jQuery.easing.easeOutBounce(a, b * 2 - e, 0, d, e) * .5 + d * .5 + c } })

/* jQuery.ScrollTo */
; (function (d) { var k = d.scrollTo = function (a, i, e) { d(window).scrollTo(a, i, e) }; k.defaults = { axis: 'xy', duration: parseFloat(d.fn.jquery) >= 1.3 ? 0 : 1 }; k.window = function (a) { return d(window)._scrollable() }; d.fn._scrollable = function () { return this.map(function () { var a = this, i = !a.nodeName || d.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!i) return a; var e = (a.contentWindow || a).document || a.ownerDocument || a; return d.browser.safari || e.compatMode == 'BackCompat' ? e.body : e.documentElement }) }; d.fn.scrollTo = function (n, j, b) { if (typeof j == 'object') { b = j; j = 0 } if (typeof b == 'function') b = { onAfter: b }; if (n == 'max') n = 9e9; b = d.extend({}, k.defaults, b); j = j || b.speed || b.duration; b.queue = b.queue && b.axis.length > 1; if (b.queue) j /= 2; b.offset = p(b.offset); b.over = p(b.over); return this._scrollable().each(function () { var q = this, r = d(q), f = n, s, g = {}, u = r.is('html,body'); switch (typeof f) { case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)) { f = p(f); break } f = d(f, this); case 'object': if (f.is || f.style) s = (f = d(f)).offset() } d.each(b.axis.split(''), function (a, i) { var e = i == 'x' ? 'Left' : 'Top', h = e.toLowerCase(), c = 'scroll' + e, l = q[c], m = k.max(q, i); if (s) { g[c] = s[h] + (u ? 0 : l - r.offset()[h]); if (b.margin) { g[c] -= parseInt(f.css('margin' + e)) || 0; g[c] -= parseInt(f.css('border' + e + 'Width')) || 0 } g[c] += b.offset[h] || 0; if (b.over[h]) g[c] += f[i == 'x' ? 'width' : 'height']() * b.over[h] } else { var o = f[h]; g[c] = o.slice && o.slice(-1) == '%' ? parseFloat(o) / 100 * m : o } if (/^\d+$/.test(g[c])) g[c] = g[c] <= 0 ? 0 : Math.min(g[c], m); if (!a && b.queue) { if (l != g[c]) t(b.onAfterFirst); delete g[c] } }); t(b.onAfter); function t(a) { r.animate(g, j, b.easing, a && function () { a.call(this, n, b) }) } }).end() }; k.max = function (a, i) { var e = i == 'x' ? 'Width' : 'Height', h = 'scroll' + e; if (!d(a).is('html,body')) return a[h] - d(a)[e.toLowerCase()](); var c = 'client' + e, l = a.ownerDocument.documentElement, m = a.ownerDocument.body; return Math.max(l[h], m[h]) - Math.min(l[c], m[c]) }; function p(a) { return typeof a == 'object' ? a : { top: a, left: a} } })(jQuery);

/*Slimbox v2.04*/
(function (w) { var E = w(window), u, f, F = -1, n, x, D, v, y, L, r, m = !window.XMLHttpRequest, s = [], l = document.documentElement, k = {}, t = new Image(), J = new Image(), H, a, g, p, I, d, G, c, A, K; w(function () { w("body").append(w([H = w('<div id="lbOverlay" />')[0], a = w('<div id="lbCenter" />')[0], G = w('<div id="lbBottomContainer" />')[0]]).css("display", "none")); g = w('<div id="lbImage" />').appendTo(a).append(p = w('<div style="position: relative;" />').append([I = w('<a id="lbPrevLink" href="#" />').click(B)[0], d = w('<a id="lbNextLink" href="#" />').click(e)[0]])[0])[0]; c = w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="#" />').add(H).click(C)[0], A = w('<div id="lbCaption" />')[0], K = w('<div id="lbNumber" />')[0], w('<div style="clear: both;" />')[0]])[0] }); w.slimbox = function (O, N, M) { u = w.extend({ loop: false, overlayOpacity: 0.8, overlayFadeDuration: 400, resizeDuration: 400, resizeEasing: "swing", initialWidth: 250, initialHeight: 250, imageFadeDuration: 400, captionAnimationDuration: 400, counterText: "Image {x} of {y}", closeKeys: [27, 88, 67], previousKeys: [37, 80], nextKeys: [39, 78] }, M); if (typeof O == "string") { O = [[O, N]]; N = 0 } y = E.scrollTop() + (E.height() / 2); L = u.initialWidth; r = u.initialHeight; w(a).css({ top: Math.max(0, y - (r / 2)), width: L, height: r, marginLeft: -L / 2 }).show(); v = m || (H.currentStyle && (H.currentStyle.position != "fixed")); if (v) { H.style.position = "absolute" } w(H).css("opacity", u.overlayOpacity).fadeIn(u.overlayFadeDuration); z(); j(1); f = O; u.loop = u.loop && (f.length > 1); return b(N) }; w.fn.slimbox = function (M, P, O) { P = P || function (Q) { return [Q.href, Q.title] }; O = O || function () { return true }; var N = this; return N.unbind("click").click(function () { var S = this, U = 0, T, Q = 0, R; T = w.grep(N, function (W, V) { return O.call(S, W, V) }); for (R = T.length; Q < R; ++Q) { if (T[Q] == S) { U = Q } T[Q] = P(T[Q], Q) } return w.slimbox(T, U, M) }) }; function z() { var N = E.scrollLeft(), M = E.width(); w([a, G]).css("left", N + (M / 2)); if (v) { w(H).css({ left: N, top: E.scrollTop(), width: M, height: E.height() }) } } function j(M) { if (M) { w("object").add(m ? "select" : "embed").each(function (O, P) { s[O] = [P, P.style.visibility]; P.style.visibility = "hidden" }) } else { w.each(s, function (O, P) { P[0].style.visibility = P[1] }); s = [] } var N = M ? "bind" : "unbind"; E[N]("scroll resize", z); w(document)[N]("keydown", o) } function o(O) { var N = O.keyCode, M = w.inArray; return (M(N, u.closeKeys) >= 0) ? C() : (M(N, u.nextKeys) >= 0) ? e() : (M(N, u.previousKeys) >= 0) ? B() : false } function B() { return b(x) } function e() { return b(D) } function b(M) { if (M >= 0) { F = M; n = f[F][0]; x = (F || (u.loop ? f.length : 0)) - 1; D = ((F + 1) % f.length) || (u.loop ? 0 : -1); q(); a.className = "lbLoading"; k = new Image(); k.onload = i; k.src = n } return false } function i() { a.className = ""; w(g).css({ backgroundImage: "url(" + n + ")", visibility: "hidden", display: "" }); w(p).width(k.width); w([p, I, d]).height(k.height); w(A).html(f[F][1] || ""); w(K).html((((f.length > 1) && u.counterText) || "").replace(/{x}/, F + 1).replace(/{y}/, f.length)); if (x >= 0) { t.src = f[x][0] } if (D >= 0) { J.src = f[D][0] } L = g.offsetWidth; r = g.offsetHeight; var M = Math.max(0, y - (r / 2)); if (a.offsetHeight != r) { w(a).animate({ height: r, top: M }, u.resizeDuration, u.resizeEasing) } if (a.offsetWidth != L) { w(a).animate({ width: L, marginLeft: -L / 2 }, u.resizeDuration, u.resizeEasing) } w(a).queue(function () { w(G).css({ width: L, top: M + r, marginLeft: -L / 2, visibility: "hidden", display: "" }); w(g).css({ display: "none", visibility: "", opacity: "" }).fadeIn(u.imageFadeDuration, h) }) } function h() { if (x >= 0) { w(I).show() } if (D >= 0) { w(d).show() } w(c).css("marginTop", -c.offsetHeight).animate({ marginTop: 0 }, u.captionAnimationDuration); G.style.visibility = "" } function q() { k.onload = null; k.src = t.src = J.src = n; w([a, g, c]).stop(true); w([I, d, g, G]).hide() } function C() { if (F >= 0) { q(); F = x = D = -1; w(a).hide(); w(H).stop().fadeOut(u.overlayFadeDuration, j) } return false } })(jQuery);

/* Date extender*/
Date.prototype.format = function (format) { var returnStr = ''; var replace = Date.replaceChars; for (var i = 0; i < format.length; i++) { var curChar = format.charAt(i); if (i - 1 >= 0 && format.charAt(i - 1) == "\\") { returnStr += curChar; } else if (replace[curChar]) { returnStr += replace[curChar].call(this); } else if (curChar != "\\") { returnStr += curChar; } } return returnStr; }; Date.replaceChars = { shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], d: function () { return (this.getDate() < 10 ? '0' : '') + this.getDate(); }, D: function () { return Date.replaceChars.shortDays[this.getDay()]; }, j: function () { return this.getDate(); }, l: function () { return Date.replaceChars.longDays[this.getDay()]; }, N: function () { return this.getDay() + 1; }, S: function () { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); }, w: function () { return this.getDay(); }, z: function () { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((this - d) / 86400000); }, W: function () { var d = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - d) / 86400000) + d.getDay() + 1) / 7); }, F: function () { return Date.replaceChars.longMonths[this.getMonth()]; }, m: function () { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); }, M: function () { return Date.replaceChars.shortMonths[this.getMonth()]; }, n: function () { return this.getMonth() + 1; }, t: function () { var d = new Date(); return new Date(d.getFullYear(), d.getMonth(), 0).getDate() }, L: function () { var year = this.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); }, o: function () { var d = new Date(this.valueOf()); d.setDate(d.getDate() - ((this.getDay() + 6) % 7) + 3); return d.getFullYear(); }, Y: function () { return this.getFullYear(); }, y: function () { return ('' + this.getFullYear()).substr(2); }, a: function () { return this.getHours() < 12 ? 'am' : 'pm'; }, A: function () { return this.getHours() < 12 ? 'AM' : 'PM'; }, B: function () { return Math.floor((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1000 / 24); }, g: function () { return this.getHours() % 12 || 12; }, G: function () { return this.getHours(); }, h: function () { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); }, H: function () { return (this.getHours() < 10 ? '0' : '') + this.getHours(); }, i: function () { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); }, s: function () { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); }, u: function () { var m = this.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ? '0' : '')) + m; }, e: function () { return "Not Yet Supported"; }, I: function () { return "Not Yet Supported"; }, O: function () { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; }, P: function () { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':00'; }, T: function () { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result; }, Z: function () { return -this.getTimezoneOffset() * 60; }, c: function () { return this.format("Y-m-d\\TH:i:sP"); }, r: function () { return this.toString(); }, U: function () { return this.getTime() / 1000; } };

/*jQuery History Adapter*/
(function (a, b) { var c = a.History = a.History || {}, d = a.jQuery; if (typeof c.Adapter != "undefined") throw new Error("History.js Adapter has already been loaded..."); c.Adapter = { bind: function (a, b, c) { d(a).bind(b, c) }, trigger: function (a, b) { d(a).trigger(b) }, onDomLoad: function (a) { d(a) } }, typeof c.init != "undefined" && c.init() })(window);

/* History.js */
(function (a, b) { "use strict"; var c = a.console || b, d = a.document, e = a.navigator, f = a.amplify || !1, g = a.setTimeout, h = a.clearTimeout, i = a.setInterval, j = a.clearInterval, k = a.JSON, l = a.History = a.History || {}, m = a.history; k.stringify = k.stringify || k.encode, k.parse = k.parse || k.decode; if (typeof l.init != "undefined") throw new Error("History.js Core has already been loaded..."); l.init = function () { if (typeof l.Adapter == "undefined") return !1; typeof l.initCore != "undefined" && l.initCore(), typeof l.initHtml4 != "undefined" && l.initHtml4(); return !0 }, l.initCore = function () { if (typeof l.initCore.initialized != "undefined") return !1; l.initCore.initialized = !0, l.options = l.options || {}, l.options.hashChangeInterval = l.options.hashChangeInterval || 100, l.options.safariPollInterval = l.options.safariPollInterval || 500, l.options.doubleCheckInterval = l.options.doubleCheckInterval || 500, l.options.storeInterval = l.options.storeInterval || 1e3, l.options.busyDelay = l.options.busyDelay || 250, l.options.debug = l.options.debug || !1, l.options.initialTitle = l.options.initialTitle || d.title, l.intervalList = [], l.clearAllIntervals = function () { var a, b = l.intervalList; if (typeof b != "undefined" && b !== null) { for (a = 0; a < b.length; a++) j(b[a]); l.intervalList = null } }, l.Adapter.bind(a, "beforeunload", l.clearAllIntervals), l.Adapter.bind(a, "unload", l.clearAllIntervals), l.debug = function () { (l.options.debug || !1) && l.log.apply(l, arguments) }, l.log = function () { var a = typeof c != "undefined" && typeof c.log != "undefined" && typeof c.log.apply != "undefined", b = d.getElementById("log"), e, f, g; if (a) { var h = Array.prototype.slice.call(arguments); e = h.shift(), typeof c.debug != "undefined" ? c.debug.apply(c, [e, h]) : c.log.apply(c, [e, h]) } else e = "\n" + arguments[0] + "\n"; for (f = 1, g = arguments.length; f < g; ++f) { var i = arguments[f]; if (typeof i == "object" && typeof k != "undefined") try { i = k.stringify(i) } catch (j) { } e += "\n" + i + "\n" } b ? (b.value += e + "\n-----\n", b.scrollTop = b.scrollHeight - b.clientHeight) : a || alert(e); return !0 }, l.getInternetExplorerMajorVersion = function () { var a = l.getInternetExplorerMajorVersion.cached = typeof l.getInternetExplorerMajorVersion.cached != "undefined" ? l.getInternetExplorerMajorVersion.cached : function () { var a = 3, b = d.createElement("div"), c = b.getElementsByTagName("i"); while ((b.innerHTML = "<!--[if gt IE " + ++a + "]><i></i><![endif]-->") && c[0]); return a > 4 ? a : !1 } (); return a }, l.isInternetExplorer = function () { var a = l.isInternetExplorer.cached = typeof l.isInternetExplorer.cached != "undefined" ? l.isInternetExplorer.cached : Boolean(l.getInternetExplorerMajorVersion()); return a }, l.emulated = { pushState: !Boolean(a.history && a.history.pushState && a.history.replaceState && !/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent) && !/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)), hashChange: Boolean(!("onhashchange" in a || "onhashchange" in d) || l.isInternetExplorer() && l.getInternetExplorerMajorVersion() < 8) }, l.enabled = !l.emulated.pushState, l.bugs = { setHash: Boolean(!l.emulated.pushState && e.vendor === "Apple Computer, Inc." && /AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)), safariPoll: Boolean(!l.emulated.pushState && e.vendor === "Apple Computer, Inc." && /AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)), ieDoubleCheck: Boolean(l.isInternetExplorer() && l.getInternetExplorerMajorVersion() < 8), hashEscape: Boolean(l.isInternetExplorer() && l.getInternetExplorerMajorVersion() < 7) }, l.isEmptyObject = function (a) { for (var b in a) return !1; return !0 }, l.cloneObject = function (a) { var b, c; a ? (b = k.stringify(a), c = k.parse(b)) : c = {}; return c }, l.getRootUrl = function () { var a = d.location.protocol + "//" + (d.location.hostname || d.location.host); if (d.location.port || !1) a += ":" + d.location.port; a += "/"; return a }, l.getBaseHref = function () { var a = d.getElementsByTagName("base"), b = null, c = ""; a.length === 1 && (b = a[0], c = b.href.replace(/[^\/]+$/, "")), c = c.replace(/\/+$/, ""), c && (c += "/"); return c }, l.getBaseUrl = function () { var a = l.getBaseHref() || l.getBasePageUrl() || l.getRootUrl(); return a }, l.getPageUrl = function () { var a = l.getState(!1, !1), b = (a || {}).url || d.location.href, c = b.replace(/\/+$/, "").replace(/[^\/]+$/, function (a, b, c) { return /\./.test(a) ? a : a + "/" }); return c }, l.getBasePageUrl = function () { var a = d.location.href.replace(/[#\?].*/, "").replace(/[^\/]+$/, function (a, b, c) { return /[^\/]$/.test(a) ? "" : a }).replace(/\/+$/, "") + "/"; return a }, l.getFullUrl = function (a, b) { var c = a, d = a.substring(0, 1); b = typeof b == "undefined" ? !0 : b, /[a-z]+\:\/\//.test(a) || (d === "/" ? c = l.getRootUrl() + a.replace(/^\/+/, "") : d === "#" ? c = l.getPageUrl().replace(/#.*/, "") + a : d === "?" ? c = l.getPageUrl().replace(/[\?#].*/, "") + a : b ? c = l.getBaseUrl() + a.replace(/^(\.\/)+/, "") : c = l.getBasePageUrl() + a.replace(/^(\.\/)+/, "")); return c.replace(/\#$/, "") }, l.getShortUrl = function (a) { var b = a, c = l.getBaseUrl(), d = l.getRootUrl(); l.emulated.pushState && (b = b.replace(c, "")), b = b.replace(d, "/"), l.isTraditionalAnchor(b) && (b = "./" + b), b = b.replace(/^(\.\/)+/g, "./").replace(/\#$/, ""); return b }, l.store = f ? f.store("History.store") || {} : {}, l.store.idToState = l.store.idToState || {}, l.store.urlToId = l.store.urlToId || {}, l.store.stateToId = l.store.stateToId || {}, l.idToState = l.idToState || {}, l.stateToId = l.stateToId || {}, l.urlToId = l.urlToId || {}, l.storedStates = l.storedStates || [], l.savedStates = l.savedStates || [], l.getState = function (a, b) { typeof a == "undefined" && (a = !0), typeof b == "undefined" && (b = !0); var c = l.getLastSavedState(); !c && b && (c = l.createStateObject()), a && (c = l.cloneObject(c), c.url = c.cleanUrl || c.url); return c }, l.getIdByState = function (a) { var b = l.extractId(a.url); if (!b) { var c = l.getStateString(a); if (typeof l.stateToId[c] != "undefined") b = l.stateToId[c]; else if (typeof l.store.stateToId[c] != "undefined") b = l.store.stateToId[c]; else { for (; ; ) { b = String(Math.floor(Math.random() * 1e3)); if (typeof l.idToState[b] == "undefined" && typeof l.store.idToState[b] == "undefined") break } l.stateToId[c] = b, l.idToState[b] = a } } return b }, l.normalizeState = function (a) { if (!a || typeof a != "object") a = {}; if (typeof a.normalized != "undefined") return a; if (!a.data || typeof a.data != "object") a.data = {}; var b = {}; b.normalized = !0, b.title = a.title || "", b.url = l.getFullUrl(l.unescapeString(a.url || d.location.href)), b.hash = l.getShortUrl(b.url), b.data = l.cloneObject(a.data), b.id = l.getIdByState(b), b.cleanUrl = b.url.replace(/\??\&_suid.*/, ""), b.url = b.cleanUrl; var c = !l.isEmptyObject(b.data); if (b.title || c) b.hash = l.getShortUrl(b.url).replace(/\??\&_suid.*/, ""), /\?/.test(b.hash) || (b.hash += "?"), b.hash += "&_suid=" + b.id; b.hashedUrl = l.getFullUrl(b.hash), (l.emulated.pushState || l.bugs.safariPoll) && l.hasUrlDuplicate(b) && (b.url = b.hashedUrl); return b }, l.createStateObject = function (a, b, c) { var d = { data: a, title: b, url: c }; d = l.normalizeState(d); return d }, l.getStateById = function (a) { a = String(a); var c = l.idToState[a] || l.store.idToState[a] || b; return c }, l.getStateString = function (a) { var b = l.normalizeState(a), c = { data: b.data, title: a.title, url: a.url }, d = k.stringify(c); return d }, l.getStateId = function (a) { var b = l.normalizeState(a), c = b.id; return c }, l.getHashByState = function (a) { var b, c = l.normalizeState(a); b = c.hash; return b }, l.extractId = function (a) { var b, c, d; c = /(.*)\&_suid=([0-9]+)$/.exec(a), d = c ? c[1] || a : a, b = c ? String(c[2] || "") : ""; return b || !1 }, l.isTraditionalAnchor = function (a) { var b = !/[\/\?\.]/.test(a); return b }, l.extractState = function (a, b) { var c = null; b = b || !1; var d = l.extractId(a); d && (c = l.getStateById(d)); if (!c) { var e = l.getFullUrl(a); d = l.getIdByUrl(e) || !1, d && (c = l.getStateById(d)), !c && b && !l.isTraditionalAnchor(a) && (c = l.createStateObject(null, null, e)) } return c }, l.getIdByUrl = function (a) { var c = l.urlToId[a] || l.store.urlToId[a] || b; return c }, l.getLastSavedState = function () { return l.savedStates[l.savedStates.length - 1] || b }, l.getLastStoredState = function () { return l.storedStates[l.storedStates.length - 1] || b }, l.hasUrlDuplicate = function (a) { var b = !1, c = l.extractState(a.url); b = c && c.id !== a.id; return b }, l.storeState = function (a) { l.urlToId[a.url] = a.id, l.storedStates.push(l.cloneObject(a)); return a }, l.isLastSavedState = function (a) { var b = !1; if (l.savedStates.length) { var c = a.id, d = l.getLastSavedState(), e = d.id; b = c === e } return b }, l.saveState = function (a) { if (l.isLastSavedState(a)) return !1; l.savedStates.push(l.cloneObject(a)); return !0 }, l.getStateByIndex = function (a) { var b = null; typeof a == "undefined" ? b = l.savedStates[l.savedStates.length - 1] : a < 0 ? b = l.savedStates[l.savedStates.length + a] : b = l.savedStates[a]; return b }, l.getHash = function () { var a = l.unescapeHash(d.location.hash); return a }, l.unescapeString = function (b) { var c = b, d; for (; ; ) { d = a.unescape(c); if (d === c) break; c = d } return c }, l.unescapeHash = function (a) { var b = l.normalizeHash(a); b = l.unescapeString(b); return b }, l.normalizeHash = function (a) { var b = a.replace(/[^#]*#/, "").replace(/#.*/, ""); return b }, l.setHash = function (a, b) { if (b !== !1 && l.busy()) { l.pushQueue({ scope: l, callback: l.setHash, args: arguments, queue: b }); return !1 } var c = l.escapeHash(a); l.busy(!0); var e = l.extractState(a, !0); if (e && !l.emulated.pushState) l.pushState(e.data, e.title, e.url, !1); else if (d.location.hash !== c) if (l.bugs.setHash) { var f = l.getPageUrl(); l.pushState(null, null, f + "#" + c, !1) } else d.location.hash = c; return l }, l.escapeHash = function (b) { var c = l.normalizeHash(b); c = a.escape(c), l.bugs.hashEscape || (c = c.replace(/\%21/g, "!").replace(/\%26/g, "&").replace(/\%3D/g, "=").replace(/\%3F/g, "?")); return c }, l.getHashByUrl = function (a) { var b = String(a).replace(/([^#]*)#?([^#]*)#?(.*)/, "$2"); b = l.unescapeHash(b); return b }, l.setTitle = function (a) { var b = a.title; if (!b) { var c = l.getStateByIndex(0); c && c.url === a.url && (b = c.title || l.options.initialTitle) } try { d.getElementsByTagName("title")[0].innerHTML = b.replace("<", "&lt;").replace(">", "&gt;").replace(" & ", " &amp; ") } catch (e) { } d.title = b; return l }, l.queues = [], l.busy = function (a) { typeof a != "undefined" ? l.busy.flag = a : typeof l.busy.flag == "undefined" && (l.busy.flag = !1); if (!l.busy.flag) { h(l.busy.timeout); var b = function () { if (!l.busy.flag) for (var a = l.queues.length - 1; a >= 0; --a) { var c = l.queues[a]; if (c.length === 0) continue; var d = c.shift(); l.fireQueueItem(d), l.busy.timeout = g(b, l.options.busyDelay) } }; l.busy.timeout = g(b, l.options.busyDelay) } return l.busy.flag }, l.fireQueueItem = function (a) { return a.callback.apply(a.scope || l, a.args || []) }, l.pushQueue = function (a) { l.queues[a.queue || 0] = l.queues[a.queue || 0] || [], l.queues[a.queue || 0].push(a); return l }, l.queue = function (a, b) { typeof a == "function" && (a = { callback: a }), typeof b != "undefined" && (a.queue = b), l.busy() ? l.pushQueue(a) : l.fireQueueItem(a); return l }, l.clearQueue = function () { l.busy.flag = !1, l.queues = []; return l }, l.stateChanged = !1, l.doubleChecker = !1, l.doubleCheckComplete = function () { l.stateChanged = !0, l.doubleCheckClear(); return l }, l.doubleCheckClear = function () { l.doubleChecker && (h(l.doubleChecker), l.doubleChecker = !1); return l }, l.doubleCheck = function (a) { l.stateChanged = !1, l.doubleCheckClear(), l.bugs.ieDoubleCheck && (l.doubleChecker = g(function () { l.doubleCheckClear(), l.stateChanged || a(); return !0 }, l.options.doubleCheckInterval)); return l }, l.safariStatePoll = function () { var b = l.extractState(d.location.href), c; if (!l.isLastSavedState(b)) c = b; else return; c || (c = l.createStateObject()), l.Adapter.trigger(a, "popstate"); return l }, l.back = function (a) { if (a !== !1 && l.busy()) { l.pushQueue({ scope: l, callback: l.back, args: arguments, queue: a }); return !1 } l.busy(!0), l.doubleCheck(function () { l.back(!1) }), m.go(-1); return !0 }, l.forward = function (a) { if (a !== !1 && l.busy()) { l.pushQueue({ scope: l, callback: l.forward, args: arguments, queue: a }); return !1 } l.busy(!0), l.doubleCheck(function () { l.forward(!1) }), m.go(1); return !0 }, l.go = function (a, b) { var c; if (a > 0) for (c = 1; c <= a; ++c) l.forward(b); else { if (!(a < 0)) throw new Error("History.go: History.go requires a positive or negative integer passed."); for (c = -1; c >= a; --c) l.back(b) } return l }, l.saveState(l.storeState(l.extractState(d.location.href, !0))), f && (l.onUnload = function () { var a = f.store("History.store") || {}, b; a.idToState = a.idToState || {}, a.urlToId = a.urlToId || {}, a.stateToId = a.stateToId || {}; for (b in l.idToState) { if (!l.idToState.hasOwnProperty(b)) continue; a.idToState[b] = l.idToState[b] } for (b in l.urlToId) { if (!l.urlToId.hasOwnProperty(b)) continue; a.urlToId[b] = l.urlToId[b] } for (b in l.stateToId) { if (!l.stateToId.hasOwnProperty(b)) continue; a.stateToId[b] = l.stateToId[b] } l.store = a, f.store("History.store", a) }, l.intervalList.push(i(l.onUnload, l.options.storeInterval)), l.Adapter.bind(a, "beforeunload", l.onUnload), l.Adapter.bind(a, "unload", l.onUnload)); if (l.emulated.pushState) { var n = function () { }; l.pushState = l.pushState || n, l.replaceState = l.replaceState || n } else { l.onPopState = function (b) { l.doubleCheckComplete(); var c = l.getHash(); if (c) { var e = l.extractState(c || d.location.href, !0); e ? l.replaceState(e.data, e.title, e.url, !1) : (l.Adapter.trigger(a, "anchorchange"), l.busy(!1)), l.expectedStateId = !1; return !1 } var f = !1; b = b || {}, typeof b.state == "undefined" && (typeof b.originalEvent != "undefined" && typeof b.originalEvent.state != "undefined" ? b.state = b.originalEvent.state || !1 : typeof b.event != "undefined" && typeof b.event.state != "undefined" && (b.state = b.event.state || !1)), b.state = b.state || !1, b.state ? f = l.getStateById(b.state) : l.expectedStateId ? f = l.getStateById(l.expectedStateId) : f = l.extractState(d.location.href), f || (f = l.createStateObject(null, null, d.location.href)), l.expectedStateId = !1; if (l.isLastSavedState(f)) { l.busy(!1); return !1 } l.storeState(f), l.saveState(f), l.setTitle(f), l.Adapter.trigger(a, "statechange"), l.busy(!1); return !0 }, l.Adapter.bind(a, "popstate", l.onPopState), l.pushState = function (b, c, d, e) { if (l.getHashByUrl(d) && l.emulated.pushState) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); if (e !== !1 && l.busy()) { l.pushQueue({ scope: l, callback: l.pushState, args: arguments, queue: e }); return !1 } l.busy(!0); var f = l.createStateObject(b, c, d); l.isLastSavedState(f) ? l.busy(!1) : (l.storeState(f), l.expectedStateId = f.id, m.pushState(f.id, f.title, f.url), l.Adapter.trigger(a, "popstate")); return !0 }, l.replaceState = function (b, c, d, e) { if (l.getHashByUrl(d) && l.emulated.pushState) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); if (e !== !1 && l.busy()) { l.pushQueue({ scope: l, callback: l.replaceState, args: arguments, queue: e }); return !1 } l.busy(!0); var f = l.createStateObject(b, c, d); l.isLastSavedState(f) ? l.busy(!1) : (l.storeState(f), l.expectedStateId = f.id, m.replaceState(f.id, f.title, f.url), l.Adapter.trigger(a, "popstate")); return !0 }, l.bugs.safariPoll && l.intervalList.push(i(l.safariStatePoll, l.options.safariPollInterval)); if (e.vendor === "Apple Computer, Inc." || (e.appCodeName || "") === "Mozilla") l.Adapter.bind(a, "hashchange", function () { l.Adapter.trigger(a, "popstate") }), l.getHash() && l.Adapter.onDomLoad(function () { l.Adapter.trigger(a, "hashchange") }) } }, l.init() })(window);

/* History.js HTML4 */
(function (a, b) { "use strict"; var c = a.document, d = a.setTimeout || d, e = a.clearTimeout || e, f = a.setInterval || f, g = a.History = a.History || {}; if (typeof g.initHtml4 != "undefined") throw new Error("History.js HTML4 Support has already been loaded..."); g.initHtml4 = function () { if (typeof g.initHtml4.initialized != "undefined") return !1; g.initHtml4.initialized = !0, g.enabled = !0, g.savedHashes = [], g.isLastHash = function (a) { var b = g.getHashByIndex(), c = a === b; return c }, g.saveHash = function (a) { if (g.isLastHash(a)) return !1; g.savedHashes.push(a); return !0 }, g.getHashByIndex = function (a) { var b = null; typeof a == "undefined" ? b = g.savedHashes[g.savedHashes.length - 1] : a < 0 ? b = g.savedHashes[g.savedHashes.length + a] : b = g.savedHashes[a]; return b }, g.discardedHashes = {}, g.discardedStates = {}, g.discardState = function (a, b, c) { var d = g.getHashByState(a), e = { discardedState: a, backState: c, forwardState: b }; g.discardedStates[d] = e; return !0 }, g.discardHash = function (a, b, c) { var d = { discardedHash: a, backState: c, forwardState: b }; g.discardedHashes[a] = d; return !0 }, g.discardedState = function (a) { var b = g.getHashByState(a), c = g.discardedStates[b] || !1; return c }, g.discardedHash = function (a) { var b = g.discardedHashes[a] || !1; return b }, g.recycleState = function (a) { var b = g.getHashByState(a); g.discardedState(a) && delete g.discardedStates[b]; return !0 }, g.emulated.hashChange && (g.hashChangeInit = function () { g.checkerFunction = null; var b = ""; if (g.isInternetExplorer()) { var d = "historyjs-iframe", e = c.createElement("iframe"); e.setAttribute("id", d), e.style.display = "none", c.body.appendChild(e), e.contentWindow.document.open(), e.contentWindow.document.close(); var h = "", i = !1; g.checkerFunction = function () { if (i) return !1; i = !0; var c = g.getHash() || "", d = g.unescapeHash(e.contentWindow.document.location.hash) || ""; c !== b ? (b = c, d !== c && (h = d = c, e.contentWindow.document.open(), e.contentWindow.document.close(), e.contentWindow.document.location.hash = g.escapeHash(c)), g.Adapter.trigger(a, "hashchange")) : d !== h && (h = d, g.setHash(d, !1)), i = !1; return !0 } } else g.checkerFunction = function () { var c = g.getHash(); c !== b && (b = c, g.Adapter.trigger(a, "hashchange")); return !0 }; g.intervalList.push(f(g.checkerFunction, g.options.hashChangeInterval)); return !0 }, g.Adapter.onDomLoad(g.hashChangeInit)), g.emulated.pushState && (g.onHashChange = function (b) { var d = b && b.newURL || c.location.href, e = g.getHashByUrl(d), f = null, h = null, i = null; if (g.isLastHash(e)) { g.busy(!1); return !1 } g.doubleCheckComplete(), g.saveHash(e); if (e && g.isTraditionalAnchor(e)) { g.Adapter.trigger(a, "anchorchange"), g.busy(!1); return !1 } f = g.extractState(g.getFullUrl(e || c.location.href, !1), !0); if (g.isLastSavedState(f)) { g.busy(!1); return !1 } h = g.getHashByState(f); var j = g.discardedState(f); if (j) { g.getHashByIndex(-2) === g.getHashByState(j.forwardState) ? g.back(!1) : g.forward(!1); return !1 } g.pushState(f.data, f.title, f.url, !1); return !0 }, g.Adapter.bind(a, "hashchange", g.onHashChange), g.pushState = function (b, d, e, f) { if (g.getHashByUrl(e)) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); if (f !== !1 && g.busy()) { g.pushQueue({ scope: g, callback: g.pushState, args: arguments, queue: f }); return !1 } g.busy(!0); var h = g.createStateObject(b, d, e), i = g.getHashByState(h), j = g.getState(!1), k = g.getHashByState(j), l = g.getHash(); g.storeState(h), g.expectedStateId = h.id, g.recycleState(h), g.setTitle(h); if (i === k) { g.busy(!1); return !1 } if (i !== l && i !== g.getShortUrl(c.location.href)) { g.setHash(i, !1); return !1 } g.saveState(h), g.Adapter.trigger(a, "statechange"), g.busy(!1); return !0 }, g.replaceState = function (a, b, c, d) { if (g.getHashByUrl(c)) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); if (d !== !1 && g.busy()) { g.pushQueue({ scope: g, callback: g.replaceState, args: arguments, queue: d }); return !1 } g.busy(!0); var e = g.createStateObject(a, b, c), f = g.getState(!1), h = g.getStateByIndex(-2); g.discardState(f, e, h), g.pushState(e.data, e.title, e.url, !1); return !0 }, g.getHash() && !g.emulated.hashChange && g.Adapter.onDomLoad(function () { g.Adapter.trigger(a, "hashchange") })) }, g.init() })(window);

(function (window, undefined) {

    var 
		History = window.History,
		$ = window.jQuery,
		document = window.document;

    if(!history.pushState && ( document.location.href.indexOf("form") != -1 || document.location.href.indexOf(".aspx") != -1 ) )
        return false;
        

    if (!History.enabled)        
        return false;

    $(function () {
        var 
			contentSelector = '#content,article:first,.article:first,.post:first',
			$content = $(contentSelector).filter(':first'),
			contentNode = $content.get(0),
			$menu = $('#menu,#nav,nav:first,.nav:first').filter(':first'),
			activeClass = 'current',
			activeSelector = '.current',
			menuChildrenSelector = '> a,> li,> ul > li',

			$body = $(document.body),
			rootUrl = History.getBaseUrl(),
			scrollOptions = {
			    duration: 800,
			    easing: 'swing'
			};


        if ($content.length === 0) {
            $content = $body;
        }


        $.expr[':'].internal = function (obj, index, meta, stack) {

            var $this = $(obj),
				url = $this.attr('href') || '',
				isInternalLink;


            isInternalLink = url.substring(0, rootUrl.length) === rootUrl || url.indexOf(':') === -1;

            return isInternalLink;
        };

        var documentHtml = function (html) {
            var result = String(html)
				.replace(/<\!DOCTYPE[^>]*>/i, '')
				.replace(/<(html|head|body|title|meta|script)([\s\>])/gi, '<div class="document-$1"$2')
				.replace(/<\/(html|head|body|title|meta|script)\>/gi, '</div>')
			;

            return result;
        };

        $.fn.ajaxify = function () {
            var $this = $(this);
            $this.find('a:internal:not(.no-ajaxy)[href*=".shtml"]').click(function (event) {
                var 
					$this = $(this),
					url = $this.attr('href'),
					title = $this.attr('title') || null;

                if (event.which == 2 || event.metaKey) { return true; }

                History.pushState(null, title, url);
                event.preventDefault();
                return false;
            });
            return $this;
        };

        $body.ajaxify();

        $(window).bind('statechange', function () {
            var 
				State = History.getState(),
				url = State.url,
				relativeUrl = url.replace(rootUrl, '');

            $body.addClass('loading');

            $content.animate({ opacity: 0 }, 250);

            $.ajax({
                url: url,
                success: function (data, textStatus, jqXHR) {
                    

                    if (data.indexOf("formresult") != -1)
                        $body.addClass("formresult");
                        else
                        $body.removeClass("formresult");
                    
                    var 
						$data = $(documentHtml(data)),
						$dataBody = $data.find('.document-body:first'),
						$dataContent = $dataBody.find(contentSelector).filter(':first'),
						$menuChildren, contentHtml, $scripts;

                    $scripts = $dataContent.find('.document-script');
                    if ($scripts.length) {
                        $scripts.detach();
                    }

                    contentHtml = $dataContent.html() || $data.html();
                    if (!contentHtml) {
                        document.location.href = url;
                        return false;
                    }

                    $menuChildren = $menu.find(menuChildrenSelector);
                    $menuChildren.filter(activeSelector).removeClass(activeClass);
                    $menuChildren = $menuChildren.filter('a[href^="' + relativeUrl + '"],a[href^="/' + relativeUrl + '"],a[href^="' + url + '"]');
                    if ($menuChildren.length === 1) { $menuChildren.addClass(activeClass); }

                    $content.stop(false, false);
                    $content.html(contentHtml).ajaxify().animate({ opacity: 1 }, 125); /* you could fade in here if you'd like */
                    Init();

                    document.title = $data.find('.document-title:first').text();
                    try {
                        document.getElementsByTagName('title')[0].innerHTML = document.title.replace('<', '&lt;').replace('>', '&gt;').replace(' & ', ' &amp; ');
                    }
                    catch (Exception) { }

                    $scripts.each(function () {
                        var $script = $(this), scriptText = $script.html(), scriptNode = document.createElement('script');
                        scriptNode.appendChild(document.createTextNode(scriptText));
                        contentNode.appendChild(scriptNode);
                    });

                    if ($body.ScrollTo || false) { $body.ScrollTo(scrollOptions); } /* http://balupton.com/projects/jquery-scrollto */
                    $body.removeClass('loading');

                    if (typeof window.pageTracker !== 'undefined') {
                        window.pageTracker._trackPageview(relativeUrl);
                    }

                    if (typeof window.reinvigorate !== 'undefined' && typeof window.reinvigorate.ajax_track !== 'undefined') {
                        reinvigorate.ajax_track(url);
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    document.location.href = url;
                    return false;
                }
            }); // end ajax

        }); // end onStateChange

    }); // end onDomLoad

})(window); // end closure
