// All JScript Files in here
/*
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function() {
    var l = this, g, y = l.jQuery, p = l.$, o = l.jQuery = l.$ = function(E, F) { return new o.fn.init(E, F) }, D = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, f = /^.[^:#\[\.,]*$/; o.fn = o.prototype = { init: function(E, H) { E = E || document; if (E.nodeType) { this[0] = E; this.length = 1; this.context = E; return this } if (typeof E === "string") { var G = D.exec(E); if (G && (G[1] || !H)) { if (G[1]) { E = o.clean([G[1]], H) } else { var I = document.getElementById(G[3]); if (I && I.id != G[3]) { return o().find(E) } var F = o(I || []); F.context = document; F.selector = E; return F } } else { return o(H).find(E) } } else { if (o.isFunction(E)) { return o(document).ready(E) } } if (E.selector && E.context) { this.selector = E.selector; this.context = E.context } return this.setArray(o.isArray(E) ? E : o.makeArray(E)) }, selector: "", jquery: "1.3.2", size: function() { return this.length }, get: function(E) { return E === g ? Array.prototype.slice.call(this) : this[E] }, pushStack: function(F, H, E) { var G = o(F); G.prevObject = this; G.context = this.context; if (H === "find") { G.selector = this.selector + (this.selector ? " " : "") + E } else { if (H) { G.selector = this.selector + "." + H + "(" + E + ")" } } return G }, setArray: function(E) { this.length = 0; Array.prototype.push.apply(this, E); return this }, each: function(F, E) { return o.each(this, F, E) }, index: function(E) { return o.inArray(E && E.jquery ? E[0] : E, this) }, attr: function(F, H, G) { var E = F; if (typeof F === "string") { if (H === g) { return this[0] && o[G || "attr"](this[0], F) } else { E = {}; E[F] = H } } return this.each(function(I) { for (F in E) { o.attr(G ? this.style : this, F, o.prop(this, E[F], G, I, F)) } }) }, css: function(E, F) { if ((E == "width" || E == "height") && parseFloat(F) < 0) { F = g } return this.attr(E, F, "curCSS") }, text: function(F) { if (typeof F !== "object" && F != null) { return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(F)) } var E = ""; o.each(F || this, function() { o.each(this.childNodes, function() { if (this.nodeType != 8) { E += this.nodeType != 1 ? this.nodeValue : o.fn.text([this]) } }) }); return E }, wrapAll: function(E) { if (this[0]) { var F = o(E, this[0].ownerDocument).clone(); if (this[0].parentNode) { F.insertBefore(this[0]) } F.map(function() { var G = this; while (G.firstChild) { G = G.firstChild } return G }).append(this) } return this }, wrapInner: function(E) { return this.each(function() { o(this).contents().wrapAll(E) }) }, wrap: function(E) { return this.each(function() { o(this).wrapAll(E) }) }, append: function() { return this.domManip(arguments, true, function(E) { if (this.nodeType == 1) { this.appendChild(E) } }) }, prepend: function() { return this.domManip(arguments, true, function(E) { if (this.nodeType == 1) { this.insertBefore(E, this.firstChild) } }) }, before: function() { return this.domManip(arguments, false, function(E) { this.parentNode.insertBefore(E, this) }) }, after: function() { return this.domManip(arguments, false, function(E) { this.parentNode.insertBefore(E, this.nextSibling) }) }, end: function() { return this.prevObject || o([]) }, push: [].push, sort: [].sort, splice: [].splice, find: function(E) { if (this.length === 1) { var F = this.pushStack([], "find", E); F.length = 0; o.find(E, this[0], F); return F } else { return this.pushStack(o.unique(o.map(this, function(G) { return o.find(E, G) })), "find", E) } }, clone: function(G) { var E = this.map(function() { if (!o.support.noCloneEvent && !o.isXMLDoc(this)) { var I = this.outerHTML; if (!I) { var J = this.ownerDocument.createElement("div"); J.appendChild(this.cloneNode(true)); I = J.innerHTML } return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0] } else { return this.cloneNode(true) } }); if (G === true) { var H = this.find("*").andSelf(), F = 0; E.find("*").andSelf().each(function() { if (this.nodeName !== H[F].nodeName) { return } var I = o.data(H[F], "events"); for (var K in I) { for (var J in I[K]) { o.event.add(this, K, I[K][J], I[K][J].data) } } F++ }) } return E }, filter: function(E) { return this.pushStack(o.isFunction(E) && o.grep(this, function(G, F) { return E.call(G, F) }) || o.multiFilter(E, o.grep(this, function(F) { return F.nodeType === 1 })), "filter", E) }, closest: function(E) { var G = o.expr.match.POS.test(E) ? o(E) : null, F = 0; return this.map(function() { var H = this; while (H && H.ownerDocument) { if (G ? G.index(H) > -1 : o(H).is(E)) { o.data(H, "closest", F); return H } H = H.parentNode; F++ } }) }, not: function(E) { if (typeof E === "string") { if (f.test(E)) { return this.pushStack(o.multiFilter(E, this, true), "not", E) } else { E = o.multiFilter(E, this) } } var F = E.length && E[E.length - 1] !== g && !E.nodeType; return this.filter(function() { return F ? o.inArray(this, E) < 0 : this != E }) }, add: function(E) { return this.pushStack(o.unique(o.merge(this.get(), typeof E === "string" ? o(E) : o.makeArray(E)))) }, is: function(E) { return !!E && o.multiFilter(E, this).length > 0 }, hasClass: function(E) { return !!E && this.is("." + E) }, val: function(K) { if (K === g) { var E = this[0]; if (E) { if (o.nodeName(E, "option")) { return (E.attributes.value || {}).specified ? E.value : E.text } if (o.nodeName(E, "select")) { var I = E.selectedIndex, L = [], M = E.options, H = E.type == "select-one"; if (I < 0) { return null } for (var F = H ? I : 0, J = H ? I + 1 : M.length; F < J; F++) { var G = M[F]; if (G.selected) { K = o(G).val(); if (H) { return K } L.push(K) } } return L } return (E.value || "").replace(/\r/g, "") } return g } if (typeof K === "number") { K += "" } return this.each(function() { if (this.nodeType != 1) { return } if (o.isArray(K) && /radio|checkbox/.test(this.type)) { this.checked = (o.inArray(this.value, K) >= 0 || o.inArray(this.name, K) >= 0) } else { if (o.nodeName(this, "select")) { var N = o.makeArray(K); o("option", this).each(function() { this.selected = (o.inArray(this.value, N) >= 0 || o.inArray(this.text, N) >= 0) }); if (!N.length) { this.selectedIndex = -1 } } else { this.value = K } } }) }, html: function(E) { return E === g ? (this[0] ? this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : null) : this.empty().append(E) }, replaceWith: function(E) { return this.after(E).remove() }, eq: function(E) { return this.slice(E, +E + 1) }, slice: function() { return this.pushStack(Array.prototype.slice.apply(this, arguments), "slice", Array.prototype.slice.call(arguments).join(",")) }, map: function(E) { return this.pushStack(o.map(this, function(G, F) { return E.call(G, F, G) })) }, andSelf: function() { return this.add(this.prevObject) }, domManip: function(J, M, L) { if (this[0]) { var I = (this[0].ownerDocument || this[0]).createDocumentFragment(), F = o.clean(J, (this[0].ownerDocument || this[0]), I), H = I.firstChild; if (H) { for (var G = 0, E = this.length; G < E; G++) { L.call(K(this[G], H), this.length > 1 || G > 0 ? I.cloneNode(true) : I) } } if (F) { o.each(F, z) } } return this; function K(N, O) { return M && o.nodeName(N, "table") && o.nodeName(O, "tr") ? (N.getElementsByTagName("tbody")[0] || N.appendChild(N.ownerDocument.createElement("tbody"))) : N } } }; o.fn.init.prototype = o.fn; function z(E, F) { if (F.src) { o.ajax({ url: F.src, async: false, dataType: "script" }) } else { o.globalEval(F.text || F.textContent || F.innerHTML || "") } if (F.parentNode) { F.parentNode.removeChild(F) } } function e() { return +new Date } o.extend = o.fn.extend = function() { var J = arguments[0] || {}, H = 1, I = arguments.length, E = false, G; if (typeof J === "boolean") { E = J; J = arguments[1] || {}; H = 2 } if (typeof J !== "object" && !o.isFunction(J)) { J = {} } if (I == H) { J = this; --H } for (; H < I; H++) { if ((G = arguments[H]) != null) { for (var F in G) { var K = J[F], L = G[F]; if (J === L) { continue } if (E && L && typeof L === "object" && !L.nodeType) { J[F] = o.extend(E, K || (L.length != null ? [] : {}), L) } else { if (L !== g) { J[F] = L } } } } } return J }; var b = /z-?index|font-?weight|opacity|zoom|line-?height/i, q = document.defaultView || {}, s = Object.prototype.toString; o.extend({ noConflict: function(E) { l.$ = p; if (E) { l.jQuery = y } return o }, isFunction: function(E) { return s.call(E) === "[object Function]" }, isArray: function(E) { return s.call(E) === "[object Array]" }, isXMLDoc: function(E) { return E.nodeType === 9 && E.documentElement.nodeName !== "HTML" || !!E.ownerDocument && o.isXMLDoc(E.ownerDocument) }, globalEval: function(G) { if (G && /\S/.test(G)) { var F = document.getElementsByTagName("head")[0] || document.documentElement, E = document.createElement("script"); E.type = "text/javascript"; if (o.support.scriptEval) { E.appendChild(document.createTextNode(G)) } else { E.text = G } F.insertBefore(E, F.firstChild); F.removeChild(E) } }, nodeName: function(F, E) { return F.nodeName && F.nodeName.toUpperCase() == E.toUpperCase() }, each: function(G, K, F) { var E, H = 0, I = G.length; if (F) { if (I === g) { for (E in G) { if (K.apply(G[E], F) === false) { break } } } else { for (; H < I; ) { if (K.apply(G[H++], F) === false) { break } } } } else { if (I === g) { for (E in G) { if (K.call(G[E], E, G[E]) === false) { break } } } else { for (var J = G[0]; H < I && K.call(J, H, J) !== false; J = G[++H]) { } } } return G }, prop: function(H, I, G, F, E) { if (o.isFunction(I)) { I = I.call(H, F) } return typeof I === "number" && G == "curCSS" && !b.test(E) ? I + "px" : I }, className: { add: function(E, F) { o.each((F || "").split(/\s+/), function(G, H) { if (E.nodeType == 1 && !o.className.has(E.className, H)) { E.className += (E.className ? " " : "") + H } }) }, remove: function(E, F) { if (E.nodeType == 1) { E.className = F !== g ? o.grep(E.className.split(/\s+/), function(G) { return !o.className.has(F, G) }).join(" ") : "" } }, has: function(F, E) { return F && o.inArray(E, (F.className || F).toString().split(/\s+/)) > -1 } }, swap: function(H, G, I) { var E = {}; for (var F in G) { E[F] = H.style[F]; H.style[F] = G[F] } I.call(H); for (var F in G) { H.style[F] = E[F] } }, css: function(H, F, J, E) { if (F == "width" || F == "height") { var L, G = { position: "absolute", visibility: "hidden", display: "block" }, K = F == "width" ? ["Left", "Right"] : ["Top", "Bottom"]; function I() { L = F == "width" ? H.offsetWidth : H.offsetHeight; if (E === "border") { return } o.each(K, function() { if (!E) { L -= parseFloat(o.curCSS(H, "padding" + this, true)) || 0 } if (E === "margin") { L += parseFloat(o.curCSS(H, "margin" + this, true)) || 0 } else { L -= parseFloat(o.curCSS(H, "border" + this + "Width", true)) || 0 } }) } if (H.offsetWidth !== 0) { I() } else { o.swap(H, G, I) } return Math.max(0, Math.round(L)) } return o.curCSS(H, F, J) }, curCSS: function(I, F, G) { var L, E = I.style; if (F == "opacity" && !o.support.opacity) { L = o.attr(E, "opacity"); return L == "" ? "1" : L } if (F.match(/float/i)) { F = w } if (!G && E && E[F]) { L = E[F] } else { if (q.getComputedStyle) { if (F.match(/float/i)) { F = "float" } F = F.replace(/([A-Z])/g, "-$1").toLowerCase(); var M = q.getComputedStyle(I, null); if (M) { L = M.getPropertyValue(F) } if (F == "opacity" && L == "") { L = "1" } } else { if (I.currentStyle) { var J = F.replace(/\-(\w)/g, function(N, O) { return O.toUpperCase() }); L = I.currentStyle[F] || I.currentStyle[J]; if (!/^\d+(px)?$/i.test(L) && /^\d/.test(L)) { var H = E.left, K = I.runtimeStyle.left; I.runtimeStyle.left = I.currentStyle.left; E.left = L || 0; L = E.pixelLeft + "px"; E.left = H; I.runtimeStyle.left = K } } } } return L }, clean: function(F, K, I) { K = K || document; if (typeof K.createElement === "undefined") { K = K.ownerDocument || K[0] && K[0].ownerDocument || document } if (!I && F.length === 1 && typeof F[0] === "string") { var H = /^<(\w+)\s*\/?>$/.exec(F[0]); if (H) { return [K.createElement(H[1])] } } var G = [], E = [], L = K.createElement("div"); o.each(F, function(P, S) { if (typeof S === "number") { S += "" } if (!S) { return } if (typeof S === "string") { S = S.replace(/(<(\w+)[^>]*?)\/>/g, function(U, V, T) { return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? U : V + "></" + T + ">" }); var O = S.replace(/^\s+/, "").substring(0, 10).toLowerCase(); var Q = !O.indexOf("<opt") && [1, "<select multiple='multiple'>", "</select>"] || !O.indexOf("<leg") && [1, "<fieldset>", "</fieldset>"] || O.match(/^<(thead|tbody|tfoot|colg|cap)/) && [1, "<table>", "</table>"] || !O.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!O.indexOf("<td") || !O.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || !O.indexOf("<col") && [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || !o.support.htmlSerialize && [1, "div<div>", "</div>"] || [0, "", ""]; L.innerHTML = Q[1] + S + Q[2]; while (Q[0]--) { L = L.lastChild } if (!o.support.tbody) { var R = /<tbody/i.test(S), N = !O.indexOf("<table") && !R ? L.firstChild && L.firstChild.childNodes : Q[1] == "<table>" && !R ? L.childNodes : []; for (var M = N.length - 1; M >= 0; --M) { if (o.nodeName(N[M], "tbody") && !N[M].childNodes.length) { N[M].parentNode.removeChild(N[M]) } } } if (!o.support.leadingWhitespace && /^\s/.test(S)) { L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]), L.firstChild) } S = o.makeArray(L.childNodes) } if (S.nodeType) { G.push(S) } else { G = o.merge(G, S) } }); if (I) { for (var J = 0; G[J]; J++) { if (o.nodeName(G[J], "script") && (!G[J].type || G[J].type.toLowerCase() === "text/javascript")) { E.push(G[J].parentNode ? G[J].parentNode.removeChild(G[J]) : G[J]) } else { if (G[J].nodeType === 1) { G.splice.apply(G, [J + 1, 0].concat(o.makeArray(G[J].getElementsByTagName("script")))) } I.appendChild(G[J]) } } return E } return G }, attr: function(J, G, K) { if (!J || J.nodeType == 3 || J.nodeType == 8) { return g } var H = !o.isXMLDoc(J), L = K !== g; G = H && o.props[G] || G; if (J.tagName) { var F = /href|src|style/.test(G); if (G == "selected" && J.parentNode) { J.parentNode.selectedIndex } if (G in J && H && !F) { if (L) { if (G == "type" && o.nodeName(J, "input") && J.parentNode) { throw "type property can't be changed" } J[G] = K } if (o.nodeName(J, "form") && J.getAttributeNode(G)) { return J.getAttributeNode(G).nodeValue } if (G == "tabIndex") { var I = J.getAttributeNode("tabIndex"); return I && I.specified ? I.value : J.nodeName.match(/(button|input|object|select|textarea)/i) ? 0 : J.nodeName.match(/^(a|area)$/i) && J.href ? 0 : g } return J[G] } if (!o.support.style && H && G == "style") { return o.attr(J.style, "cssText", K) } if (L) { J.setAttribute(G, "" + K) } var E = !o.support.hrefNormalized && H && F ? J.getAttribute(G, 2) : J.getAttribute(G); return E === null ? g : E } if (!o.support.opacity && G == "opacity") { if (L) { J.zoom = 1; J.filter = (J.filter || "").replace(/alpha\([^)]*\)/, "") + (parseInt(K) + "" == "NaN" ? "" : "alpha(opacity=" + K * 100 + ")") } return J.filter && J.filter.indexOf("opacity=") >= 0 ? (parseFloat(J.filter.match(/opacity=([^)]*)/)[1]) / 100) + "" : "" } G = G.replace(/-([a-z])/ig, function(M, N) { return N.toUpperCase() }); if (L) { J[G] = K } return J[G] }, trim: function(E) { return (E || "").replace(/^\s+|\s+$/g, "") }, makeArray: function(G) { var E = []; if (G != null) { var F = G.length; if (F == null || typeof G === "string" || o.isFunction(G) || G.setInterval) { E[0] = G } else { while (F) { E[--F] = G[F] } } } return E }, inArray: function(G, H) { for (var E = 0, F = H.length; E < F; E++) { if (H[E] === G) { return E } } return -1 }, merge: function(H, E) { var F = 0, G, I = H.length; if (!o.support.getAll) { while ((G = E[F++]) != null) { if (G.nodeType != 8) { H[I++] = G } } } else { while ((G = E[F++]) != null) { H[I++] = G } } return H }, unique: function(K) { var F = [], E = {}; try { for (var G = 0, H = K.length; G < H; G++) { var J = o.data(K[G]); if (!E[J]) { E[J] = true; F.push(K[G]) } } } catch (I) { F = K } return F }, grep: function(F, J, E) { var G = []; for (var H = 0, I = F.length; H < I; H++) { if (!E != !J(F[H], H)) { G.push(F[H]) } } return G }, map: function(E, J) { var F = []; for (var G = 0, H = E.length; G < H; G++) { var I = J(E[G], G); if (I != null) { F[F.length] = I } } return F.concat.apply([], F) } }); var C = navigator.userAgent.toLowerCase(); o.browser = { version: (C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1], safari: /webkit/.test(C), opera: /opera/.test(C), msie: /msie/.test(C) && !/opera/.test(C), mozilla: /mozilla/.test(C) && !/(compatible|webkit)/.test(C) }; o.each({ parent: function(E) { return E.parentNode }, parents: function(E) { return o.dir(E, "parentNode") }, next: function(E) { return o.nth(E, 2, "nextSibling") }, prev: function(E) { return o.nth(E, 2, "previousSibling") }, nextAll: function(E) { return o.dir(E, "nextSibling") }, prevAll: function(E) { return o.dir(E, "previousSibling") }, siblings: function(E) { return o.sibling(E.parentNode.firstChild, E) }, children: function(E) { return o.sibling(E.firstChild) }, contents: function(E) { return o.nodeName(E, "iframe") ? E.contentDocument || E.contentWindow.document : o.makeArray(E.childNodes) } }, function(E, F) { o.fn[E] = function(G) { var H = o.map(this, F); if (G && typeof G == "string") { H = o.multiFilter(G, H) } return this.pushStack(o.unique(H), E, G) } }); o.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function(E, F) { o.fn[E] = function(G) { var J = [], L = o(G); for (var K = 0, H = L.length; K < H; K++) { var I = (K > 0 ? this.clone(true) : this).get(); o.fn[F].apply(o(L[K]), I); J = J.concat(I) } return this.pushStack(J, E, G) } }); o.each({ removeAttr: function(E) { o.attr(this, E, ""); if (this.nodeType == 1) { this.removeAttribute(E) } }, addClass: function(E) { o.className.add(this, E) }, removeClass: function(E) { o.className.remove(this, E) }, toggleClass: function(F, E) { if (typeof E !== "boolean") { E = !o.className.has(this, F) } o.className[E ? "add" : "remove"](this, F) }, remove: function(E) { if (!E || o.filter(E, [this]).length) { o("*", this).add([this]).each(function() { o.event.remove(this); o.removeData(this) }); if (this.parentNode) { this.parentNode.removeChild(this) } } }, empty: function() { o(this).children().remove(); while (this.firstChild) { this.removeChild(this.firstChild) } } }, function(E, F) { o.fn[E] = function() { return this.each(F, arguments) } }); function j(E, F) { return E[0] && parseInt(o.curCSS(E[0], F, true), 10) || 0 } var h = "jQuery" + e(), v = 0, A = {}; o.extend({ cache: {}, data: function(F, E, G) { F = F == l ? A : F; var H = F[h]; if (!H) { H = F[h] = ++v } if (E && !o.cache[H]) { o.cache[H] = {} } if (G !== g) { o.cache[H][E] = G } return E ? o.cache[H][E] : H }, removeData: function(F, E) { F = F == l ? A : F; var H = F[h]; if (E) { if (o.cache[H]) { delete o.cache[H][E]; E = ""; for (E in o.cache[H]) { break } if (!E) { o.removeData(F) } } } else { try { delete F[h] } catch (G) { if (F.removeAttribute) { F.removeAttribute(h) } } delete o.cache[H] } }, queue: function(F, E, H) { if (F) { E = (E || "fx") + "queue"; var G = o.data(F, E); if (!G || o.isArray(H)) { G = o.data(F, E, o.makeArray(H)) } else { if (H) { G.push(H) } } } return G }, dequeue: function(H, G) { var E = o.queue(H, G), F = E.shift(); if (!G || G === "fx") { F = E[0] } if (F !== g) { F.call(H) } } }); o.fn.extend({ data: function(E, G) { var H = E.split("."); H[1] = H[1] ? "." + H[1] : ""; if (G === g) { var F = this.triggerHandler("getData" + H[1] + "!", [H[0]]); if (F === g && this.length) { F = o.data(this[0], E) } return F === g && H[1] ? this.data(H[0]) : F } else { return this.trigger("setData" + H[1] + "!", [H[0], G]).each(function() { o.data(this, E, G) }) } }, removeData: function(E) { return this.each(function() { o.removeData(this, E) }) }, queue: function(E, F) { if (typeof E !== "string") { F = E; E = "fx" } if (F === g) { return o.queue(this[0], E) } return this.each(function() { var G = o.queue(this, E, F); if (E == "fx" && G.length == 1) { G[0].call(this) } }) }, dequeue: function(E) { return this.each(function() { o.dequeue(this, E) }) } });
    /*
    * Sizzle CSS Selector Engine - v0.9.3
    *  Copyright 2009, The Dojo Foundation
    *  Released under the MIT, BSD, and GPL Licenses.
    *  More information: http://sizzlejs.com/
    */
    (function() { var R = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, L = 0, H = Object.prototype.toString; var F = function(Y, U, ab, ac) { ab = ab || []; U = U || document; if (U.nodeType !== 1 && U.nodeType !== 9) { return [] } if (!Y || typeof Y !== "string") { return ab } var Z = [], W, af, ai, T, ad, V, X = true; R.lastIndex = 0; while ((W = R.exec(Y)) !== null) { Z.push(W[1]); if (W[2]) { V = RegExp.rightContext; break } } if (Z.length > 1 && M.exec(Y)) { if (Z.length === 2 && I.relative[Z[0]]) { af = J(Z[0] + Z[1], U) } else { af = I.relative[Z[0]] ? [U] : F(Z.shift(), U); while (Z.length) { Y = Z.shift(); if (I.relative[Y]) { Y += Z.shift() } af = J(Y, af) } } } else { var ae = ac ? { expr: Z.pop(), set: E(ac)} : F.find(Z.pop(), Z.length === 1 && U.parentNode ? U.parentNode : U, Q(U)); af = F.filter(ae.expr, ae.set); if (Z.length > 0) { ai = E(af) } else { X = false } while (Z.length) { var ah = Z.pop(), ag = ah; if (!I.relative[ah]) { ah = "" } else { ag = Z.pop() } if (ag == null) { ag = U } I.relative[ah](ai, ag, Q(U)) } } if (!ai) { ai = af } if (!ai) { throw "Syntax error, unrecognized expression: " + (ah || Y) } if (H.call(ai) === "[object Array]") { if (!X) { ab.push.apply(ab, ai) } else { if (U.nodeType === 1) { for (var aa = 0; ai[aa] != null; aa++) { if (ai[aa] && (ai[aa] === true || ai[aa].nodeType === 1 && K(U, ai[aa]))) { ab.push(af[aa]) } } } else { for (var aa = 0; ai[aa] != null; aa++) { if (ai[aa] && ai[aa].nodeType === 1) { ab.push(af[aa]) } } } } } else { E(ai, ab) } if (V) { F(V, U, ab, ac); if (G) { hasDuplicate = false; ab.sort(G); if (hasDuplicate) { for (var aa = 1; aa < ab.length; aa++) { if (ab[aa] === ab[aa - 1]) { ab.splice(aa--, 1) } } } } } return ab }; F.matches = function(T, U) { return F(T, null, null, U) }; F.find = function(aa, T, ab) { var Z, X; if (!aa) { return [] } for (var W = 0, V = I.order.length; W < V; W++) { var Y = I.order[W], X; if ((X = I.match[Y].exec(aa))) { var U = RegExp.leftContext; if (U.substr(U.length - 1) !== "\\") { X[1] = (X[1] || "").replace(/\\/g, ""); Z = I.find[Y](X, T, ab); if (Z != null) { aa = aa.replace(I.match[Y], ""); break } } } } if (!Z) { Z = T.getElementsByTagName("*") } return { set: Z, expr: aa} }; F.filter = function(ad, ac, ag, W) { var V = ad, ai = [], aa = ac, Y, T, Z = ac && ac[0] && Q(ac[0]); while (ad && ac.length) { for (var ab in I.filter) { if ((Y = I.match[ab].exec(ad)) != null) { var U = I.filter[ab], ah, af; T = false; if (aa == ai) { ai = [] } if (I.preFilter[ab]) { Y = I.preFilter[ab](Y, aa, ag, ai, W, Z); if (!Y) { T = ah = true } else { if (Y === true) { continue } } } if (Y) { for (var X = 0; (af = aa[X]) != null; X++) { if (af) { ah = U(af, Y, X, aa); var ae = W ^ !!ah; if (ag && ah != null) { if (ae) { T = true } else { aa[X] = false } } else { if (ae) { ai.push(af); T = true } } } } } if (ah !== g) { if (!ag) { aa = ai } ad = ad.replace(I.match[ab], ""); if (!T) { return [] } break } } } if (ad == V) { if (T == null) { throw "Syntax error, unrecognized expression: " + ad } else { break } } V = ad } return aa }; var I = F.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\(\)]*)+)\2\))?/ }, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(T) { return T.getAttribute("href") } }, relative: { "+": function(aa, T, Z) { var X = typeof T === "string", ab = X && !/\W/.test(T), Y = X && !ab; if (ab && !Z) { T = T.toUpperCase() } for (var W = 0, V = aa.length, U; W < V; W++) { if ((U = aa[W])) { while ((U = U.previousSibling) && U.nodeType !== 1) { } aa[W] = Y || U && U.nodeName === T ? U || false : U === T } } if (Y) { F.filter(T, aa, true) } }, ">": function(Z, U, aa) { var X = typeof U === "string"; if (X && !/\W/.test(U)) { U = aa ? U : U.toUpperCase(); for (var V = 0, T = Z.length; V < T; V++) { var Y = Z[V]; if (Y) { var W = Y.parentNode; Z[V] = W.nodeName === U ? W : false } } } else { for (var V = 0, T = Z.length; V < T; V++) { var Y = Z[V]; if (Y) { Z[V] = X ? Y.parentNode : Y.parentNode === U } } if (X) { F.filter(U, Z, true) } } }, "": function(W, U, Y) { var V = L++, T = S; if (!U.match(/\W/)) { var X = U = Y ? U : U.toUpperCase(); T = P } T("parentNode", U, V, W, X, Y) }, "~": function(W, U, Y) { var V = L++, T = S; if (typeof U === "string" && !U.match(/\W/)) { var X = U = Y ? U : U.toUpperCase(); T = P } T("previousSibling", U, V, W, X, Y) } }, find: { ID: function(U, V, W) { if (typeof V.getElementById !== "undefined" && !W) { var T = V.getElementById(U[1]); return T ? [T] : [] } }, NAME: function(V, Y, Z) { if (typeof Y.getElementsByName !== "undefined") { var U = [], X = Y.getElementsByName(V[1]); for (var W = 0, T = X.length; W < T; W++) { if (X[W].getAttribute("name") === V[1]) { U.push(X[W]) } } return U.length === 0 ? null : U } }, TAG: function(T, U) { return U.getElementsByTagName(T[1]) } }, preFilter: { CLASS: function(W, U, V, T, Z, aa) { W = " " + W[1].replace(/\\/g, "") + " "; if (aa) { return W } for (var X = 0, Y; (Y = U[X]) != null; X++) { if (Y) { if (Z ^ (Y.className && (" " + Y.className + " ").indexOf(W) >= 0)) { if (!V) { T.push(Y) } } else { if (V) { U[X] = false } } } } return false }, ID: function(T) { return T[1].replace(/\\/g, "") }, TAG: function(U, T) { for (var V = 0; T[V] === false; V++) { } return T[V] && Q(T[V]) ? U[1] : U[1].toUpperCase() }, CHILD: function(T) { if (T[1] == "nth") { var U = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2] == "even" && "2n" || T[2] == "odd" && "2n+1" || !/\D/.test(T[2]) && "0n+" + T[2] || T[2]); T[2] = (U[1] + (U[2] || 1)) - 0; T[3] = U[3] - 0 } T[0] = L++; return T }, ATTR: function(X, U, V, T, Y, Z) { var W = X[1].replace(/\\/g, ""); if (!Z && I.attrMap[W]) { X[1] = I.attrMap[W] } if (X[2] === "~=") { X[4] = " " + X[4] + " " } return X }, PSEUDO: function(X, U, V, T, Y) { if (X[1] === "not") { if (X[3].match(R).length > 1 || /^\w/.test(X[3])) { X[3] = F(X[3], null, null, U) } else { var W = F.filter(X[3], U, V, true ^ Y); if (!V) { T.push.apply(T, W) } return false } } else { if (I.match.POS.test(X[0]) || I.match.CHILD.test(X[0])) { return true } } return X }, POS: function(T) { T.unshift(true); return T } }, filters: { enabled: function(T) { return T.disabled === false && T.type !== "hidden" }, disabled: function(T) { return T.disabled === true }, checked: function(T) { return T.checked === true }, selected: function(T) { T.parentNode.selectedIndex; return T.selected === true }, parent: function(T) { return !!T.firstChild }, empty: function(T) { return !T.firstChild }, has: function(V, U, T) { return !!F(T[3], V).length }, header: function(T) { return /h\d/i.test(T.nodeName) }, text: function(T) { return "text" === T.type }, radio: function(T) { return "radio" === T.type }, checkbox: function(T) { return "checkbox" === T.type }, file: function(T) { return "file" === T.type }, password: function(T) { return "password" === T.type }, submit: function(T) { return "submit" === T.type }, image: function(T) { return "image" === T.type }, reset: function(T) { return "reset" === T.type }, button: function(T) { return "button" === T.type || T.nodeName.toUpperCase() === "BUTTON" }, input: function(T) { return /input|select|textarea|button/i.test(T.nodeName) } }, setFilters: { first: function(U, T) { return T === 0 }, last: function(V, U, T, W) { return U === W.length - 1 }, even: function(U, T) { return T % 2 === 0 }, odd: function(U, T) { return T % 2 === 1 }, lt: function(V, U, T) { return U < T[3] - 0 }, gt: function(V, U, T) { return U > T[3] - 0 }, nth: function(V, U, T) { return T[3] - 0 == U }, eq: function(V, U, T) { return T[3] - 0 == U } }, filter: { PSEUDO: function(Z, V, W, aa) { var U = V[1], X = I.filters[U]; if (X) { return X(Z, W, V, aa) } else { if (U === "contains") { return (Z.textContent || Z.innerText || "").indexOf(V[3]) >= 0 } else { if (U === "not") { var Y = V[3]; for (var W = 0, T = Y.length; W < T; W++) { if (Y[W] === Z) { return false } } return true } } } }, CHILD: function(T, W) { var Z = W[1], U = T; switch (Z) { case "only": case "first": while (U = U.previousSibling) { if (U.nodeType === 1) { return false } } if (Z == "first") { return true } U = T; case "last": while (U = U.nextSibling) { if (U.nodeType === 1) { return false } } return true; case "nth": var V = W[2], ac = W[3]; if (V == 1 && ac == 0) { return true } var Y = W[0], ab = T.parentNode; if (ab && (ab.sizcache !== Y || !T.nodeIndex)) { var X = 0; for (U = ab.firstChild; U; U = U.nextSibling) { if (U.nodeType === 1) { U.nodeIndex = ++X } } ab.sizcache = Y } var aa = T.nodeIndex - ac; if (V == 0) { return aa == 0 } else { return (aa % V == 0 && aa / V >= 0) } } }, ID: function(U, T) { return U.nodeType === 1 && U.getAttribute("id") === T }, TAG: function(U, T) { return (T === "*" && U.nodeType === 1) || U.nodeName === T }, CLASS: function(U, T) { return (" " + (U.className || U.getAttribute("class")) + " ").indexOf(T) > -1 }, ATTR: function(Y, W) { var V = W[1], T = I.attrHandle[V] ? I.attrHandle[V](Y) : Y[V] != null ? Y[V] : Y.getAttribute(V), Z = T + "", X = W[2], U = W[4]; return T == null ? X === "!=" : X === "=" ? Z === U : X === "*=" ? Z.indexOf(U) >= 0 : X === "~=" ? (" " + Z + " ").indexOf(U) >= 0 : !U ? Z && T !== false : X === "!=" ? Z != U : X === "^=" ? Z.indexOf(U) === 0 : X === "$=" ? Z.substr(Z.length - U.length) === U : X === "|=" ? Z === U || Z.substr(0, U.length + 1) === U + "-" : false }, POS: function(X, U, V, Y) { var T = U[2], W = I.setFilters[T]; if (W) { return W(X, V, U, Y) } } } }; var M = I.match.POS; for (var O in I.match) { I.match[O] = RegExp(I.match[O].source + /(?![^\[]*\])(?![^\(]*\))/.source) } var E = function(U, T) { U = Array.prototype.slice.call(U); if (T) { T.push.apply(T, U); return T } return U }; try { Array.prototype.slice.call(document.documentElement.childNodes) } catch (N) { E = function(X, W) { var U = W || []; if (H.call(X) === "[object Array]") { Array.prototype.push.apply(U, X) } else { if (typeof X.length === "number") { for (var V = 0, T = X.length; V < T; V++) { U.push(X[V]) } } else { for (var V = 0; X[V]; V++) { U.push(X[V]) } } } return U } } var G; if (document.documentElement.compareDocumentPosition) { G = function(U, T) { var V = U.compareDocumentPosition(T) & 4 ? -1 : U === T ? 0 : 1; if (V === 0) { hasDuplicate = true } return V } } else { if ("sourceIndex" in document.documentElement) { G = function(U, T) { var V = U.sourceIndex - T.sourceIndex; if (V === 0) { hasDuplicate = true } return V } } else { if (document.createRange) { G = function(W, U) { var V = W.ownerDocument.createRange(), T = U.ownerDocument.createRange(); V.selectNode(W); V.collapse(true); T.selectNode(U); T.collapse(true); var X = V.compareBoundaryPoints(Range.START_TO_END, T); if (X === 0) { hasDuplicate = true } return X } } } } (function() { var U = document.createElement("form"), V = "script" + (new Date).getTime(); U.innerHTML = "<input name='" + V + "'/>"; var T = document.documentElement; T.insertBefore(U, T.firstChild); if (!!document.getElementById(V)) { I.find.ID = function(X, Y, Z) { if (typeof Y.getElementById !== "undefined" && !Z) { var W = Y.getElementById(X[1]); return W ? W.id === X[1] || typeof W.getAttributeNode !== "undefined" && W.getAttributeNode("id").nodeValue === X[1] ? [W] : g : [] } }; I.filter.ID = function(Y, W) { var X = typeof Y.getAttributeNode !== "undefined" && Y.getAttributeNode("id"); return Y.nodeType === 1 && X && X.nodeValue === W } } T.removeChild(U) })(); (function() { var T = document.createElement("div"); T.appendChild(document.createComment("")); if (T.getElementsByTagName("*").length > 0) { I.find.TAG = function(U, Y) { var X = Y.getElementsByTagName(U[1]); if (U[1] === "*") { var W = []; for (var V = 0; X[V]; V++) { if (X[V].nodeType === 1) { W.push(X[V]) } } X = W } return X } } T.innerHTML = "<a href='#'></a>"; if (T.firstChild && typeof T.firstChild.getAttribute !== "undefined" && T.firstChild.getAttribute("href") !== "#") { I.attrHandle.href = function(U) { return U.getAttribute("href", 2) } } })(); if (document.querySelectorAll) { (function() { var T = F, U = document.createElement("div"); U.innerHTML = "<p class='TEST'></p>"; if (U.querySelectorAll && U.querySelectorAll(".TEST").length === 0) { return } F = function(Y, X, V, W) { X = X || document; if (!W && X.nodeType === 9 && !Q(X)) { try { return E(X.querySelectorAll(Y), V) } catch (Z) { } } return T(Y, X, V, W) }; F.find = T.find; F.filter = T.filter; F.selectors = T.selectors; F.matches = T.matches })() } if (document.getElementsByClassName && document.documentElement.getElementsByClassName) { (function() { var T = document.createElement("div"); T.innerHTML = "<div class='test e'></div><div class='test'></div>"; if (T.getElementsByClassName("e").length === 0) { return } T.lastChild.className = "e"; if (T.getElementsByClassName("e").length === 1) { return } I.order.splice(1, 0, "CLASS"); I.find.CLASS = function(U, V, W) { if (typeof V.getElementsByClassName !== "undefined" && !W) { return V.getElementsByClassName(U[1]) } } })() } function P(U, Z, Y, ad, aa, ac) { var ab = U == "previousSibling" && !ac; for (var W = 0, V = ad.length; W < V; W++) { var T = ad[W]; if (T) { if (ab && T.nodeType === 1) { T.sizcache = Y; T.sizset = W } T = T[U]; var X = false; while (T) { if (T.sizcache === Y) { X = ad[T.sizset]; break } if (T.nodeType === 1 && !ac) { T.sizcache = Y; T.sizset = W } if (T.nodeName === Z) { X = T; break } T = T[U] } ad[W] = X } } } function S(U, Z, Y, ad, aa, ac) { var ab = U == "previousSibling" && !ac; for (var W = 0, V = ad.length; W < V; W++) { var T = ad[W]; if (T) { if (ab && T.nodeType === 1) { T.sizcache = Y; T.sizset = W } T = T[U]; var X = false; while (T) { if (T.sizcache === Y) { X = ad[T.sizset]; break } if (T.nodeType === 1) { if (!ac) { T.sizcache = Y; T.sizset = W } if (typeof Z !== "string") { if (T === Z) { X = true; break } } else { if (F.filter(Z, [T]).length > 0) { X = T; break } } } T = T[U] } ad[W] = X } } } var K = document.compareDocumentPosition ? function(U, T) { return U.compareDocumentPosition(T) & 16 } : function(U, T) { return U !== T && (U.contains ? U.contains(T) : true) }; var Q = function(T) { return T.nodeType === 9 && T.documentElement.nodeName !== "HTML" || !!T.ownerDocument && Q(T.ownerDocument) }; var J = function(T, aa) { var W = [], X = "", Y, V = aa.nodeType ? [aa] : aa; while ((Y = I.match.PSEUDO.exec(T))) { X += Y[0]; T = T.replace(I.match.PSEUDO, "") } T = I.relative[T] ? T + "*" : T; for (var Z = 0, U = V.length; Z < U; Z++) { F(T, V[Z], W) } return F.filter(X, W) }; o.find = F; o.filter = F.filter; o.expr = F.selectors; o.expr[":"] = o.expr.filters; F.selectors.filters.hidden = function(T) { return T.offsetWidth === 0 || T.offsetHeight === 0 }; F.selectors.filters.visible = function(T) { return T.offsetWidth > 0 || T.offsetHeight > 0 }; F.selectors.filters.animated = function(T) { return o.grep(o.timers, function(U) { return T === U.elem }).length }; o.multiFilter = function(V, T, U) { if (U) { V = ":not(" + V + ")" } return F.matches(V, T) }; o.dir = function(V, U) { var T = [], W = V[U]; while (W && W != document) { if (W.nodeType == 1) { T.push(W) } W = W[U] } return T }; o.nth = function(X, T, V, W) { T = T || 1; var U = 0; for (; X; X = X[V]) { if (X.nodeType == 1 && ++U == T) { break } } return X }; o.sibling = function(V, U) { var T = []; for (; V; V = V.nextSibling) { if (V.nodeType == 1 && V != U) { T.push(V) } } return T }; return; l.Sizzle = F })(); o.event = { add: function(I, F, H, K) { if (I.nodeType == 3 || I.nodeType == 8) { return } if (I.setInterval && I != l) { I = l } if (!H.guid) { H.guid = this.guid++ } if (K !== g) { var G = H; H = this.proxy(G); H.data = K } var E = o.data(I, "events") || o.data(I, "events", {}), J = o.data(I, "handle") || o.data(I, "handle", function() { return typeof o !== "undefined" && !o.event.triggered ? o.event.handle.apply(arguments.callee.elem, arguments) : g }); J.elem = I; o.each(F.split(/\s+/), function(M, N) { var O = N.split("."); N = O.shift(); H.type = O.slice().sort().join("."); var L = E[N]; if (o.event.specialAll[N]) { o.event.specialAll[N].setup.call(I, K, O) } if (!L) { L = E[N] = {}; if (!o.event.special[N] || o.event.special[N].setup.call(I, K, O) === false) { if (I.addEventListener) { I.addEventListener(N, J, false) } else { if (I.attachEvent) { I.attachEvent("on" + N, J) } } } } L[H.guid] = H; o.event.global[N] = true }); I = null }, guid: 1, global: {}, remove: function(K, H, J) { if (K.nodeType == 3 || K.nodeType == 8) { return } var G = o.data(K, "events"), F, E; if (G) { if (H === g || (typeof H === "string" && H.charAt(0) == ".")) { for (var I in G) { this.remove(K, I + (H || "")) } } else { if (H.type) { J = H.handler; H = H.type } o.each(H.split(/\s+/), function(M, O) { var Q = O.split("."); O = Q.shift(); var N = RegExp("(^|\\.)" + Q.slice().sort().join(".*\\.") + "(\\.|$)"); if (G[O]) { if (J) { delete G[O][J.guid] } else { for (var P in G[O]) { if (N.test(G[O][P].type)) { delete G[O][P] } } } if (o.event.specialAll[O]) { o.event.specialAll[O].teardown.call(K, Q) } for (F in G[O]) { break } if (!F) { if (!o.event.special[O] || o.event.special[O].teardown.call(K, Q) === false) { if (K.removeEventListener) { K.removeEventListener(O, o.data(K, "handle"), false) } else { if (K.detachEvent) { K.detachEvent("on" + O, o.data(K, "handle")) } } } F = null; delete G[O] } } }) } for (F in G) { break } if (!F) { var L = o.data(K, "handle"); if (L) { L.elem = null } o.removeData(K, "events"); o.removeData(K, "handle") } } }, trigger: function(I, K, H, E) { var G = I.type || I; if (!E) { I = typeof I === "object" ? I[h] ? I : o.extend(o.Event(G), I) : o.Event(G); if (G.indexOf("!") >= 0) { I.type = G = G.slice(0, -1); I.exclusive = true } if (!H) { I.stopPropagation(); if (this.global[G]) { o.each(o.cache, function() { if (this.events && this.events[G]) { o.event.trigger(I, K, this.handle.elem) } }) } } if (!H || H.nodeType == 3 || H.nodeType == 8) { return g } I.result = g; I.target = H; K = o.makeArray(K); K.unshift(I) } I.currentTarget = H; var J = o.data(H, "handle"); if (J) { J.apply(H, K) } if ((!H[G] || (o.nodeName(H, "a") && G == "click")) && H["on" + G] && H["on" + G].apply(H, K) === false) { I.result = false } if (!E && H[G] && !I.isDefaultPrevented() && !(o.nodeName(H, "a") && G == "click")) { this.triggered = true; try { H[G]() } catch (L) { } } this.triggered = false; if (!I.isPropagationStopped()) { var F = H.parentNode || H.ownerDocument; if (F) { o.event.trigger(I, K, F, true) } } }, handle: function(K) { var J, E; K = arguments[0] = o.event.fix(K || l.event); K.currentTarget = this; var L = K.type.split("."); K.type = L.shift(); J = !L.length && !K.exclusive; var I = RegExp("(^|\\.)" + L.slice().sort().join(".*\\.") + "(\\.|$)"); E = (o.data(this, "events") || {})[K.type]; for (var G in E) { var H = E[G]; if (J || I.test(H.type)) { K.handler = H; K.data = H.data; var F = H.apply(this, arguments); if (F !== g) { K.result = F; if (F === false) { K.preventDefault(); K.stopPropagation() } } if (K.isImmediatePropagationStopped()) { break } } } }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function(H) { if (H[h]) { return H } var F = H; H = o.Event(F); for (var G = this.props.length, J; G; ) { J = this.props[--G]; H[J] = F[J] } if (!H.target) { H.target = H.srcElement || document } if (H.target.nodeType == 3) { H.target = H.target.parentNode } if (!H.relatedTarget && H.fromElement) { H.relatedTarget = H.fromElement == H.target ? H.toElement : H.fromElement } if (H.pageX == null && H.clientX != null) { var I = document.documentElement, E = document.body; H.pageX = H.clientX + (I && I.scrollLeft || E && E.scrollLeft || 0) - (I.clientLeft || 0); H.pageY = H.clientY + (I && I.scrollTop || E && E.scrollTop || 0) - (I.clientTop || 0) } if (!H.which && ((H.charCode || H.charCode === 0) ? H.charCode : H.keyCode)) { H.which = H.charCode || H.keyCode } if (!H.metaKey && H.ctrlKey) { H.metaKey = H.ctrlKey } if (!H.which && H.button) { H.which = (H.button & 1 ? 1 : (H.button & 2 ? 3 : (H.button & 4 ? 2 : 0))) } return H }, proxy: function(F, E) { E = E || function() { return F.apply(this, arguments) }; E.guid = F.guid = F.guid || E.guid || this.guid++; return E }, special: { ready: { setup: B, teardown: function() { } } }, specialAll: { live: { setup: function(E, F) { o.event.add(this, F[0], c) }, teardown: function(G) { if (G.length) { var E = 0, F = RegExp("(^|\\.)" + G[0] + "(\\.|$)"); o.each((o.data(this, "events").live || {}), function() { if (F.test(this.type)) { E++ } }); if (E < 1) { o.event.remove(this, G[0], c) } } } }} }; o.Event = function(E) { if (!this.preventDefault) { return new o.Event(E) } if (E && E.type) { this.originalEvent = E; this.type = E.type } else { this.type = E } this.timeStamp = e(); this[h] = true }; function k() { return false } function u() { return true } o.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = u; var E = this.originalEvent; if (!E) { return } if (E.preventDefault) { E.preventDefault() } E.returnValue = false }, stopPropagation: function() { this.isPropagationStopped = u; var E = this.originalEvent; if (!E) { return } if (E.stopPropagation) { E.stopPropagation() } E.cancelBubble = true }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = u; this.stopPropagation() }, isDefaultPrevented: k, isPropagationStopped: k, isImmediatePropagationStopped: k }; var a = function(F) { var E = F.relatedTarget; while (E && E != this) { try { E = E.parentNode } catch (G) { E = this } } if (E != this) { F.type = F.data; o.event.handle.apply(this, arguments) } }; o.each({ mouseover: "mouseenter", mouseout: "mouseleave" }, function(F, E) { o.event.special[E] = { setup: function() { o.event.add(this, F, a, E) }, teardown: function() { o.event.remove(this, F, a) } } }); o.fn.extend({ bind: function(F, G, E) { return F == "unload" ? this.one(F, G, E) : this.each(function() { o.event.add(this, F, E || G, E && G) }) }, one: function(G, H, F) { var E = o.event.proxy(F || H, function(I) { o(this).unbind(I, E); return (F || H).apply(this, arguments) }); return this.each(function() { o.event.add(this, G, E, F && H) }) }, unbind: function(F, E) { return this.each(function() { o.event.remove(this, F, E) }) }, trigger: function(E, F) { return this.each(function() { o.event.trigger(E, F, this) }) }, triggerHandler: function(E, G) { if (this[0]) { var F = o.Event(E); F.preventDefault(); F.stopPropagation(); o.event.trigger(F, G, this[0]); return F.result } }, toggle: function(G) { var E = arguments, F = 1; while (F < E.length) { o.event.proxy(G, E[F++]) } return this.click(o.event.proxy(G, function(H) { this.lastToggle = (this.lastToggle || 0) % F; H.preventDefault(); return E[this.lastToggle++].apply(this, arguments) || false })) }, hover: function(E, F) { return this.mouseenter(E).mouseleave(F) }, ready: function(E) { B(); if (o.isReady) { E.call(document, o) } else { o.readyList.push(E) } return this }, live: function(G, F) { var E = o.event.proxy(F); E.guid += this.selector + G; o(document).bind(i(G, this.selector), this.selector, E); return this }, die: function(F, E) { o(document).unbind(i(F, this.selector), E ? { guid: E.guid + this.selector + F} : null); return this } }); function c(H) { var E = RegExp("(^|\\.)" + H.type + "(\\.|$)"), G = true, F = []; o.each(o.data(this, "events").live || [], function(I, J) { if (E.test(J.type)) { var K = o(H.target).closest(J.data)[0]; if (K) { F.push({ elem: K, fn: J }) } } }); F.sort(function(J, I) { return o.data(J.elem, "closest") - o.data(I.elem, "closest") }); o.each(F, function() { if (this.fn.call(this.elem, H, this.fn.data) === false) { return (G = false) } }); return G } function i(F, E) { return ["live", F, E.replace(/\./g, "`").replace(/ /g, "|")].join(".") } o.extend({ isReady: false, readyList: [], ready: function() { if (!o.isReady) { o.isReady = true; if (o.readyList) { o.each(o.readyList, function() { this.call(document, o) }); o.readyList = null } o(document).triggerHandler("ready") } } }); var x = false; function B() { if (x) { return } x = true; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", function() { document.removeEventListener("DOMContentLoaded", arguments.callee, false); o.ready() }, false) } else { if (document.attachEvent) { document.attachEvent("onreadystatechange", function() { if (document.readyState === "complete") { document.detachEvent("onreadystatechange", arguments.callee); o.ready() } }); if (document.documentElement.doScroll && l == l.top) { (function() { if (o.isReady) { return } try { document.documentElement.doScroll("left") } catch (E) { setTimeout(arguments.callee, 0); return } o.ready() })() } } } o.event.add(l, "load", o.ready) } o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","), function(F, E) { o.fn[E] = function(G) { return G ? this.bind(E, G) : this.trigger(E) } }); o(l).bind("unload", function() { for (var E in o.cache) { if (E != 1 && o.cache[E].handle) { o.event.remove(o.cache[E].handle.elem) } } }); (function() { o.support = {}; var F = document.documentElement, G = document.createElement("script"), K = document.createElement("div"), J = "script" + (new Date).getTime(); K.style.display = "none"; K.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>'; var H = K.getElementsByTagName("*"), E = K.getElementsByTagName("a")[0]; if (!H || !H.length || !E) { return } o.support = { leadingWhitespace: K.firstChild.nodeType == 3, tbody: !K.getElementsByTagName("tbody").length, objectAll: !!K.getElementsByTagName("object")[0].getElementsByTagName("*").length, htmlSerialize: !!K.getElementsByTagName("link").length, style: /red/.test(E.getAttribute("style")), hrefNormalized: E.getAttribute("href") === "/a", opacity: E.style.opacity === "0.5", cssFloat: !!E.style.cssFloat, scriptEval: false, noCloneEvent: true, boxModel: null }; G.type = "text/javascript"; try { G.appendChild(document.createTextNode("window." + J + "=1;")) } catch (I) { } F.insertBefore(G, F.firstChild); if (l[J]) { o.support.scriptEval = true; delete l[J] } F.removeChild(G); if (K.attachEvent && K.fireEvent) { K.attachEvent("onclick", function() { o.support.noCloneEvent = false; K.detachEvent("onclick", arguments.callee) }); K.cloneNode(true).fireEvent("onclick") } o(function() { var L = document.createElement("div"); L.style.width = L.style.paddingLeft = "1px"; document.body.appendChild(L); o.boxModel = o.support.boxModel = L.offsetWidth === 2; document.body.removeChild(L).style.display = "none" }) })(); var w = o.support.cssFloat ? "cssFloat" : "styleFloat"; o.props = { "for": "htmlFor", "class": "className", "float": w, cssFloat: w, styleFloat: w, readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", tabindex: "tabIndex" }; o.fn.extend({ _load: o.fn.load, load: function(G, J, K) { if (typeof G !== "string") { return this._load(G) } var I = G.indexOf(" "); if (I >= 0) { var E = G.slice(I, G.length); G = G.slice(0, I) } var H = "GET"; if (J) { if (o.isFunction(J)) { K = J; J = null } else { if (typeof J === "object") { J = o.param(J); H = "POST" } } } var F = this; o.ajax({ url: G, type: H, dataType: "html", data: J, complete: function(M, L) { if (L == "success" || L == "notmodified") { F.html(E ? o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(E) : M.responseText) } if (K) { F.each(K, [M.responseText, L, M]) } } }); return this }, serialize: function() { return o.param(this.serializeArray()) }, serializeArray: function() { return this.map(function() { return this.elements ? o.makeArray(this.elements) : this }).filter(function() { return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password|search/i.test(this.type)) }).map(function(E, F) { var G = o(this).val(); return G == null ? null : o.isArray(G) ? o.map(G, function(I, H) { return { name: F.name, value: I} }) : { name: F.name, value: G} }).get() } }); o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(E, F) { o.fn[F] = function(G) { return this.bind(F, G) } }); var r = e(); o.extend({ get: function(E, G, H, F) { if (o.isFunction(G)) { H = G; G = null } return o.ajax({ type: "GET", url: E, data: G, success: H, dataType: F }) }, getScript: function(E, F) { return o.get(E, null, F, "script") }, getJSON: function(E, F, G) { return o.get(E, F, G, "json") }, post: function(E, G, H, F) { if (o.isFunction(G)) { H = G; G = {} } return o.ajax({ type: "POST", url: E, data: G, success: H, dataType: F }) }, ajaxSetup: function(E) { o.extend(o.ajaxSettings, E) }, ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, xhr: function() { return l.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest() }, accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*"} }, lastModified: {}, ajax: function(M) { M = o.extend(true, M, o.extend(true, {}, o.ajaxSettings, M)); var W, F = /=\?(&|$)/g, R, V, G = M.type.toUpperCase(); if (M.data && M.processData && typeof M.data !== "string") { M.data = o.param(M.data) } if (M.dataType == "jsonp") { if (G == "GET") { if (!M.url.match(F)) { M.url += (M.url.match(/\?/) ? "&" : "?") + (M.jsonp || "callback") + "=?" } } else { if (!M.data || !M.data.match(F)) { M.data = (M.data ? M.data + "&" : "") + (M.jsonp || "callback") + "=?" } } M.dataType = "json" } if (M.dataType == "json" && (M.data && M.data.match(F) || M.url.match(F))) { W = "jsonp" + r++; if (M.data) { M.data = (M.data + "").replace(F, "=" + W + "$1") } M.url = M.url.replace(F, "=" + W + "$1"); M.dataType = "script"; l[W] = function(X) { V = X; I(); L(); l[W] = g; try { delete l[W] } catch (Y) { } if (H) { H.removeChild(T) } } } if (M.dataType == "script" && M.cache == null) { M.cache = false } if (M.cache === false && G == "GET") { var E = e(); var U = M.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + E + "$2"); M.url = U + ((U == M.url) ? (M.url.match(/\?/) ? "&" : "?") + "_=" + E : "") } if (M.data && G == "GET") { M.url += (M.url.match(/\?/) ? "&" : "?") + M.data; M.data = null } if (M.global && !o.active++) { o.event.trigger("ajaxStart") } var Q = /^(\w+:)?\/\/([^\/?#]+)/.exec(M.url); if (M.dataType == "script" && G == "GET" && Q && (Q[1] && Q[1] != location.protocol || Q[2] != location.host)) { var H = document.getElementsByTagName("head")[0]; var T = document.createElement("script"); T.src = M.url; if (M.scriptCharset) { T.charset = M.scriptCharset } if (!W) { var O = false; T.onload = T.onreadystatechange = function() { if (!O && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) { O = true; I(); L(); T.onload = T.onreadystatechange = null; H.removeChild(T) } } } H.appendChild(T); return g } var K = false; var J = M.xhr(); if (M.username) { J.open(G, M.url, M.async, M.username, M.password) } else { J.open(G, M.url, M.async) } try { if (M.data) { J.setRequestHeader("Content-Type", M.contentType) } if (M.ifModified) { J.setRequestHeader("If-Modified-Since", o.lastModified[M.url] || "Thu, 01 Jan 1970 00:00:00 GMT") } J.setRequestHeader("X-Requested-With", "XMLHttpRequest"); J.setRequestHeader("Accept", M.dataType && M.accepts[M.dataType] ? M.accepts[M.dataType] + ", */*" : M.accepts._default) } catch (S) { } if (M.beforeSend && M.beforeSend(J, M) === false) { if (M.global && ! --o.active) { o.event.trigger("ajaxStop") } J.abort(); return false } if (M.global) { o.event.trigger("ajaxSend", [J, M]) } var N = function(X) { if (J.readyState == 0) { if (P) { clearInterval(P); P = null; if (M.global && ! --o.active) { o.event.trigger("ajaxStop") } } } else { if (!K && J && (J.readyState == 4 || X == "timeout")) { K = true; if (P) { clearInterval(P); P = null } R = X == "timeout" ? "timeout" : !o.httpSuccess(J) ? "error" : M.ifModified && o.httpNotModified(J, M.url) ? "notmodified" : "success"; if (R == "success") { try { V = o.httpData(J, M.dataType, M) } catch (Z) { R = "parsererror" } } if (R == "success") { var Y; try { Y = J.getResponseHeader("Last-Modified") } catch (Z) { } if (M.ifModified && Y) { o.lastModified[M.url] = Y } if (!W) { I() } } else { o.handleError(M, J, R) } L(); if (X) { J.abort() } if (M.async) { J = null } } } }; if (M.async) { var P = setInterval(N, 13); if (M.timeout > 0) { setTimeout(function() { if (J && !K) { N("timeout") } }, M.timeout) } } try { J.send(M.data) } catch (S) { o.handleError(M, J, null, S) } if (!M.async) { N() } function I() { if (M.success) { M.success(V, R) } if (M.global) { o.event.trigger("ajaxSuccess", [J, M]) } } function L() { if (M.complete) { M.complete(J, R) } if (M.global) { o.event.trigger("ajaxComplete", [J, M]) } if (M.global && ! --o.active) { o.event.trigger("ajaxStop") } } return J }, handleError: function(F, H, E, G) { if (F.error) { F.error(H, E, G) } if (F.global) { o.event.trigger("ajaxError", [H, F, G]) } }, active: 0, httpSuccess: function(F) { try { return !F.status && location.protocol == "file:" || (F.status >= 200 && F.status < 300) || F.status == 304 || F.status == 1223 } catch (E) { } return false }, httpNotModified: function(G, E) { try { var H = G.getResponseHeader("Last-Modified"); return G.status == 304 || H == o.lastModified[E] } catch (F) { } return false }, httpData: function(J, H, G) { var F = J.getResponseHeader("content-type"), E = H == "xml" || !H && F && F.indexOf("xml") >= 0, I = E ? J.responseXML : J.responseText; if (E && I.documentElement.tagName == "parsererror") { throw "parsererror" } if (G && G.dataFilter) { I = G.dataFilter(I, H) } if (typeof I === "string") { if (H == "script") { o.globalEval(I) } if (H == "json") { I = l["eval"]("(" + I + ")") } } return I }, param: function(E) { var G = []; function H(I, J) { G[G.length] = encodeURIComponent(I) + "=" + encodeURIComponent(J) } if (o.isArray(E) || E.jquery) { o.each(E, function() { H(this.name, this.value) }) } else { for (var F in E) { if (o.isArray(E[F])) { o.each(E[F], function() { H(F, this) }) } else { H(F, o.isFunction(E[F]) ? E[F]() : E[F]) } } } return G.join("&").replace(/%20/g, "+") } }); var m = {}, n, d = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]]; function t(F, E) { var G = {}; o.each(d.concat.apply([], d.slice(0, E)), function() { G[this] = F }); return G } o.fn.extend({ show: function(J, L) { if (J) { return this.animate(t("show", 3), J, L) } else { for (var H = 0, F = this.length; H < F; H++) { var E = o.data(this[H], "olddisplay"); this[H].style.display = E || ""; if (o.css(this[H], "display") === "none") { var G = this[H].tagName, K; if (m[G]) { K = m[G] } else { var I = o("<" + G + " />").appendTo("body"); K = I.css("display"); if (K === "none") { K = "block" } I.remove(); m[G] = K } o.data(this[H], "olddisplay", K) } } for (var H = 0, F = this.length; H < F; H++) { this[H].style.display = o.data(this[H], "olddisplay") || "" } return this } }, hide: function(H, I) { if (H) { return this.animate(t("hide", 3), H, I) } else { for (var G = 0, F = this.length; G < F; G++) { var E = o.data(this[G], "olddisplay"); if (!E && E !== "none") { o.data(this[G], "olddisplay", o.css(this[G], "display")) } } for (var G = 0, F = this.length; G < F; G++) { this[G].style.display = "none" } return this } }, _toggle: o.fn.toggle, toggle: function(G, F) { var E = typeof G === "boolean"; return o.isFunction(G) && o.isFunction(F) ? this._toggle.apply(this, arguments) : G == null || E ? this.each(function() { var H = E ? G : o(this).is(":hidden"); o(this)[H ? "show" : "hide"]() }) : this.animate(t("toggle", 3), G, F) }, fadeTo: function(E, G, F) { return this.animate({ opacity: G }, E, F) }, animate: function(I, F, H, G) { var E = o.speed(F, H, G); return this[E.queue === false ? "each" : "queue"](function() { var K = o.extend({}, E), M, L = this.nodeType == 1 && o(this).is(":hidden"), J = this; for (M in I) { if (I[M] == "hide" && L || I[M] == "show" && !L) { return K.complete.call(this) } if ((M == "height" || M == "width") && this.style) { K.display = o.css(this, "display"); K.overflow = this.style.overflow } } if (K.overflow != null) { this.style.overflow = "hidden" } K.curAnim = o.extend({}, I); o.each(I, function(O, S) { var R = new o.fx(J, K, O); if (/toggle|show|hide/.test(S)) { R[S == "toggle" ? L ? "show" : "hide" : S](I) } else { var Q = S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), T = R.cur(true) || 0; if (Q) { var N = parseFloat(Q[2]), P = Q[3] || "px"; if (P != "px") { J.style[O] = (N || 1) + P; T = ((N || 1) / R.cur(true)) * T; J.style[O] = T + P } if (Q[1]) { N = ((Q[1] == "-=" ? -1 : 1) * N) + T } R.custom(T, N, P) } else { R.custom(T, S, "") } } }); return true }) }, stop: function(F, E) { var G = o.timers; if (F) { this.queue([]) } this.each(function() { for (var H = G.length - 1; H >= 0; H--) { if (G[H].elem == this) { if (E) { G[H](true) } G.splice(H, 1) } } }); if (!E) { this.dequeue() } return this } }); o.each({ slideDown: t("show", 1), slideUp: t("hide", 1), slideToggle: t("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide"} }, function(E, F) { o.fn[E] = function(G, H) { return this.animate(F, G, H) } }); o.extend({ speed: function(G, H, F) { var E = typeof G === "object" ? G : { complete: F || !F && H || o.isFunction(G) && G, duration: G, easing: F && H || H && !o.isFunction(H) && H }; E.duration = o.fx.off ? 0 : typeof E.duration === "number" ? E.duration : o.fx.speeds[E.duration] || o.fx.speeds._default; E.old = E.complete; E.complete = function() { if (E.queue !== false) { o(this).dequeue() } if (o.isFunction(E.old)) { E.old.call(this) } }; return E }, easing: { linear: function(G, H, E, F) { return E + F * G }, swing: function(G, H, E, F) { return ((-Math.cos(G * Math.PI) / 2) + 0.5) * F + E } }, timers: [], fx: function(F, E, G) { this.options = E; this.elem = F; this.prop = G; if (!E.orig) { E.orig = {} } } }); o.fx.prototype = { update: function() { if (this.options.step) { this.options.step.call(this.elem, this.now, this) } (o.fx.step[this.prop] || o.fx.step._default)(this); if ((this.prop == "height" || this.prop == "width") && this.elem.style) { this.elem.style.display = "block" } }, cur: function(F) { if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) { return this.elem[this.prop] } var E = parseFloat(o.css(this.elem, this.prop, F)); return E && E > -10000 ? E : parseFloat(o.curCSS(this.elem, this.prop)) || 0 }, custom: function(I, H, G) { this.startTime = e(); this.start = I; this.end = H; this.unit = G || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; var E = this; function F(J) { return E.step(J) } F.elem = this.elem; if (F() && o.timers.push(F) && !n) { n = setInterval(function() { var K = o.timers; for (var J = 0; J < K.length; J++) { if (!K[J]()) { K.splice(J--, 1) } } if (!K.length) { clearInterval(n); n = g } }, 13) } }, show: function() { this.options.orig[this.prop] = o.attr(this.elem.style, this.prop); this.options.show = true; this.custom(this.prop == "width" || this.prop == "height" ? 1 : 0, this.cur()); o(this.elem).show() }, hide: function() { this.options.orig[this.prop] = o.attr(this.elem.style, this.prop); this.options.hide = true; this.custom(this.cur(), 0) }, step: function(H) { var G = e(); if (H || G >= this.options.duration + this.startTime) { this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[this.prop] = true; var E = true; for (var F in this.options.curAnim) { if (this.options.curAnim[F] !== true) { E = false } } if (E) { if (this.options.display != null) { this.elem.style.overflow = this.options.overflow; this.elem.style.display = this.options.display; if (o.css(this.elem, "display") == "none") { this.elem.style.display = "block" } } if (this.options.hide) { o(this.elem).hide() } if (this.options.hide || this.options.show) { for (var I in this.options.curAnim) { o.attr(this.elem.style, I, this.options.orig[I]) } } this.options.complete.call(this.elem) } return false } else { var J = G - this.startTime; this.state = J / this.options.duration; this.pos = o.easing[this.options.easing || (o.easing.swing ? "swing" : "linear")](this.state, J, 0, 1, this.options.duration); this.now = this.start + ((this.end - this.start) * this.pos); this.update() } return true } }; o.extend(o.fx, { speeds: { slow: 600, fast: 200, _default: 400 }, step: { opacity: function(E) { o.attr(E.elem.style, "opacity", E.now) }, _default: function(E) { if (E.elem.style && E.elem.style[E.prop] != null) { E.elem.style[E.prop] = E.now + E.unit } else { E.elem[E.prop] = E.now } } } }); if (document.documentElement.getBoundingClientRect) { o.fn.offset = function() { if (!this[0]) { return { top: 0, left: 0} } if (this[0] === this[0].ownerDocument.body) { return o.offset.bodyOffset(this[0]) } var G = this[0].getBoundingClientRect(), J = this[0].ownerDocument, F = J.body, E = J.documentElement, L = E.clientTop || F.clientTop || 0, K = E.clientLeft || F.clientLeft || 0, I = G.top + (self.pageYOffset || o.boxModel && E.scrollTop || F.scrollTop) - L, H = G.left + (self.pageXOffset || o.boxModel && E.scrollLeft || F.scrollLeft) - K; return { top: I, left: H} } } else { o.fn.offset = function() { if (!this[0]) { return { top: 0, left: 0} } if (this[0] === this[0].ownerDocument.body) { return o.offset.bodyOffset(this[0]) } o.offset.initialized || o.offset.initialize(); var J = this[0], G = J.offsetParent, F = J, O = J.ownerDocument, M, H = O.documentElement, K = O.body, L = O.defaultView, E = L.getComputedStyle(J, null), N = J.offsetTop, I = J.offsetLeft; while ((J = J.parentNode) && J !== K && J !== H) { M = L.getComputedStyle(J, null); N -= J.scrollTop, I -= J.scrollLeft; if (J === G) { N += J.offsetTop, I += J.offsetLeft; if (o.offset.doesNotAddBorder && !(o.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(J.tagName))) { N += parseInt(M.borderTopWidth, 10) || 0, I += parseInt(M.borderLeftWidth, 10) || 0 } F = G, G = J.offsetParent } if (o.offset.subtractsBorderForOverflowNotVisible && M.overflow !== "visible") { N += parseInt(M.borderTopWidth, 10) || 0, I += parseInt(M.borderLeftWidth, 10) || 0 } E = M } if (E.position === "relative" || E.position === "static") { N += K.offsetTop, I += K.offsetLeft } if (E.position === "fixed") { N += Math.max(H.scrollTop, K.scrollTop), I += Math.max(H.scrollLeft, K.scrollLeft) } return { top: N, left: I} } } o.offset = { initialize: function() { if (this.initialized) { return } var L = document.body, F = document.createElement("div"), H, G, N, I, M, E, J = L.style.marginTop, K = '<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>'; M = { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" }; for (E in M) { F.style[E] = M[E] } F.innerHTML = K; L.insertBefore(F, L.firstChild); H = F.firstChild, G = H.firstChild, I = H.nextSibling.firstChild.firstChild; this.doesNotAddBorder = (G.offsetTop !== 5); this.doesAddBorderForTableAndCells = (I.offsetTop === 5); H.style.overflow = "hidden", H.style.position = "relative"; this.subtractsBorderForOverflowNotVisible = (G.offsetTop === -5); L.style.marginTop = "1px"; this.doesNotIncludeMarginInBodyOffset = (L.offsetTop === 0); L.style.marginTop = J; L.removeChild(F); this.initialized = true }, bodyOffset: function(E) { o.offset.initialized || o.offset.initialize(); var G = E.offsetTop, F = E.offsetLeft; if (o.offset.doesNotIncludeMarginInBodyOffset) { G += parseInt(o.curCSS(E, "marginTop", true), 10) || 0, F += parseInt(o.curCSS(E, "marginLeft", true), 10) || 0 } return { top: G, left: F} } }; o.fn.extend({ position: function() { var I = 0, H = 0, F; if (this[0]) { var G = this.offsetParent(), J = this.offset(), E = /^body|html$/i.test(G[0].tagName) ? { top: 0, left: 0} : G.offset(); J.top -= j(this, "marginTop"); J.left -= j(this, "marginLeft"); E.top += j(G, "borderTopWidth"); E.left += j(G, "borderLeftWidth"); F = { top: J.top - E.top, left: J.left - E.left} } return F }, offsetParent: function() { var E = this[0].offsetParent || document.body; while (E && (!/^body|html$/i.test(E.tagName) && o.css(E, "position") == "static")) { E = E.offsetParent } return o(E) } }); o.each(["Left", "Top"], function(F, E) { var G = "scroll" + E; o.fn[G] = function(H) { if (!this[0]) { return null } return H !== g ? this.each(function() { this == l || this == document ? l.scrollTo(!F ? H : o(l).scrollLeft(), F ? H : o(l).scrollTop()) : this[G] = H }) : this[0] == l || this[0] == document ? self[F ? "pageYOffset" : "pageXOffset"] || o.boxModel && document.documentElement[G] || document.body[G] : this[0][G] } }); o.each(["Height", "Width"], function(I, G) { var E = I ? "Left" : "Top", H = I ? "Right" : "Bottom", F = G.toLowerCase(); o.fn["inner" + G] = function() { return this[0] ? o.css(this[0], F, false, "padding") : null }; o.fn["outer" + G] = function(K) { return this[0] ? o.css(this[0], F, false, K ? "margin" : "border") : null }; var J = G.toLowerCase(); o.fn[J] = function(K) { return this[0] == l ? document.compatMode == "CSS1Compat" && document.documentElement["client" + G] || document.body["client" + G] : this[0] == document ? Math.max(document.documentElement["client" + G], document.body["scroll" + G], document.documentElement["scroll" + G], document.body["offset" + G], document.documentElement["offset" + G]) : K === g ? (this.length ? o.css(this[0], J) : null) : this.css(J, typeof K === "string" ? K : K + "px") } })
})();


/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/

/*

The code has been modified to ensure compatibility when using side by side with swfobject.js

- Main code moved inside an object to avoid global variables.
- Using window.onload event, you should remove the defer keyword from the script tag.

*/

window.addLoadEvent = function(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

var pngfix = {

    main: function() {

        if ((parseFloat(navigator.appVersion.split("MSIE")[1]) >= 5.5) && (document.body.filters)) {
            for (var i = 0; i < document.images.length; i++) {
                var img = document.images[i]
                var imgName = img.src.toUpperCase()
                if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                    var imgID = (img.id) ? "id='" + img.id + "' " : ""
                    var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                    var imgStyle = "display:inline-block;" + img.style.cssText
                    if (img.align == "left") imgStyle = "float:left;" + imgStyle
                    if (img.align == "right") imgStyle = "float:right;" + imgStyle
                    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                    var strNewHTML = "<span " + imgID + imgClass + imgTitle
               + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
               + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
               + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                    img.outerHTML = strNewHTML
                    i = i - 1
                }
            }
        }
    }
}

window.addLoadEvent(function() { pngfix.main(); });

// JavaScript Document 

function showTextBoxPrompt(txtBox, prompt, emptyAlign) {
    if (txtBox.value == '') {
        txtBox.value = prompt;
        txtBox.style.textAlign = (emptyAlign) ? emptyAlign : 'center';
    }
}

function hideTextBoxPrompt(txtBox, prompt) {
    if (txtBox.value == prompt) {
        txtBox.value = '';
        txtBox.style.textAlign = 'left';
    }
}
function KeyDownSubmitHandler(event, item) {

    if (event.keyCode == 13) {
        if (item) {
            item.form.submit();
        }
        return false;
    }
}
function JavascriptValidatingClass(obj, text) {
    this.obj = obj;
    this.text = text;
}
var javascriptRequiredValidatingList = new Array();
var javascriptEmailValidatingList = new Array();

function addToRequiredJavascriptValiating(obj, showtext) {
    valObj = new JavascriptValidatingClass(obj, showtext);
    javascriptRequiredValidatingList[javascriptRequiredValidatingList.length] = valObj;
}
function addToEmailJavascriptValiating(obj, showtext) {
    valObj = new JavascriptValidatingClass(obj, showtext);
    javascriptEmailValidatingList[javascriptEmailValidatingList.length] = valObj;
}

function validateTheLists() {
    if (javascriptRequiredValidatingList && javascriptRequiredValidatingList.length) {
        for (ix = 0; ix < javascriptRequiredValidatingList.length; ix++) {
            if (javascriptRequiredValidatingList[ix].obj && javascriptRequiredValidatingList[ix].obj.value == "") {
                addErrorMsg("Please enter " + javascriptRequiredValidatingList[ix].text);
                javascriptRequiredValidatingList[ix].obj.focus();
                return false;
            }
        }
    }
    if (javascriptEmailValidatingList && javascriptEmailValidatingList.length) {
        for (ix = 0; ix < javascriptEmailValidatingList.length; ix++) {
            if (javascriptEmailValidatingList[ix].obj && !checkEmail(javascriptEmailValidatingList[ix].obj.value)) {
                addErrorMsg("Please check the email address of " + javascriptEmailValidatingList[ix].text);
                javascriptEmailValidatingList[ix].obj.focus();
                return false;
            }
        }
    }
    return true;
}
function addErrorMsg(errStr) {
    $('#errormsgArea').show().html(errStr);
}
function checkEmail(emailaddr) {
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(emailaddr)) {
        return false;
    } else return true;
}

//------------Timer convert the time, count down and display
//this js must be after jquery js file
var timerArray = new Array();
function TimeCounter(hours, minutes, seconds, days) {
    this.days = days;
    if (this.days == null) {
        this.days = 0;
    }
    this.hours = hours;
    this.minutes = minutes;
    this.seconds = seconds;
    this.init = init;
    this.displayTimeCountDown = null;
    this.getCountDownTime = getCountDownTime;
    this.realSeconds = 61;
    this.getDays = getDays;
    this.getHours = getHours;
    this.getMinutes = getMinutes;
    this.getSeconds = getSeconds;
    this.getDoubleDigitalNumber = getDoubleDigitalNumber;
    this.refreshUrl = null;
    if (this.days == 0 && this.hours == 0 && this.minutes == 0 && this.seconds == 0){
      this.closed = true;
    } else {
      this.closed = false;
    }
}
function getDays() {
    return getDoubleDigitalNumber(this.days);
}
function getHours() {
    return getDoubleDigitalNumber(this.hours);
}
function getMinutes() {
    return getDoubleDigitalNumber(this.minutes);
}
function getSeconds() {
    return this.getDoubleDigitalNumber(this.seconds);
}
function getDoubleDigitalNumber(num) {
    if (num < 10 && num > -1) {
        return "0" + num;
    } else
        return "" + num;
}
function getCountDownTime() {
    if (this.seconds != 0 || this.minutes != 0 || this.hours != 0 || this.days != 0) {
        if (this.seconds == 0) {
            if (this.hours > 0 || this.days > 0 || this.minutes > 0) {
                this.seconds = 59;
            }
            if (this.minutes == 0) {
                if (this.hours > 0 || this.days > 0) {
                    this.minutes = 59;
                }
                if (this.hours == 0) {
                    if (this.days > 0) {
                        this.hours = 23;
                    }
                    this.days = this.days - 1;
                    if (this.days < 0) {
                        this.days = 0;
                    }
                } else {
                    this.hours = this.hours - 1;
                }
            } else {
                this.minutes = this.minutes - 1;
            }
        } else {
            this.seconds = this.seconds - 1;
        }
    } else {
      if (this.closed == false){
        if (this.refreshUrl == null || this.refreshUrl == ''){
          window.location = '/activeAuction.do';
        } else {
          window.location = this.refreshUrl;
        }
        this.closed = true;
      }
    }
}
function init() {
    timerArray[timerArray.length] = this;
}
function showTimeCountDown() {
    if (timerArray) {
        for (ix = 0; ix < timerArray.length; ix++) {
            if (timerArray[ix].displayTimeCountDown) {
                var timer = new Date();
                if (timer.getSeconds() != timerArray[ix].realSeconds) {
                    timerArray[ix].getCountDownTime();
                    timerArray[ix].displayTimeCountDown();
                    timerArray[ix].realSeconds = timer.getSeconds();
                }
            }
        }
    }
}
//only once this function on init 
$(document).ready(function() {
    window.setInterval("showTimeCountDown()", 120);
});



var thumbnailviewer2 = {
    enableTitle: true, //Should "title" attribute of link be used as description?
    enableTransition: true, //Enable fading transition in IE?
    hideimgmouseout: false, //Hide enlarged image when mouse moves out of anchor link? (if enlarged image is hyperlinked, always set to false!)

    /////////////No need to edit beyond here/////////////////////////

    iefilterstring: 'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)', //IE specific multimedia filter string
    iefiltercapable: document.compatMode && window.createPopup ? true : false, //Detect browser support for IE filters
    preloadedimages: [], //array to preload enlarged images (ones set to display "onmouseover"
    targetlinks: [], //array to hold participating links (those with rel="enlargeimage:initType")
    alreadyrunflag: false, //flag to indicate whether init() function has been run already come window.onload

    loadimage: function(linkobj) {
        var imagepath = linkobj.getAttribute("href") //Get URL to enlarged image
        var showcontainer = document.getElementById(linkobj.getAttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
        var dest = linkobj.getAttribute("rev").split("::")[1] //Get URL enlarged image should be linked to, if any
        var description = (thumbnailviewer2.enableTitle && linkobj.getAttribute("title")) ? linkobj.getAttribute("title") : "" //Get title attr
        var imageHTML = '<img src="' + imagepath + '" style="border-width: 0" />' //Construct HTML for enlarged image
        if (typeof dest != "undefined") //Hyperlink the enlarged image?
            imageHTML = '<a href="' + dest + '">' + imageHTML + '</a>'
        if (description != "") //Use title attr of the link as description?
            imageHTML += '<br />' + description
        if (this.iefiltercapable) { //Is this an IE browser that supports filters?
            showcontainer.style.filter = this.iefilterstring
            showcontainer.filters[0].Apply()
        }
        showcontainer.innerHTML = imageHTML
        loadThickBox(linkobj);
        this.featureImage = showcontainer.getElementsByTagName("img")[0]; //Reference enlarged image itself
        // Allow the page to do some work when a thumbnail is shown
        //	if (self.showThumbnailAlert) {
        //		self.showThumbnailAlert(this.featureImage);		
        //}

        // Do the resize here as well as after load in an attempt to get it working in firefox
        // Does not work			correctTabAreaHeight(this.featureImage);

        $(this.featureImage).bind("load", function(e) {
            //document.showThumbnailAlert(this.featureImage);


            if (thumbnailviewer2.iefiltercapable) { //Is this an IE browser that supports filters?		
                showcontainer.filters[0].Play()
            }

            var img = showcontainer.getElementsByTagName("img")[0];
            correctTabAreaHeight(img);


        }
		);


        function correctTabAreaHeight(img) {

            if (document.getElementById('descriptiontab')) { // Only for the product detail page.  Should really be moved out of here.

                //var tabHeight = (600 - img.height);
                var tabHeight = 308 + (350 - img.height);

                document.getElementById('descriptiontab').style.height = tabHeight + "px";
                document.getElementById('footnotetab').style.height = tabHeight + "px";
                document.getElementById('similartab').style.height = tabHeight + "px";
            }
        }


        this.featureImage.onerror = function() { //If an error has occurred while loading the image to show
            if (thumbnailviewer2.iefiltercapable) //Is this an IE browser that supports filters?
                showcontainer.filters[0].Stop()
        }
    },

    hideimage: function(linkobj) {
        var showcontainer = document.getElementById(linkobj.getAttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
        showcontainer.innerHTML = ""
    },


    cleanup: function() { //Clean up routine on page unload
        if (this.featureImage) { this.featureImage.onload = null; this.featureImage.onerror = null; this.featureImage = null }
        this.showcontainer = null
        for (var i = 0; i < this.targetlinks.length; i++) {
            this.targetlinks[i].onclick = null
            this.targetlinks[i].onmouseover = null
            this.targetlinks[i].onmouseout = null
        }
    },

    addEvent: function(target, functionref, tasktype) { //assign a function to execute to an event handler (ie: onunload)
        var tasktype = (window.addEventListener) ? tasktype : "on" + tasktype
        if (target.addEventListener)
            target.addEventListener(tasktype, functionref, false)
        else if (target.attachEvent)
            target.attachEvent(tasktype, functionref)
    },

    init: function() { //Initialize thumbnail viewer script
        this.iefiltercapable = (this.iefiltercapable && this.enableTransition) //True or false: IE filters supported and is enabled by user
        var pagelinks = document.getElementsByTagName("a")
        for (var i = 0; i < pagelinks.length; i++) { //BEGIN FOR LOOP
            if (pagelinks[i].getAttribute("rel") && /enlargeimage:/i.test(pagelinks[i].getAttribute("rel"))) { //Begin if statement: Test for rel="enlargeimage"
                var initType = pagelinks[i].getAttribute("rel").split("::")[1] //Get display type of enlarged image ("click" or "mouseover")
                if (initType == "mouseover") { //If type is "mouseover", preload the enlarged image for quicker display
                    this.preloadedimages[this.preloadedimages.length] = new Image()
                    this.preloadedimages[this.preloadedimages.length - 1].src = pagelinks[i].href
                    pagelinks[i]["onclick"] = function() { //Cancel default click action
                        return false
                    }
                }
                pagelinks[i]["on" + initType] = function() { //Load enlarged image based on the specified display type (event)
                    thumbnailviewer2.loadimage(this) //Load image
                    return false
                }
                if (this.hideimgmouseout)
                    pagelinks[i]["onmouseout"] = function() {
                        thumbnailviewer2.hideimage(this)
                    }
                this.targetlinks[this.targetlinks.length] = pagelinks[i] //store reference to target link
            } //end if statement
        } //END FOR LOOP


    } //END init() function

}


if (document.addEventListener) //Take advantage of "DOMContentLoaded" event in select Mozilla/ Opera browsers for faster init
    thumbnailviewer2.addEvent(document, function() { thumbnailviewer2.alreadyrunflag = 1; thumbnailviewer2.init() }, "DOMContentLoaded") //Initialize script on page load
else if (document.all && document.getElementsByTagName("a").length > 0) { //Take advantage of "defer" attr inside SCRIPT tag in IE for instant init
    thumbnailviewer2.alreadyrunflag = 1
    thumbnailviewer2.init()
}
thumbnailviewer2.addEvent(window, function() { if (!thumbnailviewer2.alreadyrunflag) thumbnailviewer2.init() }, "load") //Default init method: window.onload
thumbnailviewer2.addEvent(window, function() { thumbnailviewer2.cleanup() }, "unload");
/***This is a plugin to MouseOver to add new function - load thickbox url to change the image on popup****/
function loadThickBox(linkobj) {
    var parentobj = linkobj.parentNode;
    if (parentobj) {
        for (ixx = 0; ixx < parentobj.childElementCount; ixx++) {
            if (parentobj.children.item(ixx) == linkobj && parentobj.children.item(ixx + 1).getAttribute("rel") == 'gallareygroups') {
                $(".thickbox").attr("href", parentobj.children.item(ixx + 1).getAttribute("href"));
            }
        }
    }
}
/**
* jCarousel - Riding carousels with jQuery
*   http://sorgalla.com/jcarousel/
*
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built on top of the jQuery library
*   http://jquery.com
*
* Inspired by the "Carousel Component" by Bill Scott
*   http://billwscott.com/carousel/
*/

(function($) {
    /**
    * Creates a carousel for all matched elements.
    *
    * @example $("#mycarousel").jcarousel();
    * @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul>
    * @result
    *
    * <div class="jcarousel-skin-name">
    *   <div class="jcarousel-container">
    *     <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
    *     <div class="jcarousel-next"></div>
    *     <div class="jcarousel-clip">
    *       <ul class="jcarousel-list">
    *         <li class="jcarousel-item-1">First item</li>
    *         <li class="jcarousel-item-2">Second item</li>
    *       </ul>
    *     </div>
    *   </div>
    * </div>
    *
    * @name jcarousel
    * @type jQuery
    * @param Hash o A set of key/value pairs to set as configuration properties.
    * @cat Plugins/jCarousel
    */
    $.fn.jcarousel = function(o) {
        return this.each(function() {
            new $jc(this, o);
        });
    };

    // Default configuration properties.
    var defaults = {
        vertical: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        visible: null,
        animation: 'normal',
        easing: 'swing',
        auto: 0,
        wrap: null,
        initCallback: null,
        reloadCallback: null,
        itemLoadCallback: null,
        itemFirstInCallback: null,
        itemFirstOutCallback: null,
        itemLastInCallback: null,
        itemLastOutCallback: null,
        itemVisibleInCallback: null,
        itemVisibleOutCallback: null,
        buttonNextHTML: '<div></div>',
        buttonPrevHTML: '<div></div>',
        buttonNextEvent: 'click',
        buttonPrevEvent: 'click',
        buttonNextCallback: null,
        buttonPrevCallback: null
    };

    /**
    * The jCarousel object.
    *
    * @constructor
    * @name $.jcarousel
    * @param Object e The element to create the carousel for.
    * @param Hash o A set of key/value pairs to set as configuration properties.
    * @cat Plugins/jCarousel
    */
    $.jcarousel = function(e, o) {
        this.options = $.extend({}, defaults, o || {});

        this.locked = false;

        this.container = null;
        this.clip = null;
        this.list = null;
        this.buttonNext = null;
        this.buttonPrev = null;

        this.wh = !this.options.vertical ? 'width' : 'height';
        this.lt = !this.options.vertical ? 'left' : 'top';

        // Extract skin class
        var skin = '', split = e.className.split(' ');

        for (var i = 0; i < split.length; i++) {
            if (split[i].indexOf('jcarousel-skin') != -1) {
                $(e).removeClass(split[i]);
                var skin = split[i];
                break;
            }
        }

        if (e.nodeName == 'UL' || e.nodeName == 'OL') {
            this.list = $(e);
            this.container = this.list.parent();

            if (this.container.hasClass('jcarousel-clip')) {
                if (!this.container.parent().hasClass('jcarousel-container'))
                    this.container = this.container.wrap('<div></div>');

                this.container = this.container.parent();
            } else if (!this.container.hasClass('jcarousel-container'))
                this.container = this.list.wrap('<div></div>').parent();
        } else {
            this.container = $(e);
            this.list = $(e).find('>ul,>ol,div>ul,div>ol');
        }

        if (skin != '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1)
            this.container.wrap('<div class=" ' + skin + '"></div>');

        this.clip = this.list.parent();

        if (!this.clip.length || !this.clip.hasClass('jcarousel-clip'))
            this.clip = this.list.wrap('<div></div>').parent();

        this.buttonPrev = $('.jcarousel-prev', this.container);

        if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
            this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();

        this.buttonPrev.addClass(this.className('jcarousel-prev'));

        this.buttonNext = $('.jcarousel-next', this.container);

        if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
            this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();

        this.buttonNext.addClass(this.className('jcarousel-next'));

        this.clip.addClass(this.className('jcarousel-clip'));
        this.list.addClass(this.className('jcarousel-list'));
        this.container.addClass(this.className('jcarousel-container'));

        var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
        var li = this.list.children('li');

        var self = this;

        if (li.size() > 0) {
            var wh = 0, i = this.options.offset;
            li.each(function() {
                self.format(this, i++);
                wh += self.dimension(this, di);
            });

            this.list.css(this.wh, wh + 'px');

            // Only set if not explicitly passed as option
            if (!o || o.size === undefined)
                this.options.size = li.size();
        }

        // For whatever reason, .show() does not work in Safari...
        this.container.css('display', 'block');
        this.buttonNext.css('display', 'block');
        this.buttonPrev.css('display', 'block');

        this.funcNext = function() { self.next(); };
        this.funcPrev = function() { self.prev(); };
        this.funcResize = function() { self.reload(); };

        if (this.options.initCallback != null)
            this.options.initCallback(this, 'init');

        if ($.browser.safari) {
            this.buttons(false, false);
            $(window).bind('load', function() { self.setup(); });
        } else
            this.setup();
    };

    // Create shortcut for internal use
    var $jc = $.jcarousel;

    $jc.fn = $jc.prototype = {
        jcarousel: '0.2.3'
    };

    $jc.fn.extend = $jc.extend = $.extend;

    $jc.fn.extend({
        /**
        * Setups the carousel.
        *
        * @name setup
        * @type undefined
        * @cat Plugins/jCarousel
        */
        setup: function() {
            this.first = null;
            this.last = null;
            this.prevFirst = null;
            this.prevLast = null;
            this.animating = false;
            this.timer = null;
            this.tail = null;
            this.inTail = false;

            if (this.locked)
                return;

            this.list.css(this.lt, this.pos(this.options.offset) + 'px');
            var p = this.pos(this.options.start);
            this.prevFirst = this.prevLast = null;
            this.animate(p, false);

            $(window).unbind('resize', this.funcResize).bind('resize', this.funcResize);
        },

        /**
        * Clears the list and resets the carousel.
        *
        * @name reset
        * @type undefined
        * @cat Plugins/jCarousel
        */
        reset: function() {
            this.list.empty();

            this.list.css(this.lt, '0px');
            this.list.css(this.wh, '10px');

            if (this.options.initCallback != null)
                this.options.initCallback(this, 'reset');

            this.setup();
        },

        /**
        * Reloads the carousel and adjusts positions.
        *
        * @name reload
        * @type undefined
        * @cat Plugins/jCarousel
        */
        reload: function() {
            if (this.tail != null && this.inTail)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);

            this.tail = null;
            this.inTail = false;

            if (this.options.reloadCallback != null)
                this.options.reloadCallback(this);

            if (this.options.visible != null) {
                var self = this;
                var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
                $('li', this.list).each(function(i) {
                    wh += self.dimension(this, di);
                    if (i + 1 < self.first)
                        lt = wh;
                });

                this.list.css(this.wh, wh + 'px');
                this.list.css(this.lt, -lt + 'px');
            }

            this.scroll(this.first, false);
        },

        /**
        * Locks the carousel.
        *
        * @name lock
        * @type undefined
        * @cat Plugins/jCarousel
        */
        lock: function() {
            this.locked = true;
            this.buttons();
        },

        /**
        * Unlocks the carousel.
        *
        * @name unlock
        * @type undefined
        * @cat Plugins/jCarousel
        */
        unlock: function() {
            this.locked = false;
            this.buttons();
        },

        /**
        * Sets the size of the carousel.
        *
        * @name size
        * @type undefined
        * @param Number s The size of the carousel.
        * @cat Plugins/jCarousel
        */
        size: function(s) {
            if (s != undefined) {
                this.options.size = s;
                if (!this.locked)
                    this.buttons();
            }

            return this.options.size;
        },

        /**
        * Checks whether a list element exists for the given index (or index range).
        *
        * @name get
        * @type bool
        * @param Number i The index of the (first) element.
        * @param Number i2 The index of the last element.
        * @cat Plugins/jCarousel
        */
        has: function(i, i2) {
            if (i2 == undefined || !i2)
                i2 = i;

            if (this.options.size !== null && i2 > this.options.size)
                i2 = this.options.size;

            for (var j = i; j <= i2; j++) {
                var e = this.get(j);
                if (!e.length || e.hasClass('jcarousel-item-placeholder'))
                    return false;
            }

            return true;
        },

        /**
        * Returns a jQuery object with list element for the given index.
        *
        * @name get
        * @type jQuery
        * @param Number i The index of the element.
        * @cat Plugins/jCarousel
        */
        get: function(i) {
            return $('.jcarousel-item-' + i, this.list);
        },

        /**
        * Adds an element for the given index to the list.
        * If the element already exists, it updates the inner html.
        * Returns the created element as jQuery object.
        *
        * @name add
        * @type jQuery
        * @param Number i The index of the element.
        * @param String s The innerHTML of the element.
        * @cat Plugins/jCarousel
        */
        add: function(i, s) {
            var e = this.get(i), old = 0, add = 0;

            if (e.length == 0) {
                var c, e = this.create(i), j = $jc.intval(i);
                while (c = this.get(--j)) {
                    if (j <= 0 || c.length) {
                        j <= 0 ? this.list.prepend(e) : c.after(e);
                        break;
                    }
                }
            } else
                old = this.dimension(e);

            e.removeClass(this.className('jcarousel-item-placeholder'));
            typeof s == 'string' ? e.html(s) : e.empty().append(s);

            var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
            var wh = this.dimension(e, di) - old;

            if (i > 0 && i < this.first)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');

            return e;
        },

        /**
        * Removes an element for the given index from the list.
        *
        * @name remove
        * @type undefined
        * @param Number i The index of the element.
        * @cat Plugins/jCarousel
        */
        remove: function(i) {
            var e = this.get(i);

            // Check if item exists and is not currently visible
            if (!e.length || (i >= this.first && i <= this.last))
                return;

            var d = this.dimension(e);

            if (i < this.first)
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');

            e.remove();

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
        },

        /**
        * Moves the carousel forwards.
        *
        * @name next
        * @type undefined
        * @cat Plugins/jCarousel
        */
        next: function() {
            this.stopAuto();

            if (this.tail != null && !this.inTail)
                this.scrollTail(false);
            else
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
        },

        /**
        * Moves the carousel backwards.
        *
        * @name prev
        * @type undefined
        * @cat Plugins/jCarousel
        */
        prev: function() {
            this.stopAuto();

            if (this.tail != null && this.inTail)
                this.scrollTail(true);
            else
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
        },

        /**
        * Scrolls the tail of the carousel.
        *
        * @name scrollTail
        * @type undefined
        * @param Bool b Whether scroll the tail back or forward.
        * @cat Plugins/jCarousel
        */
        scrollTail: function(b) {
            if (this.locked || this.animating || !this.tail)
                return;

            var pos = $jc.intval(this.list.css(this.lt));

            !b ? pos -= this.tail : pos += this.tail;
            this.inTail = !b;

            // Save for callbacks
            this.prevFirst = this.first;
            this.prevLast = this.last;

            this.animate(pos);
        },

        /**
        * Scrolls the carousel to a certain position.
        *
        * @name scroll
        * @type undefined
        * @param Number i The index of the element to scoll to.
        * @param Bool a Flag indicating whether to perform animation.
        * @cat Plugins/jCarousel
        */
        scroll: function(i, a) {
            if (this.locked || this.animating)
                return;

            this.animate(this.pos(i), a);
        },

        /**
        * Prepares the carousel and return the position for a certian index.
        *
        * @name pos
        * @type Number
        * @param Number i The index of the element to scoll to.
        * @cat Plugins/jCarousel
        */
        pos: function(i) {
            if (this.locked || this.animating)
                return;

            if (this.options.wrap != 'circular')
                i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);

            var back = this.first > i;
            var pos = $jc.intval(this.list.css(this.lt));

            // Create placeholders, new list width/height
            // and new list position
            var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
            var c = back ? this.get(f) : this.get(this.last);
            var j = back ? f : f - 1;
            var e = null, l = 0, p = false, d = 0;

            while (back ? --j >= i : ++j < i) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    c[back ? 'before' : 'after'](e);
                }

                c = e;
                d = this.dimension(e);

                if (p)
                    l += d;

                if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
                    pos = back ? pos + d : pos - d;
            }

            // Calculate visible items
            var clipping = this.clipping();
            var cache = [];
            var visible = 0, j = i, v = 0;
            var c = this.get(i - 1);

            while (++visible) {
                e = this.get(j);
                p = !e.length;
                if (e.length == 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    // This should only happen on a next scroll
                    c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after'](e);
                }

                c = e;
                var d = this.dimension(e);
                if (d == 0) {
                    alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
                    return 0;
                }

                if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
                    cache.push(e);
                else if (p)
                    l += d;

                v += d;

                if (v >= clipping)
                    break;

                j++;
            }

            // Remove out-of-range placeholders
            for (var x = 0; x < cache.length; x++)
                cache[x].remove();

            // Resize list
            if (l > 0) {
                this.list.css(this.wh, this.dimension(this.list) + l + 'px');

                if (back) {
                    pos -= l;
                    this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
                }
            }

            // Calculate first and last item
            var last = i + visible - 1;
            if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
                last = this.options.size;

            if (j > last) {
                visible = 0, j = last, v = 0;
                while (++visible) {
                    var e = this.get(j--);
                    if (!e.length)
                        break;
                    v += this.dimension(e);
                    if (v >= clipping)
                        break;
                }
            }

            var first = last - visible + 1;
            if (this.options.wrap != 'circular' && first < 1)
                first = 1;

            if (this.inTail && back) {
                pos += this.tail;
                this.inTail = false;
            }

            this.tail = null;
            if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
                var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
                if ((v - m) > clipping)
                    this.tail = v - clipping - m;
            }

            // Adjust position
            while (i-- > first)
                pos += this.dimension(this.get(i));

            // Save visible item range
            this.prevFirst = this.first;
            this.prevLast = this.last;
            this.first = first;
            this.last = last;

            return pos;
        },

        /**
        * Animates the carousel to a certain position.
        *
        * @name animate
        * @type undefined
        * @param mixed p Position to scroll to.
        * @param Bool a Flag indicating whether to perform animation.
        * @cat Plugins/jCarousel
        */
        animate: function(p, a) {
            if (this.locked || this.animating)
                return;

            this.animating = true;

            var self = this;
            var scrolled = function() {
                self.animating = false;

                if (p == 0)
                    self.list.css(self.lt, 0);

                if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
                    self.startAuto();

                self.buttons();
                self.notify('onAfterAnimation');
            };

            this.notify('onBeforeAnimation');

            // Animate
            if (!this.options.animation || a == false) {
                this.list.css(this.lt, p + 'px');
                scrolled();
            } else {
                var o = !this.options.vertical ? { 'left': p} : { 'top': p };
                this.list.animate(o, this.options.animation, this.options.easing, scrolled);
            }
        },

        /**
        * Starts autoscrolling.
        *
        * @name auto
        * @type undefined
        * @param Number s Seconds to periodically autoscroll the content.
        * @cat Plugins/jCarousel
        */
        startAuto: function(s) {
            if (s != undefined)
                this.options.auto = s;

            if (this.options.auto == 0)
                return this.stopAuto();

            if (this.timer != null)
                return;

            var self = this;
            this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
        },

        /**
        * Stops autoscrolling.
        *
        * @name stopAuto
        * @type undefined
        * @cat Plugins/jCarousel
        */
        stopAuto: function() {
            if (this.timer == null)
                return;

            clearTimeout(this.timer);
            this.timer = null;
        },

        /**
        * Sets the states of the prev/next buttons.
        *
        * @name buttons
        * @type undefined
        * @cat Plugins/jCarousel
        */
        buttons: function(n, p) {
            if (n == undefined || n == null) {
                var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
                    n = this.tail != null && !this.inTail;
            }

            if (p == undefined || p == null) {
                var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
                    p = this.tail != null && this.inTail;
            }

            var self = this;

            this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
            this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);

            if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
                this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
                this.buttonNext[0].jcarouselstate = n;
            }

            if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
                this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
                this.buttonPrev[0].jcarouselstate = p;
            }
        },

        notify: function(evt) {
            var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');

            // Load items
            this.callback('itemLoadCallback', evt, state);

            if (this.prevFirst !== this.first) {
                this.callback('itemFirstInCallback', evt, state, this.first);
                this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
            }

            if (this.prevLast !== this.last) {
                this.callback('itemLastInCallback', evt, state, this.last);
                this.callback('itemLastOutCallback', evt, state, this.prevLast);
            }

            this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
            this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
        },

        callback: function(cb, evt, state, i1, i2, i3, i4) {
            if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
                return;

            var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];

            if (!$.isFunction(callback))
                return;

            var self = this;

            if (i1 === undefined)
                callback(self, state, evt);
            else if (i2 === undefined)
                this.get(i1).each(function() { callback(self, this, i1, state, evt); });
            else {
                for (var i = i1; i <= i2; i++)
                    if (i !== null && !(i >= i3 && i <= i4))
                    this.get(i).each(function() { callback(self, this, i, state, evt); });
            }
        },

        create: function(i) {
            return this.format('<li></li>', i);
        },

        format: function(e, i) {
            var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i));
            $e.attr('jcarouselindex', i);
            return $e;
        },

        className: function(c) {
            return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
        },

        dimension: function(e, d) {
            var el = e.jquery != undefined ? e[0] : e;

            var old = !this.options.vertical ?
                el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
                el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');

            if (d == undefined || old == d)
                return old;

            var w = !this.options.vertical ?
                d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
                d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');

            $(el).css(this.wh, w + 'px');

            return this.dimension(el);
        },

        clipping: function() {
            return !this.options.vertical ?
                this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
                this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
        },

        index: function(i, s) {
            if (s == undefined)
                s = this.options.size;

            return Math.round((((i - 1) / s) - Math.floor((i - 1) / s)) * s) + 1;
        }
    });

    $jc.extend({
        /**
        * Gets/Sets the global default configuration properties.
        *
        * @name defaults
        * @descr Gets/Sets the global default configuration properties.
        * @type Hash
        * @param Hash d A set of key/value pairs to set as configuration properties.
        * @cat Plugins/jCarousel
        */
        defaults: function(d) {
            return $.extend(defaults, d || {});
        },

        margin: function(e, p) {
            if (!e)
                return 0;

            var el = e.jquery != undefined ? e[0] : e;

            if (p == 'marginRight' && $.browser.safari) {
                var old = { 'display': 'block', 'float': 'none', 'width': 'auto' }, oWidth, oWidth2;

                $.swap(el, old, function() { oWidth = el.offsetWidth; });

                old['marginRight'] = 0;
                $.swap(el, old, function() { oWidth2 = el.offsetWidth; });

                return oWidth2 - oWidth;
            }

            return $jc.intval($.css(el, p));
        },

        intval: function(v) {
            v = parseInt(v);
            return isNaN(v) ? 0 : v;
        }
    });

})(jQuery);

