// SV 5/16/08 cdn_path is the url of the akamai servers. this checks to see if the cdn_path is defined on the page, and if not assignes it a value of null
try {
	if(cdn_path) {
		// do nothing
	} 
} catch(e) {
	cdn_path = '';
}

/* Include jquery & plugins */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/jquery/jquery.js\"></script>";
//document.write(s);
/*
* 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) }) } });
    (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") } })
})();

//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/jquery/plugins.js\"></script>";		
//document.write(s);
/*  jQuery UI 1.7.1 */
jQuery.ui || (function(c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.1", plugin: { add: function(k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]) } }, call: function(j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k) } } } }, contains: function(k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j) }, hasScroll: function(m, k) { if (c(m).css("overflow") == "hidden") { return false } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l }, isOverAxis: function(k, j, l) { return (k > j) && (k < (j + l)) }, isOver: function(o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function(k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))) }; c.fn.removeAttr = function(j) { return (a.test(j) ? this.each(function() { this.removeAttributeNS(h, j.replace(a, "")) }) : e.call(this, j)) } } c.fn.extend({ remove: function() { c("*", this).add(this).each(function() { c(this).triggerHandler("remove") }); return i.apply(this, arguments) }, enableSelection: function() { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function() { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function() { return false }) }, scrollParent: function() { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test(c.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } else { j = this.parents().filter(function() { return (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)) }).eq(0) } return (/fixed/).test(this.css("position")) || !j.length ? c(document) : j } }); c.extend(c.expr[":"], { data: function(l, k, j) { return !!c.data(l, j[3]) }, focusable: function(k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length }, tabbable: function(k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable") } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p) } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")) } return (c.inArray(o, j) != -1) } c.widget = function(k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function(p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined) } return this.each(function() { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)) }) }; c[l] = c[l] || {}; c[l][k] = function(o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function(q, p, r) { if (q.target == o) { return m._setData(p, r) } }).bind("getData." + k, function(q, p) { if (q.target == o) { return m._getData(p) } }).bind("remove", function() { return m.destroy() }) }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option" }; c.widget.prototype = { _init: function() { }, destroy: function() { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled") }, option: function(l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l) } k = {}; k[l] = m } c.each(k, function(n, o) { j._setData(n, o) }) }, _getData: function(j) { return this.options[j] }, _setData: function(j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k) } }, enable: function() { this._setData("disabled", false) }, disable: function() { this._setData("disabled", true) }, _trigger: function(l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o] } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()) } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function() { var j = this; this.element.bind("mousedown." + this.widgetName, function(k) { return j._mouseDown(k) }).bind("click." + this.widgetName, function(k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false } }); if (c.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on") } this.started = false }, _mouseDestroy: function() { this.element.unbind("." + this.widgetName); (c.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)) }, _mouseDown: function(l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { k.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true } } this._mouseMoveDelegate = function(n) { return k._mouseMove(n) }; this._mouseUpDelegate = function(n) { return k._mouseUp(n) }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true }, _mouseMove: function(j) { if (c.browser.msie && !j.button) { return this._mouseUp(j) } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault() } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)) } return !this._mouseStarted }, _mouseUp: function(j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j) } return false }, _mouseDistanceMet: function(j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance) }, _mouseDelayMet: function(j) { return this.mouseDelayMet }, _mouseStart: function(j) { }, _mouseDrag: function(j) { }, _mouseStop: function(j) { }, _mouseCapture: function(j) { return true } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); ;
// draggable
(function(a) { a.widget("ui.draggable", a.extend({}, a.ui.mouse, { _init: function() { if (this.options.helper == "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { this.element[0].style.position = "relative" } (this.options.addClasses && this.element.addClass("ui-draggable")); (this.options.disabled && this.element.addClass("ui-draggable-disabled")); this._mouseInit() }, destroy: function() { if (!this.element.data("draggable")) { return } this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"); this._mouseDestroy() }, _mouseCapture: function(b) { var c = this.options; if (this.helper || c.disabled || a(b.target).is(".ui-resizable-handle")) { return false } this.handle = this._getHandle(b); if (!this.handle) { return false } return true }, _mouseStart: function(b) { var c = this.options; this.helper = this._createHelper(b); this._cacheHelperProportions(); if (a.ui.ddmanager) { a.ui.ddmanager.current = this } this._cacheMargins(); this.cssPosition = this.helper.css("position"); this.scrollParent = this.helper.scrollParent(); this.offset = this.element.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; a.extend(this.offset, { click: { left: b.pageX - this.offset.left, top: b.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }); this.originalPosition = this._generatePosition(b); this.originalPageX = b.pageX; this.originalPageY = b.pageY; if (c.cursorAt) { this._adjustOffsetFromHelper(c.cursorAt) } if (c.containment) { this._setContainment() } this._trigger("start", b); this._cacheHelperProportions(); if (a.ui.ddmanager && !c.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, b) } this.helper.addClass("ui-draggable-dragging"); this._mouseDrag(b, true); return true }, _mouseDrag: function(b, d) { this.position = this._generatePosition(b); this.positionAbs = this._convertPositionTo("absolute"); if (!d) { var c = this._uiHash(); this._trigger("drag", b, c); this.position = c.position } if (!this.options.axis || this.options.axis != "y") { this.helper[0].style.left = this.position.left + "px" } if (!this.options.axis || this.options.axis != "x") { this.helper[0].style.top = this.position.top + "px" } if (a.ui.ddmanager) { a.ui.ddmanager.drag(this, b) } return false }, _mouseStop: function(c) { var d = false; if (a.ui.ddmanager && !this.options.dropBehaviour) { d = a.ui.ddmanager.drop(this, c) } if (this.dropped) { d = this.dropped; this.dropped = false } if ((this.options.revert == "invalid" && !d) || (this.options.revert == "valid" && d) || this.options.revert === true || (a.isFunction(this.options.revert) && this.options.revert.call(this.element, d))) { var b = this; a(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { b._trigger("stop", c); b._clear() }) } else { this._trigger("stop", c); this._clear() } return false }, _getHandle: function(b) { var c = !this.options.handle || !a(this.options.handle, this.element).length ? true : false; a(this.options.handle, this.element).find("*").andSelf().each(function() { if (this == b.target) { c = true } }); return c }, _createHelper: function(c) { var d = this.options; var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c])) : (d.helper == "clone" ? this.element.clone() : this.element); if (!b.parents("body").length) { b.appendTo((d.appendTo == "parent" ? this.element[0].parentNode : d.appendTo)) } if (b[0] != this.element[0] && !(/(fixed|absolute)/).test(b.css("position"))) { b.css("position", "absolute") } return b }, _adjustOffsetFromHelper: function(b) { if (b.left != undefined) { this.offset.click.left = b.left + this.margins.left } if (b.right != undefined) { this.offset.click.left = this.helperProportions.width - b.right + this.margins.left } if (b.top != undefined) { this.offset.click.top = b.top + this.margins.top } if (b.bottom != undefined) { this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top } }, _getParentOffset: function() { this.offsetParent = this.helper.offsetParent(); var b = this.offsetParent.offset(); if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) { b.left += this.scrollParent.scrollLeft(); b.top += this.scrollParent.scrollTop() } if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) { b = { top: 0, left: 0} } return { top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)} }, _getRelativeOffset: function() { if (this.cssPosition == "relative") { var b = this.element.position(); return { top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()} } else { return { top: 0, left: 0} } }, _cacheMargins: function() { this.margins = { left: (parseInt(this.element.css("marginLeft"), 10) || 0), top: (parseInt(this.element.css("marginTop"), 10) || 0)} }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight()} }, _setContainment: function() { var e = this.options; if (e.containment == "parent") { e.containment = this.helper[0].parentNode } if (e.containment == "document" || e.containment == "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document : window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top] } if (!(/^(document|window|parent)$/).test(e.containment) && e.containment.constructor != Array) { var c = a(e.containment)[0]; if (!c) { return } var d = a(e.containment).offset(); var b = (a(c).css("overflow") != "hidden"); this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top] } else { if (e.containment.constructor == Array) { this.containment = e.containment } } }, _convertPositionTo: function(f, h) { if (!h) { h = this.position } var c = f == "absolute" ? 1 : -1; var e = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, g = (/(html|body)/i).test(b[0].tagName); return { top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)), left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c))} }, _generatePosition: function(e) { var h = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, i = (/(html|body)/i).test(b[0].tagName); if (this.cssPosition == "relative" && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset() } var d = e.pageX; var c = e.pageY; if (this.originalPosition) { if (this.containment) { if (e.pageX - this.offset.click.left < this.containment[0]) { d = this.containment[0] + this.offset.click.left } if (e.pageY - this.offset.click.top < this.containment[1]) { c = this.containment[1] + this.offset.click.top } if (e.pageX - this.offset.click.left > this.containment[2]) { d = this.containment[2] + this.offset.click.left } if (e.pageY - this.offset.click.top > this.containment[3]) { c = this.containment[3] + this.offset.click.top } } if (h.grid) { var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1]; c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g : (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g; var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0]; d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f : (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f } } return { top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))), left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft())))} }, _clear: function() { this.helper.removeClass("ui-draggable-dragging"); if (this.helper[0] != this.element[0] && !this.cancelHelperRemoval) { this.helper.remove() } this.helper = null; this.cancelHelperRemoval = false }, _trigger: function(b, c, d) { d = d || this._uiHash(); a.ui.plugin.call(this, b, [c, d]); if (b == "drag") { this.positionAbs = this._convertPositionTo("absolute") } return a.widget.prototype._trigger.call(this, b, c, d) }, plugins: {}, _uiHash: function(b) { return { helper: this.helper, position: this.position, absolutePosition: this.positionAbs, offset: this.positionAbs} } })); a.extend(a.ui.draggable, { version: "1.7.1", eventPrefix: "drag", defaults: { addClasses: true, appendTo: "parent", axis: false, cancel: ":input,option", connectToSortable: false, containment: false, cursor: "auto", cursorAt: false, delay: 0, distance: 1, grid: false, handle: false, helper: "original", iframeFix: false, opacity: false, refreshPositions: false, revert: false, revertDuration: 500, scope: "default", scroll: true, scrollSensitivity: 20, scrollSpeed: 20, snap: false, snapMode: "both", snapTolerance: 20, stack: false, zIndex: false} }); a.ui.plugin.add("draggable", "connectToSortable", { start: function(c, e) { var d = a(this).data("draggable"), f = d.options, b = a.extend({}, e, { item: d.element }); d.sortables = []; a(f.connectToSortable).each(function() { var g = a.data(this, "sortable"); if (g && !g.options.disabled) { d.sortables.push({ instance: g, shouldRevert: g.options.revert }); g._refreshItems(); g._trigger("activate", c, b) } }) }, stop: function(c, e) { var d = a(this).data("draggable"), b = a.extend({}, e, { item: d.element }); a.each(d.sortables, function() { if (this.instance.isOver) { this.instance.isOver = 0; d.cancelHelperRemoval = true; this.instance.cancelHelperRemoval = false; if (this.shouldRevert) { this.instance.options.revert = true } this.instance._mouseStop(c); this.instance.options.helper = this.instance.options._helper; if (d.options.helper == "original") { this.instance.currentItem.css({ top: "auto", left: "auto" }) } } else { this.instance.cancelHelperRemoval = false; this.instance._trigger("deactivate", c, b) } }) }, drag: function(c, f) { var e = a(this).data("draggable"), b = this; var d = function(i) { var n = this.offset.click.top, m = this.offset.click.left; var g = this.positionAbs.top, k = this.positionAbs.left; var j = i.height, l = i.width; var p = i.top, h = i.left; return a.ui.isOver(g + n, k + m, p, h, j, l) }; a.each(e.sortables, function(g) { this.instance.positionAbs = e.positionAbs; this.instance.helperProportions = e.helperProportions; this.instance.offset.click = e.offset.click; if (this.instance._intersectsWith(this.instance.containerCache)) { if (!this.instance.isOver) { this.instance.isOver = 1; this.instance.currentItem = a(b).clone().appendTo(this.instance.element).data("sortable-item", true); this.instance.options._helper = this.instance.options.helper; this.instance.options.helper = function() { return f.helper[0] }; c.target = this.instance.currentItem[0]; this.instance._mouseCapture(c, true); this.instance._mouseStart(c, true, true); this.instance.offset.click.top = e.offset.click.top; this.instance.offset.click.left = e.offset.click.left; this.instance.offset.parent.left -= e.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.top -= e.offset.parent.top - this.instance.offset.parent.top; e._trigger("toSortable", c); e.dropped = this.instance.element; e.currentItem = e.element; this.instance.fromOutside = e } if (this.instance.currentItem) { this.instance._mouseDrag(c) } } else { if (this.instance.isOver) { this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; this.instance.options.revert = false; this.instance._trigger("out", c, this.instance._uiHash(this.instance)); this.instance._mouseStop(c, true); this.instance.options.helper = this.instance.options._helper; this.instance.currentItem.remove(); if (this.instance.placeholder) { this.instance.placeholder.remove() } e._trigger("fromSortable", c); e.dropped = false } } }) } }); a.ui.plugin.add("draggable", "cursor", { start: function(c, d) { var b = a("body"), e = a(this).data("draggable").options; if (b.css("cursor")) { e._cursor = b.css("cursor") } b.css("cursor", e.cursor) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._cursor) { a("body").css("cursor", d._cursor) } } }); a.ui.plugin.add("draggable", "iframeFix", { start: function(b, c) { var d = a(this).data("draggable").options; a(d.iframeFix === true ? "iframe" : d.iframeFix).each(function() { a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({ width: this.offsetWidth + "px", height: this.offsetHeight + "px", position: "absolute", opacity: "0.001", zIndex: 1000 }).css(a(this).offset()).appendTo("body") }) }, stop: function(b, c) { a("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this) }) } }); a.ui.plugin.add("draggable", "opacity", { start: function(c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("opacity")) { e._opacity = b.css("opacity") } b.css("opacity", e.opacity) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._opacity) { a(c.helper).css("opacity", d._opacity) } } }); a.ui.plugin.add("draggable", "scroll", { start: function(c, d) { var b = a(this).data("draggable"); if (b.scrollParent[0] != document && b.scrollParent[0].tagName != "HTML") { b.overflowOffset = b.scrollParent.offset() } }, drag: function(d, e) { var c = a(this).data("draggable"), f = c.options, b = false; if (c.scrollParent[0] != document && c.scrollParent[0].tagName != "HTML") { if (!f.axis || f.axis != "x") { if ((c.overflowOffset.top + c.scrollParent[0].offsetHeight) - d.pageY < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop + f.scrollSpeed } else { if (d.pageY - c.overflowOffset.top < f.scrollSensitivity) { c.scrollParent[0].scrollTop = b = c.scrollParent[0].scrollTop - f.scrollSpeed } } } if (!f.axis || f.axis != "y") { if ((c.overflowOffset.left + c.scrollParent[0].offsetWidth) - d.pageX < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft + f.scrollSpeed } else { if (d.pageX - c.overflowOffset.left < f.scrollSensitivity) { c.scrollParent[0].scrollLeft = b = c.scrollParent[0].scrollLeft - f.scrollSpeed } } } } else { if (!f.axis || f.axis != "x") { if (d.pageY - a(document).scrollTop() < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() - f.scrollSpeed) } else { if (a(window).height() - (d.pageY - a(document).scrollTop()) < f.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() + f.scrollSpeed) } } } if (!f.axis || f.axis != "y") { if (d.pageX - a(document).scrollLeft() < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() - f.scrollSpeed) } else { if (a(window).width() - (d.pageX - a(document).scrollLeft()) < f.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() + f.scrollSpeed) } } } } if (b !== false && a.ui.ddmanager && !f.dropBehaviour) { a.ui.ddmanager.prepareOffsets(c, d) } } }); a.ui.plugin.add("draggable", "snap", { start: function(c, d) { var b = a(this).data("draggable"), e = b.options; b.snapElements = []; a(e.snap.constructor != String ? (e.snap.items || ":data(draggable)") : e.snap).each(function() { var g = a(this); var f = g.offset(); if (this != b.element[0]) { b.snapElements.push({ item: this, width: g.outerWidth(), height: g.outerHeight(), top: f.top, left: f.left }) } }) }, drag: function(u, p) { var g = a(this).data("draggable"), q = g.options; var y = q.snapTolerance; var x = p.offset.left, w = x + g.helperProportions.width, f = p.offset.top, e = f + g.helperProportions.height; for (var v = g.snapElements.length - 1; v >= 0; v--) { var s = g.snapElements[v].left, n = s + g.snapElements[v].width, m = g.snapElements[v].top, A = m + g.snapElements[v].height; if (!((s - y < x && x < n + y && m - y < f && f < A + y) || (s - y < x && x < n + y && m - y < e && e < A + y) || (s - y < w && w < n + y && m - y < f && f < A + y) || (s - y < w && w < n + y && m - y < e && e < A + y))) { if (g.snapElements[v].snapping) { (g.options.snap.release && g.options.snap.release.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = false; continue } if (q.snapMode != "inner") { var c = Math.abs(m - e) <= y; var z = Math.abs(A - f) <= y; var j = Math.abs(s - w) <= y; var k = Math.abs(n - x) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m - g.helperProportions.height, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s - g.helperProportions.width }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n }).left - g.margins.left } } var h = (c || z || j || k); if (q.snapMode != "outer") { var c = Math.abs(m - f) <= y; var z = Math.abs(A - e) <= y; var j = Math.abs(s - x) <= y; var k = Math.abs(n - w) <= y; if (c) { p.position.top = g._convertPositionTo("relative", { top: m, left: 0 }).top - g.margins.top } if (z) { p.position.top = g._convertPositionTo("relative", { top: A - g.helperProportions.height, left: 0 }).top - g.margins.top } if (j) { p.position.left = g._convertPositionTo("relative", { top: 0, left: s }).left - g.margins.left } if (k) { p.position.left = g._convertPositionTo("relative", { top: 0, left: n - g.helperProportions.width }).left - g.margins.left } } if (!g.snapElements[v].snapping && (c || z || j || k || h)) { (g.options.snap.snap && g.options.snap.snap.call(g.element, u, a.extend(g._uiHash(), { snapItem: g.snapElements[v].item }))) } g.snapElements[v].snapping = (c || z || j || k || h) } } }); a.ui.plugin.add("draggable", "stack", { start: function(b, c) { var e = a(this).data("draggable").options; var d = a.makeArray(a(e.stack.group)).sort(function(g, f) { return (parseInt(a(g).css("zIndex"), 10) || e.stack.min) - (parseInt(a(f).css("zIndex"), 10) || e.stack.min) }); a(d).each(function(f) { this.style.zIndex = e.stack.min + f }); this[0].style.zIndex = e.stack.min + d.length } }); a.ui.plugin.add("draggable", "zIndex", { start: function(c, d) { var b = a(d.helper), e = a(this).data("draggable").options; if (b.css("zIndex")) { e._zIndex = b.css("zIndex") } b.css("zIndex", e.zIndex) }, stop: function(b, c) { var d = a(this).data("draggable").options; if (d._zIndex) { a(c.helper).css("zIndex", d._zIndex) } } }) })(jQuery); ;
// levitip
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 } ('(8($){g f=H,W={},$9=H,$s=H,15={1B:\'1w\',q:\'F\',J:\'A\',r:\'w\',n:\'2k\',R:10,P:10,1v:25,1p:D,1l:D,1k:7,1f:1N,1d:8(){},1b:8(){}},1L=$.C.1G<="1.2.1"?\'2i\':\'2f\',1A=$.C.1G<="1.2.1"?\'2b\':\'29\';$.B({u:8(a,b){3.1q(a,b)}});$.B($.u,{N:8(a){5(a.E&&a.z)W[a.z]=a},1Z:8(){5(f)f.K()},1U:8(d){$.B(15,d)},1R:{1q:8(a,o){5(!a){m}3.4=$.B({},15,o);3.h=a;3.y=3.U=1c;3.p=W[3.4.1B]||0;3.l={T:0,S:0,11:0,16:0};g b=3,13=(3.4.J==\'A\'?8(e){5(b.4.J==\'A\')b.17(e)}:8(){});5(!$9){$s=$(\'<i Q="2h"></i>\');$9=$(\'<i><i Q="2g"></i><i Q="2e"></i><i Q="2d"></i></i>\').2c($s);$9.v({1z:\'2a\',Z:\'1y\'}).n(\'28\').1x(\'w\');5($.Y.27&&(!$.Y.1u||26($.Y.1u)<=6)&&$.C.1t){$9.1t()}}5(!3.p){m}5(3.p.O){3.p.O(3)}5($.C.1r&&3.4.1l){$(a).1r({24:3.4.1f,23:3.4.1k,22:13,21:8(){b.L()},20:0})}V{$(a).A(13,8(){b.L()})}5(3.4.J==\'1o\'){$(a).1o(8(e){b.17(e)})}},17:8(e){5(f){5(f==3){5(3.y){1n(3.y)}m}V{f.K();f=H}}g a=(3.4.r==\'h\')?3.h:(3.4.r==\'w\')?\'w\':3.4.r;$9.1x(a).v({1m:\'1Y\',Z:\'1X\'});g b=3.p.E(3);5(!b)m;$s.1W(b).1V().G();5(3.4.n){$s.n(3.4.n)}5(3.4.1p){$9.n(\'1j\')}3.l={T:e.1T,S:e.1S,11:e.1Q,16:e.1P};3.1i();$9.v({Z:\'1y\',1m:\'\'}).G();f=3;5(3.4.r==\'w\'){g c=3;$9.A(8(e){c.1h(e)},8(){c.1g()})}5(3.4.1d){3.4.1d($9,3.h)}},L:8(){g a=3;3.y=1O(8(){5(!a.U){a.K()}},3.4.1v)},1h:8(){3.U=D},1g:8(){3.U=1c;3.L()},1i:8(){g a,k,1e=$(I).1M(),1s=$(I).2s(),$M,j;$M=$9.2r();j=(3.4.r==\'w\')?{x:0,t:0,1a:0,X:0}:$M.2q();5(3.4.r==\'h\'&&$M.v(\'1z\')==\'2p\'){a=3.l.T;k=3.l.S}V{a=3.l.11;k=3.l.16}a+=3.4.P-j.x-j.1a;k+=3.4.R-j.t-j.X;5(1e<3.l.T+$9[0].1K+3.4.P){g b=$(I).1a();a-=$9[0].1K+3.4.P*2;5(j.x-b+a<0){a-=j.x-b+a}}5(1s<3.l.S+$9[0].1J+3.4.R){g c=$(I).X();k-=$9[0].1J+3.4.R*2;5(j.t-c+k<0){k-=j.t-c+k}}$9.v({x:a,t:k})},K:8(){5(3.y){1n(3.y)}$9.18().1I(1L).1I(1A).v({x:0,t:0}).1H(\'1j\');5(3.4.n){$s.1H(3.4.n)}f=1c;5(3.p.19){3.p.19(3)}5(3.4.1b){3.4.1b($9,3.h)}}}});$.C.B({2o:8(a){m 3.2n(8(){2m $.u(3,a)})}});$.u.N({z:\'1w\',E:8(a){g b=$(a.h).12(a.4.q);5(a.4.q==\'F\'){a.14=b;$(a.h).12(\'F\',\'\')}m b},19:8(a){5(a.4.q==\'F\'&&a.14){$(a.h).12(\'F\',a.14)}}});$.u.N({z:\'2l\',O:8(a){5(a.4.1E){$(a.4.q).18()}},E:8(a){g b=[];5(a.4.q){b=$(a.4.q);5(b.1F)b=b.1D(D).G()}m b}});$.u.N({z:\'2j\',O:8(a){5(a.4.1E){$(a.h.1C).18()}},E:8(a){g b=$(a.h.1C);5(b.1F)b=b.1D(D).G();m b}})})(2t);', 62, 154, '|||this|settings|if|||function|tip|||||||var|target|div|opo|posY|pos|return|addClass||handler|source|insertInto|innerTip|top|LeviTip|css|body|left|timer|type|hover|extend|fn|true|get|title|show|null|window|activateOn|close|hoverOut|op|addSourceHandler|prepare|leftOffset|class|topOffset|cy|cx|tipHover|else|sourceHandlers|scrollTop|browser|display||px|attr|onHover|titleAttr|defaults|py|hoverIn|hide|end|scrollLeft|onClose|false|onOpen|ww|hiInterval|tipHoverOut|tipHoverIn|setPosition|outerbox|hiSensitivity|useHoverIntent|visibility|clearTimeout|click|dropShadow|init|hoverIntent|wh|bgiframe|version|closeDelay|attribute|appendTo|none|position|mouseOut|sourceType|firstChild|clone|hideSourceElement|length|jquery|removeClass|unbind|clientHeight|clientWidth|mouseOver|width|50|setTimeout|pageY|pageX|prototype|clientY|clientX|setDefaults|children|html|block|hidden|closeLeviTip|timeout|out|over|sensitivity|interval|100|parseInt|msie|levitipouter|mouseleave|absolute|mouseout|append|shadowbox3|shadowbox2|mouseenter|shadowbox1|innerbox|mouseover|firstchild|levitip|element|new|each|leviTip|fixed|offset|offsetParent|height|jQuery'.split('|'), 0, {}));
// intercept
; (function($) { var f = 'intercept', g = '.' + f, j = $[f] = function(a, b, c) { $('html').intercept(a, b, c) }; $.fn.intercept = function(b, c, d) { var e, f, h; if (d) { e = {}; e[c] = d; c = e } return this.each(function() { f = this; $.each(b.split(' '), function(i, a) { h = $.data(f, a + g); if (!h) { $.data(f, a + g, $.extend({}, c)); $.event.add(f, a, j.handle) } else $.extend(h, c) }) }) }; j.absolute = /[\s>+~]/; j.handle = function(e) { var a = $.data(this, e.type + g), b = e.target, c = $(b), d, f; if (!a) return; for (d in a) { if (d == 'self' && b == this || j.absolute.test(d) ? $(d).index(b) != -1 : c.is(d)) f = a[d].apply(b, arguments) !== false && f } return f } })(jQuery);
// bgiframe Version 2.1.1
(function($) { $.fn.bgIframe = $.fn.bgiframe = function(s) { if ($.browser.msie && parseInt($.browser.version) == 6 && !window["XMLHttpRequest"]) { s = $.extend({ top: 'auto', left: 'auto', width: 'auto', height: 'auto', opacity: true, src: 'javascript:false;' }, s || {}); var prop = function(n) { return n && n.constructor == Number ? n + 'px' : n; }, html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' + 'style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') + 'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' + 'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' + 'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' + 'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' + '"/>'; return this.each(function() { if ($('> iframe.bgiframe', this).length == 0) this.insertBefore(document.createElement(html), this.firstChild); }); } return this; }; })(jQuery);
// live query
(function($) {
    $.extend($.fn, { livequery: function(type, fn, fn2) { var self = this, q; if ($.isFunction(type)) fn2 = fn, fn = type, type = undefined; $.each($.livequery.queries, function(i, query) { if (self.selector == query.selector && self.context == query.context && type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid)) return (q = query) && false; }); q = q || new $.livequery(this.selector, this.context, type, fn, fn2); q.stopped = false; q.run(); return this; }, expire: function(type, fn, fn2) { var self = this; if ($.isFunction(type)) fn2 = fn, fn = type, type = undefined; $.each($.livequery.queries, function(i, query) { if (self.selector == query.selector && self.context == query.context && (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped) $.livequery.stop(query.id); }); return this; } }); $.livequery = function(selector, context, type, fn, fn2) { this.selector = selector; this.context = context || document; this.type = type; this.fn = fn; this.fn2 = fn2; this.elements = []; this.stopped = false; this.id = $.livequery.queries.push(this) - 1; fn.$lqguid = fn.$lqguid || $.livequery.guid++; if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++; return this; }; $.livequery.prototype = { stop: function() { var query = this; if (this.type) this.elements.unbind(this.type, this.fn); else if (this.fn2) this.elements.each(function(i, el) { query.fn2.apply(el); }); this.elements = []; this.stopped = true; }, run: function() { if (this.stopped) return; var query = this; var oEls = this.elements, els = $(this.selector, this.context), nEls = els.not(oEls); this.elements = els; if (this.type) { nEls.bind(this.type, this.fn); if (oEls.length > 0) $.each(oEls, function(i, el) { if ($.inArray(el, els) < 0) $.event.remove(el, query.type, query.fn); }); } else { nEls.each(function() { query.fn.apply(this); }); if (this.fn2 && oEls.length > 0) $.each(oEls, function(i, el) { if ($.inArray(el, els) < 0) query.fn2.apply(el); }); } } }; $.extend($.livequery, { guid: 0, queries: [], queue: [], running: false, timeout: null, checkQueue: function() { if ($.livequery.running && $.livequery.queue.length) { var length = $.livequery.queue.length; while (length--) $.livequery.queries[$.livequery.queue.shift()].run(); } }, pause: function() { $.livequery.running = false; }, play: function() { $.livequery.running = true; $.livequery.run(); }, registerPlugin: function() { $.each(arguments, function(i, n) { if (!$.fn[n]) return; var old = $.fn[n]; $.fn[n] = function() { var r = old.apply(this, arguments); $.livequery.run(); return r; } }); }, run: function(id) {
        if (id != undefined) { if ($.inArray(id, $.livequery.queue) < 0) $.livequery.queue.push(id); } else
            $.each($.livequery.queries, function(id) { if ($.inArray(id, $.livequery.queue) < 0) $.livequery.queue.push(id); }); if ($.livequery.timeout) clearTimeout($.livequery.timeout); $.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
    }, stop: function(id) {
        if (id != undefined) $.livequery.queries[id].stop(); else
            $.each($.livequery.queries, function(id) { $.livequery.queries[id].stop(); });
    } 
    }); $.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove'); $(function() { $.livequery.play(); }); var init = $.prototype.init; $.prototype.init = function(a, c) { var r = init.apply(this, arguments); if (a && a.selector) r.context = a.context, r.selector = a.selector; if (typeof a == 'string') r.context = c || document, r.selector = a; return r; }; $.prototype.init.prototype = $.prototype;
})(jQuery);


/* Include parse.js */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/parse.js\"></script>";		
//document.write(s);
/* 	
	Purpose:	These functions validate user input data.
	Created by: Sairam Rangachari
	Date: 		8/28/2002
*/

// *********** Global Variables ***********

var decimalPointDelimiter=".";
var sInvalidSymbols="";

// *********** End Global Variables ***********

// *********** Validate Entered Symbol ***********

//SP : 14523 : 9/16/2005 : moved ValidateData() from the HTML pages (Shawn)
function ValidateData(sValue, sCtrl) {	
	sCtrl.value=ltrim(sValue); 
	if (!IsValidSymbol(sValue)) {
		PromptFocus(sCtrl, "Please enter a valid symbol.");		
		return false;
	} else if(!IsValidChangedSymbol(sValue,sCtrl)) {			
		return false;
	} else {
		return true;
	}
}

//SP : 14523 : 9/16/2005 : moved ValidateMultiData() for multiple symbols from the HTML pages (Shawn)
function ValidateMultiData(sValue, sCtrl) {	
	sInvalidSymbols = "";
	if (!IsValidMultiSymbol(sValue, sCtrl)) {
		if(sCtrl.value == "" || sCtrl.value.indexOf(',') == -1)
			PromptFocus(sCtrl, "Please enter a valid symbol.");
		else
			PromptFocus(sCtrl, "The following symbol(s) are invalid: " + sInvalidSymbols);
		return false;
	} else if(!IsValidChangedSymbol(sCtrl.value,sCtrl)) {
		return false;
	} else {
		return true;
	}
}

//SP : 14523 : 9/26/2005 : to allow for blank input to be a valid symbol
function ValidateDataAllowBlank(sValue, sCtrl) {	
	sCtrl.value=ltrim(sValue);
	if(sCtrl.value=="") {
		return true;
	}
	else {
		if (!IsValidSymbol(sValue)) {
			PromptFocus(sCtrl, "Please enter a valid symbol.");		
			return false;
		} else if(!IsValidChangedSymbol(sValue,sCtrl)) {			
			return false;
		} else {
			return true;
		}
	}
}

//SP : 14523 : 9/1/2005 : modified the function
function IsValidSymbol(sValue) {    
    if (IsValidStock(sValue) || IsValidOption(sValue) || IsValidIndex(sValue)) {
		return true;
	} else {
		if(sInvalidSymbols=="") {
			sInvalidSymbols = sValue;
		}
		else{
			sInvalidSymbols = sInvalidSymbols + ", " + sValue;
		}
		return false;
	}
}

//SP : 14523 : 9/1/2005 : modified the function
function IsValidStock(sValue) {
	var i=0;
	sValue=ltrim(sValue);
	
	if (sValue == '') {
		return false;
	} else if (sValue.length > 7) {
		return false;
	} else if (NonAlphaNumericExceptSlash(sValue)) {
		return false;
	} else {
		return true;
	}
}

//ML 36205 : OSI
function StripIllegalCharsFromSymbol(sQueryStr) {
	chars = new Array();
	chars[0] = "`";
	chars[1] = "~";
	chars[2] = "!";
	chars[3] = "@";
	chars[4] = "#";
	chars[5] = "$";
	chars[6] = "%";
	chars[7] = "|";
	chars[8] = ";";
	chars[9] = ":";
	chars[10] = "\'";
	chars[11] = "\"";
	chars[12] = ",";
	chars[13] = "<";
	chars[14] = ">";
	chars[15] = "/";
	
	for(i=0;i<chars.length;i++){
		if(sQueryStr.indexOf(chars[i])!=-1){
			sQueryStr=StrReplace(sQueryStr,chars[i],"");
		}
	}
	return(sQueryStr);
}

//ML 36205 : OSI
// Verify Opra symbology	
function IsOptionDotSymbol(sValue) {
	if (sValue == undefined) {
		return false;
	} 
	
	sValue=ltrim(sValue);
	
	if (sValue.length == 0) {
		return false;
	} else if (sValue.charAt(0) != '.') {
		return false
	} else if (sValue.length < 4) {
		return false;
	} else {
		return true;
	}	
}

//SP : 14523 : 9/1/2005 : Option length - no upper limit 
//ML 36205 : OSI
function IsValidOption(sValue) {
	var i=0;
	if (sValue == undefined) {
		return false;
	} 
	sValue=ltrim(sValue);	
	if (sValue.length == 0) {
		return false;
	} else if (sValue.length != StripIllegalCharsFromSymbol(sValue).length) {
		return false;
	// Verify Opra symbology	
	} else if (IsOptionDotSymbol(sValue)) {
		return true;
	// Verify OSI symbology
	/*	''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        '   OSI symbol format (XXXXXX)(YYMMDD)(C/P)(ddddd)(fff)
        '                      Symbol ExpDate call/put Strike
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''  */
	} else if (sValue.length != 21) {
		return false;
	} else if ((sValue.charAt(12).toUpperCase() == "C") || (sValue.charAt(12).toUpperCase() == "P")) {		
		for (i=6; i<=11; i++) {
	        if (!isDigit(sValue.charAt(i))) return false;			
		}
		for (i=13; i<=20; i++) {
	        if (!isDigit(sValue.charAt(i))) return false;			
		}
		return true;
	} else {
		return false;
	} 
}

//SP : 14523 : 9/1/2005 : To allow for index symbols preceeded by '$'
function IsValidIndex(sValue) {
	var i=0;
	sValue=ltrim(sValue);
	
	if (sValue == '') {
		return false;
		} else if (sValue.charAt(0)=="$" && NonAlphaNumericExceptSlash(sValue.substring(1,sValue.length))) {
		return false;
	} else if (sValue.charAt(0)!="$" && !IsValidStock(sValue)) {
		return false;
	} else {
		return true;
	}
}

//EA : 20410 : 12/29/2006
function IsValidBond(sValue) {
	var i=0;
	sValue=ltrim(sValue);
	if (sValue == '') {
		return false;
	} else if (sValue.length != 9 ) {
		return false;
	} else if (InvalidCharactersExist(sValue.substring(1,sValue.length))) {
		return false;
	} else {
		return true;
	}
}

//SP : 14523 : 9/1/2005 : copied over ValidQQQSymbol() from general.js and renamed it (Shawn)
function IsValidChangedSymbol(sValue,sCtrl) {
	sValue=ltrim(sValue);
	var i;		
	var flag=true;
	var listSymbols	= sValue.split(",");
	for(i=0; i<listSymbols.length; i++) {		
		if ((trim(listSymbols[i])).toUpperCase() =="QQQ") {
			listSymbols[i]="QQQQ";
			flag=false;
		}
	}
	if(flag==false){	
		PromptFocus(sCtrl, "The Symbol 'QQQ' has been changed to 'QQQQ'");	
		sCtrl.value = listSymbols.join(",");
	}
	return flag;
		
}

//SP : 14523 : 9/1/2005
function IsValidMultiSymbol(sValue, sCtrl) {	
	sValue=ltrim(sValue);
	if (sValue == '') {
		sCtrl.value="";
		return false;
	} else {
		var i;		
		var flag=true;
		var listSymbols	= sValue.split(",");
		for(i=0; i<listSymbols.length; i++) {
			if(ltrim(listSymbols[i])=="") {
				listSymbols.splice(i,1);	
				i--;			
			}
			else {
				if(!IsValidSymbol(listSymbols[i])) {				
					flag=false;
				}
			}
		}
		if(isEmpty(listSymbols)) {
			sCtrl.value="";
			flag=false;
		}
		else
			sCtrl.value=listSymbols.join(",");		
		return flag;
	}
}

// *********** End Validate Entered Symbol ***********

function ltrim(sValue) {
	var s='';
	if (sValue==null)
		return '';
	for(var n=0; n < sValue.length;n++) {
		if (sValue.charAt(n)!=' ') {
			s=s+sValue.charAt(n);
		}	
	}
	return s;
}

function NonAlphaNumericExceptSlash(sValue) {
	var i=0;
	var sChar;
	var flag=false;
	do {
		sChar=sValue.substring(i,i+1);
		if (!( ((sChar>="a") && (sChar<="z")) || ((sChar>="A") && (sChar<="Z")) || ((sChar>="0") && (sChar<="9")) )&& sChar!='/')
			flag=true;
		i++;
	}
	while (i<sValue.length);
	return flag;
}

function NonAlphaCharExistExceptSlash(sValue) {
	var i=0;
	var sChar;

	do {
		sChar=sValue.substring(i,i+1);
		if (!( ((sChar>="a") && (sChar<="z")) || ((sChar>="A") && (sChar<="Z")) )&& sChar!='/') {
			return(true);
		}
		i++;
	}
	while (i<sValue.length);
	return(false);
}


function NonAlphaCharactersExist(sValue) {
	var i=0;
	var sChar;

	do {
		sChar=sValue.substring(i,i+1);
		if (!(((sChar>="a") && (sChar<="z")) || ((sChar>="A") && (sChar<="Z")))) {
			return(true);
		}
		i++;
	}
	while (i<sValue.length);
	return(false);
}

function IsAlphaCharacters(sValue, nStart) {
	var i;
	if (nStart > 0 )
		i=nStart;
	else
		i=0;
	var sChar;
	if (sValue==null)
		return false;
	do {
		sChar=sValue.substring(i,i+1);
		if (!(((sChar>="a") && (sChar<="z")) || ( (sChar>="A") && (sChar<="Z")))) {
			return false;
		}
		i++;
	}
	while (i<sValue.length);
	return true;
}


function RemSpaces(ctlText,LforLeadTforTrailLTforBothAforAll) {
	var sArg=LforLeadTforTrailLTforBothAforAll.toUpperCase();
	if ((sArg=="L") || (sArg=="LT")) {
		while (ctlText.value.charAt(0)==" ") {
			ctlText.value=ctlText.value.substr(1);
		}
	}
	if ((sArg=="T") || (sArg=="LT")) {
		nLength=ctlText.value.length;
		while (ctlText.value.charAt(nLength-1)==" ") {
			ctlText.value=ctlText.value.substr(0,nLength-1);
			nLength--;
		}
	}
	if (sArg=="A") {
		var RegExp=/ /g;
		ctlText.value=ctlText.value.replace(RegExp,"");
	}
	if ((sArg!="L") && (sArg!="T") && (sArg!="LT") && (sArg!="A")) {
		window.alert("Invalid argument passed to function RemSpaces.")
	}
	return;
}

// isFloat (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is an unsigned floating point (real) number. 
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isInteger, then call isFloat.
//
// Does not accept exponential notation.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isFloat (s,bAllowNegative)

{   var i;
    var seenDecimalPoint = false;
		
    if (isEmpty(s)) 
       if (isFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) return false;

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
		if (i==0 && bAllowNegative=="1" && c=="-" && s.length>1) {
			<!--Do nothing to allow negative numbers
		}
		else {
	        if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
    	    else if (!isDigit(c)) return false;
		}
    }

    // All characters are numbers.
    return true;
}

// True if string s is an unsigned floating point (real) number. 
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isInteger, then call isFloat.
//
// Does not accept exponential notation.
//
// afterDecimalPoint specifies the number of significant digits after the decimal point
function isFloat (s,bAllowNegative, afterDecimalPoint)

{   var i;
    var seenDecimalPoint = false;
   var  CountAfterDecimal = 1;	
   var digitsafterdecimal = afterDecimalPoint;	
    if (isEmpty(s)) 
       if (isFloat.arguments.length == 1) return defaultEmptyOK;
       else return (isFloat.arguments[1] == true);

    if (s == decimalPointDelimiter) 
    {   return false; }

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true
    
    var numlength = s.length;
    
      for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
		if (i==0 && bAllowNegative=="1" && c=="-" && s.length>1) {
			<!--Do nothing to allow negative numbers
		}
		else {
	      	  if ((c == decimalPointDelimiter) && (seenDecimalPoint == false)) 
	      	        { 
	      	    	   seenDecimalPoint = true;
	      	        }
    	 	  else if (!isDigit(c)) 
    	 	        {
    	 	          return false;
    	 	        }
	          else if (seenDecimalPoint)
		        {
		            if(c == decimalPointDelimiter)
			        {
			            return false;
			        }
		           if (CountAfterDecimal > afterDecimalPoint)
			        {
			             return false;
			        }
			        else 
		            {
		               CountAfterDecimal++;
		             
		            }
			       
		           
		        }
		    }
    }

    // All characters are numbers.
    return true;
}


// isInteger (STRING s [, BOOLEAN emptyOK])
// 
// Returns true if all characters in string s are numbers.
//
// Accepts non-signed integers only. Does not accept floating 
// point, exponential notation, etc.
//
// We don't use parseInt because that would accept a string
// with trailing non-numeric characters.
//
// By default, returns defaultEmptyOK if s is empty.
// There is an optional second argument called emptyOK.
// emptyOK is used to override for a single function call
//      the default behavior which is specified globally by
//      defaultEmptyOK.
// If emptyOK is false (or any value other than true), 
//      the function will return false if s is empty.
// If emptyOK is true, the function will return true if s is empty.
//
// EXAMPLE FUNCTION CALL:     RESULT:
// isInteger ("5")            true 
// isInteger ("")             defaultEmptyOK
// isInteger ("-5")           false
// isInteger ("", true)       true
// isInteger ("", false)      false
// isInteger ("5", false)     true

function isInteger (s,bAllowNegative) {
	var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return false;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.
	
    for (i = 0; i < s.length; i++) {   
        // Check that current character is number.
        var c = s.charAt(i);
		if (i==0 && bAllowNegative=="1" && c=="-" && s.length>1) {
			<!--Do nothing to allow negative numbers
		}
		else { 
	        if (!isDigit(c)) return false;
		}
    }

    // All characters are numbers.
    return true;
}

// Check whether string s is empty.
function isEmpty(s) {
	return ((s == null) || (s.length == 0));
}

// Returns true if character c is a digit 
// (0 .. 9).
function isDigit (c) {
	return ((c >= "0") && (c <= "9"))
}

function InvalidCharactersExist(sValue) {
	var i=0;
	var sChar;
	
	do {
		sChar=sValue.substring(i,i+1);
		if (!(((sChar>="A") && (sChar<="Z")) || 
		    ((sChar>="a") && (sChar<="z")) || 
		    ((sChar>="0") && (sChar<="9"))))
		{
			return(true);
		}
		i++;	
	}
	while (i<sValue.length);
	return(false);
}

function InvalidEmailCharactersExist(sValue) {
	var i=0;
	var sChar;
	
	do {
		sChar=sValue.substring(i,i+1);
		if (!(((sChar>="A") && (sChar<="Z")) || 
		    ((sChar>="a") && (sChar<="z")) || 
		    ((sChar>="0") && (sChar<="9")) || (sChar == "-") || (sChar == "_"))) {
				return(true);
		}
		i++;	
	}
	while (i<sValue.length);
	return(false);
}

/* AN: To check if any special characters, other than '.',' ','&','-' were entered in the name fields */
function SpecialCharactersExistName(sValue) {
	var i=0;
	var sChar;
	
	if(sValue.length>0)
	{
	    do {
    	   
	        sChar=sValue.substring(i,i+1);
		    if (!(
		        ((sChar>="A") && (sChar<="Z")) || 
		        ((sChar>="a") && (sChar<="z")) || 
		        ((sChar>="0") && (sChar<="9")) || 
		        (sChar==".") || (sChar==" ") ||  
		        (sChar=="&") || (sChar=="-") || 
		        (sChar=="'") || (sChar==",")
		        ))
		    {
		                  return(true);
    		     
		    }
		    i++;	
	    }
	    while (i<sValue.length);
	    return(false);
	}
	else
	    return(false);
}

/* AN: To check if any special characters, other than '.',' ','&','#','\','/','-',':','(',')' were entered in the Address fields */
function SpecialCharactersExist(sValue) {
	var i=0;
	var sChar;
	
    if(sValue.length>0)
	{
	    do {
    	   
	        sChar=sValue.substring(i,i+1);
		    if (!(
		        ((sChar>="A") && (sChar<="Z")) || 
		        ((sChar>="a") && (sChar<="z")) || 
		        ((sChar>="0") && (sChar<="9")) || 
		        (sChar==".") || (sChar==" ") ||  
		        (sChar=="&") || (sChar==",") || 
		        (sChar=="/") || (sChar=="\\")|| 
		        (sChar=="(") || (sChar==")")||
		        (sChar=="{") || (sChar=="}")||
		        (sChar==":") || (sChar=="'") || 
		        (sChar==";") || (sChar=="-") 
		        ))
		    {
		                  return(true);
    		     
		    }
		    i++;	
	    }
	    while (i<sValue.length);
	 return(false);
	}
	else
	    return(false);
}

/* AN: To check if any special characters, other than '.',' ','&','#','\','/','-',':','(',')' were entered in the Address fields */
function SpecialCharactersExistAddress(sValue) {
	var i=0;
	var sChar;
	
    if(sValue.length>0)
	{
	    do {
    	   
	        sChar=sValue.substring(i,i+1);
		    if (!(
		        ((sChar>="A") && (sChar<="Z")) || 
		        ((sChar>="a") && (sChar<="z")) || 
		        ((sChar>="0") && (sChar<="9")) || 
		        (sChar==".") || (sChar==" ") ||  
		        (sChar=="&") || (sChar=="#") ||
		        (sChar==",") || (sChar=="-") ||
		        (sChar=="/") || (sChar=="\\")|| 
		        (sChar=="(") || (sChar==")")||
		        (sChar=="{") || (sChar=="}")||
		        (sChar==":") || (sChar=="'") || (sChar==";")
		        ))
		    {
		                  return(true);
    		     
		    }
		    i++;	
	    }
	    while (i<sValue.length);
	 return(false);
	}
	else
	    return(false);
}

/* AN: To check if length is less than 6*/
function InvalidPassport(sValue) {
	if(sValue.length < 6 )
	    {
		return (true);
	    }
	else
	    {
		 return(false);
	    }
		    
}
function isValidDate(datDate) {
  // PZ: USE THE OTHER IsValidDate function below
  // determines if the date string passed represents a valid date.
  // returns 0 if the date is valid
  // returns 1 if the date is not in the format of mm/dd/ccyy
  // returns 2 if the date is not a legal date (i.e. 02/30/1999)
  	var nRetValue=0;
  	var aDate=datDate.split("/");
	if(aDate.length==3) {
		if((aDate[0]<1 || aDate[0]>12) ||
		   (aDate[1]<1 || aDate[1]>31) ||
		   (aDate[2]<1900))
			nRetValue=2;
	} else if(aDate.length!=3) {
		nRetValue=1;
	}
	return nRetValue;
}

function IsValidDate(date2check,enableFutureDateCheck) {
	// determines if the date string passed represents a valid date.
	// returns null if the date is valid
	// returns an error message if the date is not in the format of mm/dd/ccyy
	var retval="";
	var aMMDDCCYY;
	var dtest;
	var curdate = new Date();
	var nextdate = new Date();
	nextdate.setDate(nextdate.getDate() + 1);
	date2check=StrReplace(date2check," ","",true);
	// use a regular expression pattern match to determine if the date format is valid
	if (/^(\d\d?-\d\d?-\d{4})|(\d\d?\/\d\d?\/\d{4})$/.test(date2check)) {
		dtest = new Date(date2check);
		if (/\//.test(date2check)) {
			aMMDDCCYY = date2check.split("/");
		} else {
			if (/-/.test(date2check)) {
				aMMDDCCYY = date2check.split("-");
			} else {
				aMMDDCCYY = Array(date2check.substr(0,2), date2check.substr(2,2), date2check.substr(4,4));
				dtest = new Date(aMMDDCCYY[0] + "/" + aMMDDCCYY[1] + "/" + aMMDDCCYY[2]);
			}
		}
		if (!isInteger(aMMDDCCYY[0]) || !isInteger(aMMDDCCYY[1]) || !isInteger(aMMDDCCYY[2])) {
			retval = "Invalid characters in date.\nPlease enter date in the following format: mm/dd/yyyy";
		} else {
			if (dtest.getMonth() + 1 != aMMDDCCYY[0] || dtest.getDate() != aMMDDCCYY[1] || dtest.getFullYear() != aMMDDCCYY[2]) {
				retval = "This is not a legal date (i.e. 15/45/2000)"; //2;
				return retval;
			}
			if (aMMDDCCYY[2]<'1800') {
				retval= "Invalid date."; //3;
				return retval;
			}
			if(enableFutureDateCheck==1){
				if (dtest > nextdate){
					retval = "You cannot enter a future date";
					return retval;
				}
			}
		}
	} else {
		if (InvalidCharsInDate(date2check)) {
			retval = "Invalid characters in date.\nPlease enter date in the following format: mm/dd/yyyy";
		} else {
			retval = "Invalid date format.\nPlease enter date in the following format: mm/dd/yyyy"; //1;
		}
	}
	if (retval.length>0) {
		return retval;
	} else {
		return(null);
	}
}

function IsValidTime(timeStr) {
		
		//AJ :  Checks if time is in HH:MM:SS AM/PM format.
		// The seconds and AM/PM are optional.

		var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm|Am|Pm))?$/;

		var matchArray = timeStr.match(timePat);
		if (matchArray == null) {
		alert("Time is not in a valid format.");
		return false;
		}
		hour = matchArray[1];
		minute = matchArray[2];
		second = matchArray[4];
		ampm = matchArray[6];

		if (second=="") { second = null; }
		if (ampm=="") { 
		alert("You must specify AM or PM."); 
		return false;
		}

		if (hour < 0  || hour > 12) {
		alert("Hour must be between 1 and 12.");
		return false;
		}
		if (minute<0 || minute > 59) {
		alert ("Minute must be between 0 and 59.");
		return false;
		}
		if (second != null && (second < 0 || second > 59)) {
		alert ("Second must be between 0 and 59.");
		return false;
		}
		return true;
}
		
