/*
 * Modernizr v1.6
 * http://www.modernizr.com
 *
 * Developed by:
 * - Faruk Ates  http://farukat.es/
 * - Paul Irish  http://paulirish.com/
 *
 * Copyright (c) 2009-2010
 * Dual-licensed under the BSD or MIT licenses.
 * http://www.modernizr.com/license/
 */
window.Modernizr=function(i,e,u){function s(a,b){return(""+a).indexOf(b)!==-1}function D(a,b){for(var c in a)if(j[a[c]]!==u&&(!b||b(a[c],E)))return true}function n(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);c=(a+" "+F.join(c+" ")+c).split(" ");return!!D(c,b)}function S(){f.input=function(a){for(var b=0,c=a.length;b<c;b++)L[a[b]]=!!(a[b]in h);return L}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));f.inputtypes=function(a){for(var b=0,c,k=a.length;b<
k;b++){h.setAttribute("type",a[b]);if(c=h.type!=="text"){h.value=M;if(/^range$/.test(h.type)&&h.style.WebkitAppearance!==u){l.appendChild(h);c=e.defaultView;c=c.getComputedStyle&&c.getComputedStyle(h,null).WebkitAppearance!=="textfield"&&h.offsetHeight!==0;l.removeChild(h)}else/^(search|tel)$/.test(h.type)||(c=/^(url|email)$/.test(h.type)?h.checkValidity&&h.checkValidity()===false:h.value!=M)}N[a[b]]=!!c}return N}("search tel url email datetime date month week time datetime-local number range color".split(" "))}
var f={},l=e.documentElement,E=e.createElement("modernizr"),j=E.style,h=e.createElement("input"),M=":)",O=Object.prototype.toString,q=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),F="Webkit Moz O ms Khtml".split(" "),v={svg:"http://www.w3.org/2000/svg"},d={},N={},L={},P=[],w,Q=function(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent=a+"{#modernizr{height:3px}}";(e.head||e.getElementsByTagName("head")[0]).appendChild(b);c.id="modernizr";l.appendChild(c);a=c.offsetHeight===
3;b.parentNode.removeChild(b);c.parentNode.removeChild(c);return!!a},o=function(){var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return function(b,c){c=c||document.createElement(a[b]||"div");b="on"+b;var k=b in c;if(!k){c.setAttribute||(c=document.createElement("div"));if(c.setAttribute&&c.removeAttribute){c.setAttribute(b,"");k=typeof c[b]=="function";if(typeof c[b]!="undefined")c[b]=u;c.removeAttribute(b)}}return k}}(),G={}.hasOwnProperty,R;R=
typeof G!=="undefined"&&typeof G.call!=="undefined"?function(a,b){return G.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};d.flexbox=function(){var a=e.createElement("div"),b=e.createElement("div");(function(k,g,r,x){g+=":";k.style.cssText=(g+q.join(r+";"+g)).slice(0,-g.length)+(x||"")})(a,"display","box","width:42px;padding:0;");b.style.cssText=q.join("box-flex:1;")+"width:10px;";a.appendChild(b);l.appendChild(a);var c=b.offsetWidth===42;a.removeChild(b);
l.removeChild(a);return c};d.canvas=function(){var a=e.createElement("canvas");return!!(a.getContext&&a.getContext("2d"))};d.canvastext=function(){return!!(f.canvas&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.webgl=function(){var a=e.createElement("canvas");try{if(a.getContext("webgl"))return true}catch(b){}try{if(a.getContext("experimental-webgl"))return true}catch(c){}return false};d.touch=function(){return"ontouchstart"in i||Q("@media ("+q.join("touch-enabled),(")+
"modernizr)")};d.geolocation=function(){return!!navigator.geolocation};d.postmessage=function(){return!!i.postMessage};d.websqldatabase=function(){return!!i.openDatabase};d.indexedDB=function(){for(var a=-1,b=F.length;++a<b;){var c=F[a].toLowerCase();if(i[c+"_indexedDB"]||i[c+"IndexedDB"])return true}return false};d.hashchange=function(){return o("hashchange",i)&&(document.documentMode===u||document.documentMode>7)};d.history=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return o("drag")&&
o("dragstart")&&o("dragenter")&&o("dragover")&&o("dragleave")&&o("dragend")&&o("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){j.cssText="background-color:rgba(150,255,150,.5)";return s(j.backgroundColor,"rgba")};d.hsla=function(){j.cssText="background-color:hsla(120,40%,100%,.5)";return s(j.backgroundColor,"rgba")||s(j.backgroundColor,"hsla")};d.multiplebgs=function(){j.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(j.background)};d.backgroundsize=
function(){return n("backgroundSize")};d.borderimage=function(){return n("borderImage")};d.borderradius=function(){return n("borderRadius","",function(a){return s(a,"orderRadius")})};d.boxshadow=function(){return n("boxShadow")};d.textshadow=function(){return e.createElement("div").style.textShadow===""};d.opacity=function(){var a=q.join("opacity:.5;")+"";j.cssText=a;return s(j.opacity,"0.5")};d.cssanimations=function(){return n("animationName")};d.csscolumns=function(){return n("columnCount")};d.cssgradients=
function(){var a=("background-image:"+q.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+q.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);j.cssText=a;return s(j.backgroundImage,"gradient")};d.cssreflections=function(){return n("boxReflect")};d.csstransforms=function(){return!!D(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!D(["perspectiveProperty","WebkitPerspective",
"MozPerspective","OPerspective","msPerspective"]);if(a)a=Q("@media ("+q.join("transform-3d),(")+"modernizr)");return a};d.csstransitions=function(){return n("transitionProperty")};d.fontface=function(){var a,b=e.head||e.getElementsByTagName("head")[0]||l,c=e.createElement("style"),k=e.implementation||{hasFeature:function(){return false}};c.type="text/css";b.insertBefore(c,b.firstChild);a=c.sheet||c.styleSheet;b=k.hasFeature("CSS2","")?function(g){if(!(a&&g))return false;var r=false;try{a.insertRule(g,
0);r=!/unknown/i.test(a.cssRules[0].cssText);a.deleteRule(a.cssRules.length-1)}catch(x){}return r}:function(g){if(!(a&&g))return false;a.cssText=g;return a.cssText.length!==0&&!/unknown/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(g.split(" ")[0])===0};f._fontfaceready=function(g){g(f.fontface)};return b('@font-face { font-family: "font"; src: "font.ttf"; }')};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');
b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"')||a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localstorage=function(){try{return"localStorage"in
i&&i.localStorage!==null}catch(a){return false}};d.sessionstorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webWorkers=function(){return!!i.Worker};d.applicationcache=function(){return!!i.applicationCache};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS(v.svg,"svg").createSVGRect};d.inlinesvg=function(){var a=document.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==v.svg};d.smil=function(){return!!e.createElementNS&&
/SVG/.test(O.call(e.createElementNS(v.svg,"animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(O.call(e.createElementNS(v.svg,"clipPath")))};for(var H in d)if(R(d,H)){w=H.toLowerCase();f[w]=d[H]();P.push((f[w]?"":"no-")+w)}f.input||S();f.crosswindowmessaging=f.postmessage;f.historymanagement=f.history;f.addTest=function(a,b){a=a.toLowerCase();if(!f[a]){b=!!b();l.className+=" "+(b?"":"no-")+a;f[a]=b;return f}};j.cssText="";E=h=null;i.attachEvent&&function(){var a=e.createElement("div");
a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function c(p){for(var m=-1;++m<r;)p.createElement(g[m])}function k(p,m){for(var I=p.length,t=-1,y,J=[];++t<I;){y=p[t];m=y.media||m;J.push(k(y.imports,m));J.push(y.cssText)}return J.join("")}var g="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),r=g.length,x=RegExp("<(/*)(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)",
"gi"),T=RegExp("\\b(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)\\b(?!.*[;}])","gi"),z=b.createDocumentFragment(),A=b.documentElement,K=A.firstChild,B=b.createElement("style"),C=b.createElement("body");B.media="all";c(b);c(z);a.attachEvent("onbeforeprint",function(){for(var p=-1;++p<r;)for(var m=b.getElementsByTagName(g[p]),I=m.length,t=-1;++t<I;)if(m[t].className.indexOf("iepp_")<0)m[t].className+=" iepp_"+
g[p];K.insertBefore(B,K.firstChild);B.styleSheet.cssText=k(b.styleSheets,"all").replace(T,".iepp_$1");z.appendChild(b.body);A.appendChild(C);C.innerHTML=z.firstChild.innerHTML.replace(x,"<$1bdo")});a.attachEvent("onafterprint",function(){C.innerHTML="";A.removeChild(C);K.removeChild(B);A.appendChild(z.firstChild)})}(this,document);f._enableHTML5=true;f._version="1.6";l.className=l.className.replace(/\bno-js\b/,"")+" js";l.className+=" "+P.join(" ");return f}(this,this.document);/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);

/*
 * jQuery validation plug-in 1.7
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);

// ColorBox v1.3.14 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=E=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",A=b.browser.msie&&!b.support.opacity,X=A&&b.browser.version<7,P=i+"_IE6",x,j,B,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,C,D,y,z,l,g,a,u,E,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":A?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();B=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));B.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(B,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);C=bb.height()+S.height()+s.outerHeight(e)-s.height();D=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":C,"padding-right":D}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!E&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-C,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-D,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;B[0].style.width=B[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);E=c;B[0].style.width=a.w+z+D+"px";B[0].style.height=a.h+y+C+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-D;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-C;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(o){var e="hidden";function m(t){var q,f,o,e,m=h.length,s=a.loop;d.position(t,function(){if(u){A&&p&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(m>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,m)).show();I[s||g<m-1?"show":"hide"]().html(a.next);H[s||g?"show":"hide"]().html(a.previous);q=g?h[g-1]:h[m-1];o=g<m-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){e=b.data(o,r).href||o.href;f=b.data(q,r).href||q.href;e=b.isFunction(e)?e.call(o):e;f=b.isFunction(f)?f.call(q):f;if(U(e))b("<img/>")[0].src=e;if(U(f))b("<img/>")[0].src=f}}K.hide();if(a.transition==="fade")j.fadeTo(l,1,function(){if(A)j[0].style.filter=c});else if(A)j[0].style.filter=c;n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var p,l=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(o);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:e}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==e}).css({visibility:e}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(l,0,function(){m(0)}):m(l)}};d.load=function(u){var n,c,s,q=d.prep;E=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-C:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-D:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-D;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-C;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(A?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");c[0].src=a.href;c.appendTo(k).one(Q,function(){c[0].src='//about:blank'})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(A)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!E){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!E){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this)

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/>
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();


/********************* BEGIN Custom Validation Code *********************/
// Returns the name of the current form being validated. Tracked as eVar23
function getFormName(currentForm){
	return currentForm.name || currentForm.id || currentForm.parentNode.name || currentForm.parentNode.id || currentForm.parentNode.className || "Form Not Named";
}

// Checks for any fields related to the requested field name and returns the value, e.g. searching for "name" would get the values for both First Name and Last Name
function getFieldValue(form, fieldName) {
	var fieldValue = '';
	var fields = $(form).serializeArray();
	for (var i = 0; i < fields.length; i++) {
		if ((fields[i].name.toLowerCase().indexOf(fieldName) >= 0) && (fields[i].value != '')) {
			if (fieldName.toLowerCase() !== 'name' || (fields[i].name.toLowerCase() !== 'ibname' && fields[i].name.toLowerCase() !== 'elqformname')) {
			    fieldValue+= (fieldValue ? ' ' : '') + fields[i].value;
			}
		}
	}
	return fieldValue;
}

// Initial error counter required for proper e-mail validation
jQuery.validator.submitStatus = true;

// Function called in showErorrs. Tracks field errors and sends the info to Omniture
function trackFormErrors(errorList, currentForm){
    var errorFieldNames = new Array();
    for (var i=0 ; i < errorList.length ; i++) {
        var error = errorList[i];
        errorFieldNames.push(error.element.id);
    }

	if (typeof s === 'object') {
		s.eVar23 = getFormName(currentForm)
		s.eVar5 = getFieldValue(currentForm, 'email');
		s.eVar24 = getFieldValue(currentForm, 'phone');
		s.eVar25 = getFieldValue(currentForm, 'name');
		s.eVar26 = getFieldValue(currentForm, 'country');

		if (errorList.length > 0 && jQuery.validator.submitStatus === true) {
			s.linkTrackVars = s.apl(s.linkTrackVars, 'prop5,eVar5,eVar22,eVar23,eVar24,eVar25,eVar26,events', ',', 1);
			s.linkTrackEvents = s.apl(s.linkTrackEvents, 'event76', ',', 1);
			s.eVar22 = errorFieldNames.join(",");
			s.events = 'event76';
			s.tl(true, 'o', 'Form Error');
			jQuery.validator.submitStatus = false;
		}
	}
}

jQuery.validator._emailRegEx = /^[^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*@(\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,})$/i;
jQuery.validator.emailValidate = function(value, element) {
	var demoValidation = typeof fxcm === 'object' && typeof fxcm.Demo === 'function' && typeof fxcm.Demo.prototype.isValidEmail === 'function';
	
	if (demoValidation ? fxcm.Demo.prototype.isValidEmail(value) : jQuery.validator._emailRegEx.test(value)) {
		if (typeof s === 'object' && s.prop5 !== value) {
			s.linkTrackVars = s.apl(s.linkTrackVars, 'prop5,eVar5,eVar23', ',', 1);
			// prop5/eVar5 = E-mail Address
			s.prop5 = value;
			s.eVar5 = value;
			s.eVar23 = getFormName(this.currentForm);
			s.TrackingFunctions.SetTrackingTimeout(1000, 'Email Capture');	// Use a timeout to avoid sending multiple requests as the user types
		}
		return true;
	} else {
		return this.optional(element);
	}
};

jQuery.validator._phoneRegEx = /^[+()_,.:a-zA-Z\-=0-9*]{0,20}$/i;
jQuery.validator.phoneValidate = function(value, element){
	var demoValidation = typeof fxcm === 'object' && typeof fxcm.Demo === 'function' && typeof fxcm.Demo.prototype.isValidPhone === 'function';
	
	if (demoValidation ? fxcm.Demo.prototype.isValidPhone(value) : jQuery.validator._phoneRegEx.test(value)) {
		return true;
	} else {
		return this.optional(element);
	}
};

jQuery.validator._demoBalanceRegEx = /^\d{0,13}(\.\d{0,2})?$/;
jQuery.validator.demoBalanceValidate = function(value, element){
	var demoValidation = typeof fxcm === 'object' && typeof fxcm.Demo === 'function' && typeof fxcm.Demo.prototype.isValidBalance === 'function';
	
	if (demoValidation ? fxcm.Demo.prototype.isValidBalance(value) : jQuery.validator._demoBalanceRegEx.test(value)) {
		return true;
	} else {
		return this.optional(element);
	}
};

jQuery.validator.addMethod('emailcustom', jQuery.validator.emailValidate, 'Please enter a valid email address.');

jQuery.validator.addMethod('phonecustom', jQuery.validator.phoneValidate, 'Please enter a valid phone number.');

jQuery.validator.addMethod('demobalancecustom', jQuery.validator.demoBalanceValidate, 'Please enter a valid balance amount.');

jQuery.validator.addMethod('DateOfBirth', function(value, element) {
	return this.optional(element) || /^(0?[1-9]|1[012])[-\/.](0?[1-9]|[12][0-9]|3[01])[-\/.](19|20)\d\d$/.test(value);
}, 'Please enter a valid date of birth.');



jQuery.validator.messages.required = "";

jQuery.validator.standardValidationOptions = {
	// showErrors is a function that sends form error information to Omniture for tracking
	showErrors: function(errorMap, errorList) {
		trackFormErrors(this.errorList, this.currentForm);
		//========BEGIN defaultShowErrors from jQuery.validator======
		for ( var i = 0; this.errorList[i]; i++ ) {
			var error = this.errorList[i];
			this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
			this.showLabel( error.element, error.message );
		}
		if( this.errorList.length ) {
			this.toShow = this.toShow.add( this.containers );
		}
		if (this.settings.success) {
			for ( var i = 0; this.successList[i]; i++ ) {
				this.showLabel( this.successList[i] );
			}
		}
		if (this.settings.unhighlight) {
			for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {
				this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
			}
		}
		this.toHide = this.toHide.not( this.toShow );
		this.hideErrors();
		this.addWrapper( this.toShow ).show();
		//=========END defaultShowErrors from jQuery.validator=======

		$('input.invalid,select.invalid, textarea.invalid').prevAll('label').addClass('validate');
		$("input[type='radio'].invalid").closest('.radiobox').find('label').addClass('validate');

	},
	// End of show Errors

	errorElement: 'span',
	errorClass: 'invalid',
	rules: {
		email: {
			required: true,
			emailcustom: true
		},
		JointEmail: {
			emailcustom: true
		},
		phone: {
			phonecustom: true
		},
		TransferAmount: {
			required: '#transferConsent:checked'
		},
		ExistingAccountNumber: {
			required: '#TransferFunds:checked'
		},
		'demo.phone': {
			required: true,
			phonecustom: true
		},
		'demo.initial_balance': {
			demobalancecustom: true	
		}
		
	},
	messages: {
		consent: {
			required: 'Please agree to the statement'
		}
	}
};

var _jQueryValidatorRules = jQuery.validator.standardValidationOptions.rules;
_jQueryValidatorRules['demo.email_address'] =
	_jQueryValidatorRules.EMAIL =
	_jQueryValidatorRules.Email =
	_jQueryValidatorRules.email;

var _jQueryValidatorMessages = jQuery.validator.standardValidationOptions.messages;
_jQueryValidatorMessages.youherbebyacknowledgethatyou =
	_jQueryValidatorMessages.Confirm =
	_jQueryValidatorMessages.consentTransfer =
	_jQueryValidatorMessages.transferConsent =
	_jQueryValidatorMessages.Consent =
	_jQueryValidatorMessages.Consent2 =
	_jQueryValidatorMessages.consent;

// Legacy object to support old code
jQuery.validator.customDemoFormValidationOptions = jQuery.validator.standardValidationOptions;

/* enforce max character length in textarea */
/**
* maxChar jQuery plugin
* @author Mitch Wilson
* @version 0.1.0
* @requires jQuery
* @description Enforces max character limit on any input or textarea HTML element and provides user feedback.
* @see http://mitchwilson.net/2009/08/03/new-jquery-plugin-maxchar/
*/

(function($){
	$.fn.maxChar = function(limit, options) {
		// Define default settings and override w/ options.
		settings = jQuery.extend({
			indicator: 'indicator',
			pluralMessage: ' characters remaining',
			rate: 200,
			singularMessage: ' character remaining',
			spaceBeforeMessage: ' '
		}, options);
		// Define local variables.
		var limit = limit;
		var remaining = limit;
		var rate = settings.rate;
		var timer = null;
		var target = $(this);
		var indicator = getIndicator();
		var singularMessage = settings.singularMessage;
		var pluralMessage = settings.pluralMessage;
		// If user did not create indicator, we will create default one for them.
		if(indicator.size() == 0) {
			createIndicator();
		}
		// Create helper functions.
		function update(limit){
			var remaining = limit - target.val().length;
			if(remaining < 1) {
			indicator = getIndicator();
				target.val(target.val().slice(0,limit));
				remaining = 0; // Prevents displaying negative remaining character amounts, such as -1.
			}
			if(remaining == 1) {
				indicator.text(remaining + singularMessage);//'1,000 character limit. ' +
			} else {
				indicator.text(remaining + pluralMessage);//'1,000 character limit. ' +
			}
			try {
				if(console) {
					console.log(remaining);
				}
			} catch(e) {
				// Do nothing on error.
			}
		}
		function createIndicator(){
			target.after(settings.spaceBeforeMessage + '<span id="'+settings.indicator+'"></span>');
		}
		function getIndicator(){
			return $('#'+settings.indicator);
		}
		// Call update once on code initialization to update view if text is already in textarea,
		// eg, if user relaoads page or hits back button and form textarea retains previoulsy entered text.
		update(limit);
		// Bind to focus event to active when user starts interacting with textarea.
		$(this).focus(function(){
			if(timer == null) {
				timer = setInterval(function(){update(limit)}, rate);
			}
		});
		//
		$(this).blur(function() {
			if(timer != null) {
				clearInterval(timer);
				timer = null;
				// Clear manually in case blur happened between timer updates.
				update(limit);
			}
		});
	};
})(jQuery);
/* end maxcharacter textarea */

$(document).ready(function(){
	// Required for proper firing of tracking requests
	$("form").submit(function(){
	    jQuery.validator.submitStatus = true;
	});
	
	$('input,select,textarea').change(function(){
		$(this).prevAll('label').removeClass('validate');
	});
	
	$("input[type='radio']").change(function(){
		$(this).closest('.radiobox').find('label').removeClass('validate');
	});
	
	// The forms must be looped through because jQuery Validator's .validate() function will treat all the forms as one big form
	$('form.std_validate, form.standard, form.custom').each(function() {
		$(this).validate(jQuery.validator.standardValidationOptions);
	});
	
	// Attach Eloqua AJAX submission
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.genericEloquaValidatorSubmitHandler;
	$('form.genericEloqua').each(function() {
		$(this).validate(jQuery.validator.standardValidationOptions);
	});

	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.confBoxEloquaValidatorSubmitHandler;
	$('form.confBoxEloqua').each(function() {
		$(this).validate(jQuery.validator.standardValidationOptions);
	});
	
	// Attach Demo AJAX submission
	$('form.genericDemo').each(function() {
		jQuery.validator.standardValidationOptions.submitHandler = $(this).hasClass('countryFilter') ?
																	fxcm.internal.genericCountryDemoValidatorSubmitHandler :
																	fxcm.internal.genericDemoValidatorSubmitHandler;
		$(this).validate(jQuery.validator.standardValidationOptions);
	});

	$('form.confBoxDemo').each(function() {
		jQuery.validator.standardValidationOptions.submitHandler = $(this).hasClass('countryFilter') ?
																	fxcm.internal.confBoxCountryDemoValidatorSubmitHandler :
																	fxcm.internal.confBoxDemoValidatorSubmitHandler;
		$(this).validate(jQuery.validator.standardValidationOptions);
	});
	
	delete jQuery.validator.standardValidationOptions.submitHandler;
	/********************* END Custom Validation Code *********************/
	
	// Attach ExpandableSet functionality
	$('div.expandableSet').each(function() {
		new fxcm.ui.ExpandableSet(this);
	});
	
	// Set autocomplete="off" for all submit buttons to prevent FF issue where submit stays disabled through refresh
	$('input[type=submit],input[type=image]').attr('autocomplete', 'off');
});var fxcm = new function() {
    var thatNamespace = this;
// Checks for browser support
this.support = new function() {
	var thatSupport = this;
	
	var _select = document.createElement('select');
	var _opt = _select.appendChild(document.createElement('option'));
	
	// Make sure that the options inside disabled selects aren't marked as disabled (WebKit marks them as disabled)
	_select.disabled = true;
	this.optDisabled = !_opt.disabled;
}();

// Library of utility functions
this.lib = new function() {
	var thatLib = this;
	
	/* makeClass - By John Resig (MIT Licensed), modified by Anthony DiSanti
	Allows a class to be instantiated without using the new keyword and uses prototypical inheritance
	Usage:
	var className = makeClass();
	className.prototype.init = function() {
		// Constructor Function
	}

	var obj1 = new newClass(); // Correct class instantiation using the new keyword, properly returns an instance of className
	var obj2 = newClass(); // Incorrect class instantiation missing the new keyword, still properly returns an instance of className */
	this.makeClass = function() {
		return function(args) {
			if (this instanceof arguments.callee) {
				if (typeof this.init === 'function') {
					this.init.apply(this, args && args.callee ? args : arguments);
				}
			} else {
				return new arguments.callee(arguments);
			}
		};
	};


    // Retrieves a URL query parameter, null if it does not exist
	this.getURLParameter = function(parameter) {
		// Confirm that there are URL parameters at all
		if (document.location.search === '') { return false; }
		
		var parameters = document.location.search.substring(1).split('&');	// Strip off the leading ? and split the string into individual key/value pairs
		for (parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
			var parameterParts = parameters[parameterIndex].split('=');	// Split the key and the value
			if (decodeURIComponent(parameterParts[0]).toUpperCase() === parameter.toUpperCase()) {
				return parameterParts.length >= 2 ? decodeURIComponent(parameterParts[1]) : null;	// Return null if the parameter doesn't have a value
			}
		}
		
		return false;	// Return false if the parameter doesn't exist
	};

	
	// Sets a URL query parameter
	this.setURLParameter = function (URL, parameter, value) {
		var URLParts = URL.toLowerCase().match('^(.*[\?&]' + parameter.toLowerCase() + '=).*?([\?&#].*)?$');
		
		if (URLParts)	{
			// Use the original URL so that we don't force the URL and parameters to be lower case
			return URL.substr(0,URLParts[1].length) + value + (typeof URLParts[2] !== 'undefined' ? URL.substr(URL.length - URLParts[2].length) : '');
		} else {
			// Account for a possible anchor
			var anchorLocation = URL.indexOf('#');
			if (anchorLocation >= 0) {
				return [URL.substr(0,anchorLocation), (URL.indexOf('?') == -1 ? '?' : '&'), parameter, '=', value, URL.substr(anchorLocation)].join('');
			} else {
				return URL + (URL.indexOf('?') == -1 ? '?' : '&') + parameter + '=' + value;
			}
		}
	};

	
	// Prepends padChar to a string or number to reach desired length
	this.padLeft = function(string, padChar, length) {
		return _padString(string, padChar, length, true);
	};
	
	
	// Appends padChar to a string or number to reach desired length
	this.padRight = function(string, padChar, length) {
		return _padString(string, padChar, length, false);
	};
	
	
	// Pads a string with padChar to the desired length
	function _padString(string, padChar, length, left) {
		// Convert numbers to strings
		if (typeof string === 'number') { string = String(string); }
		if (typeof padChar === 'number') { padChar = String(padChar); }
		
		// If string isn't a string or padChar isn't a 1 character string or left isn't a boolean, bomb out
		if (typeof string !== 'string' || typeof padChar !== 'string' || padChar.length !== 1 || typeof left !== 'boolean') { return false; }
		
		var padFunction = left ? Array.prototype.unshift : Array.prototype.push;
		
		var padCount = length - string.length;
		var finalString = [string];
		while (padCount > 0) {
			padFunction.call(finalString, padChar);
			padCount--;
		}
		
		return finalString.join('');
	}
	
	
	// Validates an e-mail address
	_validEmail = /^[^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*@(\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,})$/i;
	this.isValidEmail = function(email) {
		if (typeof email !== 'string') { return false; }
		
		return _validEmail.test(email);
	}
	
	
	// Validates a date
	this.isValidDate = function(date, longDay, longMonth, longYear, delimiter, internationalFormat) {
		if (typeof date !== 'string') { return false; }
		
		if (typeof longDay !== 'boolean') { longDay = false; }
		if (typeof longMonth !== 'boolean') { longMonth = false; }
		if (typeof longYear !== 'boolean') { longYear = false; }
		
		
		var day = ['(0', (longDay ? '' : '?'), '[1-9]|[12][0-9]|3[01])'];
		var year = ['(19|20)', (longYear ? '' : '?'), '\\d\\d'];
		if (typeof delimiter !== 'string') { delimiter = '[-\\/.]'; }
		delimiter = [delimiter];
		
		var dateRegEx;
		if (typeof internationalFormat !== 'boolean') {
			// Accept both US and international formats
			dateRegEx = [].concat(['^'], day, delimiter, day, delimiter, year, ['$']);
		} else {
			var month = ['(0', (longMonth ? '' : '?'), '[1-9]|1[0-2])'];
			if (internationalFormat) {
				dateRegEx = [].concat(['^'], day, delimiter, month, delimiter, year, ['$']);
			} else {
				dateRegEx = [].concat(['^'], month, delimiter, day, delimiter, year, ['$']);
			}
		}
		
		console.log(dateRegEx.join(''));
		return new RegExp(dateRegEx.join('')).test(date);
	}
	
	
	// Generates Locally Unique IDs (length parameter is optional)
	this.generateNumericID = function(length) {
		if (typeof length !== 'undefined' && typeof length !== 'number') { return false; }
		
		if (typeof length === 'undefined') {
			length = 20;	// Maximum length before the browser uses scientific notation
		}
		return Math.floor(Math.random() * Math.pow(10, length));
	}
	
	
	/* Like typeof, but can tell different types of built-in objects apart
	Adapted from jQuery 1.5.2 */
	this.type = function(object) {
		var parameterType = typeof object;
        if (parameterType !== 'object') {
            return parameterType;
        } else {
			if (object instanceof Date) {
				return 'date';
			} else if (object instanceof Array) {
				return 'array';
			} else if (object instanceof RegExp) {
				return 'regexp';
			} else {
				return 'object';
			}
        }
	};


    /* Reads a cookie
	Adapted from JQuery Cookie: https://github.com/carhartl/jquery-cookie 7/8/11 Snapshot */
    this.readCookie = function(name) {
        if (typeof name !== 'string') { return false; }

        var cookieParts = new RegExp('(?:^|; )' + encodeURIComponent(name) + '=([^;]*)').exec(document.cookie);
        return cookieParts !== null ? decodeURIComponent(cookieParts[1]) : null;
    };


    // Writes a cookie (Adapted from JQuery Cookie: https://github.com/carhartl/jquery-cookie 7/8/11 Snapshot)
    this.writeCookie = function(name, value, options) {
        if (typeof name !== 'string') { return false; }

        switch (typeof value) {
            case 'string':  // Ideal
                break;

            case 'undefined':   // Parameter wasn't passed, set a cookie with no value
                value = '';
                break;

            case 'object':
                if (value === null) {   // Treat null as an intention to set a cookie with no value
                    value = '';
                } else {    // We could JSON.stringify all other objects, but then we need to duck punch JSON.stringify into older browsers, let the client app deal with that
                    return false;
                }
                break;

            default:    // Cast other primitives to string
                value = String(value);
                break;
        }

        if (typeof options !== 'object') { options = {}; }

        return (document.cookie = [
            encodeURIComponent(name) + '=' + (value !== '' ? encodeURIComponent(value) : ''),
            options.expires instanceof Date ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            typeof options.path === 'string' ? '; path=' + options.path : '',
            typeof options.domain === 'string' ? '; domain=' + options.domain : '',
            typeof options.secure !== 'undefined' && options.secure ? '; secure' : ''
        ].join(''));
    };


    // Deletes a cookie
    this.deleteCookie = function(name, options) {
        if (typeof options !== 'object') { options = {}; }

        options.expires = new Date(0);    // Set cookie expiration to epoch
        return thatLib.writeCookie(name, '', options) ? true : false;
    }


	/* A crude way of determining if an object is a window
	Taken from jQuery 1.5.2 */
	this.isWindow = function(object) {
		return object && typeof object === "object" && "setInterval" in object;
	};

	// Adapted from isPlainObject in jQuery 1.5.2
	this.isDOMElement = function(object) {
		return object && (thatLib.type(object) === 'object') && (object.nodeType || thatLib.isWindow(object));
	};


	/* typeof returns "object" for arrays, use this function instead
	Taken from jQuery 1.5.2 */
	this.isArray = function(object) {
		return thatLib.type(object) === 'array';
	};


	/* Checks if object was created using "{}" or "new Object()"
	Taken from jQuery 1.5.2 */
	this.isPlainObject = function(object) {
		// Must be an Object.
		// Because of IE, we also have to check the presence of the constructor property.
		// Make sure that DOM nodes and window objects don't pass through, as well
		if (typeof object !== 'object' || thatLib.type(object) !== "object" || object.nodeType || thatLib.isWindow(object)) {
			return false;
		}

		// Not own constructor property must be Object
		if (object.constructor &&
			!Object.prototype.hasOwnProperty.call(object, "constructor") &&
			!Object.prototype.hasOwnProperty.call(object.constructor.prototype, "isPrototypeOf") ) {
			return false;
		}

		// Own properties are enumerated firstly, so to speed up, if last one is own, then all properties are own.
		var key;
		for (key in object) {}

		return typeof key === 'undefined' || Object.prototype.hasOwnProperty.call(object, key);
	};


	/* Clones an object
	source is the object to clone
	deep is a boolean signifying whether or not to perform a recursive copy
	Adapted from jQuery 1.5.2's extend called with parameters (deep, {}, source) */
	this.cloneObject = function(source, deep) {
		if (typeof source === 'undefined' || source === null) { return source; }
		if (typeof deep === 'undefined') { deep = false; }

		var clone = (thatLib.isArray(source) ? [] : {});

		for (name in source) {
			if (typeof source[name] !== 'undefined' && source !== null) {
				if (deep && (thatLib.isArray(source[name]) || thatLib.isPlainObject(source[name]))) {
					clone[name] = thatLib.cloneObject(source[name], deep);  // Never move original objects, clone them
				} else {    // Shallow copy primitives or if in shallow copy mode
					clone[name] = source[name];
				}
			}
		}

		// Return the clone
		return clone;
	};


	/* Ignore Earlier Callbacks v1.0
	Cancels earlier callbacks that haven't been invoked yet for the given id.
	This is especially useful when UI elements can trigger async calls directly.
	Wrapping the callback in this function will prevent it from being called repeatedly.
	This becomes very important for asynchronous calls because the responses are not guaranteed to
	arrive in the same order in which the requests were sent.
	Usage:
	asyncCall(parameters, fxcm.lib.ignoreEarlierCallbacks(callback, id)); */
	var _callbacksCount = {};
	
	this.ignoreEarlierCallbacks = function(callback, id) {
		if (typeof id === 'undefined') { id = callback; }

		if (typeof _callbacksCount[id] === 'undefined') { _callbacksCount[id] = 0; }
		_callbacksCount[id]++;

		var callbackWrapper = {};
		callbackWrapper.index = _callbacksCount[id];
		callbackWrapper.f = function() {
			if (_callbacksCount[id] === callbackWrapper.index) {
				callback.apply(this, arguments);
			}
		};
		return callbackWrapper.f;
	};


	// Queues callback functions to be executed in FIFO order
	var _callbacksQueues = {};
	this.queueCallback = function(callback, id) {
		if (typeof id === 'undefined') { id = callback; }

		if (typeof _callbacksQueues[id] === 'undefined') { _callbacksQueues[id] = []; }
		_callbacksQueues[id].push(callback);

		return function() {
			while (_callbacksQueues[id].length > 0) {
				_callbacksQueues[id].shift().apply(this, arguments);
			}
		};
	};


	// Stacks callback functions to be executed in FILO order
	var _callbacksStacks = {};
	this.stackCallback = function(callback, id) {
		if (typeof id === 'undefined') { id = callback; }

		if (typeof _callbacksStacks[id] === 'undefined') { _callbacksStacks[id] = []; }
		_callbacksStacks[id].push(callback);

		return function() {
			while (_callbacksStacks[id].length > 0) {
				_callbacksStacks[id].pop().apply(this, arguments);
			}
		};
	};
	
	
	// Performs an AJAX POST request
	this.ajaxPost = function(URL, postData, callback) {
		if (typeof postData === 'undefined') { postData = ''; }
		
		if (typeof postData === 'object') {
			if (!(postData instanceof Array)) {
				var dataArray = [];
				
				for (var field in postData) {
					if (dataArray.length > 0) {
						dataArray.push('&');
					}
					dataArray.push(field, '=', postData[field]);
				}
				
				postData = dataArray;
			}
			
			postData = postData.join('');
		}
		
		if (typeof URL !== 'string' || typeof postData !== 'string') {
			return false;
		}
		
		if (document.location.host !== thatLib.getHost(URL)) { return false; }	// Cannot perform cross-domain POSTs
		
		var httpRequest = thatLib.getAJAXObject();	// The XMLHttpRequest object is recreated on every call to workaround an IE cache problem
		if(!httpRequest) { return false; }	// The browser doesn't support AJAX
		
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/xml');
		}
		
		// Workaround for IE caching issue
		URL+= (url.indexOf('?') === -1 ? '?' : '&') + 'cacheBuster=' + thatLib.generateNumericID();

		// Open the connection
		httpRequest.open('POST', URL, true);
		
		// Set the proper headers
		httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		httpRequest.setRequestHeader('Content-length', postData.length);
		httpRequest.setRequestHeader('Connection', 'close');

		httpRequest.onreadystatechange = function () {	// Callback for handling the response
			if (httpRequest.readyState === 4) {	// Response has been fully received
				if (httpRequest.status === 200) {	// Successful submission
					if (httpRequest.responseText) {
						if (typeof callback === 'function') {
							callback.call(this, httpRequest.responseText);
						}
					}
				}
			}
		}
		
		httpRequest.send(postData);
	};
	
	
	// Extracts the hostname from a URL
	this.getHost = function (URL) {
		if (typeof URL !== 'string') { return false; }
		
		var host = URL.match(/^(?:(?:.*:)?\/\/)?([^/]+)/);
		if (!host) { return false; }	// Regex didn't match
		
		return host[1];
	};
	
	
	// Instantiates a browser-specific AJAX communication object
	this.getAJAXObject = function() {
		if (typeof ActiveXObject !== 'undefined') {	// Check for IE's ActiveX object
			try {
				var http = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					var http = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e2) {
					var http = false;
				}
			}
		} else if (typeof XMLHttpRequest === 'function') {	// Use XMLHttpRequest if ActiveX is not available
			try {
				var http = new XMLHttpRequest();
			} catch (e) {
				var http = false;
			}
		} else {	// The browser does not support AJAX communication
			var http = false;
		}
		
		return http;
	};


	// Loads a script dynamically and invokes callback after it loads
	this.getScript = function(URL, callback) {
		var script = document.createElement('script');
		script.setAttribute('type', 'text/javascript');
		if (typeof callback === 'function') {
			thatLib.addLoadHandler(script, callback);
		}
		script.setAttribute('src', encodeURI(URL));
		thatLib.attachElement(script);
	};
	
	
	// Loads a URL dynamically and invokes callback after it loads
	this.getURL = function(URL, callback) {
		var iframe = document.createElement('iframe');
		iframe.setAttribute('style', 'display:none');
		if (typeof callback === 'function') {
			thatLib.addLoadHandler(iframe, callback);
		}
		iframe.setAttribute('src', encodeURI(URL));
		thatLib.attachElement(iframe);
	};
	
	
	/* Attaches an element to the current document
	Taken from jQuery 1.5.2
	Inspired by code by Andrea Giammarchi
	http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html */
	this.attachElement = function(element) {
		var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement;

		head.appendChild(element);
	};


	/* Parses ISO-8601 dates into javascript Date objects
	Adapted from Colin Snover's <http://zetafleet.com> Date.parse with progressive enhancement for ISO-8601, version 2 */
	this.parseISO8601 = function(ISO8601) {
		var timezoneOffset = 0, dateParts;
		if (dateParts = /^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?))?/.exec(ISO8601)) {
			if (dateParts[4]) {  // Includes the time
				if (dateParts[8] !== 'Z') {
					timezoneOffset = +dateParts[10] * 60 + (+dateParts[11]); // timezoneOffset = Timezone Hours * 60 + Timezone Minutes

					if (dateParts[9] === '+') {
						timezoneOffset*= -1;  // If the timezone is ahead of UTC, the offset must be negative
					}
				}

				dateParts[7] = +dateParts[7].substr(0, 3);
			} else {    // Date only
				dateParts[4] = 0;   // Hours
				dateParts[5] = new Date().getTimezoneOffset();   // Set minutes to offset from UTC so that resulting date will be midnight in the local time zone
				dateParts[6] = 0;   // Seconds
				dateParts[7] = 0;   // Milliseconds
			}

			// Date.UTC returns the milliseconds since epoch in UTC time, which is then used to initialize a Date object to prevent local time zone issues
			return new Date(Date.UTC(+dateParts[1], +dateParts[2] - 1, +dateParts[3], +dateParts[4], +dateParts[5] + timezoneOffset, +dateParts[6], dateParts[7]));
		} else {
			return false;   // Parameter did not meet ISO-8601 format specifications
		}
	};


    // Removes illegal characters and invalid prefixes (numbers, --, or -number) from text to generate a valid CSS class name
    this.generateCSSClassName = function(text) {
        if (typeof text !== 'string' && typeof text !== 'number') { return ''; }
		text = String(text);
		
        text = text.replace(/[^-a-zA-Z_0-9]/g,'_');
        var prefixTrimmed = text.replace(/^([0-9]|-[^a-zA-Z_])*/, '');

        return (prefixTrimmed.length >= 2 ? prefixTrimmed : 'class_' + text);
    };


    // Removes illegal characters and invalid prefixes (any non-letter) from text to generate a valid CSS class name
    this.generateCSSID = function(text) {
        if (typeof text !== 'string' && typeof text !== 'number') { return ''; }
		text = String(text);
		
        text = text.replace(/[^-a-zA-Z_0-9:.]/g,'_');
        var prefixTrimmed = text.replace(/^[^a-zA-Z]*/, '');

        return (prefixTrimmed.length >= 0 ? prefixTrimmed : 'id_' + text);
    };
	
	
	// Removes illegal characters and invalid prefixes (anything other than letters, $, or _) from text to generate a valid javascript function name
    this.generateFunctionName = function(text) {
        if (typeof text !== 'string' && typeof text !== 'number') { return ''; }
		text = String(text);
		
		var illegalSuffixChars = /[^a-zA-Z0-9_]/g;
		
		var prefix = text.charAt(0);
		if (prefix.match(/[a-zA-Z$_]/)) {
			return prefix + text.substr(1).replace(illegalSuffixChars,'_');
		} else {
			return 'function_' + text.replace(illegalSuffixChars,'_');
		}
    };


    // Calculates the timestamp for midnight of the parameter
    this.midnightTimestamp = function(date) {
        switch (typeof date) {
			case 'object':
				if (!(date instanceof Date)) {
					return false;
				}
				break;

			case 'number':
			case 'string':
				date = new Date(date);
				break;

			case 'undefined':
			default:
			    return false;
		}

        return date.getTime() - (((date.getHours() * 60 + date.getMinutes()) * 60 + date.getSeconds()) * 1000 + date.getMilliseconds());
    };


    // Removes whitespace from the beginning and end of a string
    this.trim = function(text) {
        if (typeof text !== 'string') { return false; }

        if (String.prototype.trim) {    // Use native implementation if it exists
            return String.prototype.trim.call(text);
        } else {
            return text.replace(/^\s+/, '').replace(/\s+$/, '');
        }
    }


    /* Adapted from jQuery 1.6.1
    Adds one or more space-separated classes to element */
    this.addClass = function(element, classNames) {
        if (typeof classNames !== 'string') { return false; }

        switch (typeof element) {
            case 'object':
                if (!thatLib.isDOMElement(element)) {
                    return false;
                }
                break;

            case 'string':
                element = document.getElementById(element);
                if (element === null) {
                    return false;
                }
                break;

            default:
                return false;
        }

        if (classNames === '') { return true; }

        if (!element.className) {
            element.className = classNames;
        } else {
            var className = ' ' + element.className + ' ';
            var setClass = element.className;

            classNames = classNames.split(/\s+/);
            for (var classNamesIndex = 0; classNamesIndex < classNames.length; classNamesIndex++) {
                if (className.indexOf(' ' + classNames[classNamesIndex] + ' ') < 0 ) {
                    setClass += ' ' + classNames[classNamesIndex];
                }
            }

            element.className = setClass;
        }

        return true;
    };


    /* Adapted from jQuery 1.6.1
    Removes one or more space-separated classes to element */
    this.removeClass = function(element, classNames) {
        if (!(typeof classNames === 'string' || typeof classNames === 'undefined')) { return false; }

        switch (typeof element) {
            case 'object':
                if (!thatLib.isDOMElement(element)) {
                    return false;
                }
                break;

            case 'string':
                element = document.getElementById(element);
                if (element === null) {
                    return false;
                }
                break;

            default:
                return false;
        }

        if (!element.className) { return true; }
        if (typeof classNames === 'undefined' || classNames === '') {
            element.className = '';
            return true;
        }

        classNames = classNames.split(/\s+/);
        var className = (' ' + element.className + ' ').replace(/[\n\r\t]/g, ' ');

        for (var classNamesIndex = 0; classNamesIndex < classNames.length; classNamesIndex++) {
            className = className.replace(' ' + classNames[classNamesIndex] + ' ', ' ');
        }

        element.className = thatLib.trim(className);

        return true;
    };


    /* Translates Date.getDay() to the name of the day.
    If shortForm is true, only returns the first 3 characters */
    var _dayNames = {};
    _dayNames['english'] = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
    
	this.formatDay = function(day, shortForm, language) {
		if (typeof language !== 'string' || typeof _dayNames[language.toLowerCase()] === 'undefined') {
			language = 'english';
		}

        if (typeof shortForm === 'undefined') {
            shortForm = false;
        }

        var dayName = _dayNames[language.toLowerCase()][day];
		if (shortForm) {
            return dayName.substr(0,3);
        } else {
            return dayName;
        }
	};


    /* Translates Date.getMonth() to the name of the month.
    If shortForm is true, only returns the first 3 characters */
	var _monthNames = {};
    _monthNames['english'] = ['January','February','March','April','May','June','July','August','September','October','November','December'];
    this.formatMonth = function(month, shortForm, language) {
		if (typeof language !== 'string' && typeof _monthNames[language] === 'undefined') {
			language = 'english';
		}

        if (typeof shortForm === 'undefined') {
            shortForm = false;
        }

        var monthName = _monthNames[language.toLowerCase()][month];
		if (shortForm) {
            return monthName.substr(0,3);
        } else {
            return monthName;
        }
	};
	
	// Attaches events with cross-browser support, properly setting the context of this
	this.addEventHandler = function(element, event, handler, capture) {
		if (!thatLib.isDOMElement(element) || typeof event !== 'string' || typeof handler !== 'function') { return false; }
		if (event.substr(0,2) === 'on') { event = event.substr(2); }	// Strip the 'on' at the beginning of the event if it is present
		
		if (typeof element.addEventListener === 'function') {	// Primary way of adding event listeners
			if (typeof capture === 'undefined') { capture = false; }
			return element.addEventListener(event, handler, capture);
		} else if (typeof element.attachEvent !== 'undefined') {	// Special case for IE (also, strangely typeof element.attachEvent = 'object' in IE)
			return element.attachEvent('on' + event, function(e) { return handler.call(element, e); });
		} else {
			return false;
		}
	};
	
	
	// Adds an onload handler for script and iframe elements (supports IE)
	var _addLoadHandlerCallbackFired = {};
	this.addLoadHandler = function(element, callback) {
		if (typeof callback !== 'function') { return false; }
		
		var callbackID = thatLib.generateNumericID();	// Generate an ID for the callback
		_addLoadHandlerCallbackFired[callbackID] = false;	// Initialize its state as not fired
		callback = thatLib.queueCallback(callback, 'fxcm.lib.addLoadHandler:' + callbackID);	// Support multiple callbacks on the same element
		var wrappedCallback = function() {	// Wrap callback to set state to fired when called
				_addLoadHandlerCallbackFired[callbackID] = true;
				return callback.call(element);
			};
		
		// Attach standard load handler
		thatLib.addEventHandler(element, 'load', wrappedCallback);

		/* Hack to replicate element.onload in IE
		Adapted from Nick Spacek's code at https://gist.github.com/461797 */
		thatLib.addEventHandler(element, 'readystatechange', function() {
				if ((element.readyState === 'loaded' || element.readyState === 'complete') && _addLoadHandlerCallbackFired[callbackID] === false) {
					return wrappedCallback.call(element);
				}
			});
		
		return true;
	};
	
	
	/* Returns an object of name/value pairs for the contents of a form
	Inspired by jQuery 1.6.2's serializeArray() */
	var _selectTextareaRegEx = /^(?:select|textarea)/i;
	var _inputTypesRegEx = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i;
	
	this.serializeForm = function(form) {
		// Dereference an ID
		if (typeof form === 'string') { form = document.getElementById(form); }
		
		// Confirm that form is a form element
		if (!(thatLib.isDOMElement(form) && form.tagName === 'FORM')) { return false; }
		
		var serializedForm = {};
		for (elementIndex = 0; elementIndex < form.elements.length; elementIndex++) {
			var element = form.elements[elementIndex];
			
			if (element.name && !element.disabled && (element.checked || _selectTextareaRegEx.test(element.tagName) || _inputTypesRegEx.test(element.type))) {
				serializedForm[element.name] = thatLib.inputValue(element);
			}
		}
		
		return serializedForm;
	};
	
	
	/*	Returns the value of an input (supports all types)
	Inspired by jQuery 1.6.2's val() */
	var _hardReturnRegEx = /\r/g;
	
	this.inputValue = function(element) {
		if (!thatLib.isDOMElement(element)) { return false; }
		
		switch(element.tagName) {
			case 'SELECT':
				var selectedIndex = element.selectedIndex;
				if (selectedIndex < 0) { return null; }

				if (element.type === 'select-one') {
					var option = element.options[selectedIndex];
					
					if (option.selected && thatLib.isEnabledOption(option)) {
						return thatLib.inputValue(option);
					} else {
						return null;
					}
				} else {				
					var options = element.options;
					
					var values = [];
					for (var optionIndex = 0; optionIndex < options.length; optionIndex++) {
						var option = options[optionIndex];
						
						if (option.selected && thatLib.isEnabledOption(option)) {
							values.push(thatLib.inputValue(option));
						}
					}
					
					if (values.length === 0) {
						return null;
					} else if (values.length === 1) {
						return values[0];
					} else {
						return values;
					}
				}

				return null;
			
			case 'OPTION':
				var attrValue = element.attributes.value;
				if (!attrValue || attrValue.specified) {
					return element.value;
				} else {
					return element.text;
				}
			
			case 'INPUT':
				var value = element.value;
				if (typeof value === 'string') {
					return value.replace(_hardReturnRegEx, '');
				} else if (value == null) {
					return '';
				} else {
					return value;
				}
			
			default:
				return false;
		}
	};
	
	
	// Checks if the option element has been disabled or is in a disabled optgroup
	this.isEnabledOption = function(option) {
		return (thatNamespace.support.optDisabled ? !option.disabled : option.getAttribute('disabled') === null) &&
			(!option.parentNode.disabled || option.parentNode.tagName === 'OPTGROUP');
	};
	
	
	/* Cancels events in a cross-browser compatible way
	Usage:
	
	return fxcm.lib.cancelEvent(event);	*/
	this.cancelEvent = function(event) {
		if (typeof event !== 'object') { return false; }
		
		// Cancel the default action
		if (typeof event.preventDefault === 'function') {
			event.preventDefault();
		} else {
			event.returnValue = false;
		}
		
		// Stop the event from bubbling
		if (typeof event.stopPropagation === 'function') {
			event.stopPropagation();
		} else {
			event.cancelBubble = true;
		}
		
		// Return false
		return false;
	}
	
	// Returns a copy of the array with numberOfElements shifted off
	this.shiftArray = function(array, numberOfElements) {
		if (typeof numberOfElements === 'undefined') {
			numberOfElements = 1;
		} else 	if (typeof numberOfElements !== 'number' || numberOfElements < 0) {
			return false;
		}
		
		var returnArray = [];
		for (var index = numberOfElements; index < array.length; index++) {
			returnArray.push(array[index]);
		}
		
		return returnArray;
	};
	
	// Returns a copy of the array with numberOfElements popped off
	this.popArray = function(array, numberOfElements) {
		if (typeof numberOfElements === 'undefined') {
			numberOfElements = 1;
		} else 	if (typeof numberOfElements !== 'number' || numberOfElements < 0) {
			return false;
		}
		
		var returnArray = [];
		for (var index = array.length - numberOfElements - 1; index >= 0; index--) {
			returnArray.unshift(array[index]);
		}
		
		return returnArray;
	};
	
	// Dynamically adds style to the current document
	this.addStyle = function() {
		var styleElement = thatLib.createStyleElement.apply(this, arguments);
		return thatLib.attachElement(styleElement);
	};
	
	// Dynamically creates a style element
	this.createStyleElement = function(id, style) {
		var styleContent = id + ' { ' + style + ' }';

		var styleElement = document.createElement('style');
		styleElement.type = 'text/css';
		
		if(styleElement.styleSheet) {
			styleElement.styleSheet.cssText = styleContent;
		} else {
			styleElement.appendChild(document.createTextNode(styleContent));
		}
		
		return styleElement;
	};
}();

this.ui = new function() {	
	this.ExpandableSet = thatNamespace.lib.makeClass();
	
	this.ExpandableSet.prototype.init = function(wrapper, controlLink, expandText, collapseText) {
		var thatExpandableSet = this;
		var _settings = {};
		
		this.setControlLink = function(controlLink) {
			// Dereference is an ID
			if (typeof controlLink === 'string' && controlLink) {
				controlLink = document.getElementById(controlLink);
			}
			
			// Look for default if no control link was passed in
			if (!controlLink) {
				controlLink = _removeDescendents($(_settings.wrapper).find('a.controlThisSection'), _dls)[0];
			}
			
			// Set the control link if one has been found
			if (thatNamespace.lib.isDOMElement(controlLink)) {
				_settings.controlLink = controlLink;
				$(_settings.controlLink).click(_controlLinkClick);
				_updateControlLinkText();
				
				return _settings.controlLink;
			} else {
				return false;
			}
		};
		
		this.getControlLink = function(controlLink) {
			if (_settings.controlLink) {
				return _settings.controlLink;
			} else {
				return false;
			}
		};
		
		this.setExpandText = function(expandText) {
			if (typeof expandText === 'string' && expandText !== '') {
				return _settings.expandText = expandText;
			} else {
				return false;
			}
		};
		
		this.getExpandText = function() {
			return _settings.expandText;
		};
		
		this.setCollapseText = function(collapseText) {
			if (typeof collapseText === 'string' && collapseText !== '') {
				return _settings.collapseText = collapseText;
			} else {
				return false;
			}
		};
		
		this.getCollapseText = function() {
			return _settings.collapseText;
		};
		
		this.handleAnchor = function(anchor) {
			if (typeof anchor !== 'string') { return false; }
			if (anchor === '') { return true; }
			
			var filter = 'a[name=' + anchor + ']';
			
			for (var dtIndex = 0; dtIndex < _dts.length; dtIndex++) {
				var dt = $(_dts[dtIndex]);
				var dd = dt.next('dd');
				
				if (dt.find(filter).length || dd.find(filter).length) {
					_setDtState(dt, true);
					break;
				}
			}
		};
		
		function _controlLinkClick() {
			if (_settings.controlLinkState === 'expand') {
				_setAllDtStates(true);
			} else if (_settings.controlLinkState === 'collapse') {
				_setAllDtStates(false);
			}
			_updateControlLinkText();
			return false;		
		}
		
		function _setAllDtStates(expanded) {
			return _setDtState(_dts, expanded);
		}
		
		// Sets the state of one or more dt elements (pass in a jQuery object containing multiple dt elements for multiple)
		function _setDtState(dt, expanded) {
			dt = $(dt);
			
			if (expanded) {
				dt.addClass('open').next('dd').addClass('open');
			} else {
				dt.removeClass('open').next('dd').removeClass('open');
			}
			
			return true;
		}
		
		// Expands/collapses dt and dd elements
		function _toggleState(e) {
			e.stopPropagation();
			e.cancelBubble = true;
			$(this).toggleClass('open').next('dd').toggleClass('open');
			if (_settings.controlLink && (_countDts(true) === _countDts() || _countDts(false) === _countDts())) {
				_updateControlLinkText();
			}
			return false;
		}
		
		function _updateControlLinkText() {
			if (_settings.controlLink) {
				if (_countDts(true) === _countDts()) {	// All dt's are expanded
					$(_settings.controlLink).text(_settings.collapseText);
					_settings.controlLinkState = 'collapse';
				} else {	// Not all dt's are expanded
					$(_settings.controlLink).text(_settings.expandText);
					_settings.controlLinkState = 'expand';
				}
			}
		}
		
		// Counts the number of expanded dt elements
		function _countDts(expanded) { 
			if (typeof expanded === 'undefined') {	// Count all dt's
				return _dts.length;
			} else {
				if (expanded) {	// Count expanded dt's
					return _dts.filter('.open').length;
				} else {	// Count collapsed dt's
					return _dts.length - _countDts(true);
				}
			}
		}
		
		// Returns the elements that are not decendents of any other elements in the array
		function _removeDescendents(elements, ancestors) {
			if (typeof ancestors === 'undefined') {
				ancestors = elements;
			}
			
			var topLevelElements = [];
			for (var elementIndex = 0; elementIndex < elements.length; elementIndex++) {
				var ancestorFound = false;
				for (var ancestorIndex = 0; ancestorIndex < ancestors.length; ancestorIndex++) {
					if ($.contains(ancestors[ancestorIndex], elements[elementIndex])) {
						ancestorFound = true;
						break;
					}
				}
				
				if (!ancestorFound) {
					topLevelElements.push(elements[elementIndex]);
				}
			}
			
			return topLevelElements;
		}
			
		// Find the wrapper element
		if (typeof wrapper === 'string' && wrapper) {	// Dereference an ID
			wrapper = document.getElementById(wrapper);
		}
		
		if (!thatNamespace.lib.isDOMElement(wrapper)) {	// No wrapper, bomb out
			return false;
		}
		
		_settings.wrapper = wrapper;
		
		// Set the expand text 
		if (!thatExpandableSet.setExpandText(expandText)) {
			thatExpandableSet.setExpandText('Expand All');
		}
		
		// Set the collapse text
		if (!thatExpandableSet.setCollapseText(collapseText)) {
			thatExpandableSet.setCollapseText('Collapse All');
		}
		
		// Construct list of top level dl elements
		var _dls = $(_removeDescendents($(_settings.wrapper).find('dl')));
		
		// Construct list of dt elements directly within the top level dl elements
		var _dts = _dls.children('dt');
		
		// Add close this links and expand/collapse click handler
		_dts.append('<a class="closeThis"></a>');
		_dts.click(_toggleState);
		
		// Initialize the control link
		thatExpandableSet.setControlLink(controlLink);
		thatExpandableSet.handleAnchor(document.location.hash.substr(1));
	};
}();

this.Eloqua = this.lib.makeClass();
this.Eloqua.prototype.init = function(formName, form, callback) {
	var thatEloqua = this;
	var _settings = {};
	
	this.setFormName = function(formName) {
		if (typeof formName !== 'string') { return false; }
		
		return _settings.formName = formName;
	};
	
	this.getFormName = function() {
		return _settings.formName;
	};
	
	this.setCallback = function(callback) {
		if (typeof callback !== 'function') { return false; }
		
		return _settings.callback = callback;
	};
	
	this.getCallback = function() {
		return _settings.callback;
	};
	
	this.bind = function(form, formName) {
		// Dereference an id
		if (typeof form === 'string') {
			form = document.getElementById(form);
		}
		
		// Confirm that "form" is a form
		if (!(thatNamespace.lib.isDOMElement(form) && form.tagName === 'FORM')) {
			return false;
		}

		// Capture the formName if it is present on the form or was passed in
		var formName = thatNamespace.lib.serializeForm(form)['elqFormName'] || formName;
		if (typeof formName === 'string') {
			thatEloqua.setFormName(formName);
		}
		
		// Attach submit handler
		return thatNamespace.lib.addEventHandler(form, 'submit', _submitHandler);
	};
	
	function _submitHandler(event) {
		// Scrape the form
		var formData = thatNamespace.lib.serializeForm(this);
		
		if (typeof event === 'object') {	// _submitHandler is handling a submit event
			thatEloqua.submit(formData);	// Submit the request
			
			return thatNamespace.lib.cancelEvent(event);	// Cancel the form submission
		} else {	// _submitHandler was manually invoked by submit because a form was passed in
			return thatEloqua.submit(formData, event);	// Submit the request, event is the callback in this case
		}
	}
	
	// Submits submissionData, an object of key/value pairs, and invokes callback after
	this.submit = function(submissionData, callback) {
		//**** BEGIN check for submit being called with a form as the first parameter ****
		// Dereference an ID
		if (typeof submissionData === 'string') {
			submissionData = document.getElementById(submissionData);
			if (submissionData === null) { return false; }
		}
		
		// If submissionData is a DOM element, confirm that it's a form then reinvoke submit with the scraped data
		if (thatNamespace.lib.isDOMElement(submissionData)) {
			if (submissionData.tagName === 'FORM') {
				return _submitHandler.call(submissionData, callback);
			} else {
				return false;
			}
		}
		//***** END check for submit being called with a form as the first parameter *****
		
		// If submissionData contains an elqFormName, override the setting
		if (typeof submissionData['elqFormName'] === 'string') {
			thatEloqua.setFormName(submissionData['elqFormName']);
			delete submissionData['elqFormName'];
		}
		
		// Confirm that formName has been set and submissionData is either undefined or a non-null object
		if (typeof _settings.formName !== 'string' ||	// The formName must be set
				!(
					typeof submissionData === 'undefined' || 	// Allow no submissionData to be passed in
					(typeof submissionData === 'object' && submissionData !== null)	// Otherwise submissionData must be a non-null object
				)
			) {
			return false;
		}
		
		// Build the request URL base
		var requestURL = [thatEloqua.submissionURL, '?elqSiteID=202&oid=00D30000000010t'];
		
		// Add the Eloqua Form Name
		requestURL.push('&elqFormName=', _settings.formName);
		
		// Add submissionData parameters
		for (var field in submissionData) {
			requestURL.push('&', field, '=', submissionData[field]);
		}
		
		// Submit the request
		thatNamespace.lib.getURL(requestURL.join(''), callback || _settings.callback);
		
		return true;
	};
	
	// Constructor logic
	thatEloqua.setFormName(formName);
	thatEloqua.bind(form);
	thatEloqua.setCallback(callback);
};

this.Eloqua.prototype.submissionURL = 'https://secure.eloqua.com/e/f2.aspx';
this.Demo = this.lib.makeClass();
this.Demo.prototype.init = function(rb, form, successCallback) {
	var thatDemo = this;
	
	var _settings = {};
	_settings.submissionTargets = {};
	_settings.submissionTargets.get = [];
	_settings.submissionTargets.post = [];
	_settings.submissionTargets.JSONP = [];
	_settings.submissionTargets.eloqua = [];
	
	var _timeoutID = null;
	var _requestsQueue = [];
	
	this.setRB = function(rb) {
		if (typeof rb !== 'string') { return false; }
		
		return _settings.rb = rb.toLowerCase();
	};
	
	this.getRB = function() {
		return _settings.rb;
	};
	
	this.setCountry = function(country) {
		if (typeof country !== 'string') { return false; }
		
		_settings.country = country;
		_settings.rb = _rbLookup();
		
		return _settings.country;
	};
	
	this.getCountry = function() {
		return _settings.country;
	};
	
	this.setAccountType = function(accountType) {
		if (typeof accountType !== 'string') { return false; }
		
		_settings.accountType = accountType;
		_settings.rb = _rbLookup();
		
		return _settings.accountType;
	};
	
	this.getAccountType = function() {
		return _settings.accountType;
	};
	
	this.setCountryAccountType = function(country, accountType) {
		if (typeof country !== 'string' || typeof accountType !== 'string') { return false; }
		
		_settings.country = country;
		_settings.accountType = accountType;
		_settings.rb = _rbLookup();
		
		return {country: _settings.country, accountType: _settings.accountType};
	};
	
	this.setCampaign = function(campaign) {
		if (typeof campaign !== 'string') { return false; }
		
		return _settings.campaign = campaign;
	};
	
	this.getCampaign = function() {
		return _settings.campaign;
	};
	
	this.setFormName = function(name) {
		if (typeof name !== 'string') { return false; }
		
		return _settings.formName = name;
	};
	
	this.getFormName = function() {
		return _settings.formName;
	};
	
	/* Adds another submission target submitted with HTTP GET into an iFrame
	fieldMap is an object where the keys are the clientInfo field names to map and values are the submission target's expected field names
	additionalData is an object of key/value pairs that will be submitted along with the demo data
	valueMap is an object of field names, which each are objects containing key/value pairs mapping values to aliases
	If any Personally Identifiable Information (PII, e.g. name, address) is being passed, you should use a secure link (https) otherwise the data is passed as plain text */
	this.addGetSubmissionTarget = function(target, fieldMap, additionalData, callback, valueMap) {
		return _addSubmissionTarget('get', target, fieldMap, additionalData, callback, valueMap);
	};
	
	/* Adds another submission target submitted with HTTP POST
	fieldMap is an object where the keys are the clientInfo field names to map and values are the submission target's expected field name
	additionalData is an object of key/value pairs that will be submitted along with the demo data
	valueMap is an object of field names, which each are objects containing key/value pairs mapping values to aliases
	If any Personally Identifiable Information (PII, e.g. name, address) is being passed, you should use a secure link (https) otherwise the data is passed as plain text */
	this.addPostSubmissionTarget = function(target, fieldMap, additionalData, callback, valueMap) {
		return _addSubmissionTarget('post', target, fieldMap, additionalData, callback, valueMap);
	};
	
	/* Adds another submission target submitted via a script tag
	fieldMap is an object where the keys are the clientInfo field names to map and values are the submission target's expected field names
	additionalData is an object of key/value pairs that will be submitted along with the demo data
	valueMap is an object of field names, which each are objects containing key/value pairs mapping values to aliases
	If any Personally Identifiable Information (PII, e.g. name, address) is being passed, you should use a secure link (https) otherwise the data is passed as plain text */
	this.addJSONPSubmissionTarget = function(target, fieldMap, additionalData, callback, valueMap) {
		return _addSubmissionTarget('JSONP', target, fieldMap, additionalData, callback, valueMap);
	};
	
	/* Adds another submission target submitted to Eloqua
	fieldMap is an object where the keys are the clientInfo field names to map and values are the submission target's expected field names
	additionalData is an object of key/value pairs that will be submitted along with the demo data */
	this.addEloquaSubmissionTarget = function(eloquaFormName, fieldMap, additionalData, callback, valueMap) {
		return _addSubmissionTarget('eloqua', eloquaFormName, fieldMap, additionalData, callback, valueMap);
	};
	
	function _addSubmissionTarget(type, target, fieldMap, additionalData, callback, valueMap) {
		var submissionTarget = {};
		
		if (typeof target === 'string') {
			submissionTarget[type === 'eloqua' ? 'formName' : 'target'] = target;
		} else {
			return false;
		}
		
		if (typeof fieldMap !== 'undefined') {
			if (typeof fieldMap === 'object') {
				submissionTarget.fieldMap = fieldMap;
			} else {
				return false;
			}
		}
		
		if (typeof additionalData !== 'undefined') {
			if (typeof additionalData === 'object') {
				submissionTarget.additionalData = additionalData;
			} else {
				return false;
			}
		}
		
		if (typeof callback !== 'undefined') {
			if (typeof callback === 'function') {
				submissionTarget.callback = callback;
			} else {
				return false;
			}
		}
		
		if (typeof valueMap !== 'undefined') {
			if (typeof valueMap === 'object') {
				submissionTarget.valueMap = valueMap;
			} else {
				return false;
			}
		}
		
		_settings.submissionTargets[type].push(submissionTarget);
		return submissionTarget;
	}
	
	this.getSubmissionTargets = function() {
		return _settings.submissionTargets;
	};
	
	function _getCampaign() {
		return thatNamespace.lib.getURLParameter('CMP') ||
			(typeof jPersist === 'object' && typeof jPersist.visitor === 'object' && typeof jPersist.visitor.campaign === 'string' && 'SFS-' + jPersist.visitor.campaign);
	}
	
	this.setSuccessCallback = function(callback) {
		if (typeof callback !== 'function') { return false; }
		
		return _settings.successCallback = callback;
	};
	
	this.getSuccessCallback = function() {
		return _settings.successCallback;
	};
	
	this.setErrorCallback = function(callback) {
		if (typeof callback !== 'function') { return false; }
		
		return _settings.errorCallback = callback;
	};
	
	this.getErrorCallback = function() {
		return _settings.errorCallback;
	};
	
	this.checkFXTRStatus = function() {
		var callbackName = thatNamespace.lib.generateFunctionName(thatNamespace.lib.generateNumericID());
		
		window[callbackName] = _handleFXTRStatus;
		_timeoutID = setTimeout(_FXTRTimeout, 2000);	// Give FXTR Status 2 seconds to respond before defaulting to FXTR
		return thatNamespace.lib.getScript(thatDemo.FXTRStatusURL + '?callback=' + callbackName);
	}
	
	function _FXTRTimeout() {
		_timeoutID = null;
		
		_settings.submissionTarget = 'fxtr';
		
		_submitRequests();
	}
	
	function _handleFXTRStatus(status) {
		if (_timeoutID !== null) {
			clearTimeout(_timeoutID);
		}
		
		if (status) {
			_settings.submissionTarget = 'fxtr';
		} else {
			_settings.submissionTarget = 'eloqua';
		}
		
		_submitRequests();
	}
	
	function _rbLookup(country, accountType) {
		if (typeof country === 'undefined') { country = _settings.country; }
		if (typeof accountType === 'undefined') { accountType = _settings.accountType || 'ts'; }
		
		if (typeof country !== 'string' || typeof accountType !== 'string') { return false; }
		
		switch(country) {
			case 'united_states':
			case 'american_samoa':
			case 'guam':
			case 'puerto_rico':
				switch(accountType) {
					case 'ts':
						return 'fxcm';
					
					case 'at':
						return 'active_trader';
					
					case 'tsg':
						return 'tsg_llc';
					
					case 'st':
						return 'strategy_trader_llc';
					
					default:
						return false;
				}

			case 'australia':
			case 'new_zealand':
				switch(accountType) {
					case 'ts':
						return 'fxcmau';
					
					default:
						return false;
				}
			
			case 'united_kingdom':
			default:
				switch(accountType) {
					case 'ts':
					default:
						return 'fxcmuk';
				}
		}
	}
	
	this.bindCountry = function(element) {
		// Dereference an id
		if (typeof element === 'undefined') {
			if (typeof _settings.bindTarget !== 'undefined') {
				element = _settings.bindTarget;
			} else {
				return false;
			}
		} else if (typeof element === 'string') {
			element = document.getElementById(element);
		}
		
		// Confirm that element is an element
		if (!thatNamespace.lib.isDOMElement(element)) { return false; }
		
		switch (element.tagName) {
			case 'SELECT':
				thatNamespace.lib.addEventHandler(element, 'change', _countryChangeHandler);
				return true;
				
			case 'FORM':
				for (elementIndex = 0; elementIndex < element.elements.length; elementIndex++) {
					var formElement = element.elements[elementIndex];
					
					if (formElement.name.toLowerCase() === 'country' || formElement.name === 'demo.' + _demoFieldMap['country'].fxtrName || formElement.name === _demoFieldMap['country'].eloquaName) {
						thatNamespace.lib.addEventHandler(formElement, 'change', _countryChangeHandler);
						return true;
					}
				}
				return false;
				
			default:
				return false;
		}
	}
	
	function _countryChangeHandler(event) {
		return thatDemo.setCountry(thatNamespace.lib.inputValue(this));
	}
	
	this.bind = function(form) {
		// Dereference an id
		if (typeof form === 'string') {
			form = document.getElementById(form);
		}
		
		// Confirm that "form" is a form
		if (!(thatNamespace.lib.isDOMElement(form) && form.tagName === 'FORM')) {
			return false;
		}

		// Set the form name to the name attribute of the bind target if one hasn't been set already
		if (typeof _settings.formName === 'undefined') {
			thatDemo.setFormName(form.name);
		}
		
		// Attach submit handler
		_settings.bindTarget = form;
		return thatNamespace.lib.addEventHandler(form, 'submit', _submitHandler);
	}
	
	function _submitHandler(event) {
		// Set the form name to the name attribute of the bind target if one hasn't been set already
		if (typeof _settings.formName === 'undefined') {
			thatDemo.setFormName(this.name);
		}
		
		// Scrape data from the form
		var formData = thatNamespace.lib.serializeForm(this);
		
		// Map fxtr fields to their respective clientInfo name
		for (var field in _demoFieldMap) {
			if (typeof formData['demo.' + _demoFieldMap[field].fxtrName] !== 'undefined') {
				formData[field] = formData['demo.' + _demoFieldMap[field].fxtrName];
				delete formData['demo.' + _demoFieldMap[field].fxtrName];
			}
		}
		
		if (typeof event === 'object') {	// _submitHandler is handling a submit event
			thatDemo.submit(formData);	// Submit the request
			
			return thatNamespace.lib.cancelEvent(event);	// Cancel the form submission
		} else {	// _submitHandler was manually invoked by submit because a form was passed in
			return thatDemo.submit(formData, event);	// Submit the request, event is the callback in this case
		}
	}
	
	/* clientInfo can contain the following members:
	firstName (max of 50 characters)
	lastName (required): The client's last name (max of 50 characters)
	email (required): Must be a validly formatted email address (max of 50 characters)
	phone: May only use digits, letters, and the characters: +()_,.:-=* (max of 20 characters)
	phone2: May only use digits, letters, and the characters: +()_,.:-=* (max of 20 characters)
	imNetwork: Instant messaging network (aol, yahoo, icq, msn, other)
	imID: Instant messaging screen name (max of 255 characters)
	street (max of 50 characters)
	address2 (max of 255 characters)
	city (max of 50 characters)
	state: State or province (max of 50 characters)
	zip (max of 10 characters)
	country: Lower-case with underscores (white list)
	company (max of 255 characters)
	language: Preferred language (English, Traditional_Chinese, Simplified_Chinese, Bahasa_Malayu, Korean, Japanese, Vietnamese, Thai, Tagalog)
	accountType: Account type (individual, joint, corporate, partnership, trust)
	balance: Initial balance of the demo account (maximum of 13 digits before the decimal and 2 after)
	accounts: Number of accounts to create (1-9999)
	margin: Expected margin (0, less50000, 50000_100000, more100000)
	deposit: Intended funding amount for the future account (5000_24999, 25000_49999, 50000_99999, 100000_inf)
	traderType: Type of trader (individual_investor, high_volume_trader, manager, ib_regulated_introducing_broker, ib_service_provider)
	forexExperience: Years trading forex (0, 1, 2, 3, 4, 5+)
	equitiesExperience: Years trading equities (0, 1, 2, 3, 4, 5+)
	futuresExperience: Years trading futures (0, 1, 2, 3, 4, 5+)
	experienceLevel: Level of FX experience (Novice, Intermediate, Expert)
	tradingFrequency: How often the client will be trading FX (Never, Daily, Weekly, Occasionally)
	reference: Where the client heard about us (max of 255 characters)
	previousSignup: Whether or not the client has signed up before (yes, no)
	freeProduct: Whether or not the client wants to receive a free product (yes, no)
	emailSignup: Email opt-in (yes, no)
	*/
	this.submit = function(clientInfo, callback) {
		var errors = [];
		
		/**** BEGIN check for submit being called with a form as the first parameter ****/
		// Dereference an ID
		if (typeof clientInfo === 'string') {
			clientInfo = document.getElementById(clientInfo);
			if (clientInfo === null) {
				errors.push('Form ID does not exist in the DOM')
				return errors;
			}
		}
		
		// If clientInfo is a DOM element, confirm that it's a form then reinvoke submit with the scraped data
		if (thatNamespace.lib.isDOMElement(clientInfo)) {
			if (clientInfo.tagName === 'FORM') {
				return _submitHandler.call(clientInfo, callback);
			} else {
				errors.push('First parameter was a DOM element (or its id) that was not a form');
				return errors;
			}
		}
		/***** END check for submit being called with a form as the first parameter *****/
		
		// Check that client info was passed in
		if (typeof clientInfo !== 'object') {
			errors.push('No client info');
			return errors;
		}
		
		// Check for an rb being passed in with the clientInfo
		if (typeof clientInfo['rb'] === 'string') {
			thatDemo.setRB(clientInfo['rb']);
			delete clientInfo['rb'];
		}
		
		// Check from a broken RB
		if (!_settings.rb) {
			errors.push('No RB defined');
		} else {
			var db = _dbLookup(_settings.rb);
			if (!db) { errors.push('No DB set for this RB'); }
		}
		
		// Check for a hardcoded campaign
		if (typeof clientInfo['cmp'] !== 'undefined') {
			thatDemo.setCampaign(clientInfo['cmp']);
			delete clientInfo['cmp'];
		} else if (typeof clientInfo['CAMPAIGN_ID'] !== 'undefined') {
			thatDemo.setCampaign(clientInfo['CAMPAIGN_ID']);
			delete clientInfo['CAMPAIGN_ID'];
		} else if (typeof clientInfo['campaign'] !== 'undefined') {
			thatDemo.setCampaign(clientInfo['campaign']);
			delete clientInfo['campaign'];
		}
		
		// Check for a hardcoded elqFormName implying that the Eloqua form should be coregistered
		if (typeof clientInfo['elqFormName'] !== 'undefined') {
			thatDemo.addEloquaSubmissionTarget(clientInfo['elqFormName']);
			delete clientInfo['elqFormName'];
		}
		
		// Validate clientInfo
		for (var field in _demoFieldMap) {
			if (typeof clientInfo[field] !== 'undefined') {
				if (!_demoFieldMap[field].validation.call(this, clientInfo[field])) {
					errors.push('Invalid ' + _demoFieldMap[field].humanName);
				}
			} else if (_demoFieldMap[field].required) {
				errors.push('Missing ' + _demoFieldMap[field].humanName);
			}
		}
		
		if (errors.length > 0) { return errors; }
		
		var returnValue = _submitRequests(db, clientInfo, callback);
		
		return returnValue;
	};

	function _dbLookup(rb) {
		if (typeof rb === 'undefined') { rb = _settings.rb; }
		if (typeof rb !== 'string' || typeof _demoRBMap[rb] !== 'object') { return false; }
		
		return _demoRBMap[rb].db || false;
	}
	
	function _submitRequests(db, clientInfo, callback) {
		if (typeof _settings.submissionTarget !== 'string') {	// The FXTR Status Check hasn't returned nor timed out, so queue requests
			_requestsQueue.push(function() { return _submitRequests(db, clientInfo, callback); });
			
			return true;
		} else {
			var returnValue = false;
			
			while (_requestsQueue.length > 0) {	// Earlier requests were queued while waiting for the FXTR Status Check
				returnValue = _requestsQueue.shift().call(this);
			}
			
			if (typeof db === 'undefined') {	// This invocation was only intended to submit the requests in the queue
				return returnValue;
			}
			
			// Submit requests
			if (typeof fxcmdebug === 'object' && typeof fxcmdebug.demo === 'object' && typeof fxcmdebug.demo.submissionTarget === 'string') {	// We're in debug mode
				var submissionTarget = fxcmdebug.demo.submissionTarget;
			} else {	// Production use case
				var submissionTarget = _settings.submissionTarget;
			}
			
			if (submissionTarget === 'fxtr') {
				var returnValue = _submitToFXTR(db, clientInfo, callback);
			} else {
				var returnValue = _submitToEloqua(db, clientInfo, callback);
			}
			
			if (returnValue) {
				_submitToAdditionalTargets(clientInfo);
				
				// Fire off relevant tracking requests
				if (typeof fxcmsc === 'object' && typeof fxcmsc.recordDemo === 'function') {
					fxcmsc.recordDemo(_settings.rb);
				}
			}
			
			return returnValue;
		}
	}
	
	function _submitToFXTR(db, clientInfo, callback) {
		// Build the request URL base
		var requestURL = [thatDemo.FXTRSubmissionURL, '&rb=', _settings.rb, '&DB=', db];
		
		// Add clientInfo parameters
		for (var field in _demoFieldMap) {
			if (typeof clientInfo[field] !== 'undefined' && typeof _demoFieldMap[field].fxtrName === 'string') {
				requestURL.push('&demo.', _demoFieldMap[field].fxtrName, '=', clientInfo[field]);
			}
		}
		
		// Add the campaign
		if (typeof _settings.campaign === 'string') {
			requestURL.push('&cmp=', _settings.campaign, '&tid=', thatDemo.generateTransactionID());
		}
		
		// Add the form name
		if (typeof _settings.formName === 'string' && _settings.formName !== '') {
			requestURL.push('&coReg=', _settings.formName);
		}
		
		// Setup the callback
		var callbackName = thatNamespace.lib.generateFunctionName(thatNamespace.lib.generateNumericID());
		window[callbackName] = callback || _FXTRCallback;
		requestURL.push('&callback=', callbackName);
		
		// Submit the request
		thatNamespace.lib.getScript(requestURL.join(''));
		
		return true;
	}
	
	function _FXTRCallback(data) {
		if (data.errors.length === 0) {
			if (typeof _settings.successCallback === 'function') {
				_settings.successCallback.call(this, data.username, data.password);
			}
			
			return true;
		} else {
			if (typeof _settings.errorCallback === 'function') {
				_settings.errorCallback.call(this, data.errors);
			}
			
			return false;
		}
	}
	
	function _submitToEloqua(db, clientInfo, callback) {
		var eloquaFormName = _eloquaFormLookup(_settings.rb);
		if (!eloquaFormName) { return false; }
		
		// Build the submitData object
		var submitData = {};
		for (var field in _demoFieldMap) {
			if (typeof clientInfo[field] !== 'undefined' && typeof _demoFieldMap[field].eloquaName === 'string') {
				switch(field) {
					case 'address':
						var fieldValue = clientInfo[field] + ' ' + (typeof clientInfo['address2'] === 'string' ? clientInfo['address2'] : '');
						break;
					
					case 'emailSignup':
						var fieldValue = clientInfo[field] === 'yes' ? 'Y' : 'N';
						break;
						
					default:
						var fieldValue = clientInfo[field];
						break;
				}
				submitData[_demoFieldMap[field].eloquaName] = fieldValue;
			} else if (field === 'emailSignup') {
				// Eloqua requires that we pass N if the box was unchecked, but unchecked boxes aren't passed at all by default, so we add it if it was missing
				submitData[_demoFieldMap[field].eloquaName] = 'N';
			}
		}
		
		// Add the campaign
		if (typeof _settings.campaign === 'string') {
			submitData['CAMPAIGN_ID'] = _settings.campaign;
		}
		
		// Add the form name
		if (typeof _settings.formName === 'string') {
			submitData['CoReg'] = _settings.formName;
		}
		
		// Submit the request
		var eloquaRequest = new thatNamespace.Eloqua;
		eloquaRequest.setFormName(eloquaFormName);
		return eloquaRequest.submit(submitData, callback || _eloquaCallback);
	}
	
	function _eloquaFormLookup(rb) {
		if (typeof rb === 'undefined') { rb = _settings.rb; }
		if (typeof rb !== 'string' || typeof _demoRBMap[rb] !== 'object') { return false; }
		
		return _demoRBMap[rb].eloquaFormName || false;
	}
	
	function _eloquaCallback() {
		if (typeof _settings.successCallback === 'function') {
			_settings.successCallback.call(this);
		}
		
		return true;
	}
	
	function _submitToAdditionalTargets(clientInfo) {
		var submissionFunctions = {
				get: thatNamespace.lib.getURL,
				JSONP: thatNamespace.lib.getScript
			};
		
		for (var targetType in _settings.submissionTargets) {
			for (var targetIndex = 0; targetIndex < _settings.submissionTargets[targetType].length; targetIndex++) {
				var submissionTarget = _settings.submissionTargets[targetType][targetIndex];
				
				var submissionData = {};
				for (var field in clientInfo) {
					// Map field values
					if (typeof submissionTarget.valueMap === 'object' && typeof submissionTarget.valueMap[field] === 'object' && typeof submissionTarget.valueMap[field][clientInfo[field]] !== 'undefined') {
						clientInfo[field] = submissionTarget.valueMap[field][clientInfo[field]];
					}
					
					// Map field names
					if (typeof submissionTarget.fieldMap === 'object' && typeof submissionTarget.fieldMap[field] === 'string') {
						submissionData[submissionTarget.fieldMap[field]] = clientInfo[field];
					} else if (targetType === 'eloqua' && typeof _demoFieldMap[field] === 'object' && typeof _demoFieldMap[field].eloquaName === 'string') {
						submissionData[_demoFieldMap[field].eloquaName] = clientInfo[field];
					} else {
						submissionData[field] = clientInfo[field];
					}
				}
				
				if (typeof submissionTarget.additionalData === 'object') {
					for (var field in submissionTarget.additionalData) {
						submissionData[field] = submissionTarget.additionalData[field];
					}
				}
				
				if (targetType === 'eloqua') {
					var eloquaSubmission = new thatNamespace.Eloqua();
					eloquaSubmission.setFormName(submissionTarget.formName);
					eloquaSubmission.submit(submissionData, submissionTarget.callback);
				} else if (targetType === 'get' || targetType === 'JSONP') {
					var submissionURL = [submissionTarget.target];
					if (submissionTarget.target.indexOf('?') === -1) {
						submissionURL.push('?');
					}
					
					for (var field in submissionData) {
						submissionURL.push('&', field, '=', submissionData[field]);
					}
					
					submissionFunctions[targetType].call(this, submissionURL.join(''), submissionTarget.callback);
				} else if (targetType === 'post') {
					thatNamespace.lib.ajaxPost(submissionTarget.target, submissionData, submissionTarget.callback);
				}
			}
		}
		
		return true;
	}
	
	function _defaultSuccessCallback(username, password) {
		/*
		if (typeof username === 'string' && typeof password === 'string') {
			console.log('user: ' + username + "\npass: " + password);
		} else {
			console.log('Successful non-FXTR submission!');
		}
		*/
	}
	
	function _defaultErrorCallback(errors) {
		//console.log(errors);
	}
	
	
	this.iframeLoad = function(iframe, layout) {
		// Fallback to default iframe id
		if (typeof iframe === 'undefined') {
			iframe = 'demo_reg';
		}
		
		// Dereference an id
		if (typeof iframe === 'string') {
			iframe = document.getElementById(iframe);
		}
		
		// Check that iframe is actually an iFrame
		if (!(thatNamespace.lib.isDOMElement(iframe) && iframe.tagName === 'IFRAME')) {
			return false;
		}
		
		// Check that the rb has been set
		if (!_settings.rb) { return false; }
		
		// Check that the db is in our list
		var db = _dbLookup(_settings.rb);
		if (!db) { return false; }
		
		var iframeURL = [thatDemo.FXTRiframeURL, '?ib=', _settings.rb, '&DB=', db];
		
		if (typeof layout === 'string') {
			iframeURL.push('&layout=', layout);
		}
		
		var sessionID = thatNamespace.lib.getURLParameter('jsessionid') || thatNamespace.lib.readCookie('JSESSIONID');
		var transactionID = thatNamespace.lib.getURLParameter('tid') || thatNamespace.lib.readCookie('tid') || thatDemo.generateTransactionID(sessionID);
		iframeURL.push('&tid=', transactionID);

		// Add the Campaign ID
		if (typeof _settings.campaign === 'string') {
			iframeURL.push('&cmp=', _settings.campaign);
		}

		var keyword = thatNamespace.lib.getURLParameter('keyword') || thatNamespace.lib.readCookie('keyword');
		if (keyword) {
			iframeURL.push('&keyword=', keyword);
		}

		iframe.src = iframeURL.join('');
	};
	
	// Constructor logic
	thatDemo.checkFXTRStatus();
	thatDemo.setRB(rb) || thatDemo.setCountryAccountType('united_kingdom', 'ts');
	thatDemo.setSuccessCallback(successCallback || _defaultSuccessCallback);
	thatDemo.setErrorCallback(_defaultErrorCallback);
	thatDemo.setCampaign(_getCampaign());
	thatDemo.bind(form);
}

this.Demo.prototype.FXTRStatusURL = (document.location.protocol.substring(0,4) === 'http' ? '' : 'https:') + '//static.fxcm.co.uk/status/fxtr.php';
this.Demo.prototype.FXTRSubmissionURL = 'https://secure4.fxcorporate.com/tr-demo/form/service/?format=jsonp';
this.Demo.prototype.FXTRiframeURL = 'https://secure4.fxcorporate.com/fxtr/demo';

this.Demo.prototype.generateTransactionID = function(sessionID) {
	if (typeof sessionID === 'number') { sessionID = String(sessionID); }
	
	if (typeof sessionID !== 'string') {
		var suffixLength = 17;
		sessionID = thatNamespace.lib.padLeft(thatNamespace.lib.generateNumericID(suffixLength), '0', suffixLength);
	}

	var now = new Date();
	var transactionID = [thatNamespace.lib.padLeft(now.getFullYear() % 100, '0', 2),
		thatNamespace.lib.padLeft(now.getMonth() + 1, '0', 2),
		thatNamespace.lib.padLeft(now.getDate(), '0', 2),
		'_',
		sessionID];
	
	return transactionID.join('');
};

this.Demo.prototype.isValidName = function(name) {
	return typeof name === 'string' && name.length <= 50;
};

this.Demo.prototype.isValidEmail = function(email) {
	return thatNamespace.lib.isValidEmail(email) && email.length <= 50;
};

var _demoPhoneRegEx = /^[+()_,.:a-zA-Z\-=0-9*]{0,20}$/i;
this.Demo.prototype.isValidPhone = function(phone) {
	return typeof phone === 'string' && (phone === '' || _demoPhoneRegEx.test(phone)) && phone.length <= 20;
};

var _demoIMNetworks = ['', 'aol', 'yahoo', 'icq', 'msn', 'other'];
this.Demo.prototype.isValidIMNetwork = function(imNetwork) {
	return typeof imNetwork === 'string' && _demoIMNetworks.indexOf(imNetwork) >= 0;
};

this.Demo.prototype.isValidIMID = function(imID) {
	return typeof imID === 'string' && imID.length <= 255;
};

this.Demo.prototype.isValidStreet = function(street) {
	return typeof street === 'string' && street.length <= 50;
};

this.Demo.prototype.isValidAddress2 = function(address) {
	return typeof address === 'string' && address.length <= 255;
};

this.Demo.prototype.isValidCity = function(city) {
	return typeof city === 'string' && city.length <= 50;
};

this.Demo.prototype.isValidState = function(state) {
	return typeof state === 'string' && state.length <= 50;
};

this.Demo.prototype.isValidZip = function(zip) {
	return (typeof zip === 'string' || typeof zip === 'number') && String(zip).length <= 10;
};

var _demoCountryRegEx = /^[a-z_]*$/;
this.Demo.prototype.isValidCountry = function(country) {
	// We don't include the white list here for forward-compatibility.  The only assumption is that all countries will continue to be lower case with _'s in place of spaces.
	return typeof country === 'string' && _demoCountryRegEx.test(country);
};

this.Demo.prototype.isValidCompany = function(company) {
	return typeof company === 'string' && company.length <= 255;
};

var _demoLanguages = ['', 'English', 'Traditional_Chinese', 'Simplified_Chinese', 'Bahasa_Malayu', 'Korean', 'Japanese', 'Vietnamese', 'Thai', 'Tagalog'];
this.Demo.prototype.isValidLanguage = function(language) {
	return typeof language === 'string' && _demoLanguages.indexOf(language) >= 0;
};

var _demoAccountTypes = ['', 'individual', 'joint', 'corporate', 'partnership', 'trust'];
this.Demo.prototype.isValidAccountType = function(accountType) {
	return typeof accountType === 'string' && _demoAccountTypes.indexOf(accountType) >= 0;
};

var _demoBalanceRegEx = /^\d{0,13}(\.\d{0,2})?$/;
this.Demo.prototype.isValidBalance = function(balance) {
	return _demoBalanceRegEx.test(balance);
};

var _demoAccountsRegEx = /^\d{1,4}$/;
this.Demo.prototype.isValidAccounts = function(accounts) {
	return _demoAccountsRegEx.test(accounts) && accounts > 0;
};

var _demoMargins = ['', '0', 'less50000', '50000_100000', 'more100000'];
this.Demo.prototype.isValidMargin = function(margin) {
	return typeof margin === 'string' && _demoMargins.indexOf(margin) >= 0;
};

var _demoDeposits = ['', '5000_24999', '25000_49999', '50000_99999', '100000_inf'];
this.Demo.prototype.isValidDeposit = function(deposit) {
	return typeof deposit === 'string' && _demoDeposits.indexOf(deposit) >= 0;
};

var _demoTraderTypes = ['', 'individual_investor', 'high_volume_trader', 'manager', 'ib_regulated_introducing_broker', 'ib_service_provider'];
this.Demo.prototype.isValidTraderType = function(traderType) {
	return typeof traderType === 'string' && _demoTraderTypes.indexOf(traderType) >= 0;
};

var _demoYearsForexExperience = ['0', '1', '2', '3', '4', '5+'];
this.Demo.prototype.isValidForexExperience = function(forexExperience) {
	return typeof forexExperience === 'string' && (forexExperience === '' || _demoYearsForexExperience.indexOf(forexExperience) >=0);
};

var _demoYearsEquitiesExperience = ['0', '1', '2', '3', '4', '5+'];
this.Demo.prototype.isValidEquitiesExperience = function(equitiesExperience) {
	return typeof equitiesExperience === 'string' && (equitiesExperience === '' || _demoYearsEquitiesExperience.indexOf(equitiesExperience) >=0);
};

var _demoYearsFuturesExperience = ['0', '1', '2', '3', '4', '5+'];
this.Demo.prototype.isValidFuturesExperience = function(futuresExperience) {
	return typeof futuresExperience === 'string' && (futuresExperience === '' || _demoYearsFuturesExperience.indexOf(futuresExperience) >=0);
};

var _demoExperienceLevels = ['', 'Novice', 'Intermediate', 'Expert'];
this.Demo.prototype.isValidExperienceLevel = function(experienceLevel) {
	return typeof experienceLevel === 'string' && _demoExperienceLevels.indexOf(experienceLevel) >= 0;
};

var _demoTradingFrequencies = ['', 'Never', 'Daily', 'Weekly', 'Occasionally'];
this.Demo.prototype.isValidTradingFrequency = function(tradingFrequency) {
	return typeof tradingFrequency === 'string' && _demoTradingFrequencies.indexOf(tradingFrequency) >= 0;
};

this.Demo.prototype.isValidReference = function(reference) {
	return typeof reference === 'string' && reference.length <= 255;
};

this.Demo.prototype.isValidPreviousSignup = function(previousSignup) {
	return previousSignup === 'yes' || previousSignup === 'no';
};

this.Demo.prototype.isValidFreeProduct = function(freeProduct) {
	return freeProduct === 'yes' || freeProduct === 'no';
};

this.Demo.prototype.isValidEmailSignup = function(emailSignup) {
	return emailSignup === 'yes' || emailSignup === 'no';
};

var _demoFieldMap = {
	firstName: {
		fxtrName: 'firstname',
		eloquaName: 'FNAME',
		validation: thatNamespace.Demo.prototype.isValidName,
		humanName: 'first name',
		required: false
	},
	lastName: {
		fxtrName: 'lastname',
		eloquaName: 'LNAME',
		validation: thatNamespace.Demo.prototype.isValidName,
		humanName: 'last name',
		required: true
	},
	email: {
		fxtrName: 'email_address',
		eloquaName: 'EMAIL',
		validation: thatNamespace.Demo.prototype.isValidEmail,
		humanName: 'e-mail address',
		required: true
	},
	phone: {
		fxtrName: 'phone',
		eloquaName: 'PHONE',
		validation: thatNamespace.Demo.prototype.isValidPhone,
		humanName: 'phone number',
		required: false
	},
	phone2: {
		fxtrName: 'alternative_phone',
		validation: thatNamespace.Demo.prototype.isValidPhone,
		humanName: 'alternative phone number',
		required: false
	},
	imNetwork: {
		fxtrName: 'im_provider',
		validation: thatNamespace.Demo.prototype.isValidIMNetwork,
		humanName: 'IM network',
		required: false
	},
	imID: {
		fxtrName: 'im_id',
		validation: thatNamespace.Demo.prototype.isValidIMID,
		humanName: 'IM screen name',
		required: false
	},
	street: {
		fxtrName: 'residential_address',
		eloquaName: 'address',
		validation: thatNamespace.Demo.prototype.isValidStreet,
		humanName: 'street',
		required: false
	},
	address2: {
		fxtrName: 'address_misc',
		validation: thatNamespace.Demo.prototype.isValidAddress2,
		humanName: 'address 2',
		required: false
	},
	city: {
		fxtrName: 'city',
		eloquaName: 'city',
		validation: thatNamespace.Demo.prototype.isValidCity,
		humanName: 'city',
		required: false
	},
	state: {
		fxtrName: 'state_province',
		eloquaName: 'state',
		validation: thatNamespace.Demo.prototype.isValidState,
		humanName: 'state/province',
		required: false
	},
	zip: {
		fxtrName: 'zip_postal_code',
		eloquaName: 'zip',
		validation: thatNamespace.Demo.prototype.isValidZip,
		humanName: 'zip code',
		required: false
	},
	country: {
		fxtrName: 'country',
		eloquaName: 'COUNTRY',
		validation: thatNamespace.Demo.prototype.isValidCountry,
		humanName: 'country',
		required: true
	},
	company: {
		fxtrName: 'company_name',
		validation: thatNamespace.Demo.prototype.isValidCompany,
		humanName: 'company',
		required: false
	},
	language: {
		fxtrName: 'preferred_language',
		validation: thatNamespace.Demo.prototype.isValidLanguage,
		humanName: 'language',
		required: false
	},
	accountType: {
		fxtrName: 'desired_account_type',
		validation: thatNamespace.Demo.prototype.isValidAccountType,
		humanName: 'account type',
		required: false
	},
	balance: {
		fxtrName: 'initial_balance',
		validation: thatNamespace.Demo.prototype.isValidBalance,
		humanName: 'account balance',
		required: false
	},
	accounts: {
		fxtrName: 'number_accounts',
		validation: thatNamespace.Demo.prototype.isValidAccounts,
		humanName: 'number of accounts',
		required: false
	},
	margin: {
		fxtrName: 'expect_margin',
		validation: thatNamespace.Demo.prototype.isValidMargin,
		humanName: 'margin',
		required: false
	},
	deposit: {
		fxtrName: 'intended_amount',
		validation: thatNamespace.Demo.prototype.isValidDeposit,
		humanName: 'initial deposit',
		required: false
	},
	traderType: {
		fxtrName: 'which_describes_you',
		validation: thatNamespace.Demo.prototype.isValidTraderType,
		humanName: 'trader type',
		required: false
	},
	forexExperience: {
		fxtrName: 'trading_experiance_forex',	// Misspelled within the web service
		validation: thatNamespace.Demo.prototype.isValidForexExperience,
		humanName: 'years of forex trading experience',
		required: false
	},
	equitiesExperience: {
		fxtrName: 'trading_experiance_equities',	// Misspelled within the web service
		validation: thatNamespace.Demo.prototype.isValidEquitiesExperience,
		humanName: 'years of equities trading experience',
		required: false
	},
	futuresExperience: {
		fxtrName: 'trading_experiance_futures',	// Misspelled within the web service
		validation: thatNamespace.Demo.prototype.isValidFuturesExperience,
		humanName: 'years of futures trading experience',
		required: false
	},
	experienceLevel: {
		fxtrName: 'trading_experiance',	// Misspelled within the web service
		validation: thatNamespace.Demo.prototype.isValidExperienceLevel,
		humanName: 'forex trading experience level',
		required: false
	},
	tradingFrequency: {
		fxtrName: 'trading_frequency',
		validation: thatNamespace.Demo.prototype.isValidTradingFrequency,
		humanName: 'trading frequency',
		required: false
	},
	reference: {
		fxtrName: 'where_did_you_hear',
		validation: thatNamespace.Demo.prototype.isValidReference,
		humanName: 'reference',
		required: false
	},
	previousSignup: {
		fxtrName: 'previously_signed_up',
		validation: thatNamespace.Demo.prototype.isValidPreviousSignup,
		humanName: 'status of previous signup',
		required: false
	},
	freeProduct: {
		fxtrName: 'send_me_free_product',
		validation: thatNamespace.Demo.prototype.isValidFreeProduct,
		humanName: 'free product opt-in',
		required: false
	},
	emailSignup: {
		fxtrName: 'email_me_training_material',
		eloquaName: 'PROD_INFO_MKT',
		validation: thatNamespace.Demo.prototype.isValidEmailSignup,
		humanName: 'email opt-in',
		required: false
	}
};

var _demoRBMap = {
	fxcm: { db: 'PremiumDemo',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	active_trader: { db: 'XTPDEMO01',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	tsg_llc: { db: 'XTPDEMO01',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	strategy_trader_llc: { db: 'U100D1',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	cnbc_10k_llc: { db: 'PremiumDemo',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	fxcmau: { db: 'AUDMINIDEMO',
			eloquaFormName: 'FXCMDEMOFXCMAUMaintenance' },
	cnbc_10k_au: { db: 'AUDMINIDEMO',
			eloquaFormName: 'FXCMDEMOFXCMAUMaintenance' },
	fxcmuk: { db: 'U100D1',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	cnbc_10k_ltd: { db: 'U100D1',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	'fxcm-french': { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	'fxcm-german': { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	fxcm_italy: { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	fx_greece: { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	godmodetradercontest: { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	canada: { db: 'U10D2',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	fxcmgbp_spread_betting: { db: 'GBDEMO',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	etradefx: { db: 'MINIDEMO7',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	fmcm_sp: { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	mt4: { db: 'MT4USDDEMO',
			eloquaFormName: 'FXCMDEMO100KMaintenance' },
	fxcmuk_bt: { db: 'MT4GBPDEMO',
			eloquaFormName: 'FXCMDEMOUKEURMaintenance' },
	fxcmau_bt: { db: 'EUDEMO',
			eloquaFormName: 'FXCMDEMOFXCMAUMaintenance' }		
};
_demoRBMap['fxcm-italy'] = _demoRBMap.fxcm_italy;
_demoRBMap.fxcmuk_french = _demoRBMap['fxcm-french'];


// Requires jQuery

this.internal = new function() {
	var thatInternal = this;
	
	/* Concatenates all functions that are passed in and appends all strings as html within a div to the body
	Usage:
	
	var trackingFunction = fxcm.internal.trackingFactory(someFunction, '<img src="trackingPixel" />', trackingRelatedFunction);
	...
	trackingFunction();
	*/
	this.trackingFactory = function() {
		var outterArguments = arguments;
		
		return function() {
			for (var argumentIndex = 0; argumentIndex < outterArguments.length; argumentIndex++) {
				var outterArgument = outterArguments[argumentIndex];
				if (typeof outterArgument === 'string') {
					var trackingDiv = document.createElement('div');
					trackingDiv.innerHTML = outterArgument;
					trackingDiv.setAttribute('style', 'display: none');
					document.body.appendChild(trackingDiv);
				} else if (typeof outterArgument === 'function') {
					outterArgument.apply(this, arguments);
				}
			}
		};
	};
	
	// Generalized function for jQuery submitHandlers that redirect the user after form submission
	function _AJAXFormRedirectValidatorSubmitHandlerFactory(continuationFunction, redirectURL, id) {
		if (typeof redirectURL !== 'string') { return null; }

		var callback = function() { document.location.href = redirectURL; };
		
		var continuationArguments = thatNamespace.lib.shiftArray(arguments, 2);
		continuationArguments.unshift(callback);
		
		return continuationFunction.apply(this, continuationArguments);
	}
	
	/* Generalized function for creating jQuery Validator submitHandlers
	Class is the conversion type's class (fxcm.Eloqua or fxcm.Demo)
	callback is the callback function on success
	idSetter is the function for setting the conversion's id ('setFormName' or 'setRB')
	id is the conversion's id (the formName or the RB) */
	function _AJAXFormValidatorSubmitHandlerFactory(Class, successCallbackSetter, successCallback, idSetter, id) {
		var outterArguments = arguments;
		
		return function(form) {
				$(form).find('input[type=submit], input[type=button], input[type=image]').attr({disabled: true});	// Disable the form to prevent multiple submissions
				
				var conversion = new Class();
				
				if (typeof id === 'string') {
					conversion[idSetter].apply(this, thatNamespace.lib.shiftArray(outterArguments, 4));	// Remove all arguments before id
				}
				
				if (typeof successCallback === 'string') {	// Generic Eloqua
					var internalCallback = function() {
							var confBox = $('<div class="confBox" style="display:block">' + successCallback + '</div>')
							_copyClasses(form, confBox, '_conf');
							$(form).closest('.formBox').replaceWith(confBox);
						};
				} else if (typeof successCallback === 'object') {	// Generic Demo
					var internalCallback = function(username, password) {
							if (typeof username === 'string' && typeof password === 'string')  {
								var confText = successCallback.fxtr;
								confText = confText.replace('%username%', username).replace('%password%', password)
							} else {
								var confText = successCallback.eloqua;
							}
							var confBox = $('<div class="confBox" style="display:block">' + confText + '</div>');
							_copyClasses(form, confBox, '_conf');
							$(form).closest('.formBox').replaceWith(confBox);
						};
				} else if (typeof successCallback === 'function') {	// Non-generic
					var internalCallback = function() {
							Array.prototype.unshift.call(arguments, form);
							successCallback.apply(this, arguments);
						};
				} else {
					var internalCallback = function() {};
				}
				
				conversion[successCallbackSetter].call(this, internalCallback);
				conversion.submit(form);
			};
	}
	
	// Copies the classes from source to destination, optionally adding suffix
	function _copyClasses(source, destination, suffix) {
		if (typeof suffix !== 'string') { suffix = ''; }
		
		var classes = $(source).attr('class').split(' ');
		destination = $(destination);
		for (var classIndex = 0; classIndex < classes.length; classIndex++) {
			destination.addClass(classes[classIndex] + suffix);
		}
	}
	
	/********************* BEGIN Demo submitHandlers ****************/
	/* How to setup the jQuery Validate submitHandler for Demo forms

	Show the on-page confBox:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.confBoxDemoValidatorSubmitHandler;

	Show the generic Thank You text:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.genericDemoValidatorSubmitHandler;

	Custom callback function:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoValidatorSubmitHandlerFactory(yourFunction, optionalRB);

	Custom confirmation text:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoValidatorSubmitHandlerFactory('confirmationText', optionalRB);
	
	Redirect:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoRedirectValidatorSubmitHandlerFactory('redirectURL', optionalRB);
	
	Do nothing after submission:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoValidatorSubmitHandlerFactory();
	
	Show the on-page confBox with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.confBoxCountryDemoValidatorSubmitHandler;

	Show the generic Thank You text with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.genericCountryDemoValidatorSubmitHandler;
	
	Custom callback function with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoCountryValidatorSubmitHandlerFactory(yourFunction);

	Custom confirmation text with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoCountryValidatorSubmitHandlerFactory('confirmationText');
	
	Redirect with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoCountryRedirectValidatorSubmitHandlerFactory('redirectURL');
	
	Do nothing after submission with the selected country determining the RB:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.demoCountryValidatorSubmitHandlerFactory();
	
	Custom tracking on form submission:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.trackingFactory(fxcm.internal.confBoxDemoValidatorSubmitHandler, '<img src="trackingPixel" />', otherTrackingFunction); */
	


	/* Produces a submitHandler function for jQuery Validator on Demo forms
	The rb field can be left off the form if desired and instead passed in as the second parameter to demoValidatorSubmitHandlerFactory
	Usage:
	callback is not passed in (undefined): The form submits and no UI changes are made
	callback is a function: Invokes the callback after the form submits
	callback is text: Replaces the form with a confBox containing the text after the form submits */
	this.demoCountryRedirectValidatorSubmitHandlerFactory = function(redirectURL) {
		return _AJAXFormRedirectValidatorSubmitHandlerFactory(thatInternal.demoCountryValidatorSubmitHandlerFactory, redirectURL);
	}
	
	this.demoCountryValidatorSubmitHandlerFactory = function(callback) {
		return function(form) {
			var handler = _AJAXFormValidatorSubmitHandlerFactory(thatNamespace.Demo, 'setSuccessCallback', callback, 'setCountry', $(form).find('select[name=demo.country]').val());
			
			return handler(form);
		}
	}
	
	this.demoRedirectValidatorSubmitHandlerFactory = function(redirectURL, rb) {
		return _AJAXFormRedirectValidatorSubmitHandlerFactory(thatInternal.demoValidatorSubmitHandlerFactory, redirectURL, rb);
	}
	
	this.demoValidatorSubmitHandlerFactory = function(callback, rb) {
		return _AJAXFormValidatorSubmitHandlerFactory(thatNamespace.Demo, 'setSuccessCallback', callback, 'setRB', rb);
	}

	// Hides the demo form and shows the confirmation div
	this.showDemoConfBox = function(form, username, password) {
		var formParent = $(form).closest(".formBox");
		var confParent = formParent.next('.confBox');
		formParent.hide();
		
		if (typeof username === 'string' && typeof password === 'string') {	// FXTR signup
			confParent.find('.success').find('span.demoUsername').text(username);
			confParent.find('.success').find('span.demoPassword').text(password);
			confParent.find('.success').show();
		} else {	// Maintenance signup
			confParent.find('.maint').show();
		}
		confParent.fadeIn(100);
	};

	// Shows the confBox that already exists on the page after the form submits
	this.confBoxDemoValidatorSubmitHandler = thatInternal.demoValidatorSubmitHandlerFactory(thatInternal.showDemoConfBox);
	this.confBoxCountryDemoValidatorSubmitHandler = thatInternal.demoCountryValidatorSubmitHandlerFactory(thatInternal.showDemoConfBox);
	
	// Replaces the form with generic Thank You text after the form submits
	var _genericFXTRConfText = {
									fxtr:'<h3>Congratulations</h3> <p>You have successfully signed up for a demo account. Your username and password are below:</p> <p><strong>Username:</strong> %username% <br /> <strong>Password:</strong> %password%</p>',
									eloqua:'<h3>Thank you</h3> <p>Our demo registration is currently unavailable due to routine weekend maintenance. When the system again becomes available, a representative will send your demo account login information to the e-mail address you provided.</p>'
								};
	this.genericDemoValidatorSubmitHandler = thatInternal.demoValidatorSubmitHandlerFactory(_genericFXTRConfText);
	this.genericCountryDemoValidatorSubmitHandler = thatInternal.demoCountryValidatorSubmitHandlerFactory(_genericFXTRConfText);
	/********************** END Demo submitHandlers *****************/
	
	
	/********************* BEGIN Eloqua submitHandlers ****************/
	/*How to setup the jQuery Validate submitHandler for Eloqua forms
	Show the on-page confBox:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.confBoxEloquaValidatorSubmitHandler;

	Show the generic Thank You text:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.genericEloquaValidatorSubmitHandler;

	Custom callback function:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.eloquaValidatorSubmitHandlerFactory(yourFunction);

	Custom confirmation text:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.eloquaValidatorSubmitHandlerFactory('confirmationText');
	
	Redirect:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.eloquaRedirectValidatorSubmitHandlerFactory('redirectURL');

	Do nothing after submission:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.eloquaValidatorSubmitHandlerFactory();
	
	Custom tracking on form submission:
	jQuery.validator.standardValidationOptions.submitHandler = fxcm.internal.trackingFactory(fxcm.internal.confBoxEloquaValidatorSubmitHandler, '<img src="trackingPixel" />', otherTrackingFunction); */
	


	/* Produces a submitHandler function for jQuery Validator on Eloqua forms
	The elqFormName field can be left off the form if desired and instead passed in as the second parameter to eloquaValidatorSubmitHandlerFactory
	Usage:
	callback is not passed in (undefined): The form submits and no UI changes are made
	callback is a function: Invokes the callback after the form submits
	callback is text: Replaces the form with a confBox containing the text after the form submits */
	this.eloquaRedirectValidatorSubmitHandlerFactory = function(redirectURL, formName) {
		return _AJAXFormRedirectValidatorSubmitHandlerFactory(thatInternal.eloquaValidatorSubmitHandlerFactory, redirectURL, formName)
	}
	
	this.eloquaValidatorSubmitHandlerFactory = function(callback, formName) {
		return _AJAXFormValidatorSubmitHandlerFactory(thatNamespace.Eloqua, 'setCallback', callback, 'setFormName', formName);
	};
	
	// Hides the form and shows the confirmation div
	this.showEloquaConfBox = function(form) {
		var formParent = $(form).closest('.formBox');
		formParent.hide();
		formParent.next('.confBox').fadeIn(100); 
	};
	
	// Shows the confBox that already exists on the page after the form submits
	this.confBoxEloquaValidatorSubmitHandler = thatInternal.eloquaValidatorSubmitHandlerFactory(thatInternal.showEloquaConfBox);
	
	// Replaces the form with generic Thank You text after the form submits
	this.genericEloquaValidatorSubmitHandler = thatInternal.eloquaValidatorSubmitHandlerFactory('<h3>Thank you</h3> <p>Your information has been received and will be processed shortly.</p>');
	/********************** END Eloqua submitHandlers *****************/
	
	this.generateLivePersonProfile = function() {
		if (typeof jPersist === 'object') {
			for (var namespace in jPersist) {
				if (typeof jPersist[namespace] === 'object') {
					for (property in jPersist[namespace]) {
						lpAddVars('page', namespace + '_' + property, jPersist[namespace][property]);
					}
				}
			}
		}

		if (typeof redirectData === 'object') {
			lpAddVars('page', 'country', redirectData.country);
		}
	};
}();

}();

/* Douglas Crockford's json2.js, 2/23/11 Snapshot (minified via closure simple optimization)
Duck-punches the JSON global and toJSON functions into existence
Falls back to native implementations where available */
var JSON;JSON||(JSON={}); (function(){function k(a){return a<10?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,j){var c,d,h,m,g=e,f,b=j[a];b&&typeof b==="object"&&typeof b.toJSON==="function"&&(b=b.toJSON(a));typeof i==="function"&&(b=i.call(j,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);case "object":if(!b)return"null"; e+=n;f=[];if(Object.prototype.toString.apply(b)==="[object Array]"){m=b.length;for(c=0;c<m;c+=1)f[c]=l(c,b)||"null";h=f.length===0?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(i&&typeof i==="object"){m=i.length;for(c=0;c<m;c+=1)typeof i[c]==="string"&&(d=i[c],(h=l(d,b))&&f.push(o(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=l(d,b))&&f.push(o(d)+(e?": ":":")+h);h=f.length===0?"{}":e?"{\n"+e+f.join(",\n"+e)+"\n"+g+"}":"{"+f.join(",")+ "}";e=g;return h}}if(typeof Date.prototype.toJSON!=="function")Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()};var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,n,r={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;if(typeof JSON.stringify!=="function")JSON.stringify=function(a,j,c){var d;n=e="";if(typeof c==="number")for(d=0;d<c;d+=1)n+=" ";else typeof c==="string"&&(n=c);if((i=j)&&typeof j!=="function"&&(typeof j!=="object"||typeof j.length!=="number"))throw Error("JSON.stringify");return l("", {"":a})};if(typeof JSON.parse!=="function")JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&typeof b==="object")for(g in b)Object.prototype.hasOwnProperty.call(b,g)&&(f=c(b,g),f!==void 0?b[g]=f:delete b[g]);return e.call(a,d,b)}var d,a=String(a);q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return d=eval("("+a+")"),typeof e==="function"?c({"":d},""):d;throw new SyntaxError("JSON.parse");}})();

if (typeof jPersist === 'undefined') {
    var jPersist = new function() {
        var _settings = {};
        _settings.cookieLife = {};
        var _maxCookieLife = 1000*60*60*24 * 90;    // Track visitors for 90 days by default (most browsers enforce this cap on max cookie length, so set it for consistency)
        var _defaultVisitTimeout = 1000*60 * 30;    // Default visit timeout is 30 minutes from last page view

        this.setCookiePrefix = function(prefix) {
            if (typeof prefix !== 'string') { return false; }

            _settings.prefix = prefix;   // Allow illegal cookie characters because they'll be encoded by _writeCookie

            _load();

            return _settings.prefix;
        };

        this.getCookiePrefix = function() {
            return _settings.prefix;
        };

        this.setLifetime = function(namespace, lifetime) {
            if (typeof namespace !== 'string' || typeof lifetime !== 'number') { return false; }

            return _settings.cookieLife[namespace] = lifetime;
        };

        this.getLifetime = function(namespace) {
            if (typeof namespace !== 'string') { return false; }

            return _settings.cookieLife[namespace];
        };

		// TODO: Fix issue where setting a new cookie prefix after the old one has stored values will cause the new prefix to inherit the old values.
        function _load() {
            var allCookies = document.cookie.split('; ');
            for (var cookieIndex=0; cookieIndex < allCookies.length; cookieIndex++){
                var propertyComponents = allCookies[cookieIndex].match('^\\s*' + encodeURIComponent(_settings.prefix) + '(.+?)=(.+?)\\s*$');
                if (propertyComponents) {
                    if (propertyComponents[1] === '.cookieLife') {
                        _settings.cookieLife = JSON.parse(decodeURIComponent(propertyComponents[2]));
                    } else {
                        _thatjPersist[decodeURIComponent(propertyComponents[1])] = JSON.parse(decodeURIComponent(propertyComponents[2]));
                    }
                }
            }

            // Clear out expired objects' lifetime settings
            for (var memberName in _settings.cookieLife) {
                if (typeof _thatjPersist[memberName] === 'undefined') {
                    delete _settings.cookieLife[memberName];
                }
            }

            if (typeof _thatjPersist.visitor === 'undefined') {
                _thatjPersist.visitor = {};
                _thatjPersist.visitor.pageViews = 0;
                _thatjPersist.visitor.visits = 0;
                _thatjPersist.setLifetime('visitor', _maxCookieLife);
            }
            if (typeof _thatjPersist.visit === 'undefined') {
                _thatjPersist.visit = {};
                _thatjPersist.visit.pageViews = 0;
                _thatjPersist.setLifetime('visit', _defaultVisitTimeout);
            }

            return _thatjPersist.recordPageView();
        }

        this.recordPageView = function() {
            if (typeof _thatjPersist.visitor === 'object') {
                if (typeof _thatjPersist.visit === 'object' && _thatjPersist.visit.pageViews === 0) { // New Visit
                    _thatjPersist.visitor.visits++;
                }
                _thatjPersist.visitor.pageViews++;
            }
            if (typeof _thatjPersist.visit === 'object') {
                _thatjPersist.visit.pageViews++;
            }

            return _thatjPersist.save();
        }

        this.recordNewVisit = function() {
            if (typeof _thatjPersist.visit !== 'object') { _thatjPersist.visit = {}; }
            _thatjPersist.visit.pageViews = 0;

            if (typeof _settings.cookieLife.visit === 'undefined') {
                _settings.cookieLife.visit = _defaultVisitTimeout;
            }

            return _thatjPersist.recordPageView();
        }

        this.save = function() {
            // Store object namespaces as cookies
            var options = { expires: new Date() };
            var now = new Date().getTime();
            for (var memberName in _thatjPersist) {
                if (typeof _thatjPersist[memberName] !== 'function') {
                    var cookieName = _settings.prefix + memberName;
                    var cookieValue = JSON.stringify(_thatjPersist[memberName]);
                    options.expires.setTime(now + (_settings.cookieLife[memberName] || _settings.cookieLife.visitor || _maxCookieLife));    // Set expiration to this namespace's expiration if one has been set, otherwise fallback to visitor, then the max cookie life

                    _writeCookie(cookieName, cookieValue, options);
                }
            }

            // Store cookie lifetimes
            options.expires.setTime(now + (_settings.cookieLife.visitor || _maxCookieLife));
            _writeCookie(_settings.prefix + '.cookieLife', JSON.stringify(_settings.cookieLife), options);

            return true;
        };

        this.kill = function(namespace) {
            if (typeof namespace !== 'string' || namespace === 'visit' || namespace === 'visitor') { return false; }

            delete _thatjPersist[namespace];
            delete _settings.cookieLife[namespace];
            return _deleteCookie(_settings.prefix + namespace);
        };

        function _readCookie(name) {
            if (typeof fxcm === 'object' && typeof fxcm.lib === 'object' && typeof fxcm.lib.writeCookie === 'function') {
                return fxcm.lib.readCookie(name);
            } else {
                if (typeof name !== 'string') { return false; }

                var cookieParts = new RegExp('(?:^|; )' + encodeURIComponent(name) + '=([^;]*)').exec(document.cookie);
                return cookieParts ? decodeURIComponent(cookieParts[1]) : null;
            }
        }

        function _writeCookie(name, value, options) {
            if (typeof fxcm === 'object' && typeof fxcm.lib === 'object' && typeof fxcm.lib.writeCookie === 'function') {
                return fxcm.lib.writeCookie(name, value, options);
            } else {
                if (typeof name !== 'string') { return false; }

                switch (typeof value) {
                    case 'string':  // Ideal
                        break;

                    case 'undefined':   // Parameter wasn't passed, set a cookie with no value
                        value = '';
                        break;

                    case 'object':
                        if (value === null) {   // Treat null as an intention to set a cookie with no value
                            value = '';
                        } else {    // We could JSON.stringify all other objects, but then we need to duck punch JSON.stringify into older browsers, let the client app deal with that
                            return false;
                        }
                        break;

                    default:    // Cast other primitives to string
                        value = String(value);
                        break;
                }

                if (typeof options !== 'object') { options = {}; }

                return (document.cookie = [
                    encodeURIComponent(name) + '=' + (value !== '' ? encodeURIComponent(value) : ''),
                    options.expires instanceof Date ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
                    typeof options.path === 'string' ? '; path=' + options.path : '',
                    typeof options.domain === 'string' ? '; domain=' + options.domain : '',
                    typeof options.secure !== 'undefined' && options.secure ? '; secure' : ''
                ].join(''));
            }
        }

        function _deleteCookie(name, options) {
            if (typeof fxcm === 'object' && typeof fxcm.lib === 'object' && typeof fxcm.lib.deleteCookie === 'function') {
                return fxcm.lib.deleteCookie(name, options);
            } else {
                if (typeof options !== 'object') { options = {}; }

                options.expires = new Date(0);    // Set cookie expiration to epoch
                return _writeCookie(name, '', options) ? true : false;
            }
        }

        var _thatjPersist = this;
        _thatjPersist.setCookiePrefix('jp_');   // Triggers the load process
    }();
}
// Create Object for Custom Omniture Tracking
var sProperties = {};

// Generate Trackable Flowplayer Clip Object
function FlowplayerClip(configuration) {
	if (typeof configuration === 'undefined') {
		configuration = {};
	}

	// Track start event for this clip
	configuration.onStart = function(clip) {
		s.TrackingFunctions.mediaInit(clip.completeUrl,clip.fullDuration,this.getParent().id);
	};

	// Track pause event for this clip. time (in seconds) is also tracked
	configuration.onPause = function(clip) {
		s.TrackingFunctions.mediaPause(clip.completeUrl,parseInt(this.getTime()));
	};

	// Track Resume of player
	configuration.onResume = function(clip) {
		s.TrackingFunctions.mediaResume(clip.completeUrl,parseInt(this.getTime()));
	};

	// Track stop event for this clip. time is also tracked
	configuration.onStop = function(clip) {
		s.TrackingFunctions.mediaPause(clip.completeUrl,parseInt(this.getTime()));
	};

	// Track finish event for this clip
	configuration.onFinish = function(clip) {
		s.TrackingFunctions.mediaComplete(clip.completeUrl);
	};

	// Track FF or REV
	configuration.onSeek = function(clip) {
		s.TrackingFunctions.mediaSeek(clip.completeUrl,parseInt(this.getTime()));
	};

	return configuration;
}

// Retrieves a URL Query Parameter, null if it does not exist
function getURLParameter(ParameterName) {
	if (document.location.href.indexOf('?') > -1) {
		var URLParameters = document.location.href.substr(document.location.href.indexOf('?')+1);
		URLParameters = URLParameters.split('&');
		for (URLParameterIndex in URLParameters) {
			if (decodeURIComponent(URLParameters[URLParameterIndex].split('=')[0]).toUpperCase() == ParameterName.toUpperCase()) {
					return URLParameters[URLParameterIndex].split("=")[1];
				}
		}
	}
	return null;
}

// Reads a cookie (Taken from JQuery Cookie: https://github.com/carhartl/jquery-cookie  7/8/11 Snapshot)
function ReadCookie(cookieName) {
	return fxcm.lib.readCookie(cookieName);
}

// Retrieves the most recent Campaign ID checking the URL first, then the cookie
function GetCampaignID() {
	var CampaignID = getURLParameter('CMP');
	if (CampaignID == null) {
		var CampaignString;
		if (CampaignString = ReadCookie('s_cpm')) {
			eval('var CampaignArray = ' + CampaignString);
			CampaignID = CampaignArray[CampaignArray.length - 1][0];
		}
	}
	return (CampaignID == null ? '' : CampaignID); //Do not return null
}

// Generates TransactionIDs for use with FXCorporate in the format that their forms use
function GenerateTransactionID(SessionID) {
	if (typeof SessionID === 'undefined') {
		SessionID = GenerateNumericID(17);
	}

	var TransactionID = '';
	var DateObj = new Date();
	var TransactionIDSections = [DateObj.getFullYear() % 100, DateObj.getMonth() + 1, DateObj.getDate()];
	for (var Section = 0; Section < TransactionIDSections.length; Section++) {
		TransactionID += (TransactionIDSections[Section] < 10 ? '0' : '') + TransactionIDSections[Section];
	}
	TransactionID += '_' + SessionID;
	return TransactionID;
}

// Generates Locally Unique IDs (Length parameter is optional)
function GenerateNumericID(Length) {
	if (typeof Length === 'undefined') {
		Length = 20;	// Maximum length before the browser uses scientific notation
	}
	return Math.floor(Math.random() * Math.pow(10, Length));
}

// Adds tracking parameters to an iframed fxcorporate demo form tagged with id="demo_reg"
function iframeLoadGlobal(fxcorporateURL, iframeID) {
	var iframeURL = fxcorporateURL;

	var SessionID = getURLParameter('jsessionid');
	if (SessionID === null){
		SessionID = ReadCookie('JSESSIONID');
	}

	var TransactionID = getURLParameter('tid');
	if (TransactionID === null){
		TransactionID = ReadCookie('tid');
		if (TransactionID === null) {
			if (SessionID) {
				TransactionID = GenerateTransactionID(SessionID);
			} else {
				TransactionID = GenerateTransactionID();
			}
		}
	}
	iframeURL += '&tid=' + TransactionID;

	var LastCampaign = GetCampaignID();
	if (LastCampaign) {
		iframeURL += '&cmp=' + LastCampaign;
	}

	var Keyword = getURLParameter('keyword');
	if (Keyword === null){
		Keyword = ReadCookie('keyword');
	}
	if (Keyword) {
		iframeURL += '&keyword=' + Keyword;
	}

	document.getElementById(typeof iframeID !== 'undefined' ? iframeID : 'demo_reg').src = iframeURL;
}

// Turns a form into a custom demo form
function CustomDemoFormSetup(FormID, IB) {
	// Confirm that the form exists
	var Form = document.getElementById(FormID);
	if (!Form) { return false; }

	// Define values that are consistent across all forms
	var HiddenInputs = {
		rb: IB,
		IBNAME: IB,
		elqFormName: IB,
		elqSiteID: 202,
		tid: GenerateTransactionID()
	};

	// Define values that are specific to each form
	switch(IB.toLowerCase()) {
		case 'fxcm':
			HiddenInputs.DB = 'PremiumDemo';
			break;
		
		case 'active_trader':
			HiddenInputs.DB = 'XTPDEMO01';
			break;
			
		case 'tsg_llc':
			HiddenInputs.DB = 'XTPDEMO01';
			break;
			
		case 'strategy_trader_llc':
			HiddenInputs.DB = 'U100D1';
			break;

		case 'fxcmau':
			HiddenInputs.DB = 'AUDMINIDEMO';
			break;

		case 'fxcm-french':
			HiddenInputs.DB = 'EUDEMO';
			break;

		case 'fxcm-german':
			HiddenInputs.DB = 'EUDEMO';
			break;
			
		case 'fxcm-italy':
			HiddenInputs.DB = 'EUDEMO';
			break;

		case 'fxcmuk':
			HiddenInputs.DB = 'U100D5';
			break;

		case 'fxcmgbp_spread_betting':
			HiddenInputs.DB = 'GBDEMO';
			break;

		case 'cnbc_10k_llc':
			HiddenInputs.DB = 'PremiumDemo';
			break;

		case 'cnbc_10k_au':
			HiddenInputs.DB = 'AUDMINIDEMO';
			break;

		case 'cnbc_10k_ltd':
			HiddenInputs.DB = 'U100D5';
			break;

		default:
			return false;
	}

	// Capture the campaign if one exists
	var CampaignID = GetCampaignID();
	if (CampaignID) {
		HiddenInputs.cmp = CampaignID;
	}

	// Generate hidden iframe for confirmation page
	if (Form.getAttribute('target') === null)
	{
		var TargetName = GenerateNumericID();
		try {
			var iframeTarget = document.createElement('<iframe name="' + TargetName + '" />');	// IE Fix
		} catch (ex) {
			var iframeTarget = document.createElement('iframe');
			iframeTarget.setAttribute('name', TargetName);
		}
		iframeTarget.setAttribute('id', TargetName);
		iframeTarget.setAttribute('style','display:none');
		iframeTarget.setAttribute('width','1');
		iframeTarget.setAttribute('height','1');
		document.body.appendChild(iframeTarget);
		Form.setAttribute('target', TargetName);
	}

	// Setup Form Element
	Form.setAttribute('method', 'post');
	Form.setAttribute('action', 'https://secure4.fxcorporate.com/tr-demo/form/register-form');

	// Add hidden fields
	var HiddenInput;
	for (var HiddenInputName in HiddenInputs) {
		HiddenInput = document.getElementsByName(HiddenInputName);
		if (HiddenInput.length == 1)
		{
			HiddenInput = HiddenInput[0];
		} else {
			HiddenInput = document.createElement('input');
			HiddenInput.setAttribute('type', 'hidden');
			HiddenInput.setAttribute('name', HiddenInputName);
			Form.appendChild(HiddenInput);
		}
		HiddenInput.setAttribute('value',  HiddenInputs[HiddenInputName]);
	}

	return true;
}

// Wrapper for CustomDemoFormSetup mapping country and  account type(optional) to IB
function CustomDemoFormSetupByCountry(formID, country, accountType)
{
	if (typeof country === 'undefined') { return false; }
	if (typeof accountType === 'undefined') { accountType = 'ts'; }
	
	country = country.toLowerCase();
	accountType = accountType.toLowerCase();
	
	var ib;
	switch(country) {
		case 'united_states':
		case 'american_samoa':
		case 'guam':
		case 'puerto_rico':
			switch(accountType) {
				case 'ts':
					ib = 'fxcm';
					break;
				
				case 'at':
					ib = 'active_trader';
					break;
				
				case 'tsg':
					ib = 'tsg_llc';
					break;
				
				case 'st':
					ib = 'strategy_trader_llc';
					break;
				
				default:
					return false;
			}
			break;

		case 'australia':
		case 'new_zealand':
			ib = 'fxcmau';
			break;

		default:
			switch(accountType) {
				case 'ts':
					ib = 'fxcmuk';
					break;
				
				case 'sb':
					ib = 'fxcmgbp_spread_betting';
					break;
				
				default:
					return false;
			}
			break;
	}

	return CustomDemoFormSetup(formID, ib);
}