/**
* jCarousel - Riding carousels with jQuery
*   http://sorgalla.com/jcarousel/
*
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built on top of the jQuery library
*   http://jquery.com
*
* Inspired by the "Carousel Component" by Bill Scott
*   http://billwscott.com/carousel/
*/
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(9($){$.1v.C=9(o){z 4.1b(9(){3p r(4,o)})};8 q={Z:F,25:1,21:1,u:7,1c:3,15:7,1K:\'2X\',2c:\'2Q\',1q:0,B:7,1j:7,1G:7,2F:7,2B:7,2z:7,2x:7,2v:7,2s:7,2p:7,1S:\'<P></P>\',1Q:\'<P></P>\',2m:\'2l\',2k:\'2l\',1O:7,1L:7};$.C=9(e,o){4.5=$.16({},q,o||{});4.Q=F;4.D=7;4.H=7;4.t=7;4.U=7;4.R=7;4.N=!4.5.Z?\'1H\':\'26\';4.E=!4.5.Z?\'24\':\'23\';8 a=\'\',1e=e.K.1e(\' \');1r(8 i=0;i<1e.I;i++){6(1e[i].2y(\'C-2w\')!=-1){$(e).1E(1e[i]);8 a=1e[i];1p}}6(e.2t==\'3o\'||e.2t==\'3n\'){4.t=$(e);4.D=4.t.19();6(4.D.1o(\'C-H\')){6(!4.D.19().1o(\'C-D\'))4.D=4.D.B(\'<P></P>\');4.D=4.D.19()}10 6(!4.D.1o(\'C-D\'))4.D=4.t.B(\'<P></P>\').19()}10{4.D=$(e);4.t=$(e).3h(\'>2o,>2n,P>2o,P>2n\')}6(a!=\'\'&&4.D.19()[0].K.2y(\'C-2w\')==-1)4.D.B(\'<P 3g=" \'+a+\'"></P>\');4.H=4.t.19();6(!4.H.I||!4.H.1o(\'C-H\'))4.H=4.t.B(\'<P></P>\').19();4.R=$(\'.C-11\',4.D);6(4.R.u()==0&&4.5.1Q!=7)4.R=4.H.1z(4.5.1Q).11();4.R.V(4.K(\'C-11\'));4.U=$(\'.C-17\',4.D);6(4.U.u()==0&&4.5.1S!=7)4.U=4.H.1z(4.5.1S).11();4.U.V(4.K(\'C-17\'));4.H.V(4.K(\'C-H\'));4.t.V(4.K(\'C-t\'));4.D.V(4.K(\'C-D\'));8 b=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 c=4.t.32(\'1F\');8 d=4;6(c.u()>0){8 f=0,i=4.5.21;c.1b(9(){d.1I(4,i++);f+=d.S(4,b)});4.t.y(4.N,f+\'T\');6(!o||o.u===J)4.5.u=c.u()}4.D.y(\'1y\',\'1A\');4.U.y(\'1y\',\'1A\');4.R.y(\'1y\',\'1A\');4.2G=9(){d.17()};4.2b=9(){d.11()};4.1U=9(){d.2q()};6(4.5.1j!=7)4.5.1j(4,\'2a\');6($.2A.28){4.1f(F,F);$(27).1u(\'2I\',9(){d.1t()})}10 4.1t()};8 r=$.C;r.1v=r.2H={C:\'0.2.3\'};r.1v.16=r.16=$.16;r.1v.16({1t:9(){4.A=7;4.G=7;4.X=7;4.13=7;4.14=F;4.1d=7;4.O=7;4.W=F;6(4.Q)z;4.t.y(4.E,4.1s(4.5.21)+\'T\');8 p=4.1s(4.5.25);4.X=4.13=7;4.1i(p,F);$(27).22(\'2E\',4.1U).1u(\'2E\',4.1U)},2D:9(){4.t.2C();4.t.y(4.E,\'3u\');4.t.y(4.N,\'3t\');6(4.5.1j!=7)4.5.1j(4,\'2D\');4.1t()},2q:9(){6(4.O!=7&&4.W)4.t.y(4.E,r.M(4.t.y(4.E))+4.O);4.O=7;4.W=F;6(4.5.1G!=7)4.5.1G(4);6(4.5.15!=7){8 a=4;8 b=1k.1P(4.1m()/4.5.15),N=0,E=0;$(\'1F\',4.t).1b(9(i){N+=a.S(4,b);6(i+1<a.A)E=N});4.t.y(4.N,N+\'T\');4.t.y(4.E,-E+\'T\')}4.1c(4.A,F)},3s:9(){4.Q=1h;4.1f()},3r:9(){4.Q=F;4.1f()},u:9(s){6(s!=J){4.5.u=s;6(!4.Q)4.1f()}z 4.5.u},3q:9(i,a){6(a==J||!a)a=i;6(4.5.u!==7&&a>4.5.u)a=4.5.u;1r(8 j=i;j<=a;j++){8 e=4.L(j);6(!e.I||e.1o(\'C-1a-1D\'))z F}z 1h},L:9(i){z $(\'.C-1a-\'+i,4.t)},2u:9(i,s){8 e=4.L(i),20=0,2u=0;6(e.I==0){8 c,e=4.1B(i),j=r.M(i);1n(c=4.L(--j)){6(j<=0||c.I){j<=0?4.t.2r(e):c.1X(e);1p}}}10 20=4.S(e);e.1E(4.K(\'C-1a-1D\'));1R s==\'3l\'?e.3k(s):e.2C().3j(s);8 a=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 b=4.S(e,a)-20;6(i>0&&i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))-b+\'T\');4.t.y(4.N,r.M(4.t.y(4.N))+b+\'T\');z e},1V:9(i){8 e=4.L(i);6(!e.I||(i>=4.A&&i<=4.G))z;8 d=4.S(e);6(i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))+d+\'T\');e.1V();4.t.y(4.N,r.M(4.t.y(4.N))-d+\'T\')},17:9(){4.1C();6(4.O!=7&&!4.W)4.1T(F);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'G\')&&4.5.u!=7&&4.G==4.5.u)?1:4.A+4.5.1c)},11:9(){4.1C();6(4.O!=7&&4.W)4.1T(1h);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'A\')&&4.5.u!=7&&4.A==1)?4.5.u:4.A-4.5.1c)},1T:9(b){6(4.Q||4.14||!4.O)z;8 a=r.M(4.t.y(4.E));!b?a-=4.O:a+=4.O;4.W=!b;4.X=4.A;4.13=4.G;4.1i(a)},1c:9(i,a){6(4.Q||4.14)z;4.1i(4.1s(i),a)},1s:9(i){6(4.Q||4.14)z;6(4.5.B!=\'18\')i=i<1?1:(4.5.u&&i>4.5.u?4.5.u:i);8 a=4.A>i;8 b=r.M(4.t.y(4.E));8 f=4.5.B!=\'18\'&&4.A<=1?1:4.A;8 c=a?4.L(f):4.L(4.G);8 j=a?f:f-1;8 e=7,l=0,p=F,d=0;1n(a?--j>=i:++j<i){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c[a?\'1z\':\'1X\'](e)}c=e;d=4.S(e);6(p)l+=d;6(4.A!=7&&(4.5.B==\'18\'||(j>=1&&(4.5.u==7||j<=4.5.u))))b=a?b+d:b-d}8 g=4.1m();8 h=[];8 k=0,j=i,v=0;8 c=4.L(i-1);1n(++k){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c.I==0?4.t.2r(e):c[a?\'1z\':\'1X\'](e)}c=e;8 d=4.S(e);6(d==0){3f(\'3e: 3d 1H/26 3c 1r 3b. 3a 39 38 37 36 35. 34...\');z 0}6(4.5.B!=\'18\'&&4.5.u!==7&&j>4.5.u)h.33(e);10 6(p)l+=d;v+=d;6(v>=g)1p;j++}1r(8 x=0;x<h.I;x++)h[x].1V();6(l>0){4.t.y(4.N,4.S(4.t)+l+\'T\');6(a){b-=l;4.t.y(4.E,r.M(4.t.y(4.E))-l+\'T\')}}8 n=i+k-1;6(4.5.B!=\'18\'&&4.5.u&&n>4.5.u)n=4.5.u;6(j>n){k=0,j=n,v=0;1n(++k){8 e=4.L(j--);6(!e.I)1p;v+=4.S(e);6(v>=g)1p}}8 o=n-k+1;6(4.5.B!=\'18\'&&o<1)o=1;6(4.W&&a){b+=4.O;4.W=F}4.O=7;6(4.5.B!=\'18\'&&n==4.5.u&&(n-k+1)>=1){8 m=r.Y(4.L(n),!4.5.Z?\'1l\':\'1N\');6((v-m)>g)4.O=v-g-m}1n(i-->o)b+=4.S(4.L(i));4.X=4.A;4.13=4.G;4.A=o;4.G=n;z b},1i:9(p,a){6(4.Q||4.14)z;4.14=1h;8 b=4;8 c=9(){b.14=F;6(p==0)b.t.y(b.E,0);6(b.5.B==\'1Z\'||b.5.B==\'G\'||b.5.u==7||b.G<b.5.u)b.2j();b.1f();b.1M(\'2i\')};4.1M(\'31\');6(!4.5.1K||a==F){4.t.y(4.E,p+\'T\');c()}10{8 o=!4.5.Z?{\'24\':p}:{\'23\':p};4.t.1i(o,4.5.1K,4.5.2c,c)}},2j:9(s){6(s!=J)4.5.1q=s;6(4.5.1q==0)z 4.1C();6(4.1d!=7)z;8 a=4;4.1d=30(9(){a.17()},4.5.1q*2Z)},1C:9(){6(4.1d==7)z;2Y(4.1d);4.1d=7},1f:9(n,p){6(n==J||n==7){8 n=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'A\')||4.5.u==7||4.G<4.5.u);6(!4.Q&&(!4.5.B||4.5.B==\'A\')&&4.5.u!=7&&4.G>=4.5.u)n=4.O!=7&&!4.W}6(p==J||p==7){8 p=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'G\')||4.A>1);6(!4.Q&&(!4.5.B||4.5.B==\'G\')&&4.5.u!=7&&4.A==1)p=4.O!=7&&4.W}8 a=4;4.U[n?\'1u\':\'22\'](4.5.2m,4.2G)[n?\'1E\':\'V\'](4.K(\'C-17-1w\')).1J(\'1w\',n?F:1h);4.R[p?\'1u\':\'22\'](4.5.2k,4.2b)[p?\'1E\':\'V\'](4.K(\'C-11-1w\')).1J(\'1w\',p?F:1h);6(4.U.I>0&&(4.U[0].1g==J||4.U[0].1g!=n)&&4.5.1O!=7){4.U.1b(9(){a.5.1O(a,4,n)});4.U[0].1g=n}6(4.R.I>0&&(4.R[0].1g==J||4.R[0].1g!=p)&&4.5.1L!=7){4.R.1b(9(){a.5.1L(a,4,p)});4.R[0].1g=p}},1M:9(a){8 b=4.X==7?\'2a\':(4.X<4.A?\'17\':\'11\');4.12(\'2F\',a,b);6(4.X!==4.A){4.12(\'2B\',a,b,4.A);4.12(\'2z\',a,b,4.X)}6(4.13!==4.G){4.12(\'2x\',a,b,4.G);4.12(\'2v\',a,b,4.13)}4.12(\'2s\',a,b,4.A,4.G,4.X,4.13);4.12(\'2p\',a,b,4.X,4.13,4.A,4.G)},12:9(a,b,c,d,e,f,g){6(4.5[a]==J||(1R 4.5[a]!=\'2h\'&&b!=\'2i\'))z;8 h=1R 4.5[a]==\'2h\'?4.5[a][b]:4.5[a];6(!$.2W(h))z;8 j=4;6(d===J)h(j,c,b);10 6(e===J)4.L(d).1b(9(){h(j,4,d,c,b)});10{1r(8 i=d;i<=e;i++)6(i!==7&&!(i>=f&&i<=g))4.L(i).1b(9(){h(j,4,i,c,b)})}},1B:9(i){z 4.1I(\'<1F></1F>\',i)},1I:9(e,i){8 a=$(e).V(4.K(\'C-1a\')).V(4.K(\'C-1a-\'+i));a.1J(\'2V\',i);z a},K:9(c){z c+\' \'+c+(!4.5.Z?\'-2U\':\'-Z\')},S:9(e,d){8 a=e.2g!=J?e[0]:e;8 b=!4.5.Z?a.1x+r.Y(a,\'2f\')+r.Y(a,\'1l\'):a.2e+r.Y(a,\'2d\')+r.Y(a,\'1N\');6(d==J||b==d)z b;8 w=!4.5.Z?d-r.Y(a,\'2f\')-r.Y(a,\'1l\'):d-r.Y(a,\'2d\')-r.Y(a,\'1N\');$(a).y(4.N,w+\'T\');z 4.S(a)},1m:9(){z!4.5.Z?4.H[0].1x-r.M(4.H.y(\'2T\'))-r.M(4.H.y(\'2S\')):4.H[0].2e-r.M(4.H.y(\'2R\'))-r.M(4.H.y(\'3i\'))},2P:9(i,s){6(s==J)s=4.5.u;z 1k.2O((((i-1)/s)-1k.2N((i-1)/s))*s)+1}});r.16({3m:9(d){z $.16(q,d||{})},Y:9(e,p){6(!e)z 0;8 a=e.2g!=J?e[0]:e;6(p==\'1l\'&&$.2A.28){8 b={\'1y\':\'1A\',\'2M\':\'2L\',\'1H\':\'1q\'},1Y,1W;$.29(a,b,9(){1Y=a.1x});b[\'1l\']=0;$.29(a,b,9(){1W=a.1x});z 1W-1Y}z r.M($.y(a,p))},M:9(v){v=2K(v);z 2J(v)?0:v}})})(3v);', 62, 218, '||||this|options|if|null|var|function||||||||||||||||||||list|size||||css|return|first|wrap|jcarousel|container|lt|false|last|clip|length|undefined|className|get|intval|wh|tail|div|locked|buttonPrev|dimension|px|buttonNext|addClass|inTail|prevFirst|margin|vertical|else|prev|callback|prevLast|animating|visible|extend|next|circular|parent|item|each|scroll|timer|split|buttons|jcarouselstate|true|animate|initCallback|Math|marginRight|clipping|while|hasClass|break|auto|for|pos|setup|bind|fn|disabled|offsetWidth|display|before|block|create|stopAuto|placeholder|removeClass|li|reloadCallback|width|format|attr|animation|buttonPrevCallback|notify|marginBottom|buttonNextCallback|ceil|buttonPrevHTML|typeof|buttonNextHTML|scrollTail|funcResize|remove|oWidth2|after|oWidth|both|old|offset|unbind|top|left|start|height|window|safari|swap|init|funcPrev|easing|marginTop|offsetHeight|marginLeft|jquery|object|onAfterAnimation|startAuto|buttonPrevEvent|click|buttonNextEvent|ol|ul|itemVisibleOutCallback|reload|prepend|itemVisibleInCallback|nodeName|add|itemLastOutCallback|skin|itemLastInCallback|indexOf|itemFirstOutCallback|browser|itemFirstInCallback|empty|reset|resize|itemLoadCallback|funcNext|prototype|load|isNaN|parseInt|none|float|floor|round|index|swing|borderTopWidth|borderRightWidth|borderLeftWidth|horizontal|jcarouselindex|isFunction|normal|clearTimeout|1000|setTimeout|onBeforeAnimation|children|push|Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|alert|class|find|borderBottomWidth|append|html|string|defaults|OL|UL|new|has|unlock|lock|10px|0px|jQuery'.split('|'), 0, {}))

/*
* Thickbox 3.1 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = "/images/thickbox/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function() {
    tb_init('a.thickbox, area.thickbox, input.thickbox'); //pass where to apply thickbox
    imgLoader = new Image(); // preload image
    imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk) {
    $(domChunk).click(function() {
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;
        tb_show(t, a, 'thickboxhidden');
        this.blur();
        return false;
    });
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

    try {
        if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
            $("body", "html").css({ height: "100%", width: "100%" });
            $("html").css("overflow", "hidden");
            if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
                $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                $("#TB_overlay").click(tb_remove);
            }
        } else {//all others
            if (document.getElementById("TB_overlay") === null) {
                $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
                $("#TB_overlay").click(tb_remove);
            }
        }

        if (tb_detectMacXFF()) {
            $("#TB_overlay").addClass("TB_overlayMacFFBGHack"); //use png overlay so hide flash
        } else {
            $("#TB_overlay").addClass("TB_overlayBG"); //use background and opacity
        }

        if (caption === null) { caption = ""; }
        $("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); //add loader to the page
        $('#TB_load').show(); //show loader

        var baseURL;
        if (url.indexOf("?") !== -1) { //ff there is a query string involved
            baseURL = url.substr(0, url.indexOf("?"));
        } else {
            baseURL = url;
        }

        var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
        var urlType = baseURL.toLowerCase().match(urlString);

        if (urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp') {//code to show images

            TB_PrevCaption = "";
            TB_PrevURL = "";
            TB_PrevHTML = "";
            TB_NextCaption = "";
            TB_NextURL = "";
            TB_NextHTML = "";
            TB_imageCount = "";
            TB_FoundURL = false;
            if (imageGroup) {
                //TB_TempArray = $("a[@rel='"+imageGroup+"']").get();
                TB_TempArray = $("a[class='" + imageGroup + "']").get();
                for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                    var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                    if (!(TB_TempArray[TB_Counter].href == url)) {
                        if (TB_FoundURL) {
                            TB_NextCaption = TB_TempArray[TB_Counter].title;
                            TB_NextURL = TB_TempArray[TB_Counter].href;
                            TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
                        } else {
                            TB_PrevCaption = TB_TempArray[TB_Counter].title;
                            TB_PrevURL = TB_TempArray[TB_Counter].href;
                            TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
                        }
                    } else {
                        TB_FoundURL = true;
                        TB_imageCount = "Image " + (TB_Counter + 1) + " of " + (TB_TempArray.length);
                    }
                }
            }

            imgPreloader = new Image();
            imgPreloader.onload = function() {
                imgPreloader.onload = null;

                // Resizing large images - orginal by Christian Montoya edited by me.
                var pagesize = tb_getPageSize();
                var x = pagesize[0] - 150;
                var y = pagesize[1] - 150;
                var imageWidth = imgPreloader.width;
                var imageHeight = imgPreloader.height;
                if (imageWidth > x) {
                    imageHeight = imageHeight * (x / imageWidth);
                    imageWidth = x;
                    if (imageHeight > y) {
                        imageWidth = imageWidth * (y / imageHeight);
                        imageHeight = y;
                    }
                } else if (imageHeight > y) {
                    imageWidth = imageWidth * (y / imageHeight);
                    imageHeight = y;
                    if (imageWidth > x) {
                        imageHeight = imageHeight * (x / imageWidth);
                        imageWidth = x;
                    }
                }
                // End Resizing

                TB_WIDTH = imageWidth + 30;
                TB_HEIGHT = imageHeight + 60;
                $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + url + "' width='" + imageWidth + "' height='" + imageHeight + "' alt='" + caption + "'/></a>" + "<div id='TB_caption'>" + caption + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'></a></div>");

                $("#TB_closeWindowButton").click(tb_remove);

                if (!(TB_PrevHTML === "")) {
                    function goPrev() {
                        if ($(document).unbind("click", goPrev)) { $(document).unbind("click", goPrev); }
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
                        return false;
                    }
                    $("#TB_prev").click(goPrev);
                }

                if (!(TB_NextHTML === "")) {
                    function goNext() {
                        $("#TB_window").remove();
                        $("body").append("<div id='TB_window'></div>");
                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);
                        return false;
                    }
                    $("#TB_next").click(goNext);

                }

                document.onkeydown = function(e) {
                    if (e == null) { // ie
                        keycode = event.keyCode;
                    } else { // mozilla
                        keycode = e.which;
                    }
                    if (keycode == 27) { // close
                        tb_remove();
                    } else if (keycode == 190) { // display previous image
                        if (!(TB_NextHTML == "")) {
                            document.onkeydown = "";
                            goNext();
                        }
                    } else if (keycode == 188) { // display next image
                        if (!(TB_PrevHTML == "")) {
                            document.onkeydown = "";
                            goPrev();
                        }
                    }
                };

                tb_position();
                $("#TB_load").remove();
                $("#TB_ImageOff").click(tb_remove);
                $("#TB_window").css({ display: "block" }); //for safari using css instead of show
            };

            imgPreloader.src = url;
        } else {//code to show html

            var queryString = url.replace(/^[^\?]+\??/, '');
            var params = tb_parseQuery(queryString);

            TB_WIDTH = (params['width'] * 1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
            TB_HEIGHT = (params['height'] * 1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
            ajaxContentW = TB_WIDTH - 30;
            ajaxContentH = TB_HEIGHT - 45;

            if (url.indexOf('TB_iframe') != -1) {// either iframe or ajax window		
                urlNoQuery = url.split('TB_');
                $("#TB_iframeContent").remove();
                if (params['modal'] != "true") {//iframe no modal
                    $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'></a></div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;' > </iframe>");
                } else {//iframe modal
                    $("#TB_overlay").unbind();
                    $("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;'> </iframe>");
                }
            } else {// not an iframe, ajax
                if ($("#TB_window").css("display") != "block") {
                    if (params['modal'] != "true") {//ajax no modal
                        $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'></a></div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>");
                    } else {//ajax modal
                        $("#TB_overlay").unbind();
                        $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>");
                    }
                } else {//this means the window is already up, we are just loading new content via ajax
                    $("#TB_ajaxContent")[0].style.width = ajaxContentW + "px";
                    $("#TB_ajaxContent")[0].style.height = ajaxContentH + "px";
                    $("#TB_ajaxContent")[0].scrollTop = 0;
                    $("#TB_ajaxWindowTitle").html(caption);
                }
            }

            $("#TB_closeWindowButton").click(tb_remove);

            if (url.indexOf('TB_inline') != -1) {
                $("#TB_ajaxContent").append($('#' + params['inlineId']).children());
                $("#TB_window").unload(function() {
                    $('#' + params['inlineId']).append($("#TB_ajaxContent").children()); // move elements back when you're finished
                });
                tb_position();
                $("#TB_load").remove();
                $("#TB_window").css({ display: "block" });
            } else if (url.indexOf('TB_iframe') != -1) {
                tb_position();
                if ($.browser.safari) {//safari needs help because it will not fire iframe onload
                    $("#TB_load").remove();
                    $("#TB_window").css({ display: "block" });
                }
            } else {
                $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()), function() {//to do a post change this load method
                    tb_position();
                    $("#TB_load").remove();
                    tb_init("#TB_ajaxContent a.thickbox");
                    $("#TB_window").css({ display: "block" });
                });
            }

        }

        if (!params['modal']) {
            document.onkeyup = function(e) {
                if (e == null) { // ie
                    keycode = event.keyCode;
                } else { // mozilla
                    keycode = e.which;
                }
                if (keycode == 27) { // close
                    tb_remove();
                }
            };
        }

    } catch (e) {
        //nothing here
    }
}

//helper functions below
function tb_showIframe() {
    $("#TB_load").remove();
    $("#TB_window").css({ display: "block" });
}

function tb_remove() {
    $("#TB_imageOff").unbind("click");
    $("#TB_closeWindowButton").unbind("click");
    $("#TB_window").fadeOut("fast", function() { $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove(); });
    $("#TB_load").remove();
    if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
        $("body", "html").css({ height: "auto", width: "auto" });
        $("html").css("overflow", "");
    }
    document.onkeydown = "";
    document.onkeyup = "";
    return false;
}

function tb_position() {
    $("#TB_window").css({ marginLeft: '-' + parseInt((TB_WIDTH / 2), 10) + 'px', width: TB_WIDTH + 'px' });
    if (!(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
        $("#TB_window").css({ marginTop: '-' + parseInt((TB_HEIGHT / 2), 10) + 'px' });
    }
}

function tb_parseQuery(query) {
    var Params = {};
    if (!query) { return Params; } // return empty object
    var Pairs = query.split(/[;&]/);
    for (var i = 0; i < Pairs.length; i++) {
        var KeyVal = Pairs[i].split('=');
        if (!KeyVal || KeyVal.length != 2) { continue; }
        var key = unescape(KeyVal[0]);
        var val = unescape(KeyVal[1]);
        val = val.replace(/\+/g, ' ');
        Params[key] = val;
    }
    return Params;
}

function tb_getPageSize() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
    arrayPageSize = [w, h];
    return arrayPageSize;
}

function tb_detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox') != -1) {
        return true;
    }
}


/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages = { down: ['downarrowclass', '/images/down.gif', 0], right: ['rightarrowclass', '/images/right.gif'] }

var jqueryslidemenu = {

    animateduration: { over: 200, out: 100 }, //duration of slide in/ out animation, in milliseconds

    buildmenu: function(menuid, arrowsvar) {
        jQuery(document).ready(function($) {
            var $mainmenu = $("#" + menuid + ">ul")
            var $headers = $mainmenu.find("ul").parent()
            $headers.each(function(i) {
                var $curobj = $(this)
                var $subul = $(this).find('ul:eq(0)')
                this._dimensions = { w: this.offsetWidth, h: this.offsetHeight, subulw: $subul.outerWidth(), subulh: $subul.outerHeight() }
                this.istopheader = $curobj.parents("ul").length == 1 ? true : false
                $subul.css({ top: this.istopheader ? this._dimensions.h + "px" : 0 })
                $curobj.children("a:eq(0)").css(this.istopheader ? {} : {}).append(
				'<img src="' + (this.istopheader ? arrowsvar.down[1] : arrowsvar.right[1])
				+ '" class="' + (this.istopheader ? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)
                $curobj.hover(
				function(e) {
				    var $targetul = $(this).children("ul:eq(0)")
				    this._offsets = { left: $(this).offset().left, top: $(this).offset().top }
				    var menuleft = this.istopheader ? 0 : this._dimensions.w
				    menuleft = (this._offsets.left + menuleft + this._dimensions.subulw > $(window).width()) ? (this.istopheader ? -this._dimensions.subulw + this._dimensions.w : -this._dimensions.w) : menuleft
				    if ($targetul.queue().length <= 1) //if 1 or less queued animations
				        $targetul.css({ left: menuleft + "px", width: this._dimensions.subulw + 'px' }).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e) {
				    var $targetul = $(this).children("ul:eq(0)")
				    $targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
            }) //end $headers.each()
            $mainmenu.find("ul").css({ display: 'none', visibility: 'visible' })
        }) //end document.ready
    }
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages);

/*
* jQuery validation plug-in pre-1.5.2
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
*
* Copyright (c) 2006 - 2008 Jörn Zaefferer
*
* $Id: jquery.validate.js 6243 2009-02-19 11:40:49Z joern.zaefferer $
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*/

(function($) {

    $.extend($.fn, {
        // http://docs.jquery.com/Plugins/Validation/validate
        validate: function(options) {

            // if nothing is selected, return nothing; can't chain anyway
            if (!this.length) {
                options && options.debug && window.console && console.warn("nothing selected, can't validate, returning nothing");
                return;
            }

            // check if a validator for this form was already created
            var validator = $.data(this[0], 'validator');
            if (validator) {
                return validator;
            }

            validator = new $.validator(options, this[0]);
            $.data(this[0], 'validator', validator);

            if (validator.settings.onsubmit) {

                // allow suppresing validation by adding a cancel class to the submit button
                this.find("input, button").filter(".cancel").click(function() {
                    validator.cancelSubmit = true;
                });

                // validate the form on submit
                this.submit(function(event) {
                    if (validator.settings.debug)
                    // prevent form submit to be able to see console output
                        event.preventDefault();

                    function handle() {
                        if (validator.settings.submitHandler) {
                            validator.settings.submitHandler.call(validator, validator.currentForm);
                            return false;
                        }
                        return true;
                    }

                    // prevent submit for invalid forms or custom submit handlers
                    if (validator.cancelSubmit) {
                        validator.cancelSubmit = false;
                        return handle();
                    }
                    if (validator.form()) {
                        if (validator.pendingRequest) {
                            validator.formSubmitted = true;
                            return false;
                        }
                        return handle();
                    } else {
                        validator.focusInvalid();
                        return false;
                    }
                });
            }

            return validator;
        },
        // http://docs.jquery.com/Plugins/Validation/valid
        valid: function() {
            if ($(this[0]).is('form')) {
                return this.validate().form();
            } else {
                var valid = false;
                var validator = $(this[0].form).validate();
                this.each(function() {
                    valid |= validator.element(this);
                });
                return valid;
            }
        },
        // attributes: space seperated list of attributes to retrieve and remove
        removeAttrs: function(attributes) {
            var result = {},
			$element = this;
            $.each(attributes.split(/\s/), function(index, value) {
                result[value] = $element.attr(value);
                $element.removeAttr(value);
            });
            return result;
        },
        // http://docs.jquery.com/Plugins/Validation/rules
        rules: function(command, argument) {
            var element = this[0];

            if (command) {
                var settings = $.data(element.form, 'validator').settings;
                var staticRules = settings.rules;
                var existingRules = $.validator.staticRules(element);
                switch (command) {
                    case "add":
                        $.extend(existingRules, $.validator.normalizeRule(argument));
                        staticRules[element.name] = existingRules;
                        if (argument.messages)
                            settings.messages[element.name] = $.extend(settings.messages[element.name], argument.messages);
                        break;
                    case "remove":
                        if (!argument) {
                            delete staticRules[element.name];
                            return existingRules;
                        }
                        var filtered = {};
                        $.each(argument.split(/\s/), function(index, method) {
                            filtered[method] = existingRules[method];
                            delete existingRules[method];
                        });
                        return filtered;
                }
            }

            var data = $.validator.normalizeRules(
		$.extend(
			{},
			$.validator.metadataRules(element),
			$.validator.classRules(element),
			$.validator.attributeRules(element),
			$.validator.staticRules(element)
		), element);

            // make sure required is at front
            if (data.required) {
                var param = data.required;
                delete data.required;
                data = $.extend({ required: param }, data);
            }

            return data;
        }
    });

    // Custom selectors
    $.extend($.expr[":"], {
        // http://docs.jquery.com/Plugins/Validation/blank
        blank: function(a) { return !$.trim(a.value); },
        // http://docs.jquery.com/Plugins/Validation/filled
        filled: function(a) { return !!$.trim(a.value); },
        // http://docs.jquery.com/Plugins/Validation/unchecked
        unchecked: function(a) { return !a.checked; }
    });


    $.format = function(source, params) {
        if (arguments.length == 1)
            return function() {
                var args = $.makeArray(arguments);
                args.unshift(source);
                return $.format.apply(this, args);
            };
        if (arguments.length > 2 && params.constructor != Array) {
            params = $.makeArray(arguments).slice(1);
        }
        if (params.constructor != Array) {
            params = [params];
        }
        $.each(params, function(i, n) {
            source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
        });
        return source;
    };

    // constructor for validator
    $.validator = function(options, form) {
        this.settings = $.extend({}, $.validator.defaults, options);
        this.currentForm = form;
        this.init();
    };

    $.extend($.validator, {

        defaults: {
            messages: {},
            groups: {},
            rules: {},
            errorClass: "error",
            errorElement: "label",
            focusInvalid: true,
            errorContainer: $([]),
            errorLabelContainer: $([]),
            onsubmit: true,
            ignore: [],
            ignoreTitle: false,
            onfocusin: function(element) {
                this.lastActive = element;

                // hide error label and remove error class on focus if enabled
                if (this.settings.focusCleanup && !this.blockFocusCleanup) {
                    this.settings.unhighlight && this.settings.unhighlight.call(this, element, this.settings.errorClass);
                    this.errorsFor(element).hide();
                }
            },
            onfocusout: function(element) {
                if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {
                    this.element(element);
                }
            },
            onkeyup: function(element) {
                if (element.name in this.submitted || element == this.lastElement) {
                    this.element(element);
                }
            },
            onclick: function(element) {
                if (element.name in this.submitted)
                    this.element(element);
            },
            highlight: function(element, errorClass) {
                $(element).addClass(errorClass);
            },
            unhighlight: function(element, errorClass) {
                $(element).removeClass(errorClass);
            }
        },

        // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
        setDefaults: function(settings) {
            $.extend($.validator.defaults, settings);
        },

        messages: {
            required: "This field is required.",
            remote: "Please fix this field.",
            email: "Please enter a valid email address.",
            url: "Please enter a valid URL.",
            date: "Please enter a valid date.",
            dateISO: "Please enter a valid date (ISO).",
            dateDE: "Bitte geben Sie ein gültiges Datum ein.",
            number: "Please enter a valid number.",
            numberDE: "Bitte geben Sie eine Nummer ein.",
            digits: "Please enter only digits",
            creditcard: "Please enter a valid credit card number.",
            equalTo: "Please enter the same value again.",
            accept: "Please enter a value with a valid extension.",
            maxlength: $.format("Please enter no more than {0} characters."),
            minlength: $.format("Please enter at least {0} characters."),
            rangelength: $.format("Please enter a value between {0} and {1} characters long."),
            range: $.format("Please enter a value between {0} and {1}."),
            max: $.format("Please enter a value less than or equal to {0}."),
            min: $.format("Please enter a value greater than or equal to {0}.")
        },

        autoCreateRanges: false,

        prototype: {

            init: function() {
                this.labelContainer = $(this.settings.errorLabelContainer);
                this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
                this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);
                this.submitted = {};
                this.valueCache = {};
                this.pendingRequest = 0;
                this.pending = {};
                this.invalid = {};
                this.reset();

                var groups = (this.groups = {});
                $.each(this.settings.groups, function(key, value) {
                    $.each(value.split(/\s/), function(index, name) {
                        groups[name] = key;
                    });
                });
                var rules = this.settings.rules;
                $.each(rules, function(key, value) {
                    rules[key] = $.validator.normalizeRule(value);
                });

                function delegate(event) {
                    var validator = $.data(this[0].form, "validator");
                    validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0]);
                }
                $(this.currentForm)
				.delegate("focusin focusout keyup", ":text, :password, :file, select, textarea", delegate)
				.delegate("click", ":radio, :checkbox", delegate);

                if (this.settings.invalidHandler)
                    $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
            },

            // http://docs.jquery.com/Plugins/Validation/Validator/form
            form: function() {
                this.checkForm();
                $.extend(this.submitted, this.errorMap);
                this.invalid = $.extend({}, this.errorMap);
                if (!this.valid())
                    $(this.currentForm).triggerHandler("invalid-form", [this]);
                this.showErrors();
                return this.valid();
            },

            checkForm: function() {
                this.prepareForm();
                for (var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++) {
                    this.check(elements[i]);
                }
                return this.valid();
            },

            // http://docs.jquery.com/Plugins/Validation/Validator/element
            element: function(element) {
                element = this.clean(element);
                this.lastElement = element;
                this.prepareElement(element);
                this.currentElements = $(element);
                var result = this.check(element);
                if (result) {
                    delete this.invalid[element.name];
                } else {
                    this.invalid[element.name] = true;
                }
                if (!this.numberOfInvalids()) {
                    // Hide error containers on last error
                    this.toHide = this.toHide.add(this.containers);
                }
                this.showErrors();
                return result;
            },

            // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
            showErrors: function(errors) {
                if (errors) {
                    // add items to error list and map
                    $.extend(this.errorMap, errors);
                    this.errorList = [];
                    for (var name in errors) {
                        this.errorList.push({
                            message: errors[name],
                            element: this.findByName(name)[0]
                        });
                    }
                    // remove items from success list
                    this.successList = $.grep(this.successList, function(element) {
                        return !(element.name in errors);
                    });
                }
                this.settings.showErrors
				? this.settings.showErrors.call(this, this.errorMap, this.errorList)
				: this.defaultShowErrors();
            },

            // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
            resetForm: function() {
                if ($.fn.resetForm)
                    $(this.currentForm).resetForm();
                this.submitted = {};
                this.prepareForm();
                this.hideErrors();
                this.elements().removeClass(this.settings.errorClass);
            },

            numberOfInvalids: function() {
                return this.objectLength(this.invalid);
            },

            objectLength: function(obj) {
                var count = 0;
                for (var i in obj)
                    count++;
                return count;
            },

            hideErrors: function() {
                this.addWrapper(this.toHide).hide();
            },

            valid: function() {
                return this.size() == 0;
            },

            size: function() {
                return this.errorList.length;
            },

            focusInvalid: function() {
                if (this.settings.focusInvalid) {
                    try {
                        $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus();
                    } catch (e) {
                        // ignore IE throwing errors when focusing hidden elements
                    }
                }
            },

            findLastActive: function() {
                var lastActive = this.lastActive;
                return lastActive && $.grep(this.errorList, function(n) {
                    return n.element.name == lastActive.name;
                }).length == 1 && lastActive;
            },

            elements: function() {
                var validator = this,
				rulesCache = {};

                // select all valid inputs inside the form (no submit or reset buttons)
                // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
                return $([]).add(this.currentForm.elements)
			.filter(":input")
			.not(":submit, :reset, :image, [disabled]")
			.not(this.settings.ignore)
			.filter(function() {
			    !this.name && validator.settings.debug && window.console && console.error("%o has no name assigned", this);

			    // select only the first element for each name, and only those with rules specified
			    if (this.name in rulesCache || !validator.objectLength($(this).rules()))
			        return false;

			    rulesCache[this.name] = true;
			    return true;
			});
            },

            clean: function(selector) {
                return $(selector)[0];
            },

            errors: function() {
                return $(this.settings.errorElement + "." + this.settings.errorClass, this.errorContext);
            },

            reset: function() {
                this.successList = [];
                this.errorList = [];
                this.errorMap = {};
                this.toShow = $([]);
                this.toHide = $([]);
                this.formSubmitted = false;
                this.currentElements = $([]);
            },

            prepareForm: function() {
                this.reset();
                this.toHide = this.errors().add(this.containers);
            },

            prepareElement: function(element) {
                this.reset();
                this.toHide = this.errorsFor(element);
            },

            check: function(element) {
                element = this.clean(element);

                // if radio/checkbox, validate first element in group instead
                if (this.checkable(element)) {
                    element = this.findByName(element.name)[0];
                }

                var rules = $(element).rules();
                var dependencyMismatch = false;
                for (method in rules) {
                    var rule = { method: method, parameters: rules[method] };
                    try {
                        var result = $.validator.methods[method].call(this, element.value.replace(/\r/g, ""), element, rule.parameters);

                        // if a method indicates that the field is optional and therefore valid,
                        // don't mark it as valid when there are no other rules
                        if (result == "dependency-mismatch") {
                            dependencyMismatch = true;
                            continue;
                        }
                        dependencyMismatch = false;

                        if (result == "pending") {
                            this.toHide = this.toHide.not(this.errorsFor(element));
                            return;
                        }

                        if (!result) {
                            this.formatAndAdd(element, rule);
                            return false;
                        }
                    } catch (e) {
                        this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
						 + ", check the '" + rule.method + "' method");
                        throw e;
                    }
                }
                if (dependencyMismatch)
                    return;
                if (this.objectLength(rules))
                    this.successList.push(element);
                return true;
            },

            // return the custom message for the given element and validation method
            // specified in the element's "messages" metadata
            customMetaMessage: function(element, method) {
                if (!$.metadata)
                    return;

                var meta = this.settings.meta
				? $(element).metadata()[this.settings.meta]
				: $(element).metadata();

                return meta && meta.messages && meta.messages[method];
            },

            // return the custom message for the given element name and validation method
            customMessage: function(name, method) {
                var m = this.settings.messages[name];
                return m && (m.constructor == String
				? m
				: m[method]);
            },

            // return the first defined argument, allowing empty strings
            findDefined: function() {
                for (var i = 0; i < arguments.length; i++) {
                    if (arguments[i] !== undefined)
                        return arguments[i];
                }
                return undefined;
            },

            defaultMessage: function(element, method) {
                return this.findDefined(
				this.customMessage(element.name, method),
				this.customMetaMessage(element, method),
                // title is never undefined, so handle empty string as undefined
				!this.settings.ignoreTitle && element.title || undefined,
				$.validator.messages[method],
				"<strong>Warning: No message defined for " + element.name + "</strong>"
			);
            },

            formatAndAdd: function(element, rule) {
                var message = this.defaultMessage(element, rule.method);
                if (typeof message == "function")
                    message = message.call(this, rule.parameters, element);
                this.errorList.push({
                    message: message,
                    element: element
                });
                this.errorMap[element.name] = message;
                this.submitted[element.name] = message;
            },

            addWrapper: function(toToggle) {
                if (this.settings.wrapper)
                    toToggle = toToggle.add(toToggle.parents(this.settings.wrapper));
                return toToggle;
            },

            defaultShowErrors: function() {
                for (var i = 0; this.errorList[i]; i++) {
                    var error = this.errorList[i];
                    this.settings.highlight && this.settings.highlight.call(this, error.element, this.settings.errorClass);
                    this.showLabel(error.element, error.message);
                }
                if (this.errorList.length) {
                    this.toShow = this.toShow.add(this.containers);
                }
                if (this.settings.success) {
                    for (var i = 0; this.successList[i]; i++) {
                        this.showLabel(this.successList[i]);
                    }
                }
                if (this.settings.unhighlight) {
                    for (var i = 0, elements = this.validElements(); elements[i]; i++) {
                        this.settings.unhighlight.call(this, elements[i], this.settings.errorClass);
                    }
                }
                this.toHide = this.toHide.not(this.toShow);
                this.hideErrors();
                this.addWrapper(this.toShow).show();
            },

            validElements: function() {
                return this.currentElements.not(this.invalidElements());
            },

            invalidElements: function() {
                return $(this.errorList).map(function() {
                    return this.element;
                });
            },

            showLabel: function(element, message) {
                var label = this.errorsFor(element);
                if (label.length) {
                    // refresh error/success class
                    label.removeClass().addClass(this.settings.errorClass);

                    // check if we have a generated label, replace the message then
                    label.attr("generated") && label.html(message);
                } else {
                    // create label
                    label = $("<" + this.settings.errorElement + "/>")
					.attr({ "for": this.idOrName(element), generated: true })
					.addClass(this.settings.errorClass)
					.html(message || "");
                    if (this.settings.wrapper) {
                        // make sure the element is visible, even in IE
                        // actually showing the wrapped element is handled elsewhere
                        label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
                    }
                    if (!this.labelContainer.append(label).length)
                        this.settings.errorPlacement
						? this.settings.errorPlacement(label, $(element))
						: label.insertAfter(element);
                }
                if (!message && this.settings.success) {
                    label.text("");
                    typeof this.settings.success == "string"
					? label.addClass(this.settings.success)
					: this.settings.success(label);
                }
                this.toShow = this.toShow.add(label);
            },

            errorsFor: function(element) {
                return this.errors().filter("[for='" + this.idOrName(element) + "']");
            },

            idOrName: function(element) {
                return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
            },

            checkable: function(element) {
                return /radio|checkbox/i.test(element.type);
            },

            findByName: function(name) {
                // select by name and filter by form for performance over form.find("[name=...]")
                var form = this.currentForm;
                return $(document.getElementsByName(name)).map(function(index, element) {
                    return element.form == form && element.name == name && element || null;
                });
            },

            getLength: function(value, element) {
                switch (element.nodeName.toLowerCase()) {
                    case 'select':
                        return $("option:selected", element).length;
                    case 'input':
                        if (this.checkable(element))
                            return this.findByName(element.name).filter(':checked').length;
                }
                return value.length;
            },

            depend: function(param, element) {
                return this.dependTypes[typeof param]
				? this.dependTypes[typeof param](param, element)
				: true;
            },

            dependTypes: {
                "boolean": function(param, element) {
                    return param;
                },
                "string": function(param, element) {
                    return !!$(param, element.form).length;
                },
                "function": function(param, element) {
                    return param(element);
                }
            },

            optional: function(element) {
                return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
            },

            startRequest: function(element) {
                if (!this.pending[element.name]) {
                    this.pendingRequest++;
                    this.pending[element.name] = true;
                }
            },

            stopRequest: function(element, valid) {
                this.pendingRequest--;
                // sometimes synchronization fails, make sure pendingRequest is never < 0
                if (this.pendingRequest < 0)
                    this.pendingRequest = 0;
                delete this.pending[element.name];
                if (valid && this.pendingRequest == 0 && this.formSubmitted && this.form()) {
                    $(this.currentForm).submit();
                } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
                    $(this.currentForm).triggerHandler("invalid-form", [this]);
                }
            },

            previousValue: function(element) {
                return $.data(element, "previousValue") || $.data(element, "previousValue", previous = {
                    old: null,
                    valid: true,
                    message: this.defaultMessage(element, "remote")
                });
            }

        },

        classRuleSettings: {
            required: { required: true },
            email: { email: true },
            url: { url: true },
            date: { date: true },
            dateISO: { dateISO: true },
            dateDE: { dateDE: true },
            number: { number: true },
            numberDE: { numberDE: true },
            digits: { digits: true },
            creditcard: { creditcard: true }
        },

        addClassRules: function(className, rules) {
            className.constructor == String ?
			this.classRuleSettings[className] = rules :
			$.extend(this.classRuleSettings, className);
        },

        classRules: function(element) {
            var rules = {};
            var classes = $(element).attr('class');
            classes && $.each(classes.split(' '), function() {
                if (this in $.validator.classRuleSettings) {
                    $.extend(rules, $.validator.classRuleSettings[this]);
                }
            });
            return rules;
        },

        attributeRules: function(element) {
            var rules = {};
            var $element = $(element);

            for (method in $.validator.methods) {
                var value = $element.attr(method);
                if (value) {
                    rules[method] = value;
                }
            }

            // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
            if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
                delete rules.maxlength;
            }

            return rules;
        },

        metadataRules: function(element) {
            if (!$.metadata) return {};

            var meta = $.data(element.form, 'validator').settings.meta;
            return meta ?
			$(element).metadata()[meta] :
			$(element).metadata();
        },

        staticRules: function(element) {
            var rules = {};
            var validator = $.data(element.form, 'validator');
            if (validator.settings.rules) {
                rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
            }
            return rules;
        },

        normalizeRules: function(rules, element) {
            // handle dependency check
            $.each(rules, function(prop, val) {
                // ignore rule when param is explicitly false, eg. required:false
                if (val === false) {
                    delete rules[prop];
                    return;
                }
                if (val.param || val.depends) {
                    var keepRule = true;
                    switch (typeof val.depends) {
                        case "string":
                            keepRule = !!$(val.depends, element.form).length;
                            break;
                        case "function":
                            keepRule = val.depends.call(element, element);
                            break;
                    }
                    if (keepRule) {
                        rules[prop] = val.param !== undefined ? val.param : true;
                    } else {
                        delete rules[prop];
                    }
                }
            });

            // evaluate parameters
            $.each(rules, function(rule, parameter) {
                rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
            });

            // clean number parameters
            $.each(['minlength', 'maxlength', 'min', 'max'], function() {
                if (rules[this]) {
                    rules[this] = Number(rules[this]);
                }
            });
            $.each(['rangelength', 'range'], function() {
                if (rules[this]) {
                    rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
                }
            });

            if ($.validator.autoCreateRanges) {
                // auto-create ranges
                if (rules.min && rules.max) {
                    rules.range = [rules.min, rules.max];
                    delete rules.min;
                    delete rules.max;
                }
                if (rules.minlength && rules.maxlength) {
                    rules.rangelength = [rules.minlength, rules.maxlength];
                    delete rules.minlength;
                    delete rules.maxlength;
                }
            }

            // To support custom messages in metadata ignore rule methods titled "messages"
            if (rules.messages) {
                delete rules.messages
            }

            return rules;
        },

        // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
        normalizeRule: function(data) {
            if (typeof data == "string") {
                var transformed = {};
                $.each(data.split(/\s/), function() {
                    transformed[this] = true;
                });
                data = transformed;
            }
            return data;
        },

        // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
        addMethod: function(name, method, message) {
            $.validator.methods[name] = method;
            $.validator.messages[name] = message;
            if (method.length < 3) {
                $.validator.addClassRules(name, $.validator.normalizeRule(name));
            }
        },

        methods: {

            // http://docs.jquery.com/Plugins/Validation/Methods/required
            required: function(value, element, param) {
                // check if dependency is met
                if (!this.depend(param, element))
                    return "dependency-mismatch";
                switch (element.nodeName.toLowerCase()) {
                    case 'select':
                        var options = $("option:selected", element);
                        return options.length > 0 && (element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0);
                    case 'input':
                        if (this.checkable(element))
                            return this.getLength(value, element) > 0;
                    default:
                        return $.trim(value).length > 0;
                }
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/remote
            remote: function(value, element, param) {
                if (this.optional(element))
                    return "dependency-mismatch";

                var previous = this.previousValue(element);

                if (!this.settings.messages[element.name])
                    this.settings.messages[element.name] = {};
                this.settings.messages[element.name].remote = typeof previous.message == "function" ? previous.message(value) : previous.message;

                param = typeof param == "string" && { url: param} || param;

                if (previous.old !== value) {
                    previous.old = value;
                    var validator = this;
                    this.startRequest(element);
                    var data = {};
                    data[element.name] = value;
                    $.ajax($.extend(true, {
                        url: param,
                        mode: "abort",
                        port: "validate" + element.name,
                        dataType: "json",
                        data: data,
                        success: function(response) {
                            if (response) {
                                var submitted = validator.formSubmitted;
                                validator.prepareElement(element);
                                validator.formSubmitted = submitted;
                                validator.successList.push(element);
                                validator.showErrors();
                            } else {
                                var errors = {};
                                errors[element.name] = response || validator.defaultMessage(element, "remote");
                                validator.showErrors(errors);
                            }
                            previous.valid = response;
                            validator.stopRequest(element, response);
                        }
                    }, param));
                    return "pending";
                } else if (this.pending[element.name]) {
                    return "pending";
                }
                return previous.valid;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/minlength
            minlength: function(value, element, param) {
                return this.optional(element) || this.getLength($.trim(value), element) >= param;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
            maxlength: function(value, element, param) {
                return this.optional(element) || this.getLength($.trim(value), element) <= param;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
            rangelength: function(value, element, param) {
                var length = this.getLength($.trim(value), element);
                return this.optional(element) || (length >= param[0] && length <= param[1]);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/min
            min: function(value, element, param) {
                return this.optional(element) || value >= param;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/max
            max: function(value, element, param) {
                return this.optional(element) || value <= param;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/range
            range: function(value, element, param) {
                return this.optional(element) || (value >= param[0] && value <= param[1]);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/email
            email: function(value, element) {
                // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
                return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/url
            url: function(value, element) {
                // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
                return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/date
            date: function(value, element) {
                return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
            dateISO: function(value, element) {
                return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/dateDE
            dateDE: function(value, element) {
                return this.optional(element) || /^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/number
            number: function(value, element) {
                return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/numberDE
            numberDE: function(value, element) {
                return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/digits
            digits: function(value, element) {
                return this.optional(element) || /^\d+$/.test(value);
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
            // based on http://en.wikipedia.org/wiki/Luhn
            creditcard: function(value, element) {
                if (this.optional(element))
                    return "dependency-mismatch";
                // accept only digits and dashes
                if (/[^0-9-]+/.test(value))
                    return false;
                var nCheck = 0,
				nDigit = 0,
				bEven = false;

                value = value.replace(/\D/g, "");

                for (n = value.length - 1; n >= 0; n--) {
                    var cDigit = value.charAt(n);
                    var nDigit = parseInt(cDigit, 10);
                    if (bEven) {
                        if ((nDigit *= 2) > 9)
                            nDigit -= 9;
                    }
                    nCheck += nDigit;
                    bEven = !bEven;
                }

                return (nCheck % 10) == 0;
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/accept
            accept: function(value, element, param) {
                param = typeof param == "string" ? param : "png|jpe?g|gif";
                return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
            },

            // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
            equalTo: function(value, element, param) {
                return value == $(param).val();
            }

        }

    });

})(jQuery);

// ajax mode: abort
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 
; (function($) {
    var ajax = $.ajax;
    var pendingRequests = {};
    $.ajax = function(settings) {
        // create settings for compatibility with ajaxSetup
        settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
        var port = settings.port;
        if (settings.mode == "abort") {
            if (pendingRequests[port]) {
                pendingRequests[port].abort();
            }
            return (pendingRequests[port] = ajax.apply(this, arguments));
        }
        return ajax.apply(this, arguments);
    };
})(jQuery);

// provides cross-browser focusin and focusout events
// IE has native support, in other browsers, use event caputuring (neither bubbles)

// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 

// provides triggerEvent(type: String, target: Element) to trigger delegated events
; (function($) {
    $.each({
        focus: 'focusin',
        blur: 'focusout'
    }, function(original, fix) {
        $.event.special[fix] = {
            setup: function() {
                if ($.browser.msie) return false;
                this.addEventListener(original, $.event.special[fix].handler, true);
            },
            teardown: function() {
                if ($.browser.msie) return false;
                this.removeEventListener(original,
				$.event.special[fix].handler, true);
            },
            handler: function(e) {
                arguments[0] = $.event.fix(e);
                arguments[0].type = fix;
                return $.event.handle.apply(this, arguments);
            }
        };
    });
    $.extend($.fn, {
        delegate: function(type, delegate, handler) {
            return this.bind(type, function(event) {
                var target = $(event.target);
                if (target.is(delegate)) {
                    return handler.apply(target, arguments);
                }
            });
        },
        triggerEvent: function(type, target) {
            return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
        }
    })
})(jQuery);


function toggleAnswer(whoToShowHide) {
    if (document.getElementById(whoToShowHide).style.display != 'block') {
        document.getElementById(whoToShowHide).style.display = 'block';
    } else {
        document.getElementById(whoToShowHide).style.display = 'none';
    }
}

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject = function() { var D = "undefined", r = "object", S = "Shockwave Flash", W = "ShockwaveFlash.ShockwaveFlash", q = "application/x-shockwave-flash", R = "SWFObjectExprInst", x = "onreadystatechange", O = window, j = document, t = navigator, T = false, U = [h], o = [], N = [], I = [], l, Q, E, B, J = false, a = false, n, G, m = true, M = function() { var aa = typeof j.getElementById != D && typeof j.getElementsByTagName != D && typeof j.createElement != D, ah = t.userAgent.toLowerCase(), Y = t.platform.toLowerCase(), ae = Y ? /win/.test(Y) : /win/.test(ah), ac = Y ? /mac/.test(Y) : /mac/.test(ah), af = /webkit/.test(ah) ? parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, X = ! +"\v1", ag = [0, 0, 0], ab = null; if (typeof t.plugins != D && typeof t.plugins[S] == r) { ab = t.plugins[S].description; if (ab && !(typeof t.mimeTypes != D && t.mimeTypes[q] && !t.mimeTypes[q].enabledPlugin)) { T = true; X = false; ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10); ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10); ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0 } } else { if (typeof O.ActiveXObject != D) { try { var ad = new ActiveXObject(W); if (ad) { ab = ad.GetVariable("$version"); if (ab) { X = true; ab = ab.split(" ")[1].split(","); ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } } catch (Z) { } } } return { w3: aa, pv: ag, wk: af, ie: X, win: ae, mac: ac} } (), k = function() { if (!M.w3) { return } if ((typeof j.readyState != D && j.readyState == "complete") || (typeof j.readyState == D && (j.getElementsByTagName("body")[0] || j.body))) { f() } if (!J) { if (typeof j.addEventListener != D) { j.addEventListener("DOMContentLoaded", f, false) } if (M.ie && M.win) { j.attachEvent(x, function() { if (j.readyState == "complete") { j.detachEvent(x, arguments.callee); f() } }); if (O == top) { (function() { if (J) { return } try { j.documentElement.doScroll("left") } catch (X) { setTimeout(arguments.callee, 0); return } f() })() } } if (M.wk) { (function() { if (J) { return } if (!/loaded|complete/.test(j.readyState)) { setTimeout(arguments.callee, 0); return } f() })() } s(f) } } (); function f() { if (J) { return } try { var Z = j.getElementsByTagName("body")[0].appendChild(C("span")); Z.parentNode.removeChild(Z) } catch (aa) { return } J = true; var X = U.length; for (var Y = 0; Y < X; Y++) { U[Y]() } } function K(X) { if (J) { X() } else { U[U.length] = X } } function s(Y) { if (typeof O.addEventListener != D) { O.addEventListener("load", Y, false) } else { if (typeof j.addEventListener != D) { j.addEventListener("load", Y, false) } else { if (typeof O.attachEvent != D) { i(O, "onload", Y) } else { if (typeof O.onload == "function") { var X = O.onload; O.onload = function() { X(); Y() } } else { O.onload = Y } } } } } function h() { if (T) { V() } else { H() } } function V() { var X = j.getElementsByTagName("body")[0]; var aa = C(r); aa.setAttribute("type", q); var Z = X.appendChild(aa); if (Z) { var Y = 0; (function() { if (typeof Z.GetVariable != D) { var ab = Z.GetVariable("$version"); if (ab) { ab = ab.split(" ")[1].split(","); M.pv = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } else { if (Y < 10) { Y++; setTimeout(arguments.callee, 10); return } } X.removeChild(aa); Z = null; H() })() } else { H() } } function H() { var ag = o.length; if (ag > 0) { for (var af = 0; af < ag; af++) { var Y = o[af].id; var ab = o[af].callbackFn; var aa = { success: false, id: Y }; if (M.pv[0] > 0) { var ae = c(Y); if (ae) { if (F(o[af].swfVersion) && !(M.wk && M.wk < 312)) { w(Y, true); if (ab) { aa.success = true; aa.ref = z(Y); ab(aa) } } else { if (o[af].expressInstall && A()) { var ai = {}; ai.data = o[af].expressInstall; ai.width = ae.getAttribute("width") || "0"; ai.height = ae.getAttribute("height") || "0"; if (ae.getAttribute("class")) { ai.styleclass = ae.getAttribute("class") } if (ae.getAttribute("align")) { ai.align = ae.getAttribute("align") } var ah = {}; var X = ae.getElementsByTagName("param"); var ac = X.length; for (var ad = 0; ad < ac; ad++) { if (X[ad].getAttribute("name").toLowerCase() != "movie") { ah[X[ad].getAttribute("name")] = X[ad].getAttribute("value") } } P(ai, ah, Y, ab) } else { p(ae); if (ab) { ab(aa) } } } } } else { w(Y, true); if (ab) { var Z = z(Y); if (Z && typeof Z.SetVariable != D) { aa.success = true; aa.ref = Z } ab(aa) } } } } } function z(aa) { var X = null; var Y = c(aa); if (Y && Y.nodeName == "OBJECT") { if (typeof Y.SetVariable != D) { X = Y } else { var Z = Y.getElementsByTagName(r)[0]; if (Z) { X = Z } } } return X } function A() { return !a && F("6.0.65") && (M.win || M.mac) && !(M.wk && M.wk < 312) } function P(aa, ab, X, Z) { a = true; E = Z || null; B = { success: false, id: X }; var ae = c(X); if (ae) { if (ae.nodeName == "OBJECT") { l = g(ae); Q = null } else { l = ae; Q = X } aa.id = R; if (typeof aa.width == D || (!/%$/.test(aa.width) && parseInt(aa.width, 10) < 310)) { aa.width = "310" } if (typeof aa.height == D || (!/%$/.test(aa.height) && parseInt(aa.height, 10) < 137)) { aa.height = "137" } j.title = j.title.slice(0, 47) + " - Flash Player Installation"; var ad = M.ie && M.win ? "ActiveX" : "PlugIn", ac = "MMredirectURL=" + O.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + ad + "&MMdoctitle=" + j.title; if (typeof ab.flashvars != D) { ab.flashvars += "&" + ac } else { ab.flashvars = ac } if (M.ie && M.win && ae.readyState != 4) { var Y = C("div"); X += "SWFObjectNew"; Y.setAttribute("id", X); ae.parentNode.insertBefore(Y, ae); ae.style.display = "none"; (function() { if (ae.readyState == 4) { ae.parentNode.removeChild(ae) } else { setTimeout(arguments.callee, 10) } })() } u(aa, ab, X) } } function p(Y) { if (M.ie && M.win && Y.readyState != 4) { var X = C("div"); Y.parentNode.insertBefore(X, Y); X.parentNode.replaceChild(g(Y), X); Y.style.display = "none"; (function() { if (Y.readyState == 4) { Y.parentNode.removeChild(Y) } else { setTimeout(arguments.callee, 10) } })() } else { Y.parentNode.replaceChild(g(Y), Y) } } function g(ab) { var aa = C("div"); if (M.win && M.ie) { aa.innerHTML = ab.innerHTML } else { var Y = ab.getElementsByTagName(r)[0]; if (Y) { var ad = Y.childNodes; if (ad) { var X = ad.length; for (var Z = 0; Z < X; Z++) { if (!(ad[Z].nodeType == 1 && ad[Z].nodeName == "PARAM") && !(ad[Z].nodeType == 8)) { aa.appendChild(ad[Z].cloneNode(true)) } } } } } return aa } function u(ai, ag, Y) { var X, aa = c(Y); if (M.wk && M.wk < 312) { return X } if (aa) { if (typeof ai.id == D) { ai.id = Y } if (M.ie && M.win) { var ah = ""; for (var ae in ai) { if (ai[ae] != Object.prototype[ae]) { if (ae.toLowerCase() == "data") { ag.movie = ai[ae] } else { if (ae.toLowerCase() == "styleclass") { ah += ' class="' + ai[ae] + '"' } else { if (ae.toLowerCase() != "classid") { ah += " " + ae + '="' + ai[ae] + '"' } } } } } var af = ""; for (var ad in ag) { if (ag[ad] != Object.prototype[ad]) { af += '<param name="' + ad + '" value="' + ag[ad] + '" />' } } aa.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ah + ">" + af + "</object>"; N[N.length] = ai.id; X = c(ai.id) } else { var Z = C(r); Z.setAttribute("type", q); for (var ac in ai) { if (ai[ac] != Object.prototype[ac]) { if (ac.toLowerCase() == "styleclass") { Z.setAttribute("class", ai[ac]) } else { if (ac.toLowerCase() != "classid") { Z.setAttribute(ac, ai[ac]) } } } } for (var ab in ag) { if (ag[ab] != Object.prototype[ab] && ab.toLowerCase() != "movie") { e(Z, ab, ag[ab]) } } aa.parentNode.replaceChild(Z, aa); X = Z } } return X } function e(Z, X, Y) { var aa = C("param"); aa.setAttribute("name", X); aa.setAttribute("value", Y); Z.appendChild(aa) } function y(Y) { var X = c(Y); if (X && X.nodeName == "OBJECT") { if (M.ie && M.win) { X.style.display = "none"; (function() { if (X.readyState == 4) { b(Y) } else { setTimeout(arguments.callee, 10) } })() } else { X.parentNode.removeChild(X) } } } function b(Z) { var Y = c(Z); if (Y) { for (var X in Y) { if (typeof Y[X] == "function") { Y[X] = null } } Y.parentNode.removeChild(Y) } } function c(Z) { var X = null; try { X = j.getElementById(Z) } catch (Y) { } return X } function C(X) { return j.createElement(X) } function i(Z, X, Y) { Z.attachEvent(X, Y); I[I.length] = [Z, X, Y] } function F(Z) { var Y = M.pv, X = Z.split("."); X[0] = parseInt(X[0], 10); X[1] = parseInt(X[1], 10) || 0; X[2] = parseInt(X[2], 10) || 0; return (Y[0] > X[0] || (Y[0] == X[0] && Y[1] > X[1]) || (Y[0] == X[0] && Y[1] == X[1] && Y[2] >= X[2])) ? true : false } function v(ac, Y, ad, ab) { if (M.ie && M.mac) { return } var aa = j.getElementsByTagName("head")[0]; if (!aa) { return } var X = (ad && typeof ad == "string") ? ad : "screen"; if (ab) { n = null; G = null } if (!n || G != X) { var Z = C("style"); Z.setAttribute("type", "text/css"); Z.setAttribute("media", X); n = aa.appendChild(Z); if (M.ie && M.win && typeof j.styleSheets != D && j.styleSheets.length > 0) { n = j.styleSheets[j.styleSheets.length - 1] } G = X } if (M.ie && M.win) { if (n && typeof n.addRule == r) { n.addRule(ac, Y) } } else { if (n && typeof j.createTextNode != D) { n.appendChild(j.createTextNode(ac + " {" + Y + "}")) } } } function w(Z, X) { if (!m) { return } var Y = X ? "visible" : "hidden"; if (J && c(Z)) { c(Z).style.visibility = Y } else { v("#" + Z, "visibility:" + Y) } } function L(Y) { var Z = /[\\\"<>\.;]/; var X = Z.exec(Y) != null; return X && typeof encodeURIComponent != D ? encodeURIComponent(Y) : Y } var d = function() { if (M.ie && M.win) { window.attachEvent("onunload", function() { var ac = I.length; for (var ab = 0; ab < ac; ab++) { I[ab][0].detachEvent(I[ab][1], I[ab][2]) } var Z = N.length; for (var aa = 0; aa < Z; aa++) { y(N[aa]) } for (var Y in M) { M[Y] = null } M = null; for (var X in swfobject) { swfobject[X] = null } swfobject = null }) } } (); return { registerObject: function(ab, X, aa, Z) { if (M.w3 && ab && X) { var Y = {}; Y.id = ab; Y.swfVersion = X; Y.expressInstall = aa; Y.callbackFn = Z; o[o.length] = Y; w(ab, false) } else { if (Z) { Z({ success: false, id: ab }) } } }, getObjectById: function(X) { if (M.w3) { return z(X) } }, embedSWF: function(ab, ah, ae, ag, Y, aa, Z, ad, af, ac) { var X = { success: false, id: ah }; if (M.w3 && !(M.wk && M.wk < 312) && ab && ah && ae && ag && Y) { w(ah, false); K(function() { ae += ""; ag += ""; var aj = {}; if (af && typeof af === r) { for (var al in af) { aj[al] = af[al] } } aj.data = ab; aj.width = ae; aj.height = ag; var am = {}; if (ad && typeof ad === r) { for (var ak in ad) { am[ak] = ad[ak] } } if (Z && typeof Z === r) { for (var ai in Z) { if (typeof am.flashvars != D) { am.flashvars += "&" + ai + "=" + Z[ai] } else { am.flashvars = ai + "=" + Z[ai] } } } if (F(Y)) { var an = u(aj, am, ah); if (aj.id == ah) { w(ah, true) } X.success = true; X.ref = an } else { if (aa && A()) { aj.data = aa; P(aj, am, ah, ac); return } else { w(ah, true) } } if (ac) { ac(X) } }) } else { if (ac) { ac(X) } } }, switchOffAutoHideShow: function() { m = false }, ua: M, getFlashPlayerVersion: function() { return { major: M.pv[0], minor: M.pv[1], release: M.pv[2]} }, hasFlashPlayerVersion: F, createSWF: function(Z, Y, X) { if (M.w3) { return u(Z, Y, X) } else { return undefined } }, showExpressInstall: function(Z, aa, X, Y) { if (M.w3 && A()) { P(Z, aa, X, Y) } }, removeSWF: function(X) { if (M.w3) { y(X) } }, createCSS: function(aa, Z, Y, X) { if (M.w3) { v(aa, Z, Y, X) } }, addDomLoadEvent: K, addLoadEvent: s, getQueryParamValue: function(aa) { var Z = j.location.search || j.location.hash; if (Z) { if (/\?/.test(Z)) { Z = Z.split("?")[1] } if (aa == null) { return L(Z) } var Y = Z.split("&"); for (var X = 0; X < Y.length; X++) { if (Y[X].substring(0, Y[X].indexOf("=")) == aa) { return L(Y[X].substring((Y[X].indexOf("=") + 1))) } } } return "" }, expressInstallCallback: function() { if (a) { var X = c(R); if (X && l) { X.parentNode.replaceChild(l, X); if (Q) { w(Q, true); if (M.ie && M.win) { l.style.display = "block" } } if (E) { E(B) } } a = false } } } } ();

/* DWR Ajax plug-in*/

var DWR_HOST_PACKAGE;

if (DWREngine == null) var DWREngine = {};

DWREngine.setErrorHandler = function(handler) {
    DWREngine._errorHandler = handler;
};





DWREngine.setWarningHandler = function(handler) {
    DWREngine._warningHandler = handler;
};





DWREngine.setTimeout = function(timeout) {
    DWREngine._timeout = timeout;
};





DWREngine.setPreHook = function(handler) {
    DWREngine._preHook = handler;
};





DWREngine.setPostHook = function(handler) {
    DWREngine._postHook = handler;
};


DWREngine.XMLHttpRequest = 1;


DWREngine.IFrame = 2;






DWREngine.setMethod = function(newMethod) {
    if (newMethod != DWREngine.XMLHttpRequest && newMethod != DWREngine.IFrame) {
        DWREngine._handleError("Remoting method must be one of DWREngine.XMLHttpRequest or DWREngine.IFrame");
        return;
    }
    DWREngine._method = newMethod;
};





DWREngine.setVerb = function(verb) {
    if (verb != "GET" && verb != "POST") {
        DWREngine._handleError("Remoting verb must be one of GET or POST");
        return;
    }
    DWREngine._verb = verb;
};





DWREngine.setOrdered = function(ordered) {
    DWREngine._ordered = ordered;
};





DWREngine.setAsync = function(async) {
    DWREngine._async = async;
};





DWREngine.setTextHtmlHandler = function(handler) {
    DWREngine._textHtmlHandler = handler;
}





DWREngine.defaultMessageHandler = function(message) {
    if (typeof message == "object" && message.name == "Error" && message.description) {
        alert("Error: " + message.description);
    }
    else {

        if (message.toString().indexOf("0x80040111") == -1) {
            alert(message);
        }
    }
};





DWREngine.beginBatch = function() {
    if (DWREngine._batch) {
        DWREngine._handleError("Batch already started.");
        return;
    }

    DWREngine._batch = {
        map: { callCount: 0 },
        paramCount: 0,
        ids: [],
        preHooks: [],
        postHooks: []
    };
};





DWREngine.endBatch = function(options) {
    var batch = DWREngine._batch;
    if (batch == null) {
        DWREngine._handleError("No batch in progress.");
        return;
    }

    if (options && options.preHook) batch.preHooks.unshift(options.preHook);
    if (options && options.postHook) batch.postHooks.push(options.postHook);
    if (DWREngine._preHook) batch.preHooks.unshift(DWREngine._preHook);
    if (DWREngine._postHook) batch.postHooks.push(DWREngine._postHook);

    if (batch.method == null) batch.method = DWREngine._method;
    if (batch.verb == null) batch.verb = DWREngine._verb;
    if (batch.async == null) batch.async = DWREngine._async;
    if (batch.timeout == null) batch.timeout = DWREngine._timeout;

    batch.completed = false;


    DWREngine._batch = null;



    if (!DWREngine._ordered) {
        DWREngine._sendData(batch);
        DWREngine._batches[DWREngine._batches.length] = batch;
    }
    else {
        if (DWREngine._batches.length == 0) {

            DWREngine._sendData(batch);
            DWREngine._batches[DWREngine._batches.length] = batch;
        }
        else {

            DWREngine._batchQueue[DWREngine._batchQueue.length] = batch;
        }
    }
};






DWREngine._errorHandler = DWREngine.defaultMessageHandler;


DWREngine._warningHandler = null;


DWREngine._preHook = null;


DWREngine._postHook = null;


DWREngine._batches = [];


DWREngine._batchQueue = [];


DWREngine._handlersMap = {};


DWREngine._method = DWREngine.XMLHttpRequest;


DWREngine._verb = "POST";


DWREngine._ordered = false;


DWREngine._async = true;


DWREngine._batch = null;


DWREngine._timeout = 0;


DWREngine._DOMDocument = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"];


DWREngine._XMLHTTP = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];










DWREngine._execute = function(path, scriptName, methodName, vararg_params) {
    var singleShot = false;
    if (DWREngine._batch == null) {
        DWREngine.beginBatch();
        singleShot = true;
    }

    var args = [];
    for (var i = 0; i < arguments.length - 3; i++) {
        args[i] = arguments[i + 3];
    }

    if (DWREngine._batch.path == null) {
        DWREngine._batch.path = path;
    }
    else {
        if (DWREngine._batch.path != path) {
            DWREngine._handleError("Can't batch requests to multiple DWR Servlets.");
            return;
        }
    }


    var params;
    var callData;
    var firstArg = args[0];
    var lastArg = args[args.length - 1];

    if (typeof firstArg == "function") {
        callData = { callback: args.shift() };
        params = args;
    }
    else if (typeof lastArg == "function") {
        callData = { callback: args.pop() };
        params = args;
    }
    else if (lastArg != null && typeof lastArg == "object" && lastArg.callback != null && typeof lastArg.callback == "function") {
        callData = args.pop();
        params = args;
    }
    else if (firstArg == null) {



        if (lastArg == null && args.length > 2) {
            DWREngine._handleError("Ambiguous nulls at start and end of parameter list. Which is the callback function?");
        }
        callData = { callback: args.shift() };
        params = args;
    }
    else if (lastArg == null) {
        callData = { callback: args.pop() };
        params = args;
    }
    else {
        DWREngine._handleError("Missing callback function or metadata object.");
        return;
    }


    var random = Math.floor(Math.random() * 10001);
    var id = (random + "_" + new Date().getTime()).toString();
    var prefix = "c" + DWREngine._batch.map.callCount + "-";
    DWREngine._batch.ids.push(id);


    if (callData.method != null) {
        DWREngine._batch.method = callData.method;
        delete callData.method;
    }
    if (callData.verb != null) {
        DWREngine._batch.verb = callData.verb;
        delete callData.verb;
    }
    if (callData.async != null) {
        DWREngine._batch.async = callData.async;
        delete callData.async;
    }
    if (callData.timeout != null) {
        DWREngine._batch.timeout = callData.timeout;
        delete callData.timeout;
    }


    if (callData.preHook != null) {
        DWREngine._batch.preHooks.unshift(callData.preHook);
        delete callData.preHook;
    }
    if (callData.postHook != null) {
        DWREngine._batch.postHooks.push(callData.postHook);
        delete callData.postHook;
    }


    if (callData.errorHandler == null) callData.errorHandler = DWREngine._errorHandler;
    if (callData.warningHandler == null) callData.warningHandler = DWREngine._warningHandler;


    DWREngine._handlersMap[id] = callData;

    DWREngine._batch.map[prefix + "scriptName"] = scriptName;
    DWREngine._batch.map[prefix + "methodName"] = methodName;
    DWREngine._batch.map[prefix + "id"] = id;


    for (i = 0; i < params.length; i++) {
        DWREngine._serializeAll(DWREngine._batch, [], params[i], prefix + "param" + i);
    }


    DWREngine._batch.map.callCount++;
    if (singleShot) {
        DWREngine.endBatch();
    }
};


DWREngine._sendData = function(batch) {

    if (batch.map.callCount == 0) return;

    for (var i = 0; i < batch.preHooks.length; i++) {
        batch.preHooks[i]();
    }
    batch.preHooks = null;

    if (batch.timeout && batch.timeout != 0) {
        batch.interval = setInterval(function() { DWREngine._abortRequest(batch); }, batch.timeout);
    }

    var urlPostfix;
    if (batch.map.callCount == 1) {
        urlPostfix = batch.map["c0-scriptName"] + "." + batch.map["c0-methodName"] + ".dwr";
    }
    else {
        urlPostfix = "Multiple." + batch.map.callCount + ".dwr";
    }


    if (batch.method == DWREngine.XMLHttpRequest) {
        if (window.XMLHttpRequest) {
            batch.req = new XMLHttpRequest();
        }

        else if (window.ActiveXObject && !(navigator.userAgent.indexOf("Mac") >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)) {
            batch.req = DWREngine._newActiveXObject(DWREngine._XMLHTTP);
        }
    }

    var query = "";
    var prop;


    if (batch.req) {
        batch.map.xml = "true";

        if (batch.async) {
            batch.req.onreadystatechange = function() { DWREngine._stateChange(batch); };
        }

        var indexSafari = navigator.userAgent.indexOf("Safari/");
        if (indexSafari >= 0) {
            var version = navigator.userAgent.substring(indexSafari + 7);
            if (parseInt(version, 10) < 400) batch.verb == "GET";
        }
        if (batch.verb == "GET") {



            batch.map.callCount = "" + batch.map.callCount;

            for (prop in batch.map) {
                var qkey = encodeURIComponent(prop);
                var qval = encodeURIComponent(batch.map[prop]);
                if (qval == "") DWREngine._handleError("Found empty qval for qkey=" + qkey);
                query += qkey + "=" + qval + "&";
            }

            try {
                batch.req.open("GET", batch.path + "/exec/" + urlPostfix + "?" + query, batch.async);
                batch.req.send(null);
                if (!batch.async) DWREngine._stateChange(batch);
            }
            catch (ex) {
                DWREngine._handleMetaDataError(null, ex);
            }
        }
        else {
            for (prop in batch.map) {
                if (typeof batch.map[prop] != "function") {
                    query += prop + "=" + batch.map[prop] + "\n";
                }
            }

            try {
                batch.req.open("POST", batch.path + "/exec/" + urlPostfix, batch.async);
                batch.req.setRequestHeader('Content-Type', 'text/plain');
                batch.req.send(query);
                if (!batch.async) DWREngine._stateChange(batch);
            }
            catch (ex) {
                DWREngine._handleMetaDataError(null, ex);
            }
        }
    }
    else {
        batch.map.xml = "false";
        var idname = "dwr-if-" + batch.map["c0-id"];

        batch.div = document.createElement("div");
        batch.div.innerHTML = "<iframe src='javascript:void(0)' frameborder='0' width='0' height='0' id='" + idname + "' name='" + idname + "'></iframe>";
        document.body.appendChild(batch.div);
        batch.iframe = document.getElementById(idname);
        batch.iframe.setAttribute("style", "width:0px; height:0px; border:0px;");

        if (batch.verb == "GET") {
            for (prop in batch.map) {
                if (typeof batch.map[prop] != "function") {
                    query += encodeURIComponent(prop) + "=" + encodeURIComponent(batch.map[prop]) + "&";
                }
            }
            query = query.substring(0, query.length - 1);

            batch.iframe.setAttribute("src", batch.path + "/exec/" + urlPostfix + "?" + query);
            document.body.appendChild(batch.iframe);
        }
        else {
            batch.form = document.createElement("form");
            batch.form.setAttribute("id", "dwr-form");
            batch.form.setAttribute("action", batch.path + "/exec" + urlPostfix);
            batch.form.setAttribute("target", idname);
            batch.form.target = idname;
            batch.form.setAttribute("method", "POST");
            for (prop in batch.map) {
                var formInput = document.createElement("input");
                formInput.setAttribute("type", "hidden");
                formInput.setAttribute("name", prop);
                formInput.setAttribute("value", batch.map[prop]);
                batch.form.appendChild(formInput);
            }
            document.body.appendChild(batch.form);
            batch.form.submit();
        }
    }
};


DWREngine._stateChange = function(batch) {
    if (!batch.completed && batch.req.readyState == 4) {
        try {
            var reply = batch.req.responseText;

            if (reply == null || reply == "") {
                DWREngine._handleMetaDataWarning(null, "No data received from server");
            }
            else {
                var contentType = batch.req.getResponseHeader("Content-Type");
                if (!contentType.match(/^text\/plain/) && !contentType.match(/^text\/javascript/)) {
                    if (DWREngine._textHtmlHandler && contentType.match(/^text\/html/)) {
                        DWREngine._textHtmlHandler();
                    }
                    else {
                        DWREngine._handleMetaDataWarning(null, "Invalid content type from server: '" + contentType + "'");
                    }
                }
                else {



                    if (reply.search("DWREngine._handle") == -1) {
                        DWREngine._handleMetaDataWarning(null, "Invalid reply from server");
                    }
                    else {
                        eval(reply);
                    }
                }
            }


            DWREngine._clearUp(batch);
        }
        catch (ex) {
            if (ex == null) ex = "Unknown error occured";
            DWREngine._handleMetaDataWarning(null, ex);
        }
        finally {



            if (DWREngine._batchQueue.length != 0) {
                var sendbatch = DWREngine._batchQueue.shift();
                DWREngine._sendData(sendbatch);
                DWREngine._batches[DWREngine._batches.length] = sendbatch;
            }
        }
    }
};






DWREngine._handleResponse = function(id, reply) {

    var handlers = DWREngine._handlersMap[id];
    DWREngine._handlersMap[id] = null;

    if (handlers) {


        try {
            if (handlers.callback) handlers.callback(reply);
        }
        catch (ex) {
            DWREngine._handleMetaDataError(handlers, ex);
        }
    }


    if (DWREngine._method == DWREngine.IFrame) {
        var responseBatch = DWREngine._batches[DWREngine._batches.length - 1];

        if (responseBatch.map["c" + (responseBatch.map.callCount - 1) + "-id"] == id) {
            DWREngine._clearUp(responseBatch);
        }
    }
};


DWREngine._handleServerError = function(id, error) {

    var handlers = DWREngine._handlersMap[id];
    DWREngine._handlersMap[id] = null;

    if (error.message) DWREngine._handleMetaDataError(handlers, error.message, error);
    else DWREngine._handleMetaDataError(handlers, error);
};


DWREngine._eval = function(script) {
    return eval(script);
}


DWREngine._abortRequest = function(batch) {
    if (batch && !batch.completed) {
        clearInterval(batch.interval);
        DWREngine._clearUp(batch);
        if (batch.req) batch.req.abort();

        var handlers;
        for (var i = 0; i < batch.ids.length; i++) {
            handlers = DWREngine._handlersMap[batch.ids[i]];
            DWREngine._handleMetaDataError(handlers, "Timeout");
        }
    }
};


DWREngine._clearUp = function(batch) {
    if (batch.completed) {
        DWREngine._handleError("Double complete");
        return;
    }


    if (batch.div) batch.div.parentNode.removeChild(batch.div);
    if (batch.iframe) batch.iframe.parentNode.removeChild(batch.iframe);
    if (batch.form) batch.form.parentNode.removeChild(batch.form);


    if (batch.req) delete batch.req;

    for (var i = 0; i < batch.postHooks.length; i++) {
        batch.postHooks[i]();
    }
    batch.postHooks = null;


    for (var i = 0; i < DWREngine._batches.length; i++) {
        if (DWREngine._batches[i] == batch) {
            DWREngine._batches.splice(i, 1);
            break;
        }
    }

    batch.completed = true;
};


DWREngine._handleError = function(reason, ex) {
    if (DWREngine._errorHandler) DWREngine._errorHandler(reason, ex);
};


DWREngine._handleWarning = function(reason, ex) {
    if (DWREngine._warningHandler) DWREngine._warningHandler(reason, ex);
};


DWREngine._handleMetaDataError = function(handlers, reason, ex) {
    if (handlers && typeof handlers.errorHandler == "function") handlers.errorHandler(reason, ex);
    else DWREngine._handleError(reason, ex);
};


DWREngine._handleMetaDataWarning = function(handlers, reason, ex) {
    if (handlers && typeof handlers.warningHandler == "function") handlers.warningHandler(reason, ex);
    else DWREngine._handleWarning(reason, ex);
};








DWREngine._serializeAll = function(batch, referto, data, name) {
    if (data == null) {
        batch.map[name] = "null:null";
        return;
    }

    switch (typeof data) {
        case "boolean":
            batch.map[name] = "boolean:" + data;
            break;
        case "number":
            batch.map[name] = "number:" + data;
            break;
        case "string":
            batch.map[name] = "string:" + encodeURIComponent(data);
            break;
        case "object":
            if (data instanceof String) batch.map[name] = "String:" + encodeURIComponent(data);
            else if (data instanceof Boolean) batch.map[name] = "Boolean:" + data;
            else if (data instanceof Number) batch.map[name] = "Number:" + data;
            else if (data instanceof Date) batch.map[name] = "Date:" + data.getTime();
            else if (data instanceof Array) batch.map[name] = DWREngine._serializeArray(batch, referto, data, name);
            else batch.map[name] = DWREngine._serializeObject(batch, referto, data, name);
            break;
        case "function":

            break;
        default:
            DWREngine._handleWarning("Unexpected type: " + typeof data + ", attempting default converter.");
            batch.map[name] = "default:" + data;
            break;
    }
};


DWREngine._lookup = function(referto, data, name) {
    var lookup;

    for (var i = 0; i < referto.length; i++) {
        if (referto[i].data == data) {
            lookup = referto[i];
            break;
        }
    }
    if (lookup) return "reference:" + lookup.name;
    referto.push({ data: data, name: name });
    return null;
};


DWREngine._serializeObject = function(batch, referto, data, name) {
    var ref = DWREngine._lookup(referto, data, name);
    if (ref) return ref;



    if (data.nodeName && data.nodeType) {
        return DWREngine._serializeXml(batch, referto, data, name);
    }


    var reply = "Object:{";
    var element;
    for (element in data) {
        batch.paramCount++;
        var childName = "c" + DWREngine._batch.map.callCount + "-e" + batch.paramCount;
        DWREngine._serializeAll(batch, referto, data[element], childName);

        reply += encodeURIComponent(element) + ":reference:" + childName + ", ";
    }

    if (reply.substring(reply.length - 2) == ", ") {
        reply = reply.substring(0, reply.length - 2);
    }
    reply += "}";

    return reply;
};


DWREngine._serializeXml = function(batch, referto, data, name) {
    var ref = DWREngine._lookup(referto, data, name);
    if (ref) return ref;

    var output;
    if (window.XMLSerializer) output = new XMLSerializer().serializeToString(data);
    else output = data.toXml;

    return "XML:" + encodeURIComponent(output);
};


DWREngine._serializeArray = function(batch, referto, data, name) {
    var ref = DWREngine._lookup(referto, data, name);
    if (ref) return ref;

    var reply = "Array:[";
    for (var i = 0; i < data.length; i++) {
        if (i != 0) reply += ",";
        batch.paramCount++;
        var childName = "c" + DWREngine._batch.map.callCount + "-e" + batch.paramCount;
        DWREngine._serializeAll(batch, referto, data[i], childName);
        reply += "reference:";
        reply += childName;
    }
    reply += "]";

    return reply;
};


DWREngine._unserializeDocument = function(xml) {
    var dom;
    if (window.DOMParser) {
        var parser = new DOMParser();
        dom = parser.parseFromString(xml, "text/xml");
        if (!dom.documentElement || dom.documentElement.tagName == "parsererror") {
            var message = dom.documentElement.firstChild.data;
            message += "\n" + dom.documentElement.firstChild.nextSibling.firstChild.data;
            throw message;
        }
        return dom;
    }
    else if (window.ActiveXObject) {
        dom = DWREngine._newActiveXObject(DWREngine._DOMDocument);
        dom.loadXML(xml);
        return dom;
    }
    else {
        var div = document.createElement("div");
        div.innerHTML = xml;
        return div;
    }
};





DWREngine._newActiveXObject = function(axarray) {
    var returnValue;
    for (var i = 0; i < axarray.length; i++) {
        try {
            returnValue = new ActiveXObject(axarray[i]);
            break;
        }
        catch (ex) { }
    }
    return returnValue;
};


if (typeof window.encodeURIComponent === 'undefined') {
    DWREngine._utf8 = function(wide) {
        wide = "" + wide;
        var c;
        var s;
        var enc = "";
        var i = 0;
        while (i < wide.length) {
            c = wide.charCodeAt(i++);

            if (c >= 0xDC00 && c < 0xE000) continue;
            if (c >= 0xD800 && c < 0xDC00) {
                if (i >= wide.length) continue;
                s = wide.charCodeAt(i++);
                if (s < 0xDC00 || c >= 0xDE00) continue;
                c = ((c - 0xD800) << 10) + (s - 0xDC00) + 0x10000;
            }

            if (c < 0x80) {
                enc += String.fromCharCode(c);
            }
            else if (c < 0x800) {
                enc += String.fromCharCode(0xC0 + (c >> 6), 0x80 + (c & 0x3F));
            }
            else if (c < 0x10000) {
                enc += String.fromCharCode(0xE0 + (c >> 12), 0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
            }
            else {
                enc += String.fromCharCode(0xF0 + (c >> 18), 0x80 + (c >> 12 & 0x3F), 0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
            }
        }
        return enc;
    }

    DWREngine._hexchars = "0123456789ABCDEF";

    DWREngine._toHex = function(n) {
        return DWREngine._hexchars.charAt(n >> 4) + DWREngine._hexchars.charAt(n & 0xF);
    }

    DWREngine._okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";

    window.encodeURIComponent = function(s) {
        s = DWREngine._utf8(s);
        var c;
        var enc = "";
        for (var i = 0; i < s.length; i++) {
            if (DWREngine._okURIchars.indexOf(s.charAt(i)) == -1) {
                enc += "%" + DWREngine._toHex(s.charCodeAt(i));
            }
            else {
                enc += s.charAt(i);
            }
        }
        return enc;
    }
}


if (typeof Array.prototype.splice === 'undefined') {
    Array.prototype.splice = function(ind, cnt) {
        if (arguments.length == 0) return ind;
        if (typeof ind != "number") ind = 0;
        if (ind < 0) ind = Math.max(0, this.length + ind);
        if (ind > this.length) {
            if (arguments.length > 2) ind = this.length;
            else return [];
        }
        if (arguments.length < 2) cnt = this.length - ind;

        cnt = (typeof cnt == "number") ? Math.max(0, cnt) : 0;
        removeArray = this.slice(ind, ind + cnt);
        endArray = this.slice(ind + cnt);
        this.length = ind;

        for (var i = 2; i < arguments.length; i++) this[this.length] = arguments[i];
        for (i = 0; i < endArray.length; i++) this[this.length] = endArray[i];

        return removeArray;
    }
}


if (typeof Array.prototype.shift === 'undefined') {
    Array.prototype.shift = function(str) {
        var val = this[0];
        for (var i = 1; i < this.length; ++i) this[i - 1] = this[i];
        this.length--;
        return val;
    }
}


if (typeof Array.prototype.unshift === 'undefined') {
    Array.prototype.unshift = function() {
        var i = unshift.arguments.length;
        for (var j = this.length - 1; j >= 0; --j) this[j + i] = this[j];
        for (j = 0; j < i; ++j) this[j] = unshift.arguments[j];
    }
}


if (typeof Array.prototype.push === 'undefined') {
    Array.prototype.push = function() {
        var sub = this.length;
        for (var i = 0; i < push.arguments.length; ++i) {
            this[sub] = push.arguments[i];
            sub++;
        }
    }
}


if (typeof Array.prototype.pop === 'undefined') {
    Array.prototype.pop = function() {
        var lastElement = this[this.length - 1];
        this.length--;
        return lastElement;
    }
}
/*DWR ajax util*/


















function DWRUtil() { }





DWRUtil.onReturn = function(event, action) {
    if (!event) {
        event = window.event;
    }
    if (event && event.keyCode && event.keyCode == 13) {
        action();
    }
};





DWRUtil.selectRange = function(ele, start, end) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("selectRange() can't find an element with id: " + orig + ".");
        return;
    }
    if (ele.setSelectionRange) {
        ele.setSelectionRange(start, end);
    }
    else if (ele.createTextRange) {
        var range = ele.createTextRange();
        range.moveStart("character", start);
        range.moveEnd("character", end - ele.value.length);
        range.select();
    }
    ele.focus();
};




DWRUtil._getSelection = function(ele) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("selectRange() can't find an element with id: " + orig + ".");
        return;
    }
    return ele.value.substring(ele.selectionStart, ele.selectionEnd);





}





var $;
if (!$ && document.getElementById) {
    $ = function() {
        var elements = new Array();
        for (var i = 0; i < arguments.length; i++) {
            var element = arguments[i];
            if (typeof element == 'string') {
                element = document.getElementById(element);
            }
            if (arguments.length == 1) {
                return element;
            }
            elements.push(element);
        }
        return elements;
    }
}
else if (!$ && document.all) {
    $ = function() {
        var elements = new Array();
        for (var i = 0; i < arguments.length; i++) {
            var element = arguments[i];
            if (typeof element == 'string') {
                element = document.all[element];
            }
            if (arguments.length == 1) {
                return element;
            }
            elements.push(element);
        }
        return elements;
    }
}





DWRUtil.toDescriptiveString = function(data, level, depth) {
    var reply = "";
    var i = 0;
    var value;
    var obj;
    if (level == null) level = 0;
    if (depth == null) depth = 0;
    if (data == null) return "null";
    if (DWRUtil._isArray(data)) {
        if (data.length == 0) reply += "[]";
        else {
            if (level != 0) reply += "[\n";
            else reply = "[";
            for (i = 0; i < data.length; i++) {
                try {
                    obj = data[i];
                    if (obj == null || typeof obj == "function") {
                        continue;
                    }
                    else if (typeof obj == "object") {
                        if (level > 0) value = DWRUtil.toDescriptiveString(obj, level - 1, depth + 1);
                        else value = DWRUtil._detailedTypeOf(obj);
                    }
                    else {
                        value = "" + obj;
                        value = value.replace(/\/n/g, "\\n");
                        value = value.replace(/\/t/g, "\\t");
                    }
                }
                catch (ex) {
                    value = "" + ex;
                }
                if (level != 0) {
                    reply += DWRUtil._indent(level, depth + 2) + value + ", \n";
                }
                else {
                    if (value.length > 13) value = value.substring(0, 10) + "...";
                    reply += value + ", ";
                    if (i > 5) {
                        reply += "...";
                        break;
                    }
                }
            }
            if (level != 0) reply += DWRUtil._indent(level, depth) + "]";
            else reply += "]";
        }
        return reply;
    }
    if (typeof data == "string" || typeof data == "number" || DWRUtil._isDate(data)) {
        return data.toString();
    }
    if (typeof data == "object") {
        var typename = DWRUtil._detailedTypeOf(data);
        if (typename != "Object") reply = typename + " ";
        if (level != 0) reply += "{\n";
        else reply = "{";
        var isHtml = DWRUtil._isHTMLElement(data);
        for (var prop in data) {
            if (isHtml) {

                if (prop.toUpperCase() == prop || prop == "title" ||
prop == "lang" || prop == "dir" || prop == "className" ||
prop == "form" || prop == "name" || prop == "prefix" ||
prop == "namespaceURI" || prop == "nodeType" ||
prop == "firstChild" || prop == "lastChild" ||
prop.match(/^offset/)) {
                    continue;
                }
            }
            value = "";
            try {
                obj = data[prop];
                if (obj == null || typeof obj == "function") {
                    continue;
                }
                else if (typeof obj == "object") {
                    if (level > 0) {
                        value = "\n";
                        value += DWRUtil._indent(level, depth + 2);
                        value = DWRUtil.toDescriptiveString(obj, level - 1, depth + 1);
                    }
                    else {
                        value = DWRUtil._detailedTypeOf(obj);
                    }
                }
                else {
                    value = "" + obj;
                    value = value.replace(/\/n/g, "\\n");
                    value = value.replace(/\/t/g, "\\t");
                }
            }
            catch (ex) {
                value = "" + ex;
            }
            if (level == 0 && value.length > 13) value = value.substring(0, 10) + "...";
            var propStr = prop;
            if (propStr.length > 30) propStr = propStr.substring(0, 27) + "...";
            if (level != 0) reply += DWRUtil._indent(level, depth + 1);
            reply += prop + ":" + value + ", ";
            if (level != 0) reply += "\n";
            i++;
            if (level == 0 && i > 5) {
                reply += "...";
                break;
            }
        }
        reply += DWRUtil._indent(level, depth);
        reply += "}";
        return reply;
    }
    return data.toString();
};




DWRUtil._indent = function(level, depth) {
    var reply = "";
    if (level != 0) {
        for (var j = 0; j < depth; j++) {
            reply += "\u00A0\u00A0";
        }
        reply += " ";
    }
    return reply;
};





DWRUtil.useLoadingMessage = function(message) {
    var loadingMessage;
    if (message) loadingMessage = message;
    else loadingMessage = "Loading";
    DWREngine.setPreHook(function() {
        var disabledZone = $('disabledZone');
        if (!disabledZone) {
            disabledZone = document.createElement('div');
            disabledZone.setAttribute('id', 'disabledZone');
            disabledZone.style.position = "absolute";
            disabledZone.style.zIndex = "1000";
            disabledZone.style.left = "0px";
            disabledZone.style.top = "0px";
            disabledZone.style.width = "100%";
            disabledZone.style.height = "100%";
            document.body.appendChild(disabledZone);
            var messageZone = document.createElement('div');
            messageZone.setAttribute('id', 'messageZone');
            messageZone.style.position = "absolute";
            messageZone.style.top = "0px";
            messageZone.style.right = "0px";
            messageZone.style.background = "red";
            messageZone.style.color = "white";
            messageZone.style.fontFamily = "Arial,Helvetica,sans-serif";
            messageZone.style.padding = "4px";
            disabledZone.appendChild(messageZone);
            var text = document.createTextNode(loadingMessage);
            messageZone.appendChild(text);
        }
        else {
            $('messageZone').innerHTML = loadingMessage;
            disabledZone.style.visibility = 'visible';
        }
    });
    DWREngine.setPostHook(function() {
        $('disabledZone').style.visibility = 'hidden';
    });
}





DWRUtil.setValue = function(ele, val, options) {
    if (val == null) val = "";
    if (options != null) {
        if (options.escapeHtml) {
            val = val.replace(/&/, "&amp;");
            val = val.replace(/'/, "&apos;");
            val = val.replace(/</, "&lt;");
            val = val.replace(/>/, "&gt;");
        }
    }

    var orig = ele;
    var nodes, node, i;

    ele = $(ele);

    if (ele == null) {
        nodes = document.getElementsByName(orig);
        if (nodes.length >= 1) {
            ele = nodes.item(0);
        }
    }
    if (ele == null) {
        DWRUtil.debug("setValue() can't find an element with id/name: " + orig + ".");
        return;
    }

    if (DWRUtil._isHTMLElement(ele, "select")) {
        if (ele.type == "select-multiple" && DWRUtil._isArray(val)) {
            DWRUtil._selectListItems(ele, val);
        }
        else {
            DWRUtil._selectListItem(ele, val);
        }
        return;
    }

    if (DWRUtil._isHTMLElement(ele, "input")) {
        if (ele.type == "radio") {

            if (nodes == null) nodes = document.getElementsByName(orig);
            if (nodes != null && nodes.length > 1) {
                for (i = 0; i < nodes.length; i++) {
                    node = nodes.item(i);
                    if (node.type == "radio") {
                        node.checked = (node.value == val);
                    }
                }
            }
            else {
                ele.checked = (val == true);
            }
        }
        else if (ele.type == "checkbox") {
            ele.checked = val;
        }
        else {
            ele.value = val;
        }
        return;
    }

    if (DWRUtil._isHTMLElement(ele, "textarea")) {
        ele.value = val;
        return;
    }



    if (val.nodeType) {
        if (val.nodeType == 9) {
            val = val.documentElement;
        }

        val = DWRUtil._importNode(ele.ownerDocument, val, true);
        ele.appendChild(val);
        return;
    }


    ele.innerHTML = val;
};






DWRUtil._selectListItems = function(ele, val) {


    var found = false;
    var i;
    var j;
    for (i = 0; i < ele.options.length; i++) {
        ele.options[i].selected = false;
        for (j = 0; j < val.length; j++) {
            if (ele.options[i].value == val[j]) {
                ele.options[i].selected = true;
            }
        }
    }

    if (found) return;

    for (i = 0; i < ele.options.length; i++) {
        for (j = 0; j < val.length; j++) {
            if (ele.options[i].text == val[j]) {
                ele.options[i].selected = true;
            }
        }
    }
};






DWRUtil._selectListItem = function(ele, val) {


    var found = false;
    var i;
    for (i = 0; i < ele.options.length; i++) {
        if (ele.options[i].value == val) {
            ele.options[i].selected = true;
            found = true;
        }
        else {
            ele.options[i].selected = false;
        }
    }


    if (found) return;

    for (i = 0; i < ele.options.length; i++) {
        if (ele.options[i].text == val) {
            ele.options[i].selected = true;
        }
        else {
            ele.options[i].selected = false;
        }
    }
}





DWRUtil.getValue = function(ele, options) {
    if (options == null) {
        options = {};
    }
    var orig = ele;
    ele = $(ele);


    var nodes = document.getElementsByName(orig);
    if (ele == null && nodes.length >= 1) {
        ele = nodes.item(0);
    }
    if (ele == null) {
        DWRUtil.debug("getValue() can't find an element with id/name: " + orig + ".");
        return "";
    }

    if (DWRUtil._isHTMLElement(ele, "select")) {


        var sel = ele.selectedIndex;
        if (sel != -1) {
            var reply = ele.options[sel].value;
            if (reply == null || reply == "") {
                reply = ele.options[sel].text;
            }

            return reply;
        }
        else {
            return "";
        }
    }

    if (DWRUtil._isHTMLElement(ele, "input")) {
        if (ele.type == "radio") {
            var node;
            for (i = 0; i < nodes.length; i++) {
                node = nodes.item(i);
                if (node.type == "radio") {
                    if (node.checked) {
                        if (nodes.length > 1) return node.value;
                        else return true;
                    }
                }
            }
        }
        switch (ele.type) {
            case "checkbox":
            case "check-box":
            case "radio":
                return ele.checked;
            default:
                return ele.value;
        }
    }

    if (DWRUtil._isHTMLElement(ele, "textarea")) {
        return ele.value;
    }

    if (options.textContent) {
        if (ele.textContent) return ele.textContent;
        else if (ele.innerText) return ele.innerText;
    }
    return ele.innerHTML;
};





DWRUtil.getText = function(ele) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("getText() can't find an element with id: " + orig + ".");
        return "";
    }

    if (!DWRUtil._isHTMLElement(ele, "select")) {
        DWRUtil.debug("getText() can only be used with select elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele) + " from  id: " + orig + ".");
        return "";
    }



    var sel = ele.selectedIndex;
    if (sel != -1) {
        return ele.options[sel].text;
    }
    else {
        return "";
    }
};





DWRUtil.setValues = function(map) {
    for (var property in map) {

        if ($(property) != null || document.getElementsByName(property).length >= 1) {
            DWRUtil.setValue(property, map[property]);
        }
    }
};






DWRUtil.getValues = function(data) {
    var ele;
    if (typeof data == "string") ele = $(data);
    if (DWRUtil._isHTMLElement(data)) ele = data;
    if (ele != null) {
        if (ele.elements == null) {
            alert("getValues() requires an object or reference to a form element.");
            return null;
        }
        var reply = {};
        var value;
        for (var i = 0; i < ele.elements.length; i++) {
            if (ele[i].id != null) value = ele[i].id;
            else if (ele[i].value != null) value = ele[i].value;
            else value = "element" + i;
            reply[value] = DWRUtil.getValue(ele[i]);
        }
        return reply;
    }
    else {
        for (var property in data) {

            if ($(property) != null || document.getElementsByName(property).length >= 1) {
                data[property] = DWRUtil.getValue(property);
            }
        }
        return data;
    }
};





DWRUtil.addOptions = function(ele, data) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("addOptions() can't find an element with id: " + orig + ".");
        return;
    }
    var useOptions = DWRUtil._isHTMLElement(ele, "select");
    var useLi = DWRUtil._isHTMLElement(ele, ["ul", "ol"]);
    if (!useOptions && !useLi) {
        DWRUtil.debug("addOptions() can only be used with select/ul/ol elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }
    if (data == null) return;

    var text;
    var value;
    var opt;
    var li;
    if (DWRUtil._isArray(data)) {

        for (var i = 0; i < data.length; i++) {
            if (useOptions) {
                if (arguments[2] != null) {
                    if (arguments[3] != null) {
                        text = DWRUtil._getValueFrom(data[i], arguments[3]);
                        value = DWRUtil._getValueFrom(data[i], arguments[2]);
                    }
                    else {
                        value = DWRUtil._getValueFrom(data[i], arguments[2]);
                        text = value;
                    }
                }
                else {
                    text = DWRUtil._getValueFrom(data[i], arguments[3]);
                    value = text;
                }
                if (text || value) {
                    opt = new Option(text, value);
                    ele.options[ele.options.length] = opt;
                }
            }
            else {
                li = document.createElement("li");
                value = DWRUtil._getValueFrom(data[i], arguments[2]);
                if (value != null) {
                    li.innerHTML = value;
                    ele.appendChild(li);
                }
            }
        }
    }
    else if (arguments[3] != null) {
        for (var prop in data) {
            if (!useOptions) {
                alert("DWRUtil.addOptions can only create select lists from objects.");
                return;
            }
            value = DWRUtil._getValueFrom(data[prop], arguments[2]);
            text = DWRUtil._getValueFrom(data[prop], arguments[3]);
            if (text || value) {
                opt = new Option(text, value);
                ele.options[ele.options.length] = opt;
            }
        }
    }
    else {
        for (var prop in data) {
            if (!useOptions) {
                DWRUtil.debug("DWRUtil.addOptions can only create select lists from objects.");
                return;
            }
            if (typeof data[prop] == "function") {

                text = null;
                value = null;
            }
            else if (arguments[2]) {
                text = prop;
                value = data[prop];
            }
            else {
                text = data[prop];
                value = prop;
            }
            if (text || value) {
                opt = new Option(text, value);
                ele.options[ele.options.length] = opt;
            }
        }
    }
};




DWRUtil._getValueFrom = function(data, method) {
    if (method == null) return data;
    else if (typeof method == 'function') return method(data);
    else return data[method];
}





DWRUtil.removeAllOptions = function(ele) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("removeAllOptions() can't find an element with id: " + orig + ".");
        return;
    }
    var useOptions = DWRUtil._isHTMLElement(ele, "select");
    var useLi = DWRUtil._isHTMLElement(ele, ["ul", "ol"]);
    if (!useOptions && !useLi) {
        DWRUtil.debug("removeAllOptions() can only be used with select, ol and ul elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }
    if (useOptions) {
        ele.options.length = 0;
    }
    else {
        while (ele.childNodes.length > 0) {
            ele.removeChild(ele.firstChild);
        }
    }
};





DWRUtil.addRows = function(ele, data, cellFuncs, options) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("addRows() can't find an element with id: " + orig + ".");
        return;
    }
    if (!DWRUtil._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"])) {
        DWRUtil.debug("addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }
    if (!options) options = {};
    if (!options.rowCreator) options.rowCreator = DWRUtil._defaultRowCreator;
    if (!options.cellCreator) options.cellCreator = DWRUtil._defaultCellCreator;
    var tr, rowNum;
    if (DWRUtil._isArray(data)) {
        for (rowNum = 0; rowNum < data.length; rowNum++) {
            options.rowData = data[rowNum];
            options.rowIndex = rowNum;
            options.rowNum = rowNum;
            options.data = null;
            options.cellNum = -1;
            tr = DWRUtil._addRowInner(cellFuncs, options);
            if (tr != null) ele.appendChild(tr);
        }
    }
    else if (typeof data == "object") {
        rowNum = 0;
        for (var rowIndex in data) {
            options.rowData = data[rowIndex];
            options.rowIndex = rowIndex;
            options.rowNum = rowNum;
            options.data = null;
            options.cellNum = -1;
            tr = DWRUtil._addRowInner(cellFuncs, options);
            if (tr != null) ele.appendChild(tr);
            rowNum++;
        }
    }
};




DWRUtil._addRowInner = function(cellFuncs, options) {
    var tr = options.rowCreator(options);
    if (tr == null) return null;
    for (var cellNum = 0; cellNum < cellFuncs.length; cellNum++) {
        var func = cellFuncs[cellNum];
        var reply = func(options.rowData, options);
        options.data = reply;
        options.cellNum = cellNum;
        var td = options.cellCreator(options);
        if (td != null) {
            if (reply != null) {
                if (DWRUtil._isHTMLElement(reply)) td.appendChild(reply);
                else td.innerHTML = reply;
            }
            tr.appendChild(td);
        }
    }
    return tr;
};




DWRUtil._defaultRowCreator = function(options) {
    return document.createElement("tr");
};




DWRUtil._defaultCellCreator = function(options) {
    return document.createElement("td");
};





DWRUtil.removeAllRows = function(ele) {
    var orig = ele;
    ele = $(ele);
    if (ele == null) {
        DWRUtil.debug("removeAllRows() can't find an element with id: " + orig + ".");
        return;
    }
    if (!DWRUtil._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"])) {
        DWRUtil.debug("removeAllRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }
    while (ele.childNodes.length > 0) {
        ele.removeChild(ele.firstChild);
    }
};







DWRUtil._isHTMLElement = function(ele, nodeName) {
    if (ele == null || typeof ele != "object" || ele.nodeName == null) {
        return false;
    }

    if (nodeName != null) {
        var test = ele.nodeName.toLowerCase();

        if (typeof nodeName == "string") {
            return test == nodeName.toLowerCase();
        }

        if (DWRUtil._isArray(nodeName)) {
            var match = false;
            for (var i = 0; i < nodeName.length && !match; i++) {
                if (test == nodeName[i].toLowerCase()) {
                    match = true;
                }
            }
            return match;
        }

        DWRUtil.debug("DWRUtil._isHTMLElement was passed test node name that is neither a string or array of strings");
        return false;
    }

    return true;
};




DWRUtil._detailedTypeOf = function(x) {
    var reply = typeof x;
    if (reply == "object") {
        reply = Object.prototype.toString.apply(x);
        reply = reply.substring(8, reply.length - 1);
    }
    return reply;
};




DWRUtil._isArray = function(data) {
    return (data && data.join) ? true : false;
};




DWRUtil._isDate = function(data) {
    return (data && data.toUTCString) ? true : false;
};




DWRUtil._importNode = function(doc, importedNode, deep) {
    var newNode;

    if (importedNode.nodeType == 1) {
        newNode = doc.createElement(importedNode.nodeName);

        for (var i = 0; i < importedNode.attributes.length; i++) {
            var attr = importedNode.attributes[i];
            if (attr.nodeValue != null && attr.nodeValue != '') {
                newNode.setAttribute(attr.name, attr.nodeValue);
            }
        }

        if (typeof importedNode.style != "undefined") {
            newNode.style.cssText = importedNode.style.cssText;
        }
    }
    else if (importedNode.nodeType == 3) {
        newNode = doc.createTextNode(importedNode.nodeValue);
    }

    if (deep && importedNode.hasChildNodes()) {
        for (i = 0; i < importedNode.childNodes.length; i++) {
            newNode.appendChild(DWRUtil._importNode(doc, importedNode.childNodes[i], true));
        }
    }

    return newNode;
}
DWRUtil.debug = function(message) {
    alert(message);
}
/*DWR interface reference*/
function EStoreClientService() { }

EStoreClientService._path = DWR_HOST_PACKAGE + '/dwr'; //DWR_HOST_PATH = 'https://www.avantiplus.co.nz/avantiplus'

EStoreClientService.subscribe = function(p0, p1, callback) {
    DWREngine._execute(EStoreClientService._path, 'EStoreClientService', 'subscribe', p0, p1, callback);
}
EStoreClientService.getActiveAuctionState = function(p0, callback) {
    DWREngine._execute(EStoreClientService._path, 'EStoreClientService', 'getActiveAuctionState', p0, callback);
}
EStoreClientService.getAuctionProductStateDetail = function(p0, p1, callback) {
    DWREngine._execute(EStoreClientService._path, 'EStoreClientService', 'getAuctionProductStateDetail', p0, p1, callback);
}

function AjaxAuctionState() { }
AjaxAuctionState._path = DWR_HOST_PACKAGE +'/dwr';

AjaxAuctionState.getProducts = function(callback) {
    DWREngine._execute(AjaxAuctionState._path, 'AjaxAuctionState', 'getProducts', callback);
}

AjaxAuctionState.setProducts = function(p0, callback) {
    DWREngine._execute(AjaxAuctionState._path, 'AjaxAuctionState', 'setProducts', p0, callback);
}

AjaxAuctionState.getMessage = function(callback) {
    DWREngine._execute(AjaxAuctionState._path, 'AjaxAuctionState', 'getMessage', callback);
}

AjaxAuctionState.setMessage = function(p0, callback) {
    DWREngine._execute(AjaxAuctionState._path, 'AjaxAuctionState', 'setMessage', p0, callback);
}

function AjaxAuctionProductStateDetail() { }

AjaxAuctionProductStateDetail._path = DWR_HOST_PACKAGE + '/dwr';

AjaxAuctionProductStateDetail.getAmount = function(callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'getAmount', callback);
}

AjaxAuctionProductStateDetail.setAmount = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'setAmount', p0, callback);
}

AjaxAuctionProductStateDetail.getTime = function(callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'getTime', callback);
}

AjaxAuctionProductStateDetail.setTime = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'setTime', p0, callback);
}

AjaxAuctionProductStateDetail.getUsername = function(callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'getUsername', callback);
}

AjaxAuctionProductStateDetail.setUsername = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductStateDetail._path, 'AjaxAuctionProductStateDetail', 'setUsername', p0, callback);
}

function AjaxAuctionProductState() { }

AjaxAuctionProductState._path = DWR_HOST_PACKAGE + '/dwr';

AjaxAuctionProductState.getDetails = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getDetails', callback);
}

AjaxAuctionProductState.setDetails = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setDetails', p0, callback);
}

AjaxAuctionProductState.getAuctionId = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getAuctionId', callback);
}

AjaxAuctionProductState.setAuctionId = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setAuctionId', p0, callback);
}

AjaxAuctionProductState.getId = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getId', callback);
}

AjaxAuctionProductState.setId = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setId', p0, callback);
}