function Now() {
	var oDate;
	var sDate;
	var nHours;
	var nMinutes;
	var sAMPM="AM";
	var sFiller="0";
	  
	oDate = new Date();
	sDate = (oDate.getMonth() + 1) + "/";
	sDate += oDate.getDate() + "/";
	sDate += oDate.getYear() + " ";
	nHours = oDate.getHours();	
	if (nHours > 11 && nHours < 24)
		sAMPM="PM"
	if (nHours > 12 && nHours <= 24)
	  nHours=nHours-12;
	nMinutes = oDate.getMinutes();
	if (nMinutes > 9)
	  sFiller="";
	sDate += nHours + ":";
	sDate += sFiller + oDate.getMinutes() + " ";
	sDate += sAMPM;
	return(sDate);
}




function StdDateFormat(strDate) {
  // dgk-10/07/00
  // receives a date string in the format of mm/dd/ccyy, mm-dd-ccyy, or mmddccyy
  // returns a date string in the standard format: mm/dd/ccyy.
  var retval = ""
  var aMMDDCCYY
  if (isValidDate(strDate) == 0) {
     if (/\//.test(strDate)) {
             retval = strDate;
     }else{
        if (/-/.test(strDate)) {
           aMMDDCCYY = strDate.split("-");
        }else{
           aMMDDCCYY = Array(strDate.substr(0,2), strDate.substr(2,2), strDate.substr(4,4));
        }
        retval = (aMMDDCCYY[0] + "/" + aMMDDCCYY[1] + "/" + aMMDDCCYY[2]);
     }
  }
  return retval;
} 

function OnlyAlphaCharactersExist(sValue) {
	var i=0;
	var sChar;

	do
	{
		sChar=sValue.substring(i,i+1);
		if (((sChar>="a") && (sChar<="z")) || ((sChar>="A") && (sChar<="Z"))) {
			return(true);
		}
		i++;
	}
	while (i<sValue.length);
	return(false);
}


function StrReplace(sString,sFind,sReplace,bIgnoreCase) {
	var oRegExp;
	var sResult;
	var sRegExp;
	
	sRegExp='/'+sFind+'/g';
	if (bIgnoreCase==true)
		sRegExp+='i';	
	oRegExp=eval(sRegExp);
	sResult=sString.replace(oRegExp,sReplace);
	return(sResult);
}

function StripIllegalChars(sQueryStr) {
	chars = new Array();
	chars[0] = "`";
	chars[1] = "~";
	chars[2] = "!";
	chars[3] = "@";
	chars[4] = "#";
	chars[5] = "$";
	chars[6] = "%";
	chars[7] = "^";
	chars[8] = "|";
	chars[9] = ";";
	chars[10] = ":";
	chars[11] = "\'";
	chars[12] = "\"";
	chars[13] = ",";
	chars[14] = "<";
	chars[15] = ">";
	chars[16] = "/";
	
	for(i=0;i<chars.length;i++){
		if(sQueryStr.indexOf(chars[i])!=-1){
			if(i==5 || i==7){
				sQueryStr=StrReplace(sQueryStr,'\\'+chars[i],""); //escape $ and ^ characters
			}
			else{
				sQueryStr=StrReplace(sQueryStr,chars[i],"");
			}
		}
	}
	return(sQueryStr);
}
//An: Dt :29175   StripIllegalChars modified has Journal entry should allow ,:;
function StripIllegalCharsJournal(sQueryStr) {
	chars = new Array();
	chars[0] = "`";
	chars[1] = "~";
	chars[2] = "!";
	chars[3] = "@";
	chars[4] = "#";
	chars[5] = "$";
	chars[6] = "%";
	chars[7] = "^";
	chars[8] = "|";
	chars[9] = "\'";
	chars[10] = "\"";
	chars[11] = "<";
	chars[12] = ">";
	chars[13] = "/";
	
	for(i=0;i<chars.length;i++){
		if(sQueryStr.indexOf(chars[i])!=-1){
			if(i==5 || i==7){
				sQueryStr=StrReplace(sQueryStr,'\\'+chars[i],""); //escape $ and ^ characters
			}
			else{
				sQueryStr=StrReplace(sQueryStr,chars[i],"");
			}
		}
	}
	return(sQueryStr);
}

function IsAnyAlphaCharactersExist(sValue, nStart) {
	var i;
	if (nStart > 0 )
		i=nStart;
	else
		i=0;
	var sChar;	
	if (sValue==null)
		return false;
	do
	{		
		sChar=sValue.substring(i,i+1);		
		if ((((sChar>="a") && (sChar<="z")) || ( (sChar>="A") && (sChar<="Z"))))
		{
			return true;
		}
		i++;
	}
	while (i<sValue.length);
	return false;
}




function IsPOBox(sAddress) {
	var oPOBox=new RegExp("P[.]O|P[.][ ]O|PO[ ][0-9]|P[ ]O|BOX[ ][0-9]|PO[ ]BOX|POBOX","i");
	var nFound=sAddress.search(oPOBox);
		
	if (nFound>=0) {
		return(true);
	}else
		return(false);	
}

function InvalidCharsInDate(sValue) {
	var i=0;
	var sChar;
	
	do{
		sChar=sValue.substring(i,i+1);
		if (!((sChar=="-") || (sChar=="/") || (sChar>="0" && sChar<="9"))) {
			return(true);
		}
		i++;	
	}
	while (i<sValue.length);
	return(false);
}

//Duplicate function - commented out
//function ValidEmailEmpty(sEmail)
//{
//	var i=0;
//	var checkAt;
//	var checkDot;
//	var sLen=sEmail.length;
//	if (sLen > 0) {
//		while (i<sLen)
//		{
//			if (sEmail.charAt(i) == "@")
//			{
//				checkAt=true;
//			}
//			if (sEmail.charAt(i) == ".")
//			{
//				checkDot=true;
//			}
//			if (checkAt==true && checkDot==true)
//			{
//				return(true);
//			}
//			i++;
//		}
//		return(false);
//	}
//	else {
//		return(true)
//	}
//}

//Duplicate function - commented out
//function ValidAddress(sAddress)
//{
//	var i=0;
//	var sLen=sAddress.length;
//	/*
//	while (i<sLen)
//	{
//		if (sAddress.charAt(i) == " ")
//		{
//			return(true);
//		}
//		i++;
//  }
//    */
//    if (sLen>=2)
//		return(true);
//    return(false);
//}

function ValidEmail(sEmail) {
	var i=0;
	var n;
	var checkAt;
	var dupAt;
	var checkDot;
	var dupDot;
	var InvalidChar;
	var sTemp;
	var sLen=sEmail.length;
	var vArr=new Array();

	if (sEmail.indexOf(";",0)>0) {
		vArr= sEmail.split(";");
	}
	else {
		vArr[0] = sEmail;
	}

	for (n=0;n<vArr.length;n++) {
		sLen=vArr[n].length;
		checkAt="";
		checkDot="";
		InvalidChar="";
		sTemp="";
		dupAt=0;
		dupDot=0;
		i=0;		
		
		while (i<sLen) {
			if (vArr[n].charAt(i) == "@") {
				checkAt=true;
				dupAt++;
			}
			else if (vArr[n].charAt(i) == ".") {
				checkDot=true;
				//dupDot++;
			}
			else {
				sTemp=sTemp + vArr[n].charAt(i)
			}
			i++;
		}
				
		InvalidChar=InvalidEmailCharactersExist(trim(sTemp));
		if (checkAt!=true || checkDot!=true || InvalidChar==true || dupAt>1 || dupDot>1) {
			return(false);
		}		
	}
    return(true);
}

function NumberExists(sString) {
	//var oRegExpTester = new RegExp("^(?=.*[0-9]+.*)");
	//return oRegExpTester.test(sString);
	var i=0;
	var sChar;
	do {
		sChar=sString.substring(i,i+1);
		if (sChar>="0" && sChar<="9")
		{
			return(true);
		}
		i++;	
	}
	while (i<sString.length);
	return(false);
}

function LetterExists(sString) {
	//var oRegExpTester = new RegExp("^(?=.*[a-zA-Z]+.*)");
	//return oRegExpTester.test(sString);
	var i=0;
	var sChar;
	do {
		sChar=sString.substring(i,i+1);
		if ((sChar>="A" && sChar<="Z") || (sChar>="a" && sChar<="z")) {
			return(true);
		}
		i++;	
	}
	while (i<sString.length);
	return(false);
}

/****************************************************************************
		AV Calculates Significant Digit - called on load futures page
****************************************************************************/ 

 function CalculateSignificantDigits(dblInc) {
		var intIncrement=0;
		var strIncrement="";		
		var sDecimalPart="";
		var iSigDigit=2;
		var bDecimalFound = false;
		if (dblInc > 0) {		
			strIncrement = dblInc;			
			for(i = 0;i< strIncrement.length;i++) {				
				if (strIncrement.charAt(i) == decimalPointDelimiter) {
					bDecimalFound = true;
					break;
				}
			}	
			if (bDecimalFound) {
				sDecimalPart = strIncrement.substring(i+1,eval(strIncrement.length));					
				iSigDigit = eval(sDecimalPart.length);	
			} else {
				iSigDigit = 2;
			}
		}
		else{
			iSigDigit = 2;
		}
		return iSigDigit;
	}

var ASX_PRICE_INC = "0.005";
var ASX_STOCK_INC = "0.001";
var ASX_OPTION_INC = "0.001";
var STOCK_INC = "0.01";
var OPTION_INC_LESS_THAN3  = "0.05";
var OPTION_INC_GREATER_THAN3 = "0.10";

//AV 1/12/2007 - Gets the option price increments from hidden variable in quote frame
function GetOptionPriceIncrements() {
	var oElement;
	var nFrameIndex = 0;
	//5.2
	oElement = document.getElementById("QviewQuoteOptionPriceInc");
	if(oElement!=null)
	{
		var sTemp;
		var aTemp;
		sTemp = oElement.value;
		if(sTemp != "" && sTemp.indexOf(',')!=-1)
		{
			aTemp = sTemp.split(",");
			if (aTemp[0] != "")
			{
				OPTION_INC_LESS_THAN3 = aTemp[0];
			}
			if (aTemp[1] != "")
			{
				OPTION_INC_GREATER_THAN3 = aTemp[1];
			}
		}
	}
	else
	{
		if (window.frames[0]!=null && window.frames[0].name !="qview_quote"){
			nFrameIndex = 1;
		}
		if(window.frames[nFrameIndex]!=null){
			if(window.frames[nFrameIndex].name=="qview_quote"){
				if(window.frames[nFrameIndex].document.frmQuoteBox!=null && window.frames[nFrameIndex].document.frmQuoteBox.txtOptionPriceIncrements!=null) {
					sIncrements = window.frames[nFrameIndex].document.frmQuoteBox.txtOptionPriceIncrements.value;
					if (sIncrements != "" && sIncrements.indexOf(',')!=-1){
						sOptionIncrements = sIncrements.split(",");
						if (sOptionIncrements[0] != ""){
							OPTION_INC_LESS_THAN3 = sOptionIncrements[0];
						}
						if (sOptionIncrements[1] != ""){
							OPTION_INC_GREATER_THAN3 = sOptionIncrements[1];
						}
					}
				}
			}
		}
	}
}

function CalculateIncrements(dblLimit,nSecTypeID,bIncDec) {
	var dblTickInc = STOCK_INC;
	OPTION_INC_LESS_THAN3  = "0.05";
	OPTION_INC_GREATER_THAN3 = "0.10";
		  if (eval(nSecTypeID) == 1 || eval(nSecTypeID) == 4 || eval(nSecTypeID) == 12 || eval(nSecTypeID) == 9) {
				dblTickInc = STOCK_INC; // Stock, Covered Call, Protective Put, Collar
				if ((document.forms[0].lstMarket != null && document.forms[0].lstMarket.selectedIndex == 1) || 
					 (document.forms[0].txtMarket != null && document.forms[0].txtMarket.value == 1)) {
						dblTickInc = ASX_STOCK_INC;
						if (dblLimit >= 0.1 && dblLimit <= 1.995) {
							dblTickInc = ASX_PRICE_INC;
						}
						else if(dblLimit >= 2) {
							dblTickInc = STOCK_INC;
						}
				}
			}
			else {				  
				 if (document.forms[0].lstMarket == null ||(document.forms[0].lstMarket != null && document.forms[0].lstMarket.selectedIndex == 0)){
					if(eval(nSecTypeID) == 2) {//option only 
						GetOptionPriceIncrements();
					}
				 }
				 dblTickInc = OPTION_INC_LESS_THAN3;
				 if ((document.forms[0].lstMarket == null ||(document.forms[0].lstMarket != null && document.forms[0].lstMarket.selectedIndex == 0))
					&& (eval(nSecTypeID) == 3 || eval(nSecTypeID) == 10 || eval(nSecTypeID) == 5 || eval(nSecTypeID) == 8 || eval(nSecTypeID) == 11)) {
					dblTickInc = STOCK_INC;
				 }	
				 else if ((dblLimit >3 && nSecTypeID == 2) || (bIncDec == true && dblLimit == 3) ) { //option only
					dblTickInc = OPTION_INC_GREATER_THAN3;
				 }
				 else if ((document.forms[0].lstMarket != null && document.forms[0].lstMarket.selectedIndex == 1) || 
					 (document.forms[0].txtMarket != null && document.forms[0].txtMarket.value == 1)) {
					dblTickInc = ASX_PRICE_INC;
					if (dblLimit >= 0.001 && dblLimit <= 0.009 && nSecTypeID == 2) {
						dblTickInc = ASX_OPTION_INC;
					}
				 }				 
			}
			return dblTickInc;
}
/****************************************************************
		AV Increments/Decrements value in text field.
****************************************************************/
function IncrementDecrement(frmCtrlPrice,dblTickInc,dblTickDenom,iPriceDisplayType,bIncDec,nSecTypeID,bIncDollar) {
		var  dblLimit=0;
		var dblIncrement=0;				
		var sTemp='';
		var dblLeftValue = 0;
		var dblRightValue = 0;
		var iSigDigit=2;

		if (frmCtrlPrice == null || frmCtrlPrice.disabled == true) {
			return;
		}
		if (eval(nSecTypeID) >= 1 && eval(nSecTypeID)!= 13) {	
			dblLimit = parseFloat(frmCtrlPrice.value);
			dblTickInc = CalculateIncrements(dblLimit,nSecTypeID,bIncDec);
		}	
		if (bIncDollar == true)
		{	dblTickInc=1.00		// DN:6/5/08 - Adding dollar increments for PM Requirements page.
		}
		iSigDigit = CalculateSignificantDigits(dblTickInc);		
		dblIncrement =  parseFloat(dblTickInc);			
		intIncrement = parseInt(dblTickInc);
		
		if (dblIncrement == intIncrement) {
			iSigDigit=2;
		}
		
		// AV 8/22/2005 - New Logic
	    if (iPriceDisplayType == 0) {			
				dblLimit = parseFloat(frmCtrlPrice.value);
				if (dblLimit < 0.01 && eval(nSecTypeID) != 13){					
					iSigDigit = CalculateSignificantDigits(frmCtrlPrice.value);					
				}
				if(dblLimit >=0 && dblIncrement > 0) {
					if (bIncDec) { //increment
						dblLimit = RoundToDecimalPlaces((dblLimit + dblIncrement),iSigDigit);
					} else if(dblLimit > 0) { //decrement
						dblLimit = RoundToDecimalPlaces((dblLimit - dblIncrement),iSigDigit);
					}
					frmCtrlPrice.value = dblLimit;
					frmCtrlPrice.focus();
					frmCtrlPrice.select();	
				}	
			
		} /***** FUTURES ONLY ********/
		else { // the tick is in the form 100-30.5 
			sTemp = frmCtrlPrice.value;
			if (sTemp.indexOf("-") <= 0 ){
				sTemp = parseFloat(sTemp);
				if (eval(sTemp) < 0){
					frmCtrlPrice.value = 0;
					frmCtrlPrice.focus();
					return;
				}
				sTemp = RoundToNearestTick(sTemp,dblTickDenom,dblTickInc);
				if (sTemp.indexOf("-") < 0){
					PromptFocus(frmCtrlPrice, "Please enter value in ticks only.");	
					return;
				}
			}
			dblLeftValue = parseFloat(sTemp.substring(0,sTemp.indexOf("-"))); // get the value to the left
			dblRightValue = parseFloat(sTemp.substring(sTemp.indexOf("-")+1)); // get the value to the right
			dblLimit = dblRightValue;
			if(dblLimit >=0 && dblIncrement > 0) {
				if (bIncDec) { //increment
					dblLimit = RoundToDecimalPlaces((dblLimit + dblIncrement),iSigDigit);
					dblRightValue = dblLimit;
					if (parseFloat(dblTickDenom) <= dblLimit) { 
						dblLeftValue = dblLeftValue + 1;
						dblRightValue = 0;
					}					
				}			
				else if((dblLeftValue == 0 && dblRightValue >0) || (dblLeftValue > 0 && dblRightValue >=0) ) { //decrement
					bDecLeftValue = false;
					if (dblLimit == 0) {
						dblLimit = dblTickDenom;
						bDecLeftValue = true;
					}
					dblLimit = RoundToDecimalPlaces((dblLimit - dblIncrement),iSigDigit);
					dblRightValue = dblLimit;
					if (parseFloat(dblTickDenom) <= dblLimit) {
						dblLeftValue = dblLeftValue - 1;
						dblRightValue =0;
					} else if(bDecLeftValue) {
						dblLeftValue = dblLeftValue - 1;
					}
				}

				frmCtrlPrice.value = dblLeftValue + "-" + dblRightValue;
				frmCtrlPrice.focus();
				frmCtrlPrice.select();	
			}
		}
}

