/* Minification failed. Returning unminified contents.
(6364,25-33): run-time error JS1006: Expected ')': function
(6364,36): run-time error JS1004: Expected ';'
(6366,7): run-time error JS1004: Expected ';'
(6370,29): run-time error JS1004: Expected ';'
(6381,7): run-time error JS1004: Expected ';'
(6385,27): run-time error JS1004: Expected ';'
(6465,28): run-time error JS1004: Expected ';'
(6475,2-3): run-time error JS1195: Expected expression: )
 */
/*!
* jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Nov 11 19:04:53 2010 -0500
*/
(function (E, B) {
	function ka(a, b, d) { if (d === B && a.nodeType === 1) { d = a.getAttribute("data-" + b); if (typeof d === "string") { try { d = d === "true" ? true : d === "false" ? false : d === "null" ? null : !c.isNaN(d) ? parseFloat(d) : Ja.test(d) ? c.parseJSON(d) : d } catch (e) { } c.data(a, b, d) } else d = B } return d } function U() { return false } function ca() { return true } function la(a, b, d) { d[0].type = a; return c.event.handle.apply(b, d) } function Ka(a) {
		var b, d, e, f, h, l, k, o, x, r, A, C = []; f = []; h = c.data(this, this.nodeType ? "events" : "__events__"); if (typeof h === "function") h =
h.events; if (!(a.liveFired === this || !h || !h.live || a.button && a.type === "click")) {
			if (a.namespace) A = RegExp("(^|\\.)" + a.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); a.liveFired = this; var J = h.live.slice(0); for (k = 0; k < J.length; k++) { h = J[k]; h.origType.replace(X, "") === a.type ? f.push(h.selector) : J.splice(k--, 1) } f = c(a.target).closest(f, a.currentTarget); o = 0; for (x = f.length; o < x; o++) {
				r = f[o]; for (k = 0; k < J.length; k++) {
					h = J[k]; if (r.selector === h.selector && (!A || A.test(h.namespace))) {
						l = r.elem; e = null; if (h.preType === "mouseenter" ||
h.preType === "mouseleave") { a.type = h.preType; e = c(a.relatedTarget).closest(h.selector)[0] } if (!e || e !== l) C.push({ elem: l, handleObj: h, level: r.level })
					}
				}
			} o = 0; for (x = C.length; o < x; o++) { f = C[o]; if (d && f.level > d) break; a.currentTarget = f.elem; a.data = f.handleObj.data; a.handleObj = f.handleObj; A = f.handleObj.origHandler.apply(f.elem, arguments); if (A === false || a.isPropagationStopped()) { d = f.level; if (A === false) b = false; if (a.isImmediatePropagationStopped()) break } } return b
		}
	} function Y(a, b) {
		return (a && a !== "*" ? a + "." : "") + b.replace(La,
"`").replace(Ma, "&")
	} function ma(a, b, d) { if (c.isFunction(b)) return c.grep(a, function (f, h) { return !!b.call(f, h, f) === d }); else if (b.nodeType) return c.grep(a, function (f) { return f === b === d }); else if (typeof b === "string") { var e = c.grep(a, function (f) { return f.nodeType === 1 }); if (Na.test(b)) return c.filter(b, e, !d); else b = c.filter(b, e) } return c.grep(a, function (f) { return c.inArray(f, b) >= 0 === d }) } function na(a, b) {
		var d = 0; b.each(function () {
			if (this.nodeName === (a[d] && a[d].nodeName)) {
				var e = c.data(a[d++]), f = c.data(this,
e); if (e = e && e.events) { delete f.handle; f.events = {}; for (var h in e) for (var l in e[h]) c.event.add(this, h, e[h][l], e[h][l].data) }
			}
		})
	} function Oa(a, b) { b.src ? c.ajax({ url: b.src, async: false, dataType: "script" }) : c.globalEval(b.text || b.textContent || b.innerHTML || ""); b.parentNode && b.parentNode.removeChild(b) } function oa(a, b, d) {
		var e = b === "width" ? a.offsetWidth : a.offsetHeight; if (d === "border") return e; c.each(b === "width" ? Pa : Qa, function () {
			d || (e -= parseFloat(c.css(a, "padding" + this)) || 0); if (d === "margin") e += parseFloat(c.css(a,
"margin" + this)) || 0; else e -= parseFloat(c.css(a, "border" + this + "Width")) || 0
		}); return e
	} function da(a, b, d, e) { if (c.isArray(b) && b.length) c.each(b, function (f, h) { d || Ra.test(a) ? e(a, h) : da(a + "[" + (typeof h === "object" || c.isArray(h) ? f : "") + "]", h, d, e) }); else if (!d && b != null && typeof b === "object") c.isEmptyObject(b) ? e(a, "") : c.each(b, function (f, h) { da(a + "[" + f + "]", h, d, e) }); else e(a, b) } function S(a, b) { var d = {}; c.each(pa.concat.apply([], pa.slice(0, b)), function () { d[this] = a }); return d } function qa(a) {
		if (!ea[a]) {
			var b = c("<" +
a + ">").appendTo("body"), d = b.css("display"); b.remove(); if (d === "none" || d === "") d = "block"; ea[a] = d
		} return ea[a]
	} function fa(a) { return c.isWindow(a) ? a : a.nodeType === 9 ? a.defaultView || a.parentWindow : false } var t = E.document, c = function () {
		function a() { if (!b.isReady) { try { t.documentElement.doScroll("left") } catch (j) { setTimeout(a, 1); return } b.ready() } } var b = function (j, s) { return new b.fn.init(j, s) }, d = E.jQuery, e = E.$, f, h = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, l = /\S/, k = /^\s+/, o = /\s+$/, x = /\W/, r = /\d/, A = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
C = /^[\],:{}\s]*$/, J = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, w = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, I = /(?:^|:|,)(?:\s*\[)+/g, L = /(webkit)[ \/]([\w.]+)/, g = /(opera)(?:.*version)?[ \/]([\w.]+)/, i = /(msie) ([\w.]+)/, n = /(mozilla)(?:.*? rv:([\w.]+))?/, m = navigator.userAgent, p = false, q = [], u, y = Object.prototype.toString, F = Object.prototype.hasOwnProperty, M = Array.prototype.push, N = Array.prototype.slice, O = String.prototype.trim, D = Array.prototype.indexOf, R = {}; b.fn = b.prototype = { init: function (j,
s) {
	var v, z, H; if (!j) return this; if (j.nodeType) { this.context = this[0] = j; this.length = 1; return this } if (j === "body" && !s && t.body) { this.context = t; this[0] = t.body; this.selector = "body"; this.length = 1; return this } if (typeof j === "string") if ((v = h.exec(j)) && (v[1] || !s)) if (v[1]) {
		H = s ? s.ownerDocument || s : t; if (z = A.exec(j)) if (b.isPlainObject(s)) { j = [t.createElement(z[1])]; b.fn.attr.call(j, s, true) } else j = [H.createElement(z[1])]; else { z = b.buildFragment([v[1]], [H]); j = (z.cacheable ? z.fragment.cloneNode(true) : z.fragment).childNodes } return b.merge(this,
j)
	} else { if ((z = t.getElementById(v[2])) && z.parentNode) { if (z.id !== v[2]) return f.find(j); this.length = 1; this[0] = z } this.context = t; this.selector = j; return this } else if (!s && !x.test(j)) { this.selector = j; this.context = t; j = t.getElementsByTagName(j); return b.merge(this, j) } else return !s || s.jquery ? (s || f).find(j) : b(s).find(j); else if (b.isFunction(j)) return f.ready(j); if (j.selector !== B) { this.selector = j.selector; this.context = j.context } return b.makeArray(j, this)
}, selector: "", jquery: "1.4.4", length: 0, size: function () { return this.length },
	toArray: function () { return N.call(this, 0) }, get: function (j) { return j == null ? this.toArray() : j < 0 ? this.slice(j)[0] : this[j] }, pushStack: function (j, s, v) { var z = b(); b.isArray(j) ? M.apply(z, j) : b.merge(z, j); z.prevObject = this; z.context = this.context; if (s === "find") z.selector = this.selector + (this.selector ? " " : "") + v; else if (s) z.selector = this.selector + "." + s + "(" + v + ")"; return z }, each: function (j, s) { return b.each(this, j, s) }, ready: function (j) { b.bindReady(); if (b.isReady) j.call(t, b); else q && q.push(j); return this }, eq: function (j) {
		return j ===
-1 ? this.slice(j) : this.slice(j, +j + 1)
	}, first: function () { return this.eq(0) }, last: function () { return this.eq(-1) }, slice: function () { return this.pushStack(N.apply(this, arguments), "slice", N.call(arguments).join(",")) }, map: function (j) { return this.pushStack(b.map(this, function (s, v) { return j.call(s, v, s) })) }, end: function () { return this.prevObject || b(null) }, push: M, sort: [].sort, splice: [].splice
}; b.fn.init.prototype = b.fn; b.extend = b.fn.extend = function () {
	var j, s, v, z, H, G = arguments[0] || {}, K = 1, Q = arguments.length, ga = false;
	if (typeof G === "boolean") { ga = G; G = arguments[1] || {}; K = 2 } if (typeof G !== "object" && !b.isFunction(G)) G = {}; if (Q === K) { G = this; --K } for (; K < Q; K++) if ((j = arguments[K]) != null) for (s in j) { v = G[s]; z = j[s]; if (G !== z) if (ga && z && (b.isPlainObject(z) || (H = b.isArray(z)))) { if (H) { H = false; v = v && b.isArray(v) ? v : [] } else v = v && b.isPlainObject(v) ? v : {}; G[s] = b.extend(ga, v, z) } else if (z !== B) G[s] = z } return G
}; b.extend({ noConflict: function (j) { E.$ = e; if (j) E.jQuery = d; return b }, isReady: false, readyWait: 1, ready: function (j) {
	j === true && b.readyWait--;
	if (!b.readyWait || j !== true && !b.isReady) { if (!t.body) return setTimeout(b.ready, 1); b.isReady = true; if (!(j !== true && --b.readyWait > 0)) if (q) { var s = 0, v = q; for (q = null; j = v[s++]; ) j.call(t, b); b.fn.trigger && b(t).trigger("ready").unbind("ready") } }
}, bindReady: function () {
	if (!p) {
		p = true; if (t.readyState === "complete") return setTimeout(b.ready, 1); if (t.addEventListener) { t.addEventListener("DOMContentLoaded", u, false); E.addEventListener("load", b.ready, false) } else if (t.attachEvent) {
			t.attachEvent("onreadystatechange", u); E.attachEvent("onload",
b.ready); var j = false; try { j = E.frameElement == null } catch (s) { } t.documentElement.doScroll && j && a()
		}
	}
}, isFunction: function (j) { return b.type(j) === "function" }, isArray: Array.isArray || function (j) { return b.type(j) === "array" }, isWindow: function (j) { return j && typeof j === "object" && "setInterval" in j }, isNaN: function (j) { return j == null || !r.test(j) || isNaN(j) }, type: function (j) { return j == null ? String(j) : R[y.call(j)] || "object" }, isPlainObject: function (j) {
	if (!j || b.type(j) !== "object" || j.nodeType || b.isWindow(j)) return false; if (j.constructor &&
!F.call(j, "constructor") && !F.call(j.constructor.prototype, "isPrototypeOf")) return false; for (var s in j); return s === B || F.call(j, s)
}, isEmptyObject: function (j) { for (var s in j) return false; return true }, error: function (j) { throw j; }, parseJSON: function (j) { if (typeof j !== "string" || !j) return null; j = b.trim(j); if (C.test(j.replace(J, "@").replace(w, "]").replace(I, ""))) return E.JSON && E.JSON.parse ? E.JSON.parse(j) : (new Function("return " + j))(); else b.error("Invalid JSON: " + j) }, noop: function () { }, globalEval: function (j) {
	if (j &&
l.test(j)) { var s = t.getElementsByTagName("head")[0] || t.documentElement, v = t.createElement("script"); v.type = "text/javascript"; if (b.support.scriptEval) v.appendChild(t.createTextNode(j)); else v.text = j; s.insertBefore(v, s.firstChild); s.removeChild(v) }
}, nodeName: function (j, s) { return j.nodeName && j.nodeName.toUpperCase() === s.toUpperCase() }, each: function (j, s, v) {
	var z, H = 0, G = j.length, K = G === B || b.isFunction(j); if (v) if (K) for (z in j) { if (s.apply(j[z], v) === false) break } else for (; H < G; ) { if (s.apply(j[H++], v) === false) break } else if (K) for (z in j) {
		if (s.call(j[z],
z, j[z]) === false) break
	} else for (v = j[0]; H < G && s.call(v, H, v) !== false; v = j[++H]); return j
}, trim: O ? function (j) { return j == null ? "" : O.call(j) } : function (j) { return j == null ? "" : j.toString().replace(k, "").replace(o, "") }, makeArray: function (j, s) { var v = s || []; if (j != null) { var z = b.type(j); j.length == null || z === "string" || z === "function" || z === "regexp" || b.isWindow(j) ? M.call(v, j) : b.merge(v, j) } return v }, inArray: function (j, s) { if (s.indexOf) return s.indexOf(j); for (var v = 0, z = s.length; v < z; v++) if (s[v] === j) return v; return -1 }, merge: function (j,
s) { var v = j.length, z = 0; if (typeof s.length === "number") for (var H = s.length; z < H; z++) j[v++] = s[z]; else for (; s[z] !== B; ) j[v++] = s[z++]; j.length = v; return j }, grep: function (j, s, v) { var z = [], H; v = !!v; for (var G = 0, K = j.length; G < K; G++) { H = !!s(j[G], G); v !== H && z.push(j[G]) } return z }, map: function (j, s, v) { for (var z = [], H, G = 0, K = j.length; G < K; G++) { H = s(j[G], G, v); if (H != null) z[z.length] = H } return z.concat.apply([], z) }, guid: 1, proxy: function (j, s, v) {
	if (arguments.length === 2) if (typeof s === "string") { v = j; j = v[s]; s = B } else if (s && !b.isFunction(s)) {
		v =
s; s = B
	} if (!s && j) s = function () { return j.apply(v || this, arguments) }; if (j) s.guid = j.guid = j.guid || s.guid || b.guid++; return s
}, access: function (j, s, v, z, H, G) { var K = j.length; if (typeof s === "object") { for (var Q in s) b.access(j, Q, s[Q], z, H, v); return j } if (v !== B) { z = !G && z && b.isFunction(v); for (Q = 0; Q < K; Q++) H(j[Q], s, z ? v.call(j[Q], Q, H(j[Q], s)) : v, G); return j } return K ? H(j[0], s) : B }, now: function () { return (new Date).getTime() }, uaMatch: function (j) {
	j = j.toLowerCase(); j = L.exec(j) || g.exec(j) || i.exec(j) || j.indexOf("compatible") < 0 && n.exec(j) ||
[]; return { browser: j[1] || "", version: j[2] || "0" }
}, browser: {}
}); b.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (j, s) { R["[object " + s + "]"] = s.toLowerCase() }); m = b.uaMatch(m); if (m.browser) { b.browser[m.browser] = true; b.browser.version = m.version } if (b.browser.webkit) b.browser.safari = true; if (D) b.inArray = function (j, s) { return D.call(s, j) }; if (!/\s/.test("\u00a0")) { k = /^[\s\xA0]+/; o = /[\s\xA0]+$/ } f = b(t); if (t.addEventListener) u = function () {
	t.removeEventListener("DOMContentLoaded", u,
false); b.ready()
}; else if (t.attachEvent) u = function () { if (t.readyState === "complete") { t.detachEvent("onreadystatechange", u); b.ready() } }; return E.jQuery = E.$ = b
	} (); (function () {
		c.support = {}; var a = t.documentElement, b = t.createElement("script"), d = t.createElement("div"), e = "script" + c.now(); d.style.display = "none"; d.innerHTML = "   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; var f = d.getElementsByTagName("*"), h = d.getElementsByTagName("a")[0], l = t.createElement("select"),
k = l.appendChild(t.createElement("option")); if (!(!f || !f.length || !h)) {
			c.support = { leadingWhitespace: d.firstChild.nodeType === 3, tbody: !d.getElementsByTagName("tbody").length, htmlSerialize: !!d.getElementsByTagName("link").length, style: /red/.test(h.getAttribute("style")), hrefNormalized: h.getAttribute("href") === "/a", opacity: /^0.55$/.test(h.style.opacity), cssFloat: !!h.style.cssFloat, checkOn: d.getElementsByTagName("input")[0].value === "on", optSelected: k.selected, deleteExpando: true, optDisabled: false, checkClone: false,
				scriptEval: false, noCloneEvent: true, boxModel: null, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableHiddenOffsets: true
			}; l.disabled = true; c.support.optDisabled = !k.disabled; b.type = "text/javascript"; try { b.appendChild(t.createTextNode("window." + e + "=1;")) } catch (o) { } a.insertBefore(b, a.firstChild); if (E[e]) { c.support.scriptEval = true; delete E[e] } try { delete b.test } catch (x) { c.support.deleteExpando = false } a.removeChild(b); if (d.attachEvent && d.fireEvent) {
				d.attachEvent("onclick", function r() {
					c.support.noCloneEvent =
false; d.detachEvent("onclick", r)
				}); d.cloneNode(true).fireEvent("onclick")
			} d = t.createElement("div"); d.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; a = t.createDocumentFragment(); a.appendChild(d.firstChild); c.support.checkClone = a.cloneNode(true).cloneNode(true).lastChild.checked; c(function () {
				var r = t.createElement("div"); r.style.width = r.style.paddingLeft = "1px"; t.body.appendChild(r); c.boxModel = c.support.boxModel = r.offsetWidth === 2; if ("zoom" in r.style) {
					r.style.display = "inline"; r.style.zoom =
1; c.support.inlineBlockNeedsLayout = r.offsetWidth === 2; r.style.display = ""; r.innerHTML = "<div style='width:4px;'></div>"; c.support.shrinkWrapBlocks = r.offsetWidth !== 2
				} r.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>"; var A = r.getElementsByTagName("td"); c.support.reliableHiddenOffsets = A[0].offsetHeight === 0; A[0].style.display = ""; A[1].style.display = "none"; c.support.reliableHiddenOffsets = c.support.reliableHiddenOffsets && A[0].offsetHeight === 0; r.innerHTML = ""; t.body.removeChild(r).style.display =
"none"
			}); a = function (r) { var A = t.createElement("div"); r = "on" + r; var C = r in A; if (!C) { A.setAttribute(r, "return;"); C = typeof A[r] === "function" } return C }; c.support.submitBubbles = a("submit"); c.support.changeBubbles = a("change"); a = b = d = f = h = null
		}
	})(); var ra = {}, Ja = /^(?:\{.*\}|\[.*\])$/; c.extend({ cache: {}, uuid: 0, expando: "jQuery" + c.now(), noData: { embed: true, object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet: true }, data: function (a, b, d) {
		if (c.acceptData(a)) {
			a = a == E ? ra : a; var e = a.nodeType, f = e ? a[c.expando] : null, h =
c.cache; if (!(e && !f && typeof b === "string" && d === B)) { if (e) f || (a[c.expando] = f = ++c.uuid); else h = a; if (typeof b === "object") if (e) h[f] = c.extend(h[f], b); else c.extend(h, b); else if (e && !h[f]) h[f] = {}; a = e ? h[f] : h; if (d !== B) a[b] = d; return typeof b === "string" ? a[b] : a }
		}
	}, removeData: function (a, b) {
		if (c.acceptData(a)) {
			a = a == E ? ra : a; var d = a.nodeType, e = d ? a[c.expando] : a, f = c.cache, h = d ? f[e] : e; if (b) { if (h) { delete h[b]; d && c.isEmptyObject(h) && c.removeData(a) } } else if (d && c.support.deleteExpando) delete a[c.expando]; else if (a.removeAttribute) a.removeAttribute(c.expando);
			else if (d) delete f[e]; else for (var l in a) delete a[l]
		}
	}, acceptData: function (a) { if (a.nodeName) { var b = c.noData[a.nodeName.toLowerCase()]; if (b) return !(b === true || a.getAttribute("classid") !== b) } return true }
	}); c.fn.extend({ data: function (a, b) {
		var d = null; if (typeof a === "undefined") { if (this.length) { var e = this[0].attributes, f; d = c.data(this[0]); for (var h = 0, l = e.length; h < l; h++) { f = e[h].name; if (f.indexOf("data-") === 0) { f = f.substr(5); ka(this[0], f, d[f]) } } } return d } else if (typeof a === "object") return this.each(function () {
			c.data(this,
a)
		}); var k = a.split("."); k[1] = k[1] ? "." + k[1] : ""; if (b === B) { d = this.triggerHandler("getData" + k[1] + "!", [k[0]]); if (d === B && this.length) { d = c.data(this[0], a); d = ka(this[0], a, d) } return d === B && k[1] ? this.data(k[0]) : d } else return this.each(function () { var o = c(this), x = [k[0], b]; o.triggerHandler("setData" + k[1] + "!", x); c.data(this, a, b); o.triggerHandler("changeData" + k[1] + "!", x) })
	}, removeData: function (a) { return this.each(function () { c.removeData(this, a) }) }
	}); c.extend({ queue: function (a, b, d) {
		if (a) {
			b = (b || "fx") + "queue"; var e =
c.data(a, b); if (!d) return e || []; if (!e || c.isArray(d)) e = c.data(a, b, c.makeArray(d)); else e.push(d); return e
		}
	}, dequeue: function (a, b) { b = b || "fx"; var d = c.queue(a, b), e = d.shift(); if (e === "inprogress") e = d.shift(); if (e) { b === "fx" && d.unshift("inprogress"); e.call(a, function () { c.dequeue(a, b) }) } }
	}); c.fn.extend({ queue: function (a, b) { if (typeof a !== "string") { b = a; a = "fx" } if (b === B) return c.queue(this[0], a); return this.each(function () { var d = c.queue(this, a, b); a === "fx" && d[0] !== "inprogress" && c.dequeue(this, a) }) }, dequeue: function (a) {
		return this.each(function () {
			c.dequeue(this,
a)
		})
	}, delay: function (a, b) { a = c.fx ? c.fx.speeds[a] || a : a; b = b || "fx"; return this.queue(b, function () { var d = this; setTimeout(function () { c.dequeue(d, b) }, a) }) }, clearQueue: function (a) { return this.queue(a || "fx", []) }
	}); var sa = /[\n\t]/g, ha = /\s+/, Sa = /\r/g, Ta = /^(?:href|src|style)$/, Ua = /^(?:button|input)$/i, Va = /^(?:button|input|object|select|textarea)$/i, Wa = /^a(?:rea)?$/i, ta = /^(?:radio|checkbox)$/i; c.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan",
		colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder"
	}; c.fn.extend({ attr: function (a, b) { return c.access(this, a, b, true, c.attr) }, removeAttr: function (a) { return this.each(function () { c.attr(this, a, ""); this.nodeType === 1 && this.removeAttribute(a) }) }, addClass: function (a) {
		if (c.isFunction(a)) return this.each(function (x) { var r = c(this); r.addClass(a.call(this, x, r.attr("class"))) }); if (a && typeof a === "string") for (var b = (a || "").split(ha), d = 0, e = this.length; d < e; d++) {
			var f = this[d]; if (f.nodeType ===
1) if (f.className) { for (var h = " " + f.className + " ", l = f.className, k = 0, o = b.length; k < o; k++) if (h.indexOf(" " + b[k] + " ") < 0) l += " " + b[k]; f.className = c.trim(l) } else f.className = a
		} return this
	}, removeClass: function (a) {
		if (c.isFunction(a)) return this.each(function (o) { var x = c(this); x.removeClass(a.call(this, o, x.attr("class"))) }); if (a && typeof a === "string" || a === B) for (var b = (a || "").split(ha), d = 0, e = this.length; d < e; d++) {
			var f = this[d]; if (f.nodeType === 1 && f.className) if (a) {
				for (var h = (" " + f.className + " ").replace(sa, " "),
l = 0, k = b.length; l < k; l++) h = h.replace(" " + b[l] + " ", " "); f.className = c.trim(h)
			} else f.className = ""
		} return this
	}, toggleClass: function (a, b) {
		var d = typeof a, e = typeof b === "boolean"; if (c.isFunction(a)) return this.each(function (f) { var h = c(this); h.toggleClass(a.call(this, f, h.attr("class"), b), b) }); return this.each(function () {
			if (d === "string") for (var f, h = 0, l = c(this), k = b, o = a.split(ha); f = o[h++]; ) { k = e ? k : !l.hasClass(f); l[k ? "addClass" : "removeClass"](f) } else if (d === "undefined" || d === "boolean") {
				this.className && c.data(this,
"__className__", this.className); this.className = this.className || a === false ? "" : c.data(this, "__className__") || ""
			}
		})
	}, hasClass: function (a) { a = " " + a + " "; for (var b = 0, d = this.length; b < d; b++) if ((" " + this[b].className + " ").replace(sa, " ").indexOf(a) > -1) return true; return false }, val: function (a) {
		if (!arguments.length) {
			var b = this[0]; if (b) {
				if (c.nodeName(b, "option")) { var d = b.attributes.value; return !d || d.specified ? b.value : b.text } if (c.nodeName(b, "select")) {
					var e = b.selectedIndex; d = []; var f = b.options; b = b.type === "select-one";
					if (e < 0) return null; var h = b ? e : 0; for (e = b ? e + 1 : f.length; h < e; h++) { var l = f[h]; if (l.selected && (c.support.optDisabled ? !l.disabled : l.getAttribute("disabled") === null) && (!l.parentNode.disabled || !c.nodeName(l.parentNode, "optgroup"))) { a = c(l).val(); if (b) return a; d.push(a) } } return d
				} if (ta.test(b.type) && !c.support.checkOn) return b.getAttribute("value") === null ? "on" : b.value; return (b.value || "").replace(Sa, "")
			} return B
		} var k = c.isFunction(a); return this.each(function (o) {
			var x = c(this), r = a; if (this.nodeType === 1) {
				if (k) r =
a.call(this, o, x.val()); if (r == null) r = ""; else if (typeof r === "number") r += ""; else if (c.isArray(r)) r = c.map(r, function (C) { return C == null ? "" : C + "" }); if (c.isArray(r) && ta.test(this.type)) this.checked = c.inArray(x.val(), r) >= 0; else if (c.nodeName(this, "select")) { var A = c.makeArray(r); c("option", this).each(function () { this.selected = c.inArray(c(this).val(), A) >= 0 }); if (!A.length) this.selectedIndex = -1 } else this.value = r
			}
		})
	}
	}); c.extend({ attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true },
		attr: function (a, b, d, e) {
			if (!a || a.nodeType === 3 || a.nodeType === 8) return B; if (e && b in c.attrFn) return c(a)[b](d); e = a.nodeType !== 1 || !c.isXMLDoc(a); var f = d !== B; b = e && c.props[b] || b; var h = Ta.test(b); if ((b in a || a[b] !== B) && e && !h) {
				if (f) { b === "type" && Ua.test(a.nodeName) && a.parentNode && c.error("type property can't be changed"); if (d === null) a.nodeType === 1 && a.removeAttribute(b); else a[b] = d } if (c.nodeName(a, "form") && a.getAttributeNode(b)) return a.getAttributeNode(b).nodeValue; if (b === "tabIndex") return (b = a.getAttributeNode("tabIndex")) &&
b.specified ? b.value : Va.test(a.nodeName) || Wa.test(a.nodeName) && a.href ? 0 : B; return a[b]
			} if (!c.support.style && e && b === "style") { if (f) a.style.cssText = "" + d; return a.style.cssText } f && a.setAttribute(b, "" + d); if (!a.attributes[b] && a.hasAttribute && !a.hasAttribute(b)) return B; a = !c.support.hrefNormalized && e && h ? a.getAttribute(b, 2) : a.getAttribute(b); return a === null ? B : a
		}
	}); var X = /\.(.*)$/, ia = /^(?:textarea|input|select)$/i, La = /\./g, Ma = / /g, Xa = /[^\w\s.|`]/g, Ya = function (a) { return a.replace(Xa, "\\$&") }, ua = { focusin: 0, focusout: 0 };
	c.event = { add: function (a, b, d, e) {
		if (!(a.nodeType === 3 || a.nodeType === 8)) {
			if (c.isWindow(a) && a !== E && !a.frameElement) a = E; if (d === false) d = U; else if (!d) return; var f, h; if (d.handler) { f = d; d = f.handler } if (!d.guid) d.guid = c.guid++; if (h = c.data(a)) {
				var l = a.nodeType ? "events" : "__events__", k = h[l], o = h.handle; if (typeof k === "function") { o = k.handle; k = k.events } else if (!k) { a.nodeType || (h[l] = h = function () { }); h.events = k = {} } if (!o) h.handle = o = function () {
					return typeof c !== "undefined" && !c.event.triggered ? c.event.handle.apply(o.elem,
arguments) : B
				}; o.elem = a; b = b.split(" "); for (var x = 0, r; l = b[x++]; ) {
					h = f ? c.extend({}, f) : { handler: d, data: e }; if (l.indexOf(".") > -1) { r = l.split("."); l = r.shift(); h.namespace = r.slice(0).sort().join(".") } else { r = []; h.namespace = "" } h.type = l; if (!h.guid) h.guid = d.guid; var A = k[l], C = c.event.special[l] || {}; if (!A) { A = k[l] = []; if (!C.setup || C.setup.call(a, e, r, o) === false) if (a.addEventListener) a.addEventListener(l, o, false); else a.attachEvent && a.attachEvent("on" + l, o) } if (C.add) {
						C.add.call(a, h); if (!h.handler.guid) h.handler.guid =
d.guid
					} A.push(h); c.event.global[l] = true
				} a = null
			}
		}
	}, global: {}, remove: function (a, b, d, e) {
		if (!(a.nodeType === 3 || a.nodeType === 8)) {
			if (d === false) d = U; var f, h, l = 0, k, o, x, r, A, C, J = a.nodeType ? "events" : "__events__", w = c.data(a), I = w && w[J]; if (w && I) {
				if (typeof I === "function") { w = I; I = I.events } if (b && b.type) { d = b.handler; b = b.type } if (!b || typeof b === "string" && b.charAt(0) === ".") { b = b || ""; for (f in I) c.event.remove(a, f + b) } else {
					for (b = b.split(" "); f = b[l++]; ) {
						r = f; k = f.indexOf(".") < 0; o = []; if (!k) {
							o = f.split("."); f = o.shift(); x = RegExp("(^|\\.)" +
c.map(o.slice(0).sort(), Ya).join("\\.(?:.*\\.)?") + "(\\.|$)")
						} if (A = I[f]) if (d) { r = c.event.special[f] || {}; for (h = e || 0; h < A.length; h++) { C = A[h]; if (d.guid === C.guid) { if (k || x.test(C.namespace)) { e == null && A.splice(h--, 1); r.remove && r.remove.call(a, C) } if (e != null) break } } if (A.length === 0 || e != null && A.length === 1) { if (!r.teardown || r.teardown.call(a, o) === false) c.removeEvent(a, f, w.handle); delete I[f] } } else for (h = 0; h < A.length; h++) { C = A[h]; if (k || x.test(C.namespace)) { c.event.remove(a, r, C.handler, h); A.splice(h--, 1) } }
					} if (c.isEmptyObject(I)) {
						if (b =
w.handle) b.elem = null; delete w.events; delete w.handle; if (typeof w === "function") c.removeData(a, J); else c.isEmptyObject(w) && c.removeData(a)
					}
				}
			}
		}
	}, trigger: function (a, b, d, e) {
		var f = a.type || a; if (!e) {
			a = typeof a === "object" ? a[c.expando] ? a : c.extend(c.Event(f), a) : c.Event(f); if (f.indexOf("!") >= 0) { a.type = f = f.slice(0, -1); a.exclusive = true } if (!d) { a.stopPropagation(); c.event.global[f] && c.each(c.cache, function () { this.events && this.events[f] && c.event.trigger(a, b, this.handle.elem) }) } if (!d || d.nodeType === 3 || d.nodeType ===
8) return B; a.result = B; a.target = d; b = c.makeArray(b); b.unshift(a)
		} a.currentTarget = d; (e = d.nodeType ? c.data(d, "handle") : (c.data(d, "__events__") || {}).handle) && e.apply(d, b); e = d.parentNode || d.ownerDocument; try { if (!(d && d.nodeName && c.noData[d.nodeName.toLowerCase()])) if (d["on" + f] && d["on" + f].apply(d, b) === false) { a.result = false; a.preventDefault() } } catch (h) { } if (!a.isPropagationStopped() && e) c.event.trigger(a, b, e, true); else if (!a.isDefaultPrevented()) {
			var l; e = a.target; var k = f.replace(X, ""), o = c.nodeName(e, "a") && k ===
"click", x = c.event.special[k] || {}; if ((!x._default || x._default.call(d, a) === false) && !o && !(e && e.nodeName && c.noData[e.nodeName.toLowerCase()])) { try { if (e[k]) { if (l = e["on" + k]) e["on" + k] = null; c.event.triggered = true; e[k]() } } catch (r) { } if (l) e["on" + k] = l; c.event.triggered = false }
		}
	}, handle: function (a) {
		var b, d, e, f; d = []; var h = c.makeArray(arguments); a = h[0] = c.event.fix(a || E.event); a.currentTarget = this; b = a.type.indexOf(".") < 0 && !a.exclusive; if (!b) {
			e = a.type.split("."); a.type = e.shift(); d = e.slice(0).sort(); e = RegExp("(^|\\.)" +
d.join("\\.(?:.*\\.)?") + "(\\.|$)")
		} a.namespace = a.namespace || d.join("."); f = c.data(this, this.nodeType ? "events" : "__events__"); if (typeof f === "function") f = f.events; d = (f || {})[a.type]; if (f && d) { d = d.slice(0); f = 0; for (var l = d.length; f < l; f++) { var k = d[f]; if (b || e.test(k.namespace)) { a.handler = k.handler; a.data = k.data; a.handleObj = k; k = k.handler.apply(this, h); if (k !== B) { a.result = k; if (k === false) { a.preventDefault(); a.stopPropagation() } } if (a.isImmediatePropagationStopped()) break } } } return a.result
	}, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
		fix: function (a) {
			if (a[c.expando]) return a; var b = a; a = c.Event(b); for (var d = this.props.length, e; d; ) { e = this.props[--d]; a[e] = b[e] } if (!a.target) a.target = a.srcElement || t; if (a.target.nodeType === 3) a.target = a.target.parentNode; if (!a.relatedTarget && a.fromElement) a.relatedTarget = a.fromElement === a.target ? a.toElement : a.fromElement; if (a.pageX == null && a.clientX != null) {
				b = t.documentElement; d = t.body; a.pageX = a.clientX + (b && b.scrollLeft || d && d.scrollLeft || 0) - (b && b.clientLeft || d && d.clientLeft || 0); a.pageY = a.clientY + (b && b.scrollTop ||
d && d.scrollTop || 0) - (b && b.clientTop || d && d.clientTop || 0)
			} if (a.which == null && (a.charCode != null || a.keyCode != null)) a.which = a.charCode != null ? a.charCode : a.keyCode; if (!a.metaKey && a.ctrlKey) a.metaKey = a.ctrlKey; if (!a.which && a.button !== B) a.which = a.button & 1 ? 1 : a.button & 2 ? 3 : a.button & 4 ? 2 : 0; return a
		}, guid: 1E8, proxy: c.proxy, special: { ready: { setup: c.bindReady, teardown: c.noop }, live: { add: function (a) { c.event.add(this, Y(a.origType, a.selector), c.extend({}, a, { handler: Ka, guid: a.handler.guid })) }, remove: function (a) {
			c.event.remove(this,
Y(a.origType, a.selector), a)
		}
		}, beforeunload: { setup: function (a, b, d) { if (c.isWindow(this)) this.onbeforeunload = d }, teardown: function (a, b) { if (this.onbeforeunload === b) this.onbeforeunload = null } }
		}
	}; c.removeEvent = t.removeEventListener ? function (a, b, d) { a.removeEventListener && a.removeEventListener(b, d, false) } : function (a, b, d) { a.detachEvent && a.detachEvent("on" + b, d) }; c.Event = function (a) {
		if (!this.preventDefault) return new c.Event(a); if (a && a.type) { this.originalEvent = a; this.type = a.type } else this.type = a; this.timeStamp =
c.now(); this[c.expando] = true
	}; c.Event.prototype = { preventDefault: function () { this.isDefaultPrevented = ca; var a = this.originalEvent; if (a) if (a.preventDefault) a.preventDefault(); else a.returnValue = false }, stopPropagation: function () { this.isPropagationStopped = ca; var a = this.originalEvent; if (a) { a.stopPropagation && a.stopPropagation(); a.cancelBubble = true } }, stopImmediatePropagation: function () { this.isImmediatePropagationStopped = ca; this.stopPropagation() }, isDefaultPrevented: U, isPropagationStopped: U, isImmediatePropagationStopped: U };
	var va = function (a) { var b = a.relatedTarget; try { for (; b && b !== this; ) b = b.parentNode; if (b !== this) { a.type = a.data; c.event.handle.apply(this, arguments) } } catch (d) { } }, wa = function (a) { a.type = a.data; c.event.handle.apply(this, arguments) }; c.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function (a, b) { c.event.special[a] = { setup: function (d) { c.event.add(this, b, d && d.selector ? wa : va, a) }, teardown: function (d) { c.event.remove(this, b, d && d.selector ? wa : va) } } }); if (!c.support.submitBubbles) c.event.special.submit = { setup: function () {
		if (this.nodeName.toLowerCase() !==
"form") { c.event.add(this, "click.specialSubmit", function (a) { var b = a.target, d = b.type; if ((d === "submit" || d === "image") && c(b).closest("form").length) { a.liveFired = B; return la("submit", this, arguments) } }); c.event.add(this, "keypress.specialSubmit", function (a) { var b = a.target, d = b.type; if ((d === "text" || d === "password") && c(b).closest("form").length && a.keyCode === 13) { a.liveFired = B; return la("submit", this, arguments) } }) } else return false
	}, teardown: function () { c.event.remove(this, ".specialSubmit") }
	}; if (!c.support.changeBubbles) {
		var V,
xa = function (a) { var b = a.type, d = a.value; if (b === "radio" || b === "checkbox") d = a.checked; else if (b === "select-multiple") d = a.selectedIndex > -1 ? c.map(a.options, function (e) { return e.selected }).join("-") : ""; else if (a.nodeName.toLowerCase() === "select") d = a.selectedIndex; return d }, Z = function (a, b) {
	var d = a.target, e, f; if (!(!ia.test(d.nodeName) || d.readOnly)) {
		e = c.data(d, "_change_data"); f = xa(d); if (a.type !== "focusout" || d.type !== "radio") c.data(d, "_change_data", f); if (!(e === B || f === e)) if (e != null || f) {
			a.type = "change"; a.liveFired =
B; return c.event.trigger(a, b, d)
		}
	}
}; c.event.special.change = { filters: { focusout: Z, beforedeactivate: Z, click: function (a) { var b = a.target, d = b.type; if (d === "radio" || d === "checkbox" || b.nodeName.toLowerCase() === "select") return Z.call(this, a) }, keydown: function (a) { var b = a.target, d = b.type; if (a.keyCode === 13 && b.nodeName.toLowerCase() !== "textarea" || a.keyCode === 32 && (d === "checkbox" || d === "radio") || d === "select-multiple") return Z.call(this, a) }, beforeactivate: function (a) { a = a.target; c.data(a, "_change_data", xa(a)) } }, setup: function () {
	if (this.type ===
"file") return false; for (var a in V) c.event.add(this, a + ".specialChange", V[a]); return ia.test(this.nodeName)
}, teardown: function () { c.event.remove(this, ".specialChange"); return ia.test(this.nodeName) }
}; V = c.event.special.change.filters; V.focus = V.beforeactivate
	} t.addEventListener && c.each({ focus: "focusin", blur: "focusout" }, function (a, b) {
		function d(e) { e = c.event.fix(e); e.type = b; return c.event.trigger(e, null, e.target) } c.event.special[b] = { setup: function () { ua[b]++ === 0 && t.addEventListener(a, d, true) }, teardown: function () {
			--ua[b] ===
0 && t.removeEventListener(a, d, true)
		}
		}
	}); c.each(["bind", "one"], function (a, b) { c.fn[b] = function (d, e, f) { if (typeof d === "object") { for (var h in d) this[b](h, e, d[h], f); return this } if (c.isFunction(e) || e === false) { f = e; e = B } var l = b === "one" ? c.proxy(f, function (o) { c(this).unbind(o, l); return f.apply(this, arguments) }) : f; if (d === "unload" && b !== "one") this.one(d, e, f); else { h = 0; for (var k = this.length; h < k; h++) c.event.add(this[h], d, l, e) } return this } }); c.fn.extend({ unbind: function (a, b) {
		if (typeof a === "object" && !a.preventDefault) for (var d in a) this.unbind(d,
a[d]); else { d = 0; for (var e = this.length; d < e; d++) c.event.remove(this[d], a, b) } return this
	}, delegate: function (a, b, d, e) { return this.live(b, d, e, a) }, undelegate: function (a, b, d) { return arguments.length === 0 ? this.unbind("live") : this.die(b, null, d, a) }, trigger: function (a, b) { return this.each(function () { c.event.trigger(a, b, this) }) }, triggerHandler: function (a, b) { if (this[0]) { var d = c.Event(a); d.preventDefault(); d.stopPropagation(); c.event.trigger(d, b, this[0]); return d.result } }, toggle: function (a) {
		for (var b = arguments, d =
1; d < b.length; ) c.proxy(a, b[d++]); return this.click(c.proxy(a, function (e) { var f = (c.data(this, "lastToggle" + a.guid) || 0) % d; c.data(this, "lastToggle" + a.guid, f + 1); e.preventDefault(); return b[f].apply(this, arguments) || false }))
	}, hover: function (a, b) { return this.mouseenter(a).mouseleave(b || a) }
	}); var ya = { focus: "focusin", blur: "focusout", mouseenter: "mouseover", mouseleave: "mouseout" }; c.each(["live", "die"], function (a, b) {
		c.fn[b] = function (d, e, f, h) {
			var l, k = 0, o, x, r = h || this.selector; h = h ? this : c(this.context); if (typeof d ===
"object" && !d.preventDefault) { for (l in d) h[b](l, e, d[l], r); return this } if (c.isFunction(e)) { f = e; e = B } for (d = (d || "").split(" "); (l = d[k++]) != null; ) { o = X.exec(l); x = ""; if (o) { x = o[0]; l = l.replace(X, "") } if (l === "hover") d.push("mouseenter" + x, "mouseleave" + x); else { o = l; if (l === "focus" || l === "blur") { d.push(ya[l] + x); l += x } else l = (ya[l] || l) + x; if (b === "live") { x = 0; for (var A = h.length; x < A; x++) c.event.add(h[x], "live." + Y(l, r), { data: e, selector: r, handler: f, origType: l, origHandler: f, preType: o }) } else h.unbind("live." + Y(l, r), f) } } return this
		}
	});
	c.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".split(" "), function (a, b) { c.fn[b] = function (d, e) { if (e == null) { e = d; d = null } return arguments.length > 0 ? this.bind(b, d, e) : this.trigger(b) }; if (c.attrFn) c.attrFn[b] = true }); E.attachEvent && !E.addEventListener && c(E).bind("unload", function () { for (var a in c.cache) if (c.cache[a].handle) try { c.event.remove(c.cache[a].handle.elem) } catch (b) { } });
	(function () {
		function a(g, i, n, m, p, q) { p = 0; for (var u = m.length; p < u; p++) { var y = m[p]; if (y) { var F = false; for (y = y[g]; y; ) { if (y.sizcache === n) { F = m[y.sizset]; break } if (y.nodeType === 1 && !q) { y.sizcache = n; y.sizset = p } if (y.nodeName.toLowerCase() === i) { F = y; break } y = y[g] } m[p] = F } } } function b(g, i, n, m, p, q) {
			p = 0; for (var u = m.length; p < u; p++) {
				var y = m[p]; if (y) {
					var F = false; for (y = y[g]; y; ) {
						if (y.sizcache === n) { F = m[y.sizset]; break } if (y.nodeType === 1) {
							if (!q) { y.sizcache = n; y.sizset = p } if (typeof i !== "string") { if (y === i) { F = true; break } } else if (k.filter(i,
[y]).length > 0) { F = y; break }
						} y = y[g]
					} m[p] = F
				}
			}
		} var d = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, e = 0, f = Object.prototype.toString, h = false, l = true; [0, 0].sort(function () { l = false; return 0 }); var k = function (g, i, n, m) {
			n = n || []; var p = i = i || t; if (i.nodeType !== 1 && i.nodeType !== 9) return []; if (!g || typeof g !== "string") return n; var q, u, y, F, M, N = true, O = k.isXML(i), D = [], R = g; do {
				d.exec(""); if (q = d.exec(R)) {
					R = q[3]; D.push(q[1]); if (q[2]) {
						F = q[3];
						break
					}
				}
			} while (q); if (D.length > 1 && x.exec(g)) if (D.length === 2 && o.relative[D[0]]) u = L(D[0] + D[1], i); else for (u = o.relative[D[0]] ? [i] : k(D.shift(), i); D.length; ) { g = D.shift(); if (o.relative[g]) g += D.shift(); u = L(g, u) } else {
				if (!m && D.length > 1 && i.nodeType === 9 && !O && o.match.ID.test(D[0]) && !o.match.ID.test(D[D.length - 1])) { q = k.find(D.shift(), i, O); i = q.expr ? k.filter(q.expr, q.set)[0] : q.set[0] } if (i) {
					q = m ? { expr: D.pop(), set: C(m)} : k.find(D.pop(), D.length === 1 && (D[0] === "~" || D[0] === "+") && i.parentNode ? i.parentNode : i, O); u = q.expr ? k.filter(q.expr,
q.set) : q.set; if (D.length > 0) y = C(u); else N = false; for (; D.length; ) { q = M = D.pop(); if (o.relative[M]) q = D.pop(); else M = ""; if (q == null) q = i; o.relative[M](y, q, O) }
				} else y = []
			} y || (y = u); y || k.error(M || g); if (f.call(y) === "[object Array]") if (N) if (i && i.nodeType === 1) for (g = 0; y[g] != null; g++) { if (y[g] && (y[g] === true || y[g].nodeType === 1 && k.contains(i, y[g]))) n.push(u[g]) } else for (g = 0; y[g] != null; g++) y[g] && y[g].nodeType === 1 && n.push(u[g]); else n.push.apply(n, y); else C(y, n); if (F) { k(F, p, n, m); k.uniqueSort(n) } return n
		}; k.uniqueSort = function (g) {
			if (w) {
				h =
l; g.sort(w); if (h) for (var i = 1; i < g.length; i++) g[i] === g[i - 1] && g.splice(i--, 1)
			} return g
		}; k.matches = function (g, i) { return k(g, null, null, i) }; k.matchesSelector = function (g, i) { return k(i, null, null, [g]).length > 0 }; k.find = function (g, i, n) {
			var m; if (!g) return []; for (var p = 0, q = o.order.length; p < q; p++) { var u, y = o.order[p]; if (u = o.leftMatch[y].exec(g)) { var F = u[1]; u.splice(1, 1); if (F.substr(F.length - 1) !== "\\") { u[1] = (u[1] || "").replace(/\\/g, ""); m = o.find[y](u, i, n); if (m != null) { g = g.replace(o.match[y], ""); break } } } } m || (m = i.getElementsByTagName("*"));
			return { set: m, expr: g }
		}; k.filter = function (g, i, n, m) {
			for (var p, q, u = g, y = [], F = i, M = i && i[0] && k.isXML(i[0]); g && i.length; ) {
				for (var N in o.filter) if ((p = o.leftMatch[N].exec(g)) != null && p[2]) {
					var O, D, R = o.filter[N]; D = p[1]; q = false; p.splice(1, 1); if (D.substr(D.length - 1) !== "\\") {
						if (F === y) y = []; if (o.preFilter[N]) if (p = o.preFilter[N](p, F, n, y, m, M)) { if (p === true) continue } else q = O = true; if (p) for (var j = 0; (D = F[j]) != null; j++) if (D) { O = R(D, p, j, F); var s = m ^ !!O; if (n && O != null) if (s) q = true; else F[j] = false; else if (s) { y.push(D); q = true } } if (O !==
B) { n || (F = y); g = g.replace(o.match[N], ""); if (!q) return []; break }
					}
				} if (g === u) if (q == null) k.error(g); else break; u = g
			} return F
		}; k.error = function (g) { throw "Syntax error, unrecognized expression: " + g; }; var o = k.selectors = { order: ["ID", "NAME", "TAG"], match: { ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
			POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
		}, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function (g) { return g.getAttribute("href") } }, relative: { "+": function (g, i) {
			var n = typeof i === "string", m = n && !/\W/.test(i); n = n && !m; if (m) i = i.toLowerCase(); m = 0; for (var p = g.length, q; m < p; m++) if (q = g[m]) {
				for (; (q = q.previousSibling) && q.nodeType !== 1; ); g[m] = n || q && q.nodeName.toLowerCase() ===
i ? q || false : q === i
			} n && k.filter(i, g, true)
		}, ">": function (g, i) { var n, m = typeof i === "string", p = 0, q = g.length; if (m && !/\W/.test(i)) for (i = i.toLowerCase(); p < q; p++) { if (n = g[p]) { n = n.parentNode; g[p] = n.nodeName.toLowerCase() === i ? n : false } } else { for (; p < q; p++) if (n = g[p]) g[p] = m ? n.parentNode : n.parentNode === i; m && k.filter(i, g, true) } }, "": function (g, i, n) { var m, p = e++, q = b; if (typeof i === "string" && !/\W/.test(i)) { m = i = i.toLowerCase(); q = a } q("parentNode", i, p, g, m, n) }, "~": function (g, i, n) {
			var m, p = e++, q = b; if (typeof i === "string" && !/\W/.test(i)) {
				m =
i = i.toLowerCase(); q = a
			} q("previousSibling", i, p, g, m, n)
		}
		}, find: { ID: function (g, i, n) { if (typeof i.getElementById !== "undefined" && !n) return (g = i.getElementById(g[1])) && g.parentNode ? [g] : [] }, NAME: function (g, i) { if (typeof i.getElementsByName !== "undefined") { for (var n = [], m = i.getElementsByName(g[1]), p = 0, q = m.length; p < q; p++) m[p].getAttribute("name") === g[1] && n.push(m[p]); return n.length === 0 ? null : n } }, TAG: function (g, i) { return i.getElementsByTagName(g[1]) } }, preFilter: { CLASS: function (g, i, n, m, p, q) {
			g = " " + g[1].replace(/\\/g,
"") + " "; if (q) return g; q = 0; for (var u; (u = i[q]) != null; q++) if (u) if (p ^ (u.className && (" " + u.className + " ").replace(/[\t\n]/g, " ").indexOf(g) >= 0)) n || m.push(u); else if (n) i[q] = false; return false
		}, ID: function (g) { return g[1].replace(/\\/g, "") }, TAG: function (g) { return g[1].toLowerCase() }, CHILD: function (g) { if (g[1] === "nth") { var i = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2] === "even" && "2n" || g[2] === "odd" && "2n+1" || !/\D/.test(g[2]) && "0n+" + g[2] || g[2]); g[2] = i[1] + (i[2] || 1) - 0; g[3] = i[3] - 0 } g[0] = e++; return g }, ATTR: function (g, i, n,
m, p, q) { i = g[1].replace(/\\/g, ""); if (!q && o.attrMap[i]) g[1] = o.attrMap[i]; if (g[2] === "~=") g[4] = " " + g[4] + " "; return g }, PSEUDO: function (g, i, n, m, p) { if (g[1] === "not") if ((d.exec(g[3]) || "").length > 1 || /^\w/.test(g[3])) g[3] = k(g[3], null, null, i); else { g = k.filter(g[3], i, n, true ^ p); n || m.push.apply(m, g); return false } else if (o.match.POS.test(g[0]) || o.match.CHILD.test(g[0])) return true; return g }, POS: function (g) { g.unshift(true); return g }
		}, filters: { enabled: function (g) { return g.disabled === false && g.type !== "hidden" }, disabled: function (g) {
			return g.disabled ===
true
		}, checked: function (g) { return g.checked === true }, selected: function (g) { return g.selected === true }, parent: function (g) { return !!g.firstChild }, empty: function (g) { return !g.firstChild }, has: function (g, i, n) { return !!k(n[3], g).length }, header: function (g) { return /h\d/i.test(g.nodeName) }, text: function (g) { return "text" === g.type }, radio: function (g) { return "radio" === g.type }, checkbox: function (g) { return "checkbox" === g.type }, file: function (g) { return "file" === g.type }, password: function (g) { return "password" === g.type }, submit: function (g) {
			return "submit" ===
g.type
		}, image: function (g) { return "image" === g.type }, reset: function (g) { return "reset" === g.type }, button: function (g) { return "button" === g.type || g.nodeName.toLowerCase() === "button" }, input: function (g) { return /input|select|textarea|button/i.test(g.nodeName) }
		}, setFilters: { first: function (g, i) { return i === 0 }, last: function (g, i, n, m) { return i === m.length - 1 }, even: function (g, i) { return i % 2 === 0 }, odd: function (g, i) { return i % 2 === 1 }, lt: function (g, i, n) { return i < n[3] - 0 }, gt: function (g, i, n) { return i > n[3] - 0 }, nth: function (g, i, n) {
			return n[3] -
0 === i
		}, eq: function (g, i, n) { return n[3] - 0 === i }
		}, filter: { PSEUDO: function (g, i, n, m) { var p = i[1], q = o.filters[p]; if (q) return q(g, n, i, m); else if (p === "contains") return (g.textContent || g.innerText || k.getText([g]) || "").indexOf(i[3]) >= 0; else if (p === "not") { i = i[3]; n = 0; for (m = i.length; n < m; n++) if (i[n] === g) return false; return true } else k.error("Syntax error, unrecognized expression: " + p) }, CHILD: function (g, i) {
			var n = i[1], m = g; switch (n) {
				case "only": case "first": for (; m = m.previousSibling; ) if (m.nodeType === 1) return false; if (n ===
"first") return true; m = g; case "last": for (; m = m.nextSibling; ) if (m.nodeType === 1) return false; return true; case "nth": n = i[2]; var p = i[3]; if (n === 1 && p === 0) return true; var q = i[0], u = g.parentNode; if (u && (u.sizcache !== q || !g.nodeIndex)) { var y = 0; for (m = u.firstChild; m; m = m.nextSibling) if (m.nodeType === 1) m.nodeIndex = ++y; u.sizcache = q } m = g.nodeIndex - p; return n === 0 ? m === 0 : m % n === 0 && m / n >= 0
			}
		}, ID: function (g, i) { return g.nodeType === 1 && g.getAttribute("id") === i }, TAG: function (g, i) {
			return i === "*" && g.nodeType === 1 || g.nodeName.toLowerCase() ===
i
		}, CLASS: function (g, i) { return (" " + (g.className || g.getAttribute("class")) + " ").indexOf(i) > -1 }, ATTR: function (g, i) { var n = i[1]; n = o.attrHandle[n] ? o.attrHandle[n](g) : g[n] != null ? g[n] : g.getAttribute(n); var m = n + "", p = i[2], q = i[4]; return n == null ? p === "!=" : p === "=" ? m === q : p === "*=" ? m.indexOf(q) >= 0 : p === "~=" ? (" " + m + " ").indexOf(q) >= 0 : !q ? m && n !== false : p === "!=" ? m !== q : p === "^=" ? m.indexOf(q) === 0 : p === "$=" ? m.substr(m.length - q.length) === q : p === "|=" ? m === q || m.substr(0, q.length + 1) === q + "-" : false }, POS: function (g, i, n, m) {
			var p = o.setFilters[i[2]];
			if (p) return p(g, n, i, m)
		}
		}
		}, x = o.match.POS, r = function (g, i) { return "\\" + (i - 0 + 1) }, A; for (A in o.match) { o.match[A] = RegExp(o.match[A].source + /(?![^\[]*\])(?![^\(]*\))/.source); o.leftMatch[A] = RegExp(/(^(?:.|\r|\n)*?)/.source + o.match[A].source.replace(/\\(\d+)/g, r)) } var C = function (g, i) { g = Array.prototype.slice.call(g, 0); if (i) { i.push.apply(i, g); return i } return g }; try { Array.prototype.slice.call(t.documentElement.childNodes, 0) } catch (J) {
			C = function (g, i) {
				var n = 0, m = i || []; if (f.call(g) === "[object Array]") Array.prototype.push.apply(m,
g); else if (typeof g.length === "number") for (var p = g.length; n < p; n++) m.push(g[n]); else for (; g[n]; n++) m.push(g[n]); return m
			}
		} var w, I; if (t.documentElement.compareDocumentPosition) w = function (g, i) { if (g === i) { h = true; return 0 } if (!g.compareDocumentPosition || !i.compareDocumentPosition) return g.compareDocumentPosition ? -1 : 1; return g.compareDocumentPosition(i) & 4 ? -1 : 1 }; else {
			w = function (g, i) {
				var n, m, p = [], q = []; n = g.parentNode; m = i.parentNode; var u = n; if (g === i) { h = true; return 0 } else if (n === m) return I(g, i); else if (n) { if (!m) return 1 } else return -1;
				for (; u; ) { p.unshift(u); u = u.parentNode } for (u = m; u; ) { q.unshift(u); u = u.parentNode } n = p.length; m = q.length; for (u = 0; u < n && u < m; u++) if (p[u] !== q[u]) return I(p[u], q[u]); return u === n ? I(g, q[u], -1) : I(p[u], i, 1)
			}; I = function (g, i, n) { if (g === i) return n; for (g = g.nextSibling; g; ) { if (g === i) return -1; g = g.nextSibling } return 1 }
		} k.getText = function (g) { for (var i = "", n, m = 0; g[m]; m++) { n = g[m]; if (n.nodeType === 3 || n.nodeType === 4) i += n.nodeValue; else if (n.nodeType !== 8) i += k.getText(n.childNodes) } return i }; (function () {
			var g = t.createElement("div"),
i = "script" + (new Date).getTime(), n = t.documentElement; g.innerHTML = "<a name='" + i + "'/>"; n.insertBefore(g, n.firstChild); if (t.getElementById(i)) { o.find.ID = function (m, p, q) { if (typeof p.getElementById !== "undefined" && !q) return (p = p.getElementById(m[1])) ? p.id === m[1] || typeof p.getAttributeNode !== "undefined" && p.getAttributeNode("id").nodeValue === m[1] ? [p] : B : [] }; o.filter.ID = function (m, p) { var q = typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id"); return m.nodeType === 1 && q && q.nodeValue === p } } n.removeChild(g);
			n = g = null
		})(); (function () { var g = t.createElement("div"); g.appendChild(t.createComment("")); if (g.getElementsByTagName("*").length > 0) o.find.TAG = function (i, n) { var m = n.getElementsByTagName(i[1]); if (i[1] === "*") { for (var p = [], q = 0; m[q]; q++) m[q].nodeType === 1 && p.push(m[q]); m = p } return m }; g.innerHTML = "<a href='#'></a>"; if (g.firstChild && typeof g.firstChild.getAttribute !== "undefined" && g.firstChild.getAttribute("href") !== "#") o.attrHandle.href = function (i) { return i.getAttribute("href", 2) }; g = null })(); t.querySelectorAll &&
function () {
	var g = k, i = t.createElement("div"); i.innerHTML = "<p class='TEST'></p>"; if (!(i.querySelectorAll && i.querySelectorAll(".TEST").length === 0)) {
		k = function (m, p, q, u) {
			p = p || t; m = m.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if (!u && !k.isXML(p)) if (p.nodeType === 9) try { return C(p.querySelectorAll(m), q) } catch (y) { } else if (p.nodeType === 1 && p.nodeName.toLowerCase() !== "object") {
				var F = p.getAttribute("id"), M = F || "__sizzle__"; F || p.setAttribute("id", M); try { return C(p.querySelectorAll("#" + M + " " + m), q) } catch (N) { } finally {
					F ||
p.removeAttribute("id")
				}
			} return g(m, p, q, u)
		}; for (var n in g) k[n] = g[n]; i = null
	}
} (); (function () { var g = t.documentElement, i = g.matchesSelector || g.mozMatchesSelector || g.webkitMatchesSelector || g.msMatchesSelector, n = false; try { i.call(t.documentElement, "[test!='']:sizzle") } catch (m) { n = true } if (i) k.matchesSelector = function (p, q) { q = q.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if (!k.isXML(p)) try { if (n || !o.match.PSEUDO.test(q) && !/!=/.test(q)) return i.call(p, q) } catch (u) { } return k(q, null, null, [p]).length > 0 } })(); (function () {
	var g =
t.createElement("div"); g.innerHTML = "<div class='test e'></div><div class='test'></div>"; if (!(!g.getElementsByClassName || g.getElementsByClassName("e").length === 0)) { g.lastChild.className = "e"; if (g.getElementsByClassName("e").length !== 1) { o.order.splice(1, 0, "CLASS"); o.find.CLASS = function (i, n, m) { if (typeof n.getElementsByClassName !== "undefined" && !m) return n.getElementsByClassName(i[1]) }; g = null } }
})(); k.contains = t.documentElement.contains ? function (g, i) { return g !== i && (g.contains ? g.contains(i) : true) } : t.documentElement.compareDocumentPosition ?
function (g, i) { return !!(g.compareDocumentPosition(i) & 16) } : function () { return false }; k.isXML = function (g) { return (g = (g ? g.ownerDocument || g : 0).documentElement) ? g.nodeName !== "HTML" : false }; var L = function (g, i) { for (var n, m = [], p = "", q = i.nodeType ? [i] : i; n = o.match.PSEUDO.exec(g); ) { p += n[0]; g = g.replace(o.match.PSEUDO, "") } g = o.relative[g] ? g + "*" : g; n = 0; for (var u = q.length; n < u; n++) k(g, q[n], m); return k.filter(p, m) }; c.find = k; c.expr = k.selectors; c.expr[":"] = c.expr.filters; c.unique = k.uniqueSort; c.text = k.getText; c.isXMLDoc = k.isXML;
		c.contains = k.contains
	})(); var Za = /Until$/, $a = /^(?:parents|prevUntil|prevAll)/, ab = /,/, Na = /^.[^:#\[\.,]*$/, bb = Array.prototype.slice, cb = c.expr.match.POS; c.fn.extend({ find: function (a) { for (var b = this.pushStack("", "find", a), d = 0, e = 0, f = this.length; e < f; e++) { d = b.length; c.find(a, this[e], b); if (e > 0) for (var h = d; h < b.length; h++) for (var l = 0; l < d; l++) if (b[l] === b[h]) { b.splice(h--, 1); break } } return b }, has: function (a) { var b = c(a); return this.filter(function () { for (var d = 0, e = b.length; d < e; d++) if (c.contains(this, b[d])) return true }) },
		not: function (a) { return this.pushStack(ma(this, a, false), "not", a) }, filter: function (a) { return this.pushStack(ma(this, a, true), "filter", a) }, is: function (a) { return !!a && c.filter(a, this).length > 0 }, closest: function (a, b) {
			var d = [], e, f, h = this[0]; if (c.isArray(a)) {
				var l, k = {}, o = 1; if (h && a.length) {
					e = 0; for (f = a.length; e < f; e++) { l = a[e]; k[l] || (k[l] = c.expr.match.POS.test(l) ? c(l, b || this.context) : l) } for (; h && h.ownerDocument && h !== b; ) {
						for (l in k) { e = k[l]; if (e.jquery ? e.index(h) > -1 : c(h).is(e)) d.push({ selector: l, elem: h, level: o }) } h =
h.parentNode; o++
					}
				} return d
			} l = cb.test(a) ? c(a, b || this.context) : null; e = 0; for (f = this.length; e < f; e++) for (h = this[e]; h; ) if (l ? l.index(h) > -1 : c.find.matchesSelector(h, a)) { d.push(h); break } else { h = h.parentNode; if (!h || !h.ownerDocument || h === b) break } d = d.length > 1 ? c.unique(d) : d; return this.pushStack(d, "closest", a)
		}, index: function (a) { if (!a || typeof a === "string") return c.inArray(this[0], a ? c(a) : this.parent().children()); return c.inArray(a.jquery ? a[0] : a, this) }, add: function (a, b) {
			var d = typeof a === "string" ? c(a, b || this.context) :
c.makeArray(a), e = c.merge(this.get(), d); return this.pushStack(!d[0] || !d[0].parentNode || d[0].parentNode.nodeType === 11 || !e[0] || !e[0].parentNode || e[0].parentNode.nodeType === 11 ? e : c.unique(e))
		}, andSelf: function () { return this.add(this.prevObject) }
	}); c.each({ parent: function (a) { return (a = a.parentNode) && a.nodeType !== 11 ? a : null }, parents: function (a) { return c.dir(a, "parentNode") }, parentsUntil: function (a, b, d) { return c.dir(a, "parentNode", d) }, next: function (a) { return c.nth(a, 2, "nextSibling") }, prev: function (a) {
		return c.nth(a,
2, "previousSibling")
	}, nextAll: function (a) { return c.dir(a, "nextSibling") }, prevAll: function (a) { return c.dir(a, "previousSibling") }, nextUntil: function (a, b, d) { return c.dir(a, "nextSibling", d) }, prevUntil: function (a, b, d) { return c.dir(a, "previousSibling", d) }, siblings: function (a) { return c.sibling(a.parentNode.firstChild, a) }, children: function (a) { return c.sibling(a.firstChild) }, contents: function (a) { return c.nodeName(a, "iframe") ? a.contentDocument || a.contentWindow.document : c.makeArray(a.childNodes) }
	}, function (a,
b) { c.fn[a] = function (d, e) { var f = c.map(this, b, d); Za.test(a) || (e = d); if (e && typeof e === "string") f = c.filter(e, f); f = this.length > 1 ? c.unique(f) : f; if ((this.length > 1 || ab.test(e)) && $a.test(a)) f = f.reverse(); return this.pushStack(f, a, bb.call(arguments).join(",")) } }); c.extend({ filter: function (a, b, d) { if (d) a = ":not(" + a + ")"; return b.length === 1 ? c.find.matchesSelector(b[0], a) ? [b[0]] : [] : c.find.matches(a, b) }, dir: function (a, b, d) {
	var e = []; for (a = a[b]; a && a.nodeType !== 9 && (d === B || a.nodeType !== 1 || !c(a).is(d)); ) {
		a.nodeType === 1 &&
e.push(a); a = a[b]
	} return e
}, nth: function (a, b, d) { b = b || 1; for (var e = 0; a; a = a[d]) if (a.nodeType === 1 && ++e === b) break; return a }, sibling: function (a, b) { for (var d = []; a; a = a.nextSibling) a.nodeType === 1 && a !== b && d.push(a); return d }
}); var za = / jQuery\d+="(?:\d+|null)"/g, $ = /^\s+/, Aa = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, Ba = /<([\w:]+)/, db = /<tbody/i, eb = /<|&#?\w+;/, Ca = /<(?:script|object|embed|option|style)/i, Da = /checked\s*(?:[^=]|=\s*.checked.)/i, fb = /\=([^="'>\s]+\/)>/g, P = { option: [1,
"<select multiple='multiple'>", "</select>"], legend: [1, "<fieldset>", "</fieldset>"], thead: [1, "<table>", "</table>"], tr: [2, "<table><tbody>", "</tbody></table>"], td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], area: [1, "<map>", "</map>"], _default: [0, "", ""]
}; P.optgroup = P.option; P.tbody = P.tfoot = P.colgroup = P.caption = P.thead; P.th = P.td; if (!c.support.htmlSerialize) P._default = [1, "div<div>", "</div>"]; c.fn.extend({ text: function (a) {
	if (c.isFunction(a)) return this.each(function (b) {
		var d =
c(this); d.text(a.call(this, b, d.text()))
	}); if (typeof a !== "object" && a !== B) return this.empty().append((this[0] && this[0].ownerDocument || t).createTextNode(a)); return c.text(this)
}, wrapAll: function (a) { if (c.isFunction(a)) return this.each(function (d) { c(this).wrapAll(a.call(this, d)) }); if (this[0]) { var b = c(a, this[0].ownerDocument).eq(0).clone(true); this[0].parentNode && b.insertBefore(this[0]); b.map(function () { for (var d = this; d.firstChild && d.firstChild.nodeType === 1; ) d = d.firstChild; return d }).append(this) } return this },
	wrapInner: function (a) { if (c.isFunction(a)) return this.each(function (b) { c(this).wrapInner(a.call(this, b)) }); return this.each(function () { var b = c(this), d = b.contents(); d.length ? d.wrapAll(a) : b.append(a) }) }, wrap: function (a) { return this.each(function () { c(this).wrapAll(a) }) }, unwrap: function () { return this.parent().each(function () { c.nodeName(this, "body") || c(this).replaceWith(this.childNodes) }).end() }, append: function () { return this.domManip(arguments, true, function (a) { this.nodeType === 1 && this.appendChild(a) }) },
	prepend: function () { return this.domManip(arguments, true, function (a) { this.nodeType === 1 && this.insertBefore(a, this.firstChild) }) }, before: function () { if (this[0] && this[0].parentNode) return this.domManip(arguments, false, function (b) { this.parentNode.insertBefore(b, this) }); else if (arguments.length) { var a = c(arguments[0]); a.push.apply(a, this.toArray()); return this.pushStack(a, "before", arguments) } }, after: function () {
		if (this[0] && this[0].parentNode) return this.domManip(arguments, false, function (b) {
			this.parentNode.insertBefore(b,
this.nextSibling)
		}); else if (arguments.length) { var a = this.pushStack(this, "after", arguments); a.push.apply(a, c(arguments[0]).toArray()); return a }
	}, remove: function (a, b) { for (var d = 0, e; (e = this[d]) != null; d++) if (!a || c.filter(a, [e]).length) { if (!b && e.nodeType === 1) { c.cleanData(e.getElementsByTagName("*")); c.cleanData([e]) } e.parentNode && e.parentNode.removeChild(e) } return this }, empty: function () {
		for (var a = 0, b; (b = this[a]) != null; a++) for (b.nodeType === 1 && c.cleanData(b.getElementsByTagName("*")); b.firstChild; ) b.removeChild(b.firstChild);
		return this
	}, clone: function (a) { var b = this.map(function () { if (!c.support.noCloneEvent && !c.isXMLDoc(this)) { var d = this.outerHTML, e = this.ownerDocument; if (!d) { d = e.createElement("div"); d.appendChild(this.cloneNode(true)); d = d.innerHTML } return c.clean([d.replace(za, "").replace(fb, '="$1">').replace($, "")], e)[0] } else return this.cloneNode(true) }); if (a === true) { na(this, b); na(this.find("*"), b.find("*")) } return b }, html: function (a) {
		if (a === B) return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.replace(za, "") : null;
		else if (typeof a === "string" && !Ca.test(a) && (c.support.leadingWhitespace || !$.test(a)) && !P[(Ba.exec(a) || ["", ""])[1].toLowerCase()]) { a = a.replace(Aa, "<$1></$2>"); try { for (var b = 0, d = this.length; b < d; b++) if (this[b].nodeType === 1) { c.cleanData(this[b].getElementsByTagName("*")); this[b].innerHTML = a } } catch (e) { this.empty().append(a) } } else c.isFunction(a) ? this.each(function (f) { var h = c(this); h.html(a.call(this, f, h.html())) }) : this.empty().append(a); return this
	}, replaceWith: function (a) {
		if (this[0] && this[0].parentNode) {
			if (c.isFunction(a)) return this.each(function (b) {
				var d =
c(this), e = d.html(); d.replaceWith(a.call(this, b, e))
			}); if (typeof a !== "string") a = c(a).detach(); return this.each(function () { var b = this.nextSibling, d = this.parentNode; c(this).remove(); b ? c(b).before(a) : c(d).append(a) })
		} else return this.pushStack(c(c.isFunction(a) ? a() : a), "replaceWith", a)
	}, detach: function (a) { return this.remove(a, true) }, domManip: function (a, b, d) {
		var e, f, h, l = a[0], k = []; if (!c.support.checkClone && arguments.length === 3 && typeof l === "string" && Da.test(l)) return this.each(function () {
			c(this).domManip(a,
b, d, true)
		}); if (c.isFunction(l)) return this.each(function (x) { var r = c(this); a[0] = l.call(this, x, b ? r.html() : B); r.domManip(a, b, d) }); if (this[0]) {
			e = l && l.parentNode; e = c.support.parentNode && e && e.nodeType === 11 && e.childNodes.length === this.length ? { fragment: e} : c.buildFragment(a, this, k); h = e.fragment; if (f = h.childNodes.length === 1 ? h = h.firstChild : h.firstChild) {
				b = b && c.nodeName(f, "tr"); f = 0; for (var o = this.length; f < o; f++) d.call(b ? c.nodeName(this[f], "table") ? this[f].getElementsByTagName("tbody")[0] || this[f].appendChild(this[f].ownerDocument.createElement("tbody")) :
this[f] : this[f], f > 0 || e.cacheable || this.length > 1 ? h.cloneNode(true) : h)
			} k.length && c.each(k, Oa)
		} return this
	}
}); c.buildFragment = function (a, b, d) { var e, f, h; b = b && b[0] ? b[0].ownerDocument || b[0] : t; if (a.length === 1 && typeof a[0] === "string" && a[0].length < 512 && b === t && !Ca.test(a[0]) && (c.support.checkClone || !Da.test(a[0]))) { f = true; if (h = c.fragments[a[0]]) if (h !== 1) e = h } if (!e) { e = b.createDocumentFragment(); c.clean(a, b, e, d) } if (f) c.fragments[a[0]] = h ? e : 1; return { fragment: e, cacheable: f} }; c.fragments = {}; c.each({ appendTo: "append",
	prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith"
}, function (a, b) { c.fn[a] = function (d) { var e = []; d = c(d); var f = this.length === 1 && this[0].parentNode; if (f && f.nodeType === 11 && f.childNodes.length === 1 && d.length === 1) { d[b](this[0]); return this } else { f = 0; for (var h = d.length; f < h; f++) { var l = (f > 0 ? this.clone(true) : this).get(); c(d[f])[b](l); e = e.concat(l) } return this.pushStack(e, a, d.selector) } } }); c.extend({ clean: function (a, b, d, e) {
	b = b || t; if (typeof b.createElement === "undefined") b = b.ownerDocument ||
b[0] && b[0].ownerDocument || t; for (var f = [], h = 0, l; (l = a[h]) != null; h++) {
		if (typeof l === "number") l += ""; if (l) {
			if (typeof l === "string" && !eb.test(l)) l = b.createTextNode(l); else if (typeof l === "string") {
				l = l.replace(Aa, "<$1></$2>"); var k = (Ba.exec(l) || ["", ""])[1].toLowerCase(), o = P[k] || P._default, x = o[0], r = b.createElement("div"); for (r.innerHTML = o[1] + l + o[2]; x--; ) r = r.lastChild; if (!c.support.tbody) {
					x = db.test(l); k = k === "table" && !x ? r.firstChild && r.firstChild.childNodes : o[1] === "<table>" && !x ? r.childNodes : []; for (o = k.length -
1; o >= 0; --o) c.nodeName(k[o], "tbody") && !k[o].childNodes.length && k[o].parentNode.removeChild(k[o])
				} !c.support.leadingWhitespace && $.test(l) && r.insertBefore(b.createTextNode($.exec(l)[0]), r.firstChild); l = r.childNodes
			} if (l.nodeType) f.push(l); else f = c.merge(f, l)
		}
	} if (d) for (h = 0; f[h]; h++) if (e && c.nodeName(f[h], "script") && (!f[h].type || f[h].type.toLowerCase() === "text/javascript")) e.push(f[h].parentNode ? f[h].parentNode.removeChild(f[h]) : f[h]); else {
		f[h].nodeType === 1 && f.splice.apply(f, [h + 1, 0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
		d.appendChild(f[h])
	} return f
}, cleanData: function (a) { for (var b, d, e = c.cache, f = c.event.special, h = c.support.deleteExpando, l = 0, k; (k = a[l]) != null; l++) if (!(k.nodeName && c.noData[k.nodeName.toLowerCase()])) if (d = k[c.expando]) { if ((b = e[d]) && b.events) for (var o in b.events) f[o] ? c.event.remove(k, o) : c.removeEvent(k, o, b.handle); if (h) delete k[c.expando]; else k.removeAttribute && k.removeAttribute(c.expando); delete e[d] } }
}); var Ea = /alpha\([^)]*\)/i, gb = /opacity=([^)]*)/, hb = /-([a-z])/ig, ib = /([A-Z])/g, Fa = /^-?\d+(?:px)?$/i,
jb = /^-?\d/, kb = { position: "absolute", visibility: "hidden", display: "block" }, Pa = ["Left", "Right"], Qa = ["Top", "Bottom"], W, Ga, aa, lb = function (a, b) { return b.toUpperCase() }; c.fn.css = function (a, b) { if (arguments.length === 2 && b === B) return this; return c.access(this, a, b, true, function (d, e, f) { return f !== B ? c.style(d, e, f) : c.css(d, e) }) }; c.extend({ cssHooks: { opacity: { get: function (a, b) { if (b) { var d = W(a, "opacity", "opacity"); return d === "" ? "1" : d } else return a.style.opacity } } }, cssNumber: { zIndex: true, fontWeight: true, opacity: true,
	zoom: true, lineHeight: true
}, cssProps: { "float": c.support.cssFloat ? "cssFloat" : "styleFloat" }, style: function (a, b, d, e) { if (!(!a || a.nodeType === 3 || a.nodeType === 8 || !a.style)) { var f, h = c.camelCase(b), l = a.style, k = c.cssHooks[h]; b = c.cssProps[h] || h; if (d !== B) { if (!(typeof d === "number" && isNaN(d) || d == null)) { if (typeof d === "number" && !c.cssNumber[h]) d += "px"; if (!k || !("set" in k) || (d = k.set(a, d)) !== B) try { l[b] = d } catch (o) { } } } else { if (k && "get" in k && (f = k.get(a, false, e)) !== B) return f; return l[b] } } }, css: function (a, b, d) {
	var e, f = c.camelCase(b),
h = c.cssHooks[f]; b = c.cssProps[f] || f; if (h && "get" in h && (e = h.get(a, true, d)) !== B) return e; else if (W) return W(a, b, f)
}, swap: function (a, b, d) { var e = {}, f; for (f in b) { e[f] = a.style[f]; a.style[f] = b[f] } d.call(a); for (f in b) a.style[f] = e[f] }, camelCase: function (a) { return a.replace(hb, lb) }
}); c.curCSS = c.css; c.each(["height", "width"], function (a, b) {
	c.cssHooks[b] = { get: function (d, e, f) {
		var h; if (e) {
			if (d.offsetWidth !== 0) h = oa(d, b, f); else c.swap(d, kb, function () { h = oa(d, b, f) }); if (h <= 0) {
				h = W(d, b, b); if (h === "0px" && aa) h = aa(d, b, b);
				if (h != null) return h === "" || h === "auto" ? "0px" : h
			} if (h < 0 || h == null) { h = d.style[b]; return h === "" || h === "auto" ? "0px" : h } return typeof h === "string" ? h : h + "px"
		}
	}, set: function (d, e) { if (Fa.test(e)) { e = parseFloat(e); if (e >= 0) return e + "px" } else return e }
	}
}); if (!c.support.opacity) c.cssHooks.opacity = { get: function (a, b) { return gb.test((b && a.currentStyle ? a.currentStyle.filter : a.style.filter) || "") ? parseFloat(RegExp.$1) / 100 + "" : b ? "1" : "" }, set: function (a, b) {
	var d = a.style; d.zoom = 1; var e = c.isNaN(b) ? "" : "alpha(opacity=" + b * 100 + ")", f =
d.filter || ""; d.filter = Ea.test(f) ? f.replace(Ea, e) : d.filter + " " + e
}
}; if (t.defaultView && t.defaultView.getComputedStyle) Ga = function (a, b, d) { var e; d = d.replace(ib, "-$1").toLowerCase(); if (!(b = a.ownerDocument.defaultView)) return B; if (b = b.getComputedStyle(a, null)) { e = b.getPropertyValue(d); if (e === "" && !c.contains(a.ownerDocument.documentElement, a)) e = c.style(a, d) } return e }; if (t.documentElement.currentStyle) aa = function (a, b) {
	var d, e, f = a.currentStyle && a.currentStyle[b], h = a.style; if (!Fa.test(f) && jb.test(f)) {
		d = h.left;
		e = a.runtimeStyle.left; a.runtimeStyle.left = a.currentStyle.left; h.left = b === "fontSize" ? "1em" : f || 0; f = h.pixelLeft + "px"; h.left = d; a.runtimeStyle.left = e
	} return f === "" ? "auto" : f
}; W = Ga || aa; if (c.expr && c.expr.filters) { c.expr.filters.hidden = function (a) { var b = a.offsetHeight; return a.offsetWidth === 0 && b === 0 || !c.support.reliableHiddenOffsets && (a.style.display || c.css(a, "display")) === "none" }; c.expr.filters.visible = function (a) { return !c.expr.filters.hidden(a) } } var mb = c.now(), nb = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
ob = /^(?:select|textarea)/i, pb = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, qb = /^(?:GET|HEAD)$/, Ra = /\[\]$/, T = /\=\?(&|$)/, ja = /\?/, rb = /([?&])_=[^&]*/, sb = /^(\w+:)?\/\/([^\/?#]+)/, tb = /%20/g, ub = /#.*$/, Ha = c.fn.load; c.fn.extend({ load: function (a, b, d) {
	if (typeof a !== "string" && Ha) return Ha.apply(this, arguments); else if (!this.length) return this; var e = a.indexOf(" "); if (e >= 0) { var f = a.slice(e, a.length); a = a.slice(0, e) } e = "GET"; if (b) if (c.isFunction(b)) { d = b; b = null } else if (typeof b ===
"object") { b = c.param(b, c.ajaxSettings.traditional); e = "POST" } var h = this; c.ajax({ url: a, type: e, dataType: "html", data: b, complete: function (l, k) { if (k === "success" || k === "notmodified") h.html(f ? c("<div>").append(l.responseText.replace(nb, "")).find(f) : l.responseText); d && h.each(d, [l.responseText, k, l]) } }); return this
}, serialize: function () { return c.param(this.serializeArray()) }, serializeArray: function () {
	return this.map(function () { return this.elements ? c.makeArray(this.elements) : this }).filter(function () {
		return this.name &&
!this.disabled && (this.checked || ob.test(this.nodeName) || pb.test(this.type))
	}).map(function (a, b) { var d = c(this).val(); return d == null ? null : c.isArray(d) ? c.map(d, function (e) { return { name: b.name, value: e} }) : { name: b.name, value: d} }).get()
}
}); c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (a, b) { c.fn[b] = function (d) { return this.bind(b, d) } }); c.extend({ get: function (a, b, d, e) { if (c.isFunction(b)) { e = e || d; d = b; b = null } return c.ajax({ type: "GET", url: a, data: b, success: d, dataType: e }) },
	getScript: function (a, b) { return c.get(a, null, b, "script") }, getJSON: function (a, b, d) { return c.get(a, b, d, "json") }, post: function (a, b, d, e) { if (c.isFunction(b)) { e = e || d; d = b; b = {} } return c.ajax({ type: "POST", url: a, data: b, success: d, dataType: e }) }, ajaxSetup: function (a) { c.extend(c.ajaxSettings, a) }, ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, xhr: function () { return new E.XMLHttpRequest }, accepts: { xml: "application/xml, text/xml", html: "text/html",
		script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*"
	}
	}, ajax: function (a) {
		var b = c.extend(true, {}, c.ajaxSettings, a), d, e, f, h = b.type.toUpperCase(), l = qb.test(h); b.url = b.url.replace(ub, ""); b.context = a && a.context != null ? a.context : b; if (b.data && b.processData && typeof b.data !== "string") b.data = c.param(b.data, b.traditional); if (b.dataType === "jsonp") {
			if (h === "GET") T.test(b.url) || (b.url += (ja.test(b.url) ? "&" : "?") + (b.jsonp || "callback") + "=?"); else if (!b.data ||
!T.test(b.data)) b.data = (b.data ? b.data + "&" : "") + (b.jsonp || "callback") + "=?"; b.dataType = "json"
		} if (b.dataType === "json" && (b.data && T.test(b.data) || T.test(b.url))) { d = b.jsonpCallback || "jsonp" + mb++; if (b.data) b.data = (b.data + "").replace(T, "=" + d + "$1"); b.url = b.url.replace(T, "=" + d + "$1"); b.dataType = "script"; var k = E[d]; E[d] = function (m) { if (c.isFunction(k)) k(m); else { E[d] = B; try { delete E[d] } catch (p) { } } f = m; c.handleSuccess(b, w, e, f); c.handleComplete(b, w, e, f); r && r.removeChild(A) } } if (b.dataType === "script" && b.cache === null) b.cache =
false; if (b.cache === false && l) { var o = c.now(), x = b.url.replace(rb, "$1_=" + o); b.url = x + (x === b.url ? (ja.test(b.url) ? "&" : "?") + "_=" + o : "") } if (b.data && l) b.url += (ja.test(b.url) ? "&" : "?") + b.data; b.global && c.active++ === 0 && c.event.trigger("ajaxStart"); o = (o = sb.exec(b.url)) && (o[1] && o[1].toLowerCase() !== location.protocol || o[2].toLowerCase() !== location.host); if (b.dataType === "script" && h === "GET" && o) {
			var r = t.getElementsByTagName("head")[0] || t.documentElement, A = t.createElement("script"); if (b.scriptCharset) A.charset = b.scriptCharset;
			A.src = b.url; if (!d) { var C = false; A.onload = A.onreadystatechange = function () { if (!C && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { C = true; c.handleSuccess(b, w, e, f); c.handleComplete(b, w, e, f); A.onload = A.onreadystatechange = null; r && A.parentNode && r.removeChild(A) } } } r.insertBefore(A, r.firstChild); return B
		} var J = false, w = b.xhr(); if (w) {
			b.username ? w.open(h, b.url, b.async, b.username, b.password) : w.open(h, b.url, b.async); try {
				if (b.data != null && !l || a && a.contentType) w.setRequestHeader("Content-Type",
b.contentType); if (b.ifModified) { c.lastModified[b.url] && w.setRequestHeader("If-Modified-Since", c.lastModified[b.url]); c.etag[b.url] && w.setRequestHeader("If-None-Match", c.etag[b.url]) } o || w.setRequestHeader("X-Requested-With", "XMLHttpRequest"); w.setRequestHeader("Accept", b.dataType && b.accepts[b.dataType] ? b.accepts[b.dataType] + ", */*; q=0.01" : b.accepts._default)
			} catch (I) { } if (b.beforeSend && b.beforeSend.call(b.context, w, b) === false) { b.global && c.active-- === 1 && c.event.trigger("ajaxStop"); w.abort(); return false } b.global &&
c.triggerGlobal(b, "ajaxSend", [w, b]); var L = w.onreadystatechange = function (m) {
	if (!w || w.readyState === 0 || m === "abort") { J || c.handleComplete(b, w, e, f); J = true; if (w) w.onreadystatechange = c.noop } else if (!J && w && (w.readyState === 4 || m === "timeout")) {
		J = true; w.onreadystatechange = c.noop; e = m === "timeout" ? "timeout" : !c.httpSuccess(w) ? "error" : b.ifModified && c.httpNotModified(w, b.url) ? "notmodified" : "success"; var p; if (e === "success") try { f = c.httpData(w, b.dataType, b) } catch (q) { e = "parsererror"; p = q } if (e === "success" || e === "notmodified") d ||
c.handleSuccess(b, w, e, f); else c.handleError(b, w, e, p); d || c.handleComplete(b, w, e, f); m === "timeout" && w.abort(); if (b.async) w = null
	}
}; try { var g = w.abort; w.abort = function () { w && Function.prototype.call.call(g, w); L("abort") } } catch (i) { } b.async && b.timeout > 0 && setTimeout(function () { w && !J && L("timeout") }, b.timeout); try { w.send(l || b.data == null ? null : b.data) } catch (n) { c.handleError(b, w, null, n); c.handleComplete(b, w, e, f) } b.async || L(); return w
		}
	}, param: function (a, b) {
		var d = [], e = function (h, l) {
			l = c.isFunction(l) ? l() : l; d[d.length] =
encodeURIComponent(h) + "=" + encodeURIComponent(l)
		}; if (b === B) b = c.ajaxSettings.traditional; if (c.isArray(a) || a.jquery) c.each(a, function () { e(this.name, this.value) }); else for (var f in a) da(f, a[f], b, e); return d.join("&").replace(tb, "+")
	}
}); c.extend({ active: 0, lastModified: {}, etag: {}, handleError: function (a, b, d, e) { a.error && a.error.call(a.context, b, d, e); a.global && c.triggerGlobal(a, "ajaxError", [b, a, e]) }, handleSuccess: function (a, b, d, e) {
	a.success && a.success.call(a.context, e, d, b); a.global && c.triggerGlobal(a, "ajaxSuccess",
[b, a])
}, handleComplete: function (a, b, d) { a.complete && a.complete.call(a.context, b, d); a.global && c.triggerGlobal(a, "ajaxComplete", [b, a]); a.global && c.active-- === 1 && c.event.trigger("ajaxStop") }, triggerGlobal: function (a, b, d) { (a.context && a.context.url == null ? c(a.context) : c.event).trigger(b, d) }, httpSuccess: function (a) { try { return !a.status && location.protocol === "file:" || a.status >= 200 && a.status < 300 || a.status === 304 || a.status === 1223 } catch (b) { } return false }, httpNotModified: function (a, b) {
	var d = a.getResponseHeader("Last-Modified"),
e = a.getResponseHeader("Etag"); if (d) c.lastModified[b] = d; if (e) c.etag[b] = e; return a.status === 304
}, httpData: function (a, b, d) { var e = a.getResponseHeader("content-type") || "", f = b === "xml" || !b && e.indexOf("xml") >= 0; a = f ? a.responseXML : a.responseText; f && a.documentElement.nodeName === "parsererror" && c.error("parsererror"); if (d && d.dataFilter) a = d.dataFilter(a, b); if (typeof a === "string") if (b === "json" || !b && e.indexOf("json") >= 0) a = c.parseJSON(a); else if (b === "script" || !b && e.indexOf("javascript") >= 0) c.globalEval(a); return a }
});
	if (E.ActiveXObject) c.ajaxSettings.xhr = function () { if (E.location.protocol !== "file:") try { return new E.XMLHttpRequest } catch (a) { } try { return new E.ActiveXObject("Microsoft.XMLHTTP") } catch (b) { } }; c.support.ajax = !!c.ajaxSettings.xhr(); var ea = {}, vb = /^(?:toggle|show|hide)$/, wb = /^([+\-]=)?([\d+.\-]+)(.*)$/, ba, pa = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]]; c.fn.extend({ show: function (a, b, d) {
		if (a || a === 0) return this.animate(S("show",
3), a, b, d); else { d = 0; for (var e = this.length; d < e; d++) { a = this[d]; b = a.style.display; if (!c.data(a, "olddisplay") && b === "none") b = a.style.display = ""; b === "" && c.css(a, "display") === "none" && c.data(a, "olddisplay", qa(a.nodeName)) } for (d = 0; d < e; d++) { a = this[d]; b = a.style.display; if (b === "" || b === "none") a.style.display = c.data(a, "olddisplay") || "" } return this }
	}, hide: function (a, b, d) {
		if (a || a === 0) return this.animate(S("hide", 3), a, b, d); else {
			a = 0; for (b = this.length; a < b; a++) {
				d = c.css(this[a], "display"); d !== "none" && c.data(this[a], "olddisplay",
d)
			} for (a = 0; a < b; a++) this[a].style.display = "none"; return this
		}
	}, _toggle: c.fn.toggle, toggle: function (a, b, d) { var e = typeof a === "boolean"; if (c.isFunction(a) && c.isFunction(b)) this._toggle.apply(this, arguments); else a == null || e ? this.each(function () { var f = e ? a : c(this).is(":hidden"); c(this)[f ? "show" : "hide"]() }) : this.animate(S("toggle", 3), a, b, d); return this }, fadeTo: function (a, b, d, e) { return this.filter(":hidden").css("opacity", 0).show().end().animate({ opacity: b }, a, d, e) }, animate: function (a, b, d, e) {
		var f = c.speed(b,
d, e); if (c.isEmptyObject(a)) return this.each(f.complete); return this[f.queue === false ? "each" : "queue"](function () {
	var h = c.extend({}, f), l, k = this.nodeType === 1, o = k && c(this).is(":hidden"), x = this; for (l in a) {
		var r = c.camelCase(l); if (l !== r) { a[r] = a[l]; delete a[l]; l = r } if (a[l] === "hide" && o || a[l] === "show" && !o) return h.complete.call(this); if (k && (l === "height" || l === "width")) {
			h.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY]; if (c.css(this, "display") === "inline" && c.css(this, "float") === "none") if (c.support.inlineBlockNeedsLayout) if (qa(this.nodeName) ===
"inline") this.style.display = "inline-block"; else { this.style.display = "inline"; this.style.zoom = 1 } else this.style.display = "inline-block"
		} if (c.isArray(a[l])) { (h.specialEasing = h.specialEasing || {})[l] = a[l][1]; a[l] = a[l][0] }
	} if (h.overflow != null) this.style.overflow = "hidden"; h.curAnim = c.extend({}, a); c.each(a, function (A, C) {
		var J = new c.fx(x, h, A); if (vb.test(C)) J[C === "toggle" ? o ? "show" : "hide" : C](a); else {
			var w = wb.exec(C), I = J.cur() || 0; if (w) {
				var L = parseFloat(w[2]), g = w[3] || "px"; if (g !== "px") {
					c.style(x, A, (L || 1) + g); I = (L ||
1) / J.cur() * I; c.style(x, A, I + g)
				} if (w[1]) L = (w[1] === "-=" ? -1 : 1) * L + I; J.custom(I, L, g)
			} else J.custom(I, C, "")
		}
	}); return true
})
	}, stop: function (a, b) { var d = c.timers; a && this.queue([]); this.each(function () { for (var e = d.length - 1; e >= 0; e--) if (d[e].elem === this) { b && d[e](true); d.splice(e, 1) } }); b || this.dequeue(); return this }
	}); c.each({ slideDown: S("show", 1), slideUp: S("hide", 1), slideToggle: S("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle"} }, function (a, b) {
		c.fn[a] = function (d, e, f) {
			return this.animate(b,
d, e, f)
		}
	}); c.extend({ speed: function (a, b, d) { var e = a && typeof a === "object" ? c.extend({}, a) : { complete: d || !d && b || c.isFunction(a) && a, duration: a, easing: d && b || b && !c.isFunction(b) && b }; e.duration = c.fx.off ? 0 : typeof e.duration === "number" ? e.duration : e.duration in c.fx.speeds ? c.fx.speeds[e.duration] : c.fx.speeds._default; e.old = e.complete; e.complete = function () { e.queue !== false && c(this).dequeue(); c.isFunction(e.old) && e.old.call(this) }; return e }, easing: { linear: function (a, b, d, e) { return d + e * a }, swing: function (a, b, d, e) {
		return (-Math.cos(a *
Math.PI) / 2 + 0.5) * e + d
	}
	}, timers: [], fx: function (a, b, d) { this.options = b; this.elem = a; this.prop = d; if (!b.orig) b.orig = {} }
	}); c.fx.prototype = { update: function () { this.options.step && this.options.step.call(this.elem, this.now, this); (c.fx.step[this.prop] || c.fx.step._default)(this) }, cur: function () { if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) return this.elem[this.prop]; var a = parseFloat(c.css(this.elem, this.prop)); return a && a > -1E4 ? a : 0 }, custom: function (a, b, d) {
		function e(l) { return f.step(l) }
		var f = this, h = c.fx; this.startTime = c.now(); this.start = a; this.end = b; this.unit = d || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; e.elem = this.elem; if (e() && c.timers.push(e) && !ba) ba = setInterval(h.tick, h.interval)
	}, show: function () { this.options.orig[this.prop] = c.style(this.elem, this.prop); this.options.show = true; this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); c(this.elem).show() }, hide: function () {
		this.options.orig[this.prop] = c.style(this.elem, this.prop); this.options.hide = true;
		this.custom(this.cur(), 0)
	}, step: function (a) {
		var b = c.now(), d = true; if (a || b >= this.options.duration + this.startTime) {
			this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[this.prop] = true; for (var e in this.options.curAnim) if (this.options.curAnim[e] !== true) d = false; if (d) {
				if (this.options.overflow != null && !c.support.shrinkWrapBlocks) { var f = this.elem, h = this.options; c.each(["", "X", "Y"], function (k, o) { f.style["overflow" + o] = h.overflow[k] }) } this.options.hide && c(this.elem).hide(); if (this.options.hide ||
this.options.show) for (var l in this.options.curAnim) c.style(this.elem, l, this.options.orig[l]); this.options.complete.call(this.elem)
			} return false
		} else { a = b - this.startTime; this.state = a / this.options.duration; b = this.options.easing || (c.easing.swing ? "swing" : "linear"); this.pos = c.easing[this.options.specialEasing && this.options.specialEasing[this.prop] || b](this.state, a, 0, 1, this.options.duration); this.now = this.start + (this.end - this.start) * this.pos; this.update() } return true
	}
	}; c.extend(c.fx, { tick: function () {
		for (var a =
c.timers, b = 0; b < a.length; b++) a[b]() || a.splice(b--, 1); a.length || c.fx.stop()
	}, interval: 13, stop: function () { clearInterval(ba); ba = null }, speeds: { slow: 600, fast: 200, _default: 400 }, step: { opacity: function (a) { c.style(a.elem, "opacity", a.now) }, _default: function (a) { if (a.elem.style && a.elem.style[a.prop] != null) a.elem.style[a.prop] = (a.prop === "width" || a.prop === "height" ? Math.max(0, a.now) : a.now) + a.unit; else a.elem[a.prop] = a.now } }
	}); if (c.expr && c.expr.filters) c.expr.filters.animated = function (a) {
		return c.grep(c.timers, function (b) {
			return a ===
b.elem
		}).length
	}; var xb = /^t(?:able|d|h)$/i, Ia = /^(?:body|html)$/i; c.fn.offset = "getBoundingClientRect" in t.documentElement ? function (a) {
		var b = this[0], d; if (a) return this.each(function (l) { c.offset.setOffset(this, a, l) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return c.offset.bodyOffset(b); try { d = b.getBoundingClientRect() } catch (e) { } var f = b.ownerDocument, h = f.documentElement; if (!d || !c.contains(h, b)) return d || { top: 0, left: 0 }; b = f.body; f = fa(f); return { top: d.top + (f.pageYOffset || c.support.boxModel &&
h.scrollTop || b.scrollTop) - (h.clientTop || b.clientTop || 0), left: d.left + (f.pageXOffset || c.support.boxModel && h.scrollLeft || b.scrollLeft) - (h.clientLeft || b.clientLeft || 0)
		}
	} : function (a) {
		var b = this[0]; if (a) return this.each(function (x) { c.offset.setOffset(this, a, x) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return c.offset.bodyOffset(b); c.offset.initialize(); var d, e = b.offsetParent, f = b.ownerDocument, h = f.documentElement, l = f.body; d = (f = f.defaultView) ? f.getComputedStyle(b, null) : b.currentStyle;
		for (var k = b.offsetTop, o = b.offsetLeft; (b = b.parentNode) && b !== l && b !== h; ) {
			if (c.offset.supportsFixedPosition && d.position === "fixed") break; d = f ? f.getComputedStyle(b, null) : b.currentStyle; k -= b.scrollTop; o -= b.scrollLeft; if (b === e) { k += b.offsetTop; o += b.offsetLeft; if (c.offset.doesNotAddBorder && !(c.offset.doesAddBorderForTableAndCells && xb.test(b.nodeName))) { k += parseFloat(d.borderTopWidth) || 0; o += parseFloat(d.borderLeftWidth) || 0 } e = b.offsetParent } if (c.offset.subtractsBorderForOverflowNotVisible && d.overflow !== "visible") {
				k +=
parseFloat(d.borderTopWidth) || 0; o += parseFloat(d.borderLeftWidth) || 0
			} d = d
		} if (d.position === "relative" || d.position === "static") { k += l.offsetTop; o += l.offsetLeft } if (c.offset.supportsFixedPosition && d.position === "fixed") { k += Math.max(h.scrollTop, l.scrollTop); o += Math.max(h.scrollLeft, l.scrollLeft) } return { top: k, left: o }
	}; c.offset = { initialize: function () {
		var a = t.body, b = t.createElement("div"), d, e, f, h = parseFloat(c.css(a, "marginTop")) || 0; c.extend(b.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px",
			height: "1px", visibility: "hidden"
		}); b.innerHTML = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; a.insertBefore(b, a.firstChild); d = b.firstChild; e = d.firstChild; f = d.nextSibling.firstChild.firstChild; this.doesNotAddBorder = e.offsetTop !== 5; this.doesAddBorderForTableAndCells =
f.offsetTop === 5; e.style.position = "fixed"; e.style.top = "20px"; this.supportsFixedPosition = e.offsetTop === 20 || e.offsetTop === 15; e.style.position = e.style.top = ""; d.style.overflow = "hidden"; d.style.position = "relative"; this.subtractsBorderForOverflowNotVisible = e.offsetTop === -5; this.doesNotIncludeMarginInBodyOffset = a.offsetTop !== h; a.removeChild(b); c.offset.initialize = c.noop
	}, bodyOffset: function (a) {
		var b = a.offsetTop, d = a.offsetLeft; c.offset.initialize(); if (c.offset.doesNotIncludeMarginInBodyOffset) {
			b += parseFloat(c.css(a,
"marginTop")) || 0; d += parseFloat(c.css(a, "marginLeft")) || 0
		} return { top: b, left: d }
	}, setOffset: function (a, b, d) {
		var e = c.css(a, "position"); if (e === "static") a.style.position = "relative"; var f = c(a), h = f.offset(), l = c.css(a, "top"), k = c.css(a, "left"), o = e === "absolute" && c.inArray("auto", [l, k]) > -1; e = {}; var x = {}; if (o) x = f.position(); l = o ? x.top : parseInt(l, 10) || 0; k = o ? x.left : parseInt(k, 10) || 0; if (c.isFunction(b)) b = b.call(a, d, h); if (b.top != null) e.top = b.top - h.top + l; if (b.left != null) e.left = b.left - h.left + k; "using" in b ? b.using.call(a,
e) : f.css(e)
	}
	}; c.fn.extend({ position: function () { if (!this[0]) return null; var a = this[0], b = this.offsetParent(), d = this.offset(), e = Ia.test(b[0].nodeName) ? { top: 0, left: 0} : b.offset(); d.top -= parseFloat(c.css(a, "marginTop")) || 0; d.left -= parseFloat(c.css(a, "marginLeft")) || 0; e.top += parseFloat(c.css(b[0], "borderTopWidth")) || 0; e.left += parseFloat(c.css(b[0], "borderLeftWidth")) || 0; return { top: d.top - e.top, left: d.left - e.left} }, offsetParent: function () {
		return this.map(function () {
			for (var a = this.offsetParent || t.body; a && !Ia.test(a.nodeName) &&
c.css(a, "position") === "static"; ) a = a.offsetParent; return a
		})
	}
	}); c.each(["Left", "Top"], function (a, b) { var d = "scroll" + b; c.fn[d] = function (e) { var f = this[0], h; if (!f) return null; if (e !== B) return this.each(function () { if (h = fa(this)) h.scrollTo(!a ? e : c(h).scrollLeft(), a ? e : c(h).scrollTop()); else this[d] = e }); else return (h = fa(f)) ? "pageXOffset" in h ? h[a ? "pageYOffset" : "pageXOffset"] : c.support.boxModel && h.document.documentElement[d] || h.document.body[d] : f[d] } }); c.each(["Height", "Width"], function (a, b) {
		var d = b.toLowerCase();
		c.fn["inner" + b] = function () { return this[0] ? parseFloat(c.css(this[0], d, "padding")) : null }; c.fn["outer" + b] = function (e) { return this[0] ? parseFloat(c.css(this[0], d, e ? "margin" : "border")) : null }; c.fn[d] = function (e) {
			var f = this[0]; if (!f) return e == null ? null : this; if (c.isFunction(e)) return this.each(function (l) { var k = c(this); k[d](e.call(this, l, k[d]())) }); if (c.isWindow(f)) return f.document.compatMode === "CSS1Compat" && f.document.documentElement["client" + b] || f.document.body["client" + b]; else if (f.nodeType === 9) return Math.max(f.documentElement["client" +
b], f.body["scroll" + b], f.documentElement["scroll" + b], f.body["offset" + b], f.documentElement["offset" + b]); else if (e === B) { f = c.css(f, d); var h = parseFloat(f); return c.isNaN(h) ? f : h } else return this.css(d, typeof e === "string" ? e : e + "px")
		}
	})
})(window);
// END JQUERY LIBRARY //

/*
* jQuery UI 1.7.2
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
* http://docs.jquery.com/UI
*/
jQuery.ui || (function (c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.2", plugin: { add: function (k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]) } }, call: function (j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k) } } } }, contains: function (k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j) }, hasScroll: function (m, k) { if (c(m).css("overflow") == "hidden") { return false } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l }, isOverAxis: function (k, j, l) { return (k > j) && (k < (j + l)) }, isOver: function (o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, 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, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function (k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))) }; c.fn.removeAttr = function (j) { return (a.test(j) ? this.each(function () { this.removeAttributeNS(h, j.replace(a, "")) }) : e.call(this, j)) } } c.fn.extend({ remove: function () { c("*", this).add(this).each(function () { c(this).triggerHandler("remove") }); return i.apply(this, arguments) }, enableSelection: function () { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function () { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function () { return false }) }, scrollParent: function () { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = this.parents().filter(function () { return (/(relative|absolute|fixed)/).test(c.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } else { j = this.parents().filter(function () { return (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } return (/fixed/).test(this.css("position")) || !j.length ? c(document) : j } }); c.extend(c.expr[":"], { data: function (l, k, j) { return !!c.data(l, j[3]) }, focusable: function (k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length }, tabbable: function (k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable") } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p) } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")) } return (c.inArray(o, j) != -1) } c.widget = function (k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function (p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined) } return this.each(function () { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)) }) }; c[l] = c[l] || {}; c[l][k] = function (o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function (q, p, r) { if (q.target == o) { return m._setData(p, r) } }).bind("getData." + k, function (q, p) { if (q.target == o) { return m._getData(p) } }).bind("remove", function () { return m.destroy() }) }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option" }; c.widget.prototype = { _init: function () { }, destroy: function () { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled") }, option: function (l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l) } k = {}; k[l] = m } c.each(k, function (n, o) { j._setData(n, o) }) }, _getData: function (j) { return this.options[j] }, _setData: function (j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k) } }, enable: function () { this._setData("disabled", false) }, disable: function () { this._setData("disabled", true) }, _trigger: function (l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o] } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()) } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function () { var j = this; this.element.bind("mousedown." + this.widgetName, function (k) { return j._mouseDown(k) }).bind("click." + this.widgetName, function (k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false } }); if (c.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on") } this.started = false }, _mouseDestroy: function () { this.element.unbind("." + this.widgetName); (c.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)) }, _mouseDown: function (l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function () { k.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true } } this._mouseMoveDelegate = function (n) { return k._mouseMove(n) }; this._mouseUpDelegate = function (n) { return k._mouseUp(n) }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true }, _mouseMove: function (j) { if (c.browser.msie && !j.button) { return this._mouseUp(j) } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault() } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)) } return !this._mouseStarted }, _mouseUp: function (j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j) } return false }, _mouseDistanceMet: function (j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance) }, _mouseDelayMet: function (j) { return this.mouseDelayMet }, _mouseStart: function (j) { }, _mouseDrag: function (j) { }, _mouseStop: function (j) { }, _mouseCapture: function (j) { return true } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); ; /*
/* jQuery UI Draggable 1.7.2
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * http://docs.jquery.com/UI/Draggables
 * Depends:
 *	ui.core.js
 */
(function (a) { a.widget("ui.draggable", a.extend({}, a.ui.mouse, { _init: function () { if (this.options.helper == "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { this.element[0].style.position = "relative" } (this.options.addClasses && this.element.addClass("ui-draggable")); (this.options.disabled && this.element.addClass("ui-draggable-disabled")); this._mouseInit() }, destroy: function () { if (!this.element.data("draggable")) { return } this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"); this._mouseDestroy() }, _mouseCapture: function (b) { var c = this.options; if (this.helper || c.disabled || a(b.target).is(".ui-resizable-handle")) { return false } this.handle = this._getHandle(b); if (!this.handle) { return false } return true }, _mouseStart: function (b) { var c = this.options; this.helper = this._createHelper(b); this._cacheHelperProportions(); if (a.ui.ddmanager) { a.ui.ddmanager.current = this } this._cacheMargins(); this.cssPosition = this.helper.css("position"); this.scrollParent = this.helper.scrollParent(); this.offset = this.element.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; a.extend(this.offset, { click: { left: b.pageX - this.offset.left, top: b.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }); this.originalPosition = this._generatePosition(b); this.originalPageX = b.pageX; this.originalPageY = b.pageY; if (c.cursorAt) { this._adjustOffsetFromHelper(c.cursorAt) } if (c.containment) { this._setContainment() } this._trigger("start", b); this._cacheHelperProportions(); if (a.ui.ddmanager && !c.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, b) } this.helper.addClass("ui-draggable-dragging"); this._mouseDrag(b, true); return true }, _mouseDrag: function (b, d) { this.position = this._generatePosition(b); this.positionAbs = this._convertPositionTo("absolute"); if (!d) { var c = this._uiHash(); this._trigger("drag", b, c); this.position = c.position } if (!this.options.axis || this.options.axis != "y") { this.helper[0].style.left = this.position.left + "px" } if (!this.options.axis || this.options.axis != "x") { this.helper[0].style.top = this.position.top + "px" } if (a.ui.ddmanager) { a.ui.ddmanager.drag(this, b) } return false }, _mouseStop: function (c) { var d = false; if (a.ui.ddmanager && !this.options.dropBehaviour) { d = a.ui.ddmanager.drop(this, c) } if (this.dropped) { d = this.dropped; this.dropped = false } if ((this.options.revert == "invalid" && !d) || (this.options.revert == "valid" && d) || this.options.revert === true || (a.isFunction(this.options.revert) && this.options.revert.call(this.element, d))) { var b = this; a(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function () { b._trigger("stop", c); b._clear() }) } else { this._trigger("stop", c); this._clear() } return false }, _getHandle: function (b) { var c = !this.options.handle || !a(this.options.handle, this.element).length ? true : false; a(this.options.handle, this.element).find("*").andSelf().each(function () { if (this == b.target) { c = true } }); return c }, _createHelper: function (c) { var d = this.options; var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c])) : (d.helper == "clone" ? this.element.clone() : this.element); if (!b.parents("body").length) { b.appendTo((d.appendTo == "parent" ? this.element[0].parentNode : d.appendTo)) } if (b[0] != this.element[0] && !(/(fixed|absolute)/).test(b.css("position"))) { b.css("position", "absolute") } return b }, _adjustOffsetFromHelper: function (b) { if (b.left != undefined) { this.offset.click.left = b.left + this.margins.left } if (b.right != undefined) { this.offset.click.left = this.helperProportions.width - b.right + this.margins.left } if (b.top != undefined) { this.offset.click.top = b.top + this.margins.top } if (b.bottom != undefined) { this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top } }, _getParentOffset: function () { this.offsetParent = this.helper.offsetParent(); var b = this.offsetParent.offset(); if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) { b.left += this.scrollParent.scrollLeft(); b.top += this.scrollParent.scrollTop() } if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) { b = { top: 0, left: 0} } return { top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)} }, _getRelativeOffset: function () { if (this.cssPosition == "relative") { var b = this.element.position(); return { top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()} } else { return { top: 0, left: 0} } }, _cacheMargins: function () { this.margins = { left: (parseInt(this.element.css("marginLeft"), 10) || 0), top: (parseInt(this.element.css("marginTop"), 10) || 0)} }, _cacheHelperProportions: function () { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight()} }, _setContainment: function () { var e = this.options; if (e.containment == "parent") { e.containment = this.helper[0].parentNode } if (e.containment == "document" || e.containment == "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document : window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top] } if (!(/^(document|window|parent)$/).test(e.containment) && e.containment.constructor != Array) { var c = a(e.containment)[0]; if (!c) { return } var d = a(e.containment).offset(); var b = (a(c).css("overflow") != "hidden"); this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top] } else { if (e.containment.constructor == Array) { this.containment = e.containment } } }, _convertPositionTo: function (f, h) { if (!h) { h = this.position } var c = f == "absolute" ? 1 : -1; var e = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, g = (/(html|body)/i).test(b[0].tagName); return { top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)), left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c))} }, _generatePosition: function (e) { var h = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, i = (/(html|body)/i).test(b[0].tagName); if (this.cssPosition == "relative" && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset() } var d = e.pageX; var c = e.pageY; if (this.originalPosition) { if (this.containment) { if (e.pageX - this.offset.click.left < this.containment[0]) { d = this.containment[0] + this.offset.click.left } if (e.pageY - this.offset.click.top < this.containment[1]) { c = this.containment[1] + this.offset.click.top } if (e.pageX - this.offset.click.left > this.containment[2]) { d = this.containment[2] + this.offset.click.left } if (e.pageY - this.offset.click.top > this.containment[3]) { c = this.containment[3] + this.offset.click.top } } if (h.grid) { var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1]; c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g : (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g; var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0]; d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f : (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f } } return { top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))), left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft())))} }, _clear: function () { this.helper.removeClass("ui-draggable-dragging"); if (this.helper[0] != this.element[0] && !this.cancelHelperRemoval) { this.helper.remove() } this.helper = null; this.cancelHelperRemoval = false }, _trigger: function (b, c, d) { d = d || this._uiHash(); a.ui.plugin.call(this, b, [c, d]); if (b == "drag") { this.positionAbs = this._convertPositionTo("absolute") } return a.widget.prototype._trigger.call(this, b, c, d) }, plugins: {}, _uiHash: function (b) { return { helper: this.helper, position: this.position, absolutePosition: this.positionAbs, offset: this.positionAbs} } })); a.extend(a.ui.draggable, { version: "1.7.2", eventPrefix: "drag", defaults: { addClasses: true, appendTo: "parent", axis: false, cancel: ":input,option", connectToSortable: false, containment: false, cursor: "auto", cursorAt: false, delay: 0, distance: 1, grid: false, handle: false, helper: "original", iframeFix: false, opacity: false, refreshPositions: false, revert: false, revertDuration: 500, scope: "default", scroll: true, scrollSensitivity: 20, scrollSpeed: 20, snap: false, snapMode: "both", snapTolerance: 20, stack: false, zIndex: false} }); a.ui.plugin.add("draggable", "connectToSortable", { start: function (c, e) { var d = a(this).data("draggable"), f = d.options, b = a.extend({}, e, { item: d.element }); d.sortables = []; a(f.connectToSortable).each(function () { var g = a.data(this, "sortable"); if (g && !g.options.disabled) { d.sortables.push({ instance: g, shouldRevert: g.options.revert }); g._refreshItems(); g._trigger("activate", c, b) } }) }, stop: function (c, e) { var d = a(this).data("draggable"), b = a.extend({}, e, { item: d.element }); a.each(d.sortables, function () { if (this.instance.isOver) { this.instance.isOver = 0; d.cancelHelperRemoval = true; this.instance.cancelHelperRemoval = false; if (this.shouldRevert) { this.instance.options.revert = true } this.instance._mouseStop(c); this.instance.options.helper = this.instance.options._helper; if (d.options.helper == "original") { this.instance.currentItem.css({ top: "auto", left: "auto" }) } } else { this.instance.cancelHelperRemoval = false; this.instance._trigger("deactivate", c, b) } }) }, drag: function (c, f) { var e = a(this).data("draggable"), b = this; var d = function (i) { var n = this.offset.click.top, m = this.offset.click.left; var g = this.positionAbs.top, k = this.positionAbs.left; var j = i.height, l = i.width; var p = i.top, h = i.left; return a.ui.isOver(g + n, k + m, p, h, j, l) }; a.each(e.sortables, function (g) { this.instance.positionAbs = e.positionAbs; this.instance.helperProportions = e.helperProportions; this.instance.offset.click = e.offset.click; if (this.instance._intersectsWith(this.instance.containerCache)) { if (!this.instance.isOver) { this.instance.isOver = 1; this.instance.currentItem = a(b).clone().appendTo(this.instance.element).data("sortable-item", true); this.instance.options._helper = this.instance.options.helper; this.instance.options.helper = function () { return f.helper[0] }; c.target = this.instance.currentItem[0]; this.instance._mouseCapture(c, true); this.instance._mouseStart(c, true, true); this.instance.offset.click.top = e.offset.click.top; this.instance.offset.click.left = e.offset.click.left; this.instance.offset.parent.left -= e.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.top -= e.offset.parent.top - this.instance.offset.parent.top; e._trigger("toSortable", c); e.dropped = this.instance.element; e.currentItem = e.element; this.instance.fromOutside = e } if (this.instance.currentItem) { this.instance._mouseDrag(c) } } else { if (this.instance.isOver) { this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; this.instance.options.revert = false; this.instance._trigger("out", c, this.instance._uiHash(this.instance)); this.instance._mouseStop(c, true); this.instance.options.helper = this.instance.options._helper; this.instance.currentItem.remove(); if (this.instance.placeholder) { this.instance.placeholder.remove() } e._trigger("fromSortable", c); e.dropped = false } } }) } }); a.ui.plugin.add("draggable", "cursor", { start: function (c, d) { var b = a("body"), e = a(this).data("draggable").options; if (b.css("cursor")) { e._cursor = b.css("cursor") } b.css("cursor", e.cursor) }, stop: function (b, c) { var d = a(this).data("draggable").options; if (d._cursor) { a("body").css("cursor", d._cursor) } } }); a.ui.plugin.add("draggable", "iframeFix", { start: function (b, c) { var d = a(this).data("draggable").options; a(d.iframeFix === true ? "iframe" : d.iframeFix).each(function () { a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({ width: this.offsetWidth + "px", height: this.offsetHeight + "px", position: "absolute", opacity: "0.001", zIndex: 1000 }).css(a(this).offset()).appendTo("body") }) }, stop: function (b, c) { a("div.ui-draggable-iframeFix").each(function () { this.parentNode.removeChild(this) }) } }); a.ui.plugin.add("draggable", "opacity", { start: function (c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("opacity")) { e._opacity = b.css("opacity") } b.css("opacity", e.opacity) }, stop: function (b, c) { var d = a(this).data("draggable").options; if (d._opacity) { a(c.helper).css("opacity", d._opacity) } } }); a.ui.plugin.add("draggable", "scroll", { start: function (c, d) { var b = a(this).data("draggable"); if (b.scrollParent[0] != document && b.scrollParent[0].tagName != "HTML") { b.overflowOffset = b.scrollParent.offset() } }, drag: function (d, e) { var c = a(this).data("draggable"), f = c.options, b = false; if (c.scrollParent[0] != document && c.scrollParent[0].tagName != "HTML") { if (!f.axis || f.axis != "x") { if ((c.overflowOffset.top + c.scrollParent[0].offsetHeight) - d.pageY < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop + f.scrollSpeed } else { if (d.pageY - c.overflowOffset.top < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop - f.scrollSpeed } } } if (!f.axis || f.axis != "y") { if ((c.overflowOffset.left + c.scrollParent[0].offsetWidth) - d.pageX < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft + f.scrollSpeed } else { if (d.pageX - c.overflowOffset.left < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft - f.scrollSpeed } } } } else { if (!f.axis || f.axis != "x") { if (d.pageY - a(document).scrollTop() < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() - f.scrollSpeed) } else { if (a(window).height() - (d.pageY - a(document).scrollTop()) < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() + f.scrollSpeed) } } } if (!f.axis || f.axis != "y") { if (d.pageX - a(document).scrollLeft() < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() - f.scrollSpeed) } else { if (a(window).width() - (d.pageX - a(document).scrollLeft()) < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() + f.scrollSpeed) } } } } if (b !== false && a.ui.ddmanager && !f.dropBehaviour) { a.ui.ddmanager.prepareOffsets(c, d) } } }); a.ui.plugin.add("draggable", "snap", { start: function (c, d) { var b = a(this).data("draggable"), e = b.options; b.snapElements = []; a(e.snap.constructor != String ? (e.snap.items || ":data(draggable)") : e.snap).each(function () { var g = a(this); var f = g.offset(); if (this != b.element[0]) { b.snapElements.push({ item: this, width: g.outerWidth(), height: g.outerHeight(), top: f.top, left: f.left }) } }) }, drag: function (u, p) { var g = a(this).data("draggable"), q = g.options; var y = q.snapTolerance; var x = p.offset.left, w = x + g.helperProportions.width, f = p.offset.top, e = f + g.helperProportions.height; for (var v = g.snapElements.length - 1; v >= 0; v--) { var s = g.snapElements[v].left, n = s + g.snapElements[v].width, m = g.snapElements[v].top, A = m + g.snapElements[v].height; if (!((s - y < x && x < n + y && m - y < f && f < A + y) || (s - y < x && x < n + y && m - y < e && e < A + y) || (s - y < w && w < n + y && m - y < f && f < A + y) || (s - y < w && w < n + y && m - y < e && e < A + y))) { if (g.snapElements[v].snapping) { (g.options.snap.release && g.options.snap.release.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = false; continue } if (q.snapMode != "inner") { var c = Math.abs(m - e) <= y; var z = Math.abs(A - f) <= y; var j = Math.abs(s - w) <= y; var k = Math.abs(n - x) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m - g.helperProportions.height, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s - g.helperProportions.width }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n }).left - g.margins.left } } var h = (c || z || j || k); if (q.snapMode != "outer") { var c = Math.abs(m - f) <= y; var z = Math.abs(A - e) <= y; var j = Math.abs(s - x) <= y; var k = Math.abs(n - w) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A - g.helperProportions.height, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n - g.helperProportions.width }).left - g.margins.left } } if (!g.snapElements[v].snapping && (c || z || j || k || h)) { (g.options.snap.snap && g.options.snap.snap.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = (c || z || j || k || h) } } }); a.ui.plugin.add("draggable", "stack", { start: function (b, c) { var e = a(this).data("draggable").options; var d = a.makeArray(a(e.stack.group)).sort(function (g, f) { return (parseInt(a(g).css("zIndex"), 10) || e.stack.min) - (parseInt(a(f).css("zIndex"), 10) || e.stack.min) }); a(d).each(function (f) { this.style.zIndex = e.stack.min + f }); this[0].style.zIndex = e.stack.min + d.length } }); a.ui.plugin.add("draggable", "zIndex", { start: function (c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("zIndex")) { e._zIndex = b.css("zIndex") } b.css("zIndex", e.zIndex) }, stop: function (b, c) { var d = a(this).data("draggable").options; if (d._zIndex) { a(c.helper).css("zIndex", d._zIndex) } } }) })(jQuery); ; /*
 * jQuery UI Resizable 1.7.2
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * http://docs.jquery.com/UI/Resizables
 * Depends:
 *	ui.core.js
 */
(function (c) { c.widget("ui.resizable", c.extend({}, c.ui.mouse, { _init: function () { var e = this, j = this.options; this.element.addClass("ui-resizable"); c.extend(this, { _aspectRatio: !!(j.aspectRatio), aspectRatio: j.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], _helper: j.helper || j.ghost || j.animate ? j.helper || "ui-resizable-helper" : null }); if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { if (/relative/.test(this.element.css("position")) && c.browser.opera) { this.element.css({ position: "relative", top: "auto", left: "auto" }) } this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), top: this.element.css("top"), left: this.element.css("left") })); this.element = this.element.parent().data("resizable", this.element.data("resizable")); this.elementIsWrapper = true; this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0 }); this.originalResizeStyle = this.originalElement.css("resize"); this.originalElement.css("resize", "none"); this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" })); this.originalElement.css({ margin: this.originalElement.css("margin") }); this._proportionallyResize() } this.handles = j.handles || (!c(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" }); if (this.handles.constructor == String) { if (this.handles == "all") { this.handles = "n,e,s,w,se,sw,ne,nw" } var k = this.handles.split(","); this.handles = {}; for (var f = 0; f < k.length; f++) { var h = c.trim(k[f]), d = "ui-resizable-" + h; var g = c('<div class="ui-resizable-handle ' + d + '"></div>'); if (/sw|se|ne|nw/.test(h)) { g.css({ zIndex: ++j.zIndex }) } if ("se" == h) { g.addClass("ui-icon ui-icon-gripsmall-diagonal-se") } this.handles[h] = ".ui-resizable-" + h; this.element.append(g) } } this._renderAxis = function (p) { p = p || this.element; for (var m in this.handles) { if (this.handles[m].constructor == String) { this.handles[m] = c(this.handles[m], this.element).show() } if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { var n = c(this.handles[m], this.element), o = 0; o = /sw|ne|nw|se|n|s/.test(m) ? n.outerHeight() : n.outerWidth(); var l = ["padding", /ne|nw|n/.test(m) ? "Top" : /se|sw|s/.test(m) ? "Bottom" : /^e$/.test(m) ? "Right" : "Left"].join(""); p.css(l, o); this._proportionallyResize() } if (!c(this.handles[m]).length) { continue } } }; this._renderAxis(this.element); this._handles = c(".ui-resizable-handle", this.element).disableSelection(); this._handles.mouseover(function () { if (!e.resizing) { if (this.className) { var i = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i) } e.axis = i && i[1] ? i[1] : "se" } }); if (j.autoHide) { this._handles.hide(); c(this.element).addClass("ui-resizable-autohide").hover(function () { c(this).removeClass("ui-resizable-autohide"); e._handles.show() }, function () { if (!e.resizing) { c(this).addClass("ui-resizable-autohide"); e._handles.hide() } }) } this._mouseInit() }, destroy: function () { this._mouseDestroy(); var d = function (f) { c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove() }; if (this.elementIsWrapper) { d(this.element); var e = this.element; e.parent().append(this.originalElement.css({ position: e.css("position"), width: e.outerWidth(), height: e.outerHeight(), top: e.css("top"), left: e.css("left") })).end().remove() } this.originalElement.css("resize", this.originalResizeStyle); d(this.originalElement) }, _mouseCapture: function (e) { var f = false; for (var d in this.handles) { if (c(this.handles[d])[0] == e.target) { f = true } } return this.options.disabled || !!f }, _mouseStart: function (f) { var i = this.options, e = this.element.position(), d = this.element; this.resizing = true; this.documentScroll = { top: c(document).scrollTop(), left: c(document).scrollLeft() }; if (d.is(".ui-draggable") || (/absolute/).test(d.css("position"))) { d.css({ position: "absolute", top: e.top, left: e.left }) } if (c.browser.opera && (/relative/).test(d.css("position"))) { d.css({ position: "relative", top: "auto", left: "auto" }) } this._renderProxy(); var j = b(this.helper.css("left")), g = b(this.helper.css("top")); if (i.containment) { j += c(i.containment).scrollLeft() || 0; g += c(i.containment).scrollTop() || 0 } this.offset = this.helper.offset(); this.position = { left: j, top: g }; this.size = this._helper ? { width: d.outerWidth(), height: d.outerHeight()} : { width: d.width(), height: d.height() }; this.originalSize = this._helper ? { width: d.outerWidth(), height: d.outerHeight()} : { width: d.width(), height: d.height() }; this.originalPosition = { left: j, top: g }; this.sizeDiff = { width: d.outerWidth() - d.width(), height: d.outerHeight() - d.height() }; this.originalMousePosition = { left: f.pageX, top: f.pageY }; this.aspectRatio = (typeof i.aspectRatio == "number") ? i.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); var h = c(".ui-resizable-" + this.axis).css("cursor"); c("body").css("cursor", h == "auto" ? this.axis + "-resize" : h); d.addClass("ui-resizable-resizing"); this._propagate("start", f); return true }, _mouseDrag: function (d) { var g = this.helper, f = this.options, l = {}, p = this, i = this.originalMousePosition, m = this.axis; var q = (d.pageX - i.left) || 0, n = (d.pageY - i.top) || 0; var h = this._change[m]; if (!h) { return false } var k = h.apply(this, [d, q, n]), j = c.browser.msie && c.browser.version < 7, e = this.sizeDiff; if (this._aspectRatio || d.shiftKey) { k = this._updateRatio(k, d) } k = this._respectSize(k, d); this._propagate("resize", d); g.css({ top: this.position.top + "px", left: this.position.left + "px", width: this.size.width + "px", height: this.size.height + "px" }); if (!this._helper && this._proportionallyResizeElements.length) { this._proportionallyResize() } this._updateCache(k); this._trigger("resize", d, this.ui()); return false }, _mouseStop: function (g) { this.resizing = false; var h = this.options, l = this; if (this._helper) { var f = this._proportionallyResizeElements, d = f.length && (/textarea/i).test(f[0].nodeName), e = d && c.ui.hasScroll(f[0], "left") ? 0 : l.sizeDiff.height, j = d ? 0 : l.sizeDiff.width; var m = { width: (l.size.width - j), height: (l.size.height - e) }, i = (parseInt(l.element.css("left"), 10) + (l.position.left - l.originalPosition.left)) || null, k = (parseInt(l.element.css("top"), 10) + (l.position.top - l.originalPosition.top)) || null; if (!h.animate) { this.element.css(c.extend(m, { top: k, left: i })) } l.helper.height(l.size.height); l.helper.width(l.size.width); if (this._helper && !h.animate) { this._proportionallyResize() } } c("body").css("cursor", "auto"); this.element.removeClass("ui-resizable-resizing"); this._propagate("stop", g); if (this._helper) { this.helper.remove() } return false }, _updateCache: function (d) { var e = this.options; this.offset = this.helper.offset(); if (a(d.left)) { this.position.left = d.left } if (a(d.top)) { this.position.top = d.top } if (a(d.height)) { this.size.height = d.height } if (a(d.width)) { this.size.width = d.width } }, _updateRatio: function (g, f) { var h = this.options, i = this.position, e = this.size, d = this.axis; if (g.height) { g.width = (e.height * this.aspectRatio) } else { if (g.width) { g.height = (e.width / this.aspectRatio) } } if (d == "sw") { g.left = i.left + (e.width - g.width); g.top = null } if (d == "nw") { g.top = i.top + (e.height - g.height); g.left = i.left + (e.width - g.width) } return g }, _respectSize: function (k, f) { var i = this.helper, h = this.options, q = this._aspectRatio || f.shiftKey, p = this.axis, s = a(k.width) && h.maxWidth && (h.maxWidth < k.width), l = a(k.height) && h.maxHeight && (h.maxHeight < k.height), g = a(k.width) && h.minWidth && (h.minWidth > k.width), r = a(k.height) && h.minHeight && (h.minHeight > k.height); if (g) { k.width = h.minWidth } if (r) { k.height = h.minHeight } if (s) { k.width = h.maxWidth } if (l) { k.height = h.maxHeight } var e = this.originalPosition.left + this.originalSize.width, n = this.position.top + this.size.height; var j = /sw|nw|w/.test(p), d = /nw|ne|n/.test(p); if (g && j) { k.left = e - h.minWidth } if (s && j) { k.left = e - h.maxWidth } if (r && d) { k.top = n - h.minHeight } if (l && d) { k.top = n - h.maxHeight } var m = !k.width && !k.height; if (m && !k.left && k.top) { k.top = null } else { if (m && !k.top && k.left) { k.left = null } } return k }, _proportionallyResize: function () { var j = this.options; if (!this._proportionallyResizeElements.length) { return } var f = this.helper || this.element; for (var e = 0; e < this._proportionallyResizeElements.length; e++) { var g = this._proportionallyResizeElements[e]; if (!this.borderDif) { var d = [g.css("borderTopWidth"), g.css("borderRightWidth"), g.css("borderBottomWidth"), g.css("borderLeftWidth")], h = [g.css("paddingTop"), g.css("paddingRight"), g.css("paddingBottom"), g.css("paddingLeft")]; this.borderDif = c.map(d, function (k, m) { var l = parseInt(k, 10) || 0, n = parseInt(h[m], 10) || 0; return l + n }) } if (c.browser.msie && !(!(c(f).is(":hidden") || c(f).parents(":hidden").length))) { continue } g.css({ height: (f.height() - this.borderDif[0] - this.borderDif[2]) || 0, width: (f.width() - this.borderDif[1] - this.borderDif[3]) || 0 }) } }, _renderProxy: function () { var e = this.element, h = this.options; this.elementOffset = e.offset(); if (this._helper) { this.helper = this.helper || c('<div style="overflow:hidden;"></div>'); var d = c.browser.msie && c.browser.version < 7, f = (d ? 1 : 0), g = (d ? 2 : -1); this.helper.addClass(this._helper).css({ width: this.element.outerWidth() + g, height: this.element.outerHeight() + g, position: "absolute", left: this.elementOffset.left - f + "px", top: this.elementOffset.top - f + "px", zIndex: ++h.zIndex }); this.helper.appendTo("body").disableSelection() } else { this.helper = this.element } }, _change: { e: function (f, e, d) { return { width: this.originalSize.width + e} }, w: function (g, e, d) { var i = this.options, f = this.originalSize, h = this.originalPosition; return { left: h.left + e, width: f.width - e} }, n: function (g, e, d) { var i = this.options, f = this.originalSize, h = this.originalPosition; return { top: h.top + d, height: f.height - d} }, s: function (f, e, d) { return { height: this.originalSize.height + d} }, se: function (f, e, d) { return c.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [f, e, d])) }, sw: function (f, e, d) { return c.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [f, e, d])) }, ne: function (f, e, d) { return c.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [f, e, d])) }, nw: function (f, e, d) { return c.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [f, e, d])) } }, _propagate: function (e, d) { c.ui.plugin.call(this, e, [d, this.ui()]); (e != "resize" && this._trigger(e, d, this.ui())) }, plugins: {}, ui: function () { return { originalElement: this.originalElement, element: this.element, helper: this.helper, position: this.position, size: this.size, originalSize: this.originalSize, originalPosition: this.originalPosition} } })); c.extend(c.ui.resizable, { version: "1.7.2", eventPrefix: "resize", defaults: { alsoResize: false, animate: false, animateDuration: "slow", animateEasing: "swing", aspectRatio: false, autoHide: false, cancel: ":input,option", containment: false, delay: 0, distance: 1, ghost: false, grid: false, handles: "e,s,se", helper: false, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, zIndex: 1000} }); c.ui.plugin.add("resizable", "alsoResize", { start: function (e, f) { var d = c(this).data("resizable"), g = d.options; _store = function (h) { c(h).each(function () { c(this).data("resizable-alsoresize", { width: parseInt(c(this).width(), 10), height: parseInt(c(this).height(), 10), left: parseInt(c(this).css("left"), 10), top: parseInt(c(this).css("top"), 10) }) }) }; if (typeof (g.alsoResize) == "object" && !g.alsoResize.parentNode) { if (g.alsoResize.length) { g.alsoResize = g.alsoResize[0]; _store(g.alsoResize) } else { c.each(g.alsoResize, function (h, i) { _store(h) }) } } else { _store(g.alsoResize) } }, resize: function (f, h) { var e = c(this).data("resizable"), i = e.options, g = e.originalSize, k = e.originalPosition; var j = { height: (e.size.height - g.height) || 0, width: (e.size.width - g.width) || 0, top: (e.position.top - k.top) || 0, left: (e.position.left - k.left) || 0 }, d = function (l, m) { c(l).each(function () { var p = c(this), q = c(this).data("resizable-alsoresize"), o = {}, n = m && m.length ? m : ["width", "height", "top", "left"]; c.each(n || ["width", "height", "top", "left"], function (r, t) { var s = (q[t] || 0) + (j[t] || 0); if (s && s >= 0) { o[t] = s || null } }); if (/relative/.test(p.css("position")) && c.browser.opera) { e._revertToRelativePosition = true; p.css({ position: "absolute", top: "auto", left: "auto" }) } p.css(o) }) }; if (typeof (i.alsoResize) == "object" && !i.alsoResize.nodeType) { c.each(i.alsoResize, function (l, m) { d(l, m) }) } else { d(i.alsoResize) } }, stop: function (e, f) { var d = c(this).data("resizable"); if (d._revertToRelativePosition && c.browser.opera) { d._revertToRelativePosition = false; el.css({ position: "relative" }) } c(this).removeData("resizable-alsoresize-start") } }); c.ui.plugin.add("resizable", "animate", { stop: function (h, m) { var n = c(this).data("resizable"), i = n.options; var g = n._proportionallyResizeElements, d = g.length && (/textarea/i).test(g[0].nodeName), e = d && c.ui.hasScroll(g[0], "left") ? 0 : n.sizeDiff.height, k = d ? 0 : n.sizeDiff.width; var f = { width: (n.size.width - k), height: (n.size.height - e) }, j = (parseInt(n.element.css("left"), 10) + (n.position.left - n.originalPosition.left)) || null, l = (parseInt(n.element.css("top"), 10) + (n.position.top - n.originalPosition.top)) || null; n.element.animate(c.extend(f, l && j ? { top: l, left: j} : {}), { duration: i.animateDuration, easing: i.animateEasing, step: function () { var o = { width: parseInt(n.element.css("width"), 10), height: parseInt(n.element.css("height"), 10), top: parseInt(n.element.css("top"), 10), left: parseInt(n.element.css("left"), 10) }; if (g && g.length) { c(g[0]).css({ width: o.width, height: o.height }) } n._updateCache(o); n._propagate("resize", h) } }) } }); c.ui.plugin.add("resizable", "containment", { start: function (e, q) { var s = c(this).data("resizable"), i = s.options, k = s.element; var f = i.containment, j = (f instanceof c) ? f.get(0) : (/parent/.test(f)) ? k.parent().get(0) : f; if (!j) { return } s.containerElement = c(j); if (/document/.test(f) || f == document) { s.containerOffset = { left: 0, top: 0 }; s.containerPosition = { left: 0, top: 0 }; s.parentData = { element: c(document), left: 0, top: 0, width: c(document).width(), height: c(document).height() || document.body.parentNode.scrollHeight} } else { var m = c(j), h = []; c(["Top", "Right", "Left", "Bottom"]).each(function (p, o) { h[p] = b(m.css("padding" + o)) }); s.containerOffset = m.offset(); s.containerPosition = m.position(); s.containerSize = { height: (m.innerHeight() - h[3]), width: (m.innerWidth() - h[1]) }; var n = s.containerOffset, d = s.containerSize.height, l = s.containerSize.width, g = (c.ui.hasScroll(j, "left") ? j.scrollWidth : l), r = (c.ui.hasScroll(j) ? j.scrollHeight : d); s.parentData = { element: j, left: n.left, top: n.top, width: g, height: r} } }, resize: function (f, p) { var s = c(this).data("resizable"), h = s.options, e = s.containerSize, n = s.containerOffset, l = s.size, m = s.position, q = s._aspectRatio || f.shiftKey, d = { top: 0, left: 0 }, g = s.containerElement; if (g[0] != document && (/static/).test(g.css("position"))) { d = n } if (m.left < (s._helper ? n.left : 0)) { s.size.width = s.size.width + (s._helper ? (s.position.left - n.left) : (s.position.left - d.left)); if (q) { s.size.height = s.size.width / h.aspectRatio } s.position.left = h.helper ? n.left : 0 } if (m.top < (s._helper ? n.top : 0)) { s.size.height = s.size.height + (s._helper ? (s.position.top - n.top) : s.position.top); if (q) { s.size.width = s.size.height * h.aspectRatio } s.position.top = s._helper ? n.top : 0 } s.offset.left = s.parentData.left + s.position.left; s.offset.top = s.parentData.top + s.position.top; var k = Math.abs((s._helper ? s.offset.left - d.left : (s.offset.left - d.left)) + s.sizeDiff.width), r = Math.abs((s._helper ? s.offset.top - d.top : (s.offset.top - n.top)) + s.sizeDiff.height); var j = s.containerElement.get(0) == s.element.parent().get(0), i = /relative|absolute/.test(s.containerElement.css("position")); if (j && i) { k -= s.parentData.left } if (k + s.size.width >= s.parentData.width) { s.size.width = s.parentData.width - k; if (q) { s.size.height = s.size.width / s.aspectRatio } } if (r + s.size.height >= s.parentData.height) { s.size.height = s.parentData.height - r; if (q) { s.size.width = s.size.height * s.aspectRatio } } }, stop: function (e, m) { var p = c(this).data("resizable"), f = p.options, k = p.position, l = p.containerOffset, d = p.containerPosition, g = p.containerElement; var i = c(p.helper), q = i.offset(), n = i.outerWidth() - p.sizeDiff.width, j = i.outerHeight() - p.sizeDiff.height; if (p._helper && !f.animate && (/relative/).test(g.css("position"))) { c(this).css({ left: q.left - d.left - l.left, width: n, height: j }) } if (p._helper && !f.animate && (/static/).test(g.css("position"))) { c(this).css({ left: q.left - d.left - l.left, width: n, height: j }) } } }); c.ui.plugin.add("resizable", "ghost", { start: function (f, g) { var d = c(this).data("resizable"), h = d.options, e = d.size; d.ghost = d.originalElement.clone(); d.ghost.css({ opacity: 0.25, display: "block", position: "relative", height: e.height, width: e.width, margin: 0, left: 0, top: 0 }).addClass("ui-resizable-ghost").addClass(typeof h.ghost == "string" ? h.ghost : ""); d.ghost.appendTo(d.helper) }, resize: function (e, f) { var d = c(this).data("resizable"), g = d.options; if (d.ghost) { d.ghost.css({ position: "relative", height: d.size.height, width: d.size.width }) } }, stop: function (e, f) { var d = c(this).data("resizable"), g = d.options; if (d.ghost && d.helper) { d.helper.get(0).removeChild(d.ghost.get(0)) } } }); c.ui.plugin.add("resizable", "grid", { resize: function (d, l) { var n = c(this).data("resizable"), g = n.options, j = n.size, h = n.originalSize, i = n.originalPosition, m = n.axis, k = g._aspectRatio || d.shiftKey; g.grid = typeof g.grid == "number" ? [g.grid, g.grid] : g.grid; var f = Math.round((j.width - h.width) / (g.grid[0] || 1)) * (g.grid[0] || 1), e = Math.round((j.height - h.height) / (g.grid[1] || 1)) * (g.grid[1] || 1); if (/^(se|s|e)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e } else { if (/^(ne)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e; n.position.top = i.top - e } else { if (/^(sw)$/.test(m)) { n.size.width = h.width + f; n.size.height = h.height + e; n.position.left = i.left - f } else { n.size.width = h.width + f; n.size.height = h.height + e; n.position.top = i.top - e; n.position.left = i.left - f } } } } }); var b = function (d) { return parseInt(d, 10) || 0 }; var a = function (d) { return !isNaN(parseInt(d, 10)) } })(jQuery); ; /*
 * jQuery UI Datepicker 1.7.2
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * http://docs.jquery.com/UI/Datepicker
 * Depends:
 *	ui.core.js
 */
(function ($) { $.extend($.ui, { datepicker: { version: "1.7.2"} }); var PROP_NAME = "datepicker"; function Datepicker() { this.debug = false; this._curInst = null; this._keyEvent = false; this._disabledInputs = []; this._datepickerShowing = false; this._inDialog = false; this._mainDivId = "ui-datepicker-div"; this._inlineClass = "ui-datepicker-inline"; this._appendClass = "ui-datepicker-append"; this._triggerClass = "ui-datepicker-trigger"; this._dialogClass = "ui-datepicker-dialog"; this._disableClass = "ui-datepicker-disabled"; this._unselectableClass = "ui-datepicker-unselectable"; this._currentClass = "ui-datepicker-current-day"; this._dayOverClass = "ui-datepicker-days-cell-over"; this.regional = []; this.regional[""] = { closeText: "Done", prevText: "Prev", nextText: "Next", currentText: "Today", monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], dateFormat: "mm/dd/yy", firstDay: 0, isRTL: false }; this._defaults = { showOn: "focus", showAnim: "show", showOptions: {}, defaultDate: null, appendText: "", buttonText: "...", buttonImage: "", buttonImageOnly: false, hideIfNoPrevNext: false, navigationAsDateFormat: false, gotoCurrent: false, changeMonth: false, changeYear: false, showMonthAfterYear: false, yearRange: "-10:+10", showOtherMonths: false, calculateWeek: this.iso8601Week, shortYearCutoff: "+10", minDate: null, maxDate: null, duration: "normal", beforeShowDay: null, beforeShow: null, onSelect: null, onChangeMonthYear: null, onClose: null, numberOfMonths: 1, showCurrentAtPos: 0, stepMonths: 1, stepBigMonths: 12, altField: "", altFormat: "", constrainInput: true, showButtonPanel: false }; $.extend(this._defaults, this.regional[""]); this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>') } $.extend(Datepicker.prototype, { markerClassName: "hasDatepicker", log: function () { if (this.debug) { console.log.apply("", arguments) } }, setDefaults: function (settings) { extendRemove(this._defaults, settings || {}); return this }, _attachDatepicker: function (target, settings) { var inlineSettings = null; for (var attrName in this._defaults) { var attrValue = target.getAttribute("date:" + attrName); if (attrValue) { inlineSettings = inlineSettings || {}; try { inlineSettings[attrName] = eval(attrValue) } catch (err) { inlineSettings[attrName] = attrValue } } } var nodeName = target.nodeName.toLowerCase(); var inline = (nodeName == "div" || nodeName == "span"); if (!target.id) { target.id = "dp" + (++this.uuid) } var inst = this._newInst($(target), inline); inst.settings = $.extend({}, settings || {}, inlineSettings || {}); if (nodeName == "input") { this._connectDatepicker(target, inst) } else { if (inline) { this._inlineDatepicker(target, inst) } } }, _newInst: function (target, inline) { var id = target[0].id.replace(/([:\[\]\.])/g, "\\\\$1"); return { id: id, input: target, selectedDay: 0, selectedMonth: 0, selectedYear: 0, drawMonth: 0, drawYear: 0, inline: inline, dpDiv: (!inline ? this.dpDiv : $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))} }, _connectDatepicker: function (target, inst) { var input = $(target); inst.append = $([]); inst.trigger = $([]); if (input.hasClass(this.markerClassName)) { return } var appendText = this._get(inst, "appendText"); var isRTL = this._get(inst, "isRTL"); if (appendText) { inst.append = $('<span class="' + this._appendClass + '">' + appendText + "</span>"); input[isRTL ? "before" : "after"](inst.append) } var showOn = this._get(inst, "showOn"); if (showOn == "focus" || showOn == "both") { input.focus(this._showDatepicker) } if (showOn == "button" || showOn == "both") { var buttonText = this._get(inst, "buttonText"); var buttonImage = this._get(inst, "buttonImage"); inst.trigger = $(this._get(inst, "buttonImageOnly") ? $("<img/>").addClass(this._triggerClass).attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage == "" ? buttonText : $("<img/>").attr({ src: buttonImage, alt: buttonText, title: buttonText }))); input[isRTL ? "before" : "after"](inst.trigger); inst.trigger.click(function () { if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) { $.datepicker._hideDatepicker() } else { $.datepicker._showDatepicker(target) } return false }) } input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker", function (event, key, value) { inst.settings[key] = value }).bind("getData.datepicker", function (event, key) { return this._get(inst, key) }); $.data(target, PROP_NAME, inst) }, _inlineDatepicker: function (target, inst) { var divSpan = $(target); if (divSpan.hasClass(this.markerClassName)) { return } divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker", function (event, key, value) { inst.settings[key] = value }).bind("getData.datepicker", function (event, key) { return this._get(inst, key) }); $.data(target, PROP_NAME, inst); this._setDate(inst, this._getDefaultDate(inst)); this._updateDatepicker(inst); this._updateAlternate(inst) }, _dialogDatepicker: function (input, dateText, onSelect, settings, pos) { var inst = this._dialogInst; if (!inst) { var id = "dp" + (++this.uuid); this._dialogInput = $('<input type="text" id="' + id + '" size="1" style="position: absolute; top: -100px;"/>'); this._dialogInput.keydown(this._doKeyDown); $("body").append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); inst.settings = {}; $.data(this._dialogInput[0], PROP_NAME, inst) } extendRemove(inst.settings, settings || {}); this._dialogInput.val(dateText); this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); if (!this._pos) { var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; this._pos = [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY] } this._dialogInput.css("left", this._pos[0] + "px").css("top", this._pos[1] + "px"); inst.settings.onSelect = onSelect; this._inDialog = true; this.dpDiv.addClass(this._dialogClass); this._showDatepicker(this._dialogInput[0]); if ($.blockUI) { $.blockUI(this.dpDiv) } $.data(this._dialogInput[0], PROP_NAME, inst); return this }, _destroyDatepicker: function (target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return } var nodeName = target.nodeName.toLowerCase(); $.removeData(target, PROP_NAME); if (nodeName == "input") { inst.append.remove(); inst.trigger.remove(); $target.removeClass(this.markerClassName).unbind("focus", this._showDatepicker).unbind("keydown", this._doKeyDown).unbind("keypress", this._doKeyPress) } else { if (nodeName == "div" || nodeName == "span") { $target.removeClass(this.markerClassName).empty() } } }, _enableDatepicker: function (target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return } var nodeName = target.nodeName.toLowerCase(); if (nodeName == "input") { target.disabled = false; inst.trigger.filter("button").each(function () { this.disabled = false }).end().filter("img").css({ opacity: "1.0", cursor: "" }) } else { if (nodeName == "div" || nodeName == "span") { var inline = $target.children("." + this._inlineClass); inline.children().removeClass("ui-state-disabled") } } this._disabledInputs = $.map(this._disabledInputs, function (value) { return (value == target ? null : value) }) }, _disableDatepicker: function (target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return } var nodeName = target.nodeName.toLowerCase(); if (nodeName == "input") { target.disabled = true; inst.trigger.filter("button").each(function () { this.disabled = true }).end().filter("img").css({ opacity: "0.5", cursor: "default" }) } else { if (nodeName == "div" || nodeName == "span") { var inline = $target.children("." + this._inlineClass); inline.children().addClass("ui-state-disabled") } } this._disabledInputs = $.map(this._disabledInputs, function (value) { return (value == target ? null : value) }); this._disabledInputs[this._disabledInputs.length] = target }, _isDisabledDatepicker: function (target) { if (!target) { return false } for (var i = 0; i < this._disabledInputs.length; i++) { if (this._disabledInputs[i] == target) { return true } } return false }, _getInst: function (target) { try { return $.data(target, PROP_NAME) } catch (err) { throw "Missing instance data for this datepicker" } }, _optionDatepicker: function (target, name, value) { var inst = this._getInst(target); if (arguments.length == 2 && typeof name == "string") { return (name == "defaults" ? $.extend({}, $.datepicker._defaults) : (inst ? (name == "all" ? $.extend({}, inst.settings) : this._get(inst, name)) : null)) } var settings = name || {}; if (typeof name == "string") { settings = {}; settings[name] = value } if (inst) { if (this._curInst == inst) { this._hideDatepicker(null) } var date = this._getDateDatepicker(target); extendRemove(inst.settings, settings); this._setDateDatepicker(target, date); this._updateDatepicker(inst) } }, _changeDatepicker: function (target, name, value) { this._optionDatepicker(target, name, value) }, _refreshDatepicker: function (target) { var inst = this._getInst(target); if (inst) { this._updateDatepicker(inst) } }, _setDateDatepicker: function (target, date, endDate) { var inst = this._getInst(target); if (inst) { this._setDate(inst, date, endDate); this._updateDatepicker(inst); this._updateAlternate(inst) } }, _getDateDatepicker: function (target) { var inst = this._getInst(target); if (inst && !inst.inline) { this._setDateFromField(inst) } return (inst ? this._getDate(inst) : null) }, _doKeyDown: function (event) { var inst = $.datepicker._getInst(event.target); var handled = true; var isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); inst._keyEvent = true; if ($.datepicker._datepickerShowing) { switch (event.keyCode) { case 9: $.datepicker._hideDatepicker(null, ""); break; case 13: var sel = $("td." + $.datepicker._dayOverClass + ", td." + $.datepicker._currentClass, inst.dpDiv); if (sel[0]) { $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]) } else { $.datepicker._hideDatepicker(null, $.datepicker._get(inst, "duration")) } return false; break; case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, "duration")); break; case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M"); break; case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M"); break; case 35: if (event.ctrlKey || event.metaKey) { $.datepicker._clearDate(event.target) } handled = event.ctrlKey || event.metaKey; break; case 36: if (event.ctrlKey || event.metaKey) { $.datepicker._gotoToday(event.target) } handled = event.ctrlKey || event.metaKey; break; case 37: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D") } handled = event.ctrlKey || event.metaKey; if (event.originalEvent.altKey) { $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M") } break; case 38: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, -7, "D") } handled = event.ctrlKey || event.metaKey; break; case 39: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D") } handled = event.ctrlKey || event.metaKey; if (event.originalEvent.altKey) { $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M") } break; case 40: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, +7, "D") } handled = event.ctrlKey || event.metaKey; break; default: handled = false } } else { if (event.keyCode == 36 && event.ctrlKey) { $.datepicker._showDatepicker(this) } else { handled = false } } if (handled) { event.preventDefault(); event.stopPropagation() } }, _doKeyPress: function (event) { var inst = $.datepicker._getInst(event.target); if ($.datepicker._get(inst, "constrainInput")) { var chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); return event.ctrlKey || (chr < " " || !chars || chars.indexOf(chr) > -1) } }, _showDatepicker: function (input) { input = input.target || input; if (input.nodeName.toLowerCase() != "input") { input = $("input", input.parentNode)[0] } if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) { return } var inst = $.datepicker._getInst(input); var beforeShow = $.datepicker._get(inst, "beforeShow"); extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); $.datepicker._hideDatepicker(null, ""); $.datepicker._lastInput = input; $.datepicker._setDateFromField(inst); if ($.datepicker._inDialog) { input.value = "" } if (!$.datepicker._pos) { $.datepicker._pos = $.datepicker._findPos(input); $.datepicker._pos[1] += input.offsetHeight } var isFixed = false; $(input).parents().each(function () { isFixed |= $(this).css("position") == "fixed"; return !isFixed }); if (isFixed && $.browser.opera) { $.datepicker._pos[0] -= document.documentElement.scrollLeft; $.datepicker._pos[1] -= document.documentElement.scrollTop } var offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; $.datepicker._pos = null; inst.rangeStart = null; inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" }); $.datepicker._updateDatepicker(inst); offset = $.datepicker._checkOffset(inst, offset, isFixed); inst.dpDiv.css({ position: ($.datepicker._inDialog && $.blockUI ? "static" : (isFixed ? "fixed" : "absolute")), display: "none", left: offset.left + "px", top: offset.top + "px" }); if (!inst.inline) { var showAnim = $.datepicker._get(inst, "showAnim") || "show"; var duration = $.datepicker._get(inst, "duration"); var postProcess = function () { $.datepicker._datepickerShowing = true; if ($.browser.msie && parseInt($.browser.version, 10) < 7) { $("iframe.ui-datepicker-cover").css({ width: inst.dpDiv.width() + 4, height: inst.dpDiv.height() + 4 }) } }; if ($.effects && $.effects[showAnim]) { inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess) } else { inst.dpDiv[showAnim](duration, postProcess) } if (duration == "") { postProcess() } if (inst.input[0].type != "hidden") { inst.input[0].focus() } $.datepicker._curInst = inst } }, _updateDatepicker: function (inst) { var dims = { width: inst.dpDiv.width() + 4, height: inst.dpDiv.height() + 4 }; var self = this; inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({ width: dims.width, height: dims.height }).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout", function () { $(this).removeClass("ui-state-hover"); if (this.className.indexOf("ui-datepicker-prev") != -1) { $(this).removeClass("ui-datepicker-prev-hover") } if (this.className.indexOf("ui-datepicker-next") != -1) { $(this).removeClass("ui-datepicker-next-hover") } }).bind("mouseover", function () { if (!self._isDisabledDatepicker(inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); $(this).addClass("ui-state-hover"); if (this.className.indexOf("ui-datepicker-prev") != -1) { $(this).addClass("ui-datepicker-prev-hover") } if (this.className.indexOf("ui-datepicker-next") != -1) { $(this).addClass("ui-datepicker-next-hover") } } }).end().find("." + this._dayOverClass + " a").trigger("mouseover").end(); var numMonths = this._getNumberOfMonths(inst); var cols = numMonths[1]; var width = 17; if (cols > 1) { inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em") } else { inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("") } inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? "add" : "remove") + "Class"]("ui-datepicker-multi"); inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl"); if (inst.input && inst.input[0].type != "hidden" && inst == $.datepicker._curInst) { $(inst.input[0]).focus() } }, _checkOffset: function (inst, offset, isFixed) { var dpWidth = inst.dpDiv.outerWidth(); var dpHeight = inst.dpDiv.outerHeight(); var inputWidth = inst.input ? inst.input.outerWidth() : 0; var inputHeight = inst.input ? inst.input.outerHeight() : 0; var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft(); var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop(); offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0; offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight * 2 - viewHeight) : 0; return offset }, _findPos: function (obj) { while (obj && (obj.type == "hidden" || obj.nodeType != 1)) { obj = obj.nextSibling } var position = $(obj).offset(); return [position.left, position.top] }, _hideDatepicker: function (input, duration) { var inst = this._curInst; if (!inst || (input && inst != $.data(input, PROP_NAME))) { return } if (inst.stayOpen) { this._selectDate("#" + inst.id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear)) } inst.stayOpen = false; if (this._datepickerShowing) { duration = (duration != null ? duration : this._get(inst, "duration")); var showAnim = this._get(inst, "showAnim"); var postProcess = function () { $.datepicker._tidyDialog(inst) }; if (duration != "" && $.effects && $.effects[showAnim]) { inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess) } else { inst.dpDiv[(duration == "" ? "hide" : (showAnim == "slideDown" ? "slideUp" : (showAnim == "fadeIn" ? "fadeOut" : "hide")))](duration, postProcess) } if (duration == "") { this._tidyDialog(inst) } var onClose = this._get(inst, "onClose"); if (onClose) { onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]) } this._datepickerShowing = false; this._lastInput = null; if (this._inDialog) { this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); if ($.blockUI) { $.unblockUI(); $("body").append(this.dpDiv) } } this._inDialog = false } this._curInst = null }, _tidyDialog: function (inst) { inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar") }, _checkExternalClick: function (event) { if (!$.datepicker._curInst) { return } var $target = $(event.target); if (($target.parents("#" + $.datepicker._mainDivId).length == 0) && !$target.hasClass($.datepicker.markerClassName) && !$target.hasClass($.datepicker._triggerClass) && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) { $.datepicker._hideDatepicker(null, "") } }, _adjustDate: function (id, offset, period) { var target = $(id); var inst = this._getInst(target[0]); if (this._isDisabledDatepicker(target[0])) { return } this._adjustInstDate(inst, offset + (period == "M" ? this._get(inst, "showCurrentAtPos") : 0), period); this._updateDatepicker(inst) }, _gotoToday: function (id) { var target = $(id); var inst = this._getInst(target[0]); if (this._get(inst, "gotoCurrent") && inst.currentDay) { inst.selectedDay = inst.currentDay; inst.drawMonth = inst.selectedMonth = inst.currentMonth; inst.drawYear = inst.selectedYear = inst.currentYear } else { var date = new Date(); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear() } this._notifyChange(inst); this._adjustDate(target) }, _selectMonthYear: function (id, select, period) { var target = $(id); var inst = this._getInst(target[0]); inst._selectingMonthYear = false; inst["selected" + (period == "M" ? "Month" : "Year")] = inst["draw" + (period == "M" ? "Month" : "Year")] = parseInt(select.options[select.selectedIndex].value, 10); this._notifyChange(inst); this._adjustDate(target) }, _clickMonthYear: function (id) { var target = $(id); var inst = this._getInst(target[0]); if (inst.input && inst._selectingMonthYear && !$.browser.msie) { inst.input[0].focus() } inst._selectingMonthYear = !inst._selectingMonthYear }, _selectDay: function (id, month, year, td) { var target = $(id); if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { return } var inst = this._getInst(target[0]); inst.selectedDay = inst.currentDay = $("a", td).html(); inst.selectedMonth = inst.currentMonth = month; inst.selectedYear = inst.currentYear = year; if (inst.stayOpen) { inst.endDay = inst.endMonth = inst.endYear = null } this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear)); if (inst.stayOpen) { inst.rangeStart = this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); this._updateDatepicker(inst) } }, _clearDate: function (id) { var target = $(id); var inst = this._getInst(target[0]); inst.stayOpen = false; inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null; this._selectDate(target, "") }, _selectDate: function (id, dateStr) { var target = $(id); var inst = this._getInst(target[0]); dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); if (inst.input) { inst.input.val(dateStr) } this._updateAlternate(inst); var onSelect = this._get(inst, "onSelect"); if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]) } else { if (inst.input) { inst.input.trigger("change") } } if (inst.inline) { this._updateDatepicker(inst) } else { if (!inst.stayOpen) { this._hideDatepicker(null, this._get(inst, "duration")); this._lastInput = inst.input[0]; if (typeof (inst.input[0]) != "object") { inst.input[0].focus() } this._lastInput = null } } }, _updateAlternate: function (inst) { var altField = this._get(inst, "altField"); if (altField) { var altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); var date = this._getDate(inst); dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); $(altField).each(function () { $(this).val(dateStr) }) } }, noWeekends: function (date) { var day = date.getDay(); return [(day > 0 && day < 6), ""] }, iso8601Week: function (date) { var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()); var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); var firstDay = firstMon.getDay() || 7; firstMon.setDate(firstMon.getDate() + 1 - firstDay); if (firstDay < 4 && checkDate < firstMon) { checkDate.setDate(checkDate.getDate() - 3); return $.datepicker.iso8601Week(checkDate) } else { if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7; if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { return 1 } } } return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1 }, parseDate: function (format, value, settings) { if (format == null || value == null) { throw "Invalid arguments" } value = (typeof value == "object" ? value.toString() : value + ""); if (value == "") { return null } var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; var year = -1; var month = -1; var day = -1; var doy = -1; var literal = false; var lookAhead = function (match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) { iFormat++ } return matches }; var getNumber = function (match) { lookAhead(match); var origSize = (match == "@" ? 14 : (match == "y" ? 4 : (match == "o" ? 3 : 2))); var size = origSize; var num = 0; while (size > 0 && iValue < value.length && value.charAt(iValue) >= "0" && value.charAt(iValue) <= "9") { num = num * 10 + parseInt(value.charAt(iValue++), 10); size-- } if (size == origSize) { throw "Missing number at position " + iValue } return num }; var getName = function (match, shortNames, longNames) { var names = (lookAhead(match) ? longNames : shortNames); var size = 0; for (var j = 0; j < names.length; j++) { size = Math.max(size, names[j].length) } var name = ""; var iInit = iValue; while (size > 0 && iValue < value.length) { name += value.charAt(iValue++); for (var i = 0; i < names.length; i++) { if (name == names[i]) { return i + 1 } } size-- } throw "Unknown name at position " + iInit }; var checkLiteral = function () { if (value.charAt(iValue) != format.charAt(iFormat)) { throw "Unexpected literal at position " + iValue } iValue++ }; var iValue = 0; for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) == "'" && !lookAhead("'")) { literal = false } else { checkLiteral() } } else { switch (format.charAt(iFormat)) { case "d": day = getNumber("d"); break; case "D": getName("D", dayNamesShort, dayNames); break; case "o": doy = getNumber("o"); break; case "m": month = getNumber("m"); break; case "M": month = getName("M", monthNamesShort, monthNames); break; case "y": year = getNumber("y"); break; case "@": var date = new Date(getNumber("@")); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "'": if (lookAhead("'")) { checkLiteral() } else { literal = true } break; default: checkLiteral() } } } if (year == -1) { year = new Date().getFullYear() } else { if (year < 100) { year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100) } } if (doy > -1) { month = 1; day = doy; do { var dim = this._getDaysInMonth(year, month - 1); if (day <= dim) { break } month++; day -= dim } while (true) } var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) { throw "Invalid date" } return date }, ATOM: "yy-mm-dd", COOKIE: "D, dd M yy", ISO_8601: "yy-mm-dd", RFC_822: "D, d M y", RFC_850: "DD, dd-M-y", RFC_1036: "D, d M y", RFC_1123: "D, d M yy", RFC_2822: "D, d M yy", RSS: "D, d M y", TIMESTAMP: "@", W3C: "yy-mm-dd", formatDate: function (format, date, settings) { if (!date) { return "" } var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; var lookAhead = function (match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) { iFormat++ } return matches }; var formatNumber = function (match, value, len) { var num = "" + value; if (lookAhead(match)) { while (num.length < len) { num = "0" + num } } return num }; var formatName = function (match, value, shortNames, longNames) { return (lookAhead(match) ? longNames[value] : shortNames[value]) }; var output = ""; var literal = false; if (date) { for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) == "'" && !lookAhead("'")) { literal = false } else { output += format.charAt(iFormat) } } else { switch (format.charAt(iFormat)) { case "d": output += formatNumber("d", date.getDate(), 2); break; case "D": output += formatName("D", date.getDay(), dayNamesShort, dayNames); break; case "o": var doy = date.getDate(); for (var m = date.getMonth() - 1; m >= 0; m--) { doy += this._getDaysInMonth(date.getFullYear(), m) } output += formatNumber("o", doy, 3); break; case "m": output += formatNumber("m", date.getMonth() + 1, 2); break; case "M": output += formatName("M", date.getMonth(), monthNamesShort, monthNames); break; case "y": output += (lookAhead("y") ? date.getFullYear() : (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); break; case "@": output += date.getTime(); break; case "'": if (lookAhead("'")) { output += "'" } else { literal = true } break; default: output += format.charAt(iFormat) } } } } return output }, _possibleChars: function (format) { var chars = ""; var literal = false; for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) == "'" && !lookAhead("'")) { literal = false } else { chars += format.charAt(iFormat) } } else { switch (format.charAt(iFormat)) { case "d": case "m": case "y": case "@": chars += "0123456789"; break; case "D": case "M": return null; case "'": if (lookAhead("'")) { chars += "'" } else { literal = true } break; default: chars += format.charAt(iFormat) } } } return chars }, _get: function (inst, name) { return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name] }, _setDateFromField: function (inst) { var dateFormat = this._get(inst, "dateFormat"); var dates = inst.input ? inst.input.val() : null; inst.endDay = inst.endMonth = inst.endYear = null; var date = defaultDate = this._getDefaultDate(inst); var settings = this._getFormatConfig(inst); try { date = this.parseDate(dateFormat, dates, settings) || defaultDate } catch (event) { this.log(event); date = defaultDate } inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); inst.currentDay = (dates ? date.getDate() : 0); inst.currentMonth = (dates ? date.getMonth() : 0); inst.currentYear = (dates ? date.getFullYear() : 0); this._adjustInstDate(inst) }, _getDefaultDate: function (inst) { var date = this._determineDate(this._get(inst, "defaultDate"), new Date()); var minDate = this._getMinMaxDate(inst, "min", true); var maxDate = this._getMinMaxDate(inst, "max"); date = (minDate && date < minDate ? minDate : date); date = (maxDate && date > maxDate ? maxDate : date); return date }, _determineDate: function (date, defaultDate) { var offsetNumeric = function (offset) { var date = new Date(); date.setDate(date.getDate() + offset); return date }; var offsetString = function (offset, getDaysInMonth) { var date = new Date(); var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; var matches = pattern.exec(offset); while (matches) { switch (matches[2] || "d") { case "d": case "D": day += parseInt(matches[1], 10); break; case "w": case "W": day += parseInt(matches[1], 10) * 7; break; case "m": case "M": month += parseInt(matches[1], 10); day = Math.min(day, getDaysInMonth(year, month)); break; case "y": case "Y": year += parseInt(matches[1], 10); day = Math.min(day, getDaysInMonth(year, month)); break } matches = pattern.exec(offset) } return new Date(year, month, day) }; date = (date == null ? defaultDate : (typeof date == "string" ? offsetString(date, this._getDaysInMonth) : (typeof date == "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); date = (date && date.toString() == "Invalid Date" ? defaultDate : date); if (date) { date.setHours(0); date.setMinutes(0); date.setSeconds(0); date.setMilliseconds(0) } return this._daylightSavingAdjust(date) }, _daylightSavingAdjust: function (date) { if (!date) { return null } date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date }, _setDate: function (inst, date, endDate) { var clear = !(date); var origMonth = inst.selectedMonth; var origYear = inst.selectedYear; date = this._determineDate(date, new Date()); inst.selectedDay = inst.currentDay = date.getDate(); inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); if (origMonth != inst.selectedMonth || origYear != inst.selectedYear) { this._notifyChange(inst) } this._adjustInstDate(inst); if (inst.input) { inst.input.val(clear ? "" : this._formatDate(inst)) } }, _getDate: function (inst) { var startDate = (!inst.currentYear || (inst.input && inst.input.val() == "") ? null : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); return startDate }, _generateHTML: function (inst) { var today = new Date(); today = this._daylightSavingAdjust(new Date(today.getFullYear(), today.getMonth(), today.getDate())); var isRTL = this._get(inst, "isRTL"); var showButtonPanel = this._get(inst, "showButtonPanel"); var hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"); var navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"); var numMonths = this._getNumberOfMonths(inst); var showCurrentAtPos = this._get(inst, "showCurrentAtPos"); var stepMonths = this._get(inst, "stepMonths"); var stepBigMonths = this._get(inst, "stepBigMonths"); var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); var minDate = this._getMinMaxDate(inst, "min", true); var maxDate = this._getMinMaxDate(inst, "max"); var drawMonth = inst.drawMonth - showCurrentAtPos; var drawYear = inst.drawYear; if (drawMonth < 0) { drawMonth += 12; drawYear-- } if (maxDate) { var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate())); maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { drawMonth--; if (drawMonth < 0) { drawMonth = 11; drawYear-- } } } inst.drawMonth = drawMonth; inst.drawYear = drawYear; var prevText = this._get(inst, "prevText"); prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + "', -" + stepMonths + ", 'M');\" title=\"" + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? "e" : "w") + '">' + prevText + "</span></a>" : (hideIfNoPrevNext ? "" : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? "e" : "w") + '">' + prevText + "</span></a>")); var nextText = this._get(inst, "nextText"); nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + "', +" + stepMonths + ", 'M');\" title=\"" + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? "w" : "e") + '">' + nextText + "</span></a>" : (hideIfNoPrevNext ? "" : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? "w" : "e") + '">' + nextText + "</span></a>")); var currentText = this._get(inst, "currentText"); var gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, "closeText") + "</button>" : ""); var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : "") + (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + "');\">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; var firstDay = parseInt(this._get(inst, "firstDay"), 10); firstDay = (isNaN(firstDay) ? 0 : firstDay); var dayNames = this._get(inst, "dayNames"); var dayNamesShort = this._get(inst, "dayNamesShort"); var dayNamesMin = this._get(inst, "dayNamesMin"); var monthNames = this._get(inst, "monthNames"); var monthNamesShort = this._get(inst, "monthNamesShort"); var beforeShowDay = this._get(inst, "beforeShowDay"); var showOtherMonths = this._get(inst, "showOtherMonths"); var calculateWeek = this._get(inst, "calculateWeek") || this.iso8601Week; var endDate = inst.endDay ? this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate; var defaultDate = this._getDefaultDate(inst); var html = ""; for (var row = 0; row < numMonths[0]; row++) { var group = ""; for (var col = 0; col < numMonths[1]; col++) { var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); var cornerClass = " ui-corner-all"; var calender = ""; if (isMultiMonth) { calender += '<div class="ui-datepicker-group ui-datepicker-group-'; switch (col) { case 0: calender += "first"; cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; case numMonths[1] - 1: calender += "last"; cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; default: calender += "middle"; cornerClass = ""; break } calender += '">' } calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : "") + (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : "") + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + '</div><table class="ui-datepicker-calendar"><thead><tr>'; var thead = ""; for (var dow = 0; dow < 7; dow++) { var day = (dow + firstDay) % 7; thead += "<th" + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : "") + '><span title="' + dayNames[day] + '">' + dayNamesMin[day] + "</span></th>" } calender += thead + "</tr></thead><tbody>"; var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) { inst.selectedDay = Math.min(inst.selectedDay, daysInMonth) } var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (var dRow = 0; dRow < numRows; dRow++) { calender += "<tr>"; var tbody = ""; for (var dow = 0; dow < 7; dow++) { var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); var otherMonth = (printDate.getMonth() != drawMonth); var unselectable = otherMonth || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate); tbody += '<td class="' + ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + (otherMonth ? " ui-datepicker-other-month" : "") + ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? " " + this._dayOverClass : "") + (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? " " + this._currentClass : "") + (printDate.getTime() == today.getTime() ? " ui-datepicker-today" : "")) + '"' + ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : "") + (unselectable ? "" : " onclick=\"DP_jQuery.datepicker._selectDay('#" + inst.id + "'," + drawMonth + "," + drawYear + ', this);return false;"') + ">" + (otherMonth ? (showOtherMonths ? printDate.getDate() : "&#xa0;") : (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + "</span>" : '<a class="ui-state-default' + (printDate.getTime() == today.getTime() ? " ui-state-highlight" : "") + (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? " ui-state-active" : "") + '" href="#">' + printDate.getDate() + "</a>")) + "</td>"; printDate.setDate(printDate.getDate() + 1); printDate = this._daylightSavingAdjust(printDate) } calender += tbody + "</tr>" } drawMonth++; if (drawMonth > 11) { drawMonth = 0; drawYear++ } calender += "</tbody></table>" + (isMultiMonth ? "</div>" + ((numMonths[0] > 0 && col == numMonths[1] - 1) ? '<div class="ui-datepicker-row-break"></div>' : "") : ""); group += calender } html += group } html += buttonPanel + ($.browser.msie && parseInt($.browser.version, 10) < 7 && !inst.inline ? '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ""); inst._keyEvent = false; return html }, _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, selectedDate, secondary, monthNames, monthNamesShort) { minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate); var changeMonth = this._get(inst, "changeMonth"); var changeYear = this._get(inst, "changeYear"); var showMonthAfterYear = this._get(inst, "showMonthAfterYear"); var html = '<div class="ui-datepicker-title">'; var monthHtml = ""; if (secondary || !changeMonth) { monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + "</span> " } else { var inMinYear = (minDate && minDate.getFullYear() == drawYear); var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); monthHtml += '<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + "', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#" + inst.id + "');\">"; for (var month = 0; month < 12; month++) { if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { monthHtml += '<option value="' + month + '"' + (month == drawMonth ? ' selected="selected"' : "") + ">" + monthNamesShort[month] + "</option>" } } monthHtml += "</select>" } if (!showMonthAfterYear) { html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? "&#xa0;" : "") } if (secondary || !changeYear) { html += '<span class="ui-datepicker-year">' + drawYear + "</span>" } else { var years = this._get(inst, "yearRange").split(":"); var year = 0; var endYear = 0; if (years.length != 2) { year = drawYear - 10; endYear = drawYear + 10 } else { if (years[0].charAt(0) == "+" || years[0].charAt(0) == "-") { year = drawYear + parseInt(years[0], 10); endYear = drawYear + parseInt(years[1], 10) } else { year = parseInt(years[0], 10); endYear = parseInt(years[1], 10) } } year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); html += '<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + "', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#" + inst.id + "');\">"; for (; year <= endYear; year++) { html += '<option value="' + year + '"' + (year == drawYear ? ' selected="selected"' : "") + ">" + year + "</option>" } html += "</select>" } if (showMonthAfterYear) { html += (secondary || changeMonth || changeYear ? "&#xa0;" : "") + monthHtml } html += "</div>"; return html }, _adjustInstDate: function (inst, offset, period) { var year = inst.drawYear + (period == "Y" ? offset : 0); var month = inst.drawMonth + (period == "M" ? offset : 0); var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period == "D" ? offset : 0); var date = this._daylightSavingAdjust(new Date(year, month, day)); var minDate = this._getMinMaxDate(inst, "min", true); var maxDate = this._getMinMaxDate(inst, "max"); date = (minDate && date < minDate ? minDate : date); date = (maxDate && date > maxDate ? maxDate : date); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); if (period == "M" || period == "Y") { this._notifyChange(inst) } }, _notifyChange: function (inst) { var onChange = this._get(inst, "onChangeMonthYear"); if (onChange) { onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]) } }, _getNumberOfMonths: function (inst) { var numMonths = this._get(inst, "numberOfMonths"); return (numMonths == null ? [1, 1] : (typeof numMonths == "number" ? [1, numMonths] : numMonths)) }, _getMinMaxDate: function (inst, minMax, checkRange) { var date = this._determineDate(this._get(inst, minMax + "Date"), null); return (!checkRange || !inst.rangeStart ? date : (!date || inst.rangeStart > date ? inst.rangeStart : date)) }, _getDaysInMonth: function (year, month) { return 32 - new Date(year, month, 32).getDate() }, _getFirstDayOfMonth: function (year, month) { return new Date(year, month, 1).getDay() }, _canAdjustMonth: function (inst, offset, curYear, curMonth) { var numMonths = this._getNumberOfMonths(inst); var date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1)); if (offset < 0) { date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())) } return this._isInRange(inst, date) }, _isInRange: function (inst, date) { var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay))); newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate); var minDate = newMinDate || this._getMinMaxDate(inst, "min"); var maxDate = this._getMinMaxDate(inst, "max"); return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)) }, _getFormatConfig: function (inst) { var shortYearCutoff = this._get(inst, "shortYearCutoff"); shortYearCutoff = (typeof shortYearCutoff != "string" ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); return { shortYearCutoff: shortYearCutoff, dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")} }, _formatDate: function (inst, day, month, year) { if (!day) { inst.currentDay = inst.selectedDay; inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear } var date = (day ? (typeof day == "object" ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)) } }); function extendRemove(target, props) { $.extend(target, props); for (var name in props) { if (props[name] == null || props[name] == undefined) { target[name] = props[name] } } return target } function isArray(a) { return (a && (($.browser.safari && typeof a == "object" && a.length) || (a.constructor && a.constructor.toString().match(/\Array\(\)/)))) } $.fn.datepicker = function (options) { if (!$.datepicker.initialized) { $(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv); $.datepicker.initialized = true } var otherArgs = Array.prototype.slice.call(arguments, 1); if (typeof options == "string" && (options == "isDisabled" || options == "getDate")) { return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs)) } if (options == "option" && arguments.length == 2 && typeof arguments[1] == "string") { return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs)) } return this.each(function () { typeof options == "string" ? $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options) }) }; $.datepicker = new Datepicker(); $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); $.datepicker.version = "1.7.2"; window.DP_jQuery = $ })(jQuery); ;

/**
* --------------------------------------------------------------------
* jQuery-Plugin "pngFix"
* Version: 1.1, 11.09.2007
* by Andreas Eberhard, andreas.eberhard@gmail.com
*                      http://jquery.andreaseberhard.de/
*
* Copyright (c) 2007 Andreas Eberhard
* Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
*/
eval(function (p, a, c, k, e, r) { e = function (c) { return (c < 62 ? '' : e(parseInt(c / 62))) + ((c = c % 62) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if ('0'.replace(0, e) == 0) { while (c--) r[e(c)] = k[c]; k = [function (e) { return r[e] || e } ]; e = function () { return '([237-9n-zA-Z]|1\\w)' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);', [], 68, '||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|crop|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'), 0, {}));
/*
* jQuery UI Dialog 1.7.2
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
* http://docs.jquery.com/UI/Dialog
* Depends:
*	ui.core.js
*	ui.draggable.js
*	ui.resizable.js
*/
(function ($) {

	var setDataSwitch = {
		dragStart: "start.draggable",
		drag: "drag.draggable",
		dragStop: "stop.draggable",
		maxHeight: "maxHeight.resizable",
		minHeight: "minHeight.resizable",
		maxWidth: "maxWidth.resizable",
		minWidth: "minWidth.resizable",
		resizeStart: "start.resizable",
		resize: "drag.resizable",
		resizeStop: "stop.resizable"
	},

	uiDialogClasses =
		'ui-dialog ' +
		'ui-widget ' +
		'ui-widget-content ' +
		'ui-corner-all ';

	$.widget("ui.dialog", {

		_init: function () {
			this.originalTitle = this.element.attr('title');

			var self = this,
			options = this.options,

			title = options.title || this.originalTitle || '&nbsp;',
			titleId = $.ui.dialog.getTitleId(this.element),

			uiDialog = (this.uiDialog = $('<div/>'))
				.appendTo(document.body)
				.hide()
				.addClass(uiDialogClasses + options.dialogClass)
				.css({
					position: 'absolute',
					overflow: 'hidden',
					zIndex: options.zIndex
				})
			// setting tabIndex makes the div focusable
			// setting outline to 0 prevents a border on focus in Mozilla
				.attr('tabIndex', -1).css('outline', 0).keydown(function (event) {
					(options.closeOnEscape && event.keyCode
						&& event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
				})
				.attr({
					role: 'dialog',
					'aria-labelledby': titleId
				})
				.mousedown(function (event) {
					self.moveToTop(false, event);
				}),

			uiDialogContent = this.element
				.show()
				.removeAttr('title')
				.addClass(
					'ui-dialog-content ' +
					'ui-widget-content')
				.appendTo(uiDialog),

			uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
				.addClass(
					'ui-dialog-titlebar ' +
					'ui-widget-header ' +
					'ui-corner-all ' +
					'ui-helper-clearfix'
				)
				.prependTo(uiDialog),

			uiDialogTitlebarClose = $('<a href="#"/>')
				.addClass(
					'ui-dialog-titlebar-close ' +
					'ui-corner-all'
				)
				.attr('role', 'button')
				.hover(
					function () {
						uiDialogTitlebarClose.addClass('ui-state-hover');
					},
					function () {
						uiDialogTitlebarClose.removeClass('ui-state-hover');
					}
				)
				.focus(function () {
					uiDialogTitlebarClose.addClass('ui-state-focus');
				})
				.blur(function () {
					uiDialogTitlebarClose.removeClass('ui-state-focus');
				})
				.mousedown(function (ev) {
					ev.stopPropagation();
					ev.preventDefault();
				})
				.click(function (event) {
					self.close(event);
					return false;
				})
				.appendTo(uiDialogTitlebar),

			uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
				.addClass(
					'ui-icon ' +
					'ui-icon-closethick'
				)
				.text(options.closeText)
				.appendTo(uiDialogTitlebarClose),

			uiDialogTitle = $('<span/>')
				.addClass('ui-dialog-title')
				.attr('id', titleId)
				.html(title)
				.prependTo(uiDialogTitlebar);

			uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();

			(options.draggable && $.fn.draggable && this._makeDraggable());
			(options.resizable && $.fn.resizable && this._makeResizable());

			this._createButtons(options.buttons);
			this._isOpen = false;

			(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
			(options.autoOpen && this.open());

		},

		destroy: function () {
			(this.overlay && this.overlay.destroy());
			this.uiDialog.hide();
			this.element
			.unbind('.dialog')
			.removeData('dialog')
			.removeClass('ui-dialog-content ui-widget-content')
			.hide().appendTo('body');
			this.uiDialog.remove();

			(this.originalTitle && this.element.attr('title', this.originalTitle));
		},

		close: function (event) {
			var self = this;

			if (false === self._trigger('beforeclose', event)) {
				return;
			}

			(self.overlay && self.overlay.destroy());
			self.uiDialog.unbind('keypress.ui-dialog');

			(self.options.hide
			? self.uiDialog.hide(self.options.hide, function () {
				self._trigger('close', event);
			})
			: self.uiDialog.hide() && self._trigger('close', event));

			$.ui.dialog.overlay.resize();

			self._isOpen = false;

			// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
			if (self.options.modal) {
				var maxZ = 0;
				$('.ui-dialog').each(function () {
					if (this != self.uiDialog[0]) {
						maxZ = Math.max(maxZ, $(this).css('z-index'));
					}
				});
				$.ui.dialog.maxZ = maxZ;
			}
		},

		isOpen: function () {
			return this._isOpen;
		},

		// the force parameter allows us to move modal dialogs to their correct
		// position on open
		moveToTop: function (force, event) {

			if ((this.options.modal && !force)
			|| (!this.options.stack && !this.options.modal)) {
				return this._trigger('focus', event);
			}

			if (this.options.zIndex > $.ui.dialog.maxZ) {
				$.ui.dialog.maxZ = this.options.zIndex;
			}
			(this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ));

			//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
			//  http://ui.jquery.com/bugs/ticket/3193
			var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
			this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
			this.element.attr(saveScroll);
			this._trigger('focus', event);
		},

		open: function () {
			if (this._isOpen) { return; }

			var options = this.options,
			uiDialog = this.uiDialog;

			this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null;
			(uiDialog.next().length && uiDialog.appendTo('body'));
			this._size();
			this._position(options.position);
			uiDialog.show(options.show);
			this.moveToTop(true);

			// prevent tabbing out of modal dialogs
			(options.modal && uiDialog.bind('keypress.ui-dialog', function (event) {
				if (event.keyCode != $.ui.keyCode.TAB) {
					return;
				}

				var tabbables = $(':tabbable', this),
				first = tabbables.filter(':first')[0],
				last = tabbables.filter(':last')[0];

				if (event.target == last && !event.shiftKey) {
					setTimeout(function () {
						first.focus();
					}, 1);
				} else if (event.target == first && event.shiftKey) {
					setTimeout(function () {
						last.focus();
					}, 1);
				}
			}));

			// set focus to the first tabbable element in the content area or the first button
			// if there are no tabbable elements, set focus on the dialog itself
			$([])
			.add(uiDialog.find('.ui-dialog-content :tabbable:first'))
			.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
			.add(uiDialog)
			.filter(':first')
			.focus();

			this._trigger('open');
			this._isOpen = true;
		},

		_createButtons: function (buttons) {
			var self = this,
			hasButtons = false,
			uiDialogButtonPane = $('<div></div>')
				.addClass(
					'ui-dialog-buttonpane ' +
					'ui-widget-content ' +
					'ui-helper-clearfix'
				);

			// if we already have a button pane, remove it
			this.uiDialog.find('.ui-dialog-buttonpane').remove();

			(typeof buttons == 'object' && buttons !== null &&
			$.each(buttons, function () { return !(hasButtons = true); }));
			if (hasButtons) {
				$.each(buttons, function (name, fn) {
					$('<button type="button"></button>')
					.addClass(
						'ui-state-default ' +
						'ui-corner-all'
					)
					.text(name)
					.click(function () { fn.apply(self.element[0], arguments); })
					.hover(
						function () {
							$(this).addClass('ui-state-hover');
						},
						function () {
							$(this).removeClass('ui-state-hover');
						}
					)
					.focus(function () {
						$(this).addClass('ui-state-focus');
					})
					.blur(function () {
						$(this).removeClass('ui-state-focus');
					})
					.appendTo(uiDialogButtonPane);
				});
				uiDialogButtonPane.appendTo(this.uiDialog);
			}
		},

		_makeDraggable: function () {
			var self = this,
			options = this.options,
			heightBeforeDrag;

			this.uiDialog.draggable({
				cancel: '.ui-dialog-content',
				handle: '.ui-dialog-titlebar',
				containment: 'document',
				start: function () {
					heightBeforeDrag = options.height;
					$(this).height($(this).height()).addClass("ui-dialog-dragging");
					(options.dragStart && options.dragStart.apply(self.element[0], arguments));
				},
				drag: function () {
					(options.drag && options.drag.apply(self.element[0], arguments));
				},
				stop: function () {
					$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
					(options.dragStop && options.dragStop.apply(self.element[0], arguments));
					$.ui.dialog.overlay.resize();
				}
			});
		},

		_makeResizable: function (handles) {
			handles = (handles === undefined ? this.options.resizable : handles);
			var self = this,
			options = this.options,
			resizeHandles = typeof handles == 'string'
				? handles
				: 'n,e,s,w,se,sw,ne,nw';

			this.uiDialog.resizable({
				cancel: '.ui-dialog-content',
				alsoResize: this.element,
				maxWidth: options.maxWidth,
				maxHeight: options.maxHeight,
				minWidth: options.minWidth,
				minHeight: options.minHeight,
				start: function () {
					$(this).addClass("ui-dialog-resizing");
					(options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
				},
				resize: function () {
					(options.resize && options.resize.apply(self.element[0], arguments));
				},
				handles: resizeHandles,
				stop: function () {
					$(this).removeClass("ui-dialog-resizing");
					options.height = $(this).height();
					options.width = $(this).width();
					(options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
					$.ui.dialog.overlay.resize();
				}
			})
		.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
		},

		_position: function (pos) {
			var wnd = $(window), doc = $(document),
			pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
			minTop = pTop;

			if ($.inArray(pos, ['center', 'top', 'right', 'bottom', 'left']) >= 0) {
				pos = [
				pos == 'right' || pos == 'left' ? pos : 'center',
				pos == 'top' || pos == 'bottom' ? pos : 'middle'
			];
			}
			if (pos.constructor != Array) {
				pos = ['center', 'middle'];
			}
			if (pos[0].constructor == Number) {
				pLeft += pos[0];
			} else {
				switch (pos[0]) {
					case 'left':
						pLeft += 0;
						break;
					case 'right':
						pLeft += wnd.width() - this.uiDialog.outerWidth();
						break;
					default:
					case 'center':
						pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
				}
			}
			if (pos[1].constructor == Number) {
				pTop += pos[1];
			} else {
				switch (pos[1]) {
					case 'top':
						pTop += 0;
						break;
					case 'bottom':
						pTop += wnd.height() - this.uiDialog.outerHeight();
						break;
					default:
					case 'middle':
						pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2;
				}
			}

			// prevent the dialog from being too high (make sure the titlebar
			// is accessible)
			pTop = Math.max(pTop, minTop);
			this.uiDialog.css({ top: pTop, left: pLeft });
		},

		_setData: function (key, value) {
			(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
			switch (key) {
				case "buttons":
					this._createButtons(value);
					break;
				case "closeText":
					this.uiDialogTitlebarCloseText.text(value);
					break;
				case "dialogClass":
					this.uiDialog
					.removeClass(this.options.dialogClass)
					.addClass(uiDialogClasses + value);
					break;
				case "draggable":
					(value
					? this._makeDraggable()
					: this.uiDialog.draggable('destroy'));
					break;
				case "height":
					this.uiDialog.height(value);
					break;
				case "position":
					this._position(value);
					break;
				case "resizable":
					var uiDialog = this.uiDialog,
					isResizable = this.uiDialog.is(':data(resizable)');

					// currently resizable, becoming non-resizable
					(isResizable && !value && uiDialog.resizable('destroy'));

					// currently resizable, changing handles
					(isResizable && typeof value == 'string' &&
					uiDialog.resizable('option', 'handles', value));

					// currently non-resizable, becoming resizable
					(isResizable || this._makeResizable(value));
					break;
				case "title":
					$(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
					break;
				case "width":
					this.uiDialog.width(value);
					break;
			}

			$.widget.prototype._setData.apply(this, arguments);
		},

		_size: function () {
			/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
			* divs will both have width and height set, so we need to reset them
			*/
			var options = this.options;

			// reset content sizing
			this.element.css({
				height: 0,
				minHeight: 0,
				width: 'auto'
			});

			// reset wrapper sizing
			// determine the height of all the non-content elements
			var nonContentHeight = this.uiDialog.css({
				height: 'auto',
				width: options.width
			})
			.height();

			this.element
			.css({
				minHeight: Math.max(options.minHeight - nonContentHeight, 0),
				height: options.height == 'auto'
					? 'auto'
					: Math.max(options.height - nonContentHeight, 0)
			});
		}
	});

	$.extend($.ui.dialog, {
		version: "1.7.2",
		defaults: {
			autoOpen: true,
			bgiframe: false,
			buttons: {},
			closeOnEscape: true,
			closeText: 'close',
			dialogClass: '',
			draggable: true,
			hide: null,
			height: 'auto',
			maxHeight: false,
			maxWidth: false,
			minHeight: 150,
			minWidth: 150,
			modal: false,
			position: 'center',
			resizable: true,
			show: null,
			stack: true,
			title: '',
			width: 300,
			zIndex: 1000
		},

		getter: 'isOpen',

		uuid: 0,
		maxZ: 0,

		getTitleId: function ($el) {
			return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
		},

		overlay: function (dialog) {
			this.$el = $.ui.dialog.overlay.create(dialog);
		}
	});

	$.extend($.ui.dialog.overlay, {
		instances: [],
		maxZ: 0,
		events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
		function (event) { return event + '.dialog-overlay'; }).join(' '),
		create: function (dialog) {
			if (this.instances.length === 0) {
				// prevent use of anchors and inputs
				// we use a setTimeout in case the overlay is created from an
				// event that we're going to be cancelling (see #2804)
				setTimeout(function () {
					// handle $(el).dialog().dialog('close') (see #4065)
					if ($.ui.dialog.overlay.instances.length) {
						$(document).bind($.ui.dialog.overlay.events, function (event) {
							var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0;
							return (dialogZ > $.ui.dialog.overlay.maxZ);
						});
					}
				}, 1);

				// allow closing by pressing the escape key
				$(document).bind('keydown.dialog-overlay', function (event) {
					(dialog.options.closeOnEscape && event.keyCode
						&& event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
				});

				// handle window resize
				$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
			}

			var $el = $('<div></div>').appendTo(document.body)
			.addClass('ui-widget-overlay').css({
				width: this.width(),
				height: this.height()
			});

			(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());

			this.instances.push($el);
			return $el;
		},

		destroy: function ($el) {
			this.instances.splice($.inArray(this.instances, $el), 1);

			if (this.instances.length === 0) {
				$([document, window]).unbind('.dialog-overlay');
			}

			$el.remove();

			// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
			var maxZ = 0;
			$.each(this.instances, function () {
				maxZ = Math.max(maxZ, this.css('z-index'));
			});
			this.maxZ = maxZ;
		},

		height: function () {
			// handle IE 6
			if ($.browser.msie && $.browser.version < 7) {
				var scrollHeight = Math.max(
				document.documentElement.scrollHeight,
				document.body.scrollHeight
			);
				var offsetHeight = Math.max(
				document.documentElement.offsetHeight,
				document.body.offsetHeight
			);

				if (scrollHeight < offsetHeight) {
					return $(window).height() + 'px';
				} else {
					return scrollHeight + 'px';
				}
				// handle "good" browsers
			} else {
				return $(document).height() + 'px';
			}
		},

		width: function () {
			// handle IE 6
			if ($.browser.msie && $.browser.version < 7) {
				var scrollWidth = Math.max(
				document.documentElement.scrollWidth,
				document.body.scrollWidth
			);
				var offsetWidth = Math.max(
				document.documentElement.offsetWidth,
				document.body.offsetWidth
			);

				if (scrollWidth < offsetWidth) {
					return $(window).width() + 'px';
				} else {
					return scrollWidth + 'px';
				}
				// handle "good" browsers
			} else {
				return $(document).width() + 'px';
			}
		},

		resize: function () {
			/* If the dialog is draggable and the user drags it past the
			* right edge of the window, the document becomes wider so we
			* need to stretch the overlay. If the user then drags the
			* dialog back to the left, the document will become narrower,
			* so we need to shrink the overlay to the appropriate size.
			* This is handled by shrinking the overlay before setting it
			* to the full document size.
			*/
			var $overlays = $([]);
			$.each($.ui.dialog.overlay.instances, function () {
				$overlays = $overlays.add(this);
			});

			$overlays.css({
				width: 0,
				height: 0
			}).css({
				width: $.ui.dialog.overlay.width(),
				height: $.ui.dialog.overlay.height()
			});
		}
	});

	$.extend($.ui.dialog.overlay.prototype, {
		destroy: function () {
			$.ui.dialog.overlay.destroy(this.$el);
		}
	});

})(jQuery);

/*
* jQuery UI Accordion 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Accordion
*
* Depends:
*	ui.core.js
*/
(function ($) {

	$.widget("ui.accordion", {

		_init: function () {

			var o = this.options, self = this;
			this.running = 0;

			// if the user set the alwaysOpen option on init
			// then we need to set the collapsible option
			// if they set both on init, collapsible will take priority
			if (o.collapsible == $.ui.accordion.defaults.collapsible &&
			o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
				o.collapsible = !o.alwaysOpen;
			}

			if (o.navigation) {
				var current = this.element.find("a").filter(o.navigationFilter);
				if (current.length) {
					if (current.filter(o.header).length) {
						this.active = current;
					} else {
						this.active = current.parent().parent().prev();
						current.addClass("ui-accordion-content-active");
					}
				}
			}

			this.element.addClass("ui-accordion ui-widget ui-helper-reset");

			// in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
			if (this.element[0].nodeName == "UL") {
				this.element.children("li").addClass("ui-accordion-li-fix");
			}

			this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
			.bind("mouseenter.accordion", function () { $(this).addClass('ui-state-hover'); })
			.bind("mouseleave.accordion", function () { $(this).removeClass('ui-state-hover'); })
			.bind("focus.accordion", function () { $(this).addClass('ui-state-focus'); })
			.bind("blur.accordion", function () { $(this).removeClass('ui-state-focus'); });

			this.headers
			.next()
				.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");

			this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
			this.active.next().addClass('ui-accordion-content-active');

			//Append icon elements
			$("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
			this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);

			// IE7-/Win - Extra vertical space in lists fixed
			if ($.browser.msie) {
				this.element.find('a').css('zoom', '1');
			}

			this.resize();

			//ARIA
			this.element.attr('role', 'tablist');

			this.headers
			.attr('role', 'tab')
			.bind('keydown', function (event) { return self._keydown(event); })
			.next()
			.attr('role', 'tabpanel');

			this.headers
			.not(this.active || "")
			.attr('aria-expanded', 'false')
			.attr("tabIndex", "-1")
			.next()
			.hide();

			// make sure at least one header is in the tab order
			if (!this.active.length) {
				this.headers.eq(0).attr('tabIndex', '0');
			} else {
				this.active
				.attr('aria-expanded', 'true')
				.attr('tabIndex', '0');
			}

			// only need links in taborder for Safari
			if (!$.browser.safari)
				this.headers.find('a').attr('tabIndex', '-1');

			if (o.event) {
				this.headers.bind((o.event) + ".accordion", function (event) { return self._clickHandler.call(self, event, this); });
			}

		},

		destroy: function () {
			var o = this.options;

			this.element
			.removeClass("ui-accordion ui-widget ui-helper-reset")
			.removeAttr("role")
			.unbind('.accordion')
			.removeData('accordion');

			this.headers
			.unbind(".accordion")
			.removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
			.removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");

			this.headers.find("a").removeAttr("tabindex");
			this.headers.children(".ui-icon").remove();
			var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
			if (o.autoHeight || o.fillHeight) {
				contents.css("height", "");
			}
		},

		_setData: function (key, value) {
			if (key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
			$.widget.prototype._setData.apply(this, arguments);
		},

		_keydown: function (event) {

			var o = this.options, keyCode = $.ui.keyCode;

			if (o.disabled || event.altKey || event.ctrlKey)
				return;

			var length = this.headers.length;
			var currentIndex = this.headers.index(event.target);
			var toFocus = false;

			switch (event.keyCode) {
				case keyCode.RIGHT:
				case keyCode.DOWN:
					toFocus = this.headers[(currentIndex + 1) % length];
					break;
				case keyCode.LEFT:
				case keyCode.UP:
					toFocus = this.headers[(currentIndex - 1 + length) % length];
					break;
				case keyCode.SPACE:
				case keyCode.ENTER:
					return this._clickHandler({ target: event.target }, event.target);
			}

			if (toFocus) {
				$(event.target).attr('tabIndex', '-1');
				$(toFocus).attr('tabIndex', '0');
				toFocus.focus();
				return false;
			}

			return true;
		},

		resize: function () {

			var o = this.options, maxHeight;

			if (o.fillSpace) {

				if ($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
				maxHeight = this.element.parent().height();
				if ($.browser.msie) { this.element.parent().css('overflow', defOverflow); }

				this.headers.each(function () {
					maxHeight -= $(this).outerHeight();
				});

				var maxPadding = 0;
				this.headers.next().each(function () {
					maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
				}).height(Math.max(0, maxHeight - maxPadding))
			.css('overflow', 'auto');

			} else if (o.autoHeight) {
				maxHeight = 0;
				this.headers.next().each(function () {
					maxHeight = Math.max(maxHeight, $(this).outerHeight());
				}).height(maxHeight);
			}
		},

		activate: function (index) {
			// call clickHandler with custom event
			var active = this._findActive(index)[0];
			this._clickHandler({ target: active }, active);
		},

		_findActive: function (selector) {
			return selector
			? typeof selector == "number"
				? this.headers.filter(":eq(" + selector + ")")
				: this.headers.not(this.headers.not(selector))
			: selector === false
				? $([])
				: this.headers.filter(":eq(0)");
		},

		_clickHandler: function (event, target) {

			var o = this.options;
			if (o.disabled) return false;

			// called only when using activate(false) to close all parts programmatically
			if (!event.target && o.collapsible) {
				this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
				.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
				this.active.next().addClass('ui-accordion-content-active');
				var toHide = this.active.next(),
				data = {
					options: o,
					newHeader: $([]),
					oldHeader: o.active,
					newContent: $([]),
					oldContent: toHide
				},
				toShow = (this.active = $([]));
				this._toggle(toShow, toHide, data);
				return false;
			}

			// get the click target
			var clicked = $(event.currentTarget || target);
			var clickedIsActive = clicked[0] == this.active[0];

			// if animations are still active, or the active header is the target, ignore click
			if (this.running || (!o.collapsible && clickedIsActive)) {
				return false;
			}

			// switch classes
			this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
			.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
			this.active.next().addClass('ui-accordion-content-active');
			if (!clickedIsActive) {
				clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
				.find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
				clicked.next().addClass('ui-accordion-content-active');
			}

			// find elements to show and hide
			var toShow = clicked.next(),
			toHide = this.active.next(),
			data = {
				options: o,
				newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
				oldHeader: this.active,
				newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
				oldContent: toHide.find('> *')
			},
			down = this.headers.index(this.active[0]) > this.headers.index(clicked[0]);

			this.active = clickedIsActive ? $([]) : clicked;
			this._toggle(toShow, toHide, data, clickedIsActive, down);

			return false;

		},

		_toggle: function (toShow, toHide, data, clickedIsActive, down) {

			var o = this.options, self = this;

			this.toShow = toShow;
			this.toHide = toHide;
			this.data = data;

			var complete = function () { if (!self) return; return self._completed.apply(self, arguments); };

			// trigger changestart event
			this._trigger("changestart", null, this.data);

			// count elements to animate
			this.running = toHide.size() === 0 ? toShow.size() : toHide.size();

			if (o.animated) {

				var animOptions = {};

				if (o.collapsible && clickedIsActive) {
					animOptions = {
						toShow: $([]),
						toHide: toHide,
						complete: complete,
						down: down,
						autoHeight: o.autoHeight || o.fillSpace
					};
				} else {
					animOptions = {
						toShow: toShow,
						toHide: toHide,
						complete: complete,
						down: down,
						autoHeight: o.autoHeight || o.fillSpace
					};
				}

				if (!o.proxied) {
					o.proxied = o.animated;
				}

				if (!o.proxiedDuration) {
					o.proxiedDuration = o.duration;
				}

				o.animated = $.isFunction(o.proxied) ?
				o.proxied(animOptions) : o.proxied;

				o.duration = $.isFunction(o.proxiedDuration) ?
				o.proxiedDuration(animOptions) : o.proxiedDuration;

				var animations = $.ui.accordion.animations,
				duration = o.duration,
				easing = o.animated;

				if (!animations[easing]) {
					animations[easing] = function (options) {
						this.slide(options, {
							easing: easing,
							duration: duration || 700
						});
					};
				}

				animations[easing](animOptions);

			} else {

				if (o.collapsible && clickedIsActive) {
					toShow.toggle();
				} else {
					toHide.hide();
					toShow.show();
				}

				complete(true);

			}

			toHide.prev().attr('aria-expanded', 'false').attr("tabIndex", "-1").blur();
			toShow.prev().attr('aria-expanded', 'true').attr("tabIndex", "0").focus();

		},

		_completed: function (cancel) {

			var o = this.options;

			this.running = cancel ? 0 : --this.running;
			if (this.running) return;

			if (o.clearStyle) {
				this.toShow.add(this.toHide).css({
					height: "",
					overflow: ""
				});
			}

			this._trigger('change', null, this.data);
		}
	});

	$.extend($.ui.accordion, {
		version: "1.7.2",
		defaults: {
			active: null,
			alwaysOpen: true, //deprecated, use collapsible
			animated: 'slide',
			autoHeight: true,
			clearStyle: false,
			collapsible: false,
			event: "click",
			fillSpace: false,
			header: "> li > :first-child,> :not(li):even",
			icons: {
				header: "ui-icon-triangle-1-e",
				headerSelected: "ui-icon-triangle-1-s"
			},
			navigation: false,
			navigationFilter: function () {
				return this.href.toLowerCase() == location.href.toLowerCase();
			}
		},
		animations: {
			slide: function (options, additions) {
				options = $.extend({
					easing: "swing",
					duration: 300
				}, options, additions);
				if (!options.toHide.size()) {
					options.toShow.animate({ height: "show" }, options);
					return;
				}
				if (!options.toShow.size()) {
					options.toHide.animate({ height: "hide" }, options);
					return;
				}
				var overflow = options.toShow.css('overflow'),
				percentDone,
				showProps = {},
				hideProps = {},
				fxAttrs = ["height", "paddingTop", "paddingBottom"],
				originalWidth;
				// fix width before calculating height of hidden element
				var s = options.toShow;
				originalWidth = s[0].style.width;
				s.width(parseInt(s.parent().width(), 10) - parseInt(s.css("paddingLeft"), 10) - parseInt(s.css("paddingRight"), 10) - (parseInt(s.css("borderLeftWidth"), 10) || 0) - (parseInt(s.css("borderRightWidth"), 10) || 0));

				$.each(fxAttrs, function (i, prop) {
					hideProps[prop] = 'hide';

					var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
					showProps[prop] = {
						value: parts[1],
						unit: parts[2] || 'px'
					};
				});
				options.toShow.css({ height: 0, overflow: 'hidden' }).show();
				options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps, {
					step: function (now, settings) {
						// only calculate the percent when animating height
						// IE gets very inconsistent results when animating elements
						// with small values, which is common for padding
						if (settings.prop == 'height') {
							percentDone = (settings.now - settings.start) / (settings.end - settings.start);
						}

						options.toShow[0].style[settings.prop] =
						(percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
					},
					duration: options.duration,
					easing: options.easing,
					complete: function () {
						if (!options.autoHeight) {
							options.toShow.css("height", "");
						}
						options.toShow.css("width", originalWidth);
						options.toShow.css({ overflow: overflow });
						options.complete();
					}
				});
			},
			bounceslide: function (options) {
				this.slide(options, {
					easing: options.down ? "easeOutBounce" : "swing",
					duration: options.down ? 1000 : 200
				});
			},
			easeslide: function (options) {
				this.slide(options, {
					easing: "easeinout",
					duration: 700
				});
			}
		}
	});
})(jQuery);

/*!
* jquery.qtip. The jQuery tooltip plugin
*
* Copyright (c) 2009 Craig Thompson
* http://craigsworks.com
*
* Licensed under MIT
* http://www.opensource.org/licenses/mit-license.phpG
*
* Launch  : February 2009
* Version : 1.0.0-rc3
* Released: Tuesday 12th May, 2009 - 00:0
* Debug: jquery.qtip.debug.js
*/
(function ($) {
	// Implementation
	$.fn.qtip = function (options, blanket) {
		var i, id, interfaces, opts, obj, command, config, api;

		// Return API / Interfaces if requested
		if (typeof options == 'string') {
			// Make sure API data exists if requested
			if (typeof $(this).data('qtip') !== 'object')
				$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_TOOLTIP_PRESENT, false);

			// Return requested object
			if (options == 'api')
				return $(this).data('qtip').interfaces[$(this).data('qtip').current];
			else if (options == 'interfaces')
				return $(this).data('qtip').interfaces;
		}

		// Validate provided options
		else {
			// Set null options object if no options are provided
			if (!options) options = {};

			// Sanitize option data
			if (typeof options.content !== 'object' || (options.content.jquery && options.content.length > 0)) options.content = { text: options.content };
			if (typeof options.content.title !== 'object') options.content.title = { text: options.content.title };
			if (typeof options.position !== 'object') options.position = { corner: options.position };
			if (typeof options.position.corner !== 'object') options.position.corner = { target: options.position.corner, tooltip: options.position.corner };
			if (typeof options.show !== 'object') options.show = { when: options.show };
			if (typeof options.show.when !== 'object') options.show.when = { event: options.show.when };
			if (typeof options.show.effect !== 'object') options.show.effect = { type: options.show.effect };
			if (typeof options.hide !== 'object') options.hide = { when: options.hide };
			if (typeof options.hide.when !== 'object') options.hide.when = { event: options.hide.when };
			if (typeof options.hide.effect !== 'object') options.hide.effect = { type: options.hide.effect };
			if (typeof options.style !== 'object') options.style = { name: options.style };
			options.style = sanitizeStyle(options.style);

			// Build main options object
			opts = $.extend(true, {}, $.fn.qtip.defaults, options);

			// Inherit all style properties into one syle object and include original options
			opts.style = buildStyle.call({ options: opts }, opts.style);
			opts.user = $.extend(true, {}, options);
		};

		// Iterate each matched element
		return $(this).each(function () // Return original elements as per jQuery guidelines
		{
			// Check for API commands
			if (typeof options == 'string') {
				command = options.toLowerCase();
				interfaces = $(this).qtip('interfaces');

				// Make sure API data exists$('.qtip').qtip('destroy')
				if (typeof interfaces == 'object') {
					// Check if API call is a BLANKET DESTROY command
					if (blanket === true && command == 'destroy')
						while (interfaces.length > 0) interfaces[interfaces.length - 1].destroy();

					// API call is not a BLANKET DESTROY command
					else {
						// Check if supplied command effects this tooltip only (NOT BLANKET)
						if (blanket !== true) interfaces = [$(this).qtip('api')];

						// Execute command on chosen qTips
						for (i = 0; i < interfaces.length; i++) {
							// Destroy command doesn't require tooltip to be rendered
							if (command == 'destroy') interfaces[i].destroy();

							// Only call API if tooltip is rendered and it wasn't a destroy call
							else if (interfaces[i].status.rendered === true) {
								if (command == 'show') interfaces[i].show();
								else if (command == 'hide') interfaces[i].hide();
								else if (command == 'focus') interfaces[i].focus();
								else if (command == 'disable') interfaces[i].disable(true);
								else if (command == 'enable') interfaces[i].disable(false);
							};
						};
					};
				};
			}

			// No API commands, continue with qTip creation
			else {
				// Create unique configuration object
				config = $.extend(true, {}, opts);
				config.hide.effect.length = opts.hide.effect.length;
				config.show.effect.length = opts.show.effect.length;

				// Sanitize target options
				if (config.position.container === false) config.position.container = $(document.body);
				if (config.position.target === false) config.position.target = $(this);
				if (config.show.when.target === false) config.show.when.target = $(this);
				if (config.hide.when.target === false) config.hide.when.target = $(this);

				// Determine tooltip ID (Reuse array slots if possible)
				id = $.fn.qtip.interfaces.length;
				for (i = 0; i < id; i++) {
					if (typeof $.fn.qtip.interfaces[i] == 'undefined') { id = i; break; };
				};

				// Instantiate the tooltip
				obj = new qTip($(this), config, id);

				// Add API references
				$.fn.qtip.interfaces[id] = obj;

				// Check if element already has qTip data assigned
				//if(typeof $(this).data('qtip') == 'object')
				if (typeof $(this).data('qtip') === 'object' && $(this).data('qtip')) {
					// Set new current interface id
					if (typeof $(this).attr('qtip') === 'undefined')
						$(this).data('qtip').current = $(this).data('qtip').interfaces.length;

					// Push new API interface onto interfaces array
					$(this).data('qtip').interfaces.push(obj);
				}

				// No qTip data is present, create now
				else $(this).data('qtip', { current: 0, interfaces: [obj] });

				// If prerendering is disabled, create tooltip on showEvent
				if (config.content.prerender === false && config.show.when.event !== false && config.show.ready !== true) {
					config.show.when.target.bind(config.show.when.event + '.qtip-' + id + '-create', { qtip: id }, function (event) {
						// Retrieve API interface via passed qTip Id
						api = $.fn.qtip.interfaces[event.data.qtip];

						// Unbind show event and cache mouse coords
						api.options.show.when.target.unbind(api.options.show.when.event + '.qtip-' + event.data.qtip + '-create');
						api.cache.mouse = { x: event.pageX, y: event.pageY };

						// Render tooltip and start the event sequence
						construct.call(api);
						api.options.show.when.target.trigger(api.options.show.when.event);
					});
				}

				// Prerendering is enabled, create tooltip now
				else {
					// Set mouse position cache to top left of the element
					obj.cache.mouse = {
						x: config.show.when.target.offset().left,
						y: config.show.when.target.offset().top
					};

					// Construct the tooltip
					construct.call(obj);
				}
			};
		});
	};

	// Instantiator
	function qTip(target, options, id) {
		// Declare this reference
		var self = this;

		// Setup class attributes
		self.id = id;
		self.options = options;
		self.status = {
			animated: false,
			rendered: false,
			disabled: false,
			focused: false
		};
		self.elements = {
			target: target.addClass(self.options.style.classes.target),
			tooltip: null,
			wrapper: null,
			content: null,
			contentWrapper: null,
			title: null,
			button: null,
			tip: null,
			bgiframe: null
		};
		self.cache = {
			mouse: {},
			position: {},
			toggle: 0
		};
		self.timers = {};

		// Define exposed API methods
		$.extend(self, self.options.api,
      {
      	show: function (event) {
      		var returned, solo;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'show');

      		// Only continue if element is visible
      		if (self.elements.tooltip.css('display') !== 'none') return self;

      		// Clear animation queue
      		self.elements.tooltip.stop(true, false);

      		// Call API method and if return value is false, halt
      		returned = self.beforeShow.call(self, event);
      		if (returned === false) return self;

      		// Define afterShow callback method
      		function afterShow() {
      			// Call API method and focus if it isn't static
      			if (self.options.position.type !== 'static') self.focus();
      			self.onShow.call(self, event);

      			// Prevent antialias from disappearing in IE7 by removing filter attribute
      			if ($.browser.msie) self.elements.tooltip.get(0).style.removeAttribute('filter');
      		};

      		// Maintain toggle functionality if enabled
      		self.cache.toggle = 1;

      		// Update tooltip position if it isn't static
      		if (self.options.position.type !== 'static')
      			self.updatePosition(event, (self.options.show.effect.length > 0));

      		// Hide other tooltips if tooltip is solo
      		if (typeof self.options.show.solo == 'object') solo = $(self.options.show.solo);
      		else if (self.options.show.solo === true) solo = $('div.qtip').not(self.elements.tooltip);
      		if (solo) solo.each(function () { if ($(this).qtip('api').status.rendered === true) $(this).qtip('api').hide(); });

      		// Show tooltip
      		if (typeof self.options.show.effect.type == 'function') {
      			self.options.show.effect.type.call(self.elements.tooltip, self.options.show.effect.length);
      			self.elements.tooltip.queue(function () { afterShow(); $(this).dequeue(); });
      		}
      		else {
      			switch (self.options.show.effect.type.toLowerCase()) {
      				case 'fade':
      					self.elements.tooltip.fadeIn(self.options.show.effect.length, afterShow);
      					break;
      				case 'slide':
      					self.elements.tooltip.slideDown(self.options.show.effect.length, function () {
      						afterShow();
      						if (self.options.position.type !== 'static') self.updatePosition(event, true);
      					});
      					break;
      				case 'grow':
      					self.elements.tooltip.show(self.options.show.effect.length, afterShow);
      					break;
      				default:
      					self.elements.tooltip.show(null, afterShow);
      					break;
      			};

      			// Add active class to tooltip
      			self.elements.tooltip.addClass(self.options.style.classes.active);
      		};

      		// Log event and return
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_SHOWN, 'show');
      	},

      	hide: function (event) {
      		var returned;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'hide');

      		// Only continue if element is visible
      		else if (self.elements.tooltip.css('display') === 'none') return self;

      		// Stop show timer and animation queue
      		clearTimeout(self.timers.show);
      		self.elements.tooltip.stop(true, false);

      		// Call API method and if return value is false, halt
      		returned = self.beforeHide.call(self, event);
      		if (returned === false) return self;

      		// Define afterHide callback method
      		function afterHide() { self.onHide.call(self, event); };

      		// Maintain toggle functionality if enabled
      		self.cache.toggle = 0;

      		// Hide tooltip
      		if (typeof self.options.hide.effect.type == 'function') {
      			self.options.hide.effect.type.call(self.elements.tooltip, self.options.hide.effect.length);
      			self.elements.tooltip.queue(function () { afterHide(); $(this).dequeue(); });
      		}
      		else {
      			switch (self.options.hide.effect.type.toLowerCase()) {
      				case 'fade':
      					self.elements.tooltip.fadeOut(self.options.hide.effect.length, afterHide);
      					break;
      				case 'slide':
      					self.elements.tooltip.slideUp(self.options.hide.effect.length, afterHide);
      					break;
      				case 'grow':
      					self.elements.tooltip.hide(self.options.hide.effect.length, afterHide);
      					break;
      				default:
      					self.elements.tooltip.hide(null, afterHide);
      					break;
      			};

      			// Remove active class to tooltip
      			self.elements.tooltip.removeClass(self.options.style.classes.active);
      		};

      		// Log event and return
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_HIDDEN, 'hide');
      	},

      	updatePosition: function (event, animate) {
      		var i, target, tooltip, coords, mapName, imagePos, newPosition, ieAdjust, ie6Adjust, borderAdjust, mouseAdjust, offset, curPosition, returned

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updatePosition');

      		// If tooltip is static, return
      		else if (self.options.position.type == 'static')
      			return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_POSITION_STATIC, 'updatePosition');

      		// Define property objects
      		target = {
      			position: { left: 0, top: 0 },
      			dimensions: { height: 0, width: 0 },
      			corner: self.options.position.corner.target
      		};
      		tooltip = {
      			position: self.getPosition(),
      			dimensions: self.getDimensions(),
      			corner: self.options.position.corner.tooltip
      		};

      		// Target is an HTML element
      		if (self.options.position.target !== 'mouse') {
      			// If the HTML element is AREA, calculate position manually
      			if (self.options.position.target.get(0).nodeName.toLowerCase() == 'area') {
      				// Retrieve coordinates from coords attribute and parse into integers
      				coords = self.options.position.target.attr('coords').split(',');
      				for (i = 0; i < coords.length; i++) coords[i] = parseInt(coords[i]);

      				// Setup target position object
      				mapName = self.options.position.target.parent('map').attr('name');
      				imagePos = $('img[usemap="#' + mapName + '"]:first').offset();
      				target.position = {
      					left: Math.floor(imagePos.left + coords[0]),
      					top: Math.floor(imagePos.top + coords[1])
      				};

      				// Determine width and height of the area
      				switch (self.options.position.target.attr('shape').toLowerCase()) {
      					case 'rect':
      						target.dimensions = {
      							width: Math.ceil(Math.abs(coords[2] - coords[0])),
      							height: Math.ceil(Math.abs(coords[3] - coords[1]))
      						};
      						break;

      					case 'circle':
      						target.dimensions = {
      							width: coords[2] + 1,
      							height: coords[2] + 1
      						};
      						break;

      					case 'poly':
      						target.dimensions = {
      							width: coords[0],
      							height: coords[1]
      						};

      						for (i = 0; i < coords.length; i++) {
      							if (i % 2 == 0) {
      								if (coords[i] > target.dimensions.width)
      									target.dimensions.width = coords[i];
      								if (coords[i] < coords[0])
      									target.position.left = Math.floor(imagePos.left + coords[i]);
      							}
      							else {
      								if (coords[i] > target.dimensions.height)
      									target.dimensions.height = coords[i];
      								if (coords[i] < coords[1])
      									target.position.top = Math.floor(imagePos.top + coords[i]);
      							};
      						};

      						target.dimensions.width = target.dimensions.width - (target.position.left - imagePos.left);
      						target.dimensions.height = target.dimensions.height - (target.position.top - imagePos.top);
      						break;

      					default:
      						return $.fn.qtip.log.error.call(self, 4, $.fn.qtip.constants.INVALID_AREA_SHAPE, 'updatePosition');
      						break;
      				};

      				// Adjust position by 2 pixels (Positioning bug?)
      				target.dimensions.width -= 2; target.dimensions.height -= 2;
      			}

      			// Target is the document
      			else if (self.options.position.target.add(document.body).length === 1) {
      				target.position = { left: $(document).scrollLeft(), top: $(document).scrollTop() };
      				target.dimensions = { height: $(window).height(), width: $(window).width() };
      			}

      			// Target is a regular HTML element, find position normally
      			else {
      				// Check if the target is another tooltip. If its animated, retrieve position from newPosition data
      				if (typeof self.options.position.target.attr('qtip') !== 'undefined')
      					target.position = self.options.position.target.qtip('api').cache.position;
      				else
      					target.position = self.options.position.target.offset();

      				// Setup dimensions objects
      				target.dimensions = {
      					height: self.options.position.target.outerHeight(),
      					width: self.options.position.target.outerWidth()
      				};
      			};

      			// Calculate correct target corner position
      			newPosition = $.extend({}, target.position);
      			if (target.corner.search(/right/i) !== -1)
      				newPosition.left += target.dimensions.width;

      			if (target.corner.search(/bottom/i) !== -1)
      				newPosition.top += target.dimensions.height;

      			if (target.corner.search(/((top|bottom)Middle)|center/) !== -1)
      				newPosition.left += (target.dimensions.width / 2);

      			if (target.corner.search(/((left|right)Middle)|center/) !== -1)
      				newPosition.top += (target.dimensions.height / 2);
      		}

      		// Mouse is the target, set position to current mouse coordinates
      		else {
      			// Setup target position and dimensions objects
      			target.position = newPosition = { left: self.cache.mouse.x, top: self.cache.mouse.y };
      			target.dimensions = { height: 1, width: 1 };
      		};

      		// Calculate correct target corner position
      		if (tooltip.corner.search(/right/i) !== -1)
      			newPosition.left -= tooltip.dimensions.width;

      		if (tooltip.corner.search(/bottom/i) !== -1)
      			newPosition.top -= tooltip.dimensions.height;

      		if (tooltip.corner.search(/((top|bottom)Middle)|center/) !== -1)
      			newPosition.left -= (tooltip.dimensions.width / 2);

      		if (tooltip.corner.search(/((left|right)Middle)|center/) !== -1)
      			newPosition.top -= (tooltip.dimensions.height / 2);

      		// Setup IE adjustment variables (Pixel gap bugs)
      		ieAdjust = ($.browser.msie) ? 1 : 0; // And this is why I hate IE...
      		ie6Adjust = ($.browser.msie && parseInt($.browser.version.charAt(0)) === 6) ? 1 : 0; // ...and even more so IE6!

      		// Adjust for border radius
      		if (self.options.style.border.radius > 0) {
      			if (tooltip.corner.search(/Left/) !== -1)
      				newPosition.left -= self.options.style.border.radius;
      			else if (tooltip.corner.search(/Right/) !== -1)
      				newPosition.left += self.options.style.border.radius;

      			if (tooltip.corner.search(/Top/) !== -1)
      				newPosition.top -= self.options.style.border.radius;
      			else if (tooltip.corner.search(/Bottom/) !== -1)
      				newPosition.top += self.options.style.border.radius;
      		};

      		// IE only adjustments (Pixel perfect!)
      		if (ieAdjust) {
      			if (tooltip.corner.search(/top/) !== -1)
      				newPosition.top -= ieAdjust
      			else if (tooltip.corner.search(/bottom/) !== -1)
      				newPosition.top += ieAdjust

      			if (tooltip.corner.search(/left/) !== -1)
      				newPosition.left -= ieAdjust
      			else if (tooltip.corner.search(/right/) !== -1)
      				newPosition.left += ieAdjust

      			if (tooltip.corner.search(/leftMiddle|rightMiddle/) !== -1)
      				newPosition.top -= 1
      		};

      		// If screen adjustment is enabled, apply adjustments
      		if (self.options.position.adjust.screen === true)
      			newPosition = screenAdjust.call(self, newPosition, target, tooltip);

      		// If mouse is the target, prevent tooltip appearing directly under the mouse
      		if (self.options.position.target === 'mouse' && self.options.position.adjust.mouse === true) {
      			if (self.options.position.adjust.screen === true && self.elements.tip)
      				mouseAdjust = self.elements.tip.attr('rel');
      			else
      				mouseAdjust = self.options.position.corner.tooltip;

      			newPosition.left += (mouseAdjust.search(/right/i) !== -1) ? -6 : 6;
      			newPosition.top += (mouseAdjust.search(/bottom/i) !== -1) ? -6 : 6;
      		}

      		// Initiate bgiframe plugin in IE6 if tooltip overlaps a select box or object element
      		if (!self.elements.bgiframe && $.browser.msie && parseInt($.browser.version.charAt(0)) == 6) {
      			$('select, object').each(function () {
      				offset = $(this).offset();
      				offset.bottom = offset.top + $(this).height();
      				offset.right = offset.left + $(this).width();

      				if (newPosition.top + tooltip.dimensions.height >= offset.top
                  && newPosition.left + tooltip.dimensions.width >= offset.left)
      					bgiframe.call(self);
      			});
      		};

      		// Add user xy adjustments
      		newPosition.left += self.options.position.adjust.x;
      		newPosition.top += self.options.position.adjust.y;

      		// Set new tooltip position if its moved, animate if enabled
      		curPosition = self.getPosition();
      		if (newPosition.left != curPosition.left || newPosition.top != curPosition.top) {
      			// Call API method and if return value is false, halt
      			returned = self.beforePositionUpdate.call(self, event);
      			if (returned === false) return self;

      			// Cache new position
      			self.cache.position = newPosition;

      			// Check if animation is enabled
      			if (animate === true) {
      				// Set animated status
      				self.status.animated = true;

      				// Animate and reset animated status on animation end
      				self.elements.tooltip.animate(newPosition, 200, 'swing', function () { self.status.animated = false });
      			}

      			// Set new position via CSS
      			else self.elements.tooltip.css(newPosition);

      			// Call API method and log event if its not a mouse move
      			self.onPositionUpdate.call(self, event);
      			if (typeof event !== 'undefined' && event.type && event.type !== 'mousemove')
      				$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_POSITION_UPDATED, 'updatePosition');
      		};

      		return self;
      	},

      	updateWidth: function (newWidth) {
      		var hidden;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateWidth');

      		// Make sure supplied width is a number and if not, return
      		else if (newWidth && typeof newWidth !== 'number')
      			return $.fn.qtip.log.error.call(self, 2, 'newWidth must be of type number', 'updateWidth');

      		// Setup elements which must be hidden during width update
      		hidden = self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);

      		// Calculate the new width if one is not supplied
      		if (!newWidth) {
      			// Explicit width is set
      			if (typeof self.options.style.width.value == 'number')
      				newWidth = self.options.style.width.value;

      			// No width is set, proceed with auto detection
      			else {
      				// Set width to auto initally to determine new width and hide other elements
      				self.elements.tooltip.css({ width: 'auto' });
      				hidden.hide();

      				// Set position and zoom to defaults to prevent IE hasLayout bug
      				if ($.browser.msie)
      					self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: 'normal' });

      				// Set the new width
      				newWidth = self.getDimensions().width + 1;

      				// Make sure its within the maximum and minimum width boundries
      				if (!self.options.style.width.value) {
      					if (newWidth > self.options.style.width.max) newWidth = self.options.style.width.max
      					if (newWidth < self.options.style.width.min) newWidth = self.options.style.width.min
      				};
      			};
      		};

      		// Adjust newWidth by 1px if width is odd (IE6 rounding bug fix)
      		if (newWidth % 2 !== 0) newWidth -= 1;

      		// Set the new calculated width and unhide other elements
      		self.elements.tooltip.width(newWidth);
      		hidden.show();

      		// Set the border width, if enabled
      		if (self.options.style.border.radius) {
      			self.elements.tooltip.find('.qtip-betweenCorners').each(function (i) {
      				$(this).width(newWidth - (self.options.style.border.radius * 2));
      			})
      		};

      		// IE only adjustments
      		if ($.browser.msie) {
      			// Reset position and zoom to give the wrapper layout (IE hasLayout bug)
      			self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: '1' });

      			// Set the new width
      			self.elements.wrapper.width(newWidth);

      			// Adjust BGIframe height and width if enabled
      			if (self.elements.bgiframe) self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);
      		};

      		// Log event and return
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_WIDTH_UPDATED, 'updateWidth');
      	},

      	updateStyle: function (name) {
      		var tip, borders, context, corner, coordinates;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateStyle');

      		// Return if style is not defined or name is not a string
      		else if (typeof name !== 'string' || !$.fn.qtip.styles[name])
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.STYLE_NOT_DEFINED, 'updateStyle');

      		// Set the new style object
      		self.options.style = buildStyle.call(self, $.fn.qtip.styles[name], self.options.user.style);

      		// Update initial styles of content and title elements
      		self.elements.content.css(jQueryStyle(self.options.style));
      		if (self.options.content.title.text !== false)
      			self.elements.title.css(jQueryStyle(self.options.style.title, true));

      		// Update CSS border colour
      		self.elements.contentWrapper.css({ borderColor: self.options.style.border.color });

      		// Update tip color if enabled
      		if (self.options.style.tip.corner !== false) {
      			if ($('<canvas>').get(0).getContext) {
      				// Retrieve canvas context and clear
      				tip = self.elements.tooltip.find('.qtip-tip canvas:first');
      				context = tip.get(0).getContext('2d');
      				context.clearRect(0, 0, 300, 300);

      				// Draw new tip
      				corner = tip.parent('div[rel]:first').attr('rel');
      				coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);
      				drawTip.call(self, tip, coordinates, self.options.style.tip.color || self.options.style.border.color);
      			}
      			else if ($.browser.msie) {
      				// Set new fillcolor attribute
      				tip = self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');
      				tip.attr('fillcolor', self.options.style.tip.color || self.options.style.border.color);
      			};
      		};

      		// Update border colors if enabled
      		if (self.options.style.border.radius > 0) {
      			self.elements.tooltip.find('.qtip-betweenCorners').css({ backgroundColor: self.options.style.border.color });

      			if ($('<canvas>').get(0).getContext) {
      				borders = calculateBorders(self.options.style.border.radius)
      				self.elements.tooltip.find('.qtip-wrapper canvas').each(function () {
      					// Retrieve canvas context and clear
      					context = $(this).get(0).getContext('2d');
      					context.clearRect(0, 0, 300, 300);

      					// Draw new border
      					corner = $(this).parent('div[rel]:first').attr('rel')
      					drawBorder.call(self, $(this), borders[corner],
                        self.options.style.border.radius, self.options.style.border.color);
      				});
      			}
      			else if ($.browser.msie) {
      				// Set new fillcolor attribute on each border corner
      				self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function () {
      					$(this).attr('fillcolor', self.options.style.border.color)
      				});
      			};
      		};

      		// Log event and return
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_STYLE_UPDATED, 'updateStyle');
      	},

      	updateContent: function (content, reposition) {
      		var parsedContent, images, loadedImages;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateContent');

      		// Make sure content is defined before update
      		else if (!content)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateContent');

      		// Call API method and set new content if a string is returned
      		parsedContent = self.beforeContentUpdate.call(self, content);
      		if (typeof parsedContent == 'string') content = parsedContent;
      		else if (parsedContent === false) return;

      		// Set position and zoom to defaults to prevent IE hasLayout bug
      		if ($.browser.msie) self.elements.contentWrapper.children().css({ zoom: 'normal' });

      		// Append new content if its a DOM array and show it if hidden
      		if (content.jquery && content.length > 0)
      			content.clone(true).appendTo(self.elements.content).show();

      		// Content is a regular string, insert the new content
      		else self.elements.content.html(content);

      		// Check if images need to be loaded before position is updated to prevent mis-positioning
      		images = self.elements.content.find('img[complete=false]');
      		if (images.length > 0) {
      			loadedImages = 0;
      			images.each(function (i) {
      				$('<img src="' + $(this).attr('src') + '" />')
                     .load(function () { if (++loadedImages == images.length) afterLoad(); });
      			});
      		}
      		else afterLoad();

      		function afterLoad() {
      			// Update the tooltip width
      			self.updateWidth();

      			// If repositioning is enabled, update positions
      			if (reposition !== false) {
      				// Update position if tooltip isn't static
      				if (self.options.position.type !== 'static')
      					self.updatePosition(self.elements.tooltip.is(':visible'), true);

      				// Reposition the tip if enabled
      				if (self.options.style.tip.corner !== false)
      					positionTip.call(self);
      			};
      		};

      		// Call API method and log event
      		self.onContentUpdate.call(self);
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_UPDATED, 'loadContent');
      	},

      	loadContent: function (url, data, method) {
      		var returned;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'loadContent');

      		// Call API method and if return value is false, halt
      		returned = self.beforeContentLoad.call(self);
      		if (returned === false) return self;

      		// Load content using specified request type
      		if (method == 'post')
      			$.post(url, data, setupContent);
      		else
      			$.get(url, data, setupContent);

      		function setupContent(content) {
      			// Call API method and log event
      			self.onContentLoad.call(self);
      			$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_LOADED, 'loadContent');

      			// Update the content
      			self.updateContent(content);
      		};

      		return self;
      	},

      	updateTitle: function (content) {
      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateTitle');

      		// Make sure content is defined before update
      		else if (!content)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateTitle');

      		// Call API method and if return value is false, halt
      		returned = self.beforeTitleUpdate.call(self);
      		if (returned === false) return self;

      		// Set the new content and reappend the button if enabled
      		if (self.elements.button) self.elements.button = self.elements.button.clone(true);
      		self.elements.title.html(content)
      		if (self.elements.button) self.elements.title.prepend(self.elements.button);

      		// Call API method and log event
      		self.onTitleUpdate.call(self);
      		return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_TITLE_UPDATED, 'updateTitle');
      	},

      	focus: function (event) {
      		var curIndex, newIndex, elemIndex, returned;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'focus');

      		else if (self.options.position.type == 'static')
      			return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_FOCUS_STATIC, 'focus');

      		// Set z-index variables
      		curIndex = parseInt(self.elements.tooltip.css('z-index'));
      		newIndex = 6000 + $('div.qtip[qtip]').length - 1;

      		// Only update the z-index if it has changed and tooltip is not already focused
      		if (!self.status.focused && curIndex !== newIndex) {
      			// Call API method and if return value is false, halt
      			returned = self.beforeFocus.call(self, event);
      			if (returned === false) return self;

      			// Loop through all other tooltips
      			$('div.qtip[qtip]').not(self.elements.tooltip).each(function () {
      				if ($(this).qtip('api').status.rendered === true) {
      					elemIndex = parseInt($(this).css('z-index'));

      					// Reduce all other tooltip z-index by 1
      					if (typeof elemIndex == 'number' && elemIndex > -1)
      						$(this).css({ zIndex: parseInt($(this).css('z-index')) - 1 });

      					// Set focused status to false
      					$(this).qtip('api').status.focused = false;
      				}
      			})

      			// Set the new z-index and set focus status to true
      			self.elements.tooltip.css({ zIndex: newIndex });
      			self.status.focused = true;

      			// Call API method and log event
      			self.onFocus.call(self, event);
      			$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_FOCUSED, 'focus');
      		};

      		return self;
      	},

      	disable: function (state) {
      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'disable');

      		if (state) {
      			// Tooltip is not already disabled, proceed
      			if (!self.status.disabled) {
      				// Set the disabled flag and log event
      				self.status.disabled = true;
      				$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DISABLED, 'disable');
      			}

      			// Tooltip is already disabled, inform user via log
      			else $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED, 'disable');
      		}
      		else {
      			// Tooltip is not already enabled, proceed
      			if (self.status.disabled) {
      				// Reassign events, set disable status and log
      				self.status.disabled = false;
      				$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_ENABLED, 'disable');
      			}

      			// Tooltip is already enabled, inform the user via log
      			else $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED, 'disable');
      		};

      		return self;
      	},

      	destroy: function () {
      		var i, returned, interfaces;

      		// Call API method and if return value is false, halt
      		returned = self.beforeDestroy.call(self);
      		if (returned === false) return self;

      		// Check if tooltip is rendered
      		if (self.status.rendered) {
      			// Remove event handlers and remove element
      			self.options.show.when.target.unbind('mousemove.qtip', self.updatePosition);
      			self.options.show.when.target.unbind('mouseout.qtip', self.hide);
      			self.options.show.when.target.unbind(self.options.show.when.event + '.qtip');
      			self.options.hide.when.target.unbind(self.options.hide.when.event + '.qtip');
      			self.elements.tooltip.unbind(self.options.hide.when.event + '.qtip');
      			self.elements.tooltip.unbind('mouseover.qtip', self.focus);
      			self.elements.tooltip.remove();
      		}

      		// Tooltip isn't yet rendered, remove render event
      		else self.options.show.when.target.unbind(self.options.show.when.event + '.qtip-create');

      		// Check to make sure qTip data is present on target element
      		if (typeof self.elements.target.data('qtip') == 'object') {
      			// Remove API references from interfaces object
      			interfaces = self.elements.target.data('qtip').interfaces;
      			if (typeof interfaces == 'object' && interfaces.length > 0) {
      				// Remove API from interfaces array
      				for (i = 0; i < interfaces.length - 1; i++)
      					if (interfaces[i].id == self.id) interfaces.splice(i, 1)
      			}
      		}
      		delete $.fn.qtip.interfaces[self.id];

      		// Set qTip current id to previous tooltips API if available
      		if (typeof interfaces == 'object' && interfaces.length > 0)
      			self.elements.target.data('qtip').current = interfaces.length - 1;
      		else
      			self.elements.target.removeData('qtip');

      		// Call API method and log destroy
      		self.onDestroy.call(self);
      		$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DESTROYED, 'destroy');

      		return self.elements.target
      	},

      	getPosition: function () {
      		var show, offset;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getPosition');

      		show = (self.elements.tooltip.css('display') !== 'none') ? false : true;

      		// Show and hide tooltip to make sure coordinates are returned
      		if (show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
      		offset = self.elements.tooltip.offset();
      		if (show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();

      		return offset;
      	},

      	getDimensions: function () {
      		var show, dimensions;

      		// Make sure tooltip is rendered and if not, return
      		if (!self.status.rendered)
      			return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getDimensions');

      		show = (!self.elements.tooltip.is(':visible')) ? true : false;

      		// Show and hide tooltip to make sure dimensions are returned
      		if (show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
      		dimensions = {
      			height: self.elements.tooltip.outerHeight(),
      			width: self.elements.tooltip.outerWidth()
      		};
      		if (show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();

      		return dimensions;
      	}
      });
	};

	// Define priamry construct function
	function construct() {
		var self, adjust, content, url, data, method, tempLength;
		self = this;

		// Call API method
		self.beforeRender.call(self);

		// Set rendered status to true
		self.status.rendered = true;

		// Create initial tooltip elements
		self.elements.tooltip = '<div qtip="' + self.id + '" ' +
         'class="qtip ' + (self.options.style.classes.tooltip || self.options.style) + '"' +
         'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;' +
         'position:' + self.options.position.type + ';">' +
         '  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">' +
         '    <div class="qtip-contentWrapper" style="overflow:hidden;">' +
         '       <div class="qtip-content ' + self.options.style.classes.content + '"></div>' +
         '</div></div></div>';

		// Append to container element
		self.elements.tooltip = $(self.elements.tooltip);
		self.elements.tooltip.appendTo(self.options.position.container)

		// Setup tooltip qTip data
		self.elements.tooltip.data('qtip', { current: 0, interfaces: [self] });

		// Setup element references
		self.elements.wrapper = self.elements.tooltip.children('div:first');
		self.elements.contentWrapper = self.elements.wrapper.children('div:first').css({ background: self.options.style.background });
		self.elements.content = self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));

		// Apply IE hasLayout fix to wrapper and content elements
		if ($.browser.msie) self.elements.wrapper.add(self.elements.content).css({ zoom: 1 });

		// Setup tooltip attributes
		if (self.options.hide.when.event == 'unfocus') self.elements.tooltip.attr('unfocus', true);

		// If an explicit width is set, updateWidth prior to setting content to prevent dirty rendering
		if (typeof self.options.style.width.value == 'number') self.updateWidth();

		// Create borders and tips if supported by the browser
		if ($('<canvas>').get(0).getContext || $.browser.msie) {
			// Create border
			if (self.options.style.border.radius > 0)
				createBorder.call(self);
			else
				self.elements.contentWrapper.css({ border: self.options.style.border.width + 'px solid ' + self.options.style.border.color });

			// Create tip if enabled
			if (self.options.style.tip.corner !== false)
				createTip.call(self);
		}

		// Neither canvas or VML is supported, tips and borders cannot be drawn!
		else {
			// Set defined border width
			self.elements.contentWrapper.css({ border: self.options.style.border.width + 'px solid ' + self.options.style.border.color });

			// Reset border radius and tip
			self.options.style.border.radius = 0;
			self.options.style.tip.corner = false;

			// Inform via log
			$.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED, 'render');
		};

		// Use the provided content string or DOM array
		if ((typeof self.options.content.text == 'string' && self.options.content.text.length > 0)
      || (self.options.content.text.jquery && self.options.content.text.length > 0))
			content = self.options.content.text;

		// Use title string for content if present
		else if (typeof self.elements.target.attr('title') == 'string' && self.elements.target.attr('title').length > 0) {
			content = self.elements.target.attr('title').replace("\\n", '<br />');
			self.elements.target.attr('title', ''); // Remove title attribute to prevent default tooltip showing
		}

		// No title is present, use alt attribute instead
		else if (typeof self.elements.target.attr('alt') == 'string' && self.elements.target.attr('alt').length > 0) {
			content = self.elements.target.attr('alt').replace("\\n", '<br />');
			self.elements.target.attr('alt', ''); // Remove alt attribute to prevent default tooltip showing
		}

		// No valid content was provided, inform via log
		else {
			content = ' ';
			$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_VALID_CONTENT, 'render');
		};

		// Set the tooltips content and create title if enabled
		if (self.options.content.title.text !== false) createTitle.call(self);
		self.updateContent(content);

		// Assign events and toggle tooltip with focus
		assignEvents.call(self);
		if (self.options.show.ready === true) self.show();

		// Retrieve ajax content if provided
		if (self.options.content.url !== false) {
			url = self.options.content.url;
			data = self.options.content.data;
			method = self.options.content.method || 'get';
			self.loadContent(url, data, method);
		};

		// Call API method and log event
		self.onRender.call(self);
		$.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_RENDERED, 'render');
	};

	// Create borders using canvas and VML
	function createBorder() {
		var self, i, width, radius, color, coordinates, containers, size, betweenWidth, betweenCorners, borderTop, borderBottom, borderCoord, sideWidth, vertWidth;
		self = this;

		// Destroy previous border elements, if present
		self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();

		// Setup local variables
		width = self.options.style.border.width;
		radius = self.options.style.border.radius;
		color = self.options.style.border.color || self.options.style.tip.color;

		// Calculate border coordinates
		coordinates = calculateBorders(radius);

		// Create containers for the border shapes
		containers = {};
		for (i in coordinates) {
			// Create shape container
			containers[i] = '<div rel="' + i + '" style="' + ((i.search(/Left/) !== -1) ? 'left' : 'right') + ':0; ' +
            'position:absolute; height:' + radius + 'px; width:' + radius + 'px; overflow:hidden; line-height:0.1px; font-size:1px">';

			// Canvas is supported
			if ($('<canvas>').get(0).getContext)
				containers[i] += '<canvas height="' + radius + '" width="' + radius + '" style="vertical-align: top"></canvas>';

			// No canvas, but if it's IE use VML
			else if ($.browser.msie) {
				size = radius * 2 + 3;
				containers[i] += '<v:arc stroked="false" fillcolor="' + color + '" startangle="' + coordinates[i][0] + '" endangle="' + coordinates[i][1] + '" ' +
               'style="width:' + size + 'px; height:' + size + 'px; margin-top:' + ((i.search(/bottom/) !== -1) ? -2 : -1) + 'px; ' +
               'margin-left:' + ((i.search(/Right/) !== -1) ? coordinates[i][2] - 3.5 : -1) + 'px; ' +
               'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';

			};

			containers[i] += '</div>';
		};

		// Create between corners elements
		betweenWidth = self.getDimensions().width - (Math.max(width, radius) * 2);
		betweenCorners = '<div class="qtip-betweenCorners" style="height:' + radius + 'px; width:' + betweenWidth + 'px; ' +
         'overflow:hidden; background-color:' + color + '; line-height:0.1px; font-size:1px;">';

		// Create top border container
		borderTop = '<div class="qtip-borderTop" dir="ltr" style="height:' + radius + 'px; ' +
         'margin-left:' + radius + 'px; line-height:0.1px; font-size:1px; padding:0;">' +
         containers['topLeft'] + containers['topRight'] + betweenCorners;
		self.elements.wrapper.prepend(borderTop);

		// Create bottom border container
		borderBottom = '<div class="qtip-borderBottom" dir="ltr" style="height:' + radius + 'px; ' +
         'margin-left:' + radius + 'px; line-height:0.1px; font-size:1px; padding:0;">' +
         containers['bottomLeft'] + containers['bottomRight'] + betweenCorners;
		self.elements.wrapper.append(borderBottom);

		// Draw the borders if canvas were used (Delayed til after DOM creation)
		if ($('<canvas>').get(0).getContext) {
			self.elements.wrapper.find('canvas').each(function () {
				borderCoord = coordinates[$(this).parent('[rel]:first').attr('rel')];
				drawBorder.call(self, $(this), borderCoord, radius, color);
			})
		}

		// Create a phantom VML element (IE won't show the last created VML element otherwise)
		else if ($.browser.msie) self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');

		// Setup contentWrapper border
		sideWidth = Math.max(radius, (radius + (width - radius)))
		vertWidth = Math.max(width - radius, 0);
		self.elements.contentWrapper.css({
			border: '0px solid ' + color,
			borderWidth: vertWidth + 'px ' + sideWidth + 'px'
		})
	};

	// Border canvas draw method
	function drawBorder(canvas, coordinates, radius, color) {
		// Create corner
		var context = canvas.get(0).getContext('2d');
		context.fillStyle = color;
		context.beginPath();
		context.arc(coordinates[0], coordinates[1], radius, 0, Math.PI * 2, false);
		context.fill();
	};

	// Create tip using canvas and VML
	function createTip(corner) {
		var self, color, coordinates, coordsize, path;
		self = this;

		// Destroy previous tip, if there is one
		if (self.elements.tip !== null) self.elements.tip.remove();

		// Setup color and corner values
		color = self.options.style.tip.color || self.options.style.border.color;
		if (self.options.style.tip.corner === false) return;
		else if (!corner) corner = self.options.style.tip.corner;

		// Calculate tip coordinates
		coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);

		// Create tip element
		self.elements.tip = '<div class="' + self.options.style.classes.tip + '" dir="ltr" rel="' + corner + '" style="position:absolute; ' +
         'height:' + self.options.style.tip.size.height + 'px; width:' + self.options.style.tip.size.width + 'px; ' +
         'margin:0 auto; line-height:0.1px; font-size:1px;">';

		// Use canvas element if supported
		if ($('<canvas>').get(0).getContext)
			self.elements.tip += '<canvas height="' + self.options.style.tip.size.height + '" width="' + self.options.style.tip.size.width + '"></canvas>';

		// Canvas not supported - Use VML (IE)
		else if ($.browser.msie) {
			// Create coordize and tip path using tip coordinates
			coordsize = self.options.style.tip.size.width + ',' + self.options.style.tip.size.height;
			path = 'm' + coordinates[0][0] + ',' + coordinates[0][1];
			path += ' l' + coordinates[1][0] + ',' + coordinates[1][1];
			path += ' ' + coordinates[2][0] + ',' + coordinates[2][1];
			path += ' xe';

			// Create VML element
			self.elements.tip += '<v:shape fillcolor="' + color + '" stroked="false" filled="true" path="' + path + '" coordsize="' + coordsize + '" ' +
            'style="width:' + self.options.style.tip.size.width + 'px; height:' + self.options.style.tip.size.height + 'px; ' +
            'line-height:0.1px; display:inline-block; behavior:url(#default#VML); ' +
            'vertical-align:' + ((corner.search(/top/) !== -1) ? 'bottom' : 'top') + '"></v:shape>';

			// Create a phantom VML element (IE won't show the last created VML element otherwise)
			self.elements.tip += '<v:image style="behavior:url(#default#VML);"></v:image>';

			// Prevent tooltip appearing above the content (IE z-index bug)
			self.elements.contentWrapper.css('position', 'relative');
		};

		// Attach new tip to tooltip element
		self.elements.tooltip.prepend(self.elements.tip + '</div>');

		// Create element reference and draw the canvas tip (Delayed til after DOM creation)
		self.elements.tip = self.elements.tooltip.find('.' + self.options.style.classes.tip).eq(0);
		if ($('<canvas>').get(0).getContext)
			drawTip.call(self, self.elements.tip.find('canvas:first'), coordinates, color);

		// Fix IE small tip bug
		if (corner.search(/top/) !== -1 && $.browser.msie && parseInt($.browser.version.charAt(0)) === 6)
			self.elements.tip.css({ marginTop: -4 });

		// Set the tip position
		positionTip.call(self, corner);
	};

	// Canvas tip drawing method
	function drawTip(canvas, coordinates, color) {
		// Setup properties
		var context = canvas.get(0).getContext('2d');
		context.fillStyle = color;

		// Create tip
		context.beginPath();
		context.moveTo(coordinates[0][0], coordinates[0][1]);
		context.lineTo(coordinates[1][0], coordinates[1][1]);
		context.lineTo(coordinates[2][0], coordinates[2][1]);
		context.fill();
	};

	function positionTip(corner) {
		var self, ieAdjust, paddingCorner, paddingSize, newMargin;
		self = this;

		// Return if tips are disabled or tip is not yet rendered
		if (self.options.style.tip.corner === false || !self.elements.tip) return;
		if (!corner) corner = self.elements.tip.attr('rel');

		// Setup adjustment variables
		ieAdjust = positionAdjust = ($.browser.msie) ? 1 : 0;

		// Set initial position
		self.elements.tip.css(corner.match(/left|right|top|bottom/)[0], 0);

		// Set position of tip to correct side
		if (corner.search(/top|bottom/) !== -1) {
			// Adjustments for IE6 - 0.5px border gap bug
			if ($.browser.msie) {
				if (parseInt($.browser.version.charAt(0)) === 6)
					positionAdjust = (corner.search(/top/) !== -1) ? -3 : 1;
				else
					positionAdjust = (corner.search(/top/) !== -1) ? 1 : 2;
			};

			if (corner.search(/Middle/) !== -1)
				self.elements.tip.css({ left: '50%', marginLeft: -(self.options.style.tip.size.width / 2) });

			else if (corner.search(/Left/) !== -1)
				self.elements.tip.css({ left: self.options.style.border.radius - ieAdjust });

			else if (corner.search(/Right/) !== -1)
				self.elements.tip.css({ right: self.options.style.border.radius + ieAdjust });

			if (corner.search(/top/) !== -1)
				self.elements.tip.css({ top: -positionAdjust });
			else
				self.elements.tip.css({ bottom: positionAdjust });

		}
		else if (corner.search(/left|right/) !== -1) {
			// Adjustments for IE6 - 0.5px border gap bug
			if ($.browser.msie)
				positionAdjust = (parseInt($.browser.version.charAt(0)) === 6) ? 1 : ((corner.search(/left/) !== -1) ? 1 : 2);

			if (corner.search(/Middle/) !== -1)
				self.elements.tip.css({ top: '50%', marginTop: -(self.options.style.tip.size.height / 2) });

			else if (corner.search(/Top/) !== -1)
				self.elements.tip.css({ top: self.options.style.border.radius - ieAdjust });

			else if (corner.search(/Bottom/) !== -1)
				self.elements.tip.css({ bottom: self.options.style.border.radius + ieAdjust });

			if (corner.search(/left/) !== -1)
				self.elements.tip.css({ left: -positionAdjust });
			else
				self.elements.tip.css({ right: positionAdjust });
		};

		// Adjust tooltip padding to compensate for tip
		paddingCorner = 'padding-' + corner.match(/left|right|top|bottom/)[0];
		paddingSize = self.options.style.tip.size[(paddingCorner.search(/left|right/) !== -1) ? 'width' : 'height'];
		self.elements.tooltip.css('padding', 0);
		self.elements.tooltip.css(paddingCorner, paddingSize);

		// Match content margin to prevent gap bug in IE6 ONLY
		if ($.browser.msie && parseInt($.browser.version.charAt(0)) == 6) {
			newMargin = parseInt(self.elements.tip.css('margin-top')) || 0;
			newMargin += parseInt(self.elements.content.css('margin-top')) || 0;

			self.elements.tip.css({ marginTop: newMargin });
		};
	};

	// Create title bar for content
	function createTitle() {
		var self = this;

		// Destroy previous title element, if present
		if (self.elements.title !== null) self.elements.title.remove();

		// Create title element
		self.elements.title = $('<div class="' + self.options.style.classes.title + '">')
         .css(jQueryStyle(self.options.style.title, true))
         .css({ zoom: ($.browser.msie) ? 1 : 0 })
         .prependTo(self.elements.contentWrapper);

		// Update title with contents if enabled
		if (self.options.content.title.text) self.updateTitle.call(self, self.options.content.title.text);

		// Create title close buttons if enabled
		if (self.options.content.title.button !== false
      && typeof self.options.content.title.button == 'string') {
			self.elements.button = $('<a class="' + self.options.style.classes.button + '" style="float:right; position: relative"></a>')
            .css(jQueryStyle(self.options.style.button, true))
            .html(self.options.content.title.button)
            .prependTo(self.elements.title)
            .click(function (event) { if (!self.status.disabled) self.hide(event) });
		};
	};

	// Assign hide and show events
	function assignEvents() {
		var self, showTarget, hideTarget, inactiveEvents;
		self = this;

		// Setup event target variables
		showTarget = self.options.show.when.target;
		hideTarget = self.options.hide.when.target;

		// Add tooltip as a hideTarget is its fixed
		if (self.options.hide.fixed) hideTarget = hideTarget.add(self.elements.tooltip);

		// Check if the hide event is special 'inactive' type
		if (self.options.hide.when.event == 'inactive') {
			// Define events which reset the 'inactive' event handler
			inactiveEvents = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove',
         'mouseout', 'mouseenter', 'mouseleave', 'mouseover'];

			// Define 'inactive' event timer method
			function inactiveMethod(event) {
				if (self.status.disabled === true) return;

				//Clear and reset the timer
				clearTimeout(self.timers.inactive);
				self.timers.inactive = setTimeout(function () {
					// Unassign 'inactive' events
					$(inactiveEvents).each(function () {
						hideTarget.unbind(this + '.qtip-inactive');
						self.elements.content.unbind(this + '.qtip-inactive');
					});

					// Hide the tooltip
					self.hide(event);
				}
            , self.options.hide.delay);
			};
		}

		// Check if the tooltip is 'fixed'
		else if (self.options.hide.fixed === true) {
			self.elements.tooltip.bind('mouseover.qtip', function () {
				if (self.status.disabled === true) return;

				// Reset the hide timer
				clearTimeout(self.timers.hide);
			});
		};

		// Define show event method
		function showMethod(event) {
			if (self.status.disabled === true) return;

			// If set, hide tooltip when inactive for delay period
			if (self.options.hide.when.event == 'inactive') {
				// Assign each reset event
				$(inactiveEvents).each(function () {
					hideTarget.bind(this + '.qtip-inactive', inactiveMethod);
					self.elements.content.bind(this + '.qtip-inactive', inactiveMethod);
				});

				// Start the inactive timer
				inactiveMethod();
			};

			// Clear hide timers
			clearTimeout(self.timers.show);
			clearTimeout(self.timers.hide);

			// Start show timer
			self.timers.show = setTimeout(function () { self.show(event); }, self.options.show.delay);
		};

		// Define hide event method
		function hideMethod(event) {
			if (self.status.disabled === true) return;

			// Prevent hiding if tooltip is fixed and event target is the tooltip
			if (self.options.hide.fixed === true
         && self.options.hide.when.event.search(/mouse(out|leave)/i) !== -1
         && $(event.relatedTarget).parents('div.qtip[qtip]').length > 0) {
				// Prevent default and popagation
				event.stopPropagation();
				event.preventDefault();

				// Reset the hide timer
				clearTimeout(self.timers.hide);
				return false;
			};

			// Clear timers and stop animation queue
			clearTimeout(self.timers.show);
			clearTimeout(self.timers.hide);
			self.elements.tooltip.stop(true, true);

			// If tooltip has displayed, start hide timer
			self.timers.hide = setTimeout(function () { self.hide(event); }, self.options.hide.delay);
		};

		// Both events and targets are identical, apply events using a toggle
		if ((self.options.show.when.target.add(self.options.hide.when.target).length === 1
      && self.options.show.when.event == self.options.hide.when.event
      && self.options.hide.when.event !== 'inactive')
      || self.options.hide.when.event == 'unfocus') {
			self.cache.toggle = 0;
			// Use a toggle to prevent hide/show conflicts
			showTarget.bind(self.options.show.when.event + '.qtip', function (event) {
				if (self.cache.toggle == 0) showMethod(event);
				else hideMethod(event);
			});
		}

		// Events are not identical, bind normally
		else {
			showTarget.bind(self.options.show.when.event + '.qtip', showMethod);

			// If the hide event is not 'inactive', bind the hide method
			if (self.options.hide.when.event !== 'inactive')
				hideTarget.bind(self.options.hide.when.event + '.qtip', hideMethod);
		};

		// Focus the tooltip on mouseover
		if (self.options.position.type.search(/(fixed|absolute)/) !== -1)
			self.elements.tooltip.bind('mouseover.qtip', self.focus);

		// If mouse is the target, update tooltip position on mousemove
		if (self.options.position.target === 'mouse' && self.options.position.type !== 'static') {
			showTarget.bind('mousemove.qtip', function (event) {
				// Set the new mouse positions if adjustment is enabled
				self.cache.mouse = { x: event.pageX, y: event.pageY };

				// Update the tooltip position only if the tooltip is visible and adjustment is enabled
				if (self.status.disabled === false
            && self.options.position.adjust.mouse === true
            && self.options.position.type !== 'static'
            && self.elements.tooltip.css('display') !== 'none')
					self.updatePosition(event);
			});
		};
	};

	// Screen position adjustment
	function screenAdjust(position, target, tooltip) {
		var self, adjustedPosition, adjust, newCorner, overflow, corner;
		self = this;

		// Setup corner and adjustment variable
		if (tooltip.corner == 'center') return target.position // TODO: 'center' corner adjustment
		adjustedPosition = $.extend({}, position);
		newCorner = { x: false, y: false };

		// Define overflow properties
		overflow = {
			left: (adjustedPosition.left < $.fn.qtip.cache.screen.scroll.left),
			right: (adjustedPosition.left + tooltip.dimensions.width + 2 >= $.fn.qtip.cache.screen.width + $.fn.qtip.cache.screen.scroll.left),
			top: (adjustedPosition.top < $.fn.qtip.cache.screen.scroll.top),
			bottom: (adjustedPosition.top + tooltip.dimensions.height + 2 >= $.fn.qtip.cache.screen.height + $.fn.qtip.cache.screen.scroll.top)
		};

		// Determine new positioning properties
		adjust = {
			left: (overflow.left && (tooltip.corner.search(/right/i) != -1 || (tooltip.corner.search(/right/i) == -1 && !overflow.right))),
			right: (overflow.right && (tooltip.corner.search(/left/i) != -1 || (tooltip.corner.search(/left/i) == -1 && !overflow.left))),
			top: (overflow.top && tooltip.corner.search(/top/i) == -1),
			bottom: (overflow.bottom && tooltip.corner.search(/bottom/i) == -1)
		};

		// Tooltip overflows off the left side of the screen
		if (adjust.left) {
			if (self.options.position.target !== 'mouse')
				adjustedPosition.left = target.position.left + target.dimensions.width;
			else
				adjustedPosition.left = self.cache.mouse.x

			newCorner.x = 'Left';
		}

		// Tooltip overflows off the right side of the screen
		else if (adjust.right) {
			if (self.options.position.target !== 'mouse')
				adjustedPosition.left = target.position.left - tooltip.dimensions.width;
			else
				adjustedPosition.left = self.cache.mouse.x - tooltip.dimensions.width;

			newCorner.x = 'Right';
		};

		// Tooltip overflows off the top of the screen
		if (adjust.top) {
			if (self.options.position.target !== 'mouse')
				adjustedPosition.top = target.position.top + target.dimensions.height;
			else
				adjustedPosition.top = self.cache.mouse.y

			newCorner.y = 'top';
		}

		// Tooltip overflows off the bottom of the screen
		else if (adjust.bottom) {
			if (self.options.position.target !== 'mouse')
				adjustedPosition.top = target.position.top - tooltip.dimensions.height;
			else
				adjustedPosition.top = self.cache.mouse.y - tooltip.dimensions.height;

			newCorner.y = 'bottom';
		};

		// Don't adjust if resulting position is negative
		if (adjustedPosition.left < 0) {
			adjustedPosition.left = position.left;
			newCorner.x = false;
		};
		if (adjustedPosition.top < 0) {
			adjustedPosition.top = position.top;
			newCorner.y = false;
		};

		// Change tip corner if positioning has changed and tips are enabled
		if (self.options.style.tip.corner !== false) {
			// Determine new corner properties
			adjustedPosition.corner = new String(tooltip.corner);
			if (newCorner.x !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/Left|Right|Middle/, newCorner.x);
			if (newCorner.y !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/top|bottom/, newCorner.y);

			// Adjust tip if position has changed and tips are enabled
			if (adjustedPosition.corner !== self.elements.tip.attr('rel'))
				createTip.call(self, adjustedPosition.corner);
		};

		return adjustedPosition;
	};

	// Build a jQuery style object from supplied style object
	function jQueryStyle(style, sub) {
		var styleObj, i;

		styleObj = $.extend(true, {}, style);
		for (i in styleObj) {
			if (sub === true && i.search(/(tip|classes)/i) !== -1)
				delete styleObj[i];
			else if (!sub && i.search(/(width|border|tip|title|classes|user)/i) !== -1)
				delete styleObj[i];
		};

		return styleObj;
	};

	// Sanitize styles
	function sanitizeStyle(style) {
		if (typeof style.tip !== 'object') style.tip = { corner: style.tip };
		if (typeof style.tip.size !== 'object') style.tip.size = { width: style.tip.size, height: style.tip.size };
		if (typeof style.border !== 'object') style.border = { width: style.border };
		if (typeof style.width !== 'object') style.width = { value: style.width };
		if (typeof style.width.max == 'string') style.width.max = parseInt(style.width.max.replace(/([0-9]+)/i, "$1"));
		if (typeof style.width.min == 'string') style.width.min = parseInt(style.width.min.replace(/([0-9]+)/i, "$1"));

		// Convert deprecated x and y tip values to width/height
		if (typeof style.tip.size.x == 'number') {
			style.tip.size.width = style.tip.size.x;
			delete style.tip.size.x;
		};
		if (typeof style.tip.size.y == 'number') {
			style.tip.size.height = style.tip.size.y;
			delete style.tip.size.y;
		};

		return style;
	};

	// Build styles recursively with inheritance
	function buildStyle() {
		var self, i, styleArray, styleExtend, finalStyle, ieAdjust;
		self = this;

		// Build style options from supplied arguments
		styleArray = [true, {}];
		for (i = 0; i < arguments.length; i++)
			styleArray.push(arguments[i]);
		styleExtend = [$.extend.apply($, styleArray)];

		// Loop through each named style inheritance
		while (typeof styleExtend[0].name == 'string') {
			// Sanitize style data and append to extend array
			styleExtend.unshift(sanitizeStyle($.fn.qtip.styles[styleExtend[0].name]));
		};

		// Make sure resulting tooltip className represents final style
		styleExtend.unshift(true, { classes: { tooltip: 'qtip-' + (arguments[0].name || 'defaults')} }, $.fn.qtip.styles.defaults);

		// Extend into a single style object
		finalStyle = $.extend.apply($, styleExtend);

		// Adjust tip size if needed (IE 1px adjustment bug fix)
		ieAdjust = ($.browser.msie) ? 1 : 0;
		finalStyle.tip.size.width += ieAdjust;
		finalStyle.tip.size.height += ieAdjust;

		// Force even numbers for pixel precision
		if (finalStyle.tip.size.width % 2 > 0) finalStyle.tip.size.width += 1;
		if (finalStyle.tip.size.height % 2 > 0) finalStyle.tip.size.height += 1;

		// Sanitize final styles tip corner value
		if (finalStyle.tip.corner === true)
			finalStyle.tip.corner = (self.options.position.corner.tooltip === 'center') ? false : self.options.position.corner.tooltip;

		return finalStyle;
	};

	// Tip coordinates calculator
	function calculateTip(corner, width, height) {
		// Define tip coordinates in terms of height and width values
		var tips = {
			bottomRight: [[0, 0], [width, height], [width, 0]],
			bottomLeft: [[0, 0], [width, 0], [0, height]],
			topRight: [[0, height], [width, 0], [width, height]],
			topLeft: [[0, 0], [0, height], [width, height]],
			topMiddle: [[0, height], [width / 2, 0], [width, height]],
			bottomMiddle: [[0, 0], [width, 0], [width / 2, height]],
			rightMiddle: [[0, 0], [width, height / 2], [0, height]],
			leftMiddle: [[width, 0], [width, height], [0, height / 2]]
		};
		tips.leftTop = tips.bottomRight;
		tips.rightTop = tips.bottomLeft;
		tips.leftBottom = tips.topRight;
		tips.rightBottom = tips.topLeft;

		return tips[corner];
	};

	// Border coordinates calculator
	function calculateBorders(radius) {
		var borders;

		// Use canvas element if supported
		if ($('<canvas>').get(0).getContext) {
			borders = {
				topLeft: [radius, radius], topRight: [0, radius],
				bottomLeft: [radius, 0], bottomRight: [0, 0]
			};
		}

		// Canvas not supported - Use VML (IE)
		else if ($.browser.msie) {
			borders = {
				topLeft: [-90, 90, 0], topRight: [-90, 90, -radius],
				bottomLeft: [90, 270, 0], bottomRight: [90, 270, -radius]
			};
		};

		return borders;
	};

	// BGIFRAME JQUERY PLUGIN ADAPTION
	//   Special thanks to Brandon Aaron for this plugin
	//   http://plugins.jquery.com/project/bgiframe
	function bgiframe() {
		var self, html, dimensions;
		self = this;
		dimensions = self.getDimensions();

		// Setup iframe HTML string
		html = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" ' +
         'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; ' +
         'height:' + dimensions.height + 'px; width:' + dimensions.width + 'px" />';

		// Append the new HTML and setup element reference
		self.elements.bgiframe = self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');
	};

	// Assign cache and event initialisation on document load
	$(document).ready(function () {
		// Setup library cache with window scroll and dimensions of document
		$.fn.qtip.cache = {
			screen: {
				scroll: { left: $(window).scrollLeft(), top: $(window).scrollTop() },
				width: $(window).width(),
				height: $(window).height()
			}
		};

		// Adjust positions of the tooltips on window resize or scroll if enabled
		var adjustTimer;
		$(window).bind('resize scroll', function (event) {
			clearTimeout(adjustTimer);
			adjustTimer = setTimeout(function () {
				// Readjust cached screen values
				if (event.type === 'scroll')
					$.fn.qtip.cache.screen.scroll = { left: $(window).scrollLeft(), top: $(window).scrollTop() };
				else {
					$.fn.qtip.cache.screen.width = $(window).width();
					$.fn.qtip.cache.screen.height = $(window).height();
				};

				for (i = 0; i < $.fn.qtip.interfaces.length; i++) {
					// Access current elements API
					var api = $.fn.qtip.interfaces[i];

					// Update position if resize or scroll adjustments are enabled
					if (api.status.rendered === true
               && (api.options.position.type !== 'static'
               || api.options.position.adjust.scroll && event.type === 'scroll'
               || api.options.position.adjust.resize && event.type === 'resize')) {
						// Queue the animation so positions are updated correctly
						api.updatePosition(event, true);
					}
				};
			}
         , 100);
		})

		// Hide unfocus toolipts on document mousedown
		$(document).bind('mousedown.qtip', function (event) {
			if ($(event.target).parents('div.qtip').length === 0) {
				$('.qtip[unfocus]').each(function () {
					var api = $(this).qtip("api");

					// Only hide if its visible and not the tooltips target
					if ($(this).is(':visible') && !api.status.disabled
               && $(event.target).add(api.elements.target).length > 1)
						api.hide(event);
				})
			};
		})
	});

	// Define qTip API interfaces array
	$.fn.qtip.interfaces = []

	// Define log and constant place holders
	$.fn.qtip.log = { error: function () { return this; } };
	$.fn.qtip.constants = {};

	// Define configuration defaults
	$.fn.qtip.defaults = {
		// Content
		content: {
			prerender: false,
			text: false,
			url: false,
			data: null,
			title: {
				text: false,
				button: false
			}
		},
		// Position
		position: {
			target: false,
			corner: {
				target: 'bottomRight',
				tooltip: 'topLeft'
			},
			adjust: {
				x: 0, y: 0,
				mouse: true,
				screen: false,
				scroll: true,
				resize: true
			},
			type: 'absolute',
			container: false
		},
		// Effects
		show: {
			when: {
				target: false,
				event: 'mouseover'
			},
			effect: {
				type: 'fade',
				length: 100
			},
			delay: 140,
			solo: false,
			ready: false
		},
		hide: {
			when: {
				target: false,
				event: 'mouseout'
			},
			effect: {
				type: 'fade',
				length: 100
			},
			delay: 0,
			fixed: false
		},
		// Callbacks
		api: {
			beforeRender: function () { },
			onRender: function () { },
			beforePositionUpdate: function () { },
			onPositionUpdate: function () { },
			beforeShow: function () { },
			onShow: function () { },
			beforeHide: function () { },
			onHide: function () { },
			beforeContentUpdate: function () { },
			onContentUpdate: function () { },
			beforeContentLoad: function () { },
			onContentLoad: function () { },
			beforeTitleUpdate: function () { },
			onTitleUpdate: function () { },
			beforeDestroy: function () { },
			onDestroy: function () { },
			beforeFocus: function () { },
			onFocus: function () { }
		}
	};

	$.fn.qtip.styles = {
		defaults: {
			background: 'white',
			color: '#111',
			overflow: 'hidden',
			textAlign: 'left',
			width: {
				min: 0,
				max: 250
			},
			padding: '5px 9px',
			border: {
				width: 1,
				radius: 0,
				color: '#d3d3d3'
			},
			tip: {
				corner: false,
				color: false,
				size: { width: 13, height: 13 },
				opacity: 1
			},
			title: {
				background: '#e1e1e1',
				fontWeight: 'bold',
				padding: '7px 12px'
			},
			button: {
				cursor: 'pointer'
			},
			classes: {
				target: '',
				tip: 'qtip-tip',
				title: 'qtip-title',
				button: 'qtip-button',
				content: 'qtip-content',
				active: 'qtip-active'
			}
		},
		cream: {
			border: {
				width: 3,
				radius: 0,
				color: '#F9E98E'
			},
			title: {
				background: '#F0DE7D',
				color: '#A27D35'
			},
			background: '#FBF7AA',
			color: '#A27D35',

			classes: { tooltip: 'qtip-cream' }
		},
		light: {
			border: {
				width: 3,
				radius: 0,
				color: '#E2E2E2'
			},
			title: {
				background: '#f1f1f1',
				color: '#454545'
			},
			background: 'white',
			color: '#454545',

			classes: { tooltip: 'qtip-light' }
		},
		dark: {
			border: {
				width: 3,
				radius: 0,
				color: '#303030'
			},
			title: {
				background: '#404040',
				color: '#f3f3f3'
			},
			background: '#505050',
			color: '#f3f3f3',

			classes: { tooltip: 'qtip-dark' }
		},
		red: {
			border: {
				width: 3,
				radius: 0,
				color: '#CE6F6F'
			},
			title: {
				background: '#f28279',
				color: '#9C2F2F'
			},
			background: '#F79992',
			color: '#9C2F2F',

			classes: { tooltip: 'qtip-red' }
		},
		green: {
			border: {
				width: 3,
				radius: 0,
				color: '#A9DB66'
			},
			title: {
				background: '#b9db8c',
				color: '#58792E'
			},
			background: '#CDE6AC',
			color: '#58792E',

			classes: { tooltip: 'qtip-green' }
		},
		blue: {
			border: {
				width: 3,
				radius: 0,
				color: '#ADD9ED'
			},
			title: {
				background: '#D0E9F5',
				color: '#5E99BD'
			},
			background: '#E5F6FE',
			color: '#4D9FBF',

			classes: { tooltip: 'qtip-blue' }
		}
	};
})(jQuery);

/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function ($) {
	$.fn.hoverIntent = function (f, g, filter) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 150,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g} : f);

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function (ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function (ev, ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ((Math.abs(pX - cX) + Math.abs(pY - cY)) < cfg.sensitivity) {
				$(ob).unbind("mousemove", track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob, [ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval);
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function (ev, ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob, [ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function (e) {
			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({}, e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// if e.type == "mouseenter"
			if (e.type == "mouseenter") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove", track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout(function () { compare(ev, ob); }, cfg.interval); }

				// else e.type == "mouseleave"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove", track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout(function () { delay(ev, ob); }, cfg.timeout); }
			}
		};

		// bind the function to the two event listeners
		if (filter)
			return $(this).on({
				'mouseenter': handleHover,
				'mouseleave': handleHover
			}, filter);
		else
			return this.bind('mouseenter', handleHover).bind('mouseleave', handleHover);
	};
})(jQuery);

/*
* Superfish v1.4.8 - jQuery menu widget
* Copyright (c) 2008 Joel Birch
*
* Dual licensed under the MIT and GPL licenses:
* 	http://www.opensource.org/licenses/mit-license.php
* 	http://www.gnu.org/licenses/gpl.html
*
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
*/

(function ($) {
	$.fn.superfish = function (op) {

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="', c.arrowClass, '"> &#187;</span>'].join('')),
			over = function () {
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function () {
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer = setTimeout(function () {
					o.retainPath = ($.inArray($$[0], o.$path) > -1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) { over.call(o.$path); }
				}, o.delay);
			},
			getMenu = function ($menu) {
				var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function ($a) { $a.addClass(c.anchorClass).append($arrow.clone()); };

		return this.each(function () {
			var s = this.serial = sf.o.length;
			var o = $.extend({}, sf.defaults, op);
			o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function () {
				$(this).addClass([o.hoverClass, c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;

			$('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function () {
				if (o.autoArrows) addArrow($('>a:first-child', this));
			})
			.not('.' + c.bcClass)
				.hideSuperfishUl();

			var $a = $('a', this);
			$a.each(function (i) {
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function () { over.call($li); }).blur(function () { out.call($li); });
			});
			o.onInit.call(this);

		}).each(function () {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function () {
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined)
			this.toggleClass(sf.c.shadowClass + '-off');
	};
	sf.c = {
		bcClass: 'sf-breadcrumb',
		menuClass: 'sf-js-enabled',
		anchorClass: 'sf-with-ul',
		arrowClass: 'sf-sub-indicator',
		shadowClass: 'sf-shadow'
	};
	sf.defaults = {
		hoverClass: 'sfHover',
		pathClass: 'overideThisToUse',
		pathLevels: 1,
		delay: 800,
		animation: { opacity: 'show' },
		speed: 'normal',
		autoArrows: false,
		dropShadows: false,
		disableHI: false, 	// true disables hoverIntent detection
		onInit: function () { }, // callback functions
		onBeforeShow: function () { },
		onShow: function () { },
		onHide: function () { }
	};
	$.fn.extend({
		hideSuperfishUl: function () {
			var o = sf.op,
				not = (o.retainPath === true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility', 'hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl: function () {
			var o = sf.op,
				sh = sf.c.shadowClass + '-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility', 'visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation, o.speed, function () { sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});
})(jQuery);

// Name:        RLMenuLinkStatus
// Author:      Seth Newton
// Date:        07/20/2010
// Description: Used for Site Dropdown Menus to display status message based on hovered link
(function ($) {
	$.fn.RLMenuLinkStatus = function (statusTextElement, settings) {

		var config = {
			'defaultMessage': ''
		};

		if (settings) $.extend(config, settings);

		this.each(function () {
			$(this).mouseenter(function (e) {
				var link = this;
				$(statusTextElement).each(function () { $(this).text($(link).attr("title")) });
			});
			$(this).mouseleave(function (e) {
				$(statusTextElement).each(function () { $(this).text(settings.defaultText) });
			});
		});

		return this;
	};
})(jQuery);

(function ($) {
    $.fn.enable = function () {
        $(this).removeAttr("disabled");
        $(this).removeClass("disabled");
    }

    $.fn.disable = function () {
        $(this).attr("disabled", "disabled");
        $(this).addClass("disabled");
    }
})(jQuery);

String.prototype.contains = function (str) {
	return this.indexOf(str) >= 0;
};

String.prototype.trim = function () {
	if (this == undefined || this == null)
		return "";
	else
		return this.replace(/^\s+|\s+$/g, "");
};

String.prototype.ltrim = function () {
	if (this == undefined || this == null)
		return "";
	else
		return this.replace(/^\s+/, "");
};

String.prototype.rtrim = function () {
	if (this == undefined || this == null)
		return "";
	else
		return this.replace(/\s+$/, "");
};

String.prototype.compareTo = function (value) {
	if (value == undefined || value == null)
		return false;
	else
		return this.toLowerCase().trim() == value.toLowerCase().trim();
};

String.prototype.format = function () {
	var s = this,
	i = arguments.length;

	if (i == 1 && arguments[0] instanceof Array) {
		arguments = arguments[0];
		i = arguments.length;
	}

	while (i--) {
		s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
	}
	return s;
};

String.prototype.clean = function () {
	var s = this;
	s = s.trim();
	s = s.replace(/[\s-]/g, "");
	s = s.toUpperCase();
	return s;
};

function StringBuilder() {
	var values = [];

	return {
		append: function (value, delim) {
			if (values.length > 0 & delim)
				values.push(delim + value);
			else
				values.push(value);
		},
		appendFormat: function () {
			var i = arguments.length;
			if (i > 0) {
				var s = arguments[0];
				var array = new Array();
				for (var count = 1; count < arguments.length; count++) {
					array[count - 1] = arguments[count];
				}
				values.push(s.format(array));
			} else {
				values.push(arguments[0]);
			}
		},
		toString: function () {
			return values.join('');
		},
		length: function () {
			return values.join('').length;
		}
	};
}

(function ($) {
	var methods =
	{
		phone: function () {
			var _this = $(this);

			if (_this.val() == "")
				return true;
			else
				return _this.val().match(/^\(\d{3}\)\s\d{3}\-\d{4}$/g);
		},
		email: function () {
			var _this = $(this);
			var value = _this.val();

			if (value == "")
				return true;

			var emailRegEx = /^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[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,}))$/;
			var emailArray = value.split(",");

			for (var e in emailArray) {
				var email = emailArray[e].replace(/ /g, "");

				if (!email.match(emailRegEx)) {
					return false;
				}
			}
			return true;
		},
		zip: function (options) {
			var _this = $(this);
			var value = _this.val();

			if (value == undefined || value.trim() == "")
				return true;

			var expr = /(^\d{5}(-\d{4})?$)|(^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d$)/;

			if (options) {
				switch (options.format.toUpperCase()) {
					case "USA5":
						expr = /^\d{5}$/;
						break;
					case "USA+4":
						expr = /^\d{5}(-\d{4})?$/;
						break;
					case "CAN":
						expr = /^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d$/;
						break;
				}
			}

			if (value.match(expr))
				return true;
			else
				return false;
		}
	};

	$.fn.validate = function (method) {
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else {
			$.error('Method ' + method + ' does not exist on jQuery.tooltip');
		}
	};
})(jQuery);

(function ($) {

	var methods =
	{
		init: function () {
			return $(this).bind("change", methods.format);
		},
		format: function () {
			var _this = $(this);

			return _this.each(function () {
				switch (_this.data("format")) {
					case "phone":
						var _me = $(this);
						var p = _me.val();
						var c = p.replace(/[^0-9]/g, "");

						if (c.length == 10) {
							var 
								acd = c.substring(0, 3),
								pfx = c.substring(3, 6),
								sfx = c.substring(6);

							c = "(" + acd + ") " + pfx + "-" + sfx;
							_me.val(c);
						}
						break;
					case "zip":
						var value = _this.val().clean();
						if (value.length == 9) {
							value = "{0}-{1}".format(value.substring(0, 5), value.substring(5));
						}
						_this.val(value);
						break;
				}
			});
		}
	};

	$.fn.phoneNumber = function (method) {
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else if (typeof method === 'object' || !method) {
			$(this).data("format", "phone");
			return methods.init.apply(this, arguments);
		}
		else {
			$.error('Method ' + method + ' does not exist on jQuery.tooltip');
		}
	};

	$.fn.zipCode = function (method) {
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		}
		else if (typeof method === 'object' || !method) {
			$(this).data("format", "zip");
			return methods.init.apply(this, arguments);
		}
		else {
			$.error('Method ' + method + ' does not exist on jQuery.tooltip');
		}
	};
})(jQuery);

(function ($) {
	var oldHTML = $.fn.html;

	$.fn.formhtml = function () {
		if (arguments.length) return oldHTML.apply(this, arguments);
		$("input,button", this).each(function () {
			this.setAttribute('value', this.value);
		});
		$("textarea", this).each(function () {
			// updated - thanks Raja!
			this.innerHTML = this.value;
		});
		$("input:radio,input:checkbox", this).each(function () {
			// im not really even sure you need to do this for "checked"
			// but what the heck, better safe than sorry
			if (this.checked) this.setAttribute('checked', 'checked');
			else this.removeAttribute('checked');
		});
		$("option", this).each(function () {
			// also not sure, but, better safe...
			if (this.selected) this.setAttribute('selected', 'selected');
			else this.removeAttribute('selected');
		});
		return oldHTML.apply(this);
	};

	//optional to override real .html() if you want
	// $.fn.html = $.fn.formhtml;
})(jQuery);

/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Version 2.1.2
*/
(function (a) { a.fn.bgiframe = (a.browser.msie && /msie 6\.0/i.test(navigator.userAgent) ? function (d) { d = a.extend({ top: "auto", left: "auto", width: "auto", height: "auto", opacity: true, src: "javascript:false;" }, d); var c = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + d.src + '"style="display:block;position:absolute;z-index:-1;' + (d.opacity !== false ? "filter:Alpha(Opacity='0');" : "") + "top:" + (d.top == "auto" ? "expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')" : b(d.top)) + ";left:" + (d.left == "auto" ? "expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')" : b(d.left)) + ";width:" + (d.width == "auto" ? "expression(this.parentNode.offsetWidth+'px')" : b(d.width)) + ";height:" + (d.height == "auto" ? "expression(this.parentNode.offsetHeight+'px')" : b(d.height)) + ';"/>'; return this.each(function () { if (a(this).children("iframe.bgiframe").length === 0) { this.insertBefore(document.createElement(c), this.firstChild) } }) } : function () { return this }); a.fn.bgIframe = a.fn.bgiframe; function b(c) { return c && c.constructor === Number ? c + "px" : c } })(jQuery);

// numeric jquery plug-in
(function ($) {
	$.fn.numeric = function () {
		var _this = $(this);
		_this.live("keypress", function (e) {
			var key = e.charCode || e.keyCode || 0;
			// allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
			//alert(key.toString());
			return ((key == 46 && !($(this).val().contains("."))) || (key >= 48 && key <= 57) || ($.browser.mozilla && (key > 7 && key < 10)));
		});
	};
})(jQuery);


function isMobileBrowser() {
	return (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
}

/*!
* jQuery UI 1.8.21
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function ($, undefined) {

	// prevent duplicate loading
	// this is only a problem because we proxy existing functions
	// and we don't want to double proxy them
	$.ui = $.ui || {};
	if ($.ui.version) {
		return;
	}

	$.extend($.ui, {
		version: "1.8.21",

		keyCode: {
			ALT: 18,
			BACKSPACE: 8,
			CAPS_LOCK: 20,
			COMMA: 188,
			COMMAND: 91,
			COMMAND_LEFT: 91, // COMMAND
			COMMAND_RIGHT: 93,
			CONTROL: 17,
			DELETE: 46,
			DOWN: 40,
			END: 35,
			ENTER: 13,
			ESCAPE: 27,
			HOME: 36,
			INSERT: 45,
			LEFT: 37,
			MENU: 93, // COMMAND_RIGHT
			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,
			SHIFT: 16,
			SPACE: 32,
			TAB: 9,
			UP: 38,
			WINDOWS: 91 // COMMAND
		}
	});

	// plugins
	$.fn.extend({
		propAttr: $.fn.prop || $.fn.attr,

		_focus: $.fn.focus,
		focus: function (delay, fn) {
			return typeof delay === "number" ?
			this.each(function () {
				var elem = this;
				setTimeout(function () {
					$(elem).focus();
					if (fn) {
						fn.call(elem);
					}
				}, delay);
			}) :
			this._focus.apply(this, arguments);
		},

		scrollParent: function () {
			var scrollParent;
			if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
				scrollParent = this.parents().filter(function () {
					return (/(relative|absolute|fixed)/).test($.curCSS(this, 'position', 1)) && (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1));
				}).eq(0);
			} else {
				scrollParent = this.parents().filter(function () {
					return (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1));
				}).eq(0);
			}

			return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
		},

		zIndex: function (zIndex) {
			if (zIndex !== undefined) {
				return this.css("zIndex", zIndex);
			}

			if (this.length) {
				var elem = $(this[0]), position, value;
				while (elem.length && elem[0] !== document) {
					// Ignore z-index if position is set to a value where z-index is ignored by the browser
					// This makes behavior of this function consistent across browsers
					// WebKit always returns auto if the element is positioned
					position = elem.css("position");
					if (position === "absolute" || position === "relative" || position === "fixed") {
						// IE returns 0 when zIndex is not specified
						// other browsers return a string
						// we ignore the case of nested elements with an explicit value of 0
						// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
						value = parseInt(elem.css("zIndex"), 10);
						if (!isNaN(value) && value !== 0) {
							return value;
						}
					}
					elem = elem.parent();
				}
			}

			return 0;
		},

		disableSelection: function () {
			return this.bind(($.support.selectstart ? "selectstart" : "mousedown") +
			".ui-disableSelection", function (event) {
				event.preventDefault();
			});
		},

		enableSelection: function () {
			return this.unbind(".ui-disableSelection");
		}
	});

	$.each(["Width", "Height"], function (i, name) {
		var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"],
		type = name.toLowerCase(),
		orig = {
			innerWidth: $.fn.innerWidth,
			innerHeight: $.fn.innerHeight,
			outerWidth: $.fn.outerWidth,
			outerHeight: $.fn.outerHeight
		};

		function reduce(elem, size, border, margin) {
			$.each(side, function () {
				size -= parseFloat($.curCSS(elem, "padding" + this, true)) || 0;
				if (border) {
					size -= parseFloat($.curCSS(elem, "border" + this + "Width", true)) || 0;
				}
				if (margin) {
					size -= parseFloat($.curCSS(elem, "margin" + this, true)) || 0;
				}
			});
			return size;
		}

		$.fn["inner" + name] = function (size) {
			if (size === undefined) {
				return orig["inner" + name].call(this);
			}

			return this.each(function () {
				$(this).css(type, reduce(this, size) + "px");
			});
		};

		$.fn["outer" + name] = function (size, margin) {
			if (typeof size !== "number") {
				return orig["outer" + name].call(this, size);
			}

			return this.each(function () {
				$(this).css(type, reduce(this, size, true, margin) + "px");
			});
		};
	});

	// selectors
	function focusable(element, isTabIndexNotNaN) {
		var nodeName = element.nodeName.toLowerCase();
		if ("area" === nodeName) {
			var map = element.parentNode,
			mapName = map.name,
			img;
			if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") {
				return false;
			}
			img = $("img[usemap=#" + mapName + "]")[0];
			return !!img && visible(img);
		}
		return (/input|select|textarea|button|object/.test(nodeName)
		? !element.disabled
		: "a" == nodeName
			? element.href || isTabIndexNotNaN
			: isTabIndexNotNaN)
		// the element and all of its ancestors must be visible
		&& visible(element);
	}

	function visible(element) {
		return !$(element).parents().andSelf().filter(function () {
			return $.curCSS(this, "visibility") === "hidden" ||
			$.expr.filters.hidden(this);
		}).length;
	}

	$.extend($.expr[":"], {
		data: function (elem, i, match) {
			return !!$.data(elem, match[3]);
		},

		focusable: function (element) {
			return focusable(element, !isNaN($.attr(element, "tabindex")));
		},

		tabbable: function (element) {
			var tabIndex = $.attr(element, "tabindex"),
			isTabIndexNaN = isNaN(tabIndex);
			return (isTabIndexNaN || tabIndex >= 0) && focusable(element, !isTabIndexNaN);
		}
	});

	// support
	$(function () {
		var body = document.body,
		div = body.appendChild(div = document.createElement("div"));

		// access offsetHeight before setting the style to prevent a layout bug
		// in IE 9 which causes the elemnt to continue to take up space even
		// after it is removed from the DOM (#8026)
		div.offsetHeight;

		$.extend(div.style, {
			minHeight: "100px",
			height: "auto",
			padding: 0,
			borderWidth: 0
		});

		$.support.minHeight = div.offsetHeight === 100;
		$.support.selectstart = "onselectstart" in div;

		// set display to none to avoid a layout bug in IE
		// http://dev.jquery.com/ticket/4014
		body.removeChild(div).style.display = "none";
	});





	// deprecated
	$.extend($.ui, {
		// $.ui.plugin is deprecated.  Use the proxy pattern instead.
		plugin: {
			add: function (module, option, set) {
				var proto = $.ui[module].prototype;
				for (var i in set) {
					proto.plugins[i] = proto.plugins[i] || [];
					proto.plugins[i].push([option, set[i]]);
				}
			},
			call: function (instance, name, args) {
				var set = instance.plugins[name];
				if (!set || !instance.element[0].parentNode) {
					return;
				}

				for (var i = 0; i < set.length; i++) {
					if (instance.options[set[i][0]]) {
						set[i][1].apply(instance.element, args);
					}
				}
			}
		},

		// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
		contains: function (a, b) {
			return document.compareDocumentPosition ?
			a.compareDocumentPosition(b) & 16 :
			a !== b && a.contains(b);
		},

		// only used by resizable
		hasScroll: function (el, a) {

			//If overflow is hidden, the element might have extra content, but the user wants to hide it
			if ($(el).css("overflow") === "hidden") {
				return false;
			}

			var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop",
			has = false;

			if (el[scroll] > 0) {
				return true;
			}

			// TODO: determine which cases actually cause this to happen
			// if the element doesn't have the scroll set, see if it's possible to
			// set the scroll
			el[scroll] = 1;
			has = (el[scroll] > 0);
			el[scroll] = 0;
			return has;
		},

		// these are odd functions, fix the API or move into individual plugins
		isOverAxis: function (x, reference, size) {
			//Determines when x coordinate is over "b" element axis
			return (x > reference) && (x < (reference + size));
		},
		isOver: function (y, x, top, left, height, width) {
			//Determines when x, y coordinates is over "b" element
			return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
		}
	});

})(jQuery);

(function ($) {
	$.fn.extend({
		limit: function (limit, element) {

			var interval, f;
			var self = $(this);

			$(this).focus(function () {
				interval = window.setInterval(substring, 100);
			});

			$(this).blur(function () {
				clearInterval(interval);
				substring();
			});

			substringFunction = "function substring(){ var val = $(self).val();var length = val.length;if(length > limit){$(self).val($(self).val().substring(0,limit));}";
			if (typeof element != 'undefined')
				substringFunction += "if($(element).html() != limit-length){$(element).html((limit-length<=0)?'0':limit-length);}"

			substringFunction += "}";

			eval(substringFunction);



			substring();

		}
	});
})(jQuery);;
var currentControl;

//##Initialize
$(document).ready(init);
function init() {
    // this must be the first call in the init function.
    if (!window.console) {
        window.console = {
            log: function () { }
        };
    }

    // Initialize AJAX based on browser
    InitAJAX();
    // DO NOT EDIT THIS METHOD ABOVE THIS LINE //
    Check_Mobile_Direction();

    // Init lock icons
	InitLocks();
    // Initialize initially hidden controls
    InitHideOnLoad();
    // Init Input Validation for content
    InitTextValidation();
    // Initialize Superfish menu
    InitSuperFish();
    // Add Current control handlers
    InitCurrentControl();
    //sets textbox value for search box
    inputFocus();
    //init Default.aspx accordian
    initializeAccordianTools();
    //Allows Main Menu to Display Hover Text
    initializeMainMenu();
    // Initlalize family bar
    InitFamilyBar();
    // Init Pop-up Links to open rel="_blank|external" in a new window.
    InitPopupLinks();
    // Initialize validation for required fields
    InitRequiredFieldValidation();
    // Init Expand Collapse items
    InitExpandCollapse();
    // Initialize links to self
    InitSelfLinks();
    // Init Rate quote sidebar
    InitRateQuoteSidebar();
    // Init switch history info
    $(".history-nav li a").click(switchHistoryInfo);
    // Init PNG Fix
    InitPngFix();
    // Init BGI Frame
    InitBGIFrame();
    // Init iOS static footer fix
    InitStaticFooterIOS();
    // Init Login Box
    InitLoginBox();
    // Init default buttons
    initDefaultButtons();
    // init notification boxes
    initNotifications();
    // Disable Apostrophes
    //disableApostrophes();

    // Init Search box
	initFreeFindSearch();

	// Init The signup email in the site footer
	initSignUpEmail();

    $(".numeric").numeric();
}

function Check_Mobile_Direction(e) {
    var cookie = Get_Cookie("mobile_check")
    overRideCookie = Get_Cookie("mobile_check_override"),
        redirect = "false",
        referrer = document.referrer,
        mobileURL = $("#MobileSiteURL").val(),
        domain = $("#SiteDomain").val();

    //if the setting fails send them to prod.
    if (mobileURL == undefined || mobileURL == null || mobileURL == "") {
        mobileURL = "http://m.rlcarriers.com";
    }
    if (isMobileBrowser()) {
        //Check the referer. If we just came from the mobile site, we do not want to redirect from the main site back.
        if (referrer.contains("m.rlcarriers")) {
            //The override will last for one hour.
            Set_Cookie("mobile_check_override", "true", 1, undefined, domain);
            overRideCookie = "true";
        }

        if (overRideCookie == null)
            overRideCookie = "false"

        if (cookie == null) {
            //Set the cookie based upon the user choice.
            if (confirm("Would you like to use our mobile shipping tools?"))
                redirect = "true";
            Set_Cookie("mobile_check", redirect, 4320, undefined, domain);
        }
        else
            redirect = cookie;
        if (redirect == "true" && overRideCookie == "false")
            window.location = mobileURL;
    }
}

function Get_Cookie(check_name) {
    // first we'll split this cookie up into name/value pairs
    // note: document.cookie only returns name=value, not the other components
    var a_all_cookies = document.cookie.split(';');
    var a_temp_cookie = '';
    var cookie_name = '';
    var cookie_value = '';
    var b_cookie_found = false; // set boolean t/f default f
    var i = '';

    for (i = 0; i < a_all_cookies.length; i++) {
        // now we'll split apart each name=value pair
        a_temp_cookie = a_all_cookies[i].split('=');

        // and trim left/right whitespace while we're at it
        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

        // if the extracted name matches passed check_name
        if (cookie_name == check_name) {
            b_cookie_found = true;
            // we need to handle case where cookie has no value but exists (no = sign, that is):
            if (a_temp_cookie.length > 1) {
                cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, ''));
            }
            // note that in cases where cookie is initialized but no value, null is returned
            return cookie_value;
            break;
        }
        a_temp_cookie = null;
        cookie_name = '';
    }
    if (!b_cookie_found) {
        return null;
    }
}

/*
only the first 2 parameters are required, the cookie name, the cookie
value. Cookie time is in milliseconds, so the below expires will make the 
number you pass in the Set_Cookie function call the number of days the cookie
lasts, if you want it to be hours or minutes, just get rid of 24 and 60.

Generally you don't need to worry about domain, path or secure for most applications
so unless you need that, leave those parameters blank in the function call.
*/
function Set_Cookie(name, value, expires, path, domain, secure) {
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime(today.getTime());
    // if the expires variable is set, make the correct expires time, the
    // current script below will set it for x number of days, to make it
    // for hours, delete * 24, for minutes, delete * 60 * 24
    if (expires) {
        expires = expires * 1000 * 60 * 60;
    }
    var expires_date = new Date(today.getTime() + (expires));

    document.cookie = name + "=" + escape(value) +
        ((expires) ? ";expires=" + expires_date.toGMTString() : "") + //expires.toGMTString()
        ((path) ? ";path=" + path : "") +
        ((domain) ? ";domain=" + domain : "") +
        ((secure) ? ";secure" : "");
}

function Delete_Cookie(name, path, domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ((path) ? ";path=" + path : "") +
        ((domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function InitLocks() {

	$.ajax({
		type: "POST",
		url: "/Proxy.aspx/IsAuthenticated",
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: function (result) {
			if (result.d) {
				$(".myrlc-image").addClass("unlock");
				$(".myrlc-image").attr("src", "/images/myrlc-unlock.png");
				$(".secure").addClass("unsecure");
			}
		}
	});

}

function InitTextValidation() {
    $("input[type=text], textarea").blur(function () {
        // validate text
        if ($(this).val().match("(\<(/?[^\>]+)\>)")) {
            alert("The value you entered is not valid.");
            $(this).select().focus();
            return false;
        }
    });

    $("#fax-number").blur(function () {
        var fax = $(this).val();
        if (isValidPhone(fax)) {
            $(this).val(formatPhone(fax));
        }
    });
}

function InitAJAX() {
    $.ajaxSetup({
        xhr: function () {
            if ($.browser.msie) {
                return new ActiveXObject("Microsoft.XMLHTTP");
            } else {
                return new XMLHttpRequest();
            }
        }
    });
}

function InitHideOnLoad() {
    $(".hide-on-load").hide().removeClass("hide-on-load");
    $(".hide").hide().removeClass("hide");
}

function InitSuperFish() {
    //Superfish menu
    $("ul.sf-menu").superfish({ delay: 200 });
}

function InitCurrentControl() {
    $("input:not(.calculated), textarea, select").live("focus", function () {
        currentControl = $(this);
        $(this).addClass("shade");
    });

    $("input:not(.calculated), textarea, select").live("blur", function () {
        $(this).removeClass("shade");
    });
}

function InitPopupLinks() {
    // open new window for anchors with rel="_blank|external"
    $("a[rel='_blank'],a[rel='external']").click(function () {
        this.target = "_blank";
    });
}

function InitRequiredFieldValidation() {
    //Form required validation
    $('.btnSubmit').click(function () {
        //Clear Error Message field
        ClearErrorMessages();

        //new
        $('.ddRequired, .required, .email, .phone-number').each(function () {
            var _this = $(this);

            if (_this.attr("disabled") != true) {
                if (_this.is("select.required") || _this.is(".ddRequired")) {
                    var selectedValue = _this.children("option:selected").val();
                    if (selectedValue == undefined || selectedValue == null || selectedValue.trim() == "" || selectedValue == "Select...") {
                        ShowValidationIcon(_this, true);
                    }
                }
                else if (_this.is(".required")) {
                    if (_this.val() == "" || _this.val() == "Select...") {
                        ShowValidationIcon(_this, true);
                    }
                }
                if (_this.is(".email, .required.email") && !_this.validate("email")) {
                    AppendErrorMessage("[CONTROLNAME] - " + _this.val() + " is not a valid email address.", _this);
                    ShowValidationIcon(_this);
                }
                if ((_this.is(".phone-number,.required.phone-number")) && !_this.validate("phone")) {
                    AppendErrorMessage("[CONTROLNAME] - " + _this.val() + " is not a valid phone number.", _this);
                    ShowValidationIcon(_this);
                }
            }
        });

        if (HasErrors()) {
            ShowErrorPanels();
            return false;
        }

        return true;
    });

    $('.required').focus(function (e) {
        if ($(this).attr("valid") == "false") {
            $(this).removeAttr("valid");
            HideValidationIcon($(this));
            if ($(this).val() == "Required") {
                $(this).val("").focus();
            }
        }
    });

    $('.ddRequired').focus(function () {
        if ($(this).attr("valid") == "false") {
            $(this).removeAttr("valid");
            HideValidationIcon($(this));
            if ($(this).val() == "Required") {
                $(this).val("");
            }
        }
    });
}

function InitExpandCollapse() {
    //Expand Show DL - DD values
    $('#Expand').click(function (e) {
        e.preventDefault();
        e.stopPropagation();
        $("dd").css("display", "block");
    });
    $('#Collapse').click(function (e) {
        e.preventDefault();
        e.stopPropagation();
        $("dd").css("display", "none");
    });
}

function InitSelfLinks() {
    $(".self-link").attr("href", document.location);
}

function InitRateQuoteSidebar() {
    $(".rq-sidebar-submit").click(ValidateRateQuote_Sidebar);
}

function InitPngFix() {
    $(document).pngFix();
}

function InitBGIFrame() {
    $("ul.sf-menu").superfish().find('ul').bgIframe({ opacity: true });
    $('#address-book-container, .fsi-container, #template-container, #darkenScreenObject').bgiframe();
}

function InitStaticFooterIOS() {
    if (navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') {
        $("#footer").css("position", "static");
    };
}

function InitLoginBox() {
    $('#new-login-box').find('input.username').qtip({
        content: 'Log in to MyRLC to enjoy a personalized web experience. If this is your first time logging in to our new site, your password will be in ALL CAPS and your username is case sensitive.',
        //style: 'mystyle',
        position: { corner: { tooltip: 'topMiddle' } },
        hide: { when: 'mouseout', fixed: true }
    });

    $('.tool-container').find('input.username').qtip({
        content: 'Log in to MyRLC to enjoy a personalized web experience. If this is your first time logging in to our new site, your password will be in ALL CAPS and your username is case sensitive.',
        //style: 'mystyle',
        position: { corner: { tooltip: 'bottomLeft' } },
        hide: { when: 'mouseout', fixed: true }
    });


    $("input.username, input.password").focus(function () {
		$("#ctl00_PnlLoginError").hide();
	});
}

function initHiddenObjects() {
    // Will hide objects that are to be hidden on initial load.
    $(".hide").hide().removeClass("hide");
}
//#end

//family bar global vars
var familyBarTimeoutID = null;
var closeTimeout = 500;

function InitFamilyBar() {
    //Family bar toggle
    //rlcarriers hover
    $('.rlcarriers').hoverIntent(activateRLC, function () { });
    $('.rlcarriers').bind("mouseout", deactivateRLC);
    $('#familybar-dropdown').bind("mouseover", keepRLCActive);
    $('#familybar-dropdown').bind("mouseout", deactivateRLC);
    //rlglobal hover
    $('.rlglobal').hoverIntent(activateRLGlobal, function () { });
    $('.rlglobal').bind("mouseout", deactivateRLGlobal);
    $('#familybar-dropdown-2').bind("mouseover", keepRLGlobalActive);
    $('#familybar-dropdown-2').bind("mouseout", deactivateRLGlobal);
    //rltruckload hover
    $('.rltruckload').hoverIntent(activateRLTruckload, function () { });
    $('.rltruckload').bind("mouseout", deactivateRLTruckload);
    $('#familybar-dropdown-3').bind("mouseover", keepRLTruckloadActive);
    $('#familybar-dropdown-3').bind("mouseout", deactivateRLTruckload);

    // initialize click events on family bar main links.
    $("a#rlcarriers, a#rlglobal, a#rltruckload").bind("click", function (e) {
        Stop(e);
    });
}

//##RL Carriers hover
function activateRLC(e) {
    if (familyBarTimeoutID != null) {
        clearTimeout(familyBarTimeoutID);
    }
    closeRLGlobal();
    closeRLTruckload();
    $('#familybar-dropdown').css("display", "block");
    $('.rlcarriers').children("a").addClass("RLCActive");
}

function deactivateRLC(e) {
    familyBarTimeoutID = setTimeout(closeRLC, closeTimeout);
}

function keepRLCActive(e) {
    clearTimeout(familyBarTimeoutID);
    familyBarTimeoutID = null;
}

function closeRLC(e) {
    $('#familybar-dropdown').css("display", "none");
    $('.rlcarriers').children("a").removeClass("RLCActive");
}
//#end

//##RL Global hover
function activateRLGlobal(e) {
    if (familyBarTimeoutID != null) {
        clearTimeout(familyBarTimeoutID);
    }
    closeRLC();
    closeRLTruckload();
    $('#familybar-dropdown-2').css("display", "block");
    $('.rlglobal').children("a").addClass("RLGActive");
}

function deactivateRLGlobal(e) {
    familyBarTimeoutID = setTimeout(closeRLGlobal, closeTimeout);
}

function keepRLGlobalActive(e) {
    clearTimeout(familyBarTimeoutID);
    familyBarTimeoutID = null;
}

function closeRLGlobal(e) {
    $('#familybar-dropdown-2').css("display", "none");
    $('.rlglobal').children("a").removeClass("RLGActive");
}
//#end

//##RL Truckload hover
function activateRLTruckload(e) {
    if (familyBarTimeoutID != null) {
        clearTimeout(familyBarTimeoutID);
    }
    closeRLGlobal();
    closeRLC();
    $('#familybar-dropdown-3').css("display", "block");
    $('.rltruckload').children("a").addClass("RLTActive");
}

function deactivateRLTruckload(e) {
    familyBarTimeoutID = setTimeout(closeRLTruckload, closeTimeout);
}

function keepRLTruckloadActive(e) {
    clearTimeout(familyBarTimeoutID);
    familyBarTimeoutID = null;
}

function closeRLTruckload(e) {
    $('#familybar-dropdown-3').css("display", "none");
    $('.rltruckload').children("a").removeClass("RLTActive");
}
//#end

//##input title click
function inputFocus(e) {
    $('#ctl00_MainMenu_txtsearch').each(function () {
        this.value = $(this).attr('title');
        $(this).addClass('text-label1');
        $(this).focus(function () {
            if (this.value == $(this).attr('title')) {
                this.value = '';
                $(this).removeClass('text-label1');
            }
        });
        $(this).blur(function () {
            if (this.value == '') {
                this.value = $(this).attr('title');
                $(this).addClass('text-label1');
            }
        });
    });

    $('.login-input-form').each(function () {
        if ($(this).val() != '') {
            $(this).addClass("no-background");
        }
        $(this).focus(function () {
            if (!$(this).hasClass("no-background")) {
                $(this).addClass("no-background");
            }
        });
        $(this).blur(function () {
            if ($(this).val() == "") {
                $(this).removeClass("no-background");
            }
        });
    });

    $('.change-input').each(function () {
        this.value = $(this).attr('title');
        $(this).addClass('text-label1');
        $(this).focus(function () {
            if (this.value == $(this).attr('title')) {
                this.value = '';
                $(this).removeClass('text-label1');
            }
        });
        $(this).blur(function () {
            if (this.value == '') {
                this.value = $(this).attr('title');
                $(this).addClass('text-label1');
            }
        });
    });
}

//##tools accordion
function initializeAccordianTools(e) {
    $("#tools").show();
    $("#tools").accordion();

    // /images/arrowDown_12pt_666666.gif
    // /images/arrowRight_12pt_666666.gif

    $('#tools').bind('accordionchangestart', function (event, ui) {
        ui.oldHeader.children("img").attr("src", "/images/arrowRight_12pt_666666.gif");
        ui.newHeader.children("img").attr("src", "/images/arrowDown_12pt_666666.gif");
    });

    $('#tools h3.link').unbind("click").bind('click', function () {
        var rel = $(this).attr("rel");
        if (rel != undefined && rel != "") {
            document.location.href = rel;
        }
    });

    $(".btnStSubmit").bind("click", function () { TrackMe("/successful-shipment-trace/homepage"); });
}
//#end

//##Click Handlers
//add click handler for Pickup Request
$("#tool-pickuprequest").click(function () {
    $("#tools").accordion('disable');
    $(location).attr('href', '/freight/shipping/pickup-request');
});

//add click handler for Bill Of Lading
$("#tool-billoflading").click(function () {
    $("#tools").accordion('disable');
    $(location).attr('href', '/freight/shipping/bill-of-lading');
});
//#end

//## AJAX call
function AJAXCall(JSON, WebURL, Success, Failure, Context) {
    var xhr = $.ajax({
        type: "POST",
        url: WebURL,
        data: "{" + JSON + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: Success,
        error: Failure,
        context: Context // Will be context of callback.  Reference using $(this)
    });

    return xhr;
}

//Added this call to allow a stringify'd object to be passed, the extra
// {'s in the AJAXCall were causing it to fail.
function AJAXCallJSONObject(JSON, WebURL, Success, Failure, Context) {
    var xhr = $.ajax({
        type: "POST",
        url: WebURL,
        data: JSON,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: Success,
        error: Failure,
        context: Context // Will be context of callback.  Reference using $(this)
    });

    return xhr;
}
//#end

//##Validation
//returns false if any included string is not a valid email
function isValidEmail(emailStr) {
    if (!emailStr.length) {
        return false;
    }

    var emailRegEx = /^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[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,}))$/;
    EmailArray = emailStr.split(",");

    for (var e in EmailArray) {
        var email = EmailArray[e].trim();

        if (!email.match(emailRegEx)) {
            return false;
        }
    }
    return true;
}

//returns false if any included string is not a valid phone number
function isValidPhone(phoneStr) {
    var phoneRegEx = /^((\(\d{3}\)\s?)|(\d{3}-))?\d{3}-\d{4}$|^\d{10}$/;
    PhoneArray = phoneStr.split(",");

    for (var p in PhoneArray) {
        var phone = PhoneArray[p].replace(/ /g, "");

        if (!phone.match(phoneRegEx)) {
            return false;
        }
    }
    return true;
}

function formatPhone(phoneNumber) {
    phoneNumber = phoneNumber.replace(/[^0-9]/g, "");
    if (phoneNumber.length == 10) {
        var
            areaCode = phoneNumber.substring(0, 3),
            prefix = phoneNumber.substring(3, 6),
            suffix = phoneNumber.substring(6);

        return "(" + areaCode + ") " + prefix + "-" + suffix;
    }
    else {
        return phoneNumber;
    }
}

function GetTimeComparison(formattedTime) {
    formattedTime = String(formattedTime);
    var ampm = formattedTime.substring(formattedTime.length - 2, formattedTime.length);
    var alteredTime = formattedTime.replace(":", "").replace(ampm, "").replace(" ", "");
    alteredTime = parseInt(alteredTime);
    if (ampm.toLowerCase() == "pm" && alteredTime < 1200) {
        alteredTime += 1200;
    }
    return alteredTime;
}

function isUSCanadaZip(zipCode) {
    return zipCode.match(/^\d{5}(-\d{4})?$|^[a-zA-Z][0-9][a-zA-Z]\s?[0-9][a-zA-Z][0-9]$/);
}

function isUSZip(zipCode) {
    return zipCode.match(/^\d{5}(-\d{4})?$/);
}

function isCanadaZip(zipCode) {
    return zipCode.match(/^[a-zA-Z][0-9][a-zA-Z]\s?[0-9][a-zA-Z][0-9]$/);
}

function IsNumeric(val) {
    var expr = /[0-9.,]*/;
    return expr.test(val);
}

// Check if string is a whole number(digits only).
function isWhole(s) {
    var regExWholeNumber = /^\s*\d+\s*$/;
    return String(s).search(regExWholeNumber) != -1
}

function getRegExFromFormat(format) {
    var expr = /^.*$/;

    if (format == "NNNNN") {
        expr = /^\d{5}(-\d{4})?$/
    }
    else {
        format = format.replace(/N/g, "[0-9]");
        format = format.replace(/A/g, "[A-Za-z]");
        expr = new RegExp(format);
    }

    return expr;
}

var reg_PR_zip = /00[679]\d{2}([ \-]\d{4})?/;
var reg_GU_zip = /969[123]\d([ \-]\d{4})?/;
var reg_VI_zip = /008(([0-4]\d)|(5[01]))([ \-]\d{4})?/;

var reg_US_zip = /\d{5}([ \-]\d{4})?/;
var reg_CA_zip = /[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d/;

function validateZip(country, zip) {

    var result = false;
    switch (country) {
        case "DOM":
        case "USA": result = reg_US_zip.test(zip) && !reg_PR_zip.test(zip) && !reg_GU_zip.test(zip) && !reg_VI_zip.test(zip);
            break;
        case "CAN": result = reg_CA_zip.test(zip);
            break;
        case "PRI": result = reg_PR_zip.test(zip);
            break;
        case "GUM": result = reg_GU_zip.test(zip);
            break;
        case "VIR": result = reg_VI_zip.test(zip);
            break;
        default:

    }
    return result;
}

function ValidateZipFormat(countryControl, zipControl) {
    var countryValues = $(countryControl).val();

    // no country selected, do not validate (the required fields will pick this up
    if (countryValues == undefined || !countryValues.contains("_"))
        return true;
    else if ($(zipControl).val() == "")
        return true;

    countryValues = countryValues.split("_");

    if (countryValues[1].toLowerCase() == "true") {
        return validateZip(countryValues[0], $(zipControl).val());
    } else {
        return true; // not using zip codes
    }
}
//#end

//##Main Menu
function initializeMainMenu() {
    var RLDefaultOptions = { "defaultText": "" };
    $("#services-ul a").RLMenuLinkStatus("#services-ul .nav-ads", RLDefaultOptions);
    $("#coverage-ul a").RLMenuLinkStatus("#coverage-ul .nav-ads", RLDefaultOptions);
    $("#shipping-tools-ul a").RLMenuLinkStatus("#shipping-tools-ul .nav-ads", RLDefaultOptions);
    $("#resources-ul a").RLMenuLinkStatus("#resources-ul .nav-ads", RLDefaultOptions);
    $("#company-ul a").RLMenuLinkStatus("#company-ul .nav-ads", RLDefaultOptions);
}
//#end

//##Form Helpers
function Stop(e) {
    e.preventDefault();
    e.stopPropagation();
}

function Cancel(e) {
    Stop(e);
}

function ScrollTo(selector, speed, offset) {
    if ($(selector).size() > 0) {
        $("html,body").animate({ scrollTop: ($(selector).offset().top) - offset }, speed);
    }
}

function RollTo(selector, speed, offset) {
    ScrollTo(selector, speed, offset);
}

function scrollToElement(selector, duration, callback) {
    var animation = { scrollTop: $(selector).offset().top };
    $('html,body').animate(animation, duration, 'swing', function () {
        if (typeof callback === 'function') {
            callback();
        }
        callback = null;
    });
}

function ResetForm(e) {
    Stop(e);
    $("input[type=text], input[type=password], input[type=textarea], input[type=hidden]").val("");
    $("input[type=radio], input[type=checkbox]").removeAttr("checked");
    $("input[type=select-one], input[type=select-multi], select").attr("selectedIndex", -1);
}
//#end

//##Misc
//Adds the required class to the control, and adds a focus handler for validation
function AddRequired(controlId) {
    $("#" + controlId).addClass("required");

    //Add focus handling
    $("#" + controlId).focus(function () {
        if ($(this).hasClass('red')) {
            $(this).removeClass('red');
            $(this).addClass('black');
            if ($(this).val() == "Required") {
                $(this).val("");
            }
        }
    });
}

function RemoveRequired(control) {
    $(control).unbind('focus').removeClass('required');
}

function CleanText(text) {
    var apos = new RegExp("'", "g");
    var result = text.replace(/\\/g, " ").replace(apos, " ");
    return result;
}

function FixFaxFromText(fromText) {
    return fromText.replace(/[^0-9\-_\(\)\sA-Za-z]/g, "");
}

function grayOut(vis, options) {
    var options = options || {};
    var zindex = options.zindex || 5000;
    var opacity = options.opacity || 70;
    var opaque = (opacity / 100);
    var bgcolor = options.bgcolor || '#e3e3e3';
    var dark = document.getElementById('darkenScreenObject');
    if (!dark) {
        var tbody = document.getElementsByTagName("body")[0];
        var tnode = document.createElement('div');
        tnode.style.position = 'absolute';                 // Position absolutely
        tnode.style.top = '0px';                           // In the top
        tnode.style.left = '0px';                          // Left corner of the page
        tnode.style.overflow = 'hidden';                   // Try to avoid making scroll bars
        tnode.style.display = 'none';                      // Start out Hidden
        tnode.id = 'darkenScreenObject';                   // Name it so we can find it later
        tbody.appendChild(tnode);                        // Add it to the web page
        dark = document.getElementById('darkenScreenObject');  // Get the object.
    }
    if (vis) {
        //Set page width and height
        pageHeight = $.getDocHeight() + 'px';
        pageWidth = '100%';

        //set the shader to cover the entire page and make it visible.
        dark.style.zIndex = zindex;
        dark.style.opacity = opaque;
        dark.style.MozOpacity = opaque;
        dark.style.filter = 'alpha(Opacity=' + opacity + ')';

        dark.style.backgroundColor = bgcolor;
        dark.style.width = pageWidth;
        dark.style.height = pageHeight;
        dark.style.display = 'block';
    }
    else {
        dark.style.display = 'none';
    }
}

function ValidateRateQuote_Sidebar() {
    var originZip = $(".originZip-sidebar").val();
    var destinationZip = $(".destinationZip-sidebar").val();
    var selectedClass = $(".class-sidebar option:selected").val();
    var weight = $(".weight-sidebar").val();

    if (!isUSCanadaZip(originZip)) {
        alert("Please enter a valid origin zip code (US/CAN only).", "");
        return false;
    }

    if (!isUSCanadaZip(destinationZip)) {
        alert("Please enter a valid destination zip code (US/CAN only).", "\n\n");
        return false;
    }

    if (selectedClass == undefined || selectedClass == "") {
        alert("Please selected a valid class.", "\n");
        return false;
    }

    if (!IsNumeric(weight) || !weight.match(/^[1]?[\d]?[\,]?[0-9]{1,3}[.]?[\d]{0,2}$/)) {
        alert("Please enter a valid weight.", "<br />");
        return false;
    }
    else if (parseFloat(weight) == 0) {
        alert("Weight must be between 0.01 and 19,999.99.", "\n");
        return false;
    }

    TrackMe("/successful-rate-quote/homepage");
    return true;
}
//#end

//##Form Validation
function ShowErrorPanels() {
    $("#error-panel-top").removeClass("hidden");
    $("#error-panel-bottom").removeClass("hidden");
    ScrollTo("#error-panel-top", 500, 10);
}

function HideErrorPanels() {
    $("#error-panel-top").addClass("hidden");
    $("#error-panel-bottom").addClass("hidden");
}

function ClearErrorMessages() {
    $("#error-messages").html("");
    $(".validation-error").addClass("hidden");
    HideErrorPanels();
}

function AppendErrorMessage(message, control) {
    if ($("#error-messages").html() != "")
        $("#error-messages").append("<br />");

    if (control) {
        var id = GetPartialElementID(control);
        var div = $("div[rel=" + id + "]");
        if (div.length > 0) {
            message = message.replace("[CONTROLNAME]", $(div).attr("title"));
        } else {
            message = message.replace("[CONTROLNAME]", "");
        }
    }

    $("#error-messages").append("- " + message);
}

function HasErrors() {
    var messagesDiv = $("#error-messages");
    if (messagesDiv.size() > 0)
        return $("#error-messages").html() != "";
    else
        return false;
}
function hasErrors() { return HasErrors(); }

function IsFormValid() {
    var valid = $("#error-messages").html() == "";
    if (!valid) {
        ShowErrorPanels();
        Busy(false);
    }
    return valid;
}
function isFormValid() { return IsFormValid(); }

function ShowValidationIcon(element, appendRequired) {
    var id = GetPartialElementID(element);
    var div = $("div[rel=" + id + "]");
    if (div.length > 0) {
        // check to see if we need to append the required message
        if (appendRequired)
            AppendErrorMessage($(div).attr("title") + " is required.");
        // Show the validation icon
        if ($(div).hasClass("hidden"))
            $(div).removeClass("hidden");
        // Remove the validation icon and select all upon focus
        $(element).focus(function () {
            HideValidationIcon($(this));
            //Mike B. - until all class red validation is replaced
            if ($(element).hasClass('red'))
                $(element).removeClass('red');
            //End Mike B.
            if ($(this).attr("type").toLowerCase() == "text")
                $(this).select();
        });
    }
    else {
        if (appendRequired)
            AppendErrorMessage("Missing required field.");
    }
}

function HideValidationIcon(element) {
    var id = GetPartialElementID(element);
    var div = $("div[rel=" + id + "]");
    if (div.length > 0) {
        if (!($(div).hasClass("hidden")))
            $(div).addClass("hidden");
    }
}

function GetPartialElementID(element) {
    var id = $(element).attr("id");
    if (id != null && id != "") {
        if (id.startsWith("ctl00_cphBody_b2b")) {
            var arr = id.split("_");
            id = arr[arr.length - 1];
		} else if (id.startsWith("ctl00_cphBody_SalesRep_")) {
			id = id.replace("ctl00_cphBody_SalesRep_", "");
		} else if (id.startsWith("ctl00_cphBody_MyRLCLogin1_")) {
			id = id.replace("ctl00_cphBody_MyRLCLogin1_", "");
		}else if (id.startsWith("ctl00_cphBody_")) {
            id = id.replace("ctl00_cphBody_", "");
		} 
    }
    return id;
}

function IsValidString(str) {
    if (str == undefined)
        return false;
    else if (str == null)
        return false;
    else if (str == "")
        return false;
    else if (str == " ")
        return false;
    else
        return true;
}

function FormatPhoneNumber() {
    var value = $(this).val();
	value = value.replace(/[^0-9]/g, "");
	if (value.length == 11) {
		var countryCode = value.substring(0, 1),
			areaCode = value.substring(1, 4),
			prefix = value.substring(4, 7),
			suffix = value.substring(7);

		$(this).val(countryCode + " (" + areaCode + ") " + prefix + "-" + suffix);
	}
	else if (value.length == 10) {
        var areaCode = value.substring(0, 3);
        var prefix = value.substring(3, 6);
        var suffix = value.substring(6);

        $(this).val("(" + areaCode + ") " + prefix + "-" + suffix);
    }
}
//#end

//##Dropdown list population
function PopulateDropdownList(dropdown, items, withDefault) {
    dropdown.children().remove();

    if (withDefault && items.length != 1) {
        // append defualt option only if specified and the list length is not equal to 1 (doesn't make sense if there is only one option).
        $(dropdown).append("<option value=\" \"></option>");
    }

	var selected = (items.length == 1) ? " selected=\"selected\"" : "";
	for (var i = 0; i < items.length; i++) {
		if (items[i].hasOwnProperty("Value")) {
			var itemText = (items[i].hasOwnProperty("Key")) ? items[i].Key : items[i].Text;
			$(dropdown).append("<option value=\"{0}\"{2}>{1}</option>".format(items[i].Value, itemText, selected));
		}
		else
			$(dropdown).append("<option value=\"{0}\"{1}>{0}</option>".format(items[i], selected));
	}

  //  if (items.length == 1) { // if there is only one item, automatically select it.
		//if (items[0].hasOwnProperty("Value")) {
		//	var itemText = "";
		//	if (items[0].hasOwnProperty("Key")) {
		//		itemText = items[0].Key;
		//	}
		//	else {
		//		itemText = items[0].Text;
		//	}
		//	$(dropdown).append("<option value=\"{0}\" selected=\"selected\">{1}</option>".format(items[0].Value, itemText));
		//}
  //      else
  //          $(dropdown).append("<option value=\"{0}\" selected=\"selected\">{0}</option>".format(items[0]));
  //  } else { // otherwise just append the elements.
  //      for (var i = 0; i < items.length; i++) {
  //          // Add each item to the list.
		//	if (items[i].hasOwnProperty("Value")) {
		//		var itemText = "";
		//		if (items[i].hasOwnProperty("Key")) {
		//			itemText = items[i].Key;
		//		}
		//		else {
		//			itemText = items[i].Text;
		//		}
		//		$(dropdown).append("<option value=\"{0}\">{1}</option>".format(items[i].Value, itemText));
		//	}
  //          else
  //              $(dropdown).append("<option value=\"{0}\">{0}</option>".format(items[i]));
  //      }
  //  }

    if ($(dropdown).attr("rel") != undefined && $(dropdown).attr("rel") != "") {
        $(dropdown).data("SelectedItem", $(dropdown).attr("rel"));
    }

    if ($(dropdown).data("SelectedItem") != undefined && $(dropdown).data("SelectedItem") != "") {
        var value = $(dropdown).data("SelectedItem");
        SelectItem($(dropdown), value);
        $(dropdown).data("SelectedItem", "");
        $(dropdown).data("trigger", true);
    }

    $(dropdown).trigger("change");
}

function SelectItem(dropdown, value) {
    dropdown = $(dropdown);

    if (dropdown.children("option[value=\"{0}\"]".format(escape(value))).size() > 0) {
        dropdown.children("option[value=\"{0}\"]:first".format(escape(value))).attr("selected", "selected");
    } else if (dropdown.children("option[value^=\"{0}\"]".format(escape(value))).size() > 0) {
        dropdown.children("option[value^=\"{0}\"]:first".format(escape(value))).attr("selected", "selected");
    } else if (dropdown.children("option[value$=\"{0}\"]".format(escape(value))).size() > 0) {
        dropdown.children("option[value$=\"{0}\"]:first".format(escape(value))).attr("selected", "selected");
    } else if (dropdown.children().filter(function (index) { return $(this).val().indexOf(value) > -1; })) {
        dropdown.val(value);
    }
}

function ClearDropdownList(dropdown) {
    dropdown = $(dropdown);
    dropdown.children().remove().end();
}

function ResetDropdownList(dropdown) {
    dropdown = $(dropdown);

    if (dropdown.children().size() > 0) {
        dropdown.attr("selectedIndex", 0);
    }
}

function SetValue(name, value) {
    try {
        var selector = "input[id$={0}]".format(name);
        $(selector).val(value);
    } catch (err) {
        // nothing
    }
}
function StageValue(name, value) {
    try {
        var selector = "input[id$={0}]".format(name);
        $(selector).data("SetTo", value);
    } catch (err) {
        // nothing
    }
}

function StageSelectValue(name, value) {
    var selector = "select[id$={0}]".format(name);
    try {
        $(selector).data("SelectedItem", value);
        if ($(selector + " option").length > 0 && value != 'undefined' && value != undefined && value != '') {
            $(selector).val(value);
        }
    } catch (err) {
        // nothing
    }
    return $(selector);
}

function SetChecked(name, checked) {
    try {
        var selector = "input[id$={0}]".format(name);
        if (checked)
            $(selector).attr("checked", "checked");
        else
            $(selector).attr("checked", "");
    } catch (err) {
        // nothing
    }
}

function setPrevious(c) {
    c.data("previous", c.val());
}

function comparePrevious(c) {
    var previous = c.data("previous");

    if (previous == undefined || previous == "") {
        return true;
    }

    return previous == c.val();
}

function PopulateCityState(zipCode, country, destinationControl) {
    ClearDropdownList($(destinationControl));
	var xhr = $.ajax({
		type: "GET",
		url: "/shared-function/cities?zipCode=" + zipCode + "&countryCode=" + country,
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: PopulateCityState_Success,
		error: PopulateCityState_Fail,
		context: { zip: zipCode, destinationControl: $(destinationControl) } 
	});
}

function PopulateCityState_Success(result) {
	PopulateDropdownList(this.destinationControl, result);
	if (result.length === 0) {
        alert("No cities were found for the zip code provided ({0}).  Please verify the correct country is selected before entering the zip code.".format(this.zip));
        ShowValidationIcon(this.destinationControl);
    }
}

function PopulateCityState_Fail() {
    alert("Unable to get cities.  Please try again.");
}

function GetCities(countryControl, zipControl, cityControl) {
    var
        country = $(countryControl).val(),
        zip = $(zipControl).val();

    if (country != undefined && country != "") {
        country = country.split("_")[0]; // get country code
    }

    if (zip == undefined)
        zip = "";

    zip = zip.clean();
    $(zipControl).val(zip);

    if (country != "" && zip != "") {
        PopulateCityState(zip, country, $(cityControl));
    } else {
        ClearDropdownList($(cityControl));
    }
}

function CreateOptionalSectionHandler(className) {
    var selector = className;

    if (!selector.startsWith("."))
        selector = ".{0}".format(selector);
    else
        className = className.substr(1, className.length - 1);

    $(selector).bind("change", OptionalFieldChanged);
    $(selector).data("relation", className);
}

function OptionalFieldChanged() {
    // Get the class group from the rel tag of the current control
    var className = $(this).data("relation");
    // as long as there is a valid class
    if (className != undefined && className != "") {
        // create the selector for the group
        var selector = ".{0}".format(className);
        // declare a variable to determine the required status
        var isRequired = false;
        // Check the values to see of anything is selected.
        if ($("input{0}[value!=\"\"]".format(selector)).size() > 0) {
            // We have an input control with text in it, items are required.
            isRequired = true;
        } else if ($("select{0} option:selected[value!=\" \"][value!=\"\"]".format(selector)).size() > 0) {
            // items are selected in a dropdown, items are required.
            isRequired = true;
        } else {
            // passed all validation.
            isRequired = false;
        }

        if (isRequired) {
            if (!$(selector).hasClass("required"))
                $(selector).addClass("required");
        } else {
            if ($(selector).hasClass("required"))
                $(selector).removeClass("required");
        }
    }
}

function switchHistoryInfo(e) {
    e.preventDefault();
    if ($("#" + $(e.target).attr("rel")).size() > 0) {
        $(".history-nav a").removeClass("active");
        $(e.target).addClass("active");
        $(".history-info").children().hide();
        $("#" + $(e.target).attr("rel")).show();
    }
}

function SetWindowStatus(status) {
    window.status = status;
}

function ClearWindowStatus() {
    window.status = "";
}

function IsAuthenticated() {
    var retVal = false;

    $.ajax({
        type: "POST",
        url: "/Proxy.aspx/IsAuthenticated",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (result) {
            retVal = result.d;
        }
    });

    return retVal;
}

function Busy(isBusy) {
    if (isBusy) {
        $("*").addClass("busy");
    } else {
        $("*").removeClass("busy");
    }
}

function ShowErrorMessage(ajaxError) {
    try {
        var ex = JSON.parse(ajaxError.responseText);
        alert(ex.Message);
    } catch (ex) {
        alert(ajaxError.responseText);
    }
}

function TrackMe(trackData) {
    // only run if the analytics code is included.
    if (typeof (_gaq) != 'undefined' && _gaq != null && _gaq != undefined)
        // Check to see if the tracking data is an array, if it is then just submit the array to GA.
        if (trackData instanceof Array)
            _gaq.push(trackData);
        else // Otherwise assume we are tracking a pageview.
            _gaq.push(["_trackPageview", trackData]);
    else // if GA is not included, just log to the console.
        console.log("Tracking: " + trackData.toString());
}
//#end

//##Alert Override
window.alert = customAlert;
var isOpen = false;

function customAlert(message) {
    if (!isOpen) {
        $('#error-message-dialog').dialog({
            autoOpen: false, bgiframe: true, position: ['center', 100], modal: true, zIndex: '6000', title: 'R+L Carriers Message', width: 475, height: 250,
            buttons: {
                "OK": function () {
                    $(this).dialog("close");
                    isOpen = false;
                    if (currentControl)
                        $(currentControl).focus();
                }
            },
            open: function () {
                $(this).parents('.ui-dialog-buttonpane button:eq(0)').focus();
			},
			close: function () {
				$(this).dialog("destroy");
				isOpen = false;
				if (currentControl)
					$(currentControl).focus();
			}
        });
        var elements = message.split("|");
        $('#spMessage').html(elements[0]);
        $('#spCode').text(elements[1]);
        $('#spTime').text(elements[2]);
        $('#spServer').text(elements[3]);
        $('#error-message-dialog').dialog('open');
        isOpen = true;
    }
    else {
        $('#spMessage').append("<br /><br />");
        $('#spMessage').append(message);
    }
}
//#end

//##Clear Section Links
function ClearSection_Clicked(e) {
    Cancel(e); // Cancel default action

    var link = $(this); // Get the clicked link.
    var fieldset = GetFieldsetContainer(link); // Get the container (fieldset)

    if (fieldset != null) { // as long as there is a valid fieldset then clear all fields within.
        ClearFieldset(fieldset);
    }
}

function GetFieldsetContainer(obj) {
    while (obj != null && obj.get(0).tagName.toLowerCase() != "fieldset") {
        obj = obj.parent();
    }

    return obj;
}

function ClearFieldset(fieldset) {
    var
        inputs = fieldset.find("input"),
        selects = fieldset.find("select"),
        textArea = fieldset.find("textarea"),
        checkbox = fieldset.find("input[type=checkbox]");

    inputs.val("");
    selects.attr("selectedIndex", 0);
    textArea.val("");
    checkbox.attr("checked", "");

    selects.trigger("change");
    inputs.trigger("change");

    fieldset.find("input, select").filter(":first").focus();
}
//#end

//##Default Buttons
function initDefaultButtons() {
    $("#login-input").find(".login-input-form").bind("keypress", function (e) {
        if (e.keyCode == 13) {
            $("a[id$=btnLogon]").click();
        }
    });

    $(".tool-container").find(".login-input-form").bind("keypress", function (e) {
        if (e.keyCode == 13) {
            $("a[id$=btnLoginSubmit]").click();
        }
    });


}
//#end

function initFreeFindSearch() {

    var submitSearch = $("div.searchBtn .searchbutton"),
        searchInput = $("div.searchInput input[id$=txtsearch]");

    searchInput.live('keypress', function (e) {
        if (searchInput.is(':focus') && e.keyCode == 13) {
            if (searchInput.val().trim() != "") {
                window.open("http://search.freefind.com/find.html?t=s&id=24901826&pid=r&mode=ALL&query=" + escape(searchInput.val()));
            }
            else {
                alert("Please enter a keyword.");
            }
        }
    });
    submitSearch.live("click", function (e) {
        if (searchInput.val().trim() !== "") {
            window.open("http://search.freefind.com/find.html?t=s&id=24901826&pid=r&mode=ALL&query=" + escape(searchInput.val()));
        } else {
            alert("Please enter a keyword.");
        }

        e.preventDefault();
        e.stopPropagation();
        return false;
    });
}

//##Notifications
var notificationWindows = [],
    notifyTimer;

function initNotifications() {
    $(".notification-close").live("click", function () {
        $(this).parent().parent().remove();
    });
}

function closeNotification() {
    if (notificationWindows.length > 0) {
        notificationWindows.pop().fadeOut("slow", function () { $(this).remove() });
    }
}

function moveNotifications() {
    $(".notification-popup").each(function () {
        var _this = $(this),
            bottom = _this.css("bottom");

        bottom = parseInt(bottom.replace("px", ""));
        bottom += 140;

        _this.animate({ bottom: bottom + "px" }, 250);
    });
}

function Notify(message, link, context) {
    // Create the input.
    var JSONString = '\"message\":\"{0}\",\"link\":"{1}"'.format(message, link);
    // Call the proxy Method
    AJAXCall(JSONString, "/proxy.aspx/CreateNotification", Notify_Success, Notify_Fail, context);
}

function Notify_Success(result) {
    // move existing notifications if needed.
    if ($(".notification-popup").size() > 0) {
        moveNotifications();
    }
    // append the new notification
    $(this.toString()).append(result.d);
    notificationWindows.unshift($(".notification-popup").last());
    // fade in for clean look
    var index = $(".notification-popup").size();
    $(".notification-popup").last().hide().removeClass("hidden").fadeIn(250);
    // set a timer to close it after 5 seconds.
    setTimeout("closeNotification()", 5000);
}

function Notify_Fail(error) {
    // Defined in initialize
    //ShowErrorMessage(error);
}
//#end

//##Disable Apostrophe
function disableApostrophes() {
    $("input[type=text]").live("keydown", function (e) {
        var key = e.which || e.keyCode;
        if (key === 222)
            return false;
        else
            return true;
    });
}
//#end

function initSignUpEmail() {
	$("input[id$=SignUpSubmit]").live("click", function () {
		return validateEmail();
	});

	var txtEmail = $("div.signup-form input[id$=txtEmail]");
	txtEmail.live('keypress', function (e) {
		if (txtEmail.is(':focus') && e.keyCode == 13) {
			return validateEmail();
		}
	});

	if ($('#carriers-canada').length > 0) {
		ga('send', 'event', 'Canada Banner', 'Impressions', 'New Home Page');
	}

}

function validateEmail() {
	if (!$("input[id$=txtEmail]").validate("email")) {
		alert("We're sorry, the email address you entered is invalid. Let's try again - please be sure the address is in the yourname@company.com format. Thanks!");
		$("input[id$=txtEmail]").val("");
		return false;
	}
	else if ($("input[id$=txtEmail]").val() == "") {
		alert("An email address is required.")
		return false;
	}
	else
		return addEmailAddress();
}

function addEmailAddress() {
	var email = $("input[id$=txtEmail]").val();
	var JSONString = "\"emailAddress\":\"" + email + "\"";
	//Call the proxy Method
	AJAXCall(JSONString, "/shared-function/add-email-to-list", addEmail_Success, addEmail_Fail);
	return false;
}

function addEmail_Success(result) {
	var returned = result.d;
	if (returned == "created") {
		alert("Thank you! Your email has been added to our list. We look forward to connecting with you. Have a question for R+L? <a href='contact/contact-form' target='_blank'>Ask us here</a>");
	}
	else if (returned == "updated") {
		alert("Thanks for your interest - you're on our list!");
	}
	else if (returned == "failure") {
		alert("An Error has occured");
	}
	$("input[id$=txtEmail]").val("");
}

function addEmail_Fail(result) {
	alert("An Error has occured");
};
"use strict";

$(document).ready(async function () {

	async function checkAccountExpiration() {
		let acctExpired = false;
		const myrlcid = $('#my-rlc-id').val();
		if (myrlcid != '') {
			var accountExpire = await new Promise(resolve => $.ajax({ url: "/acount/get-account-expire-date", success: result => resolve(result) }));
			if (accountExpire != null) {
				const expireDate = new Date(accountExpire);
				if (expireDate.getTime() < Date.now()) {
					acctExpired = true;
				}
			}
		}
		return acctExpired;
	}

	async function checkPwdExpiration() {
		const myrlcid = $('#my-rlc-id').val();
		if (myrlcid != '') {
			const $expiryDate = $('#expiry-date');
			const pwdExpire = await new Promise(resolve => $.ajax({ url: "/acount/get-password-expire-date", success: result => resolve(result) }));
			if (pwdExpire != null) {
				const expiryDate = new Date(pwdExpire);
				const oneDay = 24 * 3600 * 1000;
				const daysRemaining = Math.round((expiryDate.getTime() - Date.now()) / oneDay);
				$expiryDate.val(pwdExpire);
				if (expiryDate.getTime() < Date.now()) {
					if (window.location.pathname != '/company/myrlc/profile-update' && window.location.pathname != '/acount/forgot-password') {
						window.location = '/company/myrlc/profile-update?status=password-expired';
					}
				} else {
					const passwordResetDays = $('password-reset-days').val() || 10;
					const noticeDays = passwordResetDays * oneDay;
					if (expiryDate.getTime() - Date.now() < noticeDays) {
						const $expiryNoticeShown = $('#expiry-notice-shown');
						const expiryNoticeShown = $expiryNoticeShown.val() ? new Date($expiryNoticeShown.val()) : null;
						if (expiryNoticeShown == null || Date.now() - expiryNoticeShown.getTime() > oneDay) {
							const message = daysRemaining > 0
								? `Your password will expire in ${daysRemaining} day(s). Would you like to reset it now?`
								: `Your password expires today. Please reset it.`;
							const $dialog = $('#error-message-dialog');
							if ($dialog.length) {
								const buttons = daysRemaining > 0 ? {
									"No": function () {
										$(this).dialog("close");
										isOpen = false;
										if (currentControl)
											$(currentControl).focus();
									},
									"Yes": function () {
										$(this).dialog("close");
										isOpen = false;
										window.location = '/company/myrlc/profile-update'
									}
								} : {
									"OK": function () {
										$(this).dialog("close");
										isOpen = false;
										window.location = '/company/myrlc/profile-update'
									}
								};
								$dialog.dialog({
									autoOpen: false, bgiframe: true, position: ['center', 100], modal: true, zIndex: '6000', title: 'R+L Carriers Message', width: 475, height: 250,
									buttons: buttons,
									open: function () {
										$(this).parents('.ui-dialog-buttonpane button:eq(0)').focus();
									},
									close: function () {
										$(this).dialog("destroy");
										isOpen = false;
										if (currentControl) {
											$(currentControl).focus();
										}
										if (daysRemaining < 1) {
											window.location = '/company/myrlc/profile-update';
										}
									}
								});
								$('#spMessage').html(message);
								$dialog.dialog('open');
							} else if (daysRemaining < 1) {
								rlcMessage("Password Expires Soon", message)
									.then(() => window.location = '/company/myrlc/profile-update');
							} else {
								rlcYesNo("Password Expires Soon", message)
									.then(response => {
										if (response) {
											window.location = '/company/myrlc/profile-update';
										}
									});
							}
							$.ajax({ url: "/acount/expiry-notice-shown" });
						}
					}
				}
			}
		}
	}

	if ($('#my-rlc-id').val()) {
		const acctExpired = await checkAccountExpiration();
		if (acctExpired) {
			if (window.location.pathname != '/acount/forgot-password') {
				window.location = '/acount/forgot-password?status=account-expired';
			}
		} else if ($('#enforce-password-expiration').val() === 'true') {
			checkPwdExpiration();
		}
	}

});;