AjaxAuctionProductState.getUser = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getUser', callback);
}

AjaxAuctionProductState.setUser = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setUser', p0, callback);
}

AjaxAuctionProductState.getBid = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getBid', callback);
}

AjaxAuctionProductState.setBid = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setBid', p0, callback);
}

AjaxAuctionProductState.isStoppedBidding = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'isStoppedBidding', callback);
}

AjaxAuctionProductState.setStoppedBidding = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setStoppedBidding', p0, callback);
}

AjaxAuctionProductState.getMessage = function(callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'getMessage', callback);
}

AjaxAuctionProductState.setMessage = function(p0, callback) {
    DWREngine._execute(AjaxAuctionProductState._path, 'AjaxAuctionProductState', 'setMessage', p0, callback);
}
/***JQuery timer***/
/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/

jQuery.fn.extend({
    everyTime: function(interval, label, fn, times) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, times);
        });
    },
    oneTime: function(interval, label, fn) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, 1);
        });
    },
    stopTime: function(label, fn) {
        return this.each(function() {
            jQuery.timer.remove(this, label, fn);
        });
    }
});

jQuery.extend({
    timer: {
        global: [],
        guid: 1,
        dataKey: "jQuery.timer",
        regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
        powers: {
            // Yeah this is major overkill...
            'ms': 1,
            'cs': 10,
            'ds': 100,
            's': 1000,
            'das': 10000,
            'hs': 100000,
            'ks': 1000000
        },
        timeParse: function(value) {
            if (value == undefined || value == null)
                return null;
            var result = this.regex.exec(jQuery.trim(value.toString()));
            if (result[2]) {
                var num = parseFloat(result[1]);
                var mult = this.powers[result[2]] || 1;
                return num * mult;
            } else {
                return value;
            }
        },
        add: function(element, interval, label, fn, times) {
            var counter = 0;

            if (jQuery.isFunction(label)) {
                if (!times)
                    times = fn;
                fn = label;
                label = interval;
            }

            interval = jQuery.timer.timeParse(interval);

            if (typeof interval != 'number' || isNaN(interval) || interval < 0)
                return;

            if (typeof times != 'number' || isNaN(times) || times < 0)
                times = 0;

            times = times || 0;

            var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});

            if (!timers[label])
                timers[label] = {};

            fn.timerID = fn.timerID || this.guid++;

            var handler = function() {
                if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
                    jQuery.timer.remove(element, label, fn);
            };

            handler.timerID = fn.timerID;

            if (!timers[label][fn.timerID])
                timers[label][fn.timerID] = window.setInterval(handler, interval);

            this.global.push(element);

        },
        remove: function(element, label, fn) {
            var timers = jQuery.data(element, this.dataKey), ret;

            if (timers) {

                if (!label) {
                    for (label in timers)
                        this.remove(element, label, fn);
                } else if (timers[label]) {
                    if (fn) {
                        if (fn.timerID) {
                            window.clearInterval(timers[label][fn.timerID]);
                            delete timers[label][fn.timerID];
                        }
                    } else {
                        for (var fn in timers[label]) {
                            window.clearInterval(timers[label][fn]);
                            delete timers[label][fn];
                        }
                    }

                    for (ret in timers[label]) break;
                    if (!ret) {
                        ret = null;
                        delete timers[label];
                    }
                }

                for (ret in timers) break;
                if (!ret)
                    jQuery.removeData(element, this.dataKey);
            }
        }
    }
});