/** Support for ticks on futures  - In Sync with VB code **/
function RoundToNearestTick(dPrice,dDenominator,dMintick) {
	sPriceInTicks = CDblToTick(dPrice,dDenominator);
	
	nPos = sPriceInTicks.indexOf("-");
	if (nPos < 1) {
        return dPrice;        
    }
    dWhole = parseFloat(sPriceInTicks.substring(0, nPos));
    dFraction = parseFloat(sPriceInTicks.substring(nPos + 1,sPriceInTicks.length));
	if (dMintick <= 0)
	{
		return dPrice;
	}
    dMinTickDenom = 1 / dMintick;
	if (dMinTickDenom <= 0)
	{
		return dPrice;
	}
    dTickSize = eval(dDenominator / dMinTickDenom);
    nTickWhole = parseInt(dFraction);
    dTickFraction = eval(dFraction - nTickWhole);
    dRemainder = dTickFraction;
    dTickHalf = eval(dTickSize / 2);     	
	while (dRemainder - dTickSize >= 0){
		 dRemainder = eval(dRemainder - dTickSize);
	}
    
    if(dRemainder >= dTickHalf) {
        dTickFraction =eval(dTickFraction + dTickSize);
    }
    
    dTickFraction = eval(dTickFraction - dRemainder);
    dFraction = eval(nTickWhole + dTickFraction);	

	while (dFraction >= dDenominator){
		dWhole = dWhole + 1;
        dFraction = eval(dFraction - dDenominator);
	}
    sPriceInTicks = dWhole + "-" + dFraction;
	return sPriceInTicks;

}

function CDblToTick(dPrice,dDenominator){
	
	nWhole = parseInt(dPrice);
	if (dPrice < 0){
		nWhole = nWhole + 1;
	}
	dFraction = dPrice - nWhole;
    dNumerator = dFraction * dDenominator;
	if(nWhole < 0) {
       nWhole = nWhole * -1;
	}
    
    if(dNumerator < 0){
        dNumerator = dNumerator * -1;
    }
    
    if(dPrice < 0) {
        sDblToTick = "-" + nWhole  +  "-" + dNumerator;
	}
    else{
        sDblToTick = nWhole + "-"  + dNumerator;
    }
    return sDblToTick;
}

function CTickToDouble(sNumber,dDenominator){	
	var sWhole;	var sFraction;	var sTemp;var nPos = sNumber.indexOf("-");	
		sWhole = String(sNumber).substring(0,nPos)		
		sFraction = String(sNumber).substring(nPos+1,sNumber.length);			
	if (nPos < 1){			
		 CTickToDbl = sNumber;		
	}else if(nPos == 1){
		CTickToDbl = Number(sWhole);
	}else{			
		sTemp = Number(sFraction / dDenominator);		
		CTickToDbl = Number(sWhole) + Number(sTemp)			
	} 			
	return CTickToDbl;		
}

function CheckScriptInjection(sString) {
	sString=trim(sString).toLowerCase();
	
	if (sString.indexOf("<script",0) != -1) {
		return ('Invalid string');
	} else if (sString.indexOf("</script>",0) != -1) {
		return ('Invalid string');
	}		
	else {
		return("");
	}
}

//Returns true if the text control's value is safe; false if contains potential injection
function CheckScriptAndSQLInjection(oTextControl, bCheckScript, bCheckSQL) {
	var sValue = oTextControl.value;
	var bContainsScript = false;
	var bContainsSQL = false;
	var bSuccessful = true;

	if (bCheckScript) {
		bContainsScript = ContainsScriptInjection(sValue);
	}

	if (bCheckSQL) {
		bContainsSQL = ContainsSQLInjection(sValue);
	}

	if (bContainsScript || bContainsSQL) {
		PromptFocus(oTextControl, "Unsafe value entered.");
		bSuccessful = false;
	}

	return bSuccessful;
}

function ContainsScriptInjection(sString) {
	sString=trim(sString).toLowerCase();
	
	if (sString.indexOf("<script",0) != -1) {
		return true;
	} else if (sString.indexOf("</script>",0) != -1) {
		return true;
	}		
	else {
		return false;
	}
}

function ContainsSQLInjection(sString) {
	var a = new Array();
	a[0] = "select";
	a[1] = "insert";
	a[2] = "update";
	a[3] = "delete";
	a[4] = "drop";
	a[5] = "alter";
	a[6] = "'";
	
	return StringContainsAnyValue(sString, a);
}

function StringContainsAnyValue(sString, asValues) {
	var sLowerString = sString.toLowerCase();
	for (var iString = 0; iString < asValues.length; iString++) {
		if (sLowerString.indexOf(asValues[iString].toLowerCase()) != -1) {
			return true;
		}
	}
	return false;
}

/****************************************************************
		AV Rounds to the specified number of decimal places.
****************************************************************/	
function RoundToDecimalPlaces(X, N) {
		var T= 	Number('1e'+N);
  		return Math.round(X*T)/T; 
}

//AV 12/9/2005 - Checks if a Valid Future display symbol is entered
function IsFutureDisplay(sSymbol) {
    var nLen;
    var sYearDigit;
    var sMonthCode;
    
    nLen = sSymbol.length;
    
    if(nLen < 3) {
		return false;
	}
 	//check if expiration year > 2009
	if (isInteger(sSymbol.substring(nLen-2, nLen))){	
		sYearDigit = sSymbol.substring(nLen-2, nLen);		
		sMonthCode =  sSymbol.substring(nLen-3, nLen-2).toUpperCase();		
	}else{
		sYearDigit = sSymbol.substring(nLen-1, nLen);
		sMonthCode =  sSymbol.substring(nLen-2, nLen-1).toUpperCase();		
	}

    if( (sMonthCode == "F" || sMonthCode == "G" || sMonthCode == "H" || 
        sMonthCode == "J" || sMonthCode == "K" || sMonthCode == "M" || 
        sMonthCode == "N" || sMonthCode == "Q" || sMonthCode == "U" || 
        sMonthCode == "V" || sMonthCode == "X" || sMonthCode == "Z") && isInteger(sYearDigit) ){
       return true;	   
	}
    else {
       return false;
	}
}

//DS 12/15/2008 - Checks if passed symbol is in Valid ACTIV format 
function IsFutureActiv(sSymbol){
	if(sSymbol==null)return sSymbol;
	var sMonthList = 'FGHJKMNQUVXZ';
	var sExpYear='';
	var sExpMonth='';
	var nPos = sSymbol.indexOf('/');
	if (nPos==-1) return false;	
	if(nPos > 0 && sSymbol.length == nPos + 4){
		var sRootSymbol = sSymbol.substr(0, nPos)
		var sExpMonth = sSymbol.substr(nPos + 3, 1);

		if( (isInteger(sSymbol.substr(nPos + 1, 2))) && (sSymbol.substr(nPos + 1, 1)!='0') ){
			sExpYear = parseInt(sSymbol.substr(nPos + 1, 2));
		}else{
			sExpYear = sSymbol.substr(nPos + 2, 1);
		}
		if (sRootSymbol=='' || sExpMonth=='' || sExpYear=='' || sExpYear=='0') {return false;}		
		if (sMonthList.indexOf(sExpMonth, 0) == -1){return false;}
		if (!(IsNumeric(sExpYear))){return false;}
		return true;		
	}
	return false;
}

function IsFutureOptionDisplay(sSymbol) {
    var nLen;   
    var sCallPut;
    var sTemp;	  
    nLen = sSymbol.length;
    if(nLen < 2) {
		return false;
	}
	sTemp = sSymbol.charAt(nLen-2);
	if(isNaN(parseInt(sTemp)))
	{
		return false;
	}
	sCallPut =sSymbol.charAt(nLen-1);	
      if (sCallPut == "P" || sCallPut == "C" || sCallPut == "c" || sCallPut == "p" ) {
       return true;
	}
    else {
       return false;
	}
}

//SB 08/22/2006 Refined the SSN validation and based then on account entities. Will make sure
//that SSN is consistently validated on different pages in the new account process and broker
function HasValidSSN(valSSN,accntentity){
	var fullSSN;
	var splitSSN;
	var ssn1;
	var ssn2;
	var ssn3;
	var validSSN;
	fullSSN = valSSN;
	validSSN = true;
	splitSSN = fullSSN.split("-");
	if(accntentity != "crp" && accntentity != "prt" && accntentity !="prt/clb"){
		if(accntentity.substring(0,3) == "trs"){
			if (!((valSSN.charAt(3)=="-" && valSSN.charAt(6)=="-")||
				   (valSSN.charAt(2)=="-"))){
				return false;
			}
		}
		else{
			if (!(valSSN.charAt(3)=="-" && valSSN.charAt(6)=="-")){
				return false;
			}
		}
		ssn1 = splitSSN[0];
		ssn2 = splitSSN[1];
		ssn3 = splitSSN[2];
		if ((ssn1.length!=3)||(ssn2.length!=2)||(ssn3.length!=4)) {
			validSSN = false;
		}
		if ((!isInteger(ssn1)) || (!isInteger(ssn2)) ||(!isInteger(ssn3))){
			validSSN = false;
		}
		if(!validSSN && accntentity.substring(0,3) == "trs"){
			if(CheckTaxIDFormat(valSSN)){
				validSSN = true;
			}
			else{
				validSSN = false;
			}
		}
		return validSSN;
	}
	else {
		if (!(valSSN.charAt(2)=="-")){
			return false;
		}
		if(CheckTaxIDFormat(valSSN)){
			return true;
		}
		else{
			return false;
		}
	}
}

function CheckTaxIDFormat(valSSN){
	var fullSSN;
	var splitSSN;
	var ssn1;
	var ssn2;
	var ssn3;
	var validSSN;
	fullSSN = valSSN;
	splitSSN = fullSSN.split("-");
	ssn1 = splitSSN[0];
	ssn2 = splitSSN[1];		
	if ((ssn1.length!=2)||(ssn2.length!=7)) {
		return false;
	}
	if ((!isInteger(ssn1)) || (!isInteger(ssn2))){
		return false;	
	}
	else{
		return true;
	}
}

function GetParamValue(sParam) 
{
	var sQueryString=location.search.substring(1);
	var aQueryStringVars=sQueryString.split("&");
	var i;
	var sValue='';
	//var rExp = /%20/gi
	for (var i=0; i<aQueryStringVars.length; i++)
	{	
		var nPos=aQueryStringVars[i].indexOf('=');
		var sParamName=aQueryStringVars[i].substring(0,nPos);
			
		if ((nPos==-1) || (sParamName.toLowerCase()!=sParam.toLowerCase())) continue;
		sValue = aQueryStringVars[i].substring(nPos+1);
		//sValue = trim(sValue.replace(rExp," "));
		i = sValue.indexOf("%20");
		while(i>0){
			sValue = trim(sValue.replace("%20"," "));
			i = sValue.indexOf("%20");
		}
		break;
	}
	if(sParam == "FIRST_NAME"){
		sValue = sValue.substring(0,15);
	}
	else if(sParam == "LAST_NAME"){
		sValue = sValue.substring(0,15);
	}
	else if(sParam == "EMAIL"){
		sValue = sValue.substring(0,256);
	}
	return sValue;
}

function CFutDisplayToActiv(sSymbol,bOldDisplay){
	var nLen, nExpYear, sMonthCode, sRoot, sRet;
	nLen = sSymbol.length;

	//check if expiration year > 2009
	if (isInteger(sSymbol.substring(nLen-2, nLen))){	
		sRoot = Left(sSymbol, nLen - 3);
		nExpYear = Right(sSymbol, 2);
		sMonthCode = sSymbol.substr(nLen - 3, 1);
	}else{
		sRoot = Left(sSymbol, nLen - 2);
		nExpYear = Right(sSymbol, 1);
		sMonthCode = sSymbol.substr(nLen - 2, 1);		
	}	
	sRet = sRoot;
	if(bOldDisplay!=true){sRet=sRet + "/";}
	if(nExpYear < 10){sRet=sRet + "0";}
	sRet=sRet + nExpYear + sMonthCode;	
	return sRet;
}
function ValidateName(sValue){
	var i=0;
	var sChar;
	do {
		sChar=sValue.substring(i,i+1);
		if(sChar == "*" || sChar == "\\" || sChar == "^"){
			return(false);
		}
		i++;
	}
	while (i<sValue.length);
	return(true);
}
function GetFutureOptionSymbolUnderlyingRoot(sSymbol) {

    var nLen, iIndex, iPos;   
    var sCallPut;
    var sTemp;	  
	
    nLen = sSymbol.length;
    if(nLen < 2) {return '';}
	sTemp = sSymbol.charAt(nLen-2);
	if(isNaN(parseInt(sTemp))){return '';}
	sCallPut =sSymbol.charAt(nLen-1);		
    if (sCallPut != "P" && sCallPut != "C" ) {return '';}    

	for(var iIndex=0; iIndex<nLen; iIndex++){
		sChar=sSymbol.charAt(iIndex);
		if (isInteger(sChar)) {  // get the first digit starting from left			
			if (IsValidFutureMonthCode(sSymbol.charAt(iIndex-1))){ // check if char before is future month. If yes, the prefix is root symbol
				return  sSymbol.substr(0, iIndex-1);		
			}
		}
	}	
	return '';	
}
function IsValidFutureMonthCode(sMonthCode){
    if( sMonthCode == "F" || sMonthCode == "G" || sMonthCode == "H" || 
        sMonthCode == "J" || sMonthCode == "K" || sMonthCode == "M" || 
        sMonthCode == "N" || sMonthCode == "Q" || sMonthCode == "U" || 
        sMonthCode == "V" || sMonthCode == "X" || sMonthCode == "Z"){
       
		return true;	   
	}else {
       return false;
	}
}

function TildeFormatEncodeStringArray(sStringArray)
{
	var i;
	var s = "";
	if(sStringArray.length > 0)
	{
		s+=TildeFormatEncodeString(sStringArray[0]);
		for(i=1; i<sStringArray.length; i++)
		{
			s+="~";
			s+=TildeFormatEncodeString(sStringArray[i]);
		}
	}
	return s;
}

function TildeFormatEncodeString(sString)
{
	var i;
	var c;
	var s = "";
	var t;
	for(i=0;i<sString.length;i++)
	{
		c = sString.charCodeAt(i);
		if((c>=48 && c<=57)||(c>=65 && c<=90)||(c>=97 && c<=122))
		{
			s+=String.fromCharCode(c);
		}
		else if(c==32)
		{
			s+=String.fromCharCode(45);
		}
		else
		{
			if(c < 256)
			{
				t = c.toString(16);
				if(t.length == 1)
				{
					t = "0" + t;
				}
				t = "." + t;
				s+=t;
			}
			else
			{
				t = c.toString(16);
				if(t.length < 4)
				{
					switch(4-t.length)
					{
						case 3:
							t = "0" + t;
						case 2:
							t = "0" + t;
						case 1:
							t = "0" + t;
						default:
							break;
					}
				}
				t = "_" + t;
				s+=t;
			}
		}
	}
	return s;
}

function TildeFormatDecodeStringToArray(sString)
{
	var oInArray;
	var oOutArray = new Array();
	var i;
	oInArray = sString.split("~");
	for(i=0;i<oInArray.length;i++)
	{
		oOutArray.push(TildeFormatDecodeStringToString(oInArray[i]));
	}
	return oOutArray;
}

function TildeFormatDecodeStringToString(sString)
{
	var i = 0;
	var c;
	var s = "";
	var t;
	var oCodes = new Array();
	while(i < sString.length)
	{
		c = sString.charCodeAt(i);
		if((c>=48 && c<=57)||(c>=65 && c<=90)||(c>=97 && c<=122))
		{
			oCodes.push(c);
		}
		else if(c==45)
		{
			oCodes.push(32);
		}
		else if(c=="_".charCodeAt(0))
		{
			if(i+4<sString.length)
			{
				t = sString.substring(i+1, i+5);
				i+=4;
				oCodes.push(parseInt(t, 16));
			}
		}
		else if(c==".".charCodeAt(0))
		{
			if(i+2<sString.length)
			{
				t = sString.substring(i+1, i+3);
				i+=2;
				oCodes.push(parseInt(t, 16));
			}
		}
		i++;
	}
	if(oCodes.length==0)return "";
	t = oCodes[0].toString();
	for(i=1;i<oCodes.length;i++)
	{
		t = t + "," + oCodes[i].toString();
	}
	s = eval("String.fromCharCode(" + t + ");");
	return s;
}




/* Include headbanners.js */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/headbanners.js\"></script>";		
//document.write(s);
/* 	
	Purpose:	This function displays the random header banners on the site.
	Created by: Shawn Roser
	Date: 		3/4/2004
*/

function GetRandomImage() {

	var s=GetSessionID();
	var sString;
	var bException="False";
	var bException1="False";
	
// SV 5/16/08 cdn_path is the url of the akamai servers. this checks to see if the cdn_path is defined on the page, and if not assignes it a value of null
try {
	if(cdn_path) {
		// do nothing
	} 
} catch(e) {
	cdn_path = '';
}
	
/*
DM 6/29/05 Don't show some banners for Singapore.
Keep unshared banners at bottom of list.
Make random number lower so you don't select unshared banners.
*/
	var f = getFirmType();

	if(f != "OX"){
		var nRandNumber = Math.floor(Math.random()*10);
	} else {
		var nRandNumber = Math.floor(Math.random()*15);
	}
	
	if (f != "SN" && nRandNumber == 9) {
		nRandNumber = Math.floor(Math.random()*8);
	}
	//alert(nRandNumber);
	var Segment1 = new Array (
		'/images/headbanners/41.gif',
		'/images/headbanners/2.gif',
		'/images/headbanners/8.gif',
		'/images/headbanners/23.gif',
		'/images/headbanners/26.gif',
		'/images/headbanners/27.gif',
		'/images/headbanners/29.gif',
		'/images/headbanners/32.gif',
		'/images/headbanners/35.gif',
		'/images/headbanners/38.gif',
		'/images/headbanners/25.gif',
		'/images/headbanners/1.gif',
		'/images/headbanners/36.gif',
		'/images/headbanners/37.gif',
		'/images/headbanners/40.gif'
		);

	if (s=="0") {
		var SegmentHref1 = new Array(
			"/welcome/tour/account/refer.aspx?s=hdr_refer",
			"/welcome/tour/quotes/dragon.aspx?s=hdr_dragon",
			"/welcome/tour/educate/xguides.aspx?s=hdr_xguides",
			"/welcome/tour/educate/webinars.aspx?s=hdr_webex",
			"/welcome/tour/quotes/virtual.aspx?s=hdr_vt",
			"/welcome/tour/quotes/morningstar.aspx?s=hdr_ms",
			"/welcome/tour/quotes/patterns.aspx?s=hdr_pat",
			"/welcome/tour/quotes/virtual.aspx?s=hdr_vtfut",
			"/educate/seminars.aspx?s=hdr_live",
			"/welcome/faq/checks.aspx?s=hdr_sgd",
			"/welcome/tour/quotes/toolbar.aspx?s=hdr_tlbr",
			"/welcome/tour/trade/wireless.aspx?s=hdr_wow",
			"/welcome/tour/trade/futures.aspx?s=hdr_fut",
			"/welcome/tour/trade/futures.aspx?s=hdr_fut2",
			"/promos/snapcharts.aspx?s=hdr_snap"
			);
	} else {
		var SegmentHref1 = new Array(
			"/oxnetaccnt/account/referral.aspx?s=hdr_refer&amp;sessionid=" + s,
			"/toolbox_dragon.asp?page_id=check_disclaim&amp;s=hdr_dragon&amp;sessionid=" + s,
			"/educate/xguides/index.aspx?s=hdr_xguides&amp;sessionid=" + s,
			"/help/webinars.aspx?s=hdr_webex&amp;sessionid=" + s,
			"/paper_trading.asp?s=hdr_vt&amp;sessionid=" + s,
			"/welcome/tour/quotes/morningstar.aspx?s=hdr_ms&amp;sessionid=" + s,
			"/trade/patterns/results.asp?s=hdr_pat&amp;sessionid=" + s + "&amp;symbol=QQQQ&amp;level=5",
			"/paper_trading.asp?s=hdr_vtfut&amp;sessionid=" + s,
			"/educate/seminars.aspx?s=hdr_live&amp;sessionid=" + s,
			"/welcome/faq/checks.aspx?s=hdr_live&amp;sessionid=" + s,
			"/toolbox/toolbar/index.aspx?s=hdr_tlbr&amp;sessionid=" + s,
			"/welcome/tour/trade/wireless.aspx?s=hdr_wow&amp;sessionid=" + s,
			"/oxnetaccnt/trade/futures.aspx?page_id=trade&sec_type_id=13&amp;s=hdr_fut&amp;sessionid=" + s,
			"/oxnetaccnt/trade/futures.aspx?page_id=trade&sec_type_id=13&amp;s=hdr_fut2&amp;sessionid=" + s,
			"/oxnettools/charts/snapcharts.aspx?s=hdr_snap&amp;sessionid=" + s
			);           
	}

if (document.location.pathname == "/welcome_hdr.htm" || document.location.pathname == "/educate_hdr.htm"  || document.location.pathname == "/thepit_topframe.htm"  || document.location.pathname == "/Order_Support.asp"  || document.location.pathname == "/account_hdr.htm" || document.location.pathname == "/help/header.aspx"  || document.location.pathname == "/welcome/header.aspx"  || document.location.pathname == "/educate/header.aspx" || document.location.pathname == "/OXNetAccnt/account/tax/gk/frame.aspx") {
		if (parent.location.pathname=="/frame_welcome.asp" || parent.location.pathname=="//frame_welcome.asp") {
			bException="True";
		}
		if (parent.location.pathname=="/educate_bookstore.asp" || parent.location.pathname=="//educate_bookstore.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/educate/frame.aspx" || parent.location.pathname=="//educate/frame.aspx") {
			bException1="True";
		}
		if (parent.location.pathname=="/commentary.asp" || parent.location.pathname=="//commentary.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/thepit_numbers.asp" || parent.location.pathname=="//thepit_numbers.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/frame_trade.asp" || parent.location.pathname=="//frame_trade.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/account_frame.asp" || parent.location.pathname=="//account_frame.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/educate/frame.asp" || parent.location.pathname=="//educate/frame.asp") {
			bException1="True";
		}
		if (parent.location.pathname=="/help/frame.aspx" || parent.location.pathname=="//help/frame.aspx") {
			bException1="True";
		}
		if (parent.location.pathname=="/welcome/frame.aspx" || parent.location.pathname=="//welcome/frame.aspx") {
			bException1="True";
		}		
		if (parent.location.pathname=="/trade/bond_frame.aspx" || parent.location.pathname=="//trade/bond_frame.aspx") {
			bException1="True";
		}				
	}

if(document.getElementById('pg_tax')){
	bException1="True";
}

	if (window.parent!=window) {
		if (bException=="True" || bException1=="True") {
			sString='<a href="' + SegmentHref1[nRandNumber] + '" target="_parent" onfocus="this.blur();" class="noHover"><img src="' + cdn_path + Segment1[nRandNumber] + '" alt="Click Here"></a>';
		} else {
			sString='<a href="' + SegmentHref1[nRandNumber] + '" onfocus="this.blur();" class="noHover"><img src="' + cdn_path + Segment1[nRandNumber] + '" alt="Click Here"></a>';
			}	
		} else {
		sString='<a href="' + SegmentHref1[nRandNumber] + '" onfocus="this.blur();" class="noHover"><img src="' + cdn_path + Segment1[nRandNumber] + '" alt="Click Here"></a>';	
		}
	document.write (sString);
}

function AlertManagerPopup()
{
	var s=GetSessionID();
	
	if (document.getElementById('divAMAlert'))
	{
		document.getElementById('divAMAlert').style.display = "none";
	}	
	OpenChildWindowSizeable('/OXNetTools/AlertManager/popup.aspx?SessionID=' + s,'AlertManagerPopup','650','400');
}



/* Include append_session.js */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/append_session.js\"></script>";		
//document.write(s);
/* 	
	Purpose:	Removed these two functions from general.js.  The "Text" version is here because of Virtual Trading.  Both functions handle retaining the session and re-directs when there isn't a session.
	Created by: Shawn Roser
	Date: 		8/27/2004
*/
// SV 5/16/08 cdn_path is the url of the akamai servers. this checks to see if the cdn_path is defined on the page, and if not assignes it a value of null
try {
	if(cdn_path) {
		// do nothing
	} 
} catch(e) {
	cdn_path = '';
}
//**************************************
var imgLogout = new Image();
imgLogout.src= cdn_path + "/images/welcome/home/log_out.gif";

var nAccount = new Image();
nAccount.src= cdn_path + "/images/welcome/home/open_account_2.gif"; //"open another account" image

function hover(){
	this.style.textDecoration="underline";
}

function hoverOut(){
	this.style.textDecoration="none";
}

function LoginOrLogoff(htmlImage) {

	var links = document.getElementsByTagName('A');
	for(i=0;i<links.length;i++){
		if(links[i].getElementsByTagName('img')){
			var images=links[i].getElementsByTagName('img');
			for(j=0;j<images.length;j++){
				if(links[i].className!='oneday' && links[i].className!='PLinfo' && links[i].className!='info' && links[i].className!='chk' && links[i].className!='bubbleCl'&& links[i].className!='dock-item2' && links[i].className!='dock-item' && links[i].className!='pattern'){
					links[i].style.background='transparent';
					links[i].onmouseover=hover;
					links[i].onmouseout=hoverOut;
				}
			}
		}
	}

	var s = GetSessionID() ;
	if (s=='0') {
		if (window.document[0]!=null)
			if (window.document[0].txtSessionID !=null)
				s = window.document[0].txtSessionID.value;
	}

	if (s=='') {
		s='0';
	}
	
	resizeHeader(); //reset header to match page size - function in general.js

	var d=window.document;
	//input: html image src
	//image src must have id
	//when call this function must 
	//specify id(login): ex LoginOrLogoff(document.login);

	var tdFlag = 0;	

	if (s != '0') { 
		if(document.getElementById('header')){
			var myInput = document.getElementById('header').getElementsByTagName('INPUT');
			for(i=0;i<myInput.length;i++){
				if(myInput[i].name=='txtTestDriveH' && myInput[i].value=='true'){
					var tdFlag = 1;
				}
			}
		}

		if(tdFlag==1){
			if (document.images.newAccount) {
				document.images.newAccount.src= "/images/welcome/home/open_account_3.gif"; //"complete your account" image
				document.images.newAccount.parentNode.href='javascript:RemoveFrames("/new_account.asp?sessionid='+GetSessionID()+'")';
				document.images.newAccount.alt= "Complete Your Account";
				document.images.newAccount.style.width='160px';
			} else {
				$('#header #utility-navigation li.open-account a').css('background-position', '-413px -113px').attr('href', 'javascript:RemoveFrames("/new_account.asp?sessionid='+GetSessionID()+'");');
			};
			
		}else{
			if (htmlImage != null){
			    htmlImage.src=imgLogout.src;
				if(document.newAccount){
					document.newAccount.src=nAccount.src;
					document.newAccount.alt="Open Another Account";
					document.newAccount.style.width='135px';  //resize "open another account" image
				}
				for (var i=0; i<d.links.length; i++) {
					if (d.links[i].href.toLowerCase().indexOf("login.asp",0)!=-1){
						d.links[i].href="javascript:AppendSessionID('/login.asp?v=0')";
						break;
					}
				}
			}
		}
	}
}


//Duplicate - commented out
//function resizeHeader(){
//	var oElement;
//	if(document.getElementById('mainTable')){
//		var a = document.getElementById('mainTable');
//		var mt = parseInt(a.scrollWidth);
//		var lmt = parseInt(a.offsetLeft);
//	}
//	if(document.getElementById('content')){	
//		var b = document.getElementById('content').clientWidth;
//	}
//
//	subArray = new Array();
//	subArray[0] = "welcome";
//	subArray[1] = "account";
//	subArray[2] = "trade";
//	subArray[3] = "quotes";
//	subArray[4] = "toolbox";
//	subArray[5] = "educate";
//	subArray[6] = "help";
//	
//	if(document.getElementById('sidebar')){
//		var c = document.getElementById('sidebar').clientWidth;
//		var x = b+c;
//	}
///	else{
//		var x = b;
//	}
//	
//	try{	
//	    if(parent.frames[0] && window.name == 'main'){
//		    if(parent.frames[0].document.getElementById('spSiteStyleAlignment')){
//			    if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0]){
//				    var cSize = parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
//				    if(cSize){
//					    if(cSize.indexOf('_sm')!=-1 && x >=700){
//						    var smResize = true;
//					    }
//				    }
//			    }
///		    }
//	    }
//	}
//	    catch(e){
//  }
//		
//	if(x >= 835 || smResize == true){ 
//		var y = document.body.clientWidth;
//		oElement = document.getElementById('header_table');
//		if(oElement!=null)
//		{
//			oElement.style.width = x+'px';
//		}
//	
//		oElement = document.getElementById('header_wrapper');
//		if(oElement!=null)
//		{
//			oElement.style.width = x+'px';
//		}
//
//		for(i=0;i<subArray.length;i++){
//			oElement = document.getElementById('sub_'+subArray[i]);
//			if(oElement!=null)
//			{
//				oElement.style.width = x-13+'px';
//			}
//		}
//		if(document.getElementById('footer')){
//			document.getElementById('footer').style.width = x+'px';
//		}
//		if(document.getElementById('Footer')){
//			document.getElementById('Footer').style.width = x +'px';	
//		}
//		if(document.getElementById('mainTable')){
//			document.getElementById('mainTable').style.width = x +'px';
//		}
//	}
//}

//consolidated check for "?" function and get pageID from URL
function qIndex(url,getSPage){
	var indexValue = url.indexOf('?');
	if(getSPage != null){ //pass any value for getSPage to find page name, leave empty to return '?' index value		
		if (indexValue!=-1) {
			var sQueryString=url.substr(indexValue+1);
			var aQueryStringVars=sQueryString.split("&");
						
			for (var i=0; i<aQueryStringVars.length; i++) {
				var nPos=aQueryStringVars[i].indexOf('=');
				var sParamName=aQueryStringVars[i].substring(0,nPos);
				if ((nPos==-1) || (sParamName.toLowerCase()=='pageid') || (sParamName.toLowerCase()=='page_id') || (sParamName.toLowerCase()=='url') || (sParamName.toLowerCase()=='index') || (sParamName.toLowerCase()=='lstindex') || (sParamName.toLowerCase()=='page') || (sParamName.toLowerCase()=='lstviewtype')){ 
					var sPage=aQueryStringVars[i].substring(nPos+1);
				}
				if ((nPos==-1) || (sParamName.toLowerCase()=='sec_type_id')){
					var sSecTypeID=aQueryStringVars[i].substring(nPos+1);
					return sSecTypeID;
				}				
			}
		}
		return sPage;
	}
	else{
		return indexValue;
	}
}

function GetSessionID() {  //onsite version
	var sSessionID='0';
	var sQueryString=location.search.substring(1);
	var aQueryStringVars=sQueryString.split("&");

	for (var i=0; i<aQueryStringVars.length; i++){
		var nPos=aQueryStringVars[i].indexOf('=');
		var sParamName=aQueryStringVars[i].substring(0,nPos);
			
		if ((nPos==-1) || (sParamName.toLowerCase()!='sessionid')) continue;
		sSessionID=aQueryStringVars[i].substring(nPos+1);
		if (sSessionID==''){
			sSessionID='0';
		}
			break;
		}
		return sSessionID;
}

function GetSessionIDText(frmName) {  //paper trade version
	var sSessionID='0';
	var sSessionText='document.' + frmName + '.txtSessionID.value';
	sSessionID=eval(sSessionText);
	return sSessionID;
}