jQuery(window).bind("unload", function() {
    jQuery.each(jQuery.timer.global, function(index, item) {
        jQuery.timer.remove(item);
    });
});
/**productJscript*/
var YAHOO = window.YAHOO || {}; YAHOO.namespace = function(D) { if (!D || !D.length) { return null } var C = D.split("."); var B = YAHOO; for (var A = (C[0] == "YAHOO") ? 1 : 0; A < C.length; ++A) { B[C[A]] = B[C[A]] || {}; B = B[C[A]] } return B }; YAHOO.namespace("util"); YAHOO.namespace("widget"); YAHOO.namespace("example"); YAHOO.util.CustomEvent = function(B, A) { this.type = B; this.scope = A || window; this.subscribers = []; if (YAHOO.util.Event) { YAHOO.util.Event.regCE(this) } }; YAHOO.util.CustomEvent.prototype = { subscribe: function(C, B, A) { this.subscribers.push(new YAHOO.util.Subscriber(C, B, A)) }, unsubscribe: function(F, C) { var B = false; for (var D = 0, A = this.subscribers.length; D < A; ++D) { var E = this.subscribers[D]; if (E && E.contains(F, C)) { this._delete(D); B = true } } return B }, fire: function() { for (var B = 0, A = this.subscribers.length; B < A; ++B) { var C = this.subscribers[B]; if (C) { var D = (C.override) ? C.obj : this.scope; C.fn.call(D, this.type, arguments, C.obj) } } }, unsubscribeAll: function() { for (var B = 0, A = this.subscribers.length; B < A; ++B) { this._delete(B) } }, _delete: function(B) { var A = this.subscribers[B]; if (A) { delete A.fn; delete A.obj } delete this.subscribers[B] } }; YAHOO.util.Subscriber = function(A, C, B) { this.fn = A; this.obj = C || null; this.override = (B) }; YAHOO.util.Subscriber.prototype.contains = function(A, B) { return (this.fn == A && this.obj == B) }; if (!YAHOO.util.Event) { YAHOO.util.Event = function() { var J = false; var I = []; var H = []; var G = []; var E = []; var C = []; var F = []; var D = []; var B = 0; var A = []; var L = 0; var K = {}; return { POLL_RETRYS: 200, POLL_INTERVAL: 50, EL: 0, TYPE: 1, FN: 2, WFN: 3, SCOPE: 3, ADJ_SCOPE: 4, isSafari: (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent), isIE: (!this.isSafari && !navigator.userAgent.match(/opera/gi) && navigator.userAgent.match(/msie/gi)), addDelayedListener: function(Q, P, O, N, M) { H[H.length] = [Q, P, O, N, M]; if (J) { B = this.POLL_RETRYS; this.startTimeout(0) } }, startTimeout: function(O) { var N = this; var M = function() { N._tryPreloadAttach() }; this.timeout = setTimeout(M, O) }, onAvailable: function(M, P, O, N) { A.push({ id: M, fn: P, obj: O, override: N }); B = this.POLL_RETRYS; this.startTimeout(0) }, addListener: function(N, V, X, U, S) { if (!X || !X.call) { return false } if (this._isValidCollection(N)) { var Y = true; for (var T = 0, W = N.length; T < W; ++T) { Y = (this.on(N[T], V, X, U, S) && Y) } return Y } else { if (typeof N == "string") { var R = this.getEl(N); if (J && R) { N = R } else { this.addDelayedListener(N, V, X, U, S); return true } } } if (!N) { return false } if ("unload" == V && U !== this) { G[G.length] = [N, V, X, U, S]; return true } var Q = (S) ? U : N; var P = function(a) { return X.call(Q, YAHOO.util.Event.getEvent(a), U) }; var Z = [N, V, X, P, Q]; var O = I.length; I[O] = Z; this.mapListener(N, V, X, O); if (this.useLegacyEvent(N, V)) { var M = this.getLegacyIndex(N, V); if (M == -1) { M = C.length; D[N.id + V] = M; C[M] = [N, V, N["on" + V]]; F[M] = []; N["on" + V] = function(a) { return YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(a), M) } } F[M].push(O) } else { if (N.addEventListener) { N.addEventListener(V, P, false) } else { if (N.attachEvent) { N.attachEvent("on" + V, P) } } } return true }, fireLegacyEvent: function(T, O) { var U = true; var M = F[O]; for (var Q = 0, R = M.length; Q < R; ++Q) { var P = M[Q]; if (P) { var V = I[P]; if (V && V[this.WFN]) { var N = V[this.ADJ_SCOPE]; var S = V[this.WFN].call(N, T); U = (U && S) } else { delete M[Q] } } } return U }, getLegacyIndex: function(O, N) { var M = this.generateId(O) + N; if (typeof D[M] == "undefined") { return -1 } else { return D[M] } }, useLegacyEvent: function(N, M) { return ((!N.addEventListener && !N.attachEvent) || (M == "click" && this.isSafari)) }, removeListener: function(M, T, P, S) { if (!P || !P.call) { return false } if (typeof M == "string") { M = this.getEl(M) } else { if (this._isValidCollection(M)) { var Q = true; for (var N = 0, O = M.length; N < O; ++N) { Q = (this.removeListener(M[N], T, P) && Q) } return Q } } if ("unload" == T) { for (N = 0, O = G.length; N < O; N++) { var U = G[N]; if (U && U[0] == M && U[1] == T && U[2] == P) { delete G[N]; return true } } return false } var R = null; if ("undefined" == typeof S) { S = this._getCacheIndex(M, T, P) } if (S >= 0) { R = I[S] } if (!M || !R) { return false } if (M.removeEventListener) { M.removeEventListener(T, R[this.WFN], false) } else { if (M.detachEvent) { M.detachEvent("on" + T, R[this.WFN]) } } delete I[S][this.WFN]; delete I[S][this.FN]; delete I[S]; return true }, getTarget: function(N, O) { var M = N.target || N.srcElement; if (O && M && "#text" == M.nodeName) { return M.parentNode } else { return M } }, getPageX: function(N) { var M = N.pageX; if (!M && 0 !== M) { M = N.clientX || 0; if (this.isIE) { M += this._getScrollLeft() } } return M }, getPageY: function(M) { var N = M.pageY; if (!N && 0 !== N) { N = M.clientY || 0; if (this.isIE) { N += this._getScrollTop() } } return N }, getXY: function(M) { return [this.getPageX(M), this.getPageY(M)] }, getRelatedTarget: function(N) { var M = N.relatedTarget; if (!M) { if (N.type == "mouseout") { M = N.toElement } else { if (N.type == "mouseover") { M = N.fromElement } } } return M }, getTime: function(N) { if (!N.time) { var M = new Date().getTime(); try { N.time = M } catch (O) { return M } } return N.time }, stopEvent: function(M) { this.stopPropagation(M); this.preventDefault(M) }, stopPropagation: function(M) { if (M.stopPropagation) { M.stopPropagation() } else { M.cancelBubble = true } }, preventDefault: function(M) { if (M.preventDefault) { M.preventDefault() } else { M.returnValue = false } }, getEvent: function(N) { var M = N || window.event; if (!M) { var O = this.getEvent.caller; while (O) { M = O.arguments[0]; if (M && Event == M.constructor) { break } O = O.caller } } return M }, getCharCode: function(M) { return M.charCode || ((M.type == "keypress") ? M.keyCode : 0) }, _getCacheIndex: function(S, Q, R) { var P = S.id + Q; if (!K[P]) { return -1 } else { for (var O = 0, M = K[P].length; O < M; ++O) { var N = K[P][O]; if (N.fn == R) { return N.index } } } return -1 }, generateId: function(M) { var N = M.id; if (!N) { N = "yui-event-auto-id-" + (L++); M.id = N } return N }, mapListener: function(O, N, M, Q) { var P = this.generateId(O) + N; if (!K[P]) { K[P] = [] } K[P].push({ fn: M, index: Q }) }, _isValidCollection: function(M) { return (M && M.length && typeof M != "string" && !M.tagName && !M.alert && typeof M[0] != "undefined") }, getEl: function(M) { return document.getElementById(M) }, clearCache: function() { }, regCE: function(M) { E.push(M) }, _load: function(M) { J = true }, _tryPreloadAttach: function() { if (this.locked) { return false } this.locked = true; var S = !J; if (!S) { S = (B > 0) } var R = []; for (var P = 0, M = H.length; P < M; ++P) { var T = H[P]; if (T) { var Q = this.getEl(T[this.EL]); if (Q) { this.on(Q, T[this.TYPE], T[this.FN], T[this.SCOPE], T[this.ADJ_SCOPE]); delete H[P] } else { R.push(T) } } } H = R; notAvail = []; for (P = 0, M = A.length; P < M; ++P) { var O = A[P]; if (O) { Q = this.getEl(O.id); if (Q) { var N = (O.override) ? O.obj : Q; O.fn.call(N, O.obj); delete A[P] } else { notAvail.push(O) } } } B = (R.length === 0 && notAvail.length === 0) ? 0 : B - 1; if (S) { this.startTimeout(this.POLL_INTERVAL) } this.locked = false }, _unload: function(S, R, P) { for (var Q = 0, N = G.length; Q < N; ++Q) { var O = G[Q]; if (O) { var M = (O[this.ADJ_SCOPE]) ? O[this.SCOPE] : window; O[this.FN].call(M, this.getEvent(S), O[this.SCOPE]) } } N = I.length; if (N) { for (Q = 0; Q < N; ++Q) { O = I[Q]; if (O) { this.removeListener(O[this.EL], O[this.TYPE], O[this.FN], Q) } } this.clearCache() } for (Q = 0, N = E.length; Q < N; ++Q) { E[Q].unsubscribeAll(); delete E[Q] } for (Q = 0, N = C.length; Q < N; ++Q) { delete C[Q] } }, _getScrollLeft: function() { return this._getScroll()[1] }, _getScrollTop: function() { return this._getScroll()[0] }, _getScroll: function() { var M = document.documentElement; db = document.body; if (M && M.scrollTop) { return [M.scrollTop, M.scrollLeft] } else { if (db) { return [db.scrollTop, db.scrollLeft] } else { return [0, 0] } } } } } (); YAHOO.util.Event.on = YAHOO.util.Event.addListener; if (document && document.body) { YAHOO.util.Event._load() } else { YAHOO.util.Event.on(window, "load", YAHOO.util.Event._load, YAHOO.util.Event, true) } YAHOO.util.Event.on(window, "unload", YAHOO.util.Event._unload, YAHOO.util.Event, true); YAHOO.util.Event._tryPreloadAttach() } YAHOO.util.Dom = function() { var B = navigator.userAgent.toLowerCase(); var A = 0; return { get: function(E) { if (typeof E != "string" && !(E instanceof Array)) { return E } if (typeof E == "string") { return document.getElementById(E) } else { var F = []; for (var D = 0, C = E.length; D < C; ++D) { F[F.length] = this.get(E[D]) } return F } return null }, getStyle: function(C, E) { var D = function(J, G) { var K = null; var I = document.defaultView; if (E == "opacity" && J.filters) { K = 1; try { K = J.filters.item("DXImageTransform.Microsoft.Alpha").opacity / 100 } catch (M) { try { K = J.filters.item("alpha").opacity / 100 } catch (M) { } } } else { if (J.style[E]) { K = J.style[E] } else { if (J.currentStyle && J.currentStyle[E]) { K = J.currentStyle[E] } else { if (I && I.getComputedStyle) { var L = ""; for (var H = 0, F = E.length; H < F; ++H) { if (E.charAt(H) == E.charAt(H).toUpperCase()) { L = L + "-" + E.charAt(H).toLowerCase() } else { L = L + E.charAt(H) } } if (I.getComputedStyle(J, "") && I.getComputedStyle(J, "").getPropertyValue(L)) { K = I.getComputedStyle(J, "").getPropertyValue(L) } } } } } return K }; return this.batch(C, D, this) }, setStyle: function(C, E, F) { var D = function(H, G) { switch (E) { case "opacity": if (H.filters) { H.style.filter = "alpha(opacity=" + F * 100 + ")"; if (!H.currentStyle.hasLayout) { H.style.zoom = 1 } } else { H.style.opacity = F; H.style["-moz-opacity"] = F; H.style["-khtml-opacity"] = F } break; default: H.style[E] = F } }; this.batch(C, D, this) }, getXY: function(C) { var D = function(G, E) { if (G.parentNode === null || E.getStyle(G, "display") == "none") { return false } var F = null; var K = []; var H; if (G.getBoundingClientRect) { H = G.getBoundingClientRect(); Math.max(document.documentElement.scrollTop, document.body.scrollTop); var I = Math.max(document.documentElement.scrollTop, document.body.scrollTop); var J = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); return [H.left + J, H.top + I] } else { if (document.getBoxObjectFor) { H = document.getBoxObjectFor(G); K = [H.x, H.y] } else { K = [G.offsetLeft, G.offsetTop]; F = G.offsetParent; if (F != G) { while (F) { K[0] += F.offsetLeft; K[1] += F.offsetTop; F = F.offsetParent } } if (B.indexOf("opera") != -1 || (B.indexOf("safari") != -1 && E.getStyle(G, "position") == "absolute")) { K[0] -= document.body.offsetLeft; K[1] -= document.body.offsetTop } } } if (G.parentNode) { F = G.parentNode } else { F = null } while (F && F.tagName != "BODY" && F.tagName != "HTML") { K[0] -= F.scrollLeft; K[1] -= F.scrollTop; if (F.parentNode) { F = F.parentNode } else { F = null } } return K }; return this.batch(C, D, this) }, getX: function(C) { return this.getXY(C)[0] }, getY: function(C) { return this.getXY(C)[1] }, setXY: function(C, F, E) { var D = function(K, I) { var J = I.getStyle(K, "position"); if (J == "static") { I.setStyle(K, "position", "relative"); J = "relative" } var M = YAHOO.util.Dom.getXY(K); if (M === false) { return false } var L = [parseInt(YAHOO.util.Dom.getStyle(K, "left"), 10), parseInt(YAHOO.util.Dom.getStyle(K, "top"), 10)]; if (isNaN(L[0])) { L[0] = (J == "relative") ? 0 : K.offsetLeft } if (isNaN(L[1])) { L[1] = (J == "relative") ? 0 : K.offsetTop } if (F[0] !== null) { K.style.left = F[0] - M[0] + L[0] + "px" } if (F[1] !== null) { K.style.top = F[1] - M[1] + L[1] + "px" } var G = I.getXY(K); if (!E && (G[0] != F[0] || G[1] != F[1])) { var H = function() { YAHOO.util.Dom.setXY(K, F, true) }; setTimeout(H, 0) } }; this.batch(C, D, this) }, setX: function(D, C) { this.setXY(D, [C, null]) }, setY: function(C, D) { this.setXY(C, [null, D]) }, getRegion: function(C) { var D = function(F, E) { return new YAHOO.util.Region.getRegion(F) }; return this.batch(C, D, this) }, getClientWidth: function() { return (document.documentElement.offsetWidth || document.body.offsetWidth) }, getClientHeight: function() { return (self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) }, getElementsByClassName: function(F, C, D) { var E = new RegExp("(?:^|\\s+)" + F + "(?:\\s+|$)"); var G = function(H) { return E.test(H.className) }; return this.getElementsBy(G, C, D) }, hasClass: function(D, C) { var E = function(H, F) { var G = new RegExp("(?:^|\\s+)" + C + "(?:\\s+|$)"); return G.test(H.className) }; return this.batch(D, E, this) }, addClass: function(D, C) { var E = function(G, F) { if (F.hasClass(G, C)) { return } G.className = [G.className, C].join(" ") }; this.batch(D, E, this) }, removeClass: function(D, C) { var E = function(H, F) { if (!F.hasClass(H, C)) { return } var G = new RegExp("(?:^|\\s+)" + C + "(?:\\s+|$)", "g"); var I = H.className; H.className = I.replace(G, " ") }; this.batch(D, E, this) }, replaceClass: function(E, D, C) { var F = function(H, G) { G.removeClass(H, D); G.addClass(H, C) }; this.batch(E, F, this) }, generateId: function(C, E) { E = E || "yui-gen"; var D = function(G, F) { G = G || {}; if (!G.id) { G.id = E + A++ } return G.id }; return this.batch(C, D, this) }, isAncestor: function(D, E) { D = this.get(D); if (!D || !E) { return false } var C = function(H, F) { if (D.contains && B.indexOf("safari") < 0) { return D.contains(H) } else { if (D.compareDocumentPosition) { return !!(D.compareDocumentPosition(H) & 16) } else { var G = H.parentNode; while (G) { if (G == D) { return true } else { if (G.tagName == "HTML") { return false } } G = G.parentNode } return false } } }; return this.batch(E, C, this) }, inDocument: function(C) { var D = function(F, E) { return E.isAncestor(document.documentElement, F) }; return this.batch(C, D, this) }, getElementsBy: function(I, D, E) { D = D || "*"; E = this.get(E) || document; var F = []; var H = E.getElementsByTagName(D); for (var G = 0, C = H.length; G < C; ++G) { if (I(H[G])) { F[F.length] = H[G] } } return F }, batch: function(E, H, G) { E = this.get(E); if (!E || !E.length) { return H(E, G) } var F = []; for (var D = 0, C = E.length; D < C; ++D) { F[F.length] = H(E[D], G) } return F } } } (); YAHOO.util.Region = function(C, D, A, B) { this.top = C; this.right = D; this.bottom = A; this.left = B }; YAHOO.util.Region.prototype.contains = function(A) { return (A.left >= this.left && A.right <= this.right && A.top >= this.top && A.bottom <= this.bottom) }; YAHOO.util.Region.prototype.getArea = function() { return ((this.bottom - this.top) * (this.right - this.left)) }; YAHOO.util.Region.prototype.intersect = function(E) { var C = Math.max(this.top, E.top); var D = Math.min(this.right, E.right); var A = Math.min(this.bottom, E.bottom); var B = Math.max(this.left, E.left); if (A >= C && D >= B) { return new YAHOO.util.Region(C, D, A, B) } else { return null } }; YAHOO.util.Region.prototype.union = function(E) { var C = Math.min(this.top, E.top); var D = Math.max(this.right, E.right); var A = Math.max(this.bottom, E.bottom); var B = Math.min(this.left, E.left); return new YAHOO.util.Region(C, D, A, B) }; YAHOO.util.Region.prototype.toString = function() { return ("Region {  t: " + this.top + ", r: " + this.right + ", b: " + this.bottom + ", l: " + this.left + "}") }; YAHOO.util.Region.getRegion = function(D) { var F = YAHOO.util.Dom.getXY(D); var C = F[1]; var E = F[0] + D.offsetWidth; var A = F[1] + D.offsetHeight; var B = F[0]; return new YAHOO.util.Region(C, E, A, B) }; YAHOO.util.Point = function(A, B) { this.x = A; this.y = B; this.top = B; this.right = A; this.bottom = B; this.left = A }; YAHOO.util.Point.prototype = new YAHOO.util.Region(); YAHOO.namespace("YAHOO.Hack").FixIESelectWidth = new function() { var G = this; var I = YAHOO.util.Event; var J = YAHOO.util.Dom; var M = {}; var A = {}; var D = 0; var K; var E = !!(document.uniqueID && typeof (XMLHttpRequest) != "undefined"); function L(P) { P = P || this; if (P.tagName.toLowerCase() != "select") { throw Error("element [" + P.id + "] is not <select>"); return } if (!J.hasClass(P.parentNode, "select-box")) { throw Error("className select-box is not included for element [" + P.id + "]"); return } var O = P.runtimeStyle; var N = P.parentNode.runtimeStyle; N.fonSize = 0; var Q = P.parentNode.currentStyle.display.toLowerCase(); if (Q == "" || Q == "inline" || Q == "inline-block") { N.display = "inline-block"; N.width = P.offsetWidth + "px"; N.height = P.offsetHeight + "px"; N.position = "relative"; O.position = "absolute"; O.top = 0; O.left = 0 } P._timerId = (D += 1); P.selectedIndex = Math.max(0, P.selectedIndex); M["_" + P._timerId] = setTimeout("void(0)", 0); A["A" + P._timerId] = setTimeout("void(0)", 0); I.on(P, "mouseover", F); I.on(document, "mousedown", H, P, true); I.on(P, "change", B, P, true) } function B(N) { status++; this.runtimeStyle.width = "" } function F(R) { var P = this; if (K && K != P) { H.call(K, R) } var S = "_" + P._timerId; var N = "A" + P._timerId; clearTimeout(M[S]); var Q = function() { clearTimeout(A[N]); if (Math.abs(O - T) > 3) { T += (O - T) / 3; P.runtimeStyle.width = T + "px"; A[N] = setTimeout(Q, 0) } else { P.runtimeStyle.width = "auto"; P.selectedIndex = Math.max(0, P.selectedIndex) } }; var T = P.offsetWidth; P.runtimeStyle.width = "auto"; var O = P.offsetWidth; clearTimeout(A[N]); Q(); P.focus(); K = P } function H(P, O) { O = (P.srcElement || P.target); if (O == this && P.type != "mouseover") { status++; I.stopEvent(P); return false } O = this; clearTimeout(A["A" + O._timerId]); var Q = "_" + O._timerId; var N = function() { O.runtimeStyle.width = "" }; if (P.type == "mouseover") { N() } else { M[Q] = setTimeout(N, 100) } } function C(N) { N = [N, ""].join(""); if (document.uniqueID && window.createPopup) { I.onAvailable(N, L); return true } else { return false } } return C }; function ProductSize(B, A) { this.code = B; this.description = A } function addProductSize(A) { this.productSizes[this.productSizes.length] = A } function ProductColour(B, A) { this.code = B; this.description = A; this.productSizes = new Array(); this.addSize = addProductSize } function changeCombo(B) { var A = B.selectedIndex; addSizeCombo(A) } function addSizeCombo(B) { var E = document.BasketForm.sizeCode; clearSize(E); var D = productColours[B]; for (var C = 0; C < D.productSizes.length; C++) { var A = D.productSizes[C]; E.options[C] = new Option(A.description, A.code) } } function clearSize(A) { A.options.length = 0 } function getFormQuantity(B) { var A = B.Quantity; return A.options[A.selectedIndex].value } var curTab = 1; function showTab(A) { document.getElementById("Tab" + A).style.display = "block"; document.getElementById("TabHeader" + A).className = "activeTab"; if (curTab != A) { document.getElementById("Tab" + curTab).style.display = "none"; document.getElementById("TabHeader" + curTab).className = "" } curTab = A } var gallery_restarea = 50; var gallery_restareaVerticle = 100; var gallery_maxspeed = 3; var gallery_maxwidth = 320; var gallery_startpos = 0; var gallery_endofgallerymsg = ""; var gallery_iedom = document.all || document.getElementById, gallery_scrollspeed = 0, gallery_movestate = "", gallery_actualwidth = "", gallery_cross_scroll, gallery_verticle_scroll, gallery_ns_scroll, gallery_statusdiv, gallery_loadedyes = 0, gallery_lefttime, gallery_righttime, gallery_crossmain; function gallery_ietruebody() { return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body } function gallery_showhidediv(A) { } function gallery_getposOffset(D, B) { var A = (B == "left") ? D.offsetLeft : D.offsetTop; var C = D.offsetParent; while (C != null) { A = (B == "left") ? A + C.offsetLeft : A + C.offsetTop; C = C.offsetParent } return A } function gallery_moveleft() { if (gallery_loadedyes) { gallery_movestate = "left"; if (gallery_iedom && parseInt(gallery_cross_scroll.style.left) > (gallery_menuwidth - gallery_actualwidth)) { gallery_cross_scroll.style.left = parseInt(gallery_cross_scroll.style.left) - gallery_scrollspeed + "px"; gallery_showhidediv("hidden") } else { gallery_showhidediv("visible") } } gallery_lefttime = setTimeout("gallery_moveleft()", 10) } function gallery_moveright() { if (gallery_loadedyes) { gallery_movestate = "right"; if (gallery_iedom && parseInt(gallery_cross_scroll.style.left) < 0) { gallery_cross_scroll.style.left = parseInt(gallery_cross_scroll.style.left) + gallery_scrollspeed + "px"; gallery_showhidediv("hidden") } else { gallery_showhidediv("visible") } } gallery_righttime = setTimeout("gallery_moveright()", 10) } function gallery_motionengine(F) { var D = gallery_getposOffset(gallery_crossmain, "left"), E = (window.pageXOffset) ? pageXOffset : gallery_ietruebody().scrollLeft, C = (window.pageYOffset) ? pageYOffset : gallery_ietruebody().scrollTop, B = window.event ? event.clientX : F.clientX ? F.clientX : ""; B -= D - E; var A = (gallery_menuwidth - gallery_restarea) / 2; var G = (gallery_menuwidth + gallery_restarea) / 2; if (B > G) { gallery_scrollspeed = (B - G) / ((gallery_menuwidth - gallery_restarea) / 2) * gallery_maxspeed; clearTimeout(gallery_righttime); if (gallery_movestate != "left") { gallery_moveleft() } } else { if (B < A) { gallery_scrollspeed = (A - B) / ((gallery_menuwidth - gallery_restarea) / 2) * gallery_maxspeed; clearTimeout(gallery_lefttime); if (gallery_movestate != "right") { gallery_moveright() } } else { gallery_scrollspeed = 0 } } } function gallery_contains_ns6(B, A) { if (A !== null) { while (A.parentNode) { if ((A = A.parentNode) == B) { return true } } } return false } function gallery_stopmotion(A) { if (!window.opera || (window.opera && A.relatedTarget !== null)) { if ((window.event && !gallery_crossmain.contains(event.toElement)) || (A && A.currentTarget && A.currentTarget != A.relatedTarget && !gallery_contains_ns6(A.currentTarget, A.relatedTarget))) { clearTimeout(gallery_lefttime); clearTimeout(gallery_righttime); gallery_movestate = "" } } } function gallery_stopmotionVerticle(A) { if ((window.event && !gallery_verticlemain.contains(event.toElement)) || (A && A.currentTarget && A.currentTarget != A.relatedTarget && !gallery_contains_ns6(A.currentTarget, A.relatedTarget))) { if (window.downtime) { clearTimeout(gallery_downtime) } if (window.uptime) { clearTimeout(gallery_uptime) } gallery_movestate = "" } } function gallery_fillup() { if (gallery_iedom) { gallery_crossmain = document.getElementById ? document.getElementById("prodcontainer") : document.all.motioncontainer; if (typeof gallery_crossmain.style.maxWidth !== "undefined") { gallery_crossmain.style.maxWidth = gallery_maxwidth + "px" } gallery_menuwidth = gallery_crossmain.offsetWidth; gallery_cross_scroll = document.getElementById ? document.getElementById("prodgallery") : document.all.motiongallery; gallery_actualwidth = document.getElementById ? document.getElementById("trueContainer").offsetWidth : document.all.trueContainer.offsetWidth; if (gallery_startpos) { gallery_cross_scroll.style.left = (gallery_menuwidth - gallery_actualwidth) / gallery_startpos + "px" } gallery_crossmain.onmousemove = function(A) { gallery_motionengine(A) }; gallery_crossmain.onmouseout = function(A) { gallery_stopmotion(A) } } gallery_loadedyes = 1 } gallery_onresize = function() { if (typeof gallery_motioncontainer !== "undefined" && gallery_motioncontainer.filters) { gallery_motioncontainer.style.width = "0"; gallery_motioncontainer.style.width = ""; gallery_motioncontainer.style.width = Math.min(gallery_motioncontainer.offsetWidth, gallery_maxwidth) + "px" } gallery_menuwidth = gallery_crossmain.offsetWidth; gallery_cross_scroll.style.left = gallery_startpos ? (gallery_menuwidth - gallery_actualwidth) / gallery_startpos + "px" : 0 }; function loadMotionProductGallery() { setTimeout("gallery_fillup()", 5000) } var restarea = 200; var restareaVerticle = 100; var maxspeed = 7; var maxwidth = 1000; var startpos = 0; var endofgallerymsg = ""; var iedom = document.all || document.getElementById, scrollspeed = 0, movestate = "", actualwidth = "", cross_scroll, verticle_scroll, ns_scroll, statusdiv, loadedyes = 0, lefttime, righttime; function ietruebody() { return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body } function showhidediv(A) { } function getposOffset(D, C) { var B = (C == "left") ? D.offsetLeft : D.offsetTop; var A = D.offsetParent; while (A != null) { B = (C == "left") ? B + A.offsetLeft : B + A.offsetTop; A = A.offsetParent } return B } function moveleft() { if (loadedyes) { movestate = "left"; if (iedom && parseInt(cross_scroll.style.left) > (menuwidth - actualwidth)) { cross_scroll.style.left = parseInt(cross_scroll.style.left) - scrollspeed + "px"; showhidediv("hidden") } else { showhidediv("visible") } } lefttime = setTimeout("moveleft()", 10) } function moveright() { if (loadedyes) { movestate = "right"; if (iedom && parseInt(cross_scroll.style.left) < 0) { cross_scroll.style.left = parseInt(cross_scroll.style.left) + scrollspeed + "px"; showhidediv("hidden") } else { showhidediv("visible") } } righttime = setTimeout("moveright()", 10) } function moveup() { if (loadedyes) { movestate = "up"; if (iedom && parseInt(verticle_scroll.style.top) > (menu_height - actualheight)) { verticle_scroll.style.top = parseInt(verticle_scroll.style.top) - scrollspeed + "px" } else { showhidediv("visible") } } uptime = setTimeout("moveup()", 20) } function movedown() { if (loadedyes) { movestate = "down"; if (iedom && parseInt(verticle_scroll.style.top) < 0) { verticle_scroll.style.top = parseInt(verticle_scroll.style.top) + scrollspeed + "px" } else { showhidediv("visible") } } downtime = setTimeout("movedown()", 20) } function motionengine(F) { var E = getposOffset(crossmain, "left"), G = (window.pageXOffset) ? pageXOffset : ietruebody().scrollLeft, D = (window.pageYOffset) ? pageYOffset : ietruebody().scrollTop, B = window.event ? event.clientX : F.clientX ? F.clientX : ""; B -= E - G; var A = (menuwidth - restarea) / 2; var C = (menuwidth + restarea) / 2; if (B > C) { scrollspeed = (B - C) / ((menuwidth - restarea) / 2) * maxspeed; clearTimeout(righttime); if (movestate != "left") { moveleft() } } else { if (B < A) { scrollspeed = (A - B) / ((menuwidth - restarea) / 2) * maxspeed; clearTimeout(lefttime); if (movestate != "right") { moveright() } } else { scrollspeed = 0 } } } function motionengineVerticle(F) { var E = getposOffset(verticlemain, "top"); var G = (window.pageXOffset) ? pageXOffset : ietruebody().scrollLeft; var D = (window.pageYOffset) ? pageYOffset : ietruebody().scrollTop; var B = window.event ? event.clientY : F.clientY ? F.clientY : ""; B -= E - D; var A = (menu_height - restareaVerticle) / 2; var C = (menu_height + restareaVerticle) / 2; if (B > C) { scrollspeed = (B - C) / ((menu_height - restareaVerticle) / 2) * maxspeed; if (window.downtime) { clearTimeout(downtime) } if (movestate != "up") { moveup() } } else { if (B < A) { scrollspeed = (A - B) / ((menu_height - restareaVerticle) / 2) * maxspeed; if (window.uptime) { clearTimeout(uptime) } if (movestate != "down") { movedown() } } else { scrollspeed = 0 } } } function contains_ns6(B, A) { if (A !== null) { while (A.parentNode) { if ((A = A.parentNode) == B) { return true } } } return false } function stopmotion(A) { if (!window.opera || (window.opera && A.relatedTarget !== null)) { if ((window.event && !crossmain.contains(event.toElement)) || (A && A.currentTarget && A.currentTarget != A.relatedTarget && !contains_ns6(A.currentTarget, A.relatedTarget))) { clearTimeout(lefttime); clearTimeout(righttime); movestate = "" } } } function stopmotionVerticle(A) { if ((window.event && !verticlemain.contains(event.toElement)) || (A && A.currentTarget && A.currentTarget != A.relatedTarget && !contains_ns6(A.currentTarget, A.relatedTarget))) { if (window.downtime) { clearTimeout(downtime) } if (window.uptime) { clearTimeout(uptime) } movestate = "" } } function fillup() { if (iedom) { verticlemain = document.getElementById ? document.getElementById("motioncontainerVerticle") : document.all.motioncontainerVerticle; if (verticlemain != null) { menu_height = parseInt(verticlemain.style.height); verticle_scroll = document.getElementById ? document.getElementById("motiongalleryVerticle") : document.all.motiongalleryVerticle; actualheight = verticle_scroll.offsetHeight; verticlemain.onmousemove = function(A) { motionengineVerticle(A) }; verticlemain.onmouseout = function(A) { stopmotionVerticle(A) } } } if (window.opera) { verticle_scroll.style.top = menu_height - actualheight + "px"; setTimeout("verticle_scroll.style.top=0", 10) } loadedyes = 1 } window.onload = fillup;
/* COOKIES */