//**************************************
// bLinkToParentWnd - Used by detached windows to point the link to parent window
function AppendSessionID(sURL, bLinkToParentWnd) {  //onsite version

	if(sURL.indexOf('http:')==0){
	sURL2 = sURL.substring(sURL.indexOf('//')+2);
	sURL = sURL2.substring(sURL2.indexOf('/'));
	}
	var sAppendChar='&';
	var nLastSlash=location.pathname.lastIndexOf('/');
	var sPath=location.pathname.substring(0, nLastSlash+1);
	var sPathName=window.location.pathname;
	var sSessionID=GetSessionID();
	var f=$.fn.firmType();

	if (qIndex(sURL)==-1)
		sAppendChar='?';
		
	var oLocalMode=new RegExp("oxwaccnt","i"); 
	var nDebugOverride=sPathName.search(oLocalMode);
	
	var oLogin=new RegExp("login.asp|/login.asp","i");
	var nLogin=sURL.search(oLogin);	
	//window.alert(sSessionID);
	if (sSessionID=='0' && nLogin==-1){		
		var sURLLowercase=sURL.toLowerCase();
		var nEndOfASP=sURLLowercase.indexOf('.asp');
		if (nEndOfASP==-1) {
			nEndOfASP=sURLLowercase.indexOf('.aspx');
		}
		
		var sASPage='';
		var sDotNetPage='';	
		sDotNetPage=sURLLowercase.substring(1,11)	// Checks to see if page has 'oxnetaccnt' in the path.  If so, it's a .net page
	
		//put educate sections behind login - dm 8/30/04
		var dirPath = sURL.substring(0,sURL.lastIndexOf('/'));
		switch(dirPath) {
			case "/educate/strategies":
				sURL="/welcome/tour/educate/strategies.aspx";
				break;
			case "/educate/xguides":
				sURL="/welcome/tour/educate/xguides.aspx";
				break;
			case "/educate/advanced":
				sURL="/welcome/tour/educate/strategies.aspx";
				break;
		}

		if (nEndOfASP!=-1) {
			// Checks to see if the first character in the filename is a slash.
			// Also strips out the "?" so files can re-direct correctly. SPR 5/20/04
			if (sURLLowercase.charAt(0)=='/') {	// If there is a slash, strip the slash out.
				var nQuestionMark=qIndex(sURLLowercase);
				if ((nQuestionMark==-1)) {
					sASPage=sURLLowercase.substring(1,nEndOfASP+5);	// For .aspx pages.
				} else if (sDotNetPage=="oxnetaccnt" || sDotNetPage=="oxnettools") {	// .net pages
					sASPage=sURLLowercase.substring(1,nEndOfASP+5);
				} else {
					sASPage=sURLLowercase.substring(1,nEndOfASP+4);	// For .asp pages.
				}
			} else {	// If there is no slash, don't trim the filename.
				sASPage=sURLLowercase.substring(0,nEndOfASP+4);
			}

			switch (sASPage) {
				case "new_account.asp":
					// SPR: This slash check is because of the welcome_cobrand.htm page which includes an asid number in the query string
					// We need to keep the query string in the url intact, while only having one slash in the url.
					if (sURL.charAt(0)=='/') {	// If there is a slash, strip the slash out. 
						sURL=sURL.substring(1,99);	// Ending at the 99th character, just for kicks.
					} else {	// If there is no slash, don't trim the filename.
						sURL=sURL.substring(0,99);
					}					
					sURL='https://' + location.host + '/' + sURL;					
					if (f=="CA") {
						if (qIndex(sURL)==-1) {
							sURL=sURL + '?txtCountryID=43';
						}
						else {
							sURL=sURL + '&txtCountryID=43';
						}
					}
					else if (f=="SN") {
						if (qIndex(sURL)==-1) {
							sURL=sURL + '?txtCountryID=206';
						}
						else {
							sURL=sURL + '&txtCountryID=206';
						}						
					}					
					break;
				case "account_position.asp":
					//alert("Reached Main Positions Function");
					sURL="/welcome/tour/account/positions.aspx";
					var sPage=qIndex(sURLLowercase,'1');
						switch (sPage){
							case "1":
								sURL="/welcome/tour/account/pl_charts.aspx";
								break;
							case "2":
								sURL="/welcome/tour/account/positions.aspx";
								break;								
							case "3":
								sURL="/welcome/tour/account/positions.aspx";
								break;								
							case "4":
								sURL="/welcome/tour/account/positions.aspx";
								break;
							case "5":
								sURL="/welcome/tour/account/analyzer.aspx";
								break;
							default:
								break;
						}
					break;
				case "oxnetaccnt/account/positions.aspx":
					//alert("Reached Main Positions Function");
					sURL="/welcome/tour/account/positions.aspx";
					var sPage=qIndex(sURLLowercase,'1');
						switch (sPage){
							case "1":
								sURL="/welcome/tour/account/pl_charts.aspx";
								break;
							case "2":
								sURL="/welcome/tour/account/positions.aspx";
								break;								
							case "3":
								sURL="/welcome/tour/account/positions.aspx";
								break;								
							case "4":
								sURL="/welcome/tour/account/positions.aspx";
								break;
							case "5":
								sURL="/welcome/tour/account/analyzer.aspx";
								break;
							default:
								break;
						}
					break;					
				case "paper_trading.asp":
					sURL="/welcome/tour/quotes/virtual.aspx";
					break;
				case "frame_trade.asp":
					sURL="/welcome/tour/trade/bonds.aspx";
					break;
				case "trade/bond_frame.aspx":
					sURL="/welcome/tour/trade/bonds.aspx";
					break;					
				case "quote_watch_list.asp":
					sURL="/welcome/tour/quotes/watch.aspx";
					break;
				case "quote_detail.asp":
					sURL="/welcome/tour/quotes/detail.aspx";
					break;
				case "account_balance.asp":
					sURL="/welcome/tour/account/balances.aspx";
					break;					
				case "oxnetaccnt/account/balances.aspx":
					sURL="/welcome/tour/account/balances.aspx";
					break;
				case "account_activity.asp":
					sURL="/welcome/tour/account/activity.aspx";
					break;
				case "account_analysis.asp":
					sURL="/welcome/tour/account/activity.aspx";
					break;
				case "order_overview.asp":
					sURL="/welcome/tour/account/activity.aspx";
					break;
				case "account_xecute.asp":
					sURL="/welcome/tour/account/xecute.aspx";
					break;
				case "quote_charts.asp":
					sURL="/welcome/tour/quotes/charts.aspx";
					break;
				case "quote_streamer.asp":
					sURL="/welcome/tour/quotes/xtend.aspx";
					break;
				case "toolbox_option_screener.asp":
					sURL="/welcome/tour/quotes/screener.aspx";
					break;
				case "toolbox_dragon.asp":
					sURL="/welcome/tour/quotes/dragon.aspx";
					break;
				case "toolbox_strategy_scan.asp":
					sURL="/welcome/tour/quotes/strategyscan.aspx";
					break;
				case "oxnetaccnt/account/overview.aspx":
					sURL="/welcome/tour/account/overview_page.aspx";
					break;
				case "account_overview.asp":
					sURL="/welcome/tour/account/overview_page.aspx";
					var sPage=qIndex(sURLLowercase,'1');
					
						switch (sPage){
							case "deposit":
								sURL="/welcome/interstitial.aspx";
								break;
							default:
								break;
						}
					break;
				//AV Issue 6973 - 03/31/04
				case "cust_service.asp":
					//alert("Reached");
					sURL="/cust_service.asp?pageid=home";
					var sPage=qIndex(sURLLowercase,'1');
					
						switch (sPage){
							case "transfer_funds":
								sURL="/welcome/tour/account/funding.aspx";
								break;
							case "request":
								sURL="/welcome/tour/account/funding.aspx";
								break;								
							case "pending":
								sURL="/welcome/interstitial.aspx";
								break;								
							case "home":
								sURL="/cust_service.asp?pageid=home";
							default:
								break;
						}
					break;
				case "account_profile.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "commentary.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "help/frame.asp":
					var sPage=qIndex(sURLLowercase,'1');
					
						switch (sPage) {
							case "http://boards.optionsxpress.com":
								sURL="/welcome/interstitial.aspx";
								break;
							case "http://boards.optionsxpress.com/":
								sURL="/welcome/interstitial.aspx";
								break;
							default:
								break;
						}
					break;
				case "thepit_numbers.asp":
					sURL="/welcome/tour/quotes/markets.aspx";
					break;
				case "thepit_advisors.aspx":
					sURL="/welcome/tour/account/xecute.aspx";
					break;
				case "thepit_index.aspx":
					sURL="/welcome/tour/quotes/markets.aspx";
					break;
				case "quotes/tnt.asp":
					sURL="/welcome/tour/quotes/markets.aspx";
					break;
				case "toolbox/toolbar/index.aspx":
					sURL="/welcome/tour/quotes/toolbar.aspx";
					break;
				case "help/webinars_agree.aspx":
					sURL="/welcome/tour/educate/webinars.aspx";
					break;
				case "help/webinars.aspx":
					sURL="/welcome/tour/educate/webinars.aspx";
					break;
				case "trade/patterns/results.asp":
					sURL="/welcome/tour/quotes/patterns.aspx";
					break;
				case "oxnettools/toolbox/chart_patterns.aspx":
					sURL="/welcome/tour/quotes/chart_patterns.aspx";
					break;
				case "oxnettools/charts/snapcharts.aspx":
					sURL="/welcome/tour/quotes/charts.aspx";
					break;					
				// start dotnet trade page conditional: SPR 6/7/04
				case "oxnetaccnt/trade/stock.aspx":				
					sURL="/welcome/tour/trade/stock.aspx";						
					break;
				case "oxnetaccnt/trade/option.aspx":				
					sURL="/welcome/tour/trade/options.aspx";
					var sPage=qIndex(sURLLowercase,'1');					
						switch (sPage) {
							case "QQQQ":
								sURL="/welcome/tour/trade/options.aspx";
								break;
							default:
								break;
						}
					break;	
				case "oxnettools/etf/overview.aspx":				
					sURL="/welcome/tour/quotes/etf.aspx";						
					break;
				case "oxnettools/quote/stockfundamentals/marketwatch/marketwatch.aspx":	
					sURL="/welcome/tour/quotes/markets.aspx";						
					break;
				case "oxnettools/quote/marketcenter/news_center.aspx":	
					sURL="/welcome/tour/quotes/markets.aspx";						
					break;					
				case "oxnettools/quote/futures_analysis.aspx":	
					sURL="/welcome/tour/quotes/markets.aspx";						
					break;
				case "oxnetaccnt/trade/option_spread.aspx":
					sURL="/welcome/tour/trade/complex.aspx";				
					var sPage=qIndex(sURLLowercase,'1');					
						switch (sPage) {
							case "8":
								sURL="/welcome/tour/trade/complex.aspx";
								break;
							case "10":
								sURL="/welcome/tour/trade/complex.aspx";
								break;
							case "11":
								sURL="/welcome/tour/trade/complex.aspx";
								break;	
							case "3":
								sURL="/welcome/tour/trade/xspreads.aspx";
								break;	
							case "5":
								sURL="/welcome/tour/trade/complex.aspx";
								break;								
							default:
								break;
						}
					break;				
				case "oxnetaccnt/trade/option_covered_call.aspx":
					sURL="/welcome/tour/trade/covered_calls.aspx";
					var sPage=qIndex(sURLLowercase,'1');					
						switch (sPage) {
							case "9":
								sURL="/welcome/tour/trade/covered_calls.aspx";
								break;
							default:
								break;
						}
					break;								
				case "oxnetaccnt/trade/mutual_fund.aspx":
					sURL="/welcome/tour/trade/mf.aspx";
					break;		
				case "oxnetaccnt/trade/futures.aspx":
					sURL="/welcome/tour/trade/futures.aspx";
					break;
				case "oxnetaccnt/account/referral.aspx":
					sURL="/welcome/tour/account/refer.aspx";
					break;
				case "oxnetaccnt/account/statements.aspx":
					sURL="/welcome/tour/account/confirms.aspx";
					break;
				case "oxnetaccnt/account/confirms/account_confirms.aspx":
					sURL="/welcome/tour/account/confirms.aspx";
					break;
				case "oxnetaccnt/trade/option_exercise_and_hedge.aspx":
					sURL="/welcome/tour/trade/options.aspx";
					break;
				case "oxnetaccnt/account/tax/index.aspx":
					sURL="/welcome/tour/educate/tax.aspx";
					break;
				case "oxnetaccnt/trade/multi_leg.aspx":
					sURL="/welcome/tour/trade/group.aspx";
					break;
				case "oxnetaccnt/trade/contingent.aspx":
					sURL="/welcome/tour/trade/contingent.aspx";
					break;
				case "oxnettools/alertmanager/index.aspx":
					sURL="/welcome/tour/quotes/watch.aspx";
					break;
				// end dotnet tradepage conditional
				case "trade_order.asp":				
					sURL="/welcome/tour/trade/status.aspx";
					var sPage=qIndex(sURLLowercase,'1');			
						switch (sPage) {
							case "exercise_request":
								sURL="/welcome/tour/trade/options.aspx";
								break;
							default:
								break;
						}			
					break;
				case "toolbox_volatility_view.asp":
					sURL="/welcome/tour/quotes/volatility_view.aspx";
					break;
				case "toolbox_indexcomponents.asp":
					sURL="/welcome/tour/quotes/indices.aspx";
					var sPage=qIndex(sURLLowercase,'1');				
					
						switch (sPage) {
							case "22":
								sURL="/welcome/tour/quotes/indices.aspx";
								break;
						}
					break;
				// ETF redirect - SPR 1/24/05
				// SV 10/27/06 ETF screener has new link. Can probably remove.
				case "toolbox_option_screener.asp":
					var sPage=qIndex(sURLLowercase,'1');				
					
						switch (sPage) {
							case "40":
								sURL="/welcome/tour/market_overview.aspx?nav=quick";
								break;
							default:
								break;
						}
					break;
				//case "quote_market_overview.asp":
					//var sPage=qIndex(sURLLowercase,'1');			
					
						//switch (sPage){
							//case "mostactives":
								//sURL="/welcome/tour/market_overview.aspx?nav=extended";
								//break;
							//default:
								//break;
						//}
					//break;
				
				case "quote_option_chain.asp":			
					sURL="/welcome/tour/quotes/chains.aspx";
					var sPage=qIndex(sURLLowercase,'1');				
					
					switch (sPage){
						case "pr":
							sURL="/welcome/tour/quotes/pricer.aspx";
							break;
						default:
							break;
					}
					break;
				/* position analyzer */
				case "position_chart.asp":				
					sURL="/welcome/tour/account/analyzer.aspx";
					var sPage=qIndex(sURLLowercase,'1');				
					switch (sPage){
						case "trade_calculator": 
							sURL="/welcome/tour/quotes/calculator.aspx";
						break;
					}
					break;
				}			
			}
		//window.alert(sURL+'before');
		
		//DS : 24844 : 6/4/2007
		var bGoToParentValid = 'False';			
		if (bLinkToParentWnd!=null){					
			if((bLinkToParentWnd=='True')&&(window.self.opener!=null)){
				bGoToParentValid='True';
				self.opener.location.href = sURL;
				window.opener.focus(); 
			}
		}
		if (bGoToParentValid=='False'){						
			location.href=sURL;
		}
		
	}
	else if (nLogin>=0 && sSessionID=='0') {
		location.href="/login.asp";
	}
	else {
		if (sURL=="new_account.asp" || sURL=="/new_account.asp") {
			//window.alert(sURL+sAppendChar+'SessionID='+sSessionID);
			//AV 08/27/2004 do not allow users to open new account
			if (window.confirm("You are about to open a new account with information based on current account. Click OK to proceed or Cancel to open a new account from scratch.")) {				
				var sWindow;
				
				sWindow=sURL+sAppendChar+'SessionID='+sSessionID+"&SubPageId=create_new&ASID=51&DUP=TRUE";
				OpenChildWindowSizeable(sWindow,'true','1024','760');
			}
			else {
				//sWindow=sURL+sAppendChar+'SessionID='+sSessionID;
				//SB DT 15366
				//Not appending session id if a totally new account is being opened
				sWindow=sURL+sAppendChar;
				OpenChildWindowSizeable(sWindow,'true','1024','760');
				//location.href=sURL+sAppendChar+'SessionID='+sSessionID;				
			}
		}
		else {		
			//DS : 24844 : 6/4/2007
			var bGoToParentValid = 'False';		
			if (bLinkToParentWnd!=null){		
				if((bLinkToParentWnd=='True')&&(window.self.opener!=null)){
					bGoToParentValid='True';
					self.opener.location.href = sURL+sAppendChar+'SessionID='+sSessionID;
					window.opener.focus(); 
				}
			}			
			if (bGoToParentValid=='False'){			
				location.href=sURL+sAppendChar+'SessionID='+sSessionID;
			}
		}
	}
	return;
}

function AppendSessionIDText(sURL,frmName,bOX) { //version for paper trade
	var sAppendChar='&';
	var nLastSlash=location.pathname.lastIndexOf('/');
	var sPath=location.pathname.substring(0, nLastSlash+1);
	var sPathName=window.location.pathname;
	//var sSessionID=GetSessionIDText(frmName);
	
	//var sWebServer=eval('document.' + frmName + '.txtOXWebServer.value');
	//AV paper trade
	var sSessionID=frmName.txtSessionID.value	
	var sWebServer=frmName.txtOXWebServer.value;
		
	if (sWebServer!='' && bOX==1)
		sURL=sWebServer + "/" + sURL;

	if (qIndex(sURL)==-1)
		sAppendChar='?';
		
	var oSecure=new RegExp("(login|account_overview|trade_order).asp","i");
	var nSecure=sURL.search(oSecure);
	
	var oLocalMode=new RegExp("oxwaccnt","i"); 
	var nDebugOverride=sPathName.search(oLocalMode);
	
	var oLogin=new RegExp("login.asp","i");
	var nLogin=sURL.search(oLogin);	
//window.alert(sSessionID);
	if (sSessionID=='0' && nLogin==-1){
		var sURLLowercase=sURL.toLowerCase();
		var nEndOfASP=sURLLowercase.indexOf('.asp');
		if (nEndOfASP==-1){
			nEndOfASP=sURLLowercase.indexOf('.htm');
		}
		var sASPage='';

		if (nEndOfASP!=-1){
			sASPage=sURLLowercase.substring(0,nEndOfASP+4);
			//window.alert(sASPage+"123");
			switch (sASPage){
			
				case "quote_watch_list.asp":
					sURL="/welcome/interstitial.aspx";
					break;			
				case "account_position.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_balance.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_activity.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_analysis.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "order_overview.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_xecute.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_overview.asp":
					sURL="/welcome/interstitial.aspx";
					break;
				case "account_profile.asp":
					sURL="/welcome/interstitial.aspx";
					break;				
				case "thepit_numbers.asp":
					sURL="/welcome/interstitial.aspx";
					break; 
				case "thepit_index.htm":
					sURL="/welcome/interstitial.aspx";
					break; 
				case "trade_order.asp":
					var sPage=qIndex(sURLLowercase,'1');
			
						//window.alert(sPageID+" "+sSecTypeID);
						switch (sPage){
							case "trade":
								sURL="/welcome/interstitial.aspx";									
								break;
							case "order_status":
								sURL="/welcome/interstitial.aspx"
								break;
							default:
								break;
						}
						
					//	sURL="welcome_tour_trade_stock.htm";
					
					break;
				case "toolbox_volatility_view.asp":
					sURL="tbox_promo_vol_view.htm";
					break;
				default: sURL="/welcome/interstitial.aspx";
					break;
			}
		}
		//window.alert(sURL+'before');
		location.href=sURL;
	}
	else if (nLogin>0)
		location.href="login.asp";
	else {
		if (nSecure>=0 && nDebugOverride==-1 && sWebServer==''){
			sURL='https://'+location.host+sPath+sURL;
		}
//window.alert(sURL+sAppendChar+'SessionID='+sSessionID);
			//location.href=sURL+sAppendChar+'SessionID='+sSessionID;
		var sOutsideVT = "false";
	if (frmName.txtOutsideVT!= null){
		sOutsideVT =  frmName.txtOutsideVT.value;
	}
	var sBranchID = ''
	if (frmName.txtBranchID!= null){
		sBranchID = frmName.txtBranchID.value;
	}
	
		location.href=sURL+sAppendChar+'SessionID='+sSessionID+'&OUTSIDE_VT='+sOutsideVT+ "&BRANCH_ID=" +sBranchID;
	}
	return;
}

//redundant check here, appendsession keeps missing some pages with test drive on them.
function checkTestDrive(flag){
	var test = 0;
	if(document.getElementById('header')){
		var myInput = document.getElementById('header').getElementsByTagName('INPUT');
		for(i=0;i<myInput.length;i++){
			if(myInput[i].name=='txtTestDriveH' && myInput[i].value=='true'){
				test = 1;
				document.images.newAccount.src= "/images/welcome/home/open_account_3.gif"; //"complete your account" image
				document.images.newAccount.parentNode.href='javascript:RemoveFrames("/new_account.asp?sessionid='+GetSessionID()+'")';
				document.images.newAccount.style.width='160px';
			}
		}
	}
	if(flag!='' && test == 1){return flag;}
}


/* Include branch/general.js */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/branch/general.js\"></script>";		
//document.write(s);
/* 	
	Purpose: OX/BX Branch functions.
	Created by: Shawn Roser
	Date: 4/26/2004
*/

function SubmitCustomerSearch() {
	//alert(window.document[0]);
	//alert(window.document[0].__VIEWSTATE);
	//Submit All pages to branch_autotrade_accounts.aspx if search is used
	//alert('1');
	if (window.document.forms[0].__VIEWSTATE == undefined)		
	{
		//alert('1.1');
		window.document.forms[0].action="/oxwbranch/branch_autotrade_accounts.aspx";
		//alert('1.2');
		window.document.forms[0].submit();
		return;
	}
	//alert('2');
	if (window.document.forms[0].__VIEWSTATE != null)
	{
		window.document.forms[0].__VIEWSTATE.name='NOVIEWSTATE';
	}	
	if (window.document.forms[0].__EVENTTARGET != null)
	{
		window.document.forms[0].__EVENTTARGET.name='NOVIEWSTATE';
	}
	window.document.forms[0].action="/oxwbranch/branch_autotrade_accounts.aspx";
	window.document.forms[0].submit();
}

function AdjustTxtCriteria1(){
	//window.alert("!!!");
	if (document.frmBranchStats == null)
	{
		return;
	}
	var nSelIndex=document.frmBranchStats.lstCriteriaType.selectedIndex;
	var sCriteriaType=document.frmBranchStats.lstCriteriaType[nSelIndex].value;
	//window.alert(sCriteriaType);

	if(sCriteriaType=="previous_account_num"){
		document.frmBranchStats.lstCriteriaType[nSelIndex].value = "account_num_previous";
	}
	if (sCriteriaType=="account_num" || sCriteriaType=="previous_account_num" || sCriteriaType=="account_num_previous"){
		var sCriteria=document.frmBranchStats.txtCriteria.value;
		//window.alert(sCriteria1);	
		//AV - 9573 Search should allow trailing or leading spaces
		sCriteria = trim(sCriteria);	
		document.frmBranchStats.txtCriteria.value=sCriteria;
		if (sCriteria==""){
			document.frmBranchStats.txtCriteria.select();
		}
		else if (!InvalidCharactersExist(sCriteria)){ // // now account # could be alpha numeric
			if(sCriteria != "pending" && sCriteria != "ack"){			
			//alert(sCriteria1.length);
			if (IsAnyAlphaCharactersExist(sCriteria)) {
				if ((sCriteria.length == 8 || sCriteria.length == 7) && sCriteria.substring(0,1) != "0"){
					sCriteria = sCriteria1.substring(0,7);
					sCriteria = "0" + sCriteria;
					sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
				}
				else {
					sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
				}
			}
			else {
				sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
			}
			document.frmBranchStats.txtCriteria.value=sCriteria;
			}
		}
		
	}
	else {
		document.frmBranchStats.lstViewType.disabled=false;
	}
	document.frmBranchStats.txtCriteria.focus();
	return;
}

function AdjustTxtCriteria2(){
	//window.alert("!!!");
	if (document.frmBranchStats == null)
	{
		return;
	}
	var nSelIndex=document.frmBranchStats.lstCriteriaType2.selectedIndex;
	var sCriteriaType=document.frmBranchStats.lstCriteriaType2[nSelIndex].value;
	//window.alert(sCriteriaType);

	if(sCriteriaType=="previous_account_num"){
		document.frmBranchStats.lstCriteriaType2[nSelIndex].value = "account_num_previous";
	}
	if (sCriteriaType=="account_num" || sCriteriaType=="previous_account_num" || sCriteriaType=="account_num_previous"){
		var sCriteria=document.frmBranchStats.txtCriteria2.value;
		//window.alert(sCriteria1);	
		//AV - 9573 Search should allow trailing or leading spaces
		sCriteria = trim(sCriteria);	
		document.frmBranchStats.txtCriteria2.value=sCriteria;
		if (sCriteria==""){
			document.frmBranchStats.txtCriteria2.select();
		}
		else if (!InvalidCharactersExist(sCriteria)){ // // now account # could be alpha numeric
			if(sCriteria != "pending" && sCriteria != "ack"){			
			//alert(sCriteria1.length);
			if (IsAnyAlphaCharactersExist(sCriteria)) {
				if ((sCriteria.length == 8 || sCriteria.length == 7) && sCriteria.substring(0,1) != "0"){
					sCriteria = sCriteria1.substring(0,7);
					sCriteria = "0" + sCriteria;
					sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
				}
				else {
					sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
				}
			}
			else {
				sCriteria=sCriteria.slice(0,4) + "-" + sCriteria.slice(4);
			}
			document.frmBranchStats.txtCriteria2.value=sCriteria;
			}
		}
		
	}
	else {
		document.frmBranchStats.lstViewType.disabled=false;
	}
	document.frmBranchStats.txtCriteria2.focus();
	return;
}

function hideHeader(){
	if(window.frames[1].document.getElementById('Header')){
		window.frames[1].document.getElementById('Header').style.display='none';
	}
	if(window.frames[1].document.getElementById('headerave')){
		window.frames[1].document.getElementById('headerave').style.display='none';
	}
	if(window.frames[1].document.getElementById('footer')){
		window.frames[1].document.getElementById('footer').style.display='none';
	}
	if(window.frames[1].document.getElementById('Footer')){
		window.frames[1].document.getElementById('Footer').style.display='none';
	}
}


/* Include nav.js */
//var s;
//s = "<script language=\"javascript\" type=\"text/javascript\" src=\"" + cdn_path + "/inc/js/nav.js\"></script>";		
//document.write(s);
$(document).ready(function() {	
	var $section = '';
	var backToTop = '<div id="top"></div>';
	var defaultSearch = '<div id="str_temp"></div>';
	
	// disable links on top-level navigation for iPhone users
	if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) {
		$('#main-navigation > li > a').attr('href', 'javascript://');
	}
		
	// back to top & search term population
	$(backToTop).appendTo('#header');
	defaultSearch = $(defaultSearch).html('Search &raquo;').text();
	// nav menu arrows and hover
	if (!$('#main-navigation > li ul li > em').size()) {
		$('#main-navigation > li ul li').prepend('<em></em>');
	};
	$('#main-navigation > li:not(#search):last').addClass('last');
	$('#main-navigation > li').hover(function() {
		$section = $(this);
		if ($section != "") {
			$section.addClass('active');
			$section.children('ul').show();
		}
	}, function() {
		if ($section != "") {
			$section.removeClass('active');
			$section.children('ul').hide();
		}
	});
	$('#main-navigation > li ul').bgiframe();	// ie6 compatibility
	// search
	$('#qt')
		.val(defaultSearch)
		.focus(function() {
			searchFocus = 'true';
			$(this).addClass('active').val('');
		})
		.blur(function() {
			searchFocus = 'false';
			$(this).removeClass('active').val(defaultSearch);
		})
		.keypress(function(event) {
			if ((event.which ? event.which : event.keyCode) == 13) {
				searchSubmit('0'); 
				return false;
			}
		});
	// framed pages
	if ($('body').is('.framed')) {
		$('#main-navigation a').attr('target', '_parent');
	};

	changeFirmType(firmType);
	checkTestDrive();
	checkFont();
});

/*
 * jQuery firmType plugin
 * Version 1.0 (July 28, 2009)
 * Written by Nick Bourgeois <nbourgeois@optionsxpress.com>
 *
 * This plugin replicates the functionality of the getFirmType function in
 * marketing.js. Returns the current user's firm type.
 *
 * (To be cleaned up later.)
 *
 */
(function ($) {
	$.fn.firmType = function () {
		var firmType,
			url = location.href.toLowerCase();

		if (url.indexOf('.sg') != -1 || url.indexOf('sg.eqdesign') != -1 || getCookie('Firm') == 'SN') {
			firmType = 'SN';
		}
		else if (url.indexOf('.ca') != -1 || url.indexOf('ca.eqdesign') != -1 || getCookie('Firm') == 'CA') {
			firmType = 'CA';
		}
		else if (url.indexOf('.au') != -1 || url.indexOf('au.eqdesign') != -1 || getCookie('Firm') == 'OB') {
			firmType = 'OB';
		}
		else if (url.indexOf('brokersxpress') != -1 || url.indexOf('bx.eqdesign') != -1 || getCookie('Firm') == 'BX') {
			firmType = 'BX';
		}
		else if (url.indexOf('advisorsxpress') != -1 || url.indexOf('ax.eqdesign') != -1 || getCookie('Firm') == 'AX') {
			firmType = 'AX';
		}
		else if (url.indexOf('optionsxpress.europe') != -1 || url.indexOf('optionsxpress.eu') != -1 || url.indexOf('eu.eqdesign') != -1 || getCookie('Firm') == 'EU') {
			firmType = 'EU';
		}
		else if (url.indexOf('oxint') != -1 || url.indexOf('oxint.eqdesign') != -1 || getCookie('Firm') == 'OXI') {
			firmType = 'OXI';
		}	
		else {
			firmType = 'OX';
		}

		return firmType;
	}
})(jQuery);

var firmType = $.fn.firmType();
var firmNameOX = 'usa';
var firmNameOXI = 'international';
var firmNameCA = 'canada';
var firmNameEU = 'europe';
var firmNameSN = 'singapore';
var firmNameAU = 'australia';

// logo swap & hiding links
function changeFirmType(firmType) {
	$('h1').removeClass();
	switch(firmType) {
		case "OX":
			$('h1').addClass(firmNameOX);
			showLinks();
			break;
		case "OXI":
			$('h1').addClass(firmNameOXI);
			removeLinks(firmNameOXI);
			break;
		case "CA":
			$('h1').addClass(firmNameCA);
			removeLinks(firmNameCA);
			break;
		case "EU":
			$('h1').addClass(firmNameEU);
			removeLinks(firmNameEU);
			break;
		case "SN":
			$('h1').addClass(firmNameSN);
			removeLinks(firmNameSN);
			break;
		case "OB":
			$('h1').addClass(firmNameAU);
			removeLinks(firmNameAU);
			break;
		default:
			$('h1').addClass(firmNameOX);
			showLinks();
			break;
	}
}
function showLinks() {
	$('#main-navigation > li ul li').show();
}
function removeLinks(firm) {
	$('#main-navigation > li ul li.' + firm).hide();
}

/* the "getCookie," "setCookie" and "delCookie" functions were all lifted from marketing.js */
//Duplicate function - commenting out
//function getCookie(name) {
//	var cname = name + "=";
//	var dc = document.cookie;
//	if (dc.length > 0) {
//		begin = dc.indexOf(cname);
//		if (begin != -1) {
//			begin += cname.length;
//			end = dc.indexOf(";", begin);
//			if (end == -1) end = dc.length;
//			return unescape(dc.substring(begin, end));
//		}
//	}
//	return null;
//}
//function setCookie(name, value, expires, path, domain, secure) {
//	document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : "; expires=" + expires.toGMTString()) + ((path == null) ? "" : "; path=" + path) + ((domain == null) ? "" : "; domain=" + domain) + ((secure == null) ? "" : "; secure");
//}
function delCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + ((path == null) ? "" : "; path=" + path) + ((domain == null) ? "" : "; domain=" + domain) + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
if(window.opener){
    window.onerror = noErrorMessages;
	if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor')){
		if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0]){
			if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
				var mySize = window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
				setStylesheet(mySize);
				//alert('popup');
			}		
		}		
	}
}
//Duplicate function - commenting out
//function checkFont(val){
//	if (getCookie('oxps_sizing')) {
//		document.cookie = 'oxps_sizing' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
//	}
//	if (getCookie('oxps_font')) {
//		document.cookie = 'oxps_font' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
//	}
//	if (getCookie('oxps_color')) {
//		document.cookie = 'oxps_color' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
//	}
//	
//	if(val=='quote'){
//		if(document.getElementById('spSiteStyleFontSize')){
//			if(document.getElementById('spSiteStyleFontSize').childNodes[0]){
//				if(document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!=null){
//					var myFont = document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue;
//					setStylesheet(myFont);
//				}		
//			}
//		}		
//	checkColor(val);
//	}
//	else{
//		if(parent.frames[0] && window.name == 'main'){
//			if(parent.frames[0].document.getElementById('spSiteStyleFontSize')){
//				if(parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0]){
//					if(parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!=null){
//						var myFont = parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue;
//						setStylesheet(myFont);
//					}		
//				}
//			}
//		checkColor();
//		}
//	}
//}
//Duplicate function - commenting out
//function checkColor(val){
//	if(val=='quote'){
//		if(document.getElementById('spSiteStyleColor')){
//			if(document.getElementById('spSiteStyleColor').childNodes[0]){
//				if(document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
//					var myColor = document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
//					setStylesheet(myColor);
//				}		
//			}	
//		}
//		resize(val);		
//	}
//	else{
//		if(parent.frames[0] && window.name == 'main'){	
//			if(parent.frames[0].document.getElementById('spSiteStyleColor')){
//				if(parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0]){
//					if(parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
//						var myColor = parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
//						setStylesheet(myColor);
//					}		
//				}	
//			}
//		resize();
//		}
//	}
//}
//function resize(val){
//	if(val=='quote'){
//		if(document.getElementById('spSiteStyleAlignment')){
//			if(document.getElementById('spSiteStyleAlignment').childNodes[0]){
//				if(document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!=null){
//					var mySize = document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
//					setStylesheet(mySize);
//				}		
//			}		
//		}	
//	}
//	else{
//		if(parent.frames[0] && window.name == 'main'){	
//			if(parent.frames[0].document.getElementById('spSiteStyleAlignment')){
//				if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0]){
//					if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!=null){
//						var mySize = parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
//						setStylesheet(mySize);
//					}		
//				}		
//			}
//		resizeHeader();
//		}
//	}
//}
function styleTab(){  //writes element to frameset file so we can detect and display "site layout" tab after reload
	var d = parent.document.createElement('div'); 
    d.id = 'prefs'; 
	var el = parent.document.getElementsByTagName('noframes');
	if(el[0]){
	    el[0].parentNode.appendChild(d); 	
	}
}
//function setStylesheet(styleTitle){
//	if(document.location.href && document.location.href.indexOf('broker_view')==-1){ //don't apply styles to web broker
//		if(document.getElementsByTagName('STYLE')){
//			var s = document.getElementsByTagName('STYLE'); 
//			if(s[0]){
//				newStyle=document.createElement('Link');
//				newStyle.rel="stylesheet";
//				newStyle.type="text/css";
//				newStyle.href= cdn_path + "/inc/"+styleTitle+".css";
//				s[0].parentNode.appendChild(newStyle);
//			}
//		}
//	}
//}