var Cookies = {
    init: function() {
        var allCookies = document.cookie.split('; ');
        for (var i = 0; i < allCookies.length; i++) {
            var cookiePair = allCookies[i].split('=');
            this[cookiePair[0]] = cookiePair[1];
        }
    },
    create: function(name, value, days) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            var expires = "; expires=" + date.toGMTString();
        }
        else var expires = "";
        document.cookie = name + "=" + value + expires + "; path=/";
        this[name] = value;
    },
    erase: function(name) {
        this.create(name, '', -1);
        this[name] = undefined;
    }
};
Cookies.init();

function resizeImage(which, max) {
    var elem = which;  //document.getElementById(which);
    if (elem == undefined || elem == null) return false;
    if (max == undefined) max = 100;
    if (elem.width > elem.height) {
        if (elem.width > max) elem.width = max;
    } else {
        if (elem.height > max) elem.height = max;
    }
}

/**for the dropdown shopping cart*/
$(document).ready(function() {

    $("#cartpreviewbtn").click(function() {
        $(".cart").toggle();
    });

    $(".close").click(function() {
        $(".cart").toggle();
    });
});


//Show Pane
function showContent(address, type) {

    if (type == "zoom") {
        if (address.href) {
            var location = "zoomifyImagePath=" + address.href + "&zoomifyNavWindow=0";
        } else {
            var location = "zoomifyImagePath=" + address + "&zoomifyNavWindow=0"; //Accept call from showContent('//address')
        }
        //If Zoomify Image
        var text = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='900' height='550' id='theMovie'>" + param + "<param name='FlashVars' value='" + location + "'><param name='MENU' value='FALSE'><param name='SRC' value='/docs/zoom/zoomifyViewer.swf'<embed " + embed + " style='z-index:99999; position:absolute;' flashvars='" + location + "' src='/docs/zoom/zoomifyViewer.swf' menu='false' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' width='900' height='550' name='theMovie'></embed></object>";

        if (document.getElementById) {
            document.getElementById("flashcontent").innerHTML = text;
        }
        return false;
    }

    if (type == "flat") {
        //If Flat Image
        var text = "<iframe frameborder='0' src='" + address + "' marginheight='0' marginwidth='0' width='900' height='550'></iframe>";
        if (document.getElementById) {
            document.getElementById("flashcontent").innerHTML = text;
        }
        return false;
    }

    if (type == "info") {
        //If Info Window
        var text = "<iframe frameborder='0' src='" + address + "' marginheight='0' marginwidth='0' width='900' height='619'></iframe>";
        if (document.getElementById) {
            document.getElementById("infocontent").innerHTML = text;
        }
        return false;
    }
    else {
        alert("No window type found");
    }

}