//General.js
var lAccntListLastSelIndex=0;
var defaultEmptyOK=false;
var decimalPointDelimiter=".";
var PO_BOX_CONFIRM_MSG="Please enter a physical legal address. PO Box numbers may be used for mailing address only";
var PO_BOX_CONFIRM_MSG2="Primary account address cannot be a P.O. Box.\n\nIf you believe you received this message in error, please click \"OK\" ";

function PromptFocus(ctrlName, txtMessage)
{
	try{
		sCtrlType=ctrlName.type;
		if (sCtrlType==null)
		sCtrlType=ctrlName[0].type;

		if (sCtrlType=="text"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="password"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="textarea"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="checkbox"){
			ctrlName.focus();
		}
		else if (sCtrlType=="radio"){
			ctrlName[0].focus();
		}
	}
	catch(err){
	}
	window.alert(txtMessage);
	try{
		if (sCtrlType=="text"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="password"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="textarea"){
			ctrlName.select();
			ctrlName.focus();
		}
		else if (sCtrlType=="checkbox"){
			ctrlName.focus();
		}
		else if (sCtrlType=="radio"){
			ctrlName[0].focus();
		}
		else if (sCtrlType=="select-one" || sCtrlType=="select-multiple") {
			ctrlName.focus();
		}
	}
	catch(err){
	}
	return;
}

// This function provent history back on browser.
// Add this function to the first page.User 
// can not go back to the first page by clicking 
// "Back" button on the second page.
// e.g. <body onload="NoBrowserBack();">
function NoBrowserBack(){
	//window.history.forward(1);
	
}


// Returns true if character c is a digit 
// (0 .. 9).


function GetSessionID() {
	var sSessionID='0';
	var sQueryString=location.search.substring(1);
	var aQueryStringVars=sQueryString.split("&");

	for (var i=0; i<aQueryStringVars.length; i++){
		var nPos=aQueryStringVars[i].indexOf('=');
		var sParamName=aQueryStringVars[i].substring(0,nPos);
			
		if ((nPos==-1) || (sParamName.toLowerCase()!='sessionid')) continue;
		sSessionID=aQueryStringVars[i].substring(nPos+1);
		if (sSessionID==''){
			sSessionID='0';
		}
			break;
		}
		return sSessionID;
}

function GetSessionIDText(frmName) {
	var sSessionID='0';
	var sSessionText='document.' + frmName + '.txtSessionID.value';
	sSessionID=eval(sSessionText);
	return sSessionID;
}

function GetSessionIDForm(){
	try{
		var oElement = document.getElementById("txtSessionID");
		if(oElement != null){
			if(oElement.value.length > 0){
				return oElement.value;
			}
		}
		if(document.forms.length > 0){
			oElement = document.forms[0].elements["txtSessionID"];
			if(oElement){
				if(oElement.value.length > 0){
					return oElement.value;
				}
			}
		}
	}
	catch(e){
	}
	return GetSessionID();
}

var imgLogout = new Image();
imgLogout.src= cdn_path + "/images/welcome/home/log_out.gif";

// function LoginOrLogoff(htmlImage)
// {
	// var s = GetSessionID() ;
	// if (s=='0') {
	    // if (window.document[0]!=null)
	     	// if (window.document[0].txtSessionID !=null)
				// s = window.document[0].txtSessionID.value;
	// }
	// //alert(s);
	// if (s=='')
		// s='0';
	// var d=window.document;
	// //input: html image src
	// //image src must have id
	// //when call this function must 
	// //specify id(login): ex LoginOrLogoff(document.login);
	// //if (GetSessionID() != '0')
	// if (s != '0')
	// { 
	    // htmlImage.src=imgLogout.src;
		// for (var i=0; i<d.links.length; i++){
			// if (d.links[i].href.toLowerCase().indexOf("login.asp",0)!=-1){
				// //d.links[i].href="/login.asp?v=0";
				// d.links[i].href="javascript:AppendSessionID('/login.asp?v=0')";
				// break;
			// }
		// }
	// }
	
// }
function ValidAddress(sAddress)
{
	var i=0;
	var sLen=sAddress.length;
	/*
	while (i<sLen)
	{
		if (sAddress.charAt(i) == " ")
		{
			return(true);
		}
		i++;
    }
    */
    if (sLen>=2)
		return(true);
    return(false);
}

/*function ValidEmail(sEmail)
{
	var i=0;
	var checkAt;
	var checkDot;
	var sLen=sEmail.length;
	
	while (i<sLen)
	{
		if (sEmail.charAt(i) == "@")
		{
			checkAt=true;
		}
		if (sEmail.charAt(i) == ".")
		{
			checkDot=true;
		}
		if (checkAt==true && checkDot==true)
		{
			return(true);
		}
	
    return(false);
}
*/
function ValidEmailEmpty(sEmail)
{
	var i=0;
	var checkAt;
	var checkDot;
	var sLen=sEmail.length;
	if (sLen > 0) {
		while (i<sLen)
		{
			if (sEmail.charAt(i) == "@")
			{
				checkAt=true;
			}
			if (sEmail.charAt(i) == ".")
			{
				checkDot=true;
			}
			if (checkAt==true && checkDot==true)
			{
				return(true);
			}
			i++;
		}
		return(false);
	}
	else {
		return(true)
	}
}

function IsFrame()
{
	return (window.parent!=window);
}
function RemoveFrames(sOptionalURL)
{
	if (IsFrame())
	{
		if (arguments.length==0)
			sURL=location.href;
		else
			sURL=sOptionalURL;
		window.open(sURL, target="_top");
	}
}

function enterLivePerson(helpButton) {
	var s = GetSessionID();
	if (s != '0') {
		var url = '/accountservice/account.asmx/GetCustAccount?sSessionID=' + s;
		$.get(url, function(result) {
			openLivePerson(helpButton,$(result).find('Obj').text());	
		});
	}	
	else {
		openLivePerson(helpButton,0);
	}
}

function openLivePerson(helpButton, aID) {
	window.name = "lp_parent";
	domain = window.location.href; 
	if (domain.indexOf("brokersxpress") != -1 || domain.indexOf("bxadvisors") != -1 || domain.indexOf("bx.eqdesign") != -1 || domain.indexOf("ax.eqdesign") != -1 || domain.indexOf("equawebbx1") != -1){ 
		//var url = "https://server.iad.liveperson.net/hc/29625551/?cmd=file&file=visitorWantsToChat&site=29625551";
		var url = "https://sales.liveperson.net/hc/29625551/?cmd=file&file=visitorWantsToChat&site=29625551&SESSIONVAR!skill=Default Ticket Skill&SESSIONVAR!person_id=0&SESSIONVAR!account_id=" + aID + "&waitTime=100000&referrer=" + escape(document.location);
	} else {		
		//var url = "http://sales.liveperson.net/hc/LPoptionsxpress/?cmd=file&file=visitorWantsToChat&site=47510077&SESSIONVAR!skill=Default Ticket Skill&SESSIONVAR!person_id=0&SESSIONVAR!account_id=" + aID + "&waitTime=100000&referrer=" + escape(document.location);		
		var url = "https://sales.liveperson.net/hc/LPoptionsxpress/?cmd=file&file=visitorWantsToChat&site=LPoptionsxpress&SESSIONVAR!skill=Funds - Checks & Wires&SESSIONVAR!person_id=0&SESSIONVAR!account_id=" + aID + "&waitTime=100000&referrer=" + escape(document.location);				
	}

// SV 3/24/08 Omniture event to track how many clicks live help gets
	var s=s_gi(omniAccount());
	s.linkTrackVars='events'; 
	s.linkTrackEvents='event17'; 
	s.events='event17';
	s.tl(helpButton,'o','Live Help Link');
	
	var hWnd = window.open(url,"live_person","width=500,height=320,resizable=yes,scrollbars=yes");
	if (hWnd != null) { if (hWnd.opener == null) { hWnd.opener = self; window.name = "home"; hWnd.location.href=url; } }			

}
								  
function OpenSymbolLookup(sForm,sControl,sPageControl,sPageControlValue,contingentFlag,sLookUp,bRefresh){
	var sWindow;
	var sName;
	var sFeatures;

	
	
	if (contingentFlag=="1")
		document.frmTrade.txtFormAction.value="CONTINGENT";	

	sWindow="/symbol_lookup.asp?formname=" + sForm + "&controlname=" + sControl;
	
	if (sPageControl!="")
		sWindow=sWindow+"&pagecontrol=" + sPageControl;
	if (sPageControlValue!="")
 		sWindow=sWindow+"&pagecontrolvalue=" + sPageControlValue;
	//if (sLookUp!="" && sLookUp!=null && sLookUp != undefined)
	//alert(arguments.length);
	if (arguments.length>=6 && sLookUp!="" && sLookUp!=null)
		sWindow=sWindow+"&LookUp=" + sLookUp;
	//if (bRefresh!="" && bRefresh!=null && bRefresh!= undefined)
	if (arguments.length>=7 && bRefresh!="" && bRefresh!=null)
		sWindow=sWindow+"&Refresh=" + bRefresh;
		
	if(document.getElementById('txtSessionID') == null)
		sWindow=sWindow+"&SessionID=";
	else
		sWindow=sWindow+"&SessionID=" + document.getElementById('txtSessionID').value;
				
	sName="SymbolLookup";
	sFeatures="width=500,height=500,toolbar=no,scrollbars=yes";	
	window.open(sWindow,sName,sFeatures);
	
}

function OpenSymbolLookupNet(sForm,sControl,sPageControl,sPageControlValue,contingentFlag,bRefresh){
	var sWindow;
	var sName;
	var sFeatures;

	
	
	if (contingentFlag=="1")
		document.frmTrade.txtFormAction.value="CONTINGENT";	

	sWindow="/symbol_lookup.asp?formname=" + sForm + "&controlname=" + sControl;
	
	if (sPageControl!="")
		sWindow=sWindow+"&pagecontrol=" + sPageControl;
	if (sPageControlValue!="")
 		sWindow=sWindow+"&pagecontrolvalue=" + sPageControlValue;
	sWindow=sWindow+"&Refresh=" + bRefresh;
		
	if(document.getElementById('txtSessionID') == null)
		sWindow=sWindow+"&SessionID=";
	else
		sWindow=sWindow+"&SessionID=" + document.getElementById('txtSessionID').value;
		
	sName="SymbolLookup";
	sFeatures="width=500,height=500,toolbar=no,scrollbars=yes";
	
	window.open(sWindow,sName,sFeatures);
	
}

function OpenChildWindow(sURL, sName, sWidth, sHeight){

	var sName;
	var sFeatures;
	sFeatures='width=' + sWidth + ',height=' + sHeight + ',toolbar=no,scrollbars=yes';
	
	window.open(sURL,sName,sFeatures);
}

function OpenChildWindowNew(sURL, sName, sWidth, sHeight){

	var sName;
	var sFeatures;
	sFeatures='width=' + sWidth + ',height=' + sHeight + ',toolbar=no,scrollbars=no';
	
	window.open(sURL,sName,sFeatures);
}

function OpenChildWindowSizeable(sURL, sName, sWidth, sHeight){

	var sName;
	var sFeatures;
	sFeatures='width=' + sWidth + ',height=' + sHeight + ',toolbar=no,scrollbars=yes,resizable=yes';
	
	window.open(sURL,sName,sFeatures);
}

function OpenPositionWindow(sURL, sName){

	var sName;
	var sFeatures;
	sFeatures='width=770,height=600,toolbar=no,scrollbars=yes';
	
	window.open(sURL,sName,sFeatures);
}

function okToSendToBeta(chk, sAction, okToSend){
	var ans='';
	var okToSubmit=true;
	
	if (chk!=null && sAction == 'PLACE' && okToSend){
		if (chk.checked){
			ans=window.prompt("Are you sure you do not want to send this order to Exchange!","N");
			if (ans=='y' || ans=='Y')
				okToSubmit=true;
			else
				okToSubmit=false;
		}
	}
	return okToSubmit;
}

function DisableButton(sButtonName){
	//var IE4 = (document.all);
	if (!IsNetscape() && IsWindowsOS()){
		//window.alert("not netscape, win32");
		//if (sButtonName!=null) {
			sButtonName.disabled=true;
		//}
	}
	return;
}

function EnableButton(sButtonName){
	if (!IsNetscape() && IsWindowsOS()){
		//if (sButtonName!=undefined) {
			sButtonName.disabled=false;
		//}	
	}
	return;		
}

function DisablePassport(sTxtName){
	//var IE4 = (document.all);
	if (!IsNetscape() && IsWindowsOS()){
		//window.alert("not netscape, win32");
		if (sTxtName!=undefined) {
			sTxtName.disabled=true;
		}
	}
	return;
}

function EnablePassport(sTxtName){
	if (!IsNetscape() && IsWindowsOS()){
		if (sTxtName!=undefined) {
			sTxtName.disabled=false;	
		}
		
	}
	return;		
}

function DisableState(lstCountry,lstState,lstPassport){
	var oLstCountry=eval("document.frmNewAccnt." + lstCountry);
	var oLstState=eval("document.frmNewAccnt." + lstState);
	var oLstPassport=eval("document.frmNewAccnt." + lstPassport);
	var nSelIndex=oLstCountry.selectedIndex;
	if (nSelIndex<=1){
		if(oLstState != null){
			EnableButton(oLstState);
		}
	
		if (lstPassport!=undefined)
			DisablePassport(oLstPassport);
	}
	else {
		if(oLstState != null){
			oLstState.selectedIndex=0;
			DisableButton(oLstState);
		}
		if (lstPassport!=undefined)
			EnablePassport(oLstPassport);
	}
	return;
}

function NewAccntDisableFlds(){
	if (!IsNetscape() && IsWindowsOS()){
		document.frmNewAccnt.txtPassport.disabled=true;
	}
	return;		
}

function IsNetscape(){
	var sAppName=window.navigator.appName;
	var reNav=/Netscape/i;
		
	return reNav.test(sAppName);
}

function IsWindowsOS(){
	var sOS=window.navigator.platform;
	var reNav=/Win/i;
	//window.alert(reNav.test(sOS));	
	return reNav.test(sOS);
}


function FormatAccountNumber(txtAccountNumber){
	if (txtAccountNumber==null)
		return;
	var s = trim(txtAccountNumber.value);
	if (!InvalidEmailCharactersExist(s) && s.length==7 && s.charAt(0)!='0'){
		s = "0" + s;
		s=s.slice(0,4) + "-" + s.slice(4);
		txtAccountNumber.value=s;
	}
}