var width = 0;
var height = 0;

//	--	Window Position --
//Get the Position to place the popup window.
//Pass the Measure you want to find either width or height
//Pass the size you want to position, either the width or height.
function windowPosition(measure, size) {
    var widthSize = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
    var heightSize = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
    var x = window.pageXOffset || (window.document.documentElement.scrollLeft || window.document.body.scrollLeft);
    var y = window.pageYOffset || (window.document.documentElement.scrollTop || window.document.body.scrollTop);
    if (measure == "width") {
        widthSize = ((widthSize / 2) - (size / 2)) + x;
        if (widthSize < 0) { widthSize = 0; }
        return widthSize;
    } else if (measure == "height") {
        heightSize = ((heightSize / 2) - (size / 2)) + y;
        if (heightSize < 0) { heightSize = 0; }
        return heightSize;
    } else {
        alert("Invalid paramater passed to windowPosition function");
    }
}

//Popup a Pane
function popup(window_id, type, source) {
    document.getElementById(window_id).style.display = "block";
    width = windowPosition("width", 928);
    height = windowPosition("height", 651);
    openPop(window_id);
    afterOpen(type, source);
}

function afterOpen(type, source) {
    switch (type) {
        case "info":
            setTimeout("showContent('" + source + "', 'info')", 500);
            document.getElementById('infoClose').style.display = 'block';
            break;
        case "zoom":
            setTimeout("showContent('" + source + "', 'zoom')", 500);
            document.getElementById('imageClose').style.display = 'block';
            setTimeout("document.getElementById('popupWindow').style.opacity = '1.0'", 1000);
            break;
        case "flat":
            setTimeout("showContent('" + source + "', 'flat')", 500);
            document.getElementById('imageClose').style.display = 'block';
            setTimeout("document.getElementById('popupWindow').style.opacity = '1.0'", 1000);
            break;
    }
}