function FormatCurrency(dblNumber){
	dblTemp=dblNumber*100;
	dblTemp=Math.round(dblTemp)/100;
	return dblTemp;
}
// DS : 27796 : 2/1/2008
// Param Number: both string and numeric types are accepted on the input
// Optional Param NumOfDecimals(defualt is 2), type numerical: number of decimals result number should consist of 
// Optional Param ShowZeros (defualt is false), type boolean: if set to true, the result number will consist of ending zeros ex: xx,xxx.200 (for 3 decimals)
//  Returns format of: xx,xxx,xxx.xx,
function NumberToCurrencyFormat(Number, NumOfDecimals, ShowZeros) {
	var sIntPart, sDecPart, sTemp, output;	
	var sNumber = '' + Number; //Convert passed number to string
	var nNumber = parseFloat(Number);	//Convert passed number to numeric		
	// Process decimal part of passed number 
	if (sNumber.indexOf('.') >= 0){ //Check if float type
		if(NumOfDecimals==null || NumOfDecimals==undefined){NumOfDecimals = 2;}
		if(ShowZeros==null || ShowZeros==undefined){ShowZeros = false;}
		nNumber = nNumber.toFixed(NumOfDecimals) ;
		sNumber = '' + nNumber;
		sTemp = sNumber.split(".") 
		sIntPart = sTemp[0];	
		sDecPart = sTemp[1];
		//remove zeros from the end of dcimal part of the number			
		if(! ShowZeros){
			var nNumOfZeros=0;
			for(var n=(sDecPart.length-1); n>=0; n--){
				var num = sDecPart.charAt(n);
				if (num=='0'){
					nNumOfZeros++;
				}else{
					break;
				}					
			}
			sDecPart = sDecPart.substr(0,(sDecPart.length - nNumOfZeros));
		}
	}else{ // Passed number is of Int type
		sIntPart = sNumber;		
		sDecPart = '';
	}
	// Process int part of passed number
	if (sIntPart.length > 3) {
		var mod = sIntPart.length % 3;
		var output = (mod > 0 ? (sIntPart.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(sIntPart.length / 3); i++) {
			if ((mod == 0) && (i == 0)){
				output += sIntPart.substring(mod+ 3 * i, mod + 3 * i + 3);
			}else{
				output+= ',' + sIntPart.substring(mod + 3 * i, mod + 3 * i + 3);
			}
		}
	}else{	
		output = sIntPart;
	}			
	if (sIntPart.length>0){output+= '.' + sDecPart;}		
	return output;
}
function OpenMiniChain(sForm,sControl,sSessionID,sControl1,ContingentFlag,bRefreshFlag,sPageIDControl,sPageIDValue,sChainLinkName,bFromOXBranch,sTxtLmtControl,sRadLimitControl,sPage,ChainType){
	//bFromOXBranch = 1 if it comes from OXBranch as it s in a diff virtual directory
	//bRefreshFlag=1 to refresh 0 not to refresh .
	//sAddlParam= add many number of parameters delimited by |
	/*
	
	*/
	var sURL="";
	var sName="";
	var sFeatures="";
	var sSymbol1="";
//alert(sControl);
//alert(bFromOXBranch);
//alert(sTxtLmtControl);
    var sSymbol;
    if(sForm.toLowerCase() == 'default_form')//OX Portal
        sSymbol=eval("document.getElementById('" + sControl + "').value");
    else
        sSymbol=eval("document." + sForm + "." + sControl + ".value");
	//window.alert(sSymbol);
	if (sPage==null){
		sPage="MINI";
	}
	if (sSymbol == "" && sControl1!=null)
		sSymbol=eval("document." + sForm + "." + sControl1 + ".value");

	if (bFromOXBranch=="1")
	{
		//sURL="/quote_option_chain.asp?" 
		sURL="/OXNetTools/MiniChains/index_mc.aspx?"
	}
	else
	{	sURL="/OXNetTools/MiniChains/index_mc.aspx?"
		//sURL="/quote_option_chain.asp?" 
	}
	
	 
	sURL= sURL + "SessionID=" + sSessionID + "&FormName=" + sForm + "&ControlName=" + sControl + "&PAGE=" + sPage;
	if (ContingentFlag=="1")
		document.frmTrade.txtFormAction.value="CONTINGENT";
	if (sSymbol > "")
		sURL=sURL + "&SymbolValue=" + sSymbol;
	if (bRefreshFlag > "")
	{
		sURL += "&REFRESH_FLAG=" + bRefreshFlag;
	}
	if (sPageIDControl > "")
	{
		sURL += "&PAGEID_CONTROL=" + sPageIDControl ;
	}

	if (sPageIDValue > "")
	{
		sURL += "&PAGEID_VALUE=" + sPageIDValue;
	}
	if (sChainLinkName > "")
	{
		sURL += "&LINK_NAME=" + sChainLinkName;
	}

	if (sTxtLmtControl > "")
	{
		sURL += "&LmtCtrl=" + sTxtLmtControl ;
	}	
	
	if (sRadLimitControl > "")
	{
		sURL += "&RAD_LMT_CONTROL=" + sRadLimitControl ;
	}
	if(ChainType > "")
	{
		sURL += "&ChainType=" + ChainType;
	}
	//AV 05/10/2004 - Pass MarketID to mini chain
	if (eval("document." + sForm + ".lstMarket") != null && IsNumeric(eval("document." + sForm + ".lstMarket.value")))
	{
		sURL += "&MARKET_ID=" +eval("document." + sForm + ".lstMarket.value") ;
	}
	var oElement = document.getElementById("txtSecTypeID");
	if(oElement != null)
	{
		if(oElement.value != "")
		{
			sURL += "&SECTYPE=" + oElement.value;
			if(oElement.value != "13" && oElement.value != "15" && oElement.value != "19" && oElement.value != "21")
			{
				sURL += "&NoCheckIsFuture=1";
			}
		}
	}
	sName="OptionChain";
	var sHeight=500;
	if(sPage=="MINI_SSF")
		sHeight=500;
	sFeatures="width=695,height=" + sHeight + ",toolbar=no,scrollbars=yes,resizable=yes";
//alert("SessionID=" + sSessionID + "&FORM_NAME=" + sForm + "&CONTROL_NAME=" + sControl + "&PAGE=" + sPage);
	
//sURL="/OXNetTools/MiniChains/index_mc.aspx"
// sURL= sURL + "?" + "SessionID=" + sSessionID;
//sURL= sURL + "&FORM_NAME=" + sForm + "&CONTROL_NAME=" + sSymbol + "&PAGE=" + sPage;
//alert(sURL);
//alert(oElement); 
//alert(sFeatures);
window.open(sURL,sName,sFeatures);
}

function OpenMiniChainII(sForm,sControl,sSessionID,sControl1,ContingentFlag,bRefreshFlag,sPageIDControl,sPageIDValue,sChainLinkName){
	//created to not include the document. to the beginning of the javascript object
	//bRefreshFlag=1 to refresh 0 not to refresh .
	//sAddlParam= add many number of parameters delimited by |
	var sURL="";
	var sName="";
	var sFeatures="";
	var sSymbol1="";
	var sSymbol=eval(sForm + "." + sControl + ".value");
	
	if (sSymbol=="" && sControl1!=null)
		sSymbol=eval(sForm + "." + sControl1 + ".value");
	
	
	sURL="/quote_option_chain.asp?SessionID=" + sSessionID + "&FORM_NAME=" + sForm + "&CONTROL_NAME=" + sControl + "&PAGE=MINI";
	if (ContingentFlag=="1")
		document.frmTrade.txtFormAction.value="CONTINGENT";
	if (sSymbol > "")
		sURL=sURL + "&SYMBOL=" + sSymbol;
	if (bRefreshFlag > "")
	{
		sURL += "&REFRESH_FLAG=" + bRefreshFlag;
	}
	if (sPageIDControl > "")
	{
		sURL += "&PAGEID_CONTROL=" + sPageIDControl ;
	}

	if (sPageIDValue > "")
	{
		sURL += "&PAGEID_VALUE=" + sPageIDValue;
	}
	if (sChainLinkName > "")
	{
		sURL += "&LINK_NAME=" + sChainLinkName;
	}

//	else if (sSymbol1 > "")
//		sURL=sURL + "&SYMBOL=" + sSymbol1;
	
	sName="OptionChain";
	sFeatures="width=550,height=450,toolbar=no,scrollbars=yes,resizable=yes";
	window.open(sURL,sName,sFeatures);	
}
function getCookie(name){
  var cname = name + "=";               
  var dc = document.cookie;             
  if (dc.length > 0) {              
    begin = dc.indexOf(cname);       
    if (begin != -1) {           
      begin += cname.length;       
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) + 
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function appendLinkA() {
    var sLink = "/toolbox_option_chain.asp"+document.frmToolbox.txtSymbol.value;
    return AppendSession (sLink);
}

function appendLinkB() {
    var sLink = "/toolbox_option_chain.asp"+document.frmToolbox.txtSymbol.value;
    return AppendSession (sLink);
}


function addLink() {
	var sLink;
    var sAppendChar='&';
	var nLastSlash=location.pathname.lastIndexOf('/');
	var sPath=location.pathname.substring(0, nLastSlash+1);
	var sURL='/position_chart.asp';

	if (sURL.indexOf('?')==-1)
	{
		sAppendChar='?';
	}
	if (sURL=='login.asp'){
		sURL='https://'+location.host+sPath+sURL;
	}
	sLink=sURL+sAppendChar+'SessionID='+GetSessionID();
    OpenChildWindow(sLink,'PositionChart', height='850',  width='675', scrollbars='yes');
}

function OpenCSWindow(sSubSelect) {
	var s;
	s=GetSessionID();
	OpenChildWindowNew('/welcome.asp?PageID=customerservice&SessionID='+s+'&hidSelValue='+sSubSelect,'','550','500');
}

function loadMe()
{
	document.frmLogin.txtUserID.focus();
}
/*
//function PromptFocus(ctrlName, txtMessage){
//	window.alert(txtMessage);
//	ctrlName.value="";
//	ctrlName.focus();
//	return;
//}
*/
function CheckForm()
{
	if (document.frmLogin.txtUserID.value=="")
	{
		PromptFocus(document.frmLogin.txtUserID, "Please enter your user name.");
		return(false);
	}
	if (document.frmLogin.txtPassword.value=="")
	{
		PromptFocus(document.frmLogin.txtPassword, "Please enter your password.");
		return(false);
	}
	else
	{
		return(true);
	}
}

function Friend() {
	var s=GetSessionID();
	OpenChildWindowSizeable('/welcome.asp?PageID=FriendReferral&amp;SessionID='+s,'False',425,450);
}

function ProcessAccntSel(frm){
    if(document.URL.toUpperCase().lastIndexOf('/OXPSPORTAL/') != -1)
	{
        __doPostBack('lstAccounts', '');
	}
    else
	{
		if ( typeof( window[ 'oCustomizePopup' ] ) != "undefined" ) 
		{
			if (oCustomizePopup!=undefined && oCustomizePopup!=null)
			{
				if (typeof(oCustomizePopup)== "object" && oCustomizePopup.closed==false)
					{
						oCustomizePopup.close();
					}
			}
		}
        frm.submit();			
	}
	return;
}

function dateDisplay(){
var todaysDate=now();
var month=todaysDate.getMonth();
var date=todaysDate.getDate();
var year=todaysDate.getFullYear();
document.write(month + "/" + date + "/" + year); 
}

function ExpMonthChanged(){
	return;
}

function IsRadSelected(oRadioButton){
	var bChecked=false;	
	for (i=0;i<oRadioButton.length;i++)
		if (oRadioButton[i].checked==true)
			bChecked=true;
	return(bChecked);
}

function UCaseLeadChar(txtName){
	var sString="";
	var sValue="";
	var sTemp = trim(txtName.value)
	var bSingleQuote;
	for(var j=0; j<sTemp.length; j++){
		if(j>0){
			if(sTemp.substr(j-1,1) == "'"){
				sString = sString + sTemp.substr(j,1)
			}
			else{
				sString = sString + sTemp.substr(j,1).toLowerCase();
	
			}
		}
		else{
			sString = sString + sTemp.substr(j,1).toLowerCase();

		}
	}
	var sValArr = sString.split(" ");
	for(var j=0; j<sValArr.length; j++){
			
		sValue = sValue + sValArr[j].substr(0,1).toUpperCase() + sValArr[j].substr(1) + " ";	
	}
	txtName.value=sValue;
	return;	
}

//----------------------------------------------------------------------------------------
// DN -DT# 37180 - uCaseSymbol can be used to convert lower case symbols to uppercase
// -- But if the symobl has a mix of lower and upper case characters it will return the string as it is
//----------------------------------------------------------------------------------------
function uCaseSymbol(sSymbol){
	var i = 0;
	var character = "";
	var nLCase = 0;

	if(sSymbol== null){
		sSymbol="";
	}
	sSymbol = sSymbol.trim();
	
	while (i < sSymbol.length){
		character = sSymbol.charAt(i);		
		if (character == character.toLowerCase()){			
			nLCase++;
		}		
		i++;
	}	
	if (nLCase == 0 || nLCase == sSymbol.length)
	{	return sSymbol.toUpperCase();
	} 
	else{
		if (IsValidOption(sSymbol)==true){	
			return sSymbol.toUpperCase();
			alert(0);
		}
		else{
			return sSymbol;
		}
	}               
}

function OpenNewAccntDoc(sDocType,lInitAccntID,sSession,bNewAccnt){
	var sSessionID;
	var sURL="/cust_service.asp?PageID=ACCNT_DOCS&ACTION=" + sDocType;
	var sGUID = "";
	if(sSession!=null && sSession != ""){
		sSessionID = sSession;
	}
	else{
		sSessionID = GetSessionID();
	}
	if(document.getElementById("txtGUID")!=null){
		sGUID = document.getElementById("txtGUID").value;
	}
	if (sSessionID>"")
		sURL+="&SESSIONID=" + sSessionID;
	if (lInitAccntID!=null && lInitAccntID != "" && lInitAccntiD != 0)
		sURL+="&INIT_ACCNT_ID=" + lInitAccntID;
	if (sDocType=="OPXS_ACH" && sSessionID!="" && sSessionID!="0") {
		if(bNewAccnt){
			sURL="/cust_service.asp?PageID=ACH_ESTABLISHMENT&SESSIONID=" + sSessionID +"&newaccount=1";			
		}
		else{
			sURL="/cust_service.asp?PageID=ACH_ESTABLISHMENT&SESSIONID=" + sSessionID;
		}
		OpenChildWindowSizeable(sURL,'','680','750');
		//window.open(sURL,"DocWindow","menubar=yes,toolbar=yes,location=no,scrollbars=yes,resizable,height=600,width=660");
	}
	else if (sDocType=="OPXS_ACH" && sGUID!="" && sGUID!="0") {
		sURL="/cust_service.asp?PageID=ACH_ESTABLISHMENT&GUID=" + sGUID +"&newaccount=1";		
		OpenChildWindowSizeable(sURL,'','680','750');
		//window.open(sURL,"DocWindow","menubar=yes,toolbar=yes,location=no,scrollbars=yes,resizable,height=600,width=660");
	}
	else {				
		window.open(sURL,"DocWindow","menubar=yes,toolbar=yes,location=no,scrollbars=yes,resizable,height=600,width=660");
	}
	return;
}

function OpenNewACAT(bPrint,AccountID,sSession) {
	var s;
	var sSessionID;
	var sGUID = "";
	if(sSession!=null && sSession != ""){
		sSessionID = sSession;
	}
	else{
		sSessionID = GetSessionID();
	}
	if(document.getElementById("txtGUID")!=null){
		sGUID = document.getElementById("txtGUID").value;
	}
	if ((sSessionID=="" || sSessionID=="0") && (sGUID=="" || sGUID=="0")) {
		s="/cust_service.asp?PageID=ACCNT_DOCS&ACTION=OPXS_ACAT";
	}
	else {
		if (bPrint==true) {
			s="/new_account.asp?FORM_ACTION=ACAT_APPLICATION&action=print&SESSIONID=" + sSessionID + "&accountid=" + AccountID + "&GUID=" +sGUID;
		}
		else {
			s="/new_account.asp?FORM_ACTION=ACAT_APPLICATION&SESSIONID=" + sSessionID +"&GUID=" +sGUID;
		}
	}
		OpenChildWindowSizeable(s,'','650','650');
}

function OpenNewIRADistribution(bPrint,AccountID) {
	var s;
	var sSessionID;
	
	sSessionID=GetSessionID();
	var d = new Date();
	s = "/OxNetAccnt/Account/transferfunds/IRADistribution/request_ira_distribution.aspx?SESSIONID=" + sSessionID +"&time=" + d.getSeconds();
	OpenChildWindowSizeable(s,'','650','750');
}


function GetQueryStrValue(sURL,sParam){
//a("here");
	var sResult="";
	if (arguments.length<2 || sURL.length==0 || sParam.length==0){
//a("bad args");
		sResult="";
	}
	else {
		var aQueryStr=sURL.split("?");
		//var sNewURL=aQueryStr[0];
		var sQueryStr="";
		if (aQueryStr.length<=1){
//a("bad split");		
			sResult="";
		}
		else {
			sQueryStr=aQueryStr[1];
//a("sQueryStr="+sQueryStr);			
			var aQueryStrVars=sQueryStr.split("&");
			var nPos=0;
			var sParamName="";
			//var bParamSet=false;
		
			if (aQueryStrVars.length>0){
				for (var i=0; i<aQueryStrVars.length; i++){
					nPos=aQueryStrVars[i].indexOf("=");
					sParamName=aQueryStrVars[i].substring(0,nPos);
					if (sParamName.toUpperCase()==sParam.toUpperCase()){
						sResult=aQueryStrVars[i].substring(nPos+1);
					}
				}
			}
		}
	}
	return(sResult);
}

function AppendQueryStr(sURL,sParam,sValue,bDupParam){
	if (arguments.length<3 || sURL.length==0 || sParam.length==0 || sValue.length==0){
		return(sURL);
	}
	else {
		if (bDupParam){
			sNewURL=sURL;
			if (sNewURL.indexOf("?")==-1){
				sNewURL+="?";
			}
			else{
				sNewURL+="&";
			}
			sNewURL+=sParam+"="+sValue;			
		}
		else {
			var aQueryStr=sURL.split("?");
			var sNewURL=aQueryStr[0];
			var sQueryStr="";
			if (aQueryStr.length>1){
				sQueryStr=aQueryStr[1];
			}
			var aQueryStrVars=sQueryStr.split("&");
			var nPos=0;
			var sParamName="";
			var bParamSet=false;
		
			if (aQueryStrVars.length>0){
				for (var i=0; i<aQueryStrVars.length; i++){
					nPos=aQueryStrVars[i].indexOf("=");
					sParamName=aQueryStrVars[i].substring(0,nPos);
					if (sParamName.toUpperCase()==sParam.toUpperCase()){
						var sTemp=sParam+"="+sValue;
						aQueryStrVars[i]=sTemp;
						bParamSet=true;				
					}
					if (sNewURL.indexOf("?")==-1){
						sNewURL+="?";
					}
					else{
						sNewURL+="&";
					}
					sNewURL+=aQueryStrVars[i];
				}
			}
			if (!bParamSet){
				if (sNewURL.indexOf("?")==-1)
					sNewURL+="?";
				else
					sNewURL+="&";
				sNewURL+=sParam + "=" + sValue;						
			}
		}
		return(sNewURL);			
	}
}



function SetDefaults(lPreferenceID,sValue,sRedirect)
{
	var s;
	s=GetSessionID();
	OpenChildWindowNew('/support.asp?PageID=Default&PreferenceID='+lPreferenceID+'&Value='+sValue+'&SessionID='+s+'&Redirect='+sRedirect,'',400,400);
	//AppendSessionID('support.asp?PageID=Default&PreferenceID='+lPreferenceID+'&Value='+sValue+'&Redirect='+sRedirect,'',1,1);
}


function VerifyOutsideTrade(sSessionId) {
	//alert(location.search.substring(1));
	var sParamName='';
	var sSource='';
	var sQueryString=location.search.substring(1);
	var aQueryStringVars=sQueryString.split("&");		
	for (var i=0; i<aQueryStringVars.length; i++){		
		var sParamName=aQueryStringVars[i];		
		if ((sParamName.toLowerCase()).indexOf("source") >= 0) {
			sSource = sParamName;
			break;	
		}
		else {
			continue;
		}
	}
	if (sSource == '')
	{
		sSource = 'source=';
	}
	if (sSessionId=='outside_trade') {
		if (ValidateFields()){
		OpenChildWindowNew('/login.asp?v=outside_trade' + '&' + sSource,'Login','159','260');
		}
		return false;	
	}
	else {
		return true;
	}
}

function LoadJSorCSS(sFile,sType)
{
	var head_node = document.getElementsByTagName('head')[0];	
	if (sType == 'link')
	{
		var lnk = document.createElement(sType);	
		lnk.setAttribute('rel','stylesheet');
		lnk.setAttribute('type','text/css');
		lnk.setAttribute('href',sFile);
		head_node.appendChild(lnk);
	}
	else if (sType == 'script')
	{	
		var scr = document.createElement(sType);
		scr.setAttribute('type','text/javascript');
		scr.setAttribute('src',sFile);		
		head_node.appendChild(scr);	
	}	
}

//KP - Replacing AddToWatch with new AddToAlertManagers.
//To achieve "lazy loading", all logic will reside in addtowatch.js
function AddtoWatch(sSymbol,sSymbol1,sSubPageID,sMarketId,nAccountWatchId) {
	jQuery.getScript('/inc/toolbox/addtowatch.js', function() {
		AddtoWatch(sSymbol,sSymbol1,sSubPageID,sMarketId,nAccountWatchId);
	});
}

function OpenOptionBook(sSymbol1,sSymbol2){
	var s;
	var sSym1 = '';
	var sSym2 = '';
	if(sSymbol1 != undefined && sSymbol1 != null)
	{
		sSym1 = sSymbol1;
	}
	if(sSymbol2 != undefined && sSymbol2 != null)
	{
		sSym2 = sSymbol2;
	}
	s=GetSessionID();
	window.open('/OXNetTools/OXNetWebControls/Controls/Quote/QuoteBook/quote_exchange.aspx?SessionId=' + s + '&PAGE_ID=OPTION_BOOK&Symbol1=' + sSym1 + '&Symbol2=' + sSym2,"",'width=500,height=400,resizable=1,toolbars=0,scrollbars=0');
}


function OpenSpreadBook(sSymbol1,sSymbol2)
{
	var s,sString;
	s=GetSessionID();
	if (s=="0")
		window.alert("You must be logged in to use this feature");
	else
	{
		if (sSymbol1 != "")
			sString ="Symbol1=" + sSymbol1 ;
		if (sSymbol2 != "") 
			sString =sString + "&Symbol2=" + sSymbol2 ;
	
		sString ="/quote_option_chain.asp?" + sString + "&page=spread_book&SessionID="+s ;
		//window.alert (sString);
		OpenChildWindow(sString,'',350,370);
		
	}
}

function OpenXSpreadBook() {
	var s,sString;
	s=GetSessionID();
	sString ="/order_support.asp?pageid=orderbook&SessionID=" + s;
	window.open(sString,"", 'width=735,height=700,resizable=yes,scrollbars=yes');
}

function powerOptionsEncrypt(sAccountId) {
	var checksum=0;
	for (j=0; j<sAccountId.length; j++) 
	{
	if ((j+1)%2==1) 
	   checksum = checksum + parseInt(sAccountId.charAt(j));
	else
	   checksum = checksum + (parseInt(sAccountId.charAt(j))*2);
	}
	checksum = checksum%6;
	return (sAccountId + checksum);
}


function powerOptionsOpen(sURL, sAccountId)
{
	var s,a,ca;
	s=GetSessionID();
	a=sAccountId;
	ca = powerOptionsEncrypt(a);
	if(s!="0")
	{
		sURL = sURL + "a="+s+"&b="+ca;
		window.open(sURL); 
	}
	else
	{
		window.open('http://www.poweropt.com/oxUsers/index.asp?page=info');
	}
}


function SpeedTradePopUp()
{
	OpenChildWindow('/account/p_speed_trade.aspx','SpeedTrade','300','710');
}

/* OpenUpdate function used in Paper Trading */
function OpenUpdate(formName,bBalance)
	{
		var SessionID=eval("document." + formName + ".txtSessionID.value;");
		var sOutsideVT ='';
		//var sOutsideVT = eval("document." + formName + ".txtOutsideVT.value;");
		var sBranchID = ''		
		//var sBranchID = eval("document." + formName + ".txtBranchID.value;");
		//alert(sOutsideVT);
		var sURL="/OXNetAccnt/vt/vt_account_update.aspx?SessionID=" + SessionID + "&Balance=" + bBalance + "&OUTSIDE_VT=" + sOutsideVT + "&BRANCH_ID=" +sBranchID;
		var sName="AccountUpdate";
		var sFeatures="width=420,height=370,toolbar=no,scrollbars=no,resizable=yes";
		window.open(sURL,sName,sFeatures);
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function EditLinkedAccount(){
	setTimeout('resetQuote()',5000);	//changed time delay from 5ms to to 5 seconds -(500 ms was displaying reload popup on various pages) 

	var sValue;
	var i;
	var n=0;
	var s;
	var testDrive = checkTestDrive('flag');
	
	i=document.forms.length;
	if (i > 1) {
		for (n=0;n<i;n++) {
			if (document.forms[n].lstAccounts!='undefined' && document.forms[n].lstAccounts!=null) {
				sValue=document.forms[n].lstAccounts.value;
				break;
			}
		}
	}
	else {
		sValue=document.forms[0].lstAccounts.value;
	}
	if (sValue=='-1') { // Edit Linked Accounts
		s=GetSessionID();
		if(testDrive){ // don't open in new window for test drive accounts
			location.href = '/account_profile.asp?PageID=LINKEDACCOUNT&SessionID='+s;
		}else{
			OpenChildWindow('/account_profile.asp?PageID=LINKEDACCOUNT&SessionID='+s,'true','430','400');
		}
		//document.forms[n].lstAccounts.value=document.forms[n].lstAccounts[0].value;
		//document.forms[n].submit();
	} else if (sValue=='-2') { // Open New Account
		s=GetSessionID();
		document.forms[n].lstAccounts.value=document.forms[n].lstAccounts[0].value;
		if(testDrive){
			OpenChildWindowSizeable('/new_account.asp?sessionid='+s,'true','1010','700');
		}else{
			OpenChildWindowSizeable('/new_account.asp?page_id=popup&asid=51&sessionid='+s,'true','1010','700');
		}
	} else if (sValue=='0') { // Spacer
		document.forms[n].lstAccounts.selectedIndex = lAccntListLastSelIndex;
		return(false);
	} else {
		if(document.forms[n].name != "frmAccountDeposit")
		{
			ProcessAccntSel(document.forms[n]);
		}
	}
}

function resetQuote(){
	if(parent)
	{
		if(parent.frames.length > 0){
			if(parent.frames[0]){
				var qFrame = parent.frames.length-1;
				if(parent.frames[qFrame])
				{
					if(parent.frames[qFrame].document.forms.length > 0)
					{
						if(parent.frames[qFrame].document.forms[0].lstAccounts == undefined)
						{
							parent.frames[qFrame].document.location.reload(true);
						}
					}
				}
			}
		}
	}
}

// JY - lstAccounts onfocus event handler
function AccntListFocusReceived() {
	var i;
	var n = 0;
	
	i = document.forms.length;
	if (i > 1) {
	  for (n=0; n<i; n++) {
	    if (document.forms[n].lstAccounts!='undefined' && document.forms[n].lstAccounts!=null) {
	     break;
	    }
	  }
	}
	lAccntListLastSelIndex = document.forms[n].lstAccounts.selectedIndex;
}

/* Pop Up Window Section */

/* SPR - Functions used for Arca and Island pop up books */
              
function NewArcaPop() {
	var symbol = document.forms[0].txtSymbol.value;
	if (symbol == null)
		symbol = document.forms[0].txtSymbol[0].value;
	var iHeight = 455;
	var iWidth = 489;
	var iTop = (screen.availHeight - iHeight) / 2;
	var iLeft = (screen.availWidth - iWidth) / 2;
	var s = GetSessionID();
	if (s==0)
	{
	location.href="login.asp";
	}
	else
	{
	//createArcaWindow('http://datasvr.tradearca.com/arcadataserver/JArcaBook.php?userID=optionsXpress',symbol,'javabook','489','455');
	window.open("https://www.optionsxpress.com/quotes/arca_quote_box.htm?SESSIONID=" + GetSessionID() + "&symbol="+ symbol + "&exchange=ARCA", 'ARCABOOK', 'personalbar=no,toolbar=no,status=no,scrolling=yes,location=no,resizable=no,menubar=no,width=445,height=460');
	}

}

function createArcaWindow (url, symbol, name, width, height) {
	var rand_num=Math.floor(Math.random()*999999);
	name = name + rand_num;
	if (symbol != null){
		url = url + "&Symbol=" + symbol

	}
	//tearWin=window.open(url, name, 'personalbar=no,toolbar=no,status=no,scrolling=yes,location=no,resizable=no,menubar=no,width=' + width + ',height=' + height);
	tearWin=window.open("/symbol_lookup.asp?SESSIONID=" + GetSessionID() + "&PAGE_ID=ARCA_WEBBOOK&URL="+url, name, 'personalbar=no,toolbar=no,status=no,scrolling=yes,location=no,resizable=no,menubar=no,width=' + width + ',height=' + height);	
}

function islandPopUpBook() { 
	var symbol = document.forms[0].txtSymbol.value;
	window.open("http://" + location.hostname + "/island_book.asp?symbol=" + symbol,"Active", 'width=260,height=530,resizable=yes');
}

function IslandPopUpBook(symbol) { 
     if (symbol != '') 	
		window.open("http://" + location.hostname + "/island_book.asp?symbol=" + symbol,"Active", 'width=260,height=530,resizable=yes');
}



/* SPR - End Functions used for Arca and Island pop up books */

function OpenJavaOptionBook(sSymbol1){
	launchQuoteBook(sSymbol1);
}

function SniffProtocol(server)
{
	var http=location.protocol;	
	var h;
	var url;
	h=http.substring(0,5);
	if (h=='http:')
	{
		http='http';
	}
	else
	{
		http='http';
	}
	server=(server.substring(7,(server.length-1)));
	
	
	if (server.length > 0)
	{
		url = http +':/'+ server+ '/'
	}
	else
	{
		url = '';
	}
	
	return url;
}

/* SPR - Function used for pop-up Analyzer  */
function openPLChart(url) {
	window.open(url,"","width=730,height=500,resizable=no,scrollbars=yes");
}

function OpenTradersDiary(server,session) {
	//if (server == "" || server == "/"){
	//	server="https://" + location.hostname;
	//}
	var url='/OXNetAccnt/Account/account_trader_diary.aspx?SessionID=' + session;
	window.open(url ,"",'width=442,height=500,resizable=0,toolbars=0,scrollbars=1');
}

//function OpenCommissionCalculator(server,session) {
function OpenCommissionCalculator() {
	//var path='OXNetAccnt/Trade/trade_commission_calculator.aspx?SessionID=' + session;
	var server="https://" + location.hostname;
	/*if (location.hostname!='wayne') {
		server='http://oxbranch.optionsxpress.com/';
	}*/
	var path='/OXNetAccnt/Trade/trade_commission_calculator.aspx';
	url=server + path;
	//url=server + path;
	window.open(url ,"",'width=317,height=183,resizable=0,toolbars=0,scrollbars=0');
	//window.open(url ,"",'width=320,height=180,resizable=0,toolbars=0,scrollbars=0');
}

function GetPrintableConfirmsURL(server,session) {
	var path='/OXNetAccnt/Account/confirms/account_confirms_printable.aspx?SessionID=' + session;
	url=server + path;
	window.open(url ,"",'width=442,height=500,resizable=0,toolbars=0,scrollbars=1');
}

// This is a function for the chain body include file header
function SubmitChainsLinksBody(page){
        document.forms[0].lstOption.value = page;
        document.forms[0].submit();
}

function OpenHTMLConfirm(sList,Price,Bust,Date,DRID,StartDate,EndDate)
{
	var Type='HTML';
	var s=GetSessionID();
	window.open ('/OXNetAccnt/Account/confirms/account_confirms_printable_display.aspx?PageID=account_confirms_printable&Price=' + Price + '&Date=' + Date + '&Bust=' + Bust + '&Type=' + Type + '&SessionID=' + s + '&DRID=' + DRID + '&SelectedList=' + sList + '&SD=' + StartDate + '&ED=' + EndDate,"",'width=742,height=950,resizable=1,toolbars=1,scrollbars=1');
}

function OpenTimeSeries(sym) {
	var s=GetSessionID();
	var symbol;

	if(sym > '')
		symbol = sym;
	else
		symbol = document.forms[0].txtSymbol.value;

	//window.open("/quote_detail.asp?SESSIONID=" + s + "&PAGE_ID=TIME_SERIES&symbol=" + symbol, "frmTimeSeries", "width=450,height=500,toolbar=no,scrollbars=yes");
	window.open("/OXNetTools/Quote/TimeSalesSeries.aspx?SessionID=" + s + "&Symbol=" + symbol, "frmTimeSeries", "width=450,height=500,toolbar=no,scrollbars=yes");	
}

function OpenCenterPieceDownLoad()
{
	var s=GetSessionID();
	window.open ('/OXNetAccnt/Account/DownLoads/account_down_load_data.aspx?&SessionID=' + s  ,"",'width=650,height=360,resizable=1,toolbars=1,scrollbars=1');
	
}

function OpenCenterPieceDownLoad(PageId)
{
	var s=GetSessionID();
	window.open ('/OXNetAccnt/Account/DownLoads/account_down_load_data.aspx?&SessionID=' + s + '&PageID=' + PageId   ,"",'width=650,height=360,resizable=1,toolbars=1,scrollbars=1');
	
}

function notrade(url)
{
		newwindow=window.open(url,'name','height=250,width=300');
		if (window.focus) {newwindow.focus()}
}

function CheckLstDate(win)
{
	var aLstValue,bLstValue,sLstValue,sLstValue1,bFlag;
	sLstValue=win.hidEndDates.value;
	sLstValue1=win.hidStartDates.value;
	aLstValue=sLstValue.split("+");
	bLstValue=sLstValue1.split("+");		

	for (var i=0; i<12; i++)
	//for (var i=1; i<aLstValue.length + 1; i++)
	{
		if (win.lstDateRange.value == 11)
		{
			if (win.txtStartDate!=null) {
				win.txtStartDate.value="";
				win.txtEndDate.value="";	
			}
		}
		else
		{
			if (win.lstDateRange.value == i)
			{		
				win.txtStartDate.value=bLstValue[i];
				win.txtEndDate.value=aLstValue[i];	
			}
		}	
	}
	win.hidStartDate.value = win.txtStartDate.value;
	win.hidEndDate.value = win.txtEndDate.value;

}

function SetDateRange(frm)
{
	
	//Determine if value has changed before changing the period
	//in some cases the value of Date Range is 7
  if (frm.lstDateRangeID != undefined && frm.lstDateRangeID != null)
 {
	
	 if (frm.lstDateRangeID.value !=7)
	{
	
		if (frm.txtStartDate.value != frm.hidStartDate.value || frm.txtEndDate.value != frm.hidEndDate.value)
		{
			frm.lstDateRangeID.value=7;
		}	
	}
	else
	{
		frm.lstDateRangeID.value=7;
	}
 }
 else if (frm.lstDateRange != undefined && frm.lstDateRange != null)
 {
	if (frm.lstDateRange.value !=11)
	{
	
		if (frm.txtStartDate.value != frm.hidStartDate.value || frm.txtEndDate.value != frm.hidEndDate.value)
		{
			frm.lstDateRange.value=11;
		}	
	}
	else
	{
		frm.lstDateRange.value=11;
	}
 }
}
function ValidateDateRange(frm)
{
	RemSpaces(frm.txtEndDate,'A');
	RemSpaces(frm.txtStartDate,'A');
	var datStartDate=frm.txtStartDate.value;
	var datEndDate=frm.txtEndDate.value;
	
	if (frm.lstDateRange.value==11)
	{
		if (datStartDate.length==0)
		{
			PromptFocus(frm.txtStartDate, "Please enter start date.");
			return(false);
		}
		if (datEndDate.length==0)
		{
			PromptFocus(frm.txtEndDate, "Please enter end date.");
			return(false);
		}	
		if (IsAnyAlphaCharactersExist(datStartDate,0))
		{
			PromptFocus(frm.txtStartDate, "Please enter a valid start date.");
			return false;
		}
		
	
		if (IsAnyAlphaCharactersExist(datEndDate,0))
		{
			PromptFocus(frm.txtEndDate, "Please enter a valid end date.");
			return false;
		}
		
		var nValidDate=isValidDate(datStartDate);
		if (nValidDate==1)
		{
			frm.txtStartDate.value="";
			PromptFocus(frm.txtStartDate, "Please enter a date in the following format: mm/dd/yyyy.");
			return(false);
		}
		if ((nValidDate==2) || (nValidDate==3)) 
		{
			frm.txtStartDate.value="";
			PromptFocus(frm.txtStartDate, "Please enter a valid date.");
			return(false);
		}
		nValidDate=isValidDate(datEndDate);
		if (nValidDate==1)
		{
			frm.txtEndDate.value="";
			PromptFocus(frm.txtEndDate, "Please enter a date in the following format: mm/dd/yyyy.");
			return(false);
		}
		if ((nValidDate==2) || (nValidDate==3)) 
		{
			frm.txtEndDate.value="";
			PromptFocus(frm.txtEndDate, "Please enter a valid date.");
			return(false);
		}
		var oStartDate=new Date(datStartDate);
		var oEndDate=new Date(datEndDate);
		if(isNaN(oStartDate) || isNaN(oEndDate)){
			window.alert("Please make sure the start and end dates are in mm/dd/yyyy format.");
			return(false);
		}
		if (oStartDate>oEndDate)
		{
			frm.txtEndDate.value="";
			PromptFocus(frm.txtEndDate, "Please enter a date after the Start Date.");
			return(false);
		}
		return(true);			
	
	}
	return(true);			
}

function trim(inputString) {   
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function setLstBox(oLstBox,sValue){
	if(oLstBox!=null){
		//window.alert(oLstBox.options.length);
		var nCount=oLstBox.options.length;
		for(var n=0; n<nCount; n++){
			if(oLstBox.options[n].text==sValue){
				oLstBox.selectedIndex=n;
			}
		}
	}
}
//DS : 21581 : 1/24/2007
function setLstBoxByValue(oLstBox,sValue){	
	if(oLstBox!=null){		
		var nCount=oLstBox.options.length;
		for(var n=0; n<nCount; n++){
			if(oLstBox.options[n].value==sValue){				
				oLstBox.selectedIndex=n;
				break;
			}
		}
	}
}

function getRadSelIndex(oRad){
	var nCount=oRad.length;
	var nRet=-1;

	for(var i=0;i<nCount;i++){
		if(oRad[i].checked){
			nRet=i;
			break;
		}
	}
	return(nRet);
}

function MutualFundLookUp(sForm,sControl,sPageControl,sPageControlValue, bDoNotRefresh) {
	var s=GetSessionID();
	var sPath = '/symbol_lookup.asp?PAGE_ID=FIND_MF&FORM=' + sForm + '&CONTROL=' + sControl + '&PageControl=' + sPageControl + '&PageControlValue=' + sPageControlValue + '&SessionID=' + s;
	if(bDoNotRefresh != undefined && bDoNotRefresh == true){
		sPath = sPath + '&Refresh=0';
	}
	OpenChildWindowSizeable(sPath,'','575','215');
}

// Displays Prophet Chart in a popup window
function openProphetCharts() {
	var s, sym, sTemp;
	sym = "QQQ";
	s=GetSessionID();
	sTemp = 'https://www.optionsxpress.com/quote_charts.asp?sessionid=' + s + '&symb=' + sym + '&PageID=STREAMING_CHARTS';
	OpenChildWindowSizeable(sTemp,'StreamingChart','550', '435');
}

// SPR: Sets focus in input boxes when page loads (e.g. home page, quote detail, etc.
function BoxFocus(form, element) {
	var loadfocus;
	loadfocus = "document." + form + "." + element + " != null";
	if (eval(loadfocus))
	{	
		loadfocus = "document." + form + "." + element + ".focus();";
		eval(loadfocus);
	}
}

//AV Detachable Calculator 03/24/2004
function DetachCalculator(symbol1, symbol2, symbol3, symbol4, type1, type2, type3, type4) {
	var s;
	s = GetSessionID();
	OpenChildWindowSizeable('/position_chart.asp?PageID=trade_calculator&DETACH=TRUE&CALCULATE=FALSE&txtSymbol1='+symbol1+'&txtSymbol2='+symbol2+'&txtSymbol3='+symbol3+'&txtSymbol4='+symbol4+'&txtAct1='+type1+'&txtAct2='+type2+'&txtAct3='+type3+'&txtAct4='+type4+'&SessionID='+s,'','748','550');
}

/**
* Checks if a window pops up without a session - AV Issue 6964 - 03/29/04
*/
function checkOpener(href){
    
     if (opener && !opener.closed){
	  
		window.opener.location.href = href;
		window.close();
		}
	
}

function ResetLeapAndMonth(){
	document.frmOptChain.txtMonths.value = "";
	document.frmOptChain.txtLeap.value = "";
}


// Selects all check boxes in the string as in the master checkbox
// sCheckboxes is the list of names of the checkboxes without the prefix and comma-separated
// sPrefix is the prefix for each checkbox name (usually chk)
// sForm is the form name
// sMasterCheckBox is the name of the master checkbox
function MatchCheckboxesToMaster(sCheckboxes,sPrefix,sForm, sMasterCheckBox)
{
 var checklist_array=sCheckboxes.split(",");
 
 for (i=0; i < checklist_array.length; i++)
 {
	s = sForm+"."+sPrefix+checklist_array[i]+".checked = " + sForm+"."+sMasterCheckBox+".checked;";
	eval(s);
 }
}


// Enables or disables the command button based on the checkboxes
// sCheckboxes is the list of names of the checkboxes without the prefix and comma-separated
// sPrefix is the prefix for each checkbox name (usually chk)
// sForm is the form name
// sButton is the button to be enabled or disabled
// schkAll is the master chkAll box that becomes checked or unchecked
function SetButtonToCheckboxes(sCheckboxes,sPrefix,sForm, sButton,schkAll)
{
 var checklist_array=sCheckboxes.split(",");
 checkboxeson=0;
 for (i=0; i < checklist_array.length; i++)
 {
	s = sForm+"."+sPrefix+checklist_array[i]+".checked == true";
	if (eval(s)) {
		checkboxeson = checkboxeson + 1;
        }
 }
 if (checkboxeson == 0){
    s=sForm+"."+sButton+".disabled = true;";
    d=sForm+"."+schkAll+".checked = false;";
    eval(d);
 }
 else{
    s=sForm+"."+sButton+".disabled = false;";
    if (checkboxeson == checklist_array.length){
	d=sForm+"."+schkAll+".checked = true;";	
        eval(d);
    }
 }
 eval(s);
}

/* Used for links in popup windows.  Place around link so it will load in the main window. */
function Detach(sValue) {		
	window.opener.location = sValue;
	window.opener.focus(); 
}


function AddBeneficiary(nInitAccountID) {
	var s=GetSessionID();
	OpenChildWindowSizeable('/new_accnt_support.asp?PageID=ACCOUNT_BENEFICIARY&SessionID=' + s + '&INIT_ACCNT_ID=' +nInitAccountID,'','1100','650');
}

/* Expand/Collapse */
function RowsShowHide(sImg,sTrid,nLegs,startindex,usesmallimages) 
{
	/**********************************************
	Clean the Start index if not passed 
	**********************************************/
        if (startindex==null)
	{startindex=0;}
	if (!IsNumeric(startindex))
	{startindex=0;}
   	if (usesmallimages==null)
	{usesmallimages=0;}
	if (!IsNumeric(usesmallimages))
	{usesmallimages=0;}
	/***************************************************
	Start Index Used for Nested ShowHide
	  - Is StartIndex > 0 Indicates Nested ShowHide
	***************************************************/
	
	var bForce=0;
	var expanded=0;
		
	/***************************************************
	If top level is selected. 
	 - Check Icon of top strid&startindex
	   if minus then need to hide all sub rows
	   if plus then show all sub rows

	***************************************************/
	if (startindex==0)
	{
		bForce=1
		var test;
		var gif;

		test = 'document.' + sImg + '.src'
		var parts=eval(test).split("/");
		gif=parts[parts.length-1];			
		if (gif!='minus.gif' && gif!='minus_sm.gif' && gif!='minus_bg.gif')
		{
			expanded=1;
		}
		if(gif=='minus_bg.gif' || gif=='plus_bg.gif'){
			usesmallimages=2;
		}
		
	}
	RowsShowHideBase(sImg,sTrid,nLegs,bForce,expanded,startindex,usesmallimages)
}
function RowsShowHideBase(sImg,sTrid,nLegs,bForce,expanded,startindex,usesmallimages) 
{
/**********************************************
Cleans the Start index
**********************************************/
   if (startindex==null)
   {
  	startindex=0;
   }
   if (!IsNumeric(startindex))
   {
  	startindex=0;
   }
   if (usesmallimages==null)
   {
  	usesmallimages=0;
   }
   if (!IsNumeric(usesmallimages))
   {
  	usesmallimages=0;
   }
   var i;
   var trid; 
   var s;
   var lastvalidtrid;
   var lastvalidimg;
   var count;
	count= Number(startindex) +Number(nLegs);
	for (i = startindex; i < count; i++) 
	{
   		try
   		{
			trid = sTrid + i;
			if (bForce==1)
			{
				if (expanded==0)
				{       	
					document.getElementById(trid).style.display='none';       
				}
				else 
				{
					document.getElementById(trid).style.display='';
				}
			
			}
			else
			{
				if (document.getElementById(trid).style.display == '') 
				{       	
					document.getElementById(trid).style.display='none';       
				}
				else 
				{
					document.getElementById(trid).style.display='';
				}
			}
			
			
			
			lastvalidtrid =trid;
		}
		catch(exception)
		{
			break;
		}
   	}
	/*****************************************************
	StartIndex > 0 indicates that nested showhide
	 - Use plus_sm.gif/minus_sm.gif
	*****************************************************/
   	if (document.getElementById(lastvalidtrid).style.display == 'none') 
	{       	
			
		if (usesmallimages==1)
		{
	   		s = 'document.' + sImg + '.src="' + cdn_path + '/images/icons/plus_sm.gif"' ;  	        
		}
		else if(usesmallimages==2){
			s = 'document.' + sImg + '.src="' + cdn_path + '/images/icons/plus_bg.gif"' ;
		}
		else
		{
	   		s = 'document.' + sImg + '.src="' + cdn_path + '/images/icons/plus.gif"' ;  	        
		}
   	}
   	else 
   	{       
		if (usesmallimages==1)
		{
		   	s = 'document.' + sImg + '.src="' + cdn_path + '/images/icons/minus_sm.gif"';    	
		}
		else if(usesmallimages==2){
			s = 'document.' + sImg + '.src="' + cdn_path + '/images/icons/minus_bg.gif"' ;
		}		
		else
		{
			s = 'document.' + sImg + '.src="/images/icons/minus.gif"';    	
		}

   		
   	}
	eval(s);
}

function ShowHideElementId(sTrid,bShow)
{
	if(bShow) 
	{
		document.getElementById(sTrid).style.display='';
	}
	else
	{
		document.getElementById(sTrid).style.display='none';
	}
}

/* for external links dm 10/20/04 */
function OpenExit(sLink,sName) {
	OpenChildWindowSizeable('/exit_popup.aspx?site=' + sLink + '&name=' + sName,'','405','295');
}

function SetContributionYear(sForm) {
	var nContributionID=sForm.lstContributionCode.value;

	if (nContributionID==6 || nContributionID==8 || nContributionID==9) {
		var todaysDate= new Date();	
		var year=todaysDate.getFullYear();
		if(sForm.lstContributionYear){
			sForm.lstContributionYear.value=year;
			sForm.lstContributionYear.disabled=true;
		}
	}
	else {
		//sForm.lstContributionYear.value="";
		if(sForm.lstContributionYear){
			sForm.lstContributionYear.disabled=false;	
		}
	}
}

function ViewUncleardFunds() {
	var s=GetSessionID();
	OpenChildWindowSizeable('/account_balance.asp?SessionID=' + s + '&PageID=AccountUnClearFunds', 'AccountUnClearFunds', '700','400');
}

function PopulateProvince(sForm,sTxtControl,sLstControl) {
	var s;

	s = "document.forms." + sForm.name + "." + sTxtControl + ".value=document.forms." + sForm.name + "." + sLstControl + "[document.forms." + sForm.name + "." + sLstControl + ".selectedIndex].text";
	eval(s);
}

function ReloadProvinces(sForm) {
	sForm.txtReloadProvince.value="true";
	sForm.submit();
}

function OpenDisclosure(sName) {
	var s='/newaccount/disclosures/' + sName + '.htm';
	OpenChildWindowSizeable(s,'','600','500');
}

function ValidQQQSymbol(sSymbol,sCtrl){
	//alert(sSymbol.toUpperCase);
	if (trim(sSymbol).toUpperCase() =="QQQ"){
		PromptFocus(sCtrl, "The Symbol 'QQQ' has been changed to 'QQQQ'");
		sCtrl.value = "QQQQ";
		return false;
	}
	else {
		return true;
	}
}

//AV check whether cookies are enabled
function IsCookieEnabled(){
		document.cookie = "test=cookiesEnabled";
		var pos = document.cookie.indexOf( "test=" );
		if( pos == -1 ) {
			return false;
		}
		else {
			return true;
		}
    }

// JY 02/09/2005 - Used in Web Broker - Opens popup for adding notes on XView and Broker View pages
function OrderNotePopup(sOrderID) {
  var s;
  s=GetSessionID();
  OpenChildWindow('/broker_report.asp?pageid=brokerordernote&subPageID=view&orderID='+sOrderID+'&SessionID='+s,'','350','250');
}

// MB 03/04/2005 - Market Data tab script for index page
var oldTab = "ex1"
function exTab(tab){
        if (oldTab != null){ 
                document.getElementById(oldTab).className="exch"; 
        }
        document.getElementById(tab).className="exch2"; 
        oldTab=tab; 
}

//AV Changes the color of the highlighted row
function ChangeColor(target, changeClass, clsName){	
	if (clsName == null || clsName == 'undefined'){
		clsName = getElement(target).className;				
		if ( clsName != changeClass ) {
			getElement(target).className = changeClass;
		} 
		else {
			getElement(target).className = clsName;	      
		} 
	}
	else {		
		getElement(target).className = clsName;	  
	}
}

function getElement(eid) {
	if (document.all) {
		return document.all[eid];
	}
	if (document.getElementById) {
		return document.getElementById(eid);
	}
}

//DM 3/23/05 Javascript hide contents function. call as lotechHide(0,0,1,1);  0=don't hide, 1=hide for (ox,oxi,ob,bx)
//tag content block with id="hideContent". get firm on page with:
//firm = "<WC@FIRMNAME>optionsXpress</WC@FIRMNAME>"; or for webbase pages:
//firm = '<span value=WC@FIRMNAME runat=server><WC@FIRMNAME></WC@FIRMNAME></span>';
//firm = firm.substring(firm.indexOf(">")+1);
//firm = firm.substring(0,firm.indexOf("<"));
//useful for pages that don't rescan tags
	function lotechHide(ox,oxi,ob,bx){
		if (ox == "1" && firm == "optionsXpress"){
			document.getElementById("hideContent").style.display = "none";
		}
		if (oxi == "1" && firm == "optionsXpress"){
			document.getElementById("hideContent").style.display = "none";
		}
		if (ob == "1" && firm == "optionsXpress Australia"){
			document.getElementById("hideContent").style.display = "none";
		}
		if (bx == "1" && firm == "brokersXpress"){
			document.getElementById("hideContent").style.display = "none";
		}
	}

	//AV not used for now
	function CheckExceptionSymbol(sSymbol) {
		if (trim(sSymbol).toUpperCase() =="S"){
			alert("Corporate action in process and pricing is complex. \n Contact LiveHelp or call if you have questions.");
		}
		return true;	
	}

//dm 3/24/05 for FAQ pages.  different targets for popup vs. onsite version of page.
function popCheck(){
	var s=GetSessionID();
      if (pop == 1)
       {
         location.href="/welcome/faq/p_faq.aspx?SessionID=" + s;
       }
      else
       {
         location.href="/welcome/faq/index.aspx?SessionID=" + s;
       }  
	}

function changeLink (par) {
	var s=GetSessionID();
      if (pop == 1)
       {
    window.opener.location.href = "javascript:AppendSessionID('" + par + "')";
     } else  {
         location.href =  "javascript:AppendSessionID('" + par + "')";
       } 
}
function ValidateSeqID(sRoute, sSeqID) {
   /* return codes:
         0 = Pass
        -1 = Fail - zero-length string or string "0"
        -2 = Fail - too many chars.
        -3 = Fail - not all numeric (if route not ISE_OM and route not RJO) */ 
   var nReturnCode = 0;
   var bContinue = true;

   // first check if user typed in a value
   if (sSeqID.length == 0 || sSeqID == "0") {
     nReturnCode = -1;
     bContinue = false;
   }

   // next check length (<= 16 chars)
   if (sSeqID.length > 16 && bContinue) {
     nReturnCode = -2;  
     bContinue = false;
   }     
      
   // next check if numeric (if route not ISE_OM and route not RJO)
   if (sRoute != "ISE_OM" && sRoute != "RJO" && sRoute != "OXSMRT" && !IsNumeric(sSeqID) && bContinue) {
     nReturnCode = -3;
   }

   if ((sRoute == "ISE_OM" || sRoute == "RJO") && sSeqID=="ACK") {
     nReturnCode = -4;
   }

   return nReturnCode;   
}

function IsNumeric(strString) {
   //  check for valid numeric strings	
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;


   for (i = 0; i < strString.length && blnResult == true; i++) {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1) {
        blnResult = false;
      }
   }
   return blnResult;
}	

//AV Used in Stock Preview
function showHaltedStockWarning(bShowWarning){
	if (bShowWarning.toUpperCase() == "TRUE"){
		window.alert("Trading has been halted for this security. \nIf placing a market order, your order could execute at "+
				"a price significantly different from the last trading quotation." + 
			"\nLimit orders may be used to protect against adverse price movement, however," +
			" limit orders by their nature are not guaranteed execution.");
	}
}

//JY 20050511 - Used on Balances page - Broker with a perm. will have popup to edit 'Pending Dividends' value
function ViewPendDividends(nForeignMarketID) {
	var s=GetSessionID();
	OpenChildWindowSizeable('/account_balance.asp?SessionID=' + s + '&PageID=AccntBalPendDividends' + '&lstMarket=' + nForeignMarketID, 'AccntBalPendDividends', '375','275');
}
function launchQuoteBook(symbol){
var s;
s=GetSessionID();
var sFeatures="width=445,height=460,toolbar=no,scrollbars=no,resizable=yes";
var sName = "https://www.optionsxpress.com/quotes/quote_box.htm?sessionid="+s+"&symbol="+symbol;
window.open(sName,"", sFeatures);
}

//JY 20050526
function OpenFutureLookup(sForm, sControl, bShowExpDate, sSymbol, sSource) {
	var sUrl;
	var sPageID;

	if (bShowExpDate)
		sPageID = "find_futures_date";
	else
		sPageID = "find_futures";

	sUrl = "/symbol_lookup.asp?page_id=" + sPageID + "&form=" + sForm + "&control=" + sControl;

	if(sSymbol != undefined && sSymbol != "")
	{
		sUrl = sUrl + "&Symbol=" + sSymbol;
	}
	if(sSource != undefined && sSource != "")
	{
		sUrl = sUrl + "&SOURCE=" + sSource;
	}
	
	OpenChildWindow(sUrl,'FuturesLookup','500','215');
}
//SC
function OpenFutureOptionLookup(sForm, sControl, bShowExpDate, sSymbol) {
	var sUrl;
	var sPageID;
	var option;
	if (bShowExpDate)
		sPageID = "option";
	else
		sPageID = "find_futures";
	sUrl = "/symbol_lookup.asp?page_id=" + sPageID + "&form=" + sForm + "&control=" + sControl + "&PageControl=option" ;

	if(sSymbol != "")
	{
		sUrl = sUrl + "&Symbol=" + sSymbol;
	}
	
	OpenChildWindow(sUrl,'FuturesLookup','500','215');
}

//JY 20050707
function OrderStatusCheck(sValue,sSeqId,sAccntNum,sOrderStatus) {
	var s,sTemp;
	s=GetSessionID();
	sTemp = "/order_support.asp?PageID=OrderStatusCheck&sessionid=" + s + "&OrderNumber=" + sValue + "&SeqID=" + sSeqId + "&AccntNum=" + sAccntNum + "&OrderStatus=" + sOrderStatus;
	OpenChildWindow(sTemp,'true','330','300');
}
//MB 20050713
function LaunchXtendlite() { 
	LaunchXtend();
} 

function LaunchXtend() {
	var s;
	s=GetSessionID();
	window.open("https://xtend.optionsxpress.com/xtend/index.asp?s=btn_xtend&SessionID="+s,"","width=1000,height=800,resizable=1,toolbars=0,scrollbars=0");
}

// SPR Search Functions
searchFocus='false';
function searchSubmit(bFramed) {
	var testdrive;
	if(searchFocus == 'true'){

	if(document.forms[0]){
		for(i=0;i<document.forms[0].elements.length;i++){  
    	        document.forms[0].elements[i].disabled = true; // disable form for enter key submit on search
		}
	}
	window.onUnload = enableForm();
	var isFramed = bFramed;
	
	var s;
	s=GetSessionID();

	if(document.getElementById('txtTestDriveH')){
		if(document.getElementById('txtTestDriveH').value=='true'){
			testdrive = "true";
		}
		else{
			testdrive = "false";
		}
	}
	else{
		testdrive = "false";
	}

	var searchValue = document.getElementById("qt").value;
	searchValue = StripIllegalChars(searchValue);				
	if (searchValue != "") {
		if (isFramed == "1")
		{ // Used for triple framed pages					
			parent.location.href =  "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en";				
		} 
		else if (isFramed == "0") 
		{ // Used for non-session and two framed pages
			var is_opera = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 
			var is_mac = navigator.userAgent.toLowerCase().indexOf("mac") != -1; 			
			if(is_opera || is_mac)
			{ 			
				parent.location.href = "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en";					
			}
			else
			{				
				location.href =  "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en";
			}
		}
	} else {
		window.alert("Please enter your search request.");
		enableForm();
	}

	}else{
		return false;
	}	
}

function enableForm(){
	if(document.forms[0]){
		for(i=0;i<document.forms[0].elements.length;i++){ 
    		document.forms[0].elements[i].disabled = false; // re-enable form on empty search query & back button
		}
	}
}

//EA 10/27/2006
function searchSubmitButton(bFramed) {
	var testdrive;
	if(document.forms[0]){
		for(i=0;i<document.forms[0].elements.length;i++){  
    	        document.forms[0].elements[i].disabled = true; // disable form for enter key submit on search
		}
	}
	window.onUnload = enableForm();
	var isFramed = bFramed;
	
	var s;
	s=GetSessionID();
	
	if(document.getElementById('txtTestDriveH')){
		if(document.getElementById('txtTestDriveH').value=='true'){
			testdrive = "true";
		}
		else{
			testdrive = "false";
		}
	}
	else{
		testdrive = "false";
	}

	var searchValue = document.getElementById("searchBody").value;
	searchValue = StripIllegalChars(searchValue);
					
	if (searchValue != "") {
		if (isFramed == "1") { // Used for triple framed pages
			parent.location.href =  location.protocol + "//" + location.hostname + "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en&testdrive=" +testdrive;
		} else if (isFramed == "0") { // Used for non-session and two framed pages
			var is_opera = navigator.userAgent.toLowerCase().indexOf("opera") != -1; 
			var is_mac = navigator.userAgent.toLowerCase().indexOf("mac") != -1; 			
			if(is_opera || is_mac){ // mac and opera have location.href issues
				parent.location.href = location.protocol + "//" + location.hostname + "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en&testdrive=" +testdrive;
			}
			else{
				location.href = location.protocol + "//" + location.hostname + "/OXNetTools/Search/SearchInterceptor.aspx?sessionid=" + s + "&qt=" + searchValue + "&col=oxps&charset=iso-8859-1&la=en&testdrive=" +testdrive;
			}
		}
	} else {
		window.alert("Please enter your search request.");
		enableForm();
	}			
}

function disableEnterKey(e) {
	var key;

	if(window.event) {
		key = window.event.keyCode;     //IE
	} else {
		key = e.which;     //firefox
	}

	if(key == 13) {
		return false;
	} else {
		return true;
	}
}

//DM 11/21/05
function getFirmType(){
	var urlFirm = location.href;
	urlFirm = urlFirm.toLowerCase();
	var firm = '';
	if(urlFirm.indexOf('.sg')!=-1 || urlFirm.indexOf('sg.eqdesign')!=-1 || getCookie('Firm')=='SN'){
		firm = 'SN';
	}
	else if(urlFirm.indexOf('.ca')!=-1 || urlFirm.indexOf('ca.eqdesign')!=-1 || getCookie('Firm')=='CA'){
		firm = 'CA';
	}
	else if(urlFirm.indexOf('.au')!=-1 || urlFirm.indexOf('au.eqdesign')!=-1 || getCookie('Firm')=='OB'){
		firm = 'OB';
	}
	else if(urlFirm.indexOf('brokersxpress')!=-1 || urlFirm.indexOf('bx.eqdesign')!=-1 || getCookie('Firm')=='BX'){
		firm = 'BX';
	}
	else if(urlFirm.indexOf('advisorsxpress')!=-1 || urlFirm.indexOf('ax.eqdesign')!=-1 || getCookie('Firm')=='AX'){
		firm = 'AX';
	}
	else if(urlFirm.indexOf('optionsxpress.europe')!=-1 || urlFirm.indexOf('optionsxpress.eu')!=-1 || urlFirm.indexOf('eu.eqdesign')!=-1 || getCookie('Firm')=='EU'){
		firm = 'EU';
	}
	else if(urlFirm.indexOf('oxint')!=-1 || urlFirm.indexOf('oxint.eqdesign')!=-1 || getCookie('Firm')=='OXI'){
		firm = 'OXI';
	}	
	else {
		firm = 'OX';
	}
	//alert(firm);
	return firm;
}

//DM 12/01/05 For IE browser data tables.  Will insert &nbsp; into empty cells so styles will be applied.
function emptyCells(){
	var numTd = document.getElementsByTagName("td").length;
	for(i=0;i<=numTd;i++){
		if(document.getElementsByTagName("td")[i]){
			if (document.getElementsByTagName("td")[i].innerHTML == '') {
	      		document.getElementsByTagName("td")[i].innerHTML = '&nbsp;';
			}
	    }
	}
}

//AV 12/09/2005 - Generic Function called from Future Lookup - can be overridden
function PopulateFuturesSymbol(sForm, sControl, sSymbol, sSymbolDescription, sSource) {
		s="self.opener.document." + sForm + "." + sControl;
		eval(s + ".value='"+ sSymbol + "'");
		if(sSource!=undefined)
		{
			if(sSource=="FUTURES_OPTIONS")
			{
				s="self.opener.GetChains()"
				eval(s);
				return;
			}
		}
		if(sForm == "frmQuoteDetail" || sForm == "frmOptChain" || sForm == "frmFuturesDetail"){
			s="self.opener.document." + sForm + ".submit()";
			eval(s);
		}
		else if(sForm == "frmTrade"){
			eval(s + ".onchange();");
		}
		else if(sForm == "frmSnapChart"){
			top.parent.opener.OnSymbolChange();
		}		
}


function CFutActivToDisplay(sSymbol)
{
	if(sSymbol==null)return sSymbol;
	var sExpYear
	var nPos = sSymbol.indexOf('/');

	if(nPos > 0 && sSymbol.length == nPos + 4)
	{
		var sRootSymbol = sSymbol.substr(0, nPos)
		var sExpMonth = sSymbol.substr(nPos + 3, 1);

		if( (isInteger(sSymbol.substr(nPos + 1, 2))) && (sSymbol.substr(nPos + 1, 1)!='0') ){
			sExpYear = parseInt(sSymbol.substr(nPos + 1, 2));
		}else{
			sExpYear = sSymbol.substr(nPos + 2, 1);
		}

		sSymbol = sRootSymbol + sExpMonth + sExpYear;
	}
	
	return sSymbol;
}

function ChangeSymDescr(sSymbolDescription){
	if(document.getElementById("spanFUTPRODDESC") != null) {				
			document.getElementById("spanFUTPRODDESC").innerHTML = sSymbolDescription;
	}

	document.frmTrade.txtSymbol.value = CFutActivToDisplay(document.frmTrade.txtSymbol.value.toUpperCase());
}

function ChangeLastTradeDateMsg(sDescription){
	if(document.getElementById("SpanLASTTRADEDATEMSG") != null)
	{
		document.getElementById("SpanLASTTRADEDATEMSG").innerHTML = sDescription;
	}
}

//DS : 8838 : 12/20/2005
// Returns true if passed username is valid
// Used in: \source\Web\OXAccnt\OXAccnt_Local\account_linked_list.htm
function IsValidAccountUserName(sValue){
	var i=0;
	var sChar;
	
	do
	{
		sChar=sValue.substring(i,i+1);
		if ( (InvalidCharactersExist(sChar) && (sChar!='_') ))
		{
			return(false);
		}
		i++;	
	}
	while (i<sValue.length);
	return(true);
}

// SPR: 1/20/06
// Show Selected sub navigation tab
function showSelectedTab(pageId) {	
	var pageName, tab;
	
	pageName = pageId.substring(3,99);		// id of page; set in the body.

	if (pageName == "spread" || pageName == "covered_call") {
		tab = "tab" + pageName;					// id of soon-to-be-selected tab
	} else {
		tab = "sub_" + pageName;				// id of soon-to-be-selected tab
		if(document.getElementById(tab)){
			document.getElementById(tab).className = "sub_selected";	// turn the tab on!
		}
	}	
	switch (pageName) {						// setting the pipes for certain links
		/* Account Activity */
		case "activity":
			if (document.getElementById("sub_econfirms_link")) {
				document.getElementById("sub_econfirms_link").className = "";
			}
			
			if (document.getElementById("sub_statements_link")) {
				document.getElementById("sub_statements_link").className = "";
			}
			
			if (document.getElementById("sub_tax_link")) {
				document.getElementById("sub_tax_link").className = "";
			}
			break;
		case "analysis":
			if (document.getElementById("sub_statements_link")) {
				document.getElementById("sub_statements_link").className = "";
			}
			
			if (document.getElementById("sub_tax_link")) {
				document.getElementById("sub_tax_link").className = "";
			}
			break;
		case "econfirms":
			document.getElementById("sub_analysis_link").className = "";
			if (document.getElementById("sub_tax_link")) {
				document.getElementById("sub_tax_link").className = "";
			}
			break;
		case "statements":
			document.getElementById("sub_analysis_link").className = "";
			document.getElementById("sub_econfirms_link").className = "";
			break;
		case "tax":
			document.getElementById("sub_analysis_link").className = "";
			document.getElementById("sub_econfirms_link").className = "";
			document.getElementById("sub_statements_link").className = "";
			break;
		/* Transfer Funds */
		case "request":				// New Request
			if(document.getElementById("sub_setup_link")){
				document.getElementById("sub_setup_link").className = "";
				document.getElementById("sub_pending_link").className = "first";
				if (document.getElementById("sub_chase_link")){
					document.getElementById("sub_chase_link").className = "";
				}
			}
			break;
		case "setup":				// Bank Information
			if(document.getElementById("sub_pending_link")){
				document.getElementById("sub_pending_link").className = "";
				document.getElementById("sub_setup_link").className = "first";
				if (document.getElementById("sub_chase_link")){
					document.getElementById("sub_chase_link").className = "first";
				}
			}
			break;
		case "pending":				// requests in progress
			if(document.getElementById("sub_pending_link")){
				document.getElementById("sub_request_link").className = "first";
				document.getElementById("sub_setup_link").className = "first";
				if (document.getElementById("sub_chase_link")){				
					document.getElementById("sub_chase_link").className = "";
				}
				document.getElementById("sub_pending_link").className = "first";
			}
			break;
		case "chase":				// visa rewards page
			if(document.getElementById("sub_chase_link")){
				document.getElementById("sub_request_link").className = "first";
				document.getElementById("sub_setup_link").className = "";
				document.getElementById("sub_pending_link").className = "";
				document.getElementById("sub_chase_link").className = "first";
			}
			break;
		/* Trade */
		case "spread":
			switch (document.frmTrade.txtSecTypeID.value) {
				case "3":			// Spread
					document.getElementById("sub_straddle_link").className = "";
					document.getElementById("sub_butterfly_link").className = "";
					document.getElementById("sub_condor_link").className = "";
					document.getElementById("sub_oco_link").className = "";					
					break;
				case "10":			// Combo
					document.getElementById("sub_butterfly_link").className = "";
					document.getElementById("sub_condor_link").className = "";
					document.getElementById("sub_oco_link").className = "";	
					break;
				case "5":			// Straddle
					document.getElementById("sub_combo_link").className = "";
					document.getElementById("sub_condor_link").className = "";
					document.getElementById("sub_oco_link").className = "";	
					break;
				case "8":			// Butterfly
					document.getElementById("sub_combo_link").className = "";
					document.getElementById("sub_straddle_link").className = "";
					document.getElementById("sub_oco_link").className = "";						
					break;
				case "11":			// Condor
					document.getElementById("sub_combo_link").className = "";
					document.getElementById("sub_straddle_link").className = "";
					document.getElementById("sub_butterfly_link").className = "";				
				break;
				case "12":			// OCO
					document.getElementById("sub_combo_link").className = "";
					document.getElementById("sub_straddle_link").className = "";
					document.getElementById("sub_butterfly_link").className = "";
				break;				
				default:
					break;
			}
			break;
		case "covered_call":
			switch (document.frmTrade.txtSecTypeID.value) {
				case "4":			// Covered Call
					document.getElementById("sub_collar_link").className = "";
					break;
				case "9":			// Collar
					document.getElementById("sub_protective_put_link").className = "";
					break;
				default:
					break;
			}
			break;
		/* Quotes > Charts */
		case "snap":
			if ( document.getElementById("sub_volatility_link") != null){
			document.getElementById("sub_volatility_link").className = "";
			}
			break;
		case "volatility":
			document.getElementById("sub_java_link").className = "";
			break;
		case "technicalevents":
			if ( document.getElementById("sub_technicalevents_link") != null){
				document.getElementById("sub_technicalevents_link").className = "";
			}
			break;			
		default:
			break;
	}
}

//SB 030706 DT 10047
function checkPhone(ctrl1,ctrl2,ctrl3){
	var phone1;
	var phone2;
	var phone3;
	phone1 = ctrl1.value;
	phone2 = ctrl2.value;
	phone3 = ctrl3.value;
	if(!isValidPhone(phone1,phone2,phone3)){
		return(false);
	}
	return(true);
}

function isValidPhone(p1,p2,p3){
	if ((p1.length!=3)||(p2.length!=3)||(p3.length!=4)) {
		return(false);		
	}	
	if ((!isInteger(p1)) || (!isInteger(p2)) ||(!isInteger(p3))){
		return(false);
	}
	return(true);
}
//SB 032106 moved from newaccount general.js 
function moveTab(theControl){
	
	if (theControl.value.length==theControl.maxLength){
		if (theControl.id=='txtSSN1'){
			if (document.getElementById("txtSSN2")!=null) {
				document.getElementById("txtSSN2").focus();
			}
		}
		else if (theControl.id=='txtSSN2'){
			if (document.getElementById("txtSSN3")!=null) {
				document.getElementById("txtSSN3").focus(); 
			}
		}
		else if (theControl.id=='txtJointSSN1'){
			if (document.getElementById("txtJointSSN2")!=null) {
				document.getElementById("txtJointSSN2").focus();
			}
		}
		else if (theControl.id=='txtJointSSN2'){
			if (document.getElementById("txtJointSSN3")!=null) {
				document.getElementById("txtJointSSN3").focus(); 
			}
		}
		else if (theControl.id=='txtTaxID1'){
			if (document.getElementById("txtTaxID2")!=null) {
				document.getElementById("txtTaxID2").focus();
			}
		}
		else if (theControl.id=='txtDOB1'){
			if (document.getElementById("txtDOB2")!=null) {
				document.getElementById("txtDOB2").focus();
			}
		}
		else if (theControl.id=='txtDOB2'){
			if (document.getElementById("txtDOB3")!=null) {
				document.getElementById("txtDOB3").focus();
			}
		}
		else if (theControl.id=='txtJointDOB1'){
			if (document.getElementById("txtJointDOB2")!=null) {
				document.getElementById("txtJointDOB2").focus();
			}
		}
		else if (theControl.id=='txtJointDOB2'){
			if (document.getElementById("txtJointDOB3")!=null) {
				document.getElementById("txtJointDOB3").focus();
			}
		}
		else if (theControl.id=='txtDayPhone1'){
			if (document.getElementById("txtDayPhone2")!=null) {
				document.getElementById("txtDayPhone2").focus();
			}
		}
		else if (theControl.id=='txtDayPhone2'){
			if (document.getElementById("txtDayPhone3")!=null) {
				document.getElementById("txtDayPhone3").focus();
			}
		}
		else if (theControl.id=='txtEvePhone1'){
			if (document.getElementById("txtEvePhone2")!=null) {
				document.getElementById("txtEvePhone2").focus();
			}
		}
		else if (theControl.id=='txtEvePhone2'){
			if (document.getElementById("txtEvePhone3")!=null) {
				document.getElementById("txtEvePhone3").focus();
			}
		}
		else if (theControl.id=='txtFax1'){
			if (document.getElementById("txtFax2")!=null) {
				document.getElementById("txtFax2").focus();
			}
		}
		else if (theControl.id=='txtFax2'){
			if (document.getElementById("txtFax3")!=null) {
				document.getElementById("txtFax3").focus();
			}
		}
		else if (theControl.id=='txtEmployerPhone1'){
			if (document.getElementById("txtEmployerPhone2")!=null) {
				document.getElementById("txtEmployerPhone2").focus();
			}
		}
		else if (theControl.id=='txtEmployerPhone2'){
			if (document.getElementById("txtEmployerPhone3")!=null) {
				document.getElementById("txtEmployerPhone3").focus();
			}
		}
		else if (theControl.id=='txtMobilePhone1'){
			if (document.getElementById("txtMobilePhone2")!=null) {
				document.getElementById("txtMobilePhone2").focus();
			}
		}
		else if (theControl.id=='txtMobilePhone2'){
			if (document.getElementById("txtMobilePhone3")!=null) {
				document.getElementById("txtMobilePhone3").focus();
			}
		}
		else if (theControl.id=='txtJointDayPhone1'){
			if (document.getElementById("txtJointDayPhone2")!=null) {
				document.getElementById("txtJointDayPhone2").focus();
			}
		}
		else if (theControl.id=='txtJointDayPhone2'){
			if (document.getElementById("txtJointDayPhone3")!=null) {
				document.getElementById("txtJointDayPhone3").focus();
			}
		}
		else if (theControl.id=='txJointEmployerPhone1'){
			if (document.getElementById("txtJointEmployerPhone2")!=null) {
				document.getElementById("txtJointEmployerPhone2").focus();
			}
		}
		else if (theControl.id=='txtJointEmployerPhone2'){
			if (document.getElementById("txtJointEmployerPhone3")!=null) {
				document.getElementById("txtJointEmployerPhone3").focus();
			}
		}
		else if (theControl.id=='txtTrustDate1'){
			if (document.getElementById("txtTrustDate2")!=null) {
				document.getElementById("txtTrustDate2").focus();
			}
		}
		else if (theControl.id=='txtTrustDate2'){
			if (document.getElementById("txtTrustDate3")!=null) {
				document.getElementById("txtTrustDate3").focus();
			}
		}
		else if (theControl.id=='txtVerifySSN1'){
			if (document.frmNewAccnt.txtVerifySSN2!=null) {
				document.frmNewAccnt.txtVerifySSN2.focus();
			}
		}
		else if (theControl.id=='txtVerifySSN2'){
			if (document.frmNewAccnt.txtVerifySSN3!=null) {
				document.frmNewAccnt.txtVerifySSN3.focus(); 
			}
		}
		else if (theControl.id=='txtVerifyJointSSN1'){
			if (document.frmNewAccnt.txtVerifyJointSSN2!=null) {
				document.frmNewAccnt.txtVerifyJointSSN2.focus();
			}
		}
		else if (theControl.id=='txtVerifyJointSSN2'){
			if (document.frmNewAccnt.txtVerifyJointSSN3!=null) {
				document.frmNewAccnt.txtVerifyJointSSN3.focus(); 
			}
		}
	
	}
}

//DM - 3/28/06 - Code to hide links in OXI header
function hideOxiLink(){
	var f=getFirmType();
	//alert(f);
	if(f=='OXI'){
		var m = document.getElementById("menu");
		var lis = m.getElementsByTagName("LI");
		var hLI = lis.length;
		for(var i=0;i<hLI;i++){
			if(lis[i].id.indexOf('oxiHide')!=-1){ //SV 5/15/07 hides coaching link for OXI
				lis[i].style.display='none';
			}
		}
	}
	if (navigator.appVersion.indexOf('Mac') != -1){
		if(document.getElementById('searchL')){
	 	 document.getElementById('searchL').style.display='none';
	  	 document.getElementById('searchR').style.display='none';
	  	 document.getElementById('qt').style.background='none';	 
	  	 document.getElementById('qt').style.border='1px solid silver';	 
		 }
	}
	randomSearch();
}

function randomSearch(){
	var f=getFirmType();
	var sID = GetSessionID();
	var rNumber;
	
	searchQ = new Array();
	searchQ[0]="Account Transfers"
	searchQ[1]="Do you have load funds?"
	searchQ[2]="How do I wire funds?"
	searchQ[3]="Can I set up ACH?"
	searchQ[4]="Can I trade futures?"
	searchQ[5]="What is Xtrends?"
	searchQ[6]="How do I fund my account?"
	searchQ[7]="What are Chart Patterns?"	
	searchQ[8]="Money Market Interest Rate"
	searchQ[9]="I want to learn about ETFs"
	searchQ[10]="Account minimums and fees"
	searchQ[11]="Can I cross margin futures?"
	searchQ[12]="Do options trade after hours?"

	if(f=='OX' || f=='BX'){
		searchQ[13]="Can I trade options in IRA?";
		rNumber = Math.floor(Math.random()*14);
		if(sID=='0'){
			searchQ[14]="How do I open an account?";
			rNumber = Math.floor(Math.random()*15);
		}
	}
	else{
		if(sID=='0'){
			searchQ[13]="How do I open an account?";
			rNumber = Math.floor(Math.random()*14);
		}
		else{
			rNumber = Math.floor(Math.random()*13);
		}
	}
	
	if(document.getElementById('qt')){
		document.getElementById('qt').value = searchQ[rNumber];
	}
}

// DS : 14176 : 3/30/2006
function SetCheckboxValue(checkbox){	
	if (checkbox!=null){
		if(checkbox.checked==true){
			checkbox.value="ON";
		}
		else{
			checkbox.value="OFF";
		}
	}
}

function OpenAlertManager(sSource,sSymbol1,sSymbol2,sFilter,nMarketId){
    var s = GetSessionID();           
    if (sSymbol1 == undefined) sSymbol1 = "";
    if (sSymbol2 == undefined) sSymbol2 = "";
	if (nMarketId == undefined) nMarketId = 0;

	if(sSource="quote_frame"){
		if(opener){
			opener.parent.frames[0].location.href = "/OXNetTools/AlertManager/index.aspx?SessionID=" + s + "&REQUEST_SOURCE=" + sSource + "&Symbol=" + sSymbol1 + "&Symbol=" + sSymbol2 + "&FILTER=" + sFilter + "&market_id=" + nMarketId;
		}
		else{
			parent.frames[0].location.href = "/OXNetTools/AlertManager/index.aspx?SessionID=" + s + "&REQUEST_SOURCE=" + sSource + "&Symbol=" + sSymbol1 + "&Symbol=" + sSymbol2 + "&FILTER=" + sFilter + "&market_id=" + nMarketId;
		}
	}
	else{
		location.href = "/OXNetTools/AlertManager/index.aspx?SessionID=" + s + "&REQUEST_SOURCE=" + sSource + "&Symbol=" + sSymbol1 + "&Symbol=" + sSymbol2 + "&FILTER=" + sFilter + "&market_id=" + nMarketId;
	}
	//if(sSymbol2!=''){
	//        location.href = "/OXNetTools/AlertManager/spread.aspx?SessionID=" + s + "&REQUEST_SOURCE=" + sSource + "&Symbol=" + sSymbol1 + "&Symbol=" + sSymbol2 + "&FILTER=" + sFilter;
	//}
	//else{
	//        location.href = "/OXNetTools/AlertManager/index.aspx?SessionID=" + s + "&REQUEST_SOURCE=" + sSource + "&Symbol=" + sSymbol1 + "&Symbol=" + sSymbol2 + "&FILTER=" + sFilter;
	//}
}


//*****************************FUNCTIONS USED BY WATCHLIST****************************


// EA : 15691 : 06/23/2006
function StripIllegalWatchChars(sQueryStr){
	sQueryStr=StrReplace(sQueryStr,"`","");
	sQueryStr=StrReplace(sQueryStr,"~","");
	sQueryStr=StrReplace(sQueryStr,"!","");
	sQueryStr=StrReplace(sQueryStr,"@","");
	sQueryStr=StrReplace(sQueryStr,"#","");
	sQueryStr=StrReplace(sQueryStr,"$","");
	sQueryStr=StrReplace(sQueryStr,"%","");
	sQueryStr=StrReplace(sQueryStr,"^","");

	sQueryStr=StrReplace(sQueryStr,"|","");
	
	sQueryStr=StrReplace(sQueryStr,";","");
	sQueryStr=StrReplace(sQueryStr,":","");
	sQueryStr=StrReplace(sQueryStr,"\'","");
	sQueryStr=StrReplace(sQueryStr,"\"","");
	
	// sQueryStr=StrReplace(sQueryStr,",","");
	sQueryStr=StrReplace(sQueryStr,"<","");
	sQueryStr=StrReplace(sQueryStr,">","");
	// sQueryStr=StrReplace(sQueryStr,".","");
	// sQueryStr=StrReplace(sQueryStr,"/","");

	return(sQueryStr);
}

// EA : 15691 : 06/23/2006
function ChangeSubmit()
{
document.frmWatchList.RefID.value="VIEW";
document.frmWatchList.submit();
}

// EA : 15691 : 06/23/2006
function SetDefault()
{
var s;
s=GetSessionID();
alert(s);
document.frmWatchList.RefID.value="DEFAULT";
document.frmWatchList.action="/quote_watch_list.asp?RefID=Default&SessionID="+s+"";
window.alert("This has been set as your default WatchList."); 
document.frmWatchList.submit();
}

// EA : 15691 : 06/23/2006
function ChangeOrderBy(sCtlName,sFromAutoRefresh){	
	if(sFromAutoRefresh != true)
	{ 	
		if (sCtlName.value=="DESC"){
			sCtlName.value="ASC";
		}
		else {
			sCtlName.value="DESC";		
		}
	}
	document.frmWatchList.txtSortSymbol.value="true";
	document.frmWatchList.RefID.value = "VIEW";
	ProcessAccntSel(document.frmWatchList);
	return;
}

// EA : 15691 : 06/23/2006
function SubmitValue(sValue,sSubValue)
{	
	var sNameLength,sname;
	
	
	if (sValue == "DELETE")
	{		
		if (!confirm("Are you sure you want to delete this Watchlist?")) 			
			return ;
	}
	if (document.frmWatchList.ID.value =="CREATE_NEW")
	{		
	sName = document.frmWatchList.lstWatch.value;  		
	if(sName.indexOf('#') >= 0)
	{
		PromptFocus(document.frmWatchList.lstWatch,"Please do not enter # character in the watch list name.");
		return;	 
	}	
	sNameLength= sName.length; 	
	if(sNameLength > 15 )
		{			
			document.frmWatchList.lstWatch.value =  document.frmWatchList.lstWatch.value.substring(0,15);
		}
	if (!LstToString())
		return;	
		

	if (document.getElementById('bulkentry').style.display == ""){
		document.frmWatchList.RefID.value = "NEW_MULTIPLE";
	}else{
		document.frmWatchList.RefID.value = "NEW";
	}
	if (document.frmWatchList.lstWatch.value == "")
		{
		PromptFocus(document.frmWatchList.lstWatch,"Please enter a Watchlist name.");
		return;
		}
	}
	else
	document.frmWatchList.RefID.value = sValue;
	
	if (sValue == "ADD")
	{
		if(!ValidateDataAllowBlank(document.frmWatchList.txtWatchSymbol[0].value,document.frmWatchList.txtWatchSymbol[0] )) {		
			return false;
		}

		if(!ValidateDataAllowBlank(document.frmWatchList.txtWatchSymbol[1].value,document.frmWatchList.txtWatchSymbol[1] )) {		
			return false;
		}
	}

	if (document.frmWatchList.txtWatchSymbol[1].value == document.frmWatchList.txtWatchSymbol[0].value)
		document.frmWatchList.txtWatchSymbol[1].value="";
	document.frmWatchList.txtWatchSymbol[0].value = StrReplace(document.frmWatchList.txtWatchSymbol[0].value,"'","",true);
	document.frmWatchList.txtWatchSymbol[1].value = StrReplace(document.frmWatchList.txtWatchSymbol[1].value,"'","",true);	
	document.frmWatchList.txtWatchSymbol[2].value = StrReplace(document.frmWatchList.txtWatchSymbol[2].value,"'","",true);
	document.frmWatchList.txtWatchSymbol[0].value = StripIllegalChars(document.frmWatchList.txtWatchSymbol[0].value);
	document.frmWatchList.txtWatchSymbol[1].value = StripIllegalChars(document.frmWatchList.txtWatchSymbol[1].value);
	document.frmWatchList.txtWatchSymbol[2].value = StripIllegalWatchChars(document.frmWatchList.txtWatchSymbol[2].value);	
	document.frmWatchList.RefSubID.value = sSubValue;		
	document.frmWatchList.submit();

}

// EA : 15691 : 06/23/2006
function Edit()
{
	var sUrl,s;
	s=GetSessionID();
	sUrl = '/quote_watch_list.asp?RefID=Edit&sessionid='+s+'';
	OpenChildWindow(sUrl,'','350','350');
}

// EA : 15691 : 06/23/2006
function DuplicateExists()
{
	var sLstValue,aLstValue;	
	sLstValue=document.frmWatchList.hidStkOptValues.value;
	aLstValue=sLstValue.split(",");		
	for (var i=0; i<aLstValue.length; i++)
		{		
		window.alert(document.frmWatchList.radContract1.value);
		if (document.frmWatchList.radContract1.value !="S")
		{
		if(document.frmWatchList.txtSymbol1.value == aLstValue[i] ) 	
			{
			alarm="true";
			PromptFocus(document.frmWatchList.txtSymbol1,aLstValue[i] + " exists in your present Watchlist.");			
			return true;
			}
		else
			{alarm="false";}
		}
		window.alert(document.frmWatchList.radContract2.value);
		if (document.frmWatchList.radContract2.value !="S")
		{
		if(document.frmWatchList.txtSymbol2.value == aLstValue[i] ) 	
			{
			alarm="true";
			PromptFocus(document.frmWatchList.txtSymbol2,aLstValue[i] + " exists in your present Watchlist.");
			return true;
			}
		else
			{alarm="false";}		
		
		}
		}				
		return false;
}

// EA : 15691 : 06/23/2006
function LstToString()
	{	
	if (document.frmWatchList.ID.value=="CREATE_NEW")
	{		
	var sLstValue,i;
	var aLstValue;
	sLstValue=document.frmWatchList.hiddenLst.value;
	aLstValue=sLstValue.split(",");	
	var alarm;
	if(document.frmWatchList.lstWatch.value == "") 	
		{
		window.alert("Enter new WatchList Name !");
		document.frmWatchList.lstWatch.focus();				
		alarm="true";
		return false;
		}		
	else
		{
		for (var i=0; i<aLstValue.length; i++)
		{
		if(document.frmWatchList.lstWatch.value == aLstValue[i] ) 	
			{
			alarm="true";
			break;
			}
		else
			{alarm="false";}
		
		}			
		if (alarm=="false")
		{	
   			
			if (document.frmWatchList.ID.value !="CREATE_NEW")
				document.frmWatchList.submit();
   			return true;
   		}
   		else 
   		{   		
   			window.alert("A watchlist with this name already exists.  Please choose another.");      					
   			document.frmWatchList.lstWatch.focus();
   			document.frmWatchList.lstWatch.value="";
   			return false;
		}
		
		}	
	
	}
	else
		{			
			if (document.frmWatchList.ID.value !="CREATE_NEW")
				document.frmWatchList.submit();
			return true;
		}
	}


// EA : 15691 : 06/23/2006
function CheckAutoReload()
{
//document.frmWatchList.RefID.value="AUTO-REFRESH";
//document.frmWatchList.DIRTY.value="ON";
if(document.frmAlertManager.chkAutoReload.checked)
	document.frmAlertManager.chkAutoReload.value="ON";
else
	document.frmAlertManager.chkAutoReload.value="OFF";
//document.frmWatchList.submit();
//ChangeOrderBy(document.frmWatchList.txtSymbol,true);
ChangeView();
}


// EA : 15691 : 06/23/2006
function CheckMe()
{	
	if (document.frmAlertManager.chkAutoReload)
	{
		if (document.frmAlertManager.chkAutoReload.checked==true){
			InitializeTimer();
			return;
		}
		else {
			StopTheClock();
			return;
		}
	}
}


// EA : 15691 : 06/23/2006
function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 30;
    StopTheClock();
    StartTheTimer();
    return;
}


function checkAlertsExpanded(){
		var i = 0;
		if(document.getElementById("txtAlertsExpandedCount")!=null){
			var e = document.getElementById("txtAlertsExpandedCount");			
			if(e.value > 0){
				return true;
			}
		}
		return false;
	}

// EA : 15691 : 06/23/2006
function StopTheClock()
{
    if(timerRunning){
        clearTimeout(timerID);
		timerRunning = false;
	}
	return;
}

// EA : 15691 : 06/23/2006
function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
         
         //document.frmWatchList.RefID.value="AUTO-REFRESH";
		 //ChangeOrderBy(document.frmWatchList.txtSymbol,true);
		if(document.getElementById('txtSortClicked')){
			document.getElementById('txtSortClicked').value="0";
		}
		
		if(checkAlertsExpanded()==false){
			ChangeView();
		}
		else{
			InitializeTimer();
		}
		
    }
    else
    {
        self.status = secs;
        secs = secs - 1;
        timerRunning = true;
        timerID = self.setTimeout("StartTheTimer()", delay);
    }
    return;
}

// EA : 15691 : 06/23/2006
function LookUp(sFrmName,sCtrlName,sSessionID)
{
var sValue,sRefresh;
if (document.frmWatchList.ID.value =="CREATE_NEW")
	sRefresh="NEW";
else
	sRefresh="REFRESH";
sValue=document.frmWatchList.lstWatch.value;
sValue="RefID="+sRefresh+"|lstWatch="+sValue;
if (sRefresh=="NEW")
	OpenMiniChain(sFrmName,sCtrlName,sSessionID,'txtWatchSymbol[0]',0,0,"RefID","VIEW","Add");
else
	{
	if (document.frmWatchList.txtWatchSymbol[1].value == "")
		OpenMiniChain(sFrmName,sCtrlName,sSessionID,'txtWatchSymbol[0]',0,1,"RefID","VIEW","Add");	
	else
		OpenMiniChain(sFrmName,sCtrlName,sSessionID,null,0,1,"RefID","VIEW","Add");	
	}
}

// EA : 15691 : 06/23/2006
function NotesSpread(sWatchID,sComboWatchID,sSymbol,sComboSymbol) 
{
var s;
s=GetSessionID();
OpenChildWindow('/quote_watch_list.asp?RefID=NOTES_REQUEST&RefSubID=SPREAD&txtSymbol='+sSymbol+'&txtComboSymbol='+sComboSymbol+'&SecWatchID='+sWatchID+'&SecWatchID1='+sComboWatchID+'&SessionID='+s,'','350','250');
}

// EA : 15691 : 06/23/2006
function Notes(sWatchID,sSymbol)
{
var s;
s=GetSessionID();
OpenChildWindow('/quote_watch_list.asp?RefID=NOTES_REQUEST&txtSymbol='+sSymbol+'&SecWatchID='+sWatchID+'&SessionID='+s,'','350','250');
}

// EA : 15691 : 06/23/2006
function Alert(sWatchID,sSymbol)
{
var s;
s=GetSessionID();
OpenChildWindow('/quote_watch_list.asp?RefID=ALERT_REQUEST&txtSymbol='+sSymbol+'&SecWatchID='+sWatchID+'&SessionID='+s+'&txtAccountWatchID='+document.frmWatchList.txtAccountWatchID.value+'&txtWatchListName='+document.frmWatchList.lstWatch[document.frmWatchList.lstWatch.selectedIndex].text,'','800','475');
}

// EA : 15691 : 06/23/2006
function AlertSpread(sWatchID,sComboWatchID,sSymbol,sComboSymbol) 
{
var s;
s=GetSessionID();
OpenChildWindow('/quote_watch_list.asp?RefID=ALERT_REQUEST&RefSubID=SPREAD&txtSymbol='+sSymbol+'&txtComboSymbol='+sComboSymbol+'&SecWatchID='+sWatchID+'&SecWatchID1='+sComboWatchID+'&SessionID='+s+'&txtAccountWatchID='+document.frmWatchList.txtAccountWatchID.value+'&txtWatchListName='+document.frmWatchList.lstWatch[document.frmWatchList.lstWatch.selectedIndex].text,'','800','475');
}

// EA : 15691 : 06/23/2006
function Delete(sWatchID)
{
document.frmWatchList.RefID.value="DELETE";
document.frmWatchList.RefSubID.value="ITEM";
document.frmWatchList.SecWatchID.value=sWatchID;
document.frmWatchList.submit();
}

// EA : 15691 : 06/23/2006
function DeleteSpread(sWatchID1,sWatchID2,sStrategyID)
{
document.frmWatchList.RefID.value="DELETE";
document.frmWatchList.RefSubID.value="ROW"
document.frmWatchList.SecWatchID.value=sWatchID1;
document.frmWatchList.SecWatchID1.value=sWatchID2;
document.frmWatchList.StrategyWatchID.value=sStrategyID;
document.frmWatchList.submit();
}

// EA : 15691 : 06/23/2006
function VerifyCheckBoxes()
{
 SetButtonToCheckboxes(document.frmWatchList.hidWatchIDList.value,"chk","document.frmWatchList","cmdDelete","chkAll")
}

// EA : 15691 : 06/23/2006
function SelectAll()
{
 MatchCheckboxesToMaster(document.frmWatchList.hidWatchIDList.value,"chk","document.frmWatchList","chkAll");
 VerifyCheckBoxes();
}

// EA : 15691 : 06/23/2006
function AddMultiple()
{

var nWatchID,sWatchListName,s;
s=GetSessionID();

if(document.frmWatchList.lstWatch.value == null){
	nWatchID = 0;
	sWatchListName = "";		
}
else{
	nWatchID = document.frmWatchList.lstWatch.value; 
	if (nWatchID == "") 
	{ 
		nWatchID = 0;
		sWatchListName = "";
	}
	else
	{
		sWatchListName = document.frmWatchList.lstWatch[document.frmWatchList.lstWatch.selectedIndex].text;
	}
}
OpenChildWindow('quote_watch_list.asp?RefID=ADD_MULTIPLE&ViewType=MULTIPLE&SessionID='+s+'&lstWatch='+nWatchID+'&txtWatchListName='+sWatchListName,'','450','350');
}

// EA : 15691 : 06/23/2006
function Rename()
{
	var sUrl,s;
	var nWatchID;
	s=GetSessionID();
	
	if(document.frmWatchList.txtAccountWatchID == null){
		nWatchID = 0;	
	}
	else{
		nWatchID = document.frmWatchList.txtAccountWatchID.value; 
	}
	sUrl = '/quote_watch_list.asp?RefID=RENAME&sessionid='+s+'&WatchID=' + nWatchID;
//	window.alert(sUrl);
	OpenChildWindow(sUrl,'','350','350');
}

//*****************************************************************************************

//SB : DT 21479 10/06/2006 Postal code validation. Used by all broker edit pages for 
//     different postal codes

var sDomesticMsg = new String();				
function validatePostalCode(objZip,nCountryID,sDomMsg){
	var sZip;
	var nInd;
	sZip=objZip.value.substring(0, 5);
		
	if(objZip.value == ""){
		if(nCountryID == 1){
			sDomMsg.value = "\n Correct Format : ##### OR #####-####";
		}
		else if(nCountryID == 43){
			sDomMsg.value = "\n Correct Format : ANANAN OR ANA NAN (A=Alphabet N=Number)";
		}
		else{
			sDomMsg.value = "";
		}
		return(false);
	}
	if(nCountryID == 1){	
		if (!isInteger(sZip) || objZip.value.length<5) {
			sDomMsg.value = "\n Correct Format : ##### OR #####-####";
			return(false);
		}
		if(objZip.value.length>5){
			if(objZip.value.length == 10){	
				sZip=objZip.value.substring(5, 6);
				if(sZip != "-"){
					sDomMsg.value = "\n Correct Format : ##### OR #####-####";
					return(false);
				}
				else {
					sZip=objZip.value.substring(6, 10);
					if (!isInteger(sZip) || sZip.length != 4) {
						sDomMsg.value = "\n Correct Format : ##### OR #####-####";
						return(false);
					}
				}
			}
			else{
				sDomMsg.value = "\n Correct Format : ##### OR #####-####";
				return(false);
			}
		}
	}
	if(nCountryID == 43){
		if (objZip.value.length != 6 && objZip.value.length != 7) {
			sDomMsg.value = "\n Correct Format : ANANAN OR ANA NAN (A=Alphabet N=Number)";
			return(false);
		}
		else{
			if(objZip.value.length == 7){
				if(objZip.value.substring(3,4) != " "){
					sDomMsg.value = "\n Correct Format : ANANAN OR ANA NAN (A=Alphabet N=Number)";
					return(false);
				}
				else{
					objZip.value = objZip.value.substring(0,3) + objZip.value.substring(4,7);
				}
			}
			for(nInd = 0; nInd < objZip.value.length; nInd++){
				sZip = objZip.value.substring(nInd, nInd+1);
				if((nInd+1) % 2 == 0){
					if(!isInteger(sZip)){
						sDomMsg.value = "\n Correct Format : ANANAN OR ANA NAN (A=Alphabet N=Number)";
						return(false);				
					}
				}
				else{
					if ((sZip < 'a' || sZip > 'z') && (sZip < 'A' || sZip > 'Z') ) {
						sDomMsg.value = "\n Correct Format : ANANAN OR ANA NAN (A=Alphabet N=Number)";
						return(false);					
					}
				}
			}
		}
	}
	
	return(true);
}

//SB DT 21163

function resetAuthorizedTraderData(frmObj){
	frmObj.lstAPAType.value = "-1";
	frmObj.txtFirstNameAuthorization.value = "";	
	frmObj.txtLastNameAuthorization.value = "";
}

var sSecMsg = new String();
function ValidSecretQA(objSecretQ,objSecretA,sDomMsg)
{
	
   	var lSecretQ = objSecretQ.options[objSecretQ.selectedIndex].text;
	var VValidDate

	if (lSecretQ.indexOf('day') >0 || lSecretQ.indexOf('date') > 0 )
	{
		
		VValidDate =IsValidDate(objSecretA.value);
		if (VValidDate > "")
		{
			sDomMsg.value= VValidDate;
			return(false);
		}
		
	}
	return(true);
}

function noErrorMessages(){
	return true;
}
//DM - 11/7/06 DT 21902 - change stylesheet functions for font and browser size
if(window.opener){
    window.onerror = noErrorMessages;
	if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor')){
		if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0]){
			if(window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
				var mySize = window.opener.parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
				setStylesheet(mySize);
				//alert('popup');
			}		
		}		
	}
}

function checkFont(val){
	if (getCookie('oxps_sizing')) {
		document.cookie = 'oxps_sizing' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
	if (getCookie('oxps_font')) {
		document.cookie = 'oxps_font' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
	if (getCookie('oxps_color')) {
		document.cookie = 'oxps_color' + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
	
	if(val=='quote'){
		if(document.getElementById('spSiteStyleFontSize')){
			if(document.getElementById('spSiteStyleFontSize').childNodes[0]){
				if(document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!=null){
					var myFont = document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue;
					setStylesheet(myFont);
				}		
			}
		}		
	checkColor(val);
	}
	else{
		if(parent.frames[0] && window.name == 'main'){
			if(parent.frames[0].document.getElementById('spSiteStyleFontSize')){
				if(parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0]){
					if(parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue!=null){
						var myFont = parent.frames[0].document.getElementById('spSiteStyleFontSize').childNodes[0].nodeValue;
						setStylesheet(myFont);
					}		
				}
			}
		checkColor();
		}
	}
}

function checkColor(val){
	if(val=='quote'){
		if(document.getElementById('spSiteStyleColor')){
			if(document.getElementById('spSiteStyleColor').childNodes[0]){
				if(document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
					var myColor = document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
					setStylesheet(myColor);
				}		
			}	
		}
		resize(val);		
	}
	else{
		if(parent.frames[0] && window.name == 'main'){	
			if(parent.frames[0].document.getElementById('spSiteStyleColor')){
				if(parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0]){
					if(parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue!=null){
						var myColor = parent.frames[0].document.getElementById('spSiteStyleColor').childNodes[0].nodeValue;
						setStylesheet(myColor);
					}		
				}	
			}
		resize();
		}
	}
}

function resize(val){
	if(val=='quote'){
		if(document.getElementById('spSiteStyleAlignment')){
			if(document.getElementById('spSiteStyleAlignment').childNodes[0]){
				if(document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!='' || document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!=null){
					var mySize = document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
					setStylesheet(mySize);
				}		
			}		
		}	
	}
	else{
		if(parent.frames[0] && window.name == 'main'){	
			if(parent.frames[0].document.getElementById('spSiteStyleAlignment')){
				if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0]){
					if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!=null){
						var mySize = parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
						setStylesheet(mySize);
					}		
				}		
			}
		resizeHeader();
		}
	}
}