function openPop(window_id) {
    //Move Window to position
    document.getElementById(window_id).style.left = width;
    document.getElementById(window_id).style.top = height;
    /*
    new Effect.Parallel(
		[
			new Effect.Move(window_id, { duration: 0.0, x: width, y: height, mode: 'absolute' }),
			new Effect.Opacity(window_id, { to: 1.0, from: 0.0, sync: true })
		],
		{
		    duration: 0.5
		}
	);
    */
   // if (is_ie6 == false) {
   //     setTimeout("document.getElementById('" + window_id + "').style.backgroundImage = 'url(/sleepstore/images/zoomPopupBackground.png)'", 500);
   // }
}

function closePopup(window_id, content_id) {
    /*
    new Effect.Parallel(
		[
		 	new Effect.Move(window_id, { x: width, y: height, mode: 'absolute', sync: true }),
		 	new Effect.Opacity(window_id, { to: 0.0, from: 1.0, sync: true })
		],
		{
		    duration: 0.5, beforeStart: beforeClose(window_id), afterFinish: afterClose(window_id, content_id)
		}
  	);
    */
    afterClose(window_id, content_id);
}

function afterClose(window_id, content_id) {
    setTimeout("document.getElementById('" + window_id + "').style.display = 'none'", 500);
    setTimeout("document.getElementById('" + content_id + "').innerHTML = ''", 500);
}

function beforeClose(window_id) {
    document.getElementById(window_id).style.backgroundImage = '';
    if (window_id == "popupWindow") {
        document.getElementById('imageClose').style.display = 'none';
    }
    if (window_id == "popupWindowInfo") {
        document.getElementById('infoClose').style.display = 'none';
    }
}
$(function () {
    var scntDiv = $('#p_scents');
    var i = $('#p_scents label').size() / 2 + 1;
    
    $('#addScnt').live('click', function () {
        for (index = 0; index < 5; index++) {
            var j = i - 1;
            $('<div class="extraperson"><label for="toName">' + i + '. Friends Name:</label><input type="text" name="tellAFriendRecipient[' + j + '].friendName" value="" class="validate[required]" ><label for="toEmail">Email address:</label><input type="text" name="tellAFriendRecipient[' + j + '].friendEmail" value="" class="validate[required,custom[email]]" >').appendTo(scntDiv);
            i++;
        }
        return false;
    });
    $('#remScnt').live('click', function () {
        if (i > 1) {
            $(this).parents('div.extraperson').remove();
        }
        return false;
    });
});