function styleTab(){  //writes element to frameset file so we can detect and display "site layout" tab after reload
	var d = parent.document.createElement('div'); 
    d.id = 'prefs'; 
	var el = parent.document.getElementsByTagName('noframes');
	if(el[0]){
	    el[0].parentNode.appendChild(d); 	
	}
}

function setStylesheet(styleTitle){
	if(document.location.href && document.location.href.indexOf('broker_view')==-1){ //don't apply styles to web broker
		if(document.getElementsByTagName('STYLE')){
			var s = document.getElementsByTagName('STYLE'); 
			if(s[0]){
				newStyle=document.createElement('Link');
				newStyle.rel="stylesheet";
				newStyle.type="text/css";
				newStyle.href= cdn_path + "/inc/"+styleTitle+".css";
				s[0].parentNode.appendChild(newStyle);
			}
		}
	}
}

//dm - 9/22/06 - resize headers based on page width
function resizeHeader(){
if(!document.getElementById('txtOXWebServer') || document.getElementById('txtOXWebServer')==null){
	if(document.getElementById('mainTable')){
		var a = document.getElementById('mainTable');
		var mt = parseInt(a.scrollWidth);
		var lmt = parseInt(a.offsetLeft);
	}
	if(document.getElementById('content')){	
		var b = document.getElementById('content').clientWidth;
	}

	subArray = new Array();
	subArray[0] = "welcome";
	subArray[1] = "account";
	subArray[2] = "trade";
	subArray[3] = "quotes";
	subArray[4] = "toolbox";
	subArray[5] = "educate";
	subArray[6] = "help";
	
	if(document.getElementById('sidebar')){
		var c = document.getElementById('sidebar').clientWidth;
		var x = b+c;
	}
	else{
		var x = b;
	}
	
	if(parent.frames[0] && window.name == 'main'){	
		if(parent.frames[0].document.getElementById('spSiteStyleAlignment')){
			if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0]){
				if(parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!='' || parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue!=null){
					var cSize = parent.frames[0].document.getElementById('spSiteStyleAlignment').childNodes[0].nodeValue;
				}		
			}		
		}
	}
	if(cSize){
		if(cSize.indexOf('_sm')!=-1 && x >=700){
			var smResize = true;
		}
	}

	if((x >= 835 || smResize == true) && document.getElementById('header_table')){ 
		var y = document.body.clientWidth;
		document.getElementById('header_table').style.width = x+'px';	
	
		document.getElementById('header_wrapper').style.width = x+'px';	

		for(i=0;i<subArray.length;i++){
			document.getElementById('sub_'+subArray[i]).style.width = x-13+'px';
		}
		if(document.getElementById('footer')){
			document.getElementById('footer').style.width = x+'px';
		}
		if(document.getElementById('Footer')){
			document.getElementById('Footer').style.width = x +'px';	
		}
		document.getElementById('mainTable').style.width = x +'px';
	}
}
}

//DS : 22238 : 12/8/2006
function textCounter(sMsg,sTxtCounter,nCharsLimit) {
	if (sMsg.value.length > nCharsLimit) 
		sMsg.value = sMsg.value.substring(0, nCharsLimit);
	else 
		sTxtCounter.value = nCharsLimit - sMsg.value.length;
}

//SV 8/7/07 DT#25499 switches out all prospect links with customer links for logged-in users
function hideReadyLink(newClass){
	var s = GetSessionID();
	if (s == '0') {
		 document.getElementById('ready').style.display="inline";	
		 document.getElementById('advantage').style.display="inline";	
		 document.getElementById('technology').style.display="inline";	
		 document.getElementById('platform').style.display="inline";	
		 document.getElementById('tools').style.display="inline";	
		 document.getElementById('faqs').style.display="none";	
		 document.getElementById('tax').style.display="none";	
		 document.getElementById('risks').style.display="none";	
		 document.getElementById('forms').style.display="none";
		 if (document.getElementById('whitepaper')){
			 document.getElementById('whitepaper').style.display="inline";
		 }
	 } else {	 
		 document.getElementById('ready').style.display="none";	
		 document.getElementById('advantage').style.display="none";	
		 document.getElementById('technology').style.display="none";	
		 document.getElementById('platform').style.display="none";	
		 document.getElementById('tools').style.display="none";	
		 document.getElementById('faqs').style.display="inline";	
		 document.getElementById('tax').style.display="inline";	
		 document.getElementById('risks').style.display="inline";	
		 document.getElementById('forms').style.display="inline";	
		document.getElementById('faqlink').className=newClass;
		if (document.getElementById('whitepaper')){
			document.getElementById('whitepaper').style.display="none";
		}
	}
}

//SB 05/14/2007 Account number validation at different places
function ValidateAccountNum(txtAccountNum,txtPrevAccntNum, AccountID){
	txtAccountNum.value = trim(txtAccountNum.value); //SN [21555]
	var sAccountNum = txtAccountNum.value;
	var sPrevAccountNum = txtPrevAccntNum.value;
	if(sAccountNum == ""){
		PromptFocus(txtAccountNum,"Account Number cannot be empty");
		return false;
	}
	if(sAccountNum != "pending" && sAccountNum != "w broker"){
		if(sAccountNum.toUpperCase() != "OX" + AccountID) //SN[29514]
		{
			if(sAccountNum.length != 9)  //SN [21555]
			{
				PromptFocus(txtAccountNum,"Account Number must be exactly 9 characters long");
				return false;		
			}
		}
	}
	if(sAccountNum != sPrevAccountNum){
		if ((confirm("Please confirm the following:\nThe new account number must already be updated at Phase3.\nNo other fields can be changed if account number is changed.\nClick 'Cancel' to undo Account Number change. Click 'OK' to continue"))!=true){
			txtAccountNum.select();
			txtAccountNum.focus();
			txtAccountNum.value = document.frmBrokerCustomerEdit.txtPrevAccntNum.value;
			return(false);	
		}

	}
	return(true);
}

//SB 07/10/2007 (validates available risk capital in new account process, account profile, and web broker)
function ValidateAvailRiskCapital(txtObj,sMsg){
	var sTemp;
	var nInd;
	if(txtObj.value == ""){
		sMsg.value="Please enter the Available Risk capital";
		return(false);
	}
	if(txtObj.value < 0){
		sMsg.value="Available Risk Capital must be a positive number";
		return(false);	
	}
	for(nInd = 0; nInd < txtObj.value.length; nInd++){
		sTemp = txtObj.value.substring(nInd, nInd+1);
		if(!isInteger(sTemp)){
			sMsg.value = "Available Risk Capital must be a numeric value";
			return(false);				
		}
	}	
	return(true);
}

//dm - 7/24/07 - links to beta chains from vb6 chains
function chainToBeta(){
	var type = document.forms[0].lstOption.value;
	var range = document.forms[0].lstRange.value;
	var t = '';
	
	switch (type) {  //convert vb6 identifiers to beta
		case "B":
			t="0";
			break;
		case "C":
			t="1";
			break;
		case "P":
			t="2";
			break;
		case "PR":
			t="0";
			break;
		case "S":
			t="4";
			break;
		case "ST":
			t="5";
			break;
		case "CC":
			t="6";
			break;
		case "CS":
			t="7";
			break;
		case "PS":
			t="8";
			break;
		case "CO":
			t="0";
			break;
		case "CLC":
			t="0";
			break;
		case "CLP":
			t="0";
			break;
		case "DCS":
			t="0";
			break;
		case "DPS":
			t="0";
			break;
		case "V":
			t="0";
			break;
		case "CB":
			t="15";
			break;
		case "PB":
			t="16";
			break;
		case "ICS":
			t="17";
			break;
		case "CM":
			t="18";
			break;
		case "SSF":
			t="0";
			break;
		default:
			t="0";
		}

	location.href="/OXNetTools/Chains/index.aspx?SESSIONID=" + GetSessionID() + "&Symbol=" + document.forms[0].txtSymbol.value + "&Range=" + range + "&ChainType=" + t;
}
//SB 08/29/2007 PDF Date format
function FormatDate(nValue){
	var sFormat;
	if(nValue < 10){
		sFormat = "0" + nValue;
	}
	else{
		sFormat = nValue;
	}
	return sFormat;
}

//JAC for CDN_PATH
function GetImagePathPrefix()
{
	var sTemp = "";
	try
	{
		if(cdn_path != undefined && cdn_path != null)
		{
			sTemp = cdn_path;
		}
	
	}
	catch(e)
	{
		sTemp = "";
	}
	return sTemp;
}

sfHover = function() {
						if (document.getElementById("MainNav") !=null) {
		            		var sfEls = document.getElementById("MainNav").getElementsByTagName("LI");				
	            			for (var i=0; i<sfEls.length; i++) {
		            			sfEls[i].onmouseover=function() {
			           	 				this.className+=" hover";
		            			}
		            			sfEls[i].onmouseout=function() {
			            			this.className=this.className.replace(new RegExp(" hover\\b"), "");
		            			}
	            			}
						}
            		}
            if (window.attachEvent) window.attachEvent("onload", sfHover);
			
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}	

function BrokerOverrideW8(bIsBroker){
	if(bIsBroker == 'true'){
		if(window.confirm("Some of the W8 information is missing. Do you want to continue?")){
			return true;
		}			
		else{
			return false;
		}
	}
	else{
		return false;
	}
	
}

function Validatew8(frmObj,sEntity,bIsBroker){
	var bOverride;
	if(frmObj.radW8BenType){
		if(frmObj.radW8BenType[0].checked == false && frmObj.radW8BenType[1].checked == false && frmObj.radW8BenType[2].checked == false && frmObj.radW8BenType[3].checked == false && frmObj.radW8BenType[4].checked == false && frmObj.radW8BenType[5].checked == false && frmObj.radW8BenType[6].checked == false && frmObj.radW8BenType[7].checked == false && frmObj.radW8BenType[8].checked == false && frmObj.radW8BenType[9].checked == false && frmObj.radW8BenType[10].checked == false && frmObj.radW8BenType[11].checked == false && frmObj.radW8BenType[12].checked == false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radW8BenType,"Please select the type of Beneficial owner.");
				return false;
			}
		}
		//if(sEntity == "ind" || sEntity == "jnt"){
		if(frmObj.radBenOwnerResident[0].checked == false && frmObj.radBenOwnerResident[1].checked == false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radBenOwnerResident,"Please specify if the beneficial owner is a resident within the meaning of the income tax treaty between the United States and a foreign country."); 
				return false;
			}
		}
		if(frmObj.radBenOwnerResident[0].checked == true){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radBenOwnerResident,"A country for the beneficial owner must be entered to complete this application.  If the beneficial owner is not a resident of a foreign country within the meaning of the income tax treaty between the United States, a separate W-8BEN will need to be completed and submitted for review."); 
				return false;
			}	
		} 
		if(frmObj.radBenOwnerResident[1].checked == true){
			if(trim(frmObj.txtResidentCountry.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtResidentCountry,"Please enter the name of country.") 
					return false;
				}
			}
			if(SpecialCharactersExistName(trim(frmObj.txtResidentCountry.value))){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtResidentCountry,"Please enter a valid value for the country.") 
					return false;
				}
			}
		}
		
		//}
		if(frmObj.radTIN[0].checked==false && frmObj.radTIN[1].checked==false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radTIN,"Please indicate whether the beneficial owner has a US TIN.") 
				return false;	
			}	
		}
		
		if(frmObj.radTIN[1].checked == true){
			if(frmObj.radW8TIN[0].checked == false && frmObj.radW8TIN[1].checked == false){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.radW8TIN,"Please indicate whether the beneficial owner has a US TIN or SSN.") 
					return false;	
				}
			}
			if(trim(frmObj.txtW8TIN.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{	
					PromptFocus(frmObj.txtW8TIN, "Please enter your taxpayer identification number.");
					return(false);
				}
			}
			if(frmObj.radW8TIN[0].checked == true){
				if(!validateSSN(trim(frmObj.txtW8TIN.value))){
					if(BrokerOverrideW8(bIsBroker)){
						return true;
					}
					else{
						PromptFocus(frmObj.txtW8TIN, "Please re-enter your SSN number in the following format:\n 000-00-0000.");
						return(false);
					}
				}		
			}	
			if(frmObj.radW8TIN[1].checked == true){
				if(!CheckTaxIDFormat(trim(frmObj.txtW8TIN.value))){
					if(BrokerOverrideW8(bIsBroker)){
						return true;
					}
					else{
						PromptFocus(frmObj.txtW8TIN, "Please re-enter your TAX ID number in the following format:\n 00-0000000.");
						return(false);
					}
				}		
			}
		}
		
		if(frmObj.radBenOwner8833[0].checked==false && frmObj.radBenOwner8833[1].checked==false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radBenOwner8833, "Please indicate whether the beneficial owner is related to the holding agent.");
				return(false);
			}
		}	

		if(sEntity == "crp" || sEntity == "prt" || sEntity == "prt/clb" || sEntity == "trs"){
			if(frmObj.chkBenOwnerIncome.checked==false && frmObj.chkBenOwnerDiv.checked==false){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.chkBenOwnerIncome,"Please check one or both conditions regarding the beneficial owner not being an individual and claiming treaty benefits."); 
					return false;
				}
			}
			/*if(frmObj.chkBenOwnerDiv.checked==false){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.chkBenOwnerDiv,"Please check the box in section e.") ;
					return false;
				}
			}*/
		}
		
		if(frmObj.radSpecialRates[0].checked == false && frmObj.radSpecialRates[1].checked == false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radSpecialRates, "Please indicate whether the beneficial owner is claiming special rates and conditions.");
				return(false);
			}
		}

		if(frmObj.radSpecialRates[1].checked == true){
			if(trim(frmObj.txtArticle.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtArticle, "Please provide the article of the treaty for which you are claiming special rates and conditions.");
					return(false);
				}
			}
			if(SpecialCharactersExistAddress(trim(frmObj.txtArticle.value))){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtArticle, "For security purposes, article must be alpha-numeric.  Spaces, commas, periods & special characters are not permitted.");
					return(false);	
				}
			}
			if(trim(frmObj.txtRate.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtRate, "Please enter the % rate of withholding.");
					return(false);
				}
			}
			if(!isFloat(trim(frmObj.txtRate.value))){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{	
					PromptFocus(frmObj.txtRate, "Please enter a valid % rate of withholding.");
					return(false);
				}
	
			}
			if(trim(frmObj.txtIncomeType.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtIncomeType, "Please specify type of income affected.");
					return(false);
				}
			}
			/*if(SpecialCharactersExistAddress(trim(frmObj.txtIncomeType.value))){
				PromptFocus(frmObj.txtIncomeType, "For security purposes, Income type must be alpha-numeric.  Spaces, commas, periods & special characters are not permitted.");
				return(false);
			}*/
			if(trim(frmObj.txtReasons.value) == ""){
				if(BrokerOverrideW8(bIsBroker)){
					return true;
				}
				else{
					PromptFocus(frmObj.txtReasons, "Please explain how the beneficial owner meets the terms of the treaty article.");
					return(false);
				}
			}
			/*if(SpecialCharactersExistAddress(trim(frmObj.txtReasons.value))){
				PromptFocus(frmObj.txtReasons, "For security purposes, explanation must be alpha-numeric.  Spaces, commas, periods & special characters are not permitted.");
				return(false);
			}*/
		}
		if(frmObj.radStmtAgmt[0].checked==false && frmObj.radStmtAgmt[1].checked==false){
			if(BrokerOverrideW8(bIsBroker)){
				return true;
			}
			else{
				PromptFocus(frmObj.radStmtAgmt, "Please indicate whether you have or will provide a statement identifying notional principal contracts.");
				return(false);
			}
		}
		
	}
	return(true);
}

function ShowHideW8Controls(frmObj){
	if(frmObj.radBenOwnerResident != null){
		if(frmObj.radBenOwnerResident[1].checked == true){
			document.getElementById('rowResidentCountry').style.display = 'inline';	
			if(trim(frmObj.txtCountry.value) != ""){
				frmObj.txtResidentCountry.value = frmObj.txtCountry.value;
			}
		}
		else{
			document.getElementById('rowResidentCountry').style.display = 'none';
			frmObj.txtResidentCountry.value = "";
		}
	}
	if(frmObj.radTIN != null){
		if(frmObj.radTIN[1].checked == true){
			document.getElementById('trTaxID').style.display = 'inline';
		}
		else{
			document.getElementById('trTaxID').style.display = 'none';
			frmObj.txtW8TIN.value = "";
			frmObj.radW8TIN[0].checked = false;
			frmObj.radW8TIN[1].checked = false;
		}
	}
	if(frmObj.radSpecialRates != null){
		if(frmObj.radSpecialRates[1].checked == true){
			document.getElementById('trSpecialRatesYes').style.display = 'inline';
		}
		else{
			document.getElementById('trSpecialRatesYes').style.display = 'none';
			frmObj.txtArticle.value = "";
			frmObj.txtRate.value = "";
			frmObj.txtIncomeType.value = "";
			frmObj.txtReasons.value = "";
		}
	}
	if(frmObj.radW8TIN != null){
		if(frmObj.radW8TIN[0].checked == true){
			document.getElementById('divW8SSN').style.display = 'inline';
		}
		else{
			document.getElementById('divW8SSN').style.display = 'none';
		}
		if(frmObj.radW8TIN[1].checked == true){
			document.getElementById('divW8TIN').style.display = 'inline';
		}
		else{
			document.getElementById('divW8TIN').style.display = 'none';
		}
	}
}

function W8EntityCheck(frmObj){
	var sEntity;
	sEntity = frmObj.txtAccntEntity.value;
	if(frmObj.chkBenOwnerIncome != null && frmObj.chkBenOwnerDiv != null){
		if(sEntity == "ind" || sEntity == "jnt"){
			frmObj.chkBenOwnerIncome.disabled = true;
			frmObj.chkBenOwnerDiv.disabled = true;
		}
	}
	
}

function GetSelAccountID(){
	if(document.getElementById('lstAccounts')){
		return document.getElementById('lstAccounts').value;
	}
	else{
		return 0;
	}
}

function RemoveViewState(){
	try{
		if(typeof document.forms[0].__VIEWSTATE != "undefined")
		{
			document.forms[0].__VIEWSTATE.name = "NOVIEWSTATE";
		}
	}
	catch(e){

	}
}

function Feedback(sPageURL){
	var s=GetSessionID(); 
	OpenChildWindow("/OXNetAccnt/feedback.aspx?sessionid=" +s +"&var=" +sPageURL,'False',565,500);
}
		

//Use this for detection!
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
};
BrowserDetect.init();	