"use strict";
/*!
 * jQuery JavaScript Library v2.2.4
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2016-05-20T17:23Z
 */
(function(global,factory){if(typeof module==="object"&&typeof module.exports==="object"){module.exports=global.document?factory(global,true):function(w){if(!w.document){throw new Error("jQuery requires a window with a document");}
return factory(w);};}else{factory(global);}}(typeof window!=="undefined"?window:this,function(window,noGlobal){var arr=[];var document=window.document;var slice=arr.slice;var concat=arr.concat;var push=arr.push;var indexOf=arr.indexOf;var class2type={};var toString=class2type.toString;var hasOwn=class2type.hasOwnProperty;var support={};var
version="2.2.4",jQuery=function(selector,context){return new jQuery.fn.init(selector,context);},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(all,letter){return letter.toUpperCase();};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,selector:"",length:0,toArray:function(){return slice.call(this);},get:function(num){return num!=null?(num<0?this[num+this.length]:this[num]):slice.call(this);},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;ret.context=this.context;return ret;},each:function(callback){return jQuery.each(this,callback);},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},slice:function(){return this.pushStack(slice.apply(this,arguments));},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[]);},end:function(){return this.prevObject||this.constructor();},push:push,sort:arr.sort,splice:arr.splice};jQuery.extend=jQuery.fn.extend=function(){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[i]||{};i++;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(i===length){target=this;i--;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[];}else{clone=src&&jQuery.isPlainObject(src)?src:{};}
target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:true,error:function(msg){throw new Error(msg);},noop:function(){},isFunction:function(obj){return jQuery.type(obj)==="function";},isArray:Array.isArray,isWindow:function(obj){return obj!=null&&obj===obj.window;},isNumeric:function(obj){var realStringObj=obj&&obj.toString();return!jQuery.isArray(obj)&&(realStringObj-parseFloat(realStringObj)+1)>=0;},isPlainObject:function(obj){var key;if(jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false;}
if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype||{},"isPrototypeOf")){return false;}
for(key in obj){}
return key===undefined||hasOwn.call(obj,key);},isEmptyObject:function(obj){var name;for(name in obj){return false;}
return true;},type:function(obj){if(obj==null){return obj+"";}
return typeof obj==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":typeof obj;},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code);if(code){if(code.indexOf("use strict")===1){script=document.createElement("script");script.text=code;document.head.appendChild(script).parentNode.removeChild(script);}else{indirect(code);}}},camelCase:function(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase);},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();},each:function(obj,callback){var length,i=0;if(isArrayLike(obj)){length=obj.length;for(;i<length;i++){if(callback.call(obj[i],i,obj[i])===false){break;}}}else{for(i in obj){if(callback.call(obj[i],i,obj[i])===false){break;}}}
return obj;},trim:function(text){return text==null?"":(text+"").replace(rtrim,"");},makeArray:function(arr,results){var ret=results||[];if(arr!=null){if(isArrayLike(Object(arr))){jQuery.merge(ret,typeof arr==="string"?[arr]:arr);}else{push.call(ret,arr);}}
return ret;},inArray:function(elem,arr,i){return arr==null?-1:indexOf.call(arr,elem,i);},merge:function(first,second){var len=+second.length,j=0,i=first.length;for(;j<len;j++){first[i++]=second[j];}
first.length=i;return first;},grep:function(elems,callback,invert){var callbackInverse,matches=[],i=0,length=elems.length,callbackExpect=!invert;for(;i<length;i++){callbackInverse=!callback(elems[i],i);if(callbackInverse!==callbackExpect){matches.push(elems[i]);}}
return matches;},map:function(elems,callback,arg){var length,value,i=0,ret=[];if(isArrayLike(elems)){length=elems.length;for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}}
return concat.apply([],ret);},guid:1,proxy:function(fn,context){var tmp,args,proxy;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp;}
if(!jQuery.isFunction(fn)){return undefined;}
args=slice.call(arguments,2);proxy=function(){return fn.apply(context||this,args.concat(slice.call(arguments)));};proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy;},now:Date.now,support:support});if(typeof Symbol==="function"){jQuery.fn[Symbol.iterator]=arr[Symbol.iterator];}
jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase();});function isArrayLike(obj){var length=!!obj&&"length"in obj&&obj.length,type=jQuery.type(obj);if(type==="function"||jQuery.isWindow(obj)){return false;}
return type==="array"||length===0||typeof length==="number"&&length>0&&(length-1)in obj;}
var Sizzle=
/*!
 * Sizzle CSS Selector Engine v2.2.1
 * http://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2015-10-17
 */
(function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,expando="sizzle"+1*new Date(),preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function(a,b){if(a===b){hasDuplicate=true;}
return 0;},MAX_NEGATIVE=1<<31,hasOwn=({}).hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,indexOf=function(list,elem){var i=0,len=list.length;for(;i<len;i++){if(list[i]===elem){return i;}}
return-1;},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",whitespace="[\\x20\\t\\r\\n\\f]",identifier="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",attributes="\\["+whitespace+"*("+identifier+")(?:"+whitespace+"*([*^$|!~]?=)"+whitespace+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+whitespace+"*\\]",pseudos=":("+identifier+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+".*"+")\\)|)",rwhitespace=new RegExp(whitespace+"+","g"),rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={"ID":new RegExp("^#("+identifier+")"),"CLASS":new RegExp("^\\.("+identifier+")"),"TAG":new RegExp("^("+identifier+"|[*])"),"ATTR":new RegExp("^"+attributes),"PSEUDO":new RegExp("^"+pseudos),"CHILD":new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),"bool":new RegExp("^(?:"+booleans+")$","i"),"needsContext":new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+
whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,rescape=/'|\\/g,runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function(_,escaped,escapedWhitespace){var high="0x"+escaped-0x10000;return high!==high||escapedWhitespace?escaped:high<0?String.fromCharCode(high+0x10000):String.fromCharCode(high>>10|0xD800,high&0x3FF|0xDC00);},unloadHandler=function(){setDocument();};try{push.apply((arr=slice.call(preferredDoc.childNodes)),preferredDoc.childNodes);arr[preferredDoc.childNodes.length].nodeType;}catch(e){push={apply:arr.length?function(target,els){push_native.apply(target,slice.call(els));}:function(target,els){var j=target.length,i=0;while((target[j++]=els[i++])){}
target.length=j-1;}};}
function Sizzle(selector,context,results,seed){var m,i,elem,nid,nidselect,match,groups,newSelector,newContext=context&&context.ownerDocument,nodeType=context?context.nodeType:9;results=results||[];if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results;}
if(!seed){if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context);}
context=context||document;if(documentIsHTML){if(nodeType!==11&&(match=rquickExpr.exec(selector))){if((m=match[1])){if(nodeType===9){if((elem=context.getElementById(m))){if(elem.id===m){results.push(elem);return results;}}else{return results;}}else{if(newContext&&(elem=newContext.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results;}}}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results;}else if((m=match[3])&&support.getElementsByClassName&&context.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results;}}
if(support.qsa&&!compilerCache[selector+" "]&&(!rbuggyQSA||!rbuggyQSA.test(selector))){if(nodeType!==1){newContext=context;newSelector=selector;}else if(context.nodeName.toLowerCase()!=="object"){if((nid=context.getAttribute("id"))){nid=nid.replace(rescape,"\\$&");}else{context.setAttribute("id",(nid=expando));}
groups=tokenize(selector);i=groups.length;nidselect=ridentifier.test(nid)?"#"+nid:"[id='"+nid+"']";while(i--){groups[i]=nidselect+" "+toSelector(groups[i]);}
newSelector=groups.join(",");newContext=rsibling.test(selector)&&testContext(context.parentNode)||context;}
if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results;}catch(qsaError){}finally{if(nid===expando){context.removeAttribute("id");}}}}}}
return select(selector.replace(rtrim,"$1"),context,results,seed);}
function createCache(){var keys=[];function cache(key,value){if(keys.push(key+" ")>Expr.cacheLength){delete cache[keys.shift()];}
return(cache[key+" "]=value);}
return cache;}
function markFunction(fn){fn[expando]=true;return fn;}
function assert(fn){var div=document.createElement("div");try{return!!fn(div);}catch(e){return false;}finally{if(div.parentNode){div.parentNode.removeChild(div);}
div=null;}}
function addHandle(attrs,handler){var arr=attrs.split("|"),i=arr.length;while(i--){Expr.attrHandle[arr[i]]=handler;}}
function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&(~b.sourceIndex||MAX_NEGATIVE)-
(~a.sourceIndex||MAX_NEGATIVE);if(diff){return diff;}
if(cur){while((cur=cur.nextSibling)){if(cur===b){return-1;}}}
return a?1:-1;}
function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type;};}
function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type;};}
function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;while(i--){if(seed[(j=matchIndexes[i])]){seed[j]=!(matches[j]=seed[j]);}}});});}
function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context;}
support=Sizzle.support={};isXML=Sizzle.isXML=function(elem){var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};setDocument=Sizzle.setDocument=function(node){var hasCompare,parent,doc=node?node.ownerDocument||node:preferredDoc;if(doc===document||doc.nodeType!==9||!doc.documentElement){return document;}
document=doc;docElem=document.documentElement;documentIsHTML=!isXML(document);if((parent=document.defaultView)&&parent.top!==parent){if(parent.addEventListener){parent.addEventListener("unload",unloadHandler,false);}else if(parent.attachEvent){parent.attachEvent("onunload",unloadHandler);}}
support.attributes=assert(function(div){div.className="i";return!div.getAttribute("className");});support.getElementsByTagName=assert(function(div){div.appendChild(document.createComment(""));return!div.getElementsByTagName("*").length;});support.getElementsByClassName=rnative.test(document.getElementsByClassName);support.getById=assert(function(div){docElem.appendChild(div).id=expando;return!document.getElementsByName||!document.getElementsByName(expando).length;});if(support.getById){Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var m=context.getElementById(id);return m?[m]:[];}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId;};};}else{delete Expr.find["ID"];Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId;};};}
Expr.find["TAG"]=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag);}else if(support.qsa){return context.querySelectorAll(tag);}}:function(tag,context){var elem,tmp=[],i=0,results=context.getElementsByTagName(tag);if(tag==="*"){while((elem=results[i++])){if(elem.nodeType===1){tmp.push(elem);}}
return tmp;}
return results;};Expr.find["CLASS"]=support.getElementsByClassName&&function(className,context){if(typeof context.getElementsByClassName!=="undefined"&&documentIsHTML){return context.getElementsByClassName(className);}};rbuggyMatches=[];rbuggyQSA=[];if((support.qsa=rnative.test(document.querySelectorAll))){assert(function(div){docElem.appendChild(div).innerHTML="<a id='"+expando+"'></a>"+"<select id='"+expando+"-\r\\' msallowcapture=''>"+"<option selected=''></option></select>";if(div.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")");}
if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")");}
if(!div.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=");}
if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked");}
if(!div.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]");}});assert(function(div){var input=document.createElement("input");input.setAttribute("type","hidden");div.appendChild(input).setAttribute("name","D");if(div.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=");}
if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled");}
div.querySelectorAll("*,:x");rbuggyQSA.push(",.*:");});}
if((support.matchesSelector=rnative.test((matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)))){assert(function(div){support.disconnectedMatch=matches.call(div,"div");matches.call(div,"[s!='']:x");rbuggyMatches.push("!=",pseudos);});}
rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));hasCompare=rnative.test(docElem.compareDocumentPosition);contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16));}:function(a,b){if(b){while((b=b.parentNode)){if(b===a){return true;}}}
return false;};sortOrder=hasCompare?function(a,b){if(a===b){hasDuplicate=true;return 0;}
var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare;}
compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1;if(compare&1||(!support.sortDetached&&b.compareDocumentPosition(a)===compare)){if(a===document||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)){return-1;}
if(b===document||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1;}
return sortInput?(indexOf(sortInput,a)-indexOf(sortInput,b)):0;}
return compare&4?-1:1;}:function(a,b){if(a===b){hasDuplicate=true;return 0;}
var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];if(!aup||!bup){return a===document?-1:b===document?1:aup?-1:bup?1:sortInput?(indexOf(sortInput,a)-indexOf(sortInput,b)):0;}else if(aup===bup){return siblingCheck(a,b);}
cur=a;while((cur=cur.parentNode)){ap.unshift(cur);}
cur=b;while((cur=cur.parentNode)){bp.unshift(cur);}
while(ap[i]===bp[i]){i++;}
return i?siblingCheck(ap[i],bp[i]):ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0;};return document;};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements);};Sizzle.matchesSelector=function(elem,expr){if((elem.ownerDocument||elem)!==document){setDocument(elem);}
expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&!compilerCache[expr+" "]&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);if(ret||support.disconnectedMatch||elem.document&&elem.document.nodeType!==11){return ret;}}catch(e){}}
return Sizzle(expr,document,null,[elem]).length>0;};Sizzle.contains=function(context,elem){if((context.ownerDocument||context)!==document){setDocument(context);}
return contains(context,elem);};Sizzle.attr=function(elem,name){if((elem.ownerDocument||elem)!==document){setDocument(elem);}
var fn=Expr.attrHandle[name.toLowerCase()],val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null;};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg);};Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while((elem=results[i++])){if(elem===results[i]){j=duplicates.push(i);}}
while(j--){results.splice(duplicates[j],1);}}
sortInput=null;return results;};getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){while((node=elem[i++])){ret+=getText(node);}}else if(nodeType===1||nodeType===9||nodeType===11){if(typeof elem.textContent==="string"){return elem.textContent;}else{for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem);}}}else if(nodeType===3||nodeType===4){return elem.nodeValue;}
return ret;};Expr=Sizzle.selectors={cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{"ATTR":function(match){match[1]=match[1].replace(runescape,funescape);match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" ";}
return match.slice(0,4);},"CHILD":function(match){match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){if(!match[3]){Sizzle.error(match[0]);}
match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+((match[7]+match[8])||match[3]==="odd");}else if(match[3]){Sizzle.error(match[0]);}
return match;},"PSEUDO":function(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null;}
if(match[3]){match[2]=match[4]||match[5]||"";}else if(unquoted&&rpseudo.test(unquoted)&&(excess=tokenize(unquoted,true))&&(excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess);}
return match.slice(0,3);}},filter:{"TAG":function(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true;}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName;};},"CLASS":function(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"");});},"ATTR":function(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);if(result==null){return operator==="!=";}
if(!operator){return true;}
result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":false;};},"CHILD":function(type,what,argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?function(elem){return!!elem.parentNode;}:function(elem,context,xml){var cache,uniqueCache,outerCache,node,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType,diff=false;if(parent){if(simple){while(dir){node=elem;while((node=node[dir])){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return false;}}
start=dir=type==="only"&&!start&&"nextSibling";}
return true;}
start=[forward?parent.firstChild:parent.lastChild];if(forward&&useCache){node=parent;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if(node.nodeType===1&&++diff&&node===elem){uniqueCache[type]=[dirruns,nodeIndex,diff];break;}}}else{if(useCache){node=elem;outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});cache=uniqueCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=nodeIndex;}
if(diff===false){while((node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop())){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){if(useCache){outerCache=node[expando]||(node[expando]={});uniqueCache=outerCache[node.uniqueID]||(outerCache[node.uniqueID]={});uniqueCache[type]=[dirruns,diff];}
if(node===elem){break;}}}}}
diff-=last;return diff===first||(diff%first===0&&diff/first>=0);}};},"PSEUDO":function(pseudo,argument){var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||Sizzle.error("unsupported pseudo: "+pseudo);if(fn[expando]){return fn(argument);}
if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i]);}}):function(elem){return fn(elem,0,args);};}
return fn;}},pseudos:{"not":markFunction(function(selector){var input=[],results=[],matcher=compile(selector.replace(rtrim,"$1"));return matcher[expando]?markFunction(function(seed,matches,context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;while(i--){if((elem=unmatched[i])){seed[i]=!(matches[i]=elem);}}}):function(elem,context,xml){input[0]=elem;matcher(input,null,xml,results);input[0]=null;return!results.pop();};}),"has":markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0;};}),"contains":markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1;};}),"lang":markFunction(function(lang){if(!ridentifier.test(lang||"")){Sizzle.error("unsupported lang: "+lang);}
lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if((elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang"))){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0;}}while((elem=elem.parentNode)&&elem.nodeType===1);return false;};}),"target":function(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id;},"root":function(elem){return elem===docElem;},"focus":function(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex);},"enabled":function(elem){return elem.disabled===false;},"disabled":function(elem){return elem.disabled===true;},"checked":function(elem){var nodeName=elem.nodeName.toLowerCase();return(nodeName==="input"&&!!elem.checked)||(nodeName==="option"&&!!elem.selected);},"selected":function(elem){if(elem.parentNode){elem.parentNode.selectedIndex;}
return elem.selected===true;},"empty":function(elem){for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false;}}
return true;},"parent":function(elem){return!Expr.pseudos["empty"](elem);},"header":function(elem){return rheader.test(elem.nodeName);},"input":function(elem){return rinputs.test(elem.nodeName);},"button":function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button";},"text":function(elem){var attr;return elem.nodeName.toLowerCase()==="input"&&elem.type==="text"&&((attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text");},"first":createPositionalPseudo(function(){return[0];}),"last":createPositionalPseudo(function(matchIndexes,length){return[length-1];}),"eq":createPositionalPseudo(function(matchIndexes,length,argument){return[argument<0?argument+length:argument];}),"even":createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i<length;i+=2){matchIndexes.push(i);}
return matchIndexes;}),"odd":createPositionalPseudo(function(matchIndexes,length){var i=1;for(;i<length;i+=2){matchIndexes.push(i);}
return matchIndexes;}),"lt":createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;--i>=0;){matchIndexes.push(i);}
return matchIndexes;}),"gt":createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i<length;){matchIndexes.push(i);}
return matchIndexes;})}};Expr.pseudos["nth"]=Expr.pseudos["eq"];for(i in{radio:true,checkbox:true,file:true,password:true,image:true}){Expr.pseudos[i]=createInputPseudo(i);}
for(i in{submit:true,reset:true}){Expr.pseudos[i]=createButtonPseudo(i);}
function setFilters(){}
setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters();tokenize=Sizzle.tokenize=function(selector,parseOnly){var matched,match,tokens,type,soFar,groups,preFilters,cached=tokenCache[selector+" "];if(cached){return parseOnly?0:cached.slice(0);}
soFar=selector;groups=[];preFilters=Expr.preFilter;while(soFar){if(!matched||(match=rcomma.exec(soFar))){if(match){soFar=soFar.slice(match[0].length)||soFar;}
groups.push((tokens=[]));}
matched=false;if((match=rcombinators.exec(soFar))){matched=match.shift();tokens.push({value:matched,type:match[0].replace(rtrim," ")});soFar=soFar.slice(matched.length);}
for(type in Expr.filter){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match)))){matched=match.shift();tokens.push({value:matched,type:type,matches:match});soFar=soFar.slice(matched.length);}}
if(!matched){break;}}
return parseOnly?soFar.length:soFar?Sizzle.error(selector):tokenCache(selector,groups).slice(0);};function toSelector(tokens){var i=0,len=tokens.length,selector="";for(;i<len;i++){selector+=tokens[i].value;}
return selector;}
function addCombinator(matcher,combinator,base){var dir=combinator.dir,checkNonElements=base&&dir==="parentNode",doneName=done++;return combinator.first?function(elem,context,xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml);}}}:function(elem,context,xml){var oldCache,uniqueCache,outerCache,newCache=[dirruns,doneName];if(xml){while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return true;}}}}else{while((elem=elem[dir])){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});uniqueCache=outerCache[elem.uniqueID]||(outerCache[elem.uniqueID]={});if((oldCache=uniqueCache[dir])&&oldCache[0]===dirruns&&oldCache[1]===doneName){return(newCache[2]=oldCache[2]);}else{uniqueCache[dir]=newCache;if((newCache[2]=matcher(elem,context,xml))){return true;}}}}}};}
function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false;}}
return true;}:matchers[0];}
function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(selector,contexts[i],results);}
return results;}
function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if((elem=unmatched[i])){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i);}}}}
return newUnmatched;}
function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter);}
if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector);}
return markFunction(function(seed,results,context,xml){var temp,i,elem,preMap=[],postMap=[],preexisting=results.length,elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems,matcherOut=matcher?postFinder||(seed?preFilter:preexisting||postFilter)?[]:results:matcherIn;if(matcher){matcher(matcherIn,matcherOut,context,xml);}
if(postFilter){temp=condense(matcherOut,postMap);postFilter(temp,[],context,xml);i=temp.length;while(i--){if((elem=temp[i])){matcherOut[postMap[i]]=!(matcherIn[postMap[i]]=elem);}}}
if(seed){if(postFinder||preFilter){if(postFinder){temp=[];i=matcherOut.length;while(i--){if((elem=matcherOut[i])){temp.push((matcherIn[i]=elem));}}
postFinder(null,(matcherOut=[]),temp,xml);}
i=matcherOut.length;while(i--){if((elem=matcherOut[i])&&(temp=postFinder?indexOf(seed,elem):preMap[i])>-1){seed[temp]=!(results[temp]=elem);}}}}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml);}else{push.apply(results,matcherOut);}}});}
function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,matchContext=addCombinator(function(elem){return elem===checkContext;},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1;},implicitRelative,true),matchers=[function(elem,context,xml){var ret=(!leadingRelative&&(xml||context!==outermostContext))||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));checkContext=null;return ret;}];for(;i<len;i++){if((matcher=Expr.relative[tokens[i].type])){matchers=[addCombinator(elementMatcher(matchers),matcher)];}else{matcher=Expr.filter[tokens[i].type].apply(null,tokens[i].matches);if(matcher[expando]){j=++i;for(;j<len;j++){if(Expr.relative[tokens[j].type]){break;}}
return setMatcher(i>1&&elementMatcher(matchers),i>1&&toSelector(tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrim,"$1"),matcher,i<j&&matcherFromTokens(tokens.slice(i,j)),j<len&&matcherFromTokens((tokens=tokens.slice(j))),j<len&&toSelector(tokens));}
matchers.push(matcher);}}
return elementMatcher(matchers);}
function matcherFromGroupMatchers(elementMatchers,setMatchers){var bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,elems=seed||byElement&&Expr.find["TAG"]("*",outermost),dirrunsUnique=(dirruns+=contextBackup==null?1:Math.random()||0.1),len=elems.length;if(outermost){outermostContext=context===document||context||outermost;}
for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;if(!context&&elem.ownerDocument!==document){setDocument(elem);xml=!documentIsHTML;}
while((matcher=elementMatchers[j++])){if(matcher(elem,context||document,xml)){results.push(elem);break;}}
if(outermost){dirruns=dirrunsUnique;}}
if(bySet){if((elem=!matcher&&elem)){matchedCount--;}
if(seed){unmatched.push(elem);}}}
matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while((matcher=setMatchers[j++])){matcher(unmatched,setMatched,context,xml);}
if(seed){if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results);}}}
setMatched=condense(setMatched);}
push.apply(results,setMatched);if(outermost&&!seed&&setMatched.length>0&&(matchedCount+setMatchers.length)>1){Sizzle.uniqueSort(results);}}
if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup;}
return unmatched;};return bySet?markFunction(superMatcher):superMatcher;}
compile=Sizzle.compile=function(selector,match){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){if(!match){match=tokenize(selector);}
i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached);}else{elementMatchers.push(cached);}}
cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));cached.selector=selector;}
return cached;};select=Sizzle.select=function(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize((selector=compiled.selector||selector));results=results||[];if(match.length===1){tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&support.getById&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results;}else if(compiled){context=context.parentNode;}
selector=selector.slice(tokens.shift().value.length);}
i=matchExpr["needsContext"].test(selector)?0:tokens.length;while(i--){token=tokens[i];if(Expr.relative[(type=token.type)]){break;}
if((find=Expr.find[type])){if((seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context))){tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results;}
break;}}}}
(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,!context||rsibling.test(selector)&&testContext(context.parentNode)||context);return results;};support.sortStable=expando.split("").sort(sortOrder).join("")===expando;support.detectDuplicates=!!hasDuplicate;setDocument();support.sortDetached=assert(function(div1){return div1.compareDocumentPosition(document.createElement("div"))&1;});if(!assert(function(div){div.innerHTML="<a href='#'></a>";return div.firstChild.getAttribute("href")==="#";})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2);}});}
if(!support.attributes||!assert(function(div){div.innerHTML="<input/>";div.firstChild.setAttribute("value","");return div.firstChild.getAttribute("value")==="";})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue;}});}
if(!assert(function(div){return div.getAttribute("disabled")==null;})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===true?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null;}});}
return Sizzle;})(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;var dir=function(elem,dir,until){var matched=[],truncate=until!==undefined;while((elem=elem[dir])&&elem.nodeType!==9){if(elem.nodeType===1){if(truncate&&jQuery(elem).is(until)){break;}
matched.push(elem);}}
return matched;};var siblings=function(n,elem){var matched=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){matched.push(n);}}
return matched;};var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=(/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/);var risSimple=/^.[^:#\[\.,]*$/;function winnow(elements,qualifier,not){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)!==not;});}
if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return(elem===qualifier)!==not;});}
if(typeof qualifier==="string"){if(risSimple.test(qualifier)){return jQuery.filter(qualifier,elements,not);}
qualifier=jQuery.filter(qualifier,elements);}
return jQuery.grep(elements,function(elem){return(indexOf.call(qualifier,elem)>-1)!==not;});}
jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")";}
return elems.length===1&&elem.nodeType===1?jQuery.find.matchesSelector(elem,expr)?[elem]:[]:jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1;}));};jQuery.fn.extend({find:function(selector){var i,len=this.length,ret=[],self=this;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true;}}}));}
for(i=0;i<len;i++){jQuery.find(selector,self[i],ret);}
ret=this.pushStack(len>1?jQuery.unique(ret):ret);ret.selector=this.selector?this.selector+" "+selector:selector;return ret;},filter:function(selector){return this.pushStack(winnow(this,selector||[],false));},not:function(selector){return this.pushStack(winnow(this,selector||[],true));},is:function(selector){return!!winnow(this,typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length;}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(selector,context,root){var match,elem;if(!selector){return this;}
root=root||rootjQuery;if(typeof selector==="string"){if(selector[0]==="<"&&selector[selector.length-1]===">"&&selector.length>=3){match=[null,selector,null];}else{match=rquickExpr.exec(selector);}
if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){this[match](context[match]);}else{this.attr(match,context[match]);}}}
return this;}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context||context.jquery){return(context||root).find(selector);}else{return this.constructor(context).find(selector);}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}else if(jQuery.isFunction(selector)){return root.ready!==undefined?root.ready(selector):selector(jQuery);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);};init.prototype=jQuery.fn;rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(target){var targets=jQuery(target,this),l=targets.length;return this.filter(function(){var i=0;for(;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},closest:function(selectors,context){var cur,i=0,l=this.length,matched=[],pos=rneedsContext.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(;i<l;i++){for(cur=this[i];cur&&cur!==context;cur=cur.parentNode){if(cur.nodeType<11&&(pos?pos.index(cur)>-1:cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break;}}}
return this.pushStack(matched.length>1?jQuery.uniqueSort(matched):matched);},index:function(elem){if(!elem){return(this[0]&&this[0].parentNode)?this.first().prevAll().length:-1;}
if(typeof elem==="string"){return indexOf.call(jQuery(elem),this[0]);}
return indexOf.call(this,elem.jquery?elem[0]:elem);},add:function(selector,context){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(selector,context))));},addBack:function(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));}});function sibling(cur,dir){while((cur=cur[dir])&&cur.nodeType!==1){}
return cur;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return dir(elem,"parentNode",until);},next:function(elem){return sibling(elem,"nextSibling");},prev:function(elem){return sibling(elem,"previousSibling");},nextAll:function(elem){return dir(elem,"nextSibling");},prevAll:function(elem){return dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return dir(elem,"previousSibling",until);},siblings:function(elem){return siblings((elem.parentNode||{}).firstChild,elem);},children:function(elem){return siblings(elem.firstChild);},contents:function(elem){return elem.contentDocument||jQuery.merge([],elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var matched=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until;}
if(selector&&typeof selector==="string"){matched=jQuery.filter(selector,matched);}
if(this.length>1){if(!guaranteedUnique[name]){jQuery.uniqueSort(matched);}
if(rparentsprev.test(name)){matched.reverse();}}
return this.pushStack(matched);};});var rnotwhite=(/\S+/g);function createOptions(options){var object={};jQuery.each(options.match(rnotwhite)||[],function(_,flag){object[flag]=true;});return object;}
jQuery.Callbacks=function(options){options=typeof options==="string"?createOptions(options):jQuery.extend({},options);var
firing,memory,fired,locked,list=[],queue=[],firingIndex=-1,fire=function(){locked=options.once;fired=firing=true;for(;queue.length;firingIndex=-1){memory=queue.shift();while(++firingIndex<list.length){if(list[firingIndex].apply(memory[0],memory[1])===false&&options.stopOnFalse){firingIndex=list.length;memory=false;}}}
if(!options.memory){memory=false;}
firing=false;if(locked){if(memory){list=[];}else{list="";}}},self={add:function(){if(list){if(memory&&!firing){firingIndex=list.length-1;queue.push(memory);}
(function add(args){jQuery.each(args,function(_,arg){if(jQuery.isFunction(arg)){if(!options.unique||!self.has(arg)){list.push(arg);}}else if(arg&&arg.length&&jQuery.type(arg)!=="string"){add(arg);}});})(arguments);if(memory&&!firing){fire();}}
return this;},remove:function(){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);if(index<=firingIndex){firingIndex--;}}});return this;},has:function(fn){return fn?jQuery.inArray(fn,list)>-1:list.length>0;},empty:function(){if(list){list=[];}
return this;},disable:function(){locked=queue=[];list=memory="";return this;},disabled:function(){return!list;},lock:function(){locked=queue=[];if(!memory){list=memory="";}
return this;},locked:function(){return!!locked;},fireWith:function(context,args){if(!locked){args=args||[];args=[context,args.slice?args.slice():args];queue.push(args);if(!firing){fire();}}
return this;},fire:function(){self.fireWith(this,arguments);return this;},fired:function(){return!!fired;}};return self;};jQuery.extend({Deferred:function(func){var tuples=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],state="pending",promise={state:function(){return state;},always:function(){deferred.done(arguments).fail(arguments);return this;},then:function(){var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var fn=jQuery.isFunction(fns[i])&&fns[i];deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);}else{newDefer[tuple[0]+"With"](this===promise?newDefer.promise():this,fn?[returned]:arguments);}});});fns=null;}).promise();},promise:function(obj){return obj!=null?jQuery.extend(obj,promise):promise;}},deferred={};promise.pipe=promise.then;jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];promise[tuple[1]]=list.add;if(stateString){list.add(function(){state=stateString;},tuples[i^1][2].disable,tuples[2][2].lock);}
deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?promise:this,arguments);return this;};deferred[tuple[0]+"With"]=list.fireWith;});promise.promise(deferred);if(func){func.call(deferred,deferred);}
return deferred;},when:function(subordinate){var i=0,resolveValues=slice.call(arguments),length=resolveValues.length,remaining=length!==1||(subordinate&&jQuery.isFunction(subordinate.promise))?length:0,deferred=remaining===1?subordinate:jQuery.Deferred(),updateFunc=function(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values);}else if(!(--remaining)){deferred.resolveWith(contexts,values);}};},progressValues,progressContexts,resolveContexts;if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i<length;i++){if(resolveValues[i]&&jQuery.isFunction(resolveValues[i].promise)){resolveValues[i].promise().progress(updateFunc(i,progressContexts,progressValues)).done(updateFunc(i,resolveContexts,resolveValues)).fail(deferred.reject);}else{--remaining;}}}
if(!remaining){deferred.resolveWith(resolveContexts,resolveValues);}
return deferred.promise();}});var readyList;jQuery.fn.ready=function(fn){jQuery.ready.promise().done(fn);return this;};jQuery.extend({isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}},ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return;}
jQuery.isReady=true;if(wait!==true&&--jQuery.readyWait>0){return;}
readyList.resolveWith(document,[jQuery]);if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");jQuery(document).off("ready");}}});function completed(){document.removeEventListener("DOMContentLoaded",completed);window.removeEventListener("load",completed);jQuery.ready();}
jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();if(document.readyState==="complete"||(document.readyState!=="loading"&&!document.documentElement.doScroll)){window.setTimeout(jQuery.ready);}else{document.addEventListener("DOMContentLoaded",completed);window.addEventListener("load",completed);}}
return readyList.promise(obj);};jQuery.ready.promise();var access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,len=elems.length,bulk=key==null;if(jQuery.type(key)==="object"){chainable=true;for(i in key){access(elems,fn,i,key[i],true,emptyGet,raw);}}else if(value!==undefined){chainable=true;if(!jQuery.isFunction(value)){raw=true;}
if(bulk){if(raw){fn.call(elems,value);fn=null;}else{bulk=fn;fn=function(elem,key,value){return bulk.call(jQuery(elem),value);};}}
if(fn){for(;i<len;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)));}}}
return chainable?elems:bulk?fn.call(elems):len?fn(elems[0],key):emptyGet;};var acceptData=function(owner){return owner.nodeType===1||owner.nodeType===9||!(+owner.nodeType);};function Data(){this.expando=jQuery.expando+Data.uid++;}
Data.uid=1;Data.prototype={register:function(owner,initial){var value=initial||{};if(owner.nodeType){owner[this.expando]=value;}else{Object.defineProperty(owner,this.expando,{value:value,writable:true,configurable:true});}
return owner[this.expando];},cache:function(owner){if(!acceptData(owner)){return{};}
var value=owner[this.expando];if(!value){value={};if(acceptData(owner)){if(owner.nodeType){owner[this.expando]=value;}else{Object.defineProperty(owner,this.expando,{value:value,configurable:true});}}}
return value;},set:function(owner,data,value){var prop,cache=this.cache(owner);if(typeof data==="string"){cache[data]=value;}else{for(prop in data){cache[prop]=data[prop];}}
return cache;},get:function(owner,key){return key===undefined?this.cache(owner):owner[this.expando]&&owner[this.expando][key];},access:function(owner,key,value){var stored;if(key===undefined||((key&&typeof key==="string")&&value===undefined)){stored=this.get(owner,key);return stored!==undefined?stored:this.get(owner,jQuery.camelCase(key));}
this.set(owner,key,value);return value!==undefined?value:key;},remove:function(owner,key){var i,name,camel,cache=owner[this.expando];if(cache===undefined){return;}
if(key===undefined){this.register(owner);}else{if(jQuery.isArray(key)){name=key.concat(key.map(jQuery.camelCase));}else{camel=jQuery.camelCase(key);if(key in cache){name=[key,camel];}else{name=camel;name=name in cache?[name]:(name.match(rnotwhite)||[]);}}
i=name.length;while(i--){delete cache[name[i]];}}
if(key===undefined||jQuery.isEmptyObject(cache)){if(owner.nodeType){owner[this.expando]=undefined;}else{delete owner[this.expando];}}},hasData:function(owner){var cache=owner[this.expando];return cache!==undefined&&!jQuery.isEmptyObject(cache);}};var dataPriv=new Data();var dataUser=new Data();var rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;function dataAttr(elem,key,data){var name;if(data===undefined&&elem.nodeType===1){name="data-"+key.replace(rmultiDash,"-$&").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:+data+""===data?+data:rbrace.test(data)?jQuery.parseJSON(data):data;}catch(e){}
dataUser.set(elem,key,data);}else{data=undefined;}}
return data;}
jQuery.extend({hasData:function(elem){return dataUser.hasData(elem)||dataPriv.hasData(elem);},data:function(elem,name,data){return dataUser.access(elem,name,data);},removeData:function(elem,name){dataUser.remove(elem,name);},_data:function(elem,name,data){return dataPriv.access(elem,name,data);},_removeData:function(elem,name){dataPriv.remove(elem,name);}});jQuery.fn.extend({data:function(key,value){var i,name,data,elem=this[0],attrs=elem&&elem.attributes;if(key===undefined){if(this.length){data=dataUser.get(elem);if(elem.nodeType===1&&!dataPriv.get(elem,"hasDataAttrs")){i=attrs.length;while(i--){if(attrs[i]){name=attrs[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.slice(5));dataAttr(elem,name,data[name]);}}}
dataPriv.set(elem,"hasDataAttrs",true);}}
return data;}
if(typeof key==="object"){return this.each(function(){dataUser.set(this,key);});}
return access(this,function(value){var data,camelKey;if(elem&&value===undefined){data=dataUser.get(elem,key)||dataUser.get(elem,key.replace(rmultiDash,"-$&").toLowerCase());if(data!==undefined){return data;}
camelKey=jQuery.camelCase(key);data=dataUser.get(elem,camelKey);if(data!==undefined){return data;}
data=dataAttr(elem,camelKey,undefined);if(data!==undefined){return data;}
return;}
camelKey=jQuery.camelCase(key);this.each(function(){var data=dataUser.get(this,camelKey);dataUser.set(this,camelKey,value);if(key.indexOf("-")>-1&&data!==undefined){dataUser.set(this,key,value);}});},null,value,arguments.length>1,null,true);},removeData:function(key){return this.each(function(){dataUser.remove(this,key);});}});jQuery.extend({queue:function(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=dataPriv.get(elem,type);if(data){if(!queue||jQuery.isArray(data)){queue=dataPriv.access(elem,type,jQuery.makeArray(data));}else{queue.push(data);}}
return queue||[];}},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function(){jQuery.dequeue(elem,type);};if(fn==="inprogress"){fn=queue.shift();startLength--;}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
delete hooks.stop;fn.call(elem,next,hooks);}
if(!startLength&&hooks){hooks.empty.fire();}},_queueHooks:function(elem,type){var key=type+"queueHooks";return dataPriv.get(elem,key)||dataPriv.access(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(elem,[type+"queue",key]);})});}});jQuery.fn.extend({queue:function(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--;}
if(arguments.length<setter){return jQuery.queue(this[0],type);}
return data===undefined?this:this.each(function(){var queue=jQuery.queue(this,type,data);jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},clearQueue:function(type){return this.queue(type||"fx",[]);},promise:function(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function(){if(!(--count)){defer.resolveWith(elements,[elements]);}};if(typeof type!=="string"){obj=type;type=undefined;}
type=type||"fx";while(i--){tmp=dataPriv.get(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve);}}
resolve();return defer.promise(obj);}});var pnum=(/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;var rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i");var cssExpand=["Top","Right","Bottom","Left"];var isHidden=function(elem,el){elem=el||elem;return jQuery.css(elem,"display")==="none"||!jQuery.contains(elem.ownerDocument,elem);};function adjustCSS(elem,prop,valueParts,tween){var adjusted,scale=1,maxIterations=20,currentValue=tween?function(){return tween.cur();}:function(){return jQuery.css(elem,prop,"");},initial=currentValue(),unit=valueParts&&valueParts[3]||(jQuery.cssNumber[prop]?"":"px"),initialInUnit=(jQuery.cssNumber[prop]||unit!=="px"&&+initial)&&rcssNum.exec(jQuery.css(elem,prop));if(initialInUnit&&initialInUnit[3]!==unit){unit=unit||initialInUnit[3];valueParts=valueParts||[];initialInUnit=+initial||1;do{scale=scale||".5";initialInUnit=initialInUnit/scale;jQuery.style(elem,prop,initialInUnit+unit);}while(scale!==(scale=currentValue()/initial)&&scale!==1&&--maxIterations);}
if(valueParts){initialInUnit=+initialInUnit||+initial||0;adjusted=valueParts[1]?initialInUnit+(valueParts[1]+1)*valueParts[2]:+valueParts[2];if(tween){tween.unit=unit;tween.start=initialInUnit;tween.end=adjusted;}}
return adjusted;}
var rcheckableType=(/^(?:checkbox|radio)$/i);var rtagName=(/<([\w:-]+)/);var rscriptType=(/^$|\/(?:java|ecma)script/i);var wrapMap={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;function getAll(context,tag){var ret=typeof context.getElementsByTagName!=="undefined"?context.getElementsByTagName(tag||"*"):typeof context.querySelectorAll!=="undefined"?context.querySelectorAll(tag||"*"):[];return tag===undefined||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],ret):ret;}
function setGlobalEval(elems,refElements){var i=0,l=elems.length;for(;i<l;i++){dataPriv.set(elems[i],"globalEval",!refElements||dataPriv.get(refElements[i],"globalEval"));}}
var rhtml=/<|&#?\w+;/;function buildFragment(elems,context,scripts,selection,ignored){var elem,tmp,tag,wrap,contains,j,fragment=context.createDocumentFragment(),nodes=[],i=0,l=elems.length;for(;i<l;i++){elem=elems[i];if(elem||elem===0){if(jQuery.type(elem)==="object"){jQuery.merge(nodes,elem.nodeType?[elem]:elem);}else if(!rhtml.test(elem)){nodes.push(context.createTextNode(elem));}else{tmp=tmp||fragment.appendChild(context.createElement("div"));tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+jQuery.htmlPrefilter(elem)+wrap[2];j=wrap[0];while(j--){tmp=tmp.lastChild;}
jQuery.merge(nodes,tmp.childNodes);tmp=fragment.firstChild;tmp.textContent="";}}}
fragment.textContent="";i=0;while((elem=nodes[i++])){if(selection&&jQuery.inArray(elem,selection)>-1){if(ignored){ignored.push(elem);}
continue;}
contains=jQuery.contains(elem.ownerDocument,elem);tmp=getAll(fragment.appendChild(elem),"script");if(contains){setGlobalEval(tmp);}
if(scripts){j=0;while((elem=tmp[j++])){if(rscriptType.test(elem.type||"")){scripts.push(elem);}}}}
return fragment;}
(function(){var fragment=document.createDocumentFragment(),div=fragment.appendChild(document.createElement("div")),input=document.createElement("input");input.setAttribute("type","radio");input.setAttribute("checked","checked");input.setAttribute("name","t");div.appendChild(input);support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue;})();var
rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true;}
function returnFalse(){return false;}
function safeActiveElement(){try{return document.activeElement;}catch(err){}}
function on(elem,types,selector,data,fn,one){var origFn,type;if(typeof types==="object"){if(typeof selector!=="string"){data=data||selector;selector=undefined;}
for(type in types){on(elem,type,selector,data,types[type],one);}
return elem;}
if(data==null&&fn==null){fn=selector;data=selector=undefined;}else if(fn==null){if(typeof selector==="string"){fn=data;data=undefined;}else{fn=data;data=selector;selector=undefined;}}
if(fn===false){fn=returnFalse;}else if(!fn){return elem;}
if(one===1){origFn=fn;fn=function(event){jQuery().off(event);return origFn.apply(this,arguments);};fn.guid=origFn.guid||(origFn.guid=jQuery.guid++);}
return elem.each(function(){jQuery.event.add(this,types,fn,data,selector);});}
jQuery.event={global:{},add:function(elem,types,handler,data,selector){var handleObjIn,eventHandle,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.get(elem);if(!elemData){return;}
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector;}
if(!handler.guid){handler.guid=jQuery.guid++;}
if(!(events=elemData.events)){events=elemData.events={};}
if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){return typeof jQuery!=="undefined"&&jQuery.event.triggered!==e.type?jQuery.event.dispatch.apply(elem,arguments):undefined;};}
types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){continue;}
special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;special=jQuery.event.special[type]||{};handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
if(selector){handlers.splice(handlers.delegateCount++,0,handleObj);}else{handlers.push(handleObj);}
jQuery.event.global[type]=true;}},remove:function(elem,types,handler,selector,mappedTypes){var j,origCount,tmp,events,t,handleObj,special,handlers,type,namespaces,origType,elemData=dataPriv.hasData(elem)&&dataPriv.get(elem);if(!elemData||!(events=elemData.events)){return;}
types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true);}
continue;}
special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--;}
if(special.remove){special.remove.call(elem,handleObj);}}}
if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle);}
delete events[type];}}
if(jQuery.isEmptyObject(events)){dataPriv.remove(elem,"handle events");}},dispatch:function(event){event=jQuery.event.fix(event);var i,j,ret,matched,handleObj,handlerQueue=[],args=slice.call(arguments),handlers=(dataPriv.get(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};args[0]=event;event.delegateTarget=this;if(special.preDispatch&&special.preDispatch.call(this,event)===false){return;}
handlerQueue=jQuery.event.handlers.call(this,event,handlers);i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){if(!event.rnamespace||event.rnamespace.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation();}}}}}
if(special.postDispatch){special.postDispatch.call(this,event);}
return event.result;},handlers:function(event,handlers){var i,matches,sel,handleObj,handlerQueue=[],delegateCount=handlers.delegateCount,cur=event.target;if(delegateCount&&cur.nodeType&&(event.type!=="click"||isNaN(event.button)||event.button<1)){for(;cur!==this;cur=cur.parentNode||this){if(cur.nodeType===1&&(cur.disabled!==true||event.type!=="click")){matches=[];for(i=0;i<delegateCount;i++){handleObj=handlers[i];sel=handleObj.selector+" ";if(matches[sel]===undefined){matches[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>-1:jQuery.find(sel,this,null,[cur]).length;}
if(matches[sel]){matches.push(handleObj);}}
if(matches.length){handlerQueue.push({elem:cur,handlers:matches});}}}}
if(delegateCount<handlers.length){handlerQueue.push({elem:this,handlers:handlers.slice(delegateCount)});}
return handlerQueue;},props:("altKey bubbles cancelable ctrlKey currentTarget detail eventPhase "+"metaKey relatedTarget shiftKey target timeStamp view which").split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(event,original){if(event.which==null){event.which=original.charCode!=null?original.charCode:original.keyCode;}
return event;}},mouseHooks:{props:("button buttons clientX clientY offsetX offsetY pageX pageY "+"screenX screenY toElement").split(" "),filter:function(event,original){var eventDoc,doc,body,button=original.button;if(event.pageX==null&&original.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=original.clientX+
(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-
(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=original.clientY+
(doc&&doc.scrollTop||body&&body.scrollTop||0)-
(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.which&&button!==undefined){event.which=(button&1?1:(button&2?3:(button&4?2:0)));}
return event;}},fix:function(event){if(event[jQuery.expando]){return event;}
var i,prop,copy,type=event.type,originalEvent=event,fixHook=this.fixHooks[type];if(!fixHook){this.fixHooks[type]=fixHook=rmouseEvent.test(type)?this.mouseHooks:rkeyEvent.test(type)?this.keyHooks:{};}
copy=fixHook.props?this.props.concat(fixHook.props):this.props;event=new jQuery.Event(originalEvent);i=copy.length;while(i--){prop=copy[i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
return fixHook.filter?fixHook.filter(event,originalEvent):event;},special:{load:{noBubble:true},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus){this.focus();return false;}},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur){this.blur();return false;}},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&jQuery.nodeName(this,"input")){this.click();return false;}},_default:function(event){return jQuery.nodeName(event.target,"a");}},beforeunload:{postDispatch:function(event){if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result;}}}}};jQuery.removeEvent=function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle);}};jQuery.Event=function(src,props){if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=src.defaultPrevented||src.defaultPrevented===undefined&&src.returnValue===false?returnTrue:returnFalse;}else{this.type=src;}
if(props){jQuery.extend(this,props);}
this.timeStamp=src&&src.timeStamp||jQuery.now();this[jQuery.expando]=true;};jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,isSimulated:false,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(e&&!this.isSimulated){e.preventDefault();}},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopPropagation();}},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue;if(e&&!this.isSimulated){e.stopImmediatePropagation();}
this.stopPropagation();}};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj;if(!related||(related!==target&&!jQuery.contains(target,related))){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix;}
return ret;}};});jQuery.fn.extend({on:function(types,selector,data,fn){return on(this,types,selector,data,fn);},one:function(types,selector,data,fn){return on(this,types,selector,data,fn,1);},off:function(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this;}
if(typeof types==="object"){for(type in types){this.off(type,selector,types[type]);}
return this;}
if(selector===false||typeof selector==="function"){fn=selector;selector=undefined;}
if(fn===false){fn=returnFalse;}
return this.each(function(){jQuery.event.remove(this,types,fn,selector);});}});var
rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function manipulationTarget(elem,content){return jQuery.nodeName(elem,"table")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,"tr")?elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody")):elem;}
function disableScript(elem){elem.type=(elem.getAttribute("type")!==null)+"/"+elem.type;return elem;}
function restoreScript(elem){var match=rscriptTypeMasked.exec(elem.type);if(match){elem.type=match[1];}else{elem.removeAttribute("type");}
return elem;}
function cloneCopyEvent(src,dest){var i,l,type,pdataOld,pdataCur,udataOld,udataCur,events;if(dest.nodeType!==1){return;}
if(dataPriv.hasData(src)){pdataOld=dataPriv.access(src);pdataCur=dataPriv.set(dest,pdataOld);events=pdataOld.events;if(events){delete pdataCur.handle;pdataCur.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i]);}}}}
if(dataUser.hasData(src)){udataOld=dataUser.access(src);udataCur=jQuery.extend({},udataOld);dataUser.set(dest,udataCur);}}
function fixInput(src,dest){var nodeName=dest.nodeName.toLowerCase();if(nodeName==="input"&&rcheckableType.test(src.type)){dest.checked=src.checked;}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}}
function domManip(collection,args,callback,ignored){args=concat.apply([],args);var fragment,first,scripts,hasScripts,node,doc,i=0,l=collection.length,iNoClone=l-1,value=args[0],isFunction=jQuery.isFunction(value);if(isFunction||(l>1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value))){return collection.each(function(index){var self=collection.eq(index);if(isFunction){args[0]=value.call(this,index,self.html());}
domManip(self,args,callback,ignored);});}
if(l){fragment=buildFragment(args,collection[0].ownerDocument,false,collection,ignored);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first;}
if(first||ignored){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;for(;i<l;i++){node=fragment;if(i!==iNoClone){node=jQuery.clone(node,true,true);if(hasScripts){jQuery.merge(scripts,getAll(node,"script"));}}
callback.call(collection[i],node,i);}
if(hasScripts){doc=scripts[scripts.length-1].ownerDocument;jQuery.map(scripts,restoreScript);for(i=0;i<hasScripts;i++){node=scripts[i];if(rscriptType.test(node.type||"")&&!dataPriv.access(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src){if(jQuery._evalUrl){jQuery._evalUrl(node.src);}}else{jQuery.globalEval(node.textContent.replace(rcleanScript,""));}}}}}}
return collection;}
function remove(elem,selector,keepData){var node,nodes=selector?jQuery.filter(selector,elem):elem,i=0;for(;(node=nodes[i])!=null;i++){if(!keepData&&node.nodeType===1){jQuery.cleanData(getAll(node));}
if(node.parentNode){if(keepData&&jQuery.contains(node.ownerDocument,node)){setGlobalEval(getAll(node,"script"));}
node.parentNode.removeChild(node);}}
return elem;}
jQuery.extend({htmlPrefilter:function(html){return html.replace(rxhtmlTag,"<$1></$2>");},clone:function(elem,dataAndEvents,deepDataAndEvents){var i,l,srcElements,destElements,clone=elem.cloneNode(true),inPage=jQuery.contains(elem.ownerDocument,elem);if(!support.noCloneChecked&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){destElements=getAll(clone);srcElements=getAll(elem);for(i=0,l=srcElements.length;i<l;i++){fixInput(srcElements[i],destElements[i]);}}
if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0,l=srcElements.length;i<l;i++){cloneCopyEvent(srcElements[i],destElements[i]);}}else{cloneCopyEvent(elem,clone);}}
destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"));}
return clone;},cleanData:function(elems){var data,elem,type,special=jQuery.event.special,i=0;for(;(elem=elems[i])!==undefined;i++){if(acceptData(elem)){if((data=elem[dataPriv.expando])){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{jQuery.removeEvent(elem,type,data.handle);}}}
elem[dataPriv.expando]=undefined;}
if(elem[dataUser.expando]){elem[dataUser.expando]=undefined;}}}}});jQuery.fn.extend({domManip:domManip,detach:function(selector){return remove(this,selector,true);},remove:function(selector){return remove(this,selector);},text:function(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){this.textContent=value;}});},null,value,arguments.length);},append:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem);}});},prepend:function(){return domManip(this,arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild);}});},before:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this);}});},after:function(){return domManip(this,arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling);}});},empty:function(){var elem,i=0;for(;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.textContent="";}}
return this;},clone:function(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents);});},html:function(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined&&elem.nodeType===1){return elem.innerHTML;}
if(typeof value==="string"&&!rnoInnerhtml.test(value)&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=jQuery.htmlPrefilter(value);try{for(;i<l;i++){elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.innerHTML=value;}}
elem=0;}catch(e){}}
if(elem){this.empty().append(value);}},null,value,arguments.length);},replaceWith:function(){var ignored=[];return domManip(this,arguments,function(elem){var parent=this.parentNode;if(jQuery.inArray(this,ignored)<0){jQuery.cleanData(getAll(this));if(parent){parent.replaceChild(elem,this);}}},ignored);}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,ret=[],insert=jQuery(selector),last=insert.length-1,i=0;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);push.apply(ret,elems.get());}
return this.pushStack(ret);};});var iframe,elemdisplay={HTML:"block",BODY:"block"};function actualDisplay(name,doc){var elem=jQuery(doc.createElement(name)).appendTo(doc.body),display=jQuery.css(elem[0],"display");elem.detach();return display;}
function defaultDisplay(nodeName){var doc=document,display=elemdisplay[nodeName];if(!display){display=actualDisplay(nodeName,doc);if(display==="none"||!display){iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);doc=iframe[0].contentDocument;doc.write();doc.close();display=actualDisplay(nodeName,doc);iframe.detach();}
elemdisplay[nodeName]=display;}
return display;}
var rmargin=(/^margin/);var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles=function(elem){var view=elem.ownerDocument.defaultView;if(!view||!view.opener){view=window;}
return view.getComputedStyle(elem);};var swap=function(elem,options,callback,args){var ret,name,old={};for(name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
ret=callback.apply(elem,args||[]);for(name in options){elem.style[name]=old[name];}
return ret;};var documentElement=document.documentElement;(function(){var pixelPositionVal,boxSizingReliableVal,pixelMarginRightVal,reliableMarginLeftVal,container=document.createElement("div"),div=document.createElement("div");if(!div.style){return;}
div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";container.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;"+"padding:0;margin-top:1px;position:absolute";container.appendChild(div);function computeStyleTests(){div.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;"+"position:relative;display:block;"+"margin:auto;border:1px;padding:1px;"+"top:1%;width:50%";div.innerHTML="";documentElement.appendChild(container);var divStyle=window.getComputedStyle(div);pixelPositionVal=divStyle.top!=="1%";reliableMarginLeftVal=divStyle.marginLeft==="2px";boxSizingReliableVal=divStyle.width==="4px";div.style.marginRight="50%";pixelMarginRightVal=divStyle.marginRight==="4px";documentElement.removeChild(container);}
jQuery.extend(support,{pixelPosition:function(){computeStyleTests();return pixelPositionVal;},boxSizingReliable:function(){if(boxSizingReliableVal==null){computeStyleTests();}
return boxSizingReliableVal;},pixelMarginRight:function(){if(boxSizingReliableVal==null){computeStyleTests();}
return pixelMarginRightVal;},reliableMarginLeft:function(){if(boxSizingReliableVal==null){computeStyleTests();}
return reliableMarginLeftVal;},reliableMarginRight:function(){var ret,marginDiv=div.appendChild(document.createElement("div"));marginDiv.style.cssText=div.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;"+"display:block;margin:0;border:0;padding:0";marginDiv.style.marginRight=marginDiv.style.width="0";div.style.width="1px";documentElement.appendChild(container);ret=!parseFloat(window.getComputedStyle(marginDiv).marginRight);documentElement.removeChild(container);div.removeChild(marginDiv);return ret;}});})();function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);ret=computed?computed.getPropertyValue(name)||computed[name]:undefined;if((ret===""||ret===undefined)&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name);}
if(computed){if(!support.pixelMarginRight()&&rnumnonpx.test(ret)&&rmargin.test(name)){width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth;}}
return ret!==undefined?ret+"":ret;}
function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return;}
return(this.get=hookFn).apply(this,arguments);}};}
var
rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"],emptyStyle=document.createElement("div").style;function vendorPropName(name){if(name in emptyStyle){return name;}
var capName=name[0].toUpperCase()+name.slice(1),i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in emptyStyle){return name;}}}
function setPositiveNumber(elem,value,subtract){var matches=rcssNum.exec(value);return matches?Math.max(0,matches[2]-(subtract||0))+(matches[3]||"px"):value;}
function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i=extra===(isBorderBox?"border":"content")?4:name==="width"?1:0,val=0;for(;i<4;i+=2){if(extra==="margin"){val+=jQuery.css(elem,extra+cssExpand[i],true,styles);}
if(isBorderBox){if(extra==="content"){val-=jQuery.css(elem,"padding"+cssExpand[i],true,styles);}
if(extra!=="margin"){val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}else{val+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);if(extra!=="padding"){val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}}
return val;}
function getWidthOrHeight(elem,name,extra){var valueIsBorderBox=true,val=name==="width"?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox=jQuery.css(elem,"boxSizing",false,styles)==="border-box";if(val<=0||val==null){val=curCSS(elem,name,styles);if(val<0||val==null){val=elem.style[name];}
if(rnumnonpx.test(val)){return val;}
valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]);val=parseFloat(val)||0;}
return(val+
augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles))+"px";}
function showHide(elements,show){var display,elem,hidden,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue;}
values[index]=dataPriv.get(elem,"olddisplay");display=elem.style.display;if(show){if(!values[index]&&display==="none"){elem.style.display="";}
if(elem.style.display===""&&isHidden(elem)){values[index]=dataPriv.access(elem,"olddisplay",defaultDisplay(elem.nodeName));}}else{hidden=isHidden(elem);if(display!=="none"||!hidden){dataPriv.set(elem,"olddisplay",hidden?display:jQuery.css(elem,"display"));}}}
for(index=0;index<length;index++){elem=elements[index];if(!elem.style){continue;}
if(!show||elem.style.display==="none"||elem.style.display===""){elem.style.display=show?values[index]||"":"none";}}
return elements;}
jQuery.extend({cssHooks:{opacity:{get:function(elem,computed){if(computed){var ret=curCSS(elem,"opacity");return ret===""?"1":ret;}}}},cssNumber:{"animationIterationCount":true,"columnCount":true,"fillOpacity":true,"flexGrow":true,"flexShrink":true,"fontWeight":true,"lineHeight":true,"opacity":true,"order":true,"orphans":true,"widows":true,"zIndex":true,"zoom":true},cssProps:{"float":"cssFloat"},style:function(elem,name,value,extra){if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return;}
var ret,type,hooks,origName=jQuery.camelCase(name),style=elem.style;name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(origName)||origName);hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(value!==undefined){type=typeof value;if(type==="string"&&(ret=rcssNum.exec(value))&&ret[1]){value=adjustCSS(elem,name,ret);type="number";}
if(value==null||value!==value){return;}
if(type==="number"){value+=ret&&ret[3]||(jQuery.cssNumber[origName]?"":"px");}
if(!support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit";}
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){style[name]=value;}}else{if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret;}
return style[name];}},css:function(elem,name,extra,styles){var val,num,hooks,origName=jQuery.camelCase(name);name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(origName)||origName);hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];if(hooks&&"get"in hooks){val=hooks.get(elem,true,extra);}
if(val===undefined){val=curCSS(elem,name,styles);}
if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name];}
if(extra===""||extra){num=parseFloat(val);return extra===true||isFinite(num)?num||0:val;}
return val;}});jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function(elem,computed,extra){if(computed){return rdisplayswap.test(jQuery.css(elem,"display"))&&elem.offsetWidth===0?swap(elem,cssShow,function(){return getWidthOrHeight(elem,name,extra);}):getWidthOrHeight(elem,name,extra);}},set:function(elem,value,extra){var matches,styles=extra&&getStyles(elem),subtract=extra&&augmentWidthOrHeight(elem,name,extra,jQuery.css(elem,"boxSizing",false,styles)==="border-box",styles);if(subtract&&(matches=rcssNum.exec(value))&&(matches[3]||"px")!=="px"){elem.style[name]=value;value=jQuery.css(elem,name);}
return setPositiveNumber(elem,value,subtract);}};});jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,function(elem,computed){if(computed){return(parseFloat(curCSS(elem,"marginLeft"))||elem.getBoundingClientRect().left-
swap(elem,{marginLeft:0},function(){return elem.getBoundingClientRect().left;}))+"px";}});jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(elem,computed){if(computed){return swap(elem,{"display":"inline-block"},curCSS,[elem,"marginRight"]);}});jQuery.each({margin:"",padding:"",border:"Width"},function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function(value){var i=0,expanded={},parts=typeof value==="string"?value.split(" "):[value];for(;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0];}
return expanded;}};if(!rmargin.test(prefix)){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber;}});jQuery.fn.extend({css:function(name,value){return access(this,function(elem,name,value){var styles,len,map={},i=0;if(jQuery.isArray(name)){styles=getStyles(elem);len=name.length;for(;i<len;i++){map[name[i]]=jQuery.css(elem,name[i],false,styles);}
return map;}
return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name);},name,value,arguments.length>1);},show:function(){return showHide(this,true);},hide:function(){return showHide(this);},toggle:function(state){if(typeof state==="boolean"){return state?this.show():this.hide();}
return this.each(function(){if(isHidden(this)){jQuery(this).show();}else{jQuery(this).hide();}});}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing);}
jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||jQuery.easing._default;this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px");},cur:function(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this);},run:function(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration);}else{this.pos=eased=percent;}
this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this);}
if(hooks&&hooks.set){hooks.set(this);}else{Tween.propHooks._default.set(this);}
return this;}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(tween){var result;if(tween.elem.nodeType!==1||tween.elem[tween.prop]!=null&&tween.elem.style[tween.prop]==null){return tween.elem[tween.prop];}
result=jQuery.css(tween.elem,tween.prop,"");return!result||result==="auto"?0:result;},set:function(tween){if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween);}else if(tween.elem.nodeType===1&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit);}else{tween.elem[tween.prop]=tween.now;}}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now;}}};jQuery.easing={linear:function(p){return p;},swing:function(p){return 0.5-Math.cos(p*Math.PI)/2;},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var
fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;function createFxNow(){window.setTimeout(function(){fxNow=undefined;});return(fxNow=jQuery.now());}
function genFx(type,includeWidth){var which,i=0,attrs={height:type};includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type;}
if(includeWidth){attrs.opacity=attrs.width=type;}
return attrs;}
function createTween(value,prop,animation){var tween,collection=(Animation.tweeners[prop]||[]).concat(Animation.tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if((tween=collection[index].call(animation,prop,value))){return tween;}}}
function defaultPrefilter(elem,props,opts){var prop,value,toggle,tween,hooks,oldfire,display,checkDisplay,anim=this,orig={},style=elem.style,hidden=elem.nodeType&&isHidden(elem),dataShow=dataPriv.get(elem,"fxshow");if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire();}};}
hooks.unqueued++;anim.always(function(){anim.always(function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire();}});});}
if(elem.nodeType===1&&("height"in props||"width"in props)){opts.overflow=[style.overflow,style.overflowX,style.overflowY];display=jQuery.css(elem,"display");checkDisplay=display==="none"?dataPriv.get(elem,"olddisplay")||defaultDisplay(elem.nodeName):display;if(checkDisplay==="inline"&&jQuery.css(elem,"float")==="none"){style.display="inline-block";}}
if(opts.overflow){style.overflow="hidden";anim.always(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2];});}
for(prop in props){value=props[prop];if(rfxtypes.exec(value)){delete props[prop];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){if(value==="show"&&dataShow&&dataShow[prop]!==undefined){hidden=true;}else{continue;}}
orig[prop]=dataShow&&dataShow[prop]||jQuery.style(elem,prop);}else{display=undefined;}}
if(!jQuery.isEmptyObject(orig)){if(dataShow){if("hidden"in dataShow){hidden=dataShow.hidden;}}else{dataShow=dataPriv.access(elem,"fxshow",{});}
if(toggle){dataShow.hidden=!hidden;}
if(hidden){jQuery(elem).show();}else{anim.done(function(){jQuery(elem).hide();});}
anim.done(function(){var prop;dataPriv.remove(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop]);}});for(prop in orig){tween=createTween(hidden?dataShow[prop]:0,prop,anim);if(!(prop in dataShow)){dataShow[prop]=tween.start;if(hidden){tween.end=tween.start;tween.start=prop==="width"||prop==="height"?1:0;}}}}else if((display==="none"?defaultDisplay(elem.nodeName):display)==="inline"){style.display=display;}}
function propFilter(props,specialEasing){var index,name,easing,value,hooks;for(index in props){name=jQuery.camelCase(index);easing=specialEasing[name];value=props[index];if(jQuery.isArray(value)){easing=value[1];value=props[index]=value[0];}
if(index!==name){props[name]=value;delete props[index];}
hooks=jQuery.cssHooks[name];if(hooks&&"expand"in hooks){value=hooks.expand(value);delete props[name];for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing;}}}else{specialEasing[name]=easing;}}}
function Animation(elem,properties,options){var result,stopped,index=0,length=Animation.prefilters.length,deferred=jQuery.Deferred().always(function(){delete tick.elem;}),tick=function(){if(stopped){return false;}
var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),temp=remaining/animation.duration||0,percent=1-temp,index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent);}
deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining;}else{deferred.resolveWith(elem,[animation]);return false;}},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{},easing:jQuery.easing._default},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween;},stop:function(gotoEnd){var index=0,length=gotoEnd?animation.tweens.length:0;if(stopped){return this;}
stopped=true;for(;index<length;index++){animation.tweens[index].run(1);}
if(gotoEnd){deferred.notifyWith(elem,[animation,1,0]);deferred.resolveWith(elem,[animation,gotoEnd]);}else{deferred.rejectWith(elem,[animation,gotoEnd]);}
return this;}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=Animation.prefilters[index].call(animation,elem,props,animation.opts);if(result){if(jQuery.isFunction(result.stop)){jQuery._queueHooks(animation.elem,animation.opts.queue).stop=jQuery.proxy(result.stop,result);}
return result;}}
jQuery.map(props,createTween,animation);if(jQuery.isFunction(animation.opts.start)){animation.opts.start.call(elem,animation);}
jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));return animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);}
jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(prop,value){var tween=this.createTween(prop,value);adjustCSS(tween.elem,prop,rcssNum.exec(value),tween);return tween;}]},tweener:function(props,callback){if(jQuery.isFunction(props)){callback=props;props=["*"];}else{props=props.match(rnotwhite);}
var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];Animation.tweeners[prop]=Animation.tweeners[prop]||[];Animation.tweeners[prop].unshift(callback);}},prefilters:[defaultPrefilter],prefilter:function(callback,prepend){if(prepend){Animation.prefilters.unshift(callback);}else{Animation.prefilters.push(callback);}}});jQuery.speed=function(speed,easing,fn){var opt=speed&&typeof speed==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;if(opt.queue==null||opt.queue===true){opt.queue="fx";}
opt.old=opt.complete;opt.complete=function(){if(jQuery.isFunction(opt.old)){opt.old.call(this);}
if(opt.queue){jQuery.dequeue(this,opt.queue);}};return opt;};jQuery.fn.extend({fadeTo:function(speed,to,easing,callback){return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:to},speed,easing,callback);},animate:function(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function(){var anim=Animation(this,jQuery.extend({},prop),optall);if(empty||dataPriv.get(this,"finish")){anim.stop(true);}};doAnimation.finish=doAnimation;return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation);},stop:function(type,clearQueue,gotoEnd){var stopQueue=function(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd);};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined;}
if(clearQueue&&type!==false){this.queue(type||"fx",[]);}
return this.each(function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=dataPriv.get(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index]);}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index]);}}}
for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1);}}
if(dequeue||!gotoEnd){jQuery.dequeue(this,type);}});},finish:function(type){if(type!==false){type=type||"fx";}
return this.each(function(){var index,data=dataPriv.get(this),queue=data[type+"queue"],hooks=data[type+"queueHooks"],timers=jQuery.timers,length=queue?queue.length:0;data.finish=true;jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,true);}
for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(true);timers.splice(index,1);}}
for(index=0;index<length;index++){if(queue[index]&&queue[index].finish){queue[index].finish.call(this);}}
delete data.finish;});}});jQuery.each(["toggle","show","hide"],function(i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback);};});jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback);};});jQuery.timers=[];jQuery.fx.tick=function(){var timer,i=0,timers=jQuery.timers;fxNow=jQuery.now();for(;i<timers.length;i++){timer=timers[i];if(!timer()&&timers[i]===timer){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}
fxNow=undefined;};jQuery.fx.timer=function(timer){jQuery.timers.push(timer);if(timer()){jQuery.fx.start();}else{jQuery.timers.pop();}};jQuery.fx.interval=13;jQuery.fx.start=function(){if(!timerId){timerId=window.setInterval(jQuery.fx.tick,jQuery.fx.interval);}};jQuery.fx.stop=function(){window.clearInterval(timerId);timerId=null;};jQuery.fx.speeds={slow:600,fast:200,_default:400};jQuery.fn.delay=function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=window.setTimeout(next,time);hooks.stop=function(){window.clearTimeout(timeout);};});};(function(){var input=document.createElement("input"),select=document.createElement("select"),opt=select.appendChild(document.createElement("option"));input.type="checkbox";support.checkOn=input.value!=="";support.optSelected=opt.selected;select.disabled=true;support.optDisabled=!opt.disabled;input=document.createElement("input");input.value="t";input.type="radio";support.radioValue=input.value==="t";})();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(name,value){return access(this,jQuery.attr,name,value,arguments.length>1);},removeAttr:function(name){return this.each(function(){jQuery.removeAttr(this,name);});}});jQuery.extend({attr:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return;}
if(typeof elem.getAttribute==="undefined"){return jQuery.prop(elem,name,value);}
if(nType!==1||!jQuery.isXMLDoc(elem)){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(jQuery.expr.match.bool.test(name)?boolHook:undefined);}
if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);return;}
if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}
elem.setAttribute(name,value+"");return value;}
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}
ret=jQuery.find.attr(elem,name);return ret==null?undefined:ret;},attrHooks:{type:{set:function(elem,value){if(!support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}
return value;}}}},removeAttr:function(elem,value){var name,propName,i=0,attrNames=value&&value.match(rnotwhite);if(attrNames&&elem.nodeType===1){while((name=attrNames[i++])){propName=jQuery.propFix[name]||name;if(jQuery.expr.match.bool.test(name)){elem[propName]=false;}
elem.removeAttribute(name);}}}});boolHook={set:function(elem,value,name){if(value===false){jQuery.removeAttr(elem,name);}else{elem.setAttribute(name,name);}
return name;}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=function(elem,name,isXML){var ret,handle;if(!isXML){handle=attrHandle[name];attrHandle[name]=ret;ret=getter(elem,name,isXML)!=null?name.toLowerCase():null;attrHandle[name]=handle;}
return ret;};});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(name,value){return access(this,jQuery.prop,name,value,arguments.length>1);},removeProp:function(name){return this.each(function(){delete this[jQuery.propFix[name]||name];});}});jQuery.extend({prop:function(elem,name,value){var ret,hooks,nType=elem.nodeType;if(nType===3||nType===8||nType===2){return;}
if(nType!==1||!jQuery.isXMLDoc(elem)){name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];}
if(value!==undefined){if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}
return(elem[name]=value);}
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}
return elem[name];},propHooks:{tabIndex:{get:function(elem){var tabindex=jQuery.find.attr(elem,"tabindex");return tabindex?parseInt(tabindex,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:-1;}}},propFix:{"for":"htmlFor","class":"className"}});if(!support.optSelected){jQuery.propHooks.selected={get:function(elem){var parent=elem.parentNode;if(parent&&parent.parentNode){parent.parentNode.selectedIndex;}
return null;},set:function(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}};}
jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this;});var rclass=/[\t\r\n\f]/g;function getClass(elem){return elem.getAttribute&&elem.getAttribute("class")||"";}
jQuery.fn.extend({addClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,getClass(this)));});}
if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while((elem=this[i++])){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while((clazz=classes[j++])){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" ";}}
finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue);}}}}
return this;},removeClass:function(value){var classes,elem,cur,curValue,clazz,j,finalValue,i=0;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,getClass(this)));});}
if(!arguments.length){return this.attr("class","");}
if(typeof value==="string"&&value){classes=value.match(rnotwhite)||[];while((elem=this[i++])){curValue=getClass(elem);cur=elem.nodeType===1&&(" "+curValue+" ").replace(rclass," ");if(cur){j=0;while((clazz=classes[j++])){while(cur.indexOf(" "+clazz+" ")>-1){cur=cur.replace(" "+clazz+" "," ");}}
finalValue=jQuery.trim(cur);if(curValue!==finalValue){elem.setAttribute("class",finalValue);}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value;if(typeof stateVal==="boolean"&&type==="string"){return stateVal?this.addClass(value):this.removeClass(value);}
if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,getClass(this),stateVal),stateVal);});}
return this.each(function(){var className,i,self,classNames;if(type==="string"){i=0;self=jQuery(this);classNames=value.match(rnotwhite)||[];while((className=classNames[i++])){if(self.hasClass(className)){self.removeClass(className);}else{self.addClass(className);}}}else if(value===undefined||type==="boolean"){className=getClass(this);if(className){dataPriv.set(this,"__className__",className);}
if(this.setAttribute){this.setAttribute("class",className||value===false?"":dataPriv.get(this,"__className__")||"");}}});},hasClass:function(selector){var className,elem,i=0;className=" "+selector+" ";while((elem=this[i++])){if(elem.nodeType===1&&(" "+getClass(elem)+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret;}
ret=elem.value;return typeof ret==="string"?ret.replace(rreturn,""):ret==null?"":ret;}
return;}
isFunction=jQuery.isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,jQuery(this).val());}else{val=value;}
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+"";});}
hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val;}});}});jQuery.extend({valHooks:{option:{get:function(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:jQuery.trim(jQuery.text(elem)).replace(rspaces," ");}},select:{get:function(elem){var value,option,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one"||index<0,values=one?null:[],max=one?index+1:options.length,i=index<0?max:one?index:0;for(;i<max;i++){option=options[i];if((option.selected||i===index)&&(support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;},set:function(elem,value){var optionSet,option,options=elem.options,values=jQuery.makeArray(value),i=options.length;while(i--){option=options[i];if(option.selected=jQuery.inArray(jQuery.valHooks.option.get(option),values)>-1){optionSet=true;}}
if(!optionSet){elem.selectedIndex=-1;}
return values;}}}});jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(elem,value){if(jQuery.isArray(value)){return(elem.checked=jQuery.inArray(jQuery(elem).val(),value)>-1);}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){return elem.getAttribute("value")===null?"on":elem.value;};}});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(event,data,elem,onlyHandlers){var i,cur,tmp,bubbleType,ontype,handle,special,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=tmp=elem=elem||document;if(elem.nodeType===3||elem.nodeType===8){return;}
if(rfocusMorph.test(type+jQuery.event.triggered)){return;}
if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();namespaces.sort();}
ontype=type.indexOf(":")<0&&"on"+type;event=event[jQuery.expando]?event:new jQuery.Event(type,typeof event==="object"&&event);event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.rnamespace=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;event.result=undefined;if(!event.target){event.target=elem;}
data=data==null?[event]:jQuery.makeArray(data,[event]);special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return;}
if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode;}
for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur;}
if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window);}}
i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){event.type=i>1?bubbleType:special.bindType||type;handle=(dataPriv.get(cur,"events")||{})[event.type]&&dataPriv.get(cur,"handle");if(handle){handle.apply(cur,data);}
handle=ontype&&cur[ontype];if(handle&&handle.apply&&acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault();}}}
event.type=type;if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&acceptData(elem)){if(ontype&&jQuery.isFunction(elem[type])&&!jQuery.isWindow(elem)){tmp=elem[ontype];if(tmp){elem[ontype]=null;}
jQuery.event.triggered=type;elem[type]();jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp;}}}}
return event.result;},simulate:function(type,elem,event){var e=jQuery.extend(new jQuery.Event(),event,{type:type,isSimulated:true});jQuery.event.trigger(e,null,elem);}});jQuery.fn.extend({trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true);}}});jQuery.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 contextmenu").split(" "),function(i,name){jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name);};});jQuery.fn.extend({hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);}});support.focusin="onfocusin"in window;if(!support.focusin){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){var handler=function(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event));};jQuery.event.special[fix]={setup:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix);if(!attaches){doc.addEventListener(orig,handler,true);}
dataPriv.access(doc,fix,(attaches||0)+1);},teardown:function(){var doc=this.ownerDocument||this,attaches=dataPriv.access(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,true);dataPriv.remove(doc,fix);}else{dataPriv.access(doc,fix,attaches);}}};});}
var location=window.location;var nonce=jQuery.now();var rquery=(/\?/);jQuery.parseJSON=function(data){return JSON.parse(data+"");};jQuery.parseXML=function(data){var xml;if(!data||typeof data!=="string"){return null;}
try{xml=(new window.DOMParser()).parseFromString(data,"text/xml");}catch(e){xml=undefined;}
if(!xml||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data);}
return xml;};var
rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href;function addToPrefiltersOrTransports(structure){return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}
var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(func)){while((dataType=dataTypes[i++])){if(dataType[0]==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func);}else{(structure[dataType]=structure[dataType]||[]).push(func);}}}};}
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=(structure===transports);function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false;}else if(seekingTransport){return!(selected=dataTypeOrTransport);}});return selected;}
return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*");}
function ajaxExtend(target,src){var key,deep,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:(deep||(deep={})))[key]=src[key];}}
if(deep){jQuery.extend(true,target,deep);}
return target;}
function ajaxHandleResponses(s,jqXHR,responses){var ct,type,finalDataType,firstDataType,contents=s.contents,dataTypes=s.dataTypes;while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type");}}
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break;}}}
if(dataTypes[0]in responses){finalDataType=dataTypes[0];}else{for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break;}
if(!firstDataType){firstDataType=type;}}
finalDataType=finalDataType||firstDataType;}
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType);}
return responses[finalDataType];}}
function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},dataTypes=s.dataTypes.slice();if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv];}}
current=dataTypes.shift();while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response;}
if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType);}
prev=current;current=dataTypes.shift();if(current){if(current==="*"){current=prev;}else if(prev!=="*"&&prev!==current){conv=converters[prev+" "+current]||converters["* "+current];if(!conv){for(conv2 in converters){tmp=conv2.split(" ");if(tmp[1]===current){conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){if(conv===true){conv=converters[conv2];}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1]);}
break;}}}}
if(conv!==true){if(conv&&s.throws){response=conv(response);}else{try{response=conv(response);}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current};}}}}}}
return{state:"success",data:response};}
jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(target,settings){return settings?ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):ajaxExtend(jQuery.ajaxSettings,target);},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(url,options){if(typeof url==="object"){options=url;url=undefined;}
options=options||{};var transport,cacheURL,responseHeadersString,responseHeaders,timeoutTimer,urlAnchor,fireGlobals,i,s=jQuery.ajaxSetup({},options),callbackContext=s.context||s,globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),statusCode=s.statusCode||{},requestHeaders={},requestHeadersNames={},state=0,strAbort="canceled",jqXHR={readyState:0,getResponseHeader:function(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while((match=rheaders.exec(responseHeadersString))){responseHeaders[match[1].toLowerCase()]=match[2];}}
match=responseHeaders[key.toLowerCase()];}
return match==null?null:match;},getAllResponseHeaders:function(){return state===2?responseHeadersString:null;},setRequestHeader:function(name,value){var lname=name.toLowerCase();if(!state){name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value;}
return this;},overrideMimeType:function(type){if(!state){s.mimeType=type;}
return this;},statusCode:function(map){var code;if(map){if(state<2){for(code in map){statusCode[code]=[statusCode[code],map[code]];}}else{jqXHR.always(map[jqXHR.status]);}}
return this;},abort:function(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText);}
done(0,finalText);return this;}};deferred.promise(jqXHR).complete=completeDeferred.add;jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;s.url=((url||s.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//");s.type=options.method||options.type||s.method||s.type;s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(s.crossDomain==null){urlAnchor=document.createElement("a");try{urlAnchor.href=s.url;urlAnchor.href=urlAnchor.href;s.crossDomain=originAnchor.protocol+"//"+originAnchor.host!==urlAnchor.protocol+"//"+urlAnchor.host;}catch(e){s.crossDomain=true;}}
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);if(state===2){return jqXHR;}
fireGlobals=jQuery.event&&s.global;if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart");}
s.type=s.type.toUpperCase();s.hasContent=!rnoContent.test(s.type);cacheURL=s.url;if(!s.hasContent){if(s.data){cacheURL=(s.url+=(rquery.test(cacheURL)?"&":"?")+s.data);delete s.data;}
if(s.cache===false){s.url=rts.test(cacheURL)?cacheURL.replace(rts,"$1_="+nonce++):cacheURL+(rquery.test(cacheURL)?"&":"?")+"_="+nonce++;}}
if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL]);}
if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL]);}}
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType);}
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+
(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i]);}
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){return jqXHR.abort();}
strAbort="abort";for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i]);}
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}
if(state===2){return jqXHR;}
if(s.async&&s.timeout>0){timeoutTimer=window.setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}
try{state=1;transport.send(requestHeaders,done);}catch(e){if(state<2){done(-1,e);}else{throw e;}}}
function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;if(state===2){return;}
state=2;if(timeoutTimer){window.clearTimeout(timeoutTimer);}
transport=undefined;responseHeadersString=headers||"";jqXHR.readyState=status>0?4:0;isSuccess=status>=200&&status<300||status===304;if(responses){response=ajaxHandleResponses(s,jqXHR,responses);}
response=ajaxConvert(s,response,jqXHR,isSuccess);if(isSuccess){if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified;}
modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified;}}
if(status===204||s.type==="HEAD"){statusText="nocontent";}else if(status===304){statusText="notmodified";}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error;}}else{error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0;}}}
jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR]);}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error]);}
jqXHR.statusCode(statusCode);statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error]);}
completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);if(!(--jQuery.active)){jQuery.event.trigger("ajaxStop");}}}
return jqXHR;},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},getScript:function(url,callback){return jQuery.get(url,undefined,callback,"script");}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined;}
return jQuery.ajax(jQuery.extend({url:url,type:method,dataType:type,data:data,success:callback},jQuery.isPlainObject(url)&&url));};});jQuery._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",async:false,global:false,"throws":true});};jQuery.fn.extend({wrapAll:function(html){var wrap;if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstElementChild){elem=elem.firstElementChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();}});jQuery.expr.filters.hidden=function(elem){return!jQuery.expr.filters.visible(elem);};jQuery.expr.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0||elem.getClientRects().length>0;};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"&&v!=null?i:"")+"]",v,traditional,add);}});}else if(!traditional&&jQuery.type(obj)==="object"){for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add);}}else{add(prefix,obj);}}
jQuery.param=function(a,traditional){var prefix,s=[],add=function(key,value){value=jQuery.isFunction(value)?value():(value==null?"":value);s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);};if(traditional===undefined){traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional;}
if(jQuery.isArray(a)||(a.jquery&&!jQuery.isPlainObject(a))){jQuery.each(a,function(){add(this.name,this.value);});}else{for(prefix in a){buildParams(prefix,a[prefix],traditional,add);}}
return s.join("&").replace(r20,"+");};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this;}).filter(function(){var type=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}):{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest();}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&("withCredentials"in xhrSupported);support.ajax=xhrSupported=!!xhrSupported;jQuery.ajaxTransport(function(options){var callback,errorCallback;if(support.cors||xhrSupported&&!options.crossDomain){return{send:function(headers,complete){var i,xhr=options.xhr();xhr.open(options.type,options.url,options.async,options.username,options.password);if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i];}}
if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType);}
if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}
for(i in headers){xhr.setRequestHeader(i,headers[i]);}
callback=function(type){return function(){if(callback){callback=errorCallback=xhr.onload=xhr.onerror=xhr.onabort=xhr.onreadystatechange=null;if(type==="abort"){xhr.abort();}else if(type==="error"){if(typeof xhr.status!=="number"){complete(0,"error");}else{complete(xhr.status,xhr.statusText);}}else{complete(xhrSuccessStatus[xhr.status]||xhr.status,xhr.statusText,(xhr.responseType||"text")!=="text"||typeof xhr.responseText!=="string"?{binary:xhr.response}:{text:xhr.responseText},xhr.getAllResponseHeaders());}}};};xhr.onload=callback();errorCallback=xhr.onerror=callback("error");if(xhr.onabort!==undefined){xhr.onabort=errorCallback;}else{xhr.onreadystatechange=function(){if(xhr.readyState===4){window.setTimeout(function(){if(callback){errorCallback();}});}};}
callback=callback("abort");try{xhr.send(options.hasContent&&options.data||null);}catch(e){if(callback){throw e;}}},abort:function(){if(callback){callback();}}};}});jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, "+"application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(text){jQuery.globalEval(text);return text;}}});jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false;}
if(s.crossDomain){s.type="GET";}});jQuery.ajaxTransport("script",function(s){if(s.crossDomain){var script,callback;return{send:function(_,complete){script=jQuery("<script>").prop({charset:s.scriptCharset,src:s.url}).on("load error",callback=function(evt){script.remove();callback=null;if(evt){complete(evt.type==="error"?404:200,evt.type);}});document.head.appendChild(script[0]);},abort:function(){if(callback){callback();}}};}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var callback=oldCallbacks.pop()||(jQuery.expando+"_"+(nonce++));this[callback]=true;return callback;}});jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==false&&(rjsonp.test(s.url)?"url":typeof s.data==="string"&&(s.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(s.data)&&"data");if(jsonProp||s.dataTypes[0]==="jsonp"){callbackName=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;if(jsonProp){s[jsonProp]=s[jsonProp].replace(rjsonp,"$1"+callbackName);}else if(s.jsonp!==false){s.url+=(rquery.test(s.url)?"&":"?")+s.jsonp+"="+callbackName;}
s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called");}
return responseContainer[0];};s.dataTypes[0]="json";overwritten=window[callbackName];window[callbackName]=function(){responseContainer=arguments;};jqXHR.always(function(){if(overwritten===undefined){jQuery(window).removeProp(callbackName);}else{window[callbackName]=overwritten;}
if(s[callbackName]){s.jsonpCallback=originalSettings.jsonpCallback;oldCallbacks.push(callbackName);}
if(responseContainer&&jQuery.isFunction(overwritten)){overwritten(responseContainer[0]);}
responseContainer=overwritten=undefined;});return"script";}});jQuery.parseHTML=function(data,context,keepScripts){if(!data||typeof data!=="string"){return null;}
if(typeof context==="boolean"){keepScripts=context;context=false;}
context=context||document;var parsed=rsingleTag.exec(data),scripts=!keepScripts&&[];if(parsed){return[context.createElement(parsed[1])];}
parsed=buildFragment([data],context,scripts);if(scripts&&scripts.length){jQuery(scripts).remove();}
return jQuery.merge([],parsed.childNodes);};var _load=jQuery.fn.load;jQuery.fn.load=function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments);}
var selector,type,response,self=this,off=url.indexOf(" ");if(off>-1){selector=jQuery.trim(url.slice(off));url=url.slice(0,off);}
if(jQuery.isFunction(params)){callback=params;params=undefined;}else if(params&&typeof params==="object"){type="POST";}
if(self.length>0){jQuery.ajax({url:url,type:type||"GET",dataType:"html",data:params}).done(function(responseText){response=arguments;self.html(selector?jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):responseText);}).always(callback&&function(jqXHR,status){self.each(function(){callback.apply(this,response||[jqXHR.responseText,status,jqXHR]);});});}
return this;};jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(i,type){jQuery.fn[type]=function(fn){return this.on(type,fn);};});jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9&&elem.defaultView;}
jQuery.offset={setOffset:function(elem,options,i){var curPosition,curLeft,curCSSTop,curTop,curOffset,curCSSLeft,calculatePosition,position=jQuery.css(elem,"position"),curElem=jQuery(elem),props={};if(position==="static"){elem.style.position="relative";}
curOffset=curElem.offset();curCSSTop=jQuery.css(elem,"top");curCSSLeft=jQuery.css(elem,"left");calculatePosition=(position==="absolute"||position==="fixed")&&(curCSSTop+curCSSLeft).indexOf("auto")>-1;if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left;}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0;}
if(jQuery.isFunction(options)){options=options.call(elem,i,jQuery.extend({},curOffset));}
if(options.top!=null){props.top=(options.top-curOffset.top)+curTop;}
if(options.left!=null){props.left=(options.left-curOffset.left)+curLeft;}
if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({offset:function(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
var docElem,win,elem=this[0],box={top:0,left:0},doc=elem&&elem.ownerDocument;if(!doc){return;}
docElem=doc.documentElement;if(!jQuery.contains(docElem,elem)){return box;}
box=elem.getBoundingClientRect();win=getWindow(doc);return{top:box.top+win.pageYOffset-docElem.clientTop,left:box.left+win.pageXOffset-docElem.clientLeft};},position:function(){if(!this[0]){return;}
var offsetParent,offset,elem=this[0],parentOffset={top:0,left:0};if(jQuery.css(elem,"position")==="fixed"){offset=elem.getBoundingClientRect();}else{offsetParent=this.offsetParent();offset=this.offset();if(!jQuery.nodeName(offsetParent[0],"html")){parentOffset=offsetParent.offset();}
parentOffset.top+=jQuery.css(offsetParent[0],"borderTopWidth",true);parentOffset.left+=jQuery.css(offsetParent[0],"borderLeftWidth",true);}
return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",true),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",true)};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent;while(offsetParent&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.offsetParent;}
return offsetParent||documentElement;});}});jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top="pageYOffset"===prop;jQuery.fn[method]=function(val){return access(this,function(elem,method,val){var win=getWindow(elem);if(val===undefined){return win?win[prop]:elem[method];}
if(win){win.scrollTo(!top?val:win.pageXOffset,top?val:win.pageYOffset);}else{elem[method]=val;}},method,val,arguments.length);};});jQuery.each(["top","left"],function(i,prop){jQuery.cssHooks[prop]=addGetHookIf(support.pixelPosition,function(elem,computed){if(computed){computed=curCSS(elem,prop);return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed;}});});jQuery.each({Height:"height",Width:"width"},function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},function(defaultExtra,funcName){jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return access(this,function(elem,type,value){var doc;if(jQuery.isWindow(elem)){return elem.document.documentElement["client"+name];}
if(elem.nodeType===9){doc=elem.documentElement;return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name]);}
return value===undefined?jQuery.css(elem,type,extra):jQuery.style(elem,type,value,extra);},type,chainable?margin:undefined,chainable,null);};});});jQuery.fn.extend({bind:function(types,data,fn){return this.on(types,null,data,fn);},unbind:function(types,fn){return this.off(types,null,fn);},delegate:function(selector,types,data,fn){return this.on(types,selector,data,fn);},undelegate:function(selector,types,fn){return arguments.length===1?this.off(selector,"**"):this.off(types,selector||"**",fn);},size:function(){return this.length;}});jQuery.fn.andSelf=jQuery.fn.addBack;if(typeof define==="function"&&define.amd){define("jquery",[],function(){return jQuery;});}
var
_jQuery=window.jQuery,_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$;}
if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}
return jQuery;};if(!noGlobal){window.jQuery=window.$=jQuery;}
return jQuery;}));var CAJAX={};CAJAX.CurrentModule=null;CAJAX.Queue=[];CAJAX.Sending=false;CAJAX.Count=0;CAJAX.InitInterval=500;CAJAX.SendInterval=500;CAJAX.MaxSimultaneous=2;CAJAX.OnQueueComplete=null;CAJAX.QueueItem=function(ID,Data,Callbacks,Options){var self=this;self.ID=ID||CAJAX.Count++;self.Namespace=null;self.Data=Data||{};self.Options=Options||{};self.Callbacks=Callbacks||null;self.URL=null;};CAJAX.Add=function(Request,Data,Callbacks,Options){var Item=new CAJAX.QueueItem(CAJAX.Count++,Data,Callbacks,Options);if(Request.indexOf('/')>-1){Item.URL=Request;}else{Item.Namespace=Request;}
CAJAX.Queue.push(Item);if(CAJAX.Sending===false){CAJAX.OnLoop();}
return Item;};CAJAX.OnInit=function(){setTimeout(CAJAX.OnLoop,CAJAX.InitInterval);};CAJAX.OnLoop=function(){if(CAJAX.Queue.length<=0){CAJAX.Sending=false;return;}
if(CAJAX.Sending){setTimeout(CAJAX.OnLoop,CAJAX.SendInterval);return;}
CAJAX.Sending=true;var QueueItem=CAJAX.Queue[0];if(typeof(QueueItem.URL)==='undefined'||QueueItem.URL===null){if(typeof(QueueItem.Namespace)!=='undefined'&&QueueItem.Namespace!==null){QueueItem.URL='';var Parts=QueueItem.Namespace.split('.');var Website,Module,Action;switch(Parts.length){case 1:Module=this.CurrentModule;Action=QueueItem.Namespace;break;case 2:Module=Parts[0];Action=Parts[1];break;case 3:Website=Parts[0];Module=Parts[1];Action=Parts[2];break;case 4:Website=Parts[1];Module=Parts[2];Action=Parts[3];break;default:console.error('Invalid Namespace: '+QueueItem.Namespace);}
QueueItem.URL='/';QueueItem.URL+=Module;QueueItem.URL+='/';QueueItem.URL+=Action;}}
var Settings={url:QueueItem.URL,dataType:'json',xhr:CAJAX.CreateXHR,complete:CAJAX.OnComplete};if(typeof(QueueItem.Options.Synchronous)==='boolean'&&QueueItem.Options.Synchronous===true){Settings.async=false;}else{Settings.async=true;}
if(typeof(QueueItem.Options.Method)==='string'){Settings.type=QueueItem.Options.Method;}else{Settings.type='POST';}
if(typeof(QueueItem.Options.IsJSON)!=='boolean'||QueueItem.Options.IsJSON===true){if(typeof(QueueItem.Data)==='object'){if(Settings.type==='GET'){}else{Settings.contentType="application/json; charset=utf-8";QueueItem.Data=JSON.stringify(QueueItem.Data);}}}else{Settings.contentType="application/x-www-form-urlencoded; charset=utf-8";}
if(QueueItem.Options.IsUpload===true){var FileFormData=new FormData();FileFormData.append("file",QueueItem.Data.File);for(var i in QueueItem.Data){if(i==='File'){continue;}
FileFormData.append(i,QueueItem.Data[i]);}
QueueItem.Data=FileFormData;Settings.processData=false;Settings.contentType=false;}
if(typeof(QueueItem.Callbacks)==='object'&&typeof(QueueItem.Callbacks.OnBeforeSend)==='function'){Settings.beforeSend=QueueItem.Callbacks.OnBeforeSend;}
Settings.data=QueueItem.Data;if(typeof(QueueItem.Options.CrossDomainCookies)==='boolean'&&QueueItem.Options.CrossDomainCookies===true){Settings.xhrFields={withCredentials:true};}
var XHRObject=$.ajax(Settings);QueueItem.XHRObject=XHRObject;setTimeout(CAJAX.OnLoop,CAJAX.SendInterval);};CAJAX.CreateXHR=function(){var XHR=$.ajaxSettings.xhr();var Callbacks=CAJAX.Queue[0].Callbacks;if(typeof(Callbacks)==='object'&&typeof(Callbacks.OnUploadProgress)==='function'&&XHR.upload){XHR.upload.addEventListener('progress',Callbacks.OnUploadProgress,false);}
if(typeof(Callbacks)==='object'&&typeof(Callbacks.OnDownloadProgress)==='function'){XHR.addEventListener('progress',Callbacks.OnDownloadProgress,false);}
return XHR;};CAJAX.OnComplete=function(XHRObject,TextStatus){var OnSuccess,OnError,Successful=false;var Callbacks=CAJAX.Queue[0].Callbacks;XHRObject.TextStatus=TextStatus;if(typeof(Callbacks)==='function'){OnSuccess=Callbacks;OnError=Callbacks;}else{if(typeof(Callbacks)==='object'){if(typeof(Callbacks.OnSuccess)==='function'){OnSuccess=Callbacks.OnSuccess;}
if(typeof(Callbacks.OnError)==='function'){OnError=Callbacks.OnError;}}}
var Data=XHRObject.responseText;if(typeof(XHRObject.responseJSON)==='object'){Data=XHRObject.responseJSON;}
if(typeof(Data)==='object'&&typeof(Data.Debug)!=='undefined'&&typeof(console.log)==='function'){console.log(Data.Debug);CAJAX.Queue.reverse();CAJAX.Queue.pop();CAJAX.Queue.reverse();CAJAX.Sending=false;return;}
if(typeof(Data)==='object'&&typeof(Data.Fatal)==='boolean'&&Data.Fatal==true){console.log(Data);if(CAJAX.HandleErrorByCode(Data.ErrorCode,Data.Response,Data.Message,XHRObject)===false){CAJAX.OutputErrorToConsole(Data);}}
var ErrorData={Success:false,Message:'',Response:{}};switch(TextStatus){case'success':case'notmodified':if(typeof(Data.Success)==='boolean'&&Data.Success===true){Successful=true;}else{if(typeof(Data.Message)==='string'){ErrorData.Message=Data.Message;}
if(typeof(Data.Response)==='object'){ErrorData.Response=Data.Response;}}
break;case'nocontent':ErrorData.Message='The request did not contain a response.';break;case'error':ErrorData.Message='There was an error processing the request.';break;case'timeout':ErrorData.Message='The request timed out.';break
case'abort':ErrorData.Message='The request was aborted.';break;case'parseerror':ErrorData.Message='There was an error parsing the response data.';break;default:ErrorData.Message='An Unknown error occurred.';break;}
if(Successful===true){if(typeof(OnSuccess)==='function')OnSuccess(Data.Response,Data.Message,XHRObject);}else{if(typeof(Data)==='object'){if(typeof(Data.Message)==='string'){ErrorData.Message=Data.Message;}
if(typeof(Data.Response)==='object'){ErrorData.Response=Data.Response;}}
if(typeof(OnError)==='function'){OnError(ErrorData.Response,ErrorData.Message,XHRObject);}
if(typeof(ErrorData.Response.ErrorCode)==='string'){CAJAX.HandleErrorByCode(ErrorData.Response.ErrorCode,ErrorData.Response,ErrorData.Message,XHRObject);}}
CAJAX.Queue.reverse();CAJAX.Queue.pop();CAJAX.Queue.reverse();CAJAX.Sending=false;if(CAJAX.Queue.length===0&&typeof(CAJAX.OnQueueComplete)==='function'){CAJAX.OnQueueComplete();CAJAX.OnQueueComplete=null;}
CAJAX.OnLoop();};CAJAX.OnError=function(Data,TextStatus){var Callback=CAJAX.Queue[0].Callback;var CallbackInput=Data.responseText;if(typeof(Data.responseJSON)=='object'){CallbackInput=Data.responseJSON;if(typeof(CallbackInput.Debug)!=='undefined'&&typeof(console.log)==='function'){console.log(CallbackInput.Debug);}}
if(Callback)Callback(CallbackInput);CAJAX.Queue.reverse();CAJAX.Queue.pop();CAJAX.Queue.reverse();CAJAX.Sending=false;};CAJAX.HandleErrorByCode=function(ErrorCode,ResponseData,Message,XHRObject){switch(ErrorCode){case"02-00001":CPageNotice.SetNotice("Failure","This IP Address is banned.");return true;case"02-00200":CPageNotice.SetNotice("Failure","Sorry, you do not have permission to access this resource.");return true;case"02-00400":CPageNotice.SetNotice("Failure","Your session has expired. Click below to refresh the page.",{"Buttons":[{"Name":"Refresh","Callback":function(){window.location.reload(true);}}]});return true;case"02-00601":CPageNotice.SetNotice("Failure","Sorry, the password entered is invalid.");return true;case"02-00605":CPageNotice.SetNotice("Failure","Sorry, the requested user cannot be found.");return true;case"02-00606":case"00-00000":{CPageNotice.SetNotice("Failure",Message);return true;}}
return false;};CAJAX.OutputErrorToConsole=function(Data){if(typeof(console.group)!=='function'){return;}
console.group(Data.Message);if(typeof(Data.Response.Errors)!=='undefined'){for(var i in Data.Response.Errors){var ErrorProps=Data.Response.Errors[i]
console.log('Error Code:',ErrorProps.ErrorCode);if(typeof(ErrorProps.Message)!=='undefined'){console.log('Message:',ErrorProps.Message);}
if(typeof(ErrorProps.File)!=='undefined'){console.log('File:',ErrorProps.File+' @ '+ErrorProps.Line);}}}
if(typeof(Data.Response.StackTrace)!=='undefined'){console.groupCollapsed('Stack Trace:');if(typeof(console.table)==='function'){console.table(Data.Response.StackTrace);}else{for(var i in Data.Response.StackTrace){var TraceRow=Data.Response.StackTrace[i]
if(typeof(TraceRow.Function)!=='undefined'){console.log('Function:',TraceRow.Function);}
if(typeof(TraceRow.File)!=='undefined'){console.log('File:',TraceRow.File+' @ '+TraceRow.Line);}}}
console.groupEnd();}
console.groupEnd();};CAJAX.AddUpload=function(Request,File,Callbacks,Data,Options){if(typeof(Options)!=='object'){Options={};}
if(typeof(Options.IsUpload)!=='boolean'){Options.IsUpload=true;}
if(typeof(Options.IsJSON)!=='boolean'){Options.IsJSON=false;}
if(typeof(Data)!=='object'){Data={Source:'CAJAX.Upload'};}
Data.File=File;var Item=new CAJAX.QueueItem(CAJAX.Count++,Data,Callbacks,Options);if(Request.indexOf('/')>-1){Item.URL=Request;}else{Item.Namespace=Request;}
CAJAX.Queue.push(Item);if(CAJAX.Sending===false){CAJAX.OnLoop();}
return Item;};$(CAJAX.OnInit);var CUtil={};CUtil.UUID=function(){var DateRef=new Date().getTime();var UUID='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(Char){var Rand=(DateRef+Math.random()*16)%16|0;DateRef=Math.floor(DateRef/16);return(Char==='x'?Rand:(Rand&0x3|0x8)).toString(16);});return UUID;};CUtil.ToBoolean=function(Value){switch(typeof(Value)){case'undefined':return false;case'boolean':return Value;case'number':return!(Value===0);case'string':switch(Value){case'1':case'true':return true;case'':case'0':case'false':return false;}
return(Value!=='');case'object':if(Value===null||(Value instanceof Array&&Value.length===0)){return false;}
return true;}
return false;};CUtil.ToArray=function(ObjectRef){var ArrayRef=[];for(var i in ObjectRef){ArrayRef.push(ObjectRef[i]);}
return ArrayRef;};CUtil.Truncate=function(InputString,MaxLength,BreakAtWord,Ellipsis){if(Ellipsis===undefined){Ellipsis="&hellip;";}
var IsTooLong=InputString.length>MaxLength?true:false;var ModString=IsTooLong?InputString.substr(0,MaxLength-1):InputString;ModString=BreakAtWord&&IsTooLong?ModString.substr(0,ModString.lastIndexOf(' ')):ModString;return IsTooLong?ModString+Ellipsis:ModString;};CUtil.OrdinalSuffix=function(Number){if($.inArray(1*Number,[11,12,13])!==-1){return Number+'th';}
switch(Number.toString().slice(-1)){case'1':return Number+'st';case'2':return Number+'nd';case'3':return Number+'rd';default:return Number+'th';}};CUtil.Alphatize=function(Number){return String.fromCharCode(64+1*Number);};CUtil.ClockToMinutes=function(ClockTime){var Parts=ClockTime.split(':');return(Parts[0]*60)+(1*Parts[1]);};CUtil.MinutesToClock=function(Minutes){var Hours=Math.floor(Minutes/60);Minutes=Minutes%60;if(Hours<10){Hours='0'+Hours;}
if(Minutes<10){Minutes='0'+Minutes;}
return Hours+':'+Minutes;};CUtil.HtmlSpecialChars=function(string,quote_style,charset,double_encode){var optTemp=0,i=0,noquotes=false;if(typeof quote_style==='undefined'||quote_style===null){quote_style=2;}
string=string.toString();if(double_encode!==false){string=string.replace(/&/g,'&amp;');}
string=string.replace(/</g,'&lt;').replace(/>/g,'&gt;');var OPTS={'ENT_NOQUOTES':0,'ENT_HTML_QUOTE_SINGLE':1,'ENT_HTML_QUOTE_DOUBLE':2,'ENT_COMPAT':2,'ENT_QUOTES':3,'ENT_IGNORE':4};if(quote_style===0){noquotes=true;}
if(typeof quote_style!=='number'){quote_style=[].concat(quote_style);for(i=0;i<quote_style.length;i++){if(OPTS[quote_style[i]]===0){noquotes=true;}else if(OPTS[quote_style[i]]){optTemp=optTemp|OPTS[quote_style[i]];}}
quote_style=optTemp;}
if(quote_style&OPTS.ENT_HTML_QUOTE_SINGLE){string=string.replace(/'/g,'&#039;');}
if(!noquotes){string=string.replace(/"/g,'&quot;');}
return string;};CUtil.HtmlSpecialCharsDecode=function(string,quote_style){var optTemp=0,i=0,noquotes=false;if(typeof quote_style==='undefined'){quote_style=2;}
string=string.toString().replace(/&lt;/g,'<').replace(/&gt;/g,'>');var OPTS={'ENT_NOQUOTES':0,'ENT_HTML_QUOTE_SINGLE':1,'ENT_HTML_QUOTE_DOUBLE':2,'ENT_COMPAT':2,'ENT_QUOTES':3,'ENT_IGNORE':4};if(quote_style===0){noquotes=true;}
if(typeof quote_style!=='number'){quote_style=[].concat(quote_style);for(i=0;i<quote_style.length;i++){if(OPTS[quote_style[i]]===0){noquotes=true;}else if(OPTS[quote_style[i]]){optTemp=optTemp|OPTS[quote_style[i]];}}
quote_style=optTemp;}
if(quote_style&OPTS.ENT_HTML_QUOTE_SINGLE){string=string.replace(/&#0*39;/g,"'");}
if(!noquotes){string=string.replace(/&quot;/g,'"');}
string=string.replace(/&amp;/g,'&');return string;};CUtil.UniqID=function(prefix,more_entropy){if(typeof prefix==='undefined'){prefix='';}
var retId;var formatSeed=function(seed,reqWidth){seed=parseInt(seed,10).toString(16);if(reqWidth<seed.length){return seed.slice(seed.length-reqWidth);}
if(reqWidth>seed.length){return Array(1+(reqWidth-seed.length)).join('0')+seed;}
return seed;};if(!this.php_js){this.php_js={};}
if(!this.php_js.uniqidSeed){this.php_js.uniqidSeed=Math.floor(Math.random()*0x75bcd15);}
this.php_js.uniqidSeed++;retId=prefix;retId+=formatSeed(parseInt(new Date().getTime()/1000,10),8);retId+=formatSeed(this.php_js.uniqidSeed,5);if(more_entropy){retId+=(Math.random()*10).toFixed(8).toString();}
return retId;};CUtil.Array={};CUtil.Array.Values=function(input){var tmp_arr=[],key='';if(input&&typeof input==='object'&&input.change_key_case){return input.values();}
for(key in input){tmp_arr[tmp_arr.length]=input[key];}
return tmp_arr;};CUtil.Array.Keys=function(input,search_value,argStrict){var search=typeof search_value!=='undefined',tmp_arr=[],strict=!!argStrict,include=true,key='';if(input&&typeof input==='object'&&input.change_key_case){return input.keys(search_value,argStrict);}
for(key in input){if(input.hasOwnProperty(key)){include=true;if(search){if(strict&&input[key]!==search_value){include=false;}else if(input[key]!=search_value){include=false;}}
if(include){tmp_arr[tmp_arr.length]=key;}}}
return tmp_arr;};CUtil.Array.Intersect=function(arr1){var retArr={},argl=arguments.length,arglm1=argl-1,k1='',arr={},i=0,k='';arr1keys:for(k1 in arr1){arrs:for(i=1;i<argl;i++){arr=arguments[i];for(k in arr){if(arr[k]===arr1[k1]){if(i===arglm1){retArr[k1]=arr1[k1];}
continue arrs;}}
continue arr1keys;}}
return retArr;};CUtil.Array.IntersectKey=function(arr1){var retArr={},argl=arguments.length,arglm1=argl-1,k1='',arr={},i=0,k='';arr1keys:for(k1 in arr1){arrs:for(i=1;i<argl;i++){arr=arguments[i];for(k in arr){if(k===k1){if(i===arglm1){retArr[k1]=arr1[k1];}
continue arrs;}}
continue arr1keys;}}
return retArr;};CUtil.Array.DiffKey=function(arr1){var argl=arguments.length,retArr={},k1='',i=1,k='',arr={};arr1keys:for(k1 in arr1){for(i=1;i<argl;i++){arr=arguments[i];for(k in arr){if(k===k1){continue arr1keys;}}
retArr[k1]=arr1[k1];}}
return retArr;};CUtil.Array.Sum=function(array){var key,sum=0;if(typeof array!=='object'){return null;}
for(key in array){if(!isNaN(parseFloat(array[key]))){sum+=parseFloat(array[key]);}}
return sum;};CUtil.Array.Merge=function(){var args=Array.prototype.slice.call(arguments),argl=args.length,arg,retObj={},k='',argil=0,j=0,i=0,ct=0,toStr=Object.prototype.toString,retArr=true;for(i=0;i<argl;i++){if(toStr.call(args[i])!=='[object Array]'){retArr=false;break;}}
if(retArr){retArr=[];for(i=0;i<argl;i++){retArr=retArr.concat(args[i]);}
return retArr;}
for(i=0,ct=0;i<argl;i++){arg=args[i];if(toStr.call(arg)==='[object Array]'){for(j=0,argil=arg.length;j<argil;j++){retObj[ct++]=arg[j];}}else{for(k in arg){if(arg.hasOwnProperty(k)){if(parseInt(k,10)+''===k){retObj[ct++]=arg[k];}else{retObj[k]=arg[k];}}}}}
return retObj;};CUtil.GetURLURI=function(url){var uri='';if(url.indexOf("://")>-1){var pieces=url.split('://');var protocol=pieces[0];var domain=pieces[1].split("/")[0];uri=url.replace(protocol+"://","").replace(domain,"");}else{uri=url;}
if(uri.indexOf("://")>-1){return CUtil.GetURLURI(uri);}
return uri;};CUtil.GetURLParams=function(url){if(typeof(url)==="undefined")url=window.location.search;else{url=url.split("?",2);url="?"+url[1];}
var match,pl=/\+/g,search=/([^&=]+)=?([^&]*)/g,decode=function(s){return decodeURIComponent(s.replace(pl," "));},query=url.substring(1);var urlParams={};while(match=search.exec(query)){urlParams[decode(match[1])]=decode(match[2]);}
return urlParams;};CUtil.BuildURLParams=function(URLParams){if(typeof(URLParams)!=="object")return false;var URLParamString="?";for(var Key in URLParams){var URLParamName=Key.replace(/([^A-Za-z0-9\_]+)/g,"");URLParamString+=URLParamName+"="+encodeURIComponent(URLParams[Key])+"&";}
URLParamString=URLParamString.replace(/\&+$/,'');return URLParamString;};CUtil.IsTouchDevice=function(){return!!('ontouchstart'in window);};CUtil.DetectCSSFeature=function(featurename){var feature=false,domPrefixes='Webkit Moz ms O'.split(' '),elm=document.createElement('div'),featurenameCapital=null;featurename=featurename.toLowerCase();if(elm.style[featurename]!==undefined){feature=true;}
if(feature===false){featurenameCapital=featurename.charAt(0).toUpperCase()+featurename.substr(1);for(var i=0;i<domPrefixes.length;i++){if(elm.style[domPrefixes[i]+featurenameCapital]!==undefined){feature=true;break;}}}
return feature;};CUtil.SupportsHistoryAPI=function(){return!!(window.history&&history.pushState);};CUtil.FormatList=function(Data,KeyName,TextName,Options){var PreparedData=[];var ExpandArray=null;for(var Index in Data){if(!Data.hasOwnProperty(Index)){continue;}
var Row=Data[Index];if(typeof(Row)==='undefined'||Row===null){continue;}
if(ExpandArray===null){ExpandArray=(typeof(Row)!=='object');}
if(ExpandArray===true){PreparedData.push({Key:Index,Value:Index,Label:Row});continue;}
if(typeof(Row[KeyName])==='undefined'||typeof(Row[TextName])==='undefined'){console.error('Row is missing key or text values.');continue;}
PreparedData.push({Key:Row[KeyName],Value:Row[KeyName],Label:Row[TextName]});}
return PreparedData;};(function(){Date.prototype._formatReplaceChars={shortMonths:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],longMonths:['January','February','March','April','May','June','July','August','September','October','November','December'],shortDays:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],longDays:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d:function(){return(this.getDate()<10?'0':'')+this.getDate();},D:function(){return this._formatReplaceChars.shortDays[this.getDay()];},j:function(){return this.getDate();},l:function(){return this._formatReplaceChars.longDays[this.getDay()];},N:function(){return this.getDay()+1;},S:function(){return(this.getDate()%10==1&&this.getDate()!=11?'st':(this.getDate()%10==2&&this.getDate()!=12?'nd':(this.getDate()%10==3&&this.getDate()!=13?'rd':'th')));},w:function(){return this.getDay();},z:function(){var d=new Date(this.getFullYear(),0,1);return Math.ceil((this-d)/86400000);},W:function(){var d=new Date(this.getFullYear(),0,1);return Math.ceil((((this-d)/86400000)+d.getDay()+1)/7);},F:function(){return this._formatReplaceChars.longMonths[this.getMonth()];},m:function(){return(this.getMonth()<9?'0':'')+(this.getMonth()+1);},M:function(){return this._formatReplaceChars.shortMonths[this.getMonth()];},n:function(){return this.getMonth()+1;},t:function(){var d=new Date();return new Date(d.getFullYear(),d.getMonth(),0).getDate()},L:function(){var year=this.getFullYear();return(year%400==0||(year%100!=0&&year%4==0));},o:function(){var d=new Date(this.valueOf());d.setDate(d.getDate()-((this.getDay()+6)%7)+3);return d.getFullYear();},Y:function(){return this.getFullYear();},y:function(){return(''+this.getFullYear()).substr(2);},a:function(){return this.getHours()<12?'am':'pm';},A:function(){return this.getHours()<12?'AM':'PM';},B:function(){return Math.floor((((this.getUTCHours()+1)%24)+this.getUTCMinutes()/60+this.getUTCSeconds()/3600)*1000/24);},g:function(){return this.getHours()%12||12;},G:function(){return this.getHours();},h:function(){return((this.getHours()%12||12)<10?'0':'')+(this.getHours()%12||12);},H:function(){return(this.getHours()<10?'0':'')+this.getHours();},i:function(){return(this.getMinutes()<10?'0':'')+this.getMinutes();},s:function(){return(this.getSeconds()<10?'0':'')+this.getSeconds();},u:function(){var m=this.getMilliseconds();return(m<10?'00':(m<100?'0':''))+m;},e:function(){return"Not Yet Supported";},I:function(){var DST=null;for(var i=0;i<12;++i){var d=new Date(this.getFullYear(),i,1);var offset=d.getTimezoneOffset();if(DST===null)DST=offset;else if(offset<DST){DST=offset;break;}else if(offset>DST)break;}
return(this.getTimezoneOffset()==DST)|0;},O:function(){return(-this.getTimezoneOffset()<0?'-':'+')+(Math.abs(this.getTimezoneOffset()/60)<10?'0':'')+(Math.abs(this.getTimezoneOffset()/60))+'00';},P:function(){return(-this.getTimezoneOffset()<0?'-':'+')+(Math.abs(this.getTimezoneOffset()/60)<10?'0':'')+(Math.abs(this.getTimezoneOffset()/60))+':00';},T:function(){var m=this.getMonth();this.setMonth(0);var result=this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/,'$1');this.setMonth(m);return result;},Z:function(){return-this.getTimezoneOffset()*60;},c:function(){return this.format("Y-m-d\\TH:i:sP");},r:function(){return this.toString();},U:function(){return this.getTime()/1000;}};Date.prototype.format=function(format){var date=this;return format.replace(/(\\?)(.)/g,function(_,esc,chr){return(esc===''&&date._formatReplaceChars[chr])?date._formatReplaceChars[chr].call(date):chr;});};}).call(this);$(document).ready(function(){CTemplateGlobal.LoadTemplateList();});var CTemplateGlobal={DefaultNamespace:null,Namespaces:'',TemplatesLoaded:false,Templates:{},XMLObjects:{},ControlsAPI:{Each:'ParseEach',If:'ParseIf',IfNot:'ParseIfNot',Console:'ParseConsole',Dump:'ParseConsole',Template:'ParseDynamicTemplate',Clientscript:'Unsupported',JS:'Unsupported',Stylesheet:'Unsupported',CSS:'Unsupported',Cache:'Unsupported',Can:'Unsupported',Cannot:'Unsupported',Call:'Unsupported',Format:'ParseFormat'},ClosingTagFordidden:{'img':true,'input':true,'br':true,'hr':true,'frame':true,'area':true,'base':true,'basefont':true,'col':true,'isindex':true,'link':true,'meta':true,'param':true},BlacklistTags:{'script':true,'applet':true,'frame':true,'frameset':true},UrlAttributes:{'href':true,'src':true,'action':true,'archive':true,'data':true,'dsync':true,'icon':true,'manifest':true,'formaction':true,'cite':true,'background':true,'longdesc':true,'profile':true,'usemap':true,'classid':true,'codebase':true,'poster':true},CSSAttributes:{'style':true},JavascriptAttributes:{'onafterprint':true,'onbeforeprint':true,'onbeforeunload':true,'onerror':true,'onhashchange':true,'onload':true,'onmessage':true,'onoffline':true,'ononline':true,'onpagehide':true,'onpageshow':true,'onpopstate':true,'onresize':true,'onstorage':true,'onunload':true,'onblur':true,'onchange':true,'oncontextmenu':true,'onfocus':true,'oninput':true,'oninvalid':true,'onreset':true,'onsearch':true,'onselect':true,'onsubmit':true,'onkeydown':true,'onkeypress':true,'onkeyup':true,'onclick':true,'ondblclick':true,'ondrag':true,'ondragend':true,'ondragenter':true,'ondragleave':true,'ondragover':true,'ondragstart':true,'ondrop':true,'onmousedown':true,'onmousemove':true,'onmouseout':true,'onmouseover':true,'onmouseup':true,'onmousewheel':true,'onwheel':true,'onscroll':true,'oncopy':true,'oncut':true,'onpaste':true,'onabort':true,'oncanplay':true,'oncanplaythrough':true,'oncuechange':true,'ondurationchange':true,'onemptied':true,'onended':true,'onloadeddata':true,'onloadedmetadata':true,'onloadstart':true,'onpause':true,'onredo':true,'onplay':true,'onplaying':true,'onprogress':true,'onratechange':true,'onseeked':true,'onseeking':true,'onstalled':true,'onsuspend':true,'ontimeupdate':true,'onvolumechange':true,'onwaiting':true,'onshow':true,'ontoggle':true},CONTENT_POINTER:'{{Content}}',EnableConditionalComments:false,OnLoadEvents:[],LoadTemplateList:function(){var self=this;if(typeof(this.DefaultNamespace)==='undefined'||this.DefaultNamespace==null||this.DefaultNamespace==''){return;}
CAJAX.Add(this.DefaultNamespace,{Namespace:this.DefaultNamespace},{OnSuccess:function(Content){self.Templates=Content.Templates;self.TemplatesLoaded=true;for(var i=0;i<self.OnLoadEvents.length;i++){var OnLoadEvent=self.OnLoadEvents[i];if(typeof(OnLoadEvent)==='function'){OnLoadEvent();}}},OnError:function(){console.error('Unable to load clientside template content.');}},{Method:'GET'});},TemplateExists:function(TemplateName){if(!this.TemplatesLoaded){this.LoadTemplateList();}
if(typeof(this.Templates[TemplateName])!=='undefined'){return true;}
return false;},Load:function(TemplateName,Attributes,Params){return new CTemplateObject(TemplateName,Attributes,Params);},BuildNamespaces:function(){if(this.TemplatesLoaded&&this.Namespaces!==''){return this.Namespaces;}else{this.Namespaces='';}
for(var Control in this.ControlsAPI){var MethodName=this.ControlsAPI[Control];this.Namespaces+='xmlns:'+Control+'="'+MethodName+'" ';}
for(var Control in this.CoreTemplates){this.Namespaces+='xmlns:'+Control+'="'+Control+'" ';}
for(var Control in this.Templates){this.Namespaces+='xmlns:'+Control+'="'+Control+'" ';}
return this.Namespaces;},GetTemplateContent:function(TemplateName){return this.Templates[TemplateName].Content;},GetTemplateAttributes:function(TemplateName){return this.Templates[TemplateName].Attributes;},GetXMLObject:function(TemplateName){if(this.TemplatesLoaded&&typeof(this.XMLObjects[TemplateName])!=='undefined'){return this.XMLObjects[TemplateName];}
var XMLObject;if(typeof(this.XMLObjects[TemplateName])==='undefined'){var XMLString='<TEMPLATEROOT '+this.BuildNamespaces()+'>';XMLString+=this.GetTemplateContent(TemplateName);XMLString+='</TEMPLATEROOT>';try{XMLObject=$($.parseXML(XMLString)).children('TEMPLATEROOT');}catch(Exception){console.error('Unable to Load Template `'+TemplateName+'`',Exception);return false;}
if(this.TemplatesLoaded){this.XMLObjects[TemplateName]=XMLObject;}}else{XMLObject=this.XMLObjects[TemplateName];}
return XMLObject;},OnLoad:function(Callback){if(typeof(Callback)!=='function'){return;}
if(this.TemplatesLoaded){Callback();}else{this.OnLoadEvents.push(Callback);}}};var CTemplateObject=function(TemplateName,Attributes,Params){this.TemplateName=null;this.Attributes={};this.Parameters={};this.Pointer='';this.TemplateName=TemplateName;if(typeof(Params)==='object'){this.Parameters=Params;}
if(typeof(Attributes)==='object'){this.Attributes=Attributes;}
this.XMLObject=null;this.Init();return this;};CTemplateObject.prototype.Init=function(){this.XMLObject=CTemplateGlobal.GetXMLObject(this.TemplateName);return this;};CTemplateObject.prototype.Render=function(ReturnContent){var Content='';var ChildNodes=this.XMLObject.contents();if(ChildNodes.length>0){for(var i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i]);}}
if(typeof(ReturnContent)==='undefined'||ReturnContent===true){return Content;}
$(document.body).append(Content);return this;};CTemplateObject.prototype.GetElementParts=function(Element){if(typeof(Element)==='undefined'||Element===null){return{NodeType:0,NodeName:'',LocalName:'',Prefix:''};}
var NodeName=Element.nodeName;var LocalName=NodeName;var Prefix=null;var Index=NodeName.indexOf(":");if(Index>=0){Prefix=NodeName.slice(0,Index);LocalName=NodeName.slice(Index+1);}
return{NodeType:Element.nodeType,NodeName:NodeName.toLowerCase(),LocalName:LocalName,Prefix:Prefix};};CTemplateObject.prototype.ParseElement=function(Element,Params){if(typeof(Params)==='undefined'){Params={};}
var Parts=this.GetElementParts(Element);var Content='';var $Element=$(Element);switch(Parts.NodeType){case 1:if(Parts.Prefix!==null&&Parts.Prefix!==''){return this.ParseControl(Element,Params);}
if(typeof(CTemplateGlobal.BlacklistTags[Parts.NodeName])==='boolean'&&CTemplateGlobal.BlacklistTags[Parts.NodeName]===true){console.error("Tag '"+Parts.NodeName+"' is not allowed in template: "+this.TemplateName);return'';}
Content+='<'+Parts.NodeName+' ';var Attributes=Element.attributes;var Attribute,i,AttrName,Context,AttributeValue;for(i=0;i<Attributes.length;i++){Attribute=Attributes[i];AttrName=Attribute.name.toLowerCase();Context=COutputEncoder.CONTEXT_HTML_ATTRIBUTE;if(typeof(CTemplateGlobal.JavascriptAttributes[AttrName])==='boolean'&&CTemplateGlobal.JavascriptAttributes[AttrName]===true){console.error("Javascript event attribute '"+AttrName+"' is not allowed in template: "+this.TemplateName);continue;}
if(typeof(CTemplateGlobal.UrlAttributes[AttrName])==='boolean'&&CTemplateGlobal.UrlAttributes[AttrName]===true){Context=COutputEncoder.CONTEXT_HTML_URL;}else{if(typeof(CTemplateGlobal.CSSAttributes[AttrName])==='boolean'&&CTemplateGlobal.CSSAttributes[AttrName]===true){Context=COutputEncoder.CONTEXT_CSS;}}
AttributeValue=CPointerParser.ParsePointerString(Attribute.value,Params,Context,this);if(typeof(AttributeValue)!=='undefined'&&AttributeValue!==null&&AttributeValue!==''){if(typeof(Attribute.prefix)!=='undefined'&&Attribute.prefix!==null&&Attribute.prefix!==''){Content+=Attribute.prefix;Content+=':';}
Content+=Attribute.name;Content+='="';Content+=AttributeValue;Content+='" ';}}
if(typeof(CTemplateGlobal.ClosingTagFordidden[Parts.NodeName])==='boolean'&&CTemplateGlobal.ClosingTagFordidden[Parts.NodeName]===true){Content+='/>';}else{Content+='>';var ChildNodes=$Element.contents();if(ChildNodes.length>0){for(i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i],Params);}}
Content+='</'+Parts.NodeName+'>';}
break;case 3:var TextValue=CPointerParser.ParsePointerString($Element.text(),Params,COutputEncoder.CONTEXT_HTML,this);if(typeof(TextValue)!=='undefined'&&TextValue!==''){Content+=TextValue;}
break;case 4:var TextValue=CPointerParser.ParsePointerString($Element.text(),Params,COutputEncoder.CONTEXT_HTML,this);if(typeof(TextValue)!=='undefined'&&TextValue!==''){Content+=TextValue;}
break;case 8:if(CTemplateGlobal.EnableConditionalComments&&Element.nodeValue.indexOf('[')===0){Content+="\r\n"+'<!--'+CPointerParser.ParsePointerString(Element.nodeValue,Params,COutputEncoder.CONTEXT_HTML,this)+'-->'+"\r\n";}
break;}
return Content;};CTemplateObject.prototype.ParseControl=function(Element,Params){if(typeof(Params)==='undefined'){Params={};}
var Parts=this.GetElementParts(Element);if(typeof(CTemplateGlobal.ControlsAPI[Parts.Prefix])!=='undefined'&&typeof(this[CTemplateGlobal.ControlsAPI[Parts.Prefix]])==='function'){var ControlPointer=CPointerParser.ParsePointer(Parts.LocalName,Params,this);var MethodName=CTemplateGlobal.ControlsAPI[Parts.Prefix];return this[MethodName](ControlPointer,Element,Params);}
if(typeof(CTemplateGlobal.Templates[Parts.Prefix])!=='undefined'){return this.ParseTemplate(Element,Params);}
return'';};CTemplateObject.prototype.ParseTemplate=function(Element,Params){if(typeof(Params)==='undefined'){Params={};}
var Parts=this.GetElementParts(Element);if(typeof(CTemplateGlobal.Templates[Parts.Prefix])==='undefined'){return'';}
var Attributes,Attribute,AttributeValue,$Element=$(Element),ObjectName=null,DataSource,ElementAttributes,ChildNodes,i,Content,Parameters={},ParamName,Template;ElementAttributes=$Element[0].attributes;Attributes=$.extend({},CTemplateGlobal.GetTemplateAttributes(Parts.Prefix));for(i=0;i<ElementAttributes.length;i++){Attribute=ElementAttributes[i];switch(Attribute.name){case'as':ObjectName=CPointerParser.ParsePointerString(Attribute.value,Params,null,this);Attributes.as=ObjectName;break;case'datasource':DataSource=CPointerParser.ParsePointerString(Attribute.value,Params,null,this);Params.DataSource=CPointerParser.ParsePointer(DataSource,Params,this);break;default:Attributes[Attribute.name]=CPointerParser.ParsePointerString(Attribute.value,Params,null,this);break;}}
if(Parts.LocalName!=='Parameters'&&Parts.LocalName!=='Params'){var ControlPointer=CPointerParser.ParsePointer(Parts.LocalName,Params,this);if(typeof(ControlPointer)==='object'){Params.Data=ControlPointer;Params.Value=null;}else{Params.Value=ControlPointer;Params.Data=null;}
if(typeof(ObjectName)==='string'){Params[ObjectName]=ControlPointer;}}
ChildNodes=$Element.contents();if(ChildNodes.length>0){Content='';for(i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i],$.extend({},Params));}
Params.Content=Content;}else{Params.Content=null;}
for(ParamName in this.Parameters){Parameters[ParamName]=this.Parameters[ParamName];}
for(ParamName in Params){Parameters[ParamName]=Params[ParamName];}
Template=CTemplateGlobal.Load(Parts.Prefix,Attributes,Parameters);if(Parts.LocalName.toLowerCase()=='pointerreference'){Template.Pointer=this.Pointer;}else{Template.Pointer=Parts.LocalName;}
return Template.Render(true);};CTemplateObject.prototype.ParseEach=function(Collection,Element,Params){var ObjectName='Data',KeyName='Key',ParentName='Parent',NumberName='Number',Limit=null,OrderBy=null,Key,Keys,$Element,Limit,Content,Number,ObjectReference,i,ChildNodes,Length,Index;if(Collection!==null&&typeof(Collection)==='object'&&typeof(Collection.Value)!=='undefined'){Collection=Collection.Value;}
if(typeof(Params)==='undefined'){Params={};}
if(typeof(Collection)==='undefined'||Collection===null||typeof(Collection)!=='object'){return'';}
if(Collection instanceof CCollection){Collection=Collection.ToArray();}
$Element=$(Element);if($Element.attr('as')){ObjectName=CPointerParser.ParsePointerString($Element.attr('as'),Params,null,this);}
if($Element.attr('key')){KeyName=CPointerParser.ParsePointerString($Element.attr('key'),Params,null,this);}
if($Element.attr('number')){NumberName=CPointerParser.ParsePointerString($Element.attr('number'),Params,null,this);}
if($Element.attr('parent')){ParentName=CPointerParser.ParsePointerString($Element.attr('parent'),Params,null,this);}
Limit=null;if($Element.attr('limit')){Limit=1*CPointerParser.ParsePointerString($Element.attr('limit'),Params,null,this);}
if($Element.attr('order')){OrderBy=CPointerParser.ParsePointerString($Element.attr('order'),Params,null,this);}
if(OrderBy!==null){Collection=Multisort(Collection,OrderBy);}
Content='';Params[ParentName]=this;Number=1;if(Collection instanceof Array){Length=Collection.length;Keys=Object.keys(Collection);}else{if(Collection instanceof CCollection){Length=Collection.Count();Collection=Collection.ToArray();Keys=Object.keys(Collection);}else{Keys=Object.keys(Collection);Length=Keys.length;}}
Index=-1;while(Length--){Key=Keys[++Index];ObjectReference=Collection[Key];Params.Data=ObjectReference;if(ObjectName!=='Data'){Params[ObjectName]=ObjectReference;}
Params[KeyName]=Key;Params[NumberName]=Number;ChildNodes=$Element.contents();if(ChildNodes.length>0){for(i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i],Params);}}
if(Limit!==null&&Number>=Limit){break;}
Number++;}
return Content;};CTemplateObject.prototype.ParseIf=function(Value,Element,Params){var Comparison,ComparisonValue;if(typeof(Params)==='undefined'){Params={};}
var Content='';var $Element=$(Element);if(Value!==null&&typeof(Value)==='object'&&typeof(Value.Value)!=='undefined'){Value=Value.Value;}
if($Element.attr('value')){ComparisonValue=CPointerParser.ParsePointerString($Element.attr('value'),Params,null,this);if(typeof(Value)==='object'){if(Value instanceof Array){Comparison=(Value.indexOf(ComparisonValue)!==-1);}else{Comparison=false;for(var ObjKey in Value){if(Value.hasOwnProperty(ObjKey)&&Value[ObjKey]==ComparisonValue){Comparison=true;break;}}}}else{Comparison=(Value==ComparisonValue)?true:false;}}else{Comparison=CUtil.ToBoolean(Value);}
if(Comparison===true){var ChildNodes=$Element.contents();if(ChildNodes.length>0){for(var i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i],Params);}}}
return Content;};CTemplateObject.prototype.ParseIfNot=function(Value,Element,Params){var Comparison,ComparisonValue;if(Value!==null&&typeof(Value)==='object'&&typeof(Value.Value)!=='undefined'){Value=Value.Value;}
if(typeof(Params)==='undefined'){Params={};}
var Content='';var $Element=$(Element);if($Element.attr('value')){ComparisonValue=CPointerParser.ParsePointerString($Element.attr('value'),Params,null,this);if(typeof(Value)==='object'){if(Value instanceof Array){Comparison=(Value.indexOf(ComparisonValue)===-1);}else{Comparison=true;for(var ObjKey in Value){if(Value.hasOwnProperty(ObjKey)&&Value[ObjKey]==ComparisonValue){Comparison=false;break;}}}}else{Comparison=(Value!=ComparisonValue)?true:false;}}else{Comparison=!CUtil.ToBoolean(Value);}
if(Comparison===true){var ChildNodes=$Element.contents();if(ChildNodes.length>0){for(var i=0;i<ChildNodes.length;i++){Content+=this.ParseElement(ChildNodes[i],Params);}}}
return Content;};CTemplateObject.prototype.ParseConsole=function(Value,Element,Params){if(typeof(console)!=='undefined'&&typeof(console.log)==='function'){console.log(Value);}
return'';};CTemplateObject.prototype.ParseDynamicTemplate=function(Value,Element,Params){var TemplateName,i,Attributes,AttributeValue,ParamName,Parameters;TemplateName=Element.attributes.getNamedItem("template-name");if(typeof(TemplateName)==='undefined'||TemplateName===null){console.error('Dynanic template controls must have a defined template name');return'';}
TemplateName=CPointerParser.ParsePointerString(TemplateName.value,Params,null,this);if(!CTemplateGlobal.TemplateExists(TemplateName))return'';Attributes=$.extend({},CTemplateGlobal.GetTemplateAttributes(TemplateName));for(i=0;i<Element.attributes.length;i++){if(Element.attributes[i].name==="template-name")continue;AttributeValue=CPointerParser.ParsePointerString(Element.attributes[i].value,Params,null,this);if(typeof(AttributeValue)!=='undefined'&&AttributeValue!==null&&AttributeValue!==''){Attributes[Element.attributes[i].name]=AttributeValue;}}
if(typeof(Value)==='object'){Params.Data=Value;}else{Params.Value=Value;}
Parameters={};for(ParamName in this.Parameters){Parameters[ParamName]=this.Parameters[ParamName];}
for(ParamName in Params){Parameters[ParamName]=Params[ParamName];}
var Template=CTemplateGlobal.Load(TemplateName,Attributes,Parameters);return Template.Render();};CTemplateObject.prototype.ParseFormat=function(Value,Element,Params){var Content='';if(typeof(Value)==='object'&&Value instanceof CObjectAttribute){Value=Value.Value;}
var ValidationType=null;var DefinitionValue=null;var ValidationOptions={};for(var i=0;i<Element.attributes.length;i++){var AttributeValue=CPointerParser.ParsePointerString(Element.attributes[i].value,Params,null,this);if(typeof(AttributeValue)==='undefined'||AttributeValue===null||AttributeValue===''){continute;}
switch(Element.attributes[i].name){case'type':var ValidationType=AttributeValue;break;case'value':var DefinitionValue=AttributeValue;default:ValidationOptions[Element.attributes[i].name]=AttributeValue;}}
if(ValidationType===null){console.warn("Missing format type for control in template "+this.TemplateName);return'';}
ValidationType=ValidationType.toLowerCase();if(!CValidationObject.prototype.IsValidType(ValidationType)){console.warn("Invalid format type: "+ValidationType);return'';}
return CValidationObject.prototype.FormatDefinition(Value,ValidationType,DefinitionValue,ValidationOptions);};CTemplateObject.prototype.Unsupported=function(Value,Element,Params){console.warn('This template feature is not supported: '+Element.nodeName);return'';};CTemplateObject.prototype.SetParameter=function(Name,Value){this.Parameters[Name]=Value;return this;};CTemplateObject.prototype.SetParameters=function(Params){if(typeof(Params)!=='undefined'&&Params!==null&&typeof(Params)==='object'){for(var Name in Params){this.Parameters[Name]=Params[Name];}}
return this;};var CPointerParser={EncodingContext:null,PointerEncoder:false,CONTROL_PATTERN:/{{[A-Za-z0-9'_,\.\|\:\[\]\=]*}}/g,PARAMETER_PATTERN:/\[[A-Za-z0-9'_,\.\=]*\]/g};CPointerParser.ParsePointerString=function(TemplateString,Params,Context,PrimaryReference){if(typeof(TemplateString)==='undefined'||TemplateString===null||TemplateString===''){return'';}
if(typeof(Params)==='undefined'){Params={};}
var Matches=TemplateString.match(this.CONTROL_PATTERN);if(typeof(Matches)==='undefined'||Matches===null||Matches.length===0){return TemplateString;}
var i,MatchingString,FullPointer,PointerList,ControlPosition,Pointer,PointerValue,PointerFunction,PointerTarget,ParamCount,ParamList,BinderPosition,ParamValue;for(i=0;i<Matches.length;i++){MatchingString=Matches[i];FullPointer=MatchingString.slice(2,-2);if(FullPointer.indexOf("||")!==-1){PointerList=FullPointer.split("||");}else{PointerList=[FullPointer];}
for(var j=0;j<PointerList.length;j++){Pointer=PointerList[j];ControlPosition=Pointer.indexOf(':');if(ControlPosition!==-1){PointerFunction=Pointer.substr(0,ControlPosition);PointerTarget=Pointer.substr(ControlPosition+1);this.PARAMETER_PATTERN.lastIndex=0;var ParamMatches=this.PARAMETER_PATTERN.exec(PointerTarget);var ParamList=[];if(typeof(ParamMatches)!=='undefined'&&ParamMatches!==null&&ParamMatches.length!==0){var ParamNameList=ParamMatches[0].slice(1,-1).split(',');PointerTarget=PointerTarget.slice(0,ParamMatches.index);for(var k in ParamNameList){var ParamString=ParamNameList[k];var BinderPosition=ParamString.indexOf('=');if(BinderPosition===-1){if(ParamString.indexOf("'")!==-1||CValidators.Numeric(ParamString)){var ParamValue=ParamString.replace(/'/g,'');}else{var ParamValue=this.ParsePointer(ParamString,Params,PrimaryReference);}
if(ParamValue===null||typeof(ParamValue)==='undefined'){continue;}
switch(typeof(ParamValue)){case'string':ParamList.push(ParamValue);break;case'array':ParamList=ParamList.concat(ParamValue);break;case'object':if(ParamValue instanceof CObject){ParamList=ParamList.concat(ParamValue.ToArray());}
break;}}else{var ParamParts=ParamString.split('=');if(ParamParts[1].indexOf("'")!==-1||CValidators.Numeric(ParamParts[1])){ParamList[ParamParts[0]]=ParamParts[1].replace(/'/g,'');}else{ParamList[ParamParts[0]]=this.ParsePointer(ParamParts[1],Params,PrimaryReference);}}}}
switch(PointerFunction){case'DangerouslyAllowUnsafeString':PointerValue=this.ParsePointer(PointerTarget,Params,PrimaryReference);break;case'URL':case'NS':console.warn('Template pointer function is not supported: '+PointerFunction+':'+PointerTarget);break;case'Format':var PointerValue=this.ParsePointer(PointerTarget,Params,PrimaryReference);if(PointerValue===null){break;}
if(PointerValue instanceof CObjectAttribute){PointerValue=PointerValue.Value;}
if(ParamList.length===0){console.warn('Missing format type for pointer '+PointerFunction+':'+PointerTarget+' in template '+PrimaryReference.TemplateName);return'';}
var ValidationType=ParamList[0];var DefinitionValue=null;ValidationType=ValidationType.toLowerCase();if(!CValidationObject.prototype.IsValidType(ValidationType)){console.warn('Invalid format type for pointer '+PointerFunction+':'+PointerTarget+' in template '+PrimaryReference.TemplateName);return'';}
ParamList.shift();var ValidationOptions=null;if(ParamList.length!==0){ValidationOptions=ParamList;}
PointerValue=CValidationObject.prototype.FormatDefinition(PointerValue,ValidationType,DefinitionValue,ValidationOptions);break;default:console.warn('Invalid Pointer function: '+PointerFunction+':'+PointerTarget+' in temlate '+PrimaryReference.TemplateName);return'';}}else{PointerValue=this.ParsePointer(PointerList[j],Params,PrimaryReference,Context);}
if(PointerValue!==null&&typeof(PointerValue)==='object'){if(PointerValue instanceof CObjectAttribute){PointerValue=PointerValue.Encode(Context);}else{if(typeof(PointerValue.Value)!=='undefined'){if(typeof(Context)!=='undefined'&&Context!==null){PointerValue=COutputEncoder.Encode(PointerValue.Value,Context);}else{PointerValue=PointerValue.Value;}}}}
if(typeof(PointerValue)!=='undefined'&&PointerValue!==null)break;}
if(typeof(PointerValue)==='undefined'||PointerValue===null){PointerValue='';}
TemplateString=TemplateString.replace(MatchingString,PointerValue);}
return TemplateString;};CPointerParser.ParsePointer=function(Name,Params,TemplateObject,Context){if(typeof(Params)==='undefined'){Params={};}
this.EncodingContext=Context;this.PointerEncoded=false;var Parts=Name.split('.');var PointerRef=this.ParsePointerInitial(Parts[0],Params,TemplateObject);for(var i=1;i<Parts.length;i++){var Part=Parts[i];if(typeof(PointerRef)==='object'&&PointerRef!==null){if(PointerRef instanceof Array){PointerRef=this.ParsePointerArray(PointerRef,Part);}else{PointerRef=this.ParsePointerObject(PointerRef,Part);}
continue;}
return null;}
if(this.PointerEncoded===false&&typeof(Context)!=='undefined'&&Context!==null&&PointerRef!==null&&PointerRef!==''){return COutputEncoder.Encode(PointerRef,Context);}
return PointerRef;};CPointerParser.ParsePointerInitial=function(Part,Params,TemplateObject){var lcPart=(''+Part).toLowerCase();switch(lcPart){case'this':return TemplateObject;case'params':case'parameters':return TemplateObject.Parameters;case'attr':case'attribute':case'attributes':return TemplateObject.Attributes;case'pointername':var PointerParts=TemplateObject.Pointer.split('.');PointerParts.pop();return PointerParts.join('.');case'pointerreference':return this.ParsePointer(TemplateObject.Pointer,Params);case'parent':if(typeof(TemplateObject.Parameters.Data)==='object'&&TemplateObject.Parameters.Data!==null&&typeof(TemplateObject.Parameters.Data.Parent)==='object'&&TemplateObject.Parameters.Data.Parent!==null){return TemplateObject.Parameters.Data.Parent;}
var PointerParts=TemplateObject.Pointer.split('.');PointerParts.pop();return this.ParsePointer(PointerParts.join('.'),Params,TemplateObject);}
if(typeof(Params[Part])!=='undefined'&&Params[Part]!==null&&typeof(Params[Part])!=='function'){return Params[Part];}
if(typeof(TemplateObject.Parameters[Part])!=='undefined'&&TemplateObject.Parameters[Part]!==null&&typeof(TemplateObject.Parameters[Part])!=='function'){return TemplateObject.Parameters[Part];}
if(typeof(TemplateObject[Part])!=='undefined'&&TemplateObject[Part]!==null&&typeof(TemplateObject[Part])!=='function'){return TemplateObject[Part];}
if(typeof(TemplateObject.Parameters.Data)==='object'&&TemplateObject.Parameters.Data!==null){var PointerRef=TemplateObject.Parameters.Data;if(PointerRef instanceof Array){return this.ParsePointerArray(PointerRef,Part);}else{if(PointerRef instanceof CObjectAttribute){if(lcPart==='value'&&typeof(PointerRef.Value)!=='undefined'){if(typeof(this.EncodingContext)!=='undefined'&&this.EncodingContext!==null){PointerRef=PointerRef.Encode(this.EncodingContext);this.PointerEncoded=true;return PointerRef;}
return PointerRef.Value;}
if(lcPart==='label'&&typeof(PointerRef.Label)!=='undefined'){return PointerRef.Label;}
if(lcPart==='name'&&typeof(PointerRef.Name)!=='undefined'){return PointerRef.Name;}
if(lcPart==='definitions'&&typeof(PointerRef.Definitions)!=='undefined'){return PointerRef.Definitions;}}}}
return null;};CPointerParser.ParsePointerObject=function(PointerRef,Part){if(PointerRef instanceof CObject){return this.ParsePointerCObject(PointerRef,Part);}
if(PointerRef instanceof CObjectAttribute){if(typeof(PointerRef[Part])!=='undefined'){return PointerRef[Part];}
return PointerRef.Value;}
if(PointerRef instanceof CCollection){return this.ParsePointerCCollection(PointerRef,Part);}
if(typeof(PointerRef[Part])!=='undefined'&&typeof(PointerRef[Part])!=='function'){return PointerRef[Part];}
var MethodName='Get'+Part;if(typeof(PointerRef[MethodName])==='function'){var FunctionPointer=PointerRef[MethodName];return FunctionPointer();}
var lcPart=Part.toLowerCase();switch(lcPart){case'json':return PointerRef.ToJSON();}
return null;};CPointerParser.ParsePointerCObject=function(PointerRef,Part){if(typeof(PointerRef[Part])!=='undefined'&&typeof(PointerRef[Part])!=='function'){return PointerRef[Part];}
var MethodName='Get'+Part;if(typeof(PointerRef[MethodName])==='function'){var FunctionPointer=PointerRef[MethodName];return FunctionPointer();}
var lcPart=Part.toLowerCase();switch(lcPart){case'properties':return PointerRef.Properties();case'isempty':return PointerRef.IsEmpty();case'json':return PointerRef.ToJSON();case'hasresult':return(!PointerRef.IsEmpty());case'count':return PointerRef.Get().length;case'labels':case'attributelabels':return PointerRef.AttributeLabels();}
return PointerRef.Attr(Part);};CPointerParser.ParsePointerCCollection=function(PointerRef,Part){var lcPart=Part.toLowerCase();switch(lcPart){case'count':return PointerRef.Count();case'isempty':return PointerRef.IsEmpty();case'json':return PointerRef.ToJSON();case'hasresult':return(!PointerRef.IsEmpty());}
if(typeof(PointerRef[Part])!=='undefined'&&typeof(PointerRef[Part])!=='function'){return PointerRef[Part];}
return null;};CPointerParser.ParsePointerArray=function(PointerRef,Part){if(typeof(PointerRef[Part])!=='undefined'&&typeof(PointerRef[Part])!=='function'){return PointerRef[Part];}
var lcPart=Part.toLowerCase();switch(lcPart){case'json':return JSON.stringify(PointerRef);case'count':return PointerRef.length;case'isempty':return(PointerRef.length===0)?true:false;case'implode':return PointerRef.join('');}
return null;};var COutputEncoder={};COutputEncoder.__AllowedURISchemes={http:'://',https:'://',mailto:':',tel:':',sms:':',fax:':',cid:':',maps:':',geo:':'};COutputEncoder.CONTEXT_HTML='htmlcontent';COutputEncoder.CONTEXT_HTML_ATTRIBUTE='htmlattribute';COutputEncoder.CONTEXT_CSS='css';COutputEncoder.CONTEXT_HTML_URL='url';COutputEncoder.AttributeEntityReplacements={"&":"&#38;","<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;"};COutputEncoder.Encode=function(Value,Context,Definitions){if(typeof(Context)!=='string'){console.error('Invalid encoding context.');return'';}
if(typeof(Value)==='undefined'||Value===null||Value===''){return Value;}
Value=""+Value;switch(Context){case this.CONTEXT_HTML:return this.EncodeHTMLContent(Value,Definitions);case this.CONTEXT_HTML_ATTRIBUTE:return this.EncodeHTMLAttribute(Value,Definitions);case this.CONTEXT_HTML_URL:return this.EncodeURLAttribute(Value,Definitions);case this.CONTEXT_CSS:return this.EncodeStyleAttribute(Value,Definitions);default:console.error('Invalid encoding context.');return'';}
return Value;};COutputEncoder.EncodeHTMLContent=function(Value,Definitions){return Value;};COutputEncoder.EncodeHTMLAttribute=function(InputValue,Definitions){var OutputValue='';var Char;for(var i=0;i<InputValue.length;i++){Char=InputValue.substr(i,1);if(typeof(this.AttributeEntityReplacements[Char])!=='undefined'){OutputValue+=this.AttributeEntityReplacements[Char];}else{OutputValue+=Char;}}
return OutputValue;};COutputEncoder.EncodeURLAttribute=function(InputValue,Definitions){var OutputValue=InputValue;return OutputValue;};COutputEncoder.EncodeStyleAttribute=function(InputValue,Definitions){var OutputValue=InputValue.replace(/[^a-zA-Z0-9#:;_. ()\/+%-\?\&]/g,'');return OutputValue;};var CDataView=function(Params){this.ID=null;this.Container=null;this.DataSource=null;this.Request=null;this.RequestType=null;this.Action=null;this.Size=null;this.Page=1;this.Template=null;this.AutoLoad=false;this.Filters=[];if(Params!==undefined&&typeof Params==='object'){for(var Key in Params){this[Key]=Params[Key];}}
this.__DataSet=[];this.__ContainerTemplate=null;this.__Template=null;this.Cache={};this.Init();return this;};CDataView.prototype.Init=function(){if(this.__Initialized===true){return this;}
if(this.Container!==null){this.Cache.Element=this.Container;}else{if(this.ID!==null){this.Cache.Element=$('#'+this.ID);}}
if(this.Cache.Element!==undefined&&this.Cache.Element.length>0){var TagName=''+this.Cache.Element.prop('tagName');switch(TagName.toLowerCase()){case'table':this.InitTable();break;case'div':default:this.Cache.Container=this.Cache.Element;}}
if(this.AutoLoad===true){this.LoadData();}
this.__Initialized=true;return this;};CDataView.prototype.InitTable=function(){var Head=this.Cache.Element.find('thead');if(Head.length===0){this.Cache.Head=$('<thead />');this.Cache.Head.append($('th',this.Cache.Element).closest('tr')).prependTo(this.Cache.Element);}else{this.Cache.Head=Head;}
var Container=this.Cache.Element.find('tbody');if(Container.length===0){this.Cache.Container=$('<tbody />');this.Cache.Container.append($('td',this.Cache.Element).closest('tr')).appendTo(this.Cache.Element);}else{this.Cache.Container=Container;}
if(this.Template===null){this.Template='TableRow';}};CDataView.prototype.Render=function(){var Size=this.Size;var DataLength=this.__DataSet.length;if(Size===null){Size=DataLength;}
this.NumPages=((DataLength/Size)|0)+1;if(this.__Template===undefined||this.__Template===null){this.__Template=new CTemplateObject(this.Template);}
var DataOffset=(this.Page-1)*Size;if(DataOffset+Size>DataLength){Size=DataLength-DataOffset;}
var Content='';for(var i=DataOffset;i<(Size+DataOffset);i++){var UnitData=this.__DataSet[i];this.__Template.SetParameters(UnitData);Content+=this.__Template.Render();}
this.Cache.Container.html(Content);return this;};CDataView.prototype.LoadData=function(){if(this.DataSource!==undefined){switch(typeof this.DataSource){case'string':this.__DataSet=this.LoadFromTable($(this.DataSource));break;case'object':this.__DataSet=this.LoadFromObject(this.DataSource);break;case'function':this.__DataSet=this.DataSource(this);break;}}
return this;};CDataView.prototype.LoadFromTable=function(TableElement){this.Init();var DataSet=[];this.Cache.Container.find('tr').each(function(){});};CDataView.prototype.LoadFromObject=function(DataObject){if(DataObject instanceof CCollection){return DataObject.ToArray();}
return DataObject;};CDataView.prototype.SortBy=function(){return this;};CDataView.prototype.GetPage=function(){return this.Page;};CDataView.prototype.GetPageTotal=function(){var Size=this.Size;var DataLength=this.__DataSet.length;if(Size===null){Size=DataLength;}
this.NumPages=((DataLength/Size)|0)+1;return this.NumPages;};CDataView.prototype.SetPage=function(Page,Redraw){this.Page=Page;if(Redraw===undefined||Redraw===true){this.Render();}
return this;};CDataView.prototype.NextPage=function(Redraw){this.Page++;var PageTotal=this.GetPageTotal();if(this.Page>PageTotal){this.Page=PageTotal;}
if(Redraw===undefined||Redraw===true){this.Render();}
return this;};CDataView.prototype.PrevPage=function(Redraw){this.Page--;if(this.Page<1){this.Page=1;}
if(Redraw===undefined||Redraw===true){this.Render();}
return this;};CDataView.prototype.SetFilters=function(Filters){return this;};CDataView.prototype.AddFilter=function(Filter){return this;};var CObjectAttribute=function(Name,Value,Label,Parent,Definitions){this.Name=Name;this.Value=null;this.Label=null;this.Parent=null;this.Definitions=null;if(typeof(Value)!=='undefined'){this.Value=Value;}
if(typeof(Label)!=='undefined'){this.Label=Label;}
if(typeof(Parent)!=='undefined'){this.Parent=Parent;}
if(typeof(Definitions)!=='undefined'){this.Definitions=Definitions;}
return this;};CObjectAttribute.prototype.toString=function(){return''+this.Value;};CObjectAttribute.prototype.Encode=function(Context){if(typeof(Context)==='undefined'||Context===null){return this.Value;}
return COutputEncoder.Encode(this.Value,Context,this.Definitions);};var CObject=function(Params,AttributeLabels){this.__Initialize(Params,AttributeLabels);};CObject.prototype.__Initialize=function(Params,AttributeLabels){this.AssocDataSet={};this.Attributes={};this.AttributeLabels={};if(typeof(Params)==='object'){for(var Name in Params){this.AssocDataSet[Name]=Params[Name];}}
if(typeof(AttributeLabels)==='object'){for(var Name in AttributeLabels){this.AttributeLabels[Name]=AttributeLabels[Name];}}};CObject.prototype.TYPE_ARRAY='array';CObject.prototype.TYPE_OBJECT='object';CObject.prototype.TYPE_JSON='json';CObject.prototype.Properties=function(){return{AttributeLabels:this.AttributeLabels};};CObject.prototype.Get=function(Name,ReturnType){if(typeof(Name)!=='undefined'&&Name!==null){if(typeof(Name)==='string'){var Names=Name.split(',');}}else{if(ReturnType===undefined||ReturnType===null){ReturnType=this.TYPE_OBJECT;}
switch(ReturnType.toLowerCase()){case this.TYPE_ARRAY:var ReturnArray=[];for(Name in ReturnValues){ReturnArray.Push({Name:Name,Value:ReturnValues[Name]});}
return ReturnArray;case this.TYPE_OBJECT:return this.AssocDataSet;case this.TYPE_JSON:return JSON.stringify(this.AssocDataSet);default:if(typeof(window[ReturnType])!=='undefined'){return new window[ReturnType](this.AssocDataSet);}
return null;}}
if(Names.length>1){var ReturnValues={};for(var i=0;i<Names.length;i++){Name=Names[i].trim();if(this.AssocDataSet[Name]!==undefined){ReturnValues[Name]=this.AssocDataSet[Name];}else{ReturnValues[Name]=null;}}
if(ReturnType===undefined||ReturnType===null){ReturnType=this.TYPE_OBJECT;}
switch(ReturnType.toLowerCase()){case this.TYPE_ARRAY:var ReturnArray=[];for(Name in ReturnValues){ReturnArray.Push({Name:Name,Value:ReturnValues[Name]});}
return ReturnArray;case this.TYPE_OBJECT:return ReturnValues;case this.TYPE_JSON:return JSON.stringify(ReturnValues);default:if(typeof(window[ReturnType])!=='undefined'){return new window[ReturnType](ReturnValues);}
return null;}}else{var ReturnValue=null;if(this.AssocDataSet[Name]!==undefined){ReturnValue=this.AssocDataSet[Name];}
if(ReturnType===undefined||ReturnType===null){return ReturnValue;}
switch(ReturnType.toLowerCase()){case this.TYPE_ARRAY:case this.TYPE_OBJECT:return ReturnValue;case this.TYPE_JSON:return JSON.stringify(ReturnValue);default:if(typeof(window[ReturnType])!=='undefined'){return new window[ReturnType](ReturnValue);}
return null;}}
return null;};CObject.prototype.Set=function(Param,Value){if(typeof(Param)==='object'){for(var Name in Param){this.AssocDataSet[Name]=Param[Name];}}else{if(typeof(Param)==='string'){this.AssocDataSet[Param]=Value;}}
return this;};CObject.prototype.Remove=function(Param){if(typeof(Param)!=='undefined'&&Param!=='*'){if(typeof Param==='object'){for(var Name in Param){delete this.AssocDataSet[Name];}}else{if(typeof Param==='string'){delete this.AssocDataSet[Name];}}}else{this.AssocDataSet={};}
return this;};CObject.prototype.Attr=function(Name){if(this.Attributes[Name]===undefined){var Value=this.Get(Name);var Label=this.GetAttributeLabel(Name);this.Attributes[Name]=new CObjectAttribute(Name,Value,Label,this);}
return this.Attributes[Name];};CObject.prototype.Attribute=function(Name){return this.Attr(Name);};CObject.prototype.GetAttributeLabel=function(Name){if(typeof(this.AttributeLabels[Name])!=='undefined'){return this.AttributeLabels[Name];}
return null;};CObject.prototype.ToJSON=function(Filter){var ReturnData={};if(typeof(Filter)==='undefined'){ReturnData=this.AssocDataSet;}else{if(typeof(Filter)==='string'){var NameList=Filter.split(',');}
for(var i=0;i<NameList.length;i++){var Name=NameList[i].trim();if(typeof(this.AssocDataSet[Name])!=='undefined'){ReturnData[Name]=this.AssocDataSet[Name];}else{ReturnData[Name]=null;}}}
return JSON.stringify(ReturnData);};CObject.prototype.ToObject=function(){return this.AssocDataSet;};CObject.prototype.ToArray=function(){var ReturnArray=[];for(var Name in this.AssocDataSet){ReturnArray.push({Name:Name,Value:this.AssocDataSet[Name]});}
return ReturnArray;};CObject.prototype.IsEmpty=function(){for(var Name in this.AssocDataSet){if(this.AssocDataSet.hasOwnProperty(Name)){return false;}}
return true;};CObject.prototype.toString=function(){console.warn("There is a problem with template data related to class '"+this.constructor.name+"'. Check template data to ensure that object contents aren't output to the client.");return'';};var CValidators={Required:function(Value,Comparison,ValidationOptions,Definitions){var Type='default';if(Definitions.hasOwnProperty("upload")){Type='upload';}
switch(Type){case'upload':if(typeof(Value)==='object'&&Value["TempID"]!='undefined'&&Value["TempID"]===''){return false;}
break;default:if(typeof(Value)==='undefined'||Value===null||Value===''||Value===CValidationObject.prototype.PLACEHOLDER_VALUE){return false;}
break;}
return true;},RequireOne:function(Values,Comparison,ValidationOptions,Definitions){var Value;for(var Name in Values){Value=Values[Name];if(typeof(Value)!=='undefined'&&Value!==null&&Value!==''&&Value!==CValidationObject.prototype.PLACEHOLDER_VALUE){return true;}}
return false;},RequireMultiple:function(Values,Comparison,ValidationOptions,Definitions){var Min=null,Max=null;var OptionKey,OptionValue;for(OptionKey in ValidationOptions){OptionValue=ValidationOptions[OptionKey];switch(OptionKey.toLowerCase()){case'0':case'min':case'minimum':Min=parseInt(OptionValue);break;case'1':case'max':case'maximum':Max=parseInt(OptionValue);break;}}
var Found=0;var Value;for(var Name in Values){Value=Values[Name];if(typeof(Value)!=='undefined'&&Value!==null&&Value!==''&&Value!==CValidationObject.prototype.PLACEHOLDER_VALUE){Found++;}}
if(Min!==null&&Max!==null){return(Found>=Min&&Found<=Max);}
if(Min!==null){return(Found>=Min);}
if(Max!==null){return(Found<=Max);}
return true;},Match:function(Values,Comparison,ValidationOptions,Definitions){if(Values.length<=1){return false;}
var MatchValue=null;var InitialSet=false;var Value;for(var Name in Values){Value=Values[Name];if(InitialSet){MatchValue=Value;InitialSet=true;continue;}
if(MatchValue!==Value){return false;}}
return true;},Unsigned:function(Value,Comparison,ValidationOptions,Definitions){return(1*Value>=0);},Integer:function(Value,Comparison,ValidationOptions,Definitions){return(Value%1===0);},Double:function(Value,Comparison,ValidationOptions,Definitions){return(Value%1!==0);},String:function(Value,Comparison,ValidationOptions,Definitions){return(typeof(Value)==='string');},Numeric:function(Value,Comparison,ValidationOptions,Definitions){Value=Number(Value);if(isNaN(Value)){return false;}else{return true;}},Decimal:function(Value,Comparison,ValidationOptions,Definitions){var ValidationRegex=/^[0-9.,\$\-]+$/;if(!ValidationRegex.test(Value)){return false;}
if(typeof(Value)==='string'){Value=Value.replace(/[^0-9.\-]/g,'');}
if(!CValidators.Numeric(Value)){return false;}
if(typeof(Value)==='string'){Value=Value.replace(/[^0-9.\-]/g,'');}
var Precision=null;var Scale=null;var OptionKey,OptionValue;for(OptionKey in ValidationOptions){OptionValue=ValidationOptions[OptionKey];switch(OptionKey.toLowerCase()){case'0':case'precision':case'char':case'digits':Precision=parseInt(OptionValue);break;case'1':case'scale':case'mantissa':case'fraction':Scale=parseInt(OptionValue);break;}}
if(typeof(Precision)==='number'&&typeof(Scale)==='number'&&Scale>Precision){console.Error('Invalid Validation Options for Decimal Type: Scale ('+Scale+') Cannot be greater than Precision ('+Precision+')');return false;}
if(typeof(Value)==='number'){Value=Value.toString();}
var PeriodPos=Value.indexOf('.');var ContainsPeriod=(PeriodPos!==-1);var Regex;if(typeof(Precision)==='number'){var PrecisionTest=Value;if(ContainsPeriod){PrecisionTest=Value.substr(0,PeriodPos);}
Regex=new RegExp('^(-)?[0-9]{0,'+(typeof(Scale)==='number'?Precision-Scale:Precision)+'}$');if(!PrecisionTest.match(Regex)){return false;}}
if(typeof(Scale)==='number'&&ContainsPeriod){Regex=new RegExp('^\.[0-9]{0,'+Scale+'}$');if(!Regex.test(Value.substr(PeriodPos))){return false;}}
return true;},Currency:function(Value,Comparison,ValidationOptions,Definitions){var ValidationRegex=/^[0-9.,\$\-]+$/;if(!ValidationRegex.test(Value)){return false;}
if(typeof(Value)==='string'){Value=Value.replace(/[^0-9.\-]/g,'');}
if(!CValidators.Numeric(Value)){return false;}
var Precision=null;var Scale=null;var OptionKey,OptionValue;for(OptionKey in ValidationOptions){OptionValue=ValidationOptions[OptionKey];switch(OptionKey.toLowerCase()){case'0':case'precision':case'char':case'digits':Precision=parseInt(OptionValue);break;case'1':case'scale':case'mantissa':case'fraction':Scale=parseInt(OptionValue);break;}}
if(typeof(Precision)==='number'&&typeof(Scale)==='number'&&Scale>Precision){console.Error('Invalid Validation Options for Currency Type: Scale ('+Scale+') Cannot be greater than Precision ('+Precision+')');return false;}
if(typeof(Value)==='number'){Value=Value.toString();}
var PeriodPos=Value.indexOf('.');var ContainsPeriod=(PeriodPos!==-1);var Regex;if(typeof(Precision)==='number'){var PrecisionTest=Value;if(ContainsPeriod){PrecisionTest=Value.substr(0,PeriodPos);}
Regex=new RegExp('^(-)?[0-9]{0,'+(typeof(Scale)==='number'?Precision-Scale:Precision)+'}$');if(!PrecisionTest.match(Regex)){return false;}}
if(typeof(Scale)==='number'&&ContainsPeriod){Regex=new RegExp('^\.[0-9]{0,'+Scale+'}$');if(!Regex.test(Value.substr(PeriodPos))){return false;}}
return true;},Alpha:function(Value,Comparison,ValidationOptions,Definitions){if(Value.match(/[^a-zA-Z]/)){return false;}
return true;},Alphanumeric:function(Value,Comparison,ValidationOptions,Definitions){if(Value.match(/[^a-zA-Z0-9]/)){return false;}
return true;},MinValue:function(Value,Comparison,ValidationOptions,Definitions){return(1*Value>=1*Comparison);},MaxValue:function(Value,Comparison,ValidationOptions,Definitions){return(1*Value<=1*Comparison);},MinLength:function(Value,Comparison,ValidationOptions,Definitions){return((''+Value).length>=1*Comparison);},MaxLength:function(Value,Comparison,ValidationOptions,Definitions){return((''+Value).length<=1*Comparison);},Length:function(Value,Comparison,ValidationOptions,Definitions){return((''+Value).length===1*Comparison);},HTML:function(Value,Comparison,ValidationOptions,Definitions){return(typeof(Value)==='string');},Password:function(Value,Comparison,ValidationOptions,Definitions){if(Value.match(/\s/)){return false;}
return true;},Date:function(Value,Comparison,ValidationOptions,Definitions){var DateObj=new Date(Value);return!isNaN(DateObj.getTime());},Month:function(Value,Comparison,ValidationOptions,Definitions){return true;},CreditCard:function(Value,Comparison,ValidationOptions,Definitions){var Regex=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(!Value.match(Regex)){return false;}
var DigitList=Value.split('');for(var i=0;i<DigitList.length;i++){DigitList[i]=parseInt(DigitList[i],10);}
var Checksum=0;var Odd=false;for(i=DigitList.length-1;i>=0;i--){if(Odd){DigitList[i]*=2;if(DigitList[i]>9){DigitList[i]-=9;}}
Checksum+=DigitList[i];Odd=!Odd;}
if(Checksum%10!==0){return false}
return true;},Username:function(Value,Comparison,ValidationOptions,Definitions){return(!Value.match(/\s/gi));},Time:function(Value,Comparison,ValidationOptions,Definitions){var Regex;var Format;if(typeof(ValidationOptions)==='object'&&ValidationOptions!==null&&"format"in ValidationOptions&&typeof(ValidationOptions["format"])==='string'){Format=ValidationOptions.format;}else{Format=CValidationObject.prototype.DEFAULT_TIME_FORMAT;}
switch(Format){case'time_with_dot_24':Regex=/^(2[0-3]|[01][0-9])\.[0-5][0-9]\.[0-5][0-9]$/;break;default:Regex=/^(2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$/;break;}
return Regex.test(Value);},Timestamp:function(Value,Comparison,ValidationOptions,Definitions){var Regex;var Format;if(typeof(ValidationOptions)==='object'&&ValidationOptions!==null&&"format"in ValidationOptions&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}else{Format=CValidationObject.prototype.DEFAULT_TIMESTAMP_FORMAT;}
switch(Format){case'date_with_slash':Regex=/^((19[7-9]|2[0-9][0-9])\d{1}\/((0[1-9]|1[0-2])\/(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])\/(29|30)|(0[13578]|1[02])\/31)|((19|20)(04|08|[2468][048]|[13579][26])|2000)\/(02)\/29)\s([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/;break;default:Regex=/^((19[7-9]|2[0-9][0-9])\d{1}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|((19|20)(04|08|[2468][048]|[13579][26])|2000)-(02)-29)\s([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/;break;}
return Regex.test(Value);},DateTime:function(Value,Comparison,ValidationOptions,Definitions){var Regex;var Format;if(typeof(ValidationOptions)==='object'&&ValidationOptions!==null&&"format"in ValidationOptions&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}else{Format=CValidationObject.prototype.DEFAULT_TIMESTAMP_FORMAT;}
switch(Format){case'date_with_slash':Regex=/^((19|2[0-9])\d{2}\/((0[1-9]|1[0-2])\/(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])\/(29|30)|(0[13578]|1[02])\/31)|((19|20)(04|08|[2468][048]|[13579][26])|2000)\/(02)\/29)\s([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/;break;default:Regex=/^((19|2[0-9])\d{2}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)|(0[13578]|1[02])-31)|((19|20)(04|08|[2468][048]|[13579][26])|2000)-(02)-29)\s([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/;break;}
return Regex.test(Value);},Upload:function(Value,Comparison,ValidationOptions,Definitions){if(!(typeof(Value)==='object'&&Value.hasOwnProperty("TempID")&&Value.hasOwnProperty("File")&&Value.hasOwnProperty("FileName")&&Value.hasOwnProperty("OriginalFileName")&&Value.hasOwnProperty("Remove"))){return false;}
return true;}};var CValidationObject=function(Data,Parameters){this.__Initialize(Data,Parameters);};CValidationObject.prototype=Object.create(CObject.prototype);CValidationObject.prototype.__Initialize=function(Data,Parameters){this.Definitions={};this.DataSources={};this.Errors={};CObject.prototype.__Initialize.call(this,Data);if(typeof(Parameters)==='object'){for(var Name in Parameters){this[Name]=Parameters[Name];}}
this.__ValidateSuccessful=null;};CValidationObject.prototype.PLACEHOLDER_VALUE='__placeholdervalue__';CValidationObject.prototype.PHONE_US='us';CValidationObject.prototype.PHONE_US_DASH='usdash';CValidationObject.prototype.PHONE_US_DOT='usdot';CValidationObject.prototype.PHONE_INTERNATIONAL='international';CValidationObject.prototype.DATE_US='us';CValidationObject.prototype.DATE_EUR='eur';CValidationObject.prototype.DATE_ISO_SHORT='isoshort';CValidationObject.prototype.DATE_ISO_LONG='isolong';CValidationObject.prototype.DEFAULT_TIME_FORMAT='HH:MM:SS';CValidationObject.prototype.DEFAULT_TIMESTAMP_FORMAT='YYYY-MM-DD HH:MM:SS';CValidationObject.prototype.__ValidationTypes={required:{Error:'This value is required.',CValidators:'Required'},unsigned:{Error:'This value must be unsigned.',CValidators:'Unsigned',CFilters:'Unsigned'},integer:{Error:'This value must be an integer.',CValidators:'Integer',CFilters:'Integer'},float:{Error:'This value must be a double.',CValidators:'Double',CFilters:'Double'},double:{Error:'This value must be a double.',CValidators:'Double',CFilters:'Double'},string:{Error:'This value must be a string.',CValidators:'String',CFilters:'String'},text:{Error:'This value must be a string.',CValidators:'String',Filter:'htmlspecialchars'},html:{Error:'This value must be a valid html string.',CValidators:'HTML',CFilters:'HTML'},numeric:{Error:'This value must be a number.',CValidators:'Numeric'},decimal:{Error:'Please enter a valid decimal number.',CValidators:'Decimal',CFilters:'Decimal',CFormats:'Decimal'},currency:{Error:'Please enter a valid monetary amount.',CValidators:'Currency',CFilters:'Currency',CFormats:'Currency'},percent:{CFormats:'Percent'},alpha:{Error:'This value must only contain letters.',CValidators:'Alpha',Filter:{regex:/[^a-zA-Z]/g}},alphanumeric:{Error:'This value must only contain letters and numbers',CValidators:'Alphanumeric',Filter:{regex:/[^a-zA-Z0-9]/g}},minvalue:{Error:'This value must be greater than or equal to {{Definition}}.',CValidators:'MinValue'},maxvalue:{Error:'This value must be less than or equal to {{Definition}}.',CValidators:'MaxValue'},minlength:{Error:'This value has a minimum length of {{Definition}}.',CValidators:'MinLength'},maxlength:{Error:'This value has a maximum length of {{Definition}}.',CValidators:'MaxLength'},length:{Error:'This value must have a length of {{Definition}}.',CValidators:'Length'},zip:{Error:'This value must be a valid Zip Code.',Validate:{regex:/^([0-9]{5}(?:-[0-9]{4})?)*$/},Filter:{regex:/[^0-9-]/g}},phone:{Error:'This value must be a valid Phone Number.',Validate:{regex:/(\D*\d){7,}/},Filter:'htmlspecialchars',CFormats:'Phone'},email:{Error:'This value must be a valid Email Address.',Validate:{regex:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/},},ip:{Error:'This value must be a valid IP Address.',Filter:{regex:/[^0-9abcdefABCDEF.:]/g}},url:{Error:'This value must be a valid URL.',},date:{Error:'This value must be a valid date.',CValidators:'Date',CFormats:'Date'},datediff:{},month:{Error:"This value must match the format 'mm/yy' or 'mm/yyyy'.",CValidators:'Month'},username:{Error:'Usernames must not contain spaces or tabs.',CValidators:'Username'},time:{Error:'This value must be a valid time.',CValidators:'Time',CFilters:'Time',CFormats:'Time'},timestamp:{Error:'This value must match the format.',CValidators:'Timestamp',CFormats:'Timestamp'},datetime:{Error:'This value must match the format.',CValidators:'DateTime',CFormats:'Timestamp'},filename:{Error:'This value must be a valid filename.',Validate:{regex:/^[a-zA-Z0-9-_]+\.[a-zA-Z0-9]+$/},CFilters:'Filename'},hash:{Validate:{regex:/^[0-9abcdef]+$/},Filter:{regex:/[^0-9abcdef]/g}},pagename:{Error:'This value must contain only letters, numbers, and hyphens.',Validate:{regex:/^[a-zA-Z0-9-]+$/},CFilters:'PageName'},password:{Error:'The password provided does not meet minimum requirements.',CValidators:'Password',Filter:{regex:/\s/}},uuid:{Validate:{regex:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/}},creditcard:{Error:'The payment card provided is invalid.',CValidators:'CreditCard'},securitycode:{Error:'The security code provided is invalid.',Validate:{regex:/^[0-9]{3,4}$/}},'require-one':{Error:'This value is required.',CValidators:'RequireOne'},'require-multiple':{Error:'This value is required.',CValidators:'RequireMultiple'},match:{Error:'These values must match.',CValidators:'Match'},type:{},datasource:{},upload:{Error:'Uploaded file is not in desired format. Please refresh the page and upload again.',CValidators:'Upload'}};CValidationObject.prototype.Attr=function(Name){if(this.Attributes[Name]===undefined){var Value=this.Get(Name);var Label=this.GetAttributeLabel(Name);var Definitions=null;if(typeof(this.Definitions[Name])!=='undefined'){Definitions=this.Definitions[Name];}
this.Attributes[Name]=new CObjectAttribute(Name,Value,Label,this,Definitions);}
return this.Attributes[Name];};CValidationObject.prototype.GetAttributeDefinitions=function(Name){if(typeof(this.Definitions[Name])!=='undefined'){return this.Definitions[Name];}
return null;};CValidationObject.prototype.GetDefinitions=function(){return this.Definitions;};CValidationObject.prototype.IsValid=function(){return(typeof(this.__ValidateSuccessful)==='boolean')?this.__ValidateSuccessful:this.Validate();};CValidationObject.prototype.IsValidated=function(){return(typeof(this.__ValidateSuccessful)==='boolean');};CValidationObject.prototype.Validate=function(){var Success=true;var AttributeName,Definition;for(AttributeName in this.Definitions){Definition=this.Definitions[AttributeName];if(!this.ValidateAttribute(AttributeName,Definition)){Success=false;}}
this.__ValidateSuccessful=Success;return Success;};CValidationObject.prototype.ValidateAttribute=function(AttributeName,Definitions){if(typeof(Definitions)==='undefined'||Definitions==null){Definitions=this.GetAttributeDefinitions(AttributeName);if(typeof(Definitions)==='undefined'||Definitions==null){return true;}}
if(typeof(Definitions)==='string'){Definitions=Definitions.split(',');}
var AttributeValue=this.Get(AttributeName);var Success=true;var DefinitionKey,DefinitionValue,ValidationOptions,ValidationType;for(DefinitionKey in Definitions){DefinitionValue=Definitions[DefinitionKey];ValidationOptions=null;if(1*DefinitionKey==DefinitionKey){ValidationType=DefinitionValue.toLowerCase();DefinitionValue=null;}else{ValidationType=DefinitionKey.toLowerCase();if(typeof(DefinitionValue)==='string'){ValidationOptions=DefinitionValue.split(',');}else{if(typeof(DefinitionValue)==='object'){ValidationOptions=DefinitionValue;DefinitionValue=null;}}}
if(!this.ValidateDefinition(AttributeValue,ValidationType,DefinitionValue,ValidationOptions,Definitions)){Success=false;this.AddError(AttributeName,this.GetValidationType(ValidationType,'Error').replace('{{Definition}}',DefinitionValue));}}
return Success;};CValidationObject.prototype.ValidateDefinition=function(AttributeValue,ValidationType,DefinitionValue,ValidationOptions,Definitions){if(typeof(this.__ValidationTypes[ValidationType])==='undefined'){console.error('Invalid validation type: '+ValidationType);return false;}
if(ValidationType!=='required'&&(typeof(AttributeValue)==='undefined'||AttributeValue===null||AttributeValue===''||AttributeValue===this.PLACEHOLDER_VALUE)){return true;}
if(typeof(ValidationOptions)==='string'){ValidationOptions=ValidationOptions.split(',');}
if(typeof(DefinitionValue)==='undefined'){DefinitionValue=null;}
if(typeof(ValidationOptions)==='undefined'){ValidationOptions=null;}
var ValidationCallback=this.GetValidationType(ValidationType,'CValidators');if(typeof(ValidationCallback)!=='undefined'&&typeof(CValidators[ValidationCallback])==='function'){var ValidationFunction=CValidators[ValidationCallback];if(!ValidationFunction(AttributeValue,DefinitionValue,ValidationOptions,Definitions)){return false;}}
var Rules=this.GetValidationType(ValidationType,'Validate');if(typeof(Rules)!=='object'){return true;}
var RuleMethod,RuleValue;for(RuleMethod in Rules){RuleValue=Rules[RuleMethod];switch(RuleMethod){case'regex':if(!RuleValue.test(AttributeValue)){return false;}
break;default:console.error('Invalid validation rule: '+RuleMethod);}}
return true;};CValidationObject.prototype.FilterDefinition=function(AttributeValue,ValidationType,DefinitionValue,ValidationOptions){if(typeof(this.__ValidationTypes[ValidationType])==='undefined'){console.error('Invalid validation type: '+ValidationType);return null;}
if(ValidationType!=='required'&&(typeof(AttributeValue)==='undefined'||AttributeValue===null||AttributeValue===''||AttributeValue===this.PLACEHOLDER_VALUE)){if(AttributeValue===this.PLACEHOLDER_VALUE){return null;}
return AttributeValue;}
if(typeof(ValidationOptions)==='string'){ValidationOptions=ValidationOptions.split(',');}
if(typeof(DefinitionValue)==='undefined'){DefinitionValue=null;}
if(typeof(ValidationOptions)==='undefined'){ValidationOptions=null;}
var FilterCallback=this.GetValidationType(ValidationType,'CFilters');if(typeof(FilterCallback)!=='undefined'&&typeof(CFilters[FilterCallback])==='function'){var FilterFunction=CFilters[FilterCallback];AttributeValue=FilterFunction(AttributeValue,DefinitionValue,ValidationOptions);}
var Rules=this.GetValidationType(ValidationType,'Filter');if(typeof(Rules)!=='object'){return AttributeValue;}
var RuleMethod,RuleValue;for(RuleMethod in Rules){RuleValue=Rules[RuleMethod];switch(RuleMethod){case'regex':AttributeValue=AttributeValue.replace(RuleValue);break;default:console.error('Invalid validation rule: '+RuleMethod);}}
return AttributeValue;};CValidationObject.prototype.FormatDefinition=function(AttributeValue,ValidationType,DefinitionValue,ValidationOptions){if(typeof(this.__ValidationTypes[ValidationType])==='undefined'){console.error('Invalid validation type: '+ValidationType);return null;}
if(ValidationType!=='required'&&(typeof(AttributeValue)==='undefined'||AttributeValue===null||AttributeValue===''||AttributeValue===this.PLACEHOLDER_VALUE)){if(AttributeValue===this.PLACEHOLDER_VALUE){return null;}
return AttributeValue;}
if(typeof(ValidationOptions)==='string'){ValidationOptions=ValidationOptions.split(',');}
if(typeof(DefinitionValue)==='undefined'){DefinitionValue=null;}
if(typeof(ValidationOptions)==='undefined'){ValidationOptions=null;}
var FormatCallback=this.GetValidationType(ValidationType,'CFormats');if(typeof(FormatCallback)!=='undefined'&&typeof(CFormats[FormatCallback])==='function'){var FormatFunction=CFormats[FormatCallback];AttributeValue=FormatFunction(AttributeValue,DefinitionValue,ValidationOptions);}
var Rules=this.GetValidationType(ValidationType,'Format');if(typeof(Rules)!=='object'){return AttributeValue;}
var RuleMethod,RuleValue;for(RuleMethod in Rules){RuleValue=Rules[RuleMethod];switch(RuleMethod){case'regex':AttributeValue=AttributeValue.replace(RuleValue);break;default:console.error('Invalid validation rule: '+RuleMethod);}}
return AttributeValue;};CValidationObject.prototype.AddError=function(Name,Message){if(typeof(this.Errors[Name])==='undefined'){this.Errors[Name]=[];}
this.Errors[Name].push(Message);return this;};CValidationObject.prototype.AddErrors=function(Errors){for(var Name in Errors){if(typeof(this.Errors[Name])==='undefined'){this.Errors[Name]=[];}
for(var i in Errors[Name]){this.Errors[Name].push(Errors[Name][i]);}}
return this;};CValidationObject.prototype.GetErrors=function(Name){if(typeof(Name)==='string'){return this.Errors[Name];}
return this.Errors;};CValidationObject.prototype.HasErrors=function(){for(var AttributeName in this.Errors){return true;}
return false;};CValidationObject.prototype.GetValidationTypes=function(){return this.__ValidationTypes;};CValidationObject.prototype.GetValidationType=function(Type,Context){if(typeof(this.__ValidationTypes[Type])==='undefined'||this.__ValidationTypes[Type]===null){return null;}
if(typeof(Context)==='undefined'||Context===null){return this.__ValidationTypes[Type];}
if(typeof(this.__ValidationTypes[Type][Context])==='undefined'||this.__ValidationTypes[Type][Context]===null){return null;}
return this.__ValidationTypes[Type][Context];};CValidationObject.prototype.IsValidType=function(Type){return(typeof(this.__ValidationTypes[Type])!=='undefined');};CValidationObject.prototype.AddAttribute=function(Name,Value,Label,Definitions){if(typeof(Value)!=='undefined'){this.AssocDataSet[Name]=Value;}
if(typeof(Label)==='string'){this.AttributeLabels[Name]=Label}
if(typeof(Definitions)==='object'){this.Definitions[Name]=Definitions;}
return this;};CValidationObject.prototype.RemoveAttribute=function(Name){if(typeof(this.AssocDataSet[Name])!=='undefined'){delete this.AssocDataSet[Name];}
if(typeof(this.AttributeLabels[Name])!=='undefined'){delete this.AttributeLabels[Name];}
if(typeof(this.Definitions[Name])!=='undefined'){delete this.Definitions[Name];}
if(typeof(this.Attributes[Name])!=='undefined'){delete this.Attributes[Name];}
return this;};CValidationObject.prototype.AddDataSource=function(Name,Values){this.DataSources[Name]=Values;return this;};CValidationObject.prototype.RemoveDataSource=function(Name,Values){if(typeof(this.DataSources[Name])!=='undefined'){delete this.DataSources[Name];}
return this;};var CFilters={Integer:function(Value,Comparison,ValidationOptions){Value=parseInt(Value);if(isNaN(Value)||isFinite(Value)===false){Value=0;}
return Value;},Float:function(Value,Comparison,ValidationOptions){Value=parseFloat(Value);if(isNaN(Value)||isFinite(Value)===false){Value=0.00;}
return Value;},Double:function(Value,Comparison,ValidationOptions){return this.Float(Value,Comparison,ValidationOptions);},PageName:function(Value,Comparison,ValidationOptions){Value=CUtil.HtmlSpecialCharsDecode(Value,'ENT_COMPAT');Value=Value.toLowerCase();Value=Value.trim().replace(/\s{2,}/g," ");Value=Value.replace(/ |_/g,"-");Value=Value.replace("&",'and');return Value.replace(/[^a-zA-Z0-9-]/g,'');},Time:function(Value,Comparison,ValidationOptions){var result=Value;var Format;if(typeof(ValidationOptions)==='object'&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}
if(typeof(Format)!=='undefined'&&Format==='time_with_dot_24'){result=Value.replace(".",":");}
return result;}};var CFormats={Integer:function(Value,Comparison,ValidationOptions){Value=parseInt(Value,10);if(isNaN(Value)||isFinite(Value)===false){Value=0;}
return Value;},Decimal:function(Value,Comparison,ValidationOptions){if(typeof(Value)==="string"){Value=Value.replace(/[^\-0-9.]/g,'');}
Value=CFilters.Double(Value);var Scale=2;var Precision=0;if(typeof(ValidationOptions)==="object"){var OptionValue;for(var OptionKey in ValidationOptions){OptionValue=ValidationOptions[OptionKey];switch(OptionKey.toLowerCase()){case'0':case'precision':case'char':case'digits':Precision=CFilters.Integer(OptionValue);break;case'1':case'scale':case'mantissa':case'fraction':Scale=CFilters.Integer(OptionValue);break;default:throw"Invalid validation rule option";}}}
if(typeof(Intl)==="object"){var Formatter=new Intl.NumberFormat('us',{style:'decimal',currency:'usd',minimumFractionDigits:Scale,maximumFractionDigits:Scale});Value=Formatter.format(Value);}else{Value=Value.toFixed(Scale);}
return Value;},Currency:function(Value,Comparison,ValidationOptions){if(typeof(Value)==="string"){Value=Value.replace(/[^\-0-9.]/g,'');}
Value=CFilters.Double(Value);var Scale=2;var Precision=0;if(typeof(ValidationOptions)==="object"){var OptionValue;for(var OptionKey in ValidationOptions){OptionValue=ValidationOptions[OptionKey];switch(OptionKey.toLowerCase()){case'0':case'precision':case'char':case'digits':Precision=CFilters.Integer(OptionValue);break;case'1':case'scale':case'mantissa':case'fraction':Scale=CFilters.Integer(OptionValue);break;default:throw"Invalid validation rule option";}}}
if(typeof(Intl)==="object"){var Formatter=new Intl.NumberFormat('us',{style:'currency',currency:'usd',minimumFractionDigits:Scale,maximumFractionDigits:Scale});Value=Formatter.format(Value);}else{Value=Value.toFixed(Scale);}
return Value;},Percent:function(Value,Comparison,ValidationOptions){Value=Value*100;return Value.toFixed(2)+'%';},Date:function(Value,Format,ValidationOptions){if(typeof(ValidationOptions)==='object'&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}
switch(Format){default:case CValidationObject.prototype.DATE_US:{Format='m/d/Y';break;}
case CValidationObject.prototype.DATE_EUR:{Format='d/m/Y';break;}
case CValidationObject.prototype.DATE_ISO_SHORT:{Format='Y-m-d';break;}
case CValidationObject.prototype.DATE_ISO_LONG:{Format='Y-m-d H:i:s';break;}}
var DateObj=new Date(Value);return DateObj.format(Format);},Phone:function(Value,Format,ValidationOptions){if(typeof(ValidationOptions)==='object'&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}
if(typeof(Format)==='undefined'||Format===''||Format==='phone'){Format=CValidationObject.prototype.PHONE_US_DASH;}
Value=''+Value;Value=Value.replace(/\D/g,'');var ReturnValue='';var CountryCode=null;var AreaCode=null;if(Value.length>10){CountryCode=Value.slice(0,Value.length-10);}
if(Value.length>=10){AreaCode=Value.substr(-10,3);}
var Exchange=Value.substr(-7,3);var Subscriber=Value.substr(-4,4);switch(Format){default:case CValidationObject.prototype.PHONE_US:if(CountryCode!==null){ReturnValue+=CountryCode+' ';}
if(AreaCode!==null){ReturnValue+='('+AreaCode+') ';}
ReturnValue+=Exchange+' '+Subscriber;break;case CValidationObject.prototype.PHONE_US_DASH:if(CountryCode!==null){ReturnValue+=CountryCode+'-';}
if(AreaCode!==null){ReturnValue+=AreaCode+'-';}
ReturnValue+=Exchange+'-'+Subscriber;break;case CValidationObject.prototype.PHONE_US_DOT:if(CountryCode!==null){ReturnValue+=CountryCode+'.';}
if(AreaCode!==null){ReturnValue+=AreaCode+'.';}
ReturnValue+=Exchange+'.'+Subscriber;break;}
return ReturnValue;},Time:function(Value,Format,ValidationOptions){var result=Value;if(typeof(ValidationOptions)==='object'&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}
if(typeof(Format)!=='undefined'&&Format==='time_with_dot_24'){result=Value.replace(":",".");}
return result;},Timestamp:function(Value,Format,ValidationOptions){var result=Value;if(typeof(ValidationOptions)==='object'&&typeof(ValidationOptions.format)==='string'){Format=ValidationOptions.format;}
if(typeof(Format)!=='undefined'&&Format==='date_with_slash'){result=Value.replace("-","/");}
return result;}};var CFormObject=function(FormName,Data,Parameters){CFormObject.prototype.__Initialize.call(this,FormName,Data,Parameters);};CFormObject.prototype=Object.create(CValidationObject.prototype);CFormObject.prototype.__Initialize=function(FormName,Data,Parameters){if(typeof(Data)!=='object'){Data={};}
if(typeof(Parameters)!=='object'){Parameters={};}
this.FormName='Form';this.DisableCSRFToken=false;this.DefaultValues=Parameters.DefaultValues||{};Data=$.extend({},this.DefaultValues,Data);CValidationObject.prototype.__Initialize.call(this,Data,Parameters);if(typeof(FormName)==='string'&&FormName.length!==''){this.FormName=FormName;}};CFormObject.prototype.GetFormElement=function(){return $('form#'+this.FormName);};CFormObject.prototype.GetElements=function(){var $Form=this.GetFormElement();if($Form.length>0){return $('[name^="'+this.FormName+'\["]',$Form);}else{return $('[name^="'+this.FormName+'\["]');}};CFormObject.prototype.GetElement=function(FormAttribute){return this.GetElements().filter('[name*="['+FormAttribute+']"]');};CFormObject.prototype.GetLabels=function(){var $Form=this.GetFormElement();if($Form.length>0){return $('[for^="'+this.FormName+'_"]',$Form);}else{return $('[for^="'+this.FormName+'_"]');}};CFormObject.prototype.GetLabel=function(FormAttribute){return this.GetLabels().filter('[for*="_'+FormAttribute+'"]');};CFormObject.prototype.LoadData=function(){var self=this;var SeparatorRegEx=/[\[A-Za-z0-9]*]+/g;this.GetElements().each(function(){var Value;var Matches=$(this).attr('name').replace(self.FormName,'').match(SeparatorRegEx);if(typeof(Matches)==='undefined'||Matches===null||Matches.length===0||Matches[0]==='[]'){return;}
var InputName=Matches[0].slice(1,-1);if(Matches.length===1){switch($(this).attr('type')){case'radio':if($(this).prop('checked')===false)return;Value=$(this).val();break;case'checkbox':if($(this).prop('checked')!==false){Value=$(this).prop('checked');}else{Value=null;}
break;default:Value=$(this).val();if(Value===self.PLACEHOLDER_VALUE){Value=null;}}}else{Value=self.Get(InputName);if(Value===undefined||Value===null||typeof Value!=='object'){Value={};}
var Key=Matches[1].slice(1,-1);if($(this).attr('type')==='checkbox'){if($(this).prop('checked')!==false){Value[Key]=$(this).prop('checked');}else{Value[Key]=null;}}else{Value[Key]=$(this).val();if(Value[Key]===self.PLACEHOLDER_VALUE){Value[Key]=null;}}}
self.AssocDataSet[InputName]=Value;});return this;};CFormObject.prototype.SetData=function(Data){var $Element;for(var Name in Data){$Element=this.GetElement(Name);if($Element.length===0){continue;}
if($Element.attr('type')==='checkbox'){$Element.prop('checked',CUtil.ToBoolean(Data[Name]));}else{if(typeof(Data[Name])==='object'){var DataProps=Data[Name];for(var SubName in DataProps){if(!DataProps.hasOwnProperty(SubName)){continue;}
var $SubElement=$Element.find('[id$=_'+SubName+']');if($SubElement.length===0){continue;}
$SubElement.val(DataProps[SubName]);}}else{$Element.val(Data[Name]);}}}
this.Set(Data);return this;};CFormObject.prototype.Validate=function(){var self=this;var IsValid=true;this.LoadData().Get();this.Errors={};IsValid=CValidationObject.prototype.Validate.call(this)
this.GetElements().each(function(){var ControlID=$(this).data('control-id');if(typeof(ControlID)!=='string'){return;}
var AttributeName=$(this).data('form-attribute');var Definitions=self.GetAttributeDefinitions(AttributeName);var Control=CControls.Get(ControlID);if(!Control.Validate(Definitions)){IsValid=false;}});return IsValid;};var CFormView=function(Options){if(typeof(Options)!=='object'){Options={};}
this.SubmitAction=Options.SubmitAction||null;this.SubmitURL=Options.SubmitURL||null;this.ValidateAction=Options.ValidateAction||null;this.ValidateURL=Options.ValidateURL||null;this.PostSubmit=Options.PostSubmit||false;this.ServerValidation=Options.ServerValidation||false;if(typeof(Options.FormObject)==='object'&&Options.FormObject instanceof CFormObject){this.FormObject=Options.FormObject;this.FormName=this.FormObject.FormName;this.FormProperties=this.FormObject.FormProperties;}else{this.FormObject=null;this.FormName=Options.FormName||null;this.FormProperties=Options.FormProperties||{};}
this.FormTemplate=Options.FormTemplate||null;this.TooltipTemplate=Options.TooltipTemplate||null;this.DisabledClass=Options.DisabledClass||'FormDisabled';this.ErrorClass=Options.ErrorClass||'FormError';this.DisableErrors=Options.DisableErrors||false;this.DisableTooltips=Options.DisableTooltips||false;this.TooltipPosition=Options.TooltipPosition||null;this.TooltipClass=Options.TooltipClass||null;this.Tooltips={};this.ValidateOnSubmit=Options.ValidateOnSubmit||true;this.ValidateOnInit=Options.ValidateOnInit||false;this.ValidateAfterSubmit=Options.ValidateAfterSubmit||false;this.ScrollOnError=Options.ScrollOnError||true;this.AnimationInterval=Options.AnimationInterval||250;this.ChildViews={};this.DataProperty=Options.DataProperty||null;this.HandleSpecialKeys=true;if(typeof(Options.HandleSpecialKeys)==="boolean")this.HandleSpecialKeys=Options.HandleSpecialKeys;this.Enabled=true;this.Sending=false;this.Submitted=false;this.SentSubmit=false;this.SentValidate=false;this.ValidationSuccessful=null;this.SubmissionSuccessful=null;this.Cache=CElementCacheGlobal.Register(this.FormName);if(typeof(Options.TooltipContainer)!=='undefined'){this.Cache().Store('TooltipContainer',Options.TooltipContainer);}else{this.Cache().Store('TooltipContainer','body');}
if(typeof(Options.ScrollContainer)!=='undefined'){this.Cache('ScrollContainer',Options.ScrollContainer);}else{this.Cache('ScrollContainer','html, body');}
if(typeof(Options.ErrorContainer)!=='undefined'){this.Cache('ErrorContainer',Options.ErrorContainer);}
this.Setup();};CFormView.prototype.Setup=function(){var self=this;if(this.FormObject===null){this.FormObject=new CFormObject(this.FormName,{},this.FormProperties);}
this.FormObject.GetFormElement().on('submit',function(Event){if(self.__PostSubmit){return true;}
Event.preventDefault();self.Submit();return false;});if(this.HandleSpecialKeys===true){this.FormObject.GetFormElement().on('keyup keypress',':input:not(textarea):not([type=submit])',function(Event){var KeyCode=Event.keyCode||Event.which;if(KeyCode===13){Event.preventDefault();}});}
this.FormObject.GetElements().on('change',function(){if(self.ValidationSuccessful===false&&self.ServerValidation!==true){self.Validate();if(self.DisableErrors!==true){self.ShowErrors();}
if(self.DisableTooltips!==true){self.ShowTooltips();}}});if(this.ValidateOnInit===true){this.Validate();if(self.DisableErrors!==true){self.ShowErrors();}
if(self.DisableTooltips!==true){self.ShowTooltips();}}};CFormView.prototype.GetData=function(){this.FormObject.LoadData();var Data=$.extend({},this.FormObject.Get());if(typeof(this.OnGetData)==='function'){Data=$.extend({},Data,this.OnGetData(Data));}
for(var ChildID in this.ChildViews){var ChildView=this.ChildViews[ChildID];if(ChildView.DataProperty!==null){if(typeof(Data[ChildView.DataProperty])==='undefined'){Data[ChildView.DataProperty]=[];}
Data[ChildView.DataProperty].push(ChildView.GetData());}else{Data[ChildID]=ChildView.GetData();}}
return Data;};CFormView.prototype.Validate=function(){var IsValid=true;var Cache=this.Cache;if(typeof(this.OnBeforeValidate)==='function'){if(this.OnBeforeValidate()===false){IsValid=false;}}
this.FormObject.LoadData();if(!this.FormObject.Validate()){IsValid=false;}
for(var ChildID in this.ChildViews){if(!this.ChildViews[ChildID].Validate()){IsValid=false;}}
if(typeof(this.OnAfterValidate)==='function'){if(this.OnAfterValidate()===false){IsValid=false;}}
this.ValidationSuccessful=IsValid;return IsValid;};CFormView.prototype.ShowErrors=function(){var FormErrors=this.FormObject.GetErrors();this.FormObject.GetElements().removeClass(this.ErrorClass);this.FormObject.GetLabels().removeClass(this.ErrorClass);for(var Name in FormErrors){var $Element=this.FormObject.GetElement(Name);if($Element.data('tooltip-target')){$Element=$($Element.data('tooltip-target'));}
$Element.addClass(this.ErrorClass);this.FormObject.GetLabel(Name).addClass(this.ErrorClass);}
for(var ChildID in this.ChildViews){this.ChildViews[ChildID].ShowErrors();}
if(typeof(this.OnShowErrors)==='function'){this.OnShowErrors();}
return this;};CFormView.prototype.ShowTooltips=function(){var Name;for(Name in this.Tooltips){this.Tooltips[Name].Hide();}
var FormErrors=this.FormObject.GetErrors();for(Name in FormErrors){var Errors=FormErrors[Name];var $Element=this.FormObject.GetElement(Name);if($Element.data('tooltip-target')){$Element=$($Element.data('tooltip-target'));}
if(!$Element.is(':visible')){console.warn(this.FormName,Name,Errors);continue;}
var ErrorContent=Errors.join('<br/>');if(typeof(this.Tooltips[Name])==='undefined'){this.Tooltips[Name]=new CTooltip($Element,ErrorContent,{Container:this.Cache('TooltipContainer'),Position:this.TooltipPosition,Class:this.TooltipClass});}else{this.Tooltips[Name].SetContent(ErrorContent);}
this.Tooltips[Name].Show();}
for(var ChildID in this.ChildViews){this.ChildViews[ChildID].ShowTooltips();}
if(typeof(this.OnShowTooltips)==='function'){this.OnShowTooltips();}
return this;};CFormView.prototype.HideErrors=function(){this.FormObject.GetElements().removeClass(this.ErrorClass);this.FormObject.GetLabels().removeClass(this.ErrorClass);};CFormView.prototype.HideTooltips=function(){var Name;for(Name in this.Tooltips){this.Tooltips[Name].Hide();}};CFormView.prototype.Submit=function(SubmitCallback){var self=this;if(this.Enabled===false){return this;}
this.Submitted=true;this.DisableForm();var SendToServer=true;if(typeof(this.OnBeforeSubmit)==='function'){this.OnBeforeSubmit();}
var DoValidation=function(){if(self.Validate()){if(typeof(self.OnValidateSuccess)==='function'){self.OnValidateSuccess();}
for(var ChildID in self.ChildViews){if(typeof(self.ChildViews[ChildID].OnValidateSuccess)==='function'){self.ChildViews[ChildID].OnValidateSuccess();}}}else{if(typeof(self.OnValidateFail)==='function'){self.OnValidateFail();}
for(var ChildID in self.ChildViews){if(typeof(self.ChildViews[ChildID].OnValidateFail)==='function'){self.ChildViews[ChildID].OnValidateFail();}}
SendToServer=false;}
if(self.DisableErrors!==true){self.ShowErrors();}
if(self.DisableTooltips!==true){self.ShowTooltips();}
if(self.ValidationSuccessful===false&&self.ScrollOnError===true){self.ScrollToError();}};if(this.ValidateOnSubmit){DoValidation();}
if(SendToServer){if(typeof(SubmitCallback)==='undefined'){SubmitCallback=null;}
if(this.ValidateAfterSubmit===true){SubmitCallback=DoValidation;}
if(this.ServerValidation===true){this.DeferredSendValidate(function(ResponseData,Message){if(self.ValidationSuccessful){self.DeferredSendSubmit(SubmitCallback);}else{if(self.DisableErrors!==true){self.ShowErrors();}
if(self.DisableTooltips!==true){self.ShowTooltips();}
if(self.ValidationSuccessful===false&&self.ScrollToError===true){self.ScrollToError();}}});}else{this.DeferredSendSubmit(SubmitCallback);}}else{this.EnableForm();}
return this;};CFormView.prototype.ScrollToError=function(){var self=this;var $Error=this.FormObject.GetFormElement().find('.'+this.ErrorClass);if(!$Error.length)return this;this.Cache('ScrollContainer').animate({scrollTop:$Error.eq(0).offset().top-150},this.AnimationInterval,function(){if(self.DisableTooltips!==true){self.ShowTooltips();}});return this;};CFormView.prototype.SendSubmit=function(Callback){var self=this;if(this.PostSubmit){this.__PostSubmit=true;this.FormObject.GetFormElement().submit();this.__PostSubmit=false;if(typeof(self.OnAfterSubmit)==='function'){self.OnAfterSubmit({},"No submit route");}
if(typeof(Callback)==='function'){Callback({},"No submit route");}
self.EnableForm();return this;}
this.Sending=true;this.SentSubmit=true;var RequestData=this.RequestData();RequestData[this.FormName]=this.GetData();var Request=(this.SubmitAction!==null?this.SubmitAction:this.SubmitURL);if(Request===null){self.Sending=false;self.SubmissionSuccessful=false;if(typeof(self.OnSubmitFail)==='function'){self.OnSubmitFail({},"No submit route");}
if(typeof(self.OnAfterSubmit)==='function'){self.OnAfterSubmit({},"No submit route");}
if(typeof(Callback)==='function'){Callback({},"No submit route");}
self.EnableForm();return this;}
CAJAX.Add(Request,RequestData,{OnSuccess:function(ResponseData,Message){self.Sending=false;self.SubmissionSuccessful=true;if(typeof(self.OnSubmitSuccess)==='function'){self.OnSubmitSuccess(ResponseData,Message);}
if(typeof(self.OnAfterSubmit)==='function'){self.OnAfterSubmit(ResponseData,Message);}
if(typeof(Callback)==='function'){Callback(ResponseData,Message);}
self.EnableForm();return true;},OnError:function(ResponseData,Message){self.Sending=false;self.SubmissionSuccessful=false;if(typeof(self.OnSubmitFail)==='function'){self.OnSubmitFail(ResponseData,Message);}
if(typeof(self.OnAfterSubmit)==='function'){self.OnAfterSubmit(ResponseData,Message);}
if(typeof(Callback)==='function'){Callback(ResponseData,Message);}
self.EnableForm();return false;}});return this;};CFormView.prototype.SendValidate=function(Callback){var self=this;this.Sending=true;this.SentValidate=true;var RequestData={};RequestData[this.FormName]=this.GetData();var Request=(this.ValidateAction!==null?this.ValidateAction:this.ValidateURL);CAJAX.Add(Request,RequestData,{OnSuccess:function(ResponseData,Message){self.Sending=false;self.ValidationSuccessful=true;if(typeof(self.OnValidateSuccess)==='function'){self.OnValidateSuccess(ResponseData,Message);}
if(typeof(self.OnAfterValidate)==='function'){self.OnAfterValidate(ResponseData,Message);}
if(typeof(Callback)==='function'){Callback(ResponseData,Message);}
self.EnableForm();return true;},OnError:function(ResponseData,Message){self.Sending=false;self.ValidationSuccessful=false;self.FormObject.AddErrors(ResponseData.Errors);if(typeof(self.OnValidateFail)==='function'){self.OnValidateFail(ResponseData,Message);}
if(typeof(self.OnAfterValidate)==='function'){self.OnAfterValidate(ResponseData,Message);}
if(typeof(Callback)==='function'){Callback(ResponseData,Message);}
self.EnableForm();return false;}});return this;};CFormView.prototype.Success=function(){return(this.ValidationSuccessful===true&&this.SubmissionSuccessful===true);};CFormView.prototype.DisableForm=function(){this.Enabled=false;this.FormObject.GetFormElement().addClass(this.DisabledClass);};CFormView.prototype.EnableForm=function(){this.Enabled=true;this.FormObject.GetFormElement().removeClass(this.DisabledClass);};CFormView.prototype.RequestData=function(){return{};};CFormView.prototype.CreateChildView=function(ID,Options){var ChildView=new CFormView(Options);this.ChildViews[ID]=ChildView;return ChildView;};CFormView.prototype.DeleteChildView=function(ID){if(typeof(this.ChildViews[ID])!=='undefined'){var ChildView=this.ChildViews[ID];ChildView.FormObject.GetElements().removeClass(ChildView.ErrorClass);ChildView.FormObject.GetLabels().removeClass(ChildView.ErrorClass);for(var Name in ChildView.Tooltips){ChildView.Tooltips[Name].Hide();}
delete this.ChildViews[ID];}
return this;};CFormView.prototype.AddChildView=function(ID,ChildView){this.ChildViews[ID]=ChildView;return this;};CFormView.prototype.GetChildView=function(ID){if(typeof(this.ChildViews[ID])==='undefined'){return null;}
return this.ChildViews[ID];};CFormView.prototype.OnAfterSetup=function(){};CFormView.prototype.OnBeforeSubmit=function(){};CFormView.prototype.OnAfterSubmit=function(){};CFormView.prototype.OnSubmitSuccess=function(){};CFormView.prototype.OnSubmitFail=function(){};CFormView.prototype.OnBeforeValidate=function(){};CFormView.prototype.OnAfterValidate=function(){};CFormView.prototype.OnValidateSuccess=function(){};CFormView.prototype.OnValidateFail=function(){};CFormView.prototype.OnShowErrors=function(){};CFormView.prototype.OnShowTooltips=function(){};CFormView.prototype.DeferredSendSubmit=function(SubmitCallback){this.SendSubmit(SubmitCallback);};CFormView.prototype.DeferredSendValidate=function(SubmitCallback){this.SendValidate(SubmitCallback);};var Keypress={__Pressed:{},__Handlers:{},__CharMap:{backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,printscreen:44,insert:45,delete:46,command:91,tilde:176}};Keypress.Add=function(Combination,Handler){this.__Handlers[Combination.toLowerCase()]=Handler;if(!this.__Initialized){this.__Initialize();}};Keypress.Remove=function(Combination){delete this.__Handlers[Combination];};Keypress.OnKeyDown=function(Event){var self=Event.data.self;for(var Key in self.__CharMap){if(Event.which===self.__CharMap[Key]){self.__Pressed[Key]=true;break;}}};Keypress.OnKeyUp=function(Event){var self=Event.data.self;self.__CheckHandlers(Event);for(var Key in self.__CharMap){if(Event.which===self.__CharMap[Key]){self.__Pressed[Key]=false;break;}}};Keypress.__Initialize=function(){$(document.body).on('keydown',{self:this},this.OnKeyDown);$(document.body).on('keyup',{self:this},this.OnKeyUp);};Keypress.__CheckHandlers=function(Event){var KeyCode=Event.which;var Char=String.fromCharCode(KeyCode).toLowerCase();for(var Combo in this.__Handlers){var Parts=Combo.split('+');var TriggerHandler=true;for(var i in Parts){var ComboKey=Parts[i];if(!this.IsPressed(ComboKey)&&ComboKey!==Char){TriggerHandler=false;break;}}
if(TriggerHandler===false){continue;}
Event.stopPropagation();var Handler=this.__Handlers[Combo];if(typeof(Handler)==='function'){Handler(Event);}
if(typeof(Handler)==='object'){}}};Keypress.IsPressed=function(Key){return(this.__Pressed[Key.toLowerCase()]===true);};$(document).ready(function(){CControls.Initialize();});var CControls={Initialized:false,ControlTag:'wj-control',Classes:{Autocomplete:'CAutocomplete',DatePicker:'CDatePicker',MonthPicker:'CMonthPicker',TimePicker:'CTimePicker',Upload:'CUpload',Toggle:'CToggle',ColorList:'CColorList',ColorPicker:'CColorPicker',CountryList:'CCountryList',Slider:'CSlider',StateList:'CStateList',PasswordStrength:'CPasswordStrength',RTE:'CRTE',CalloutBlock:'CCalloutBlock',Carousel:'CCarousel',FilterBar:'CFilterBar',HeroVideo:'CHeroVideo',HTMLContent:'CHTMLContent',MapBlock:'CMapBlock',Navigation:'CNavigation',SlidingMenu:'CSlidingMenu',AjaxLoading:'CAjaxLoading',Lightbox:'CLightbox'},Controls:{},ControlsByType:{}};CControls.Initialize=function(){if(this.Initialized){return;}
this.ParseDom();this.Initialized=true;};CControls.Get=function(ID){if(typeof(this.Controls[ID])==='undefined'){console.error('Invalid control ID',ID);return false;}
return this.Controls[ID];};CControls.GetByType=function(Type){if(typeof(this.ControlsByType[Type])==='undefined'){console.error('Invalid control Type',Type);return false;}
var ControlList=[];for(var i=0;i<this.ControlsByType[Type].length;i++){var ID=this.ControlsByType[Type][i];ControlList.push(this.Get(ID));}
return ControlList;};CControls.Register=function(ID,ControlName,Control){this.Controls[ID]=Control;if(typeof(this.ControlsByType[ControlName])==='undefined'){this.ControlsByType[ControlName]=[];}
this.ControlsByType[ControlName].push(ID);return this;};CControls.ParseDom=function($Context){if(typeof($Context)==='undefined'){$Context=$(document.body);}
var self=this;var Controls=[];$('wj-control',$Context).each(function(){Controls.push(self.ParseControl($(this)));});for(var i=0;i<Controls.length;i++){var Control=Controls[i];if(typeof(Control.OnAfterSetup)==='function'){Control.OnAfterSetup();}}};CControls.ParseControl=function($Control){var ControlName=$Control.data('control');if(typeof(this.Classes[ControlName])!=='string'){console.log('Invalid control',ControlName);return;}
var ControlID=$Control.data('control-id');if(typeof(ControlID)==="undefined"){ControlID=CUtil.UUID();if($Control.children().length==1){$Control.children().prop("id",ControlID);}}
var Data=$Control.data();var Options={};for(var Name in Data){var OptionName=Name;OptionName=OptionName.charAt(0).toUpperCase()+OptionName.substr(1);OptionName=OptionName.replace(/id$/i,'ID');Options[OptionName]=Data[Name];}
Options.ControlID=ControlID;var $Contents=$Control.children();$Contents.insertAfter($Control);$Control.remove();var ClassName=this.Classes[ControlName];var Control=new window[ClassName](Options);this.Register(ControlID,ControlName,Control);return Control;};var CControl=function(Options){};CControl.prototype.Setup=function(){};CControl.prototype.Validate=function(){return true;};CControl.prototype.OnFormError=function(){};var CSelect=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.DataSet=Options.DataSet||[];this.OptionClass=Options.OptionClass||null;this.PlaceholderLabel=Options.PlaceholderLabel||'- Select -';this.PlaceholderValue=Options.PlaceholderValue||CValidationObject.prototype.PLACEHOLDER_VALUE;this.ValueProperty=Options.ValueProperty||'Value';this.LabelProperty=Options.LabelProperty||'Label';this.OptionTemplate=Options.OptionTemplate||'SelectOption';this.OptionSort=Options.OptionSort||null;this.Cache=CElementCacheGlobal.Register('CSelect_'+this.ID,{Input:'#'+this.ID});this.Setup();};CSelect.prototype.Setup=function(){return this;};CSelect.prototype.GetValue=function(){return this.Cache('Input').val();};CSelect.prototype.SetValue=function(Value){this.Cache('Input').val(Value);return this;};CSelect.prototype.SetDataSet=function(DataSet,Render){this.DataSet=DataSet;if(typeof(Render)==='undefined'||Render===true){this.UpdateOptions();}
return this;};CSelect.prototype.UpdateOptions=function(){var SelectedValue=this.Cache('Input').val();if(typeof(SelectedValue)==='undefined'||SelectedValue===''){SelectedValue=this.PlaceholderValue;}
this.Cache('Input').html(this.GetOptionHTMLString()).val(SelectedValue);if(this.Cache('Input').val()===null){this.Cache('Input').val(this.PlaceholderValue);}
return this;};CSelect.prototype.GetOptionHTMLString=function(){var Template=new CTemplateObject(this.OptionTemplate,{},{Control:this,SelectedValue:this.Cache('Input').val()});Template.SetParameter('Option',{Value:this.PlaceholderValue,Label:this.PlaceholderLabel});var H=Template.Render(true);if(typeof(this.DataSet)!=='object'){return H;}
this.PrepareDataSet();var i,OptionData;for(i=0;i<this.DataSet.DataSet.length;i++){OptionData=this.DataSet.GetInstance(i);Template.SetParameters({Option:{Value:OptionData.Get(this.ValueProperty),Label:OptionData.Get(this.LabelProperty)}});H+=Template.Render(true);}
return H;};CSelect.prototype.PrepareDataSet=function(){if(!this.DataSet instanceof CCollection){this.DataSet=new CCollection(this.DataSet);}};var CToggle=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Cache=CElementCacheGlobal.Register('CToggle_'+this.ID,{Input:'#'+this.ID,Toggle:'#'+this.ID+'_Toggle'});this.Setup();};CToggle.prototype=Object.create(CControl.prototype);CToggle.prototype.Setup=function(){var self=this;this.Cache('Toggle').on("click",{self:this},this.OnClick);this.Refresh();this.Cache('Toggle').on('focus',{self:this},this.SetupFocus).on('blur',{self:this},this.TeardownFocus);this.Cache('Input').on('change',{self:this},function(){self.Refresh();});};CToggle.prototype.Refresh=function(){if(this.Cache('Input').val()==1){this.Cache('Toggle').addClass("ToggleActive");}else{this.Cache('Toggle').removeClass("ToggleActive");}};CToggle.prototype.OnClick=function(Event){Event.preventDefault();Event.data.self.Toggle();return false;};CToggle.prototype.Activate=function(){if(this.Cache('Input').val()!==1){this.Cache('Toggle').addClass("ToggleActive");this.Cache('Input').val(1);this.Cache('Input').trigger('change');}};CToggle.prototype.Deactivate=function(){if(this.Cache('Input').val()==1){this.Cache('Toggle').removeClass("ToggleActive");this.Cache('Input').val(0);this.Cache('Input').trigger('change');}};CToggle.prototype.Toggle=function(){if(this.Cache('Input').val()==1){this.Cache('Toggle').removeClass("ToggleActive");this.Cache('Input').val(0);}else{this.Cache('Toggle').addClass("ToggleActive");this.Cache('Input').val(1);}
this.Cache('Input').trigger('change');};CToggle.prototype.Focus=function(){this.Cache('Toggle').focus();};CToggle.prototype.SetupFocus=function(Event){var self=Event.data.self;$(document).on('keyup',{self:self},self.OnKeypress);};CToggle.prototype.TeardownFocus=function(Event){var self=Event.data.self;$(document).off('keyup',self.OnKeypress);};CToggle.prototype.OnKeypress=function(Event){var self=Event.data.self;var KeyCode=Event.which;switch(KeyCode){case 37:case 78:self.Deactivate();break;case 39:case 89:self.Activate();break;case 32:self.Toggle();break;default:return true;}
Event.preventDefault();return false;};var CUpload=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ButtonID=Options.ButtonID||null;this.UploadAction=Options.UploadAction||'System.UploadFile';this.UploadURL=Options.UploadURL||null;this.AllowRemove=Options.AllowRemove||false;this.FileURL=Options.FileUrl||null;this.MaxFileSize=Options.MaxFileSize||5242880;this.Cache=CElementCacheGlobal.Register('CUpload_'+this.ID,{Input:'#'+this.ID+'_File',Button:'#'+this.ButtonID});if(typeof(Options.OnFileComplete)==='function'){this.OnFileComplete=Options.OnFileComplete;}
if(typeof(Options.OnBeforeFileComplete)==='function'){this.OnBeforeFileComplete=Options.OnBeforeFileComplete;}
if(typeof(Options.OnAfterFileComplete)==='function'){this.OnAfterFileComplete=Options.OnAfterFileComplete;}
this.Cache().Store('Container',this.Cache('Button').parents('.FileUploadContainer'));this.Cache().Define({Progress:['.FileUploadProgress','Container'],Notice:['.FileUploadNotice','Container'],Download:['.FileUploadDownload','Container'],Preview:['.FileUploadPreview','Container'],FileName:['#'+this.ID+'_FileName','Container'],TempID:['#'+this.ID+'_TempID','Container'],OriginalFileName:['#'+this.ID+'_OriginalFileName','Container'],Remove:['#'+this.ID+'_Remove','Container'],RemoveLink:['.FileUploadRemove','Container']});this.Setup();};CUpload.prototype=Object.create(CControl.prototype);CUpload.prototype.Setup=function(){var self=this;if(this.ButtonID!==null){this.Cache('Button').on('click',{self:this},this.TriggerDialog);}
this.Cache('Input').on('change',{self:this},this.OnInputChange).on('click',{self:this},this.OnInputClick);this.Cache('Preview').on('click',{self:this},this.OnPreviewClick);this.Cache('RemoveLink').on('click',function(){self.OnRemove();});if(this.AllowRemove&&this.FileURL!==null){this.Cache('RemoveLink').addClass('FileUploadRemoveActive');}};CUpload.prototype.TriggerDialog=function(Event){Event.data.self.Cache('Input').trigger('click');Event.stopPropagation();};CUpload.prototype.OnInputClick=function(Event){Event.stopPropagation();};CUpload.prototype.OnInputChange=function(Event){Event.stopPropagation();Event.data.self.SendFiles(this.files);};CUpload.prototype.OnPreviewClick=function(Event){Event.stopPropagation();var PreviewURL=$(this).data('previewurl');if(typeof(PreviewURL)!=="string"||PreviewURL===''){return;}
window.open(PreviewURL);};CUpload.prototype.OnRemove=function(){this.Cache('Input').val('');this.Cache('FileName').val('');this.Cache('TempID').val('');this.Cache('OriginalFileName').val('');this.Cache('Container').attr("data-filetype","");this.Cache('Preview').css('background-image','url(/Theme/Base/Images/Placeholder.svg)').data('previewurl','');this.Cache('Download').attr('href','');this.Cache('Progress').css("width","0%");this.Cache('Notice').html('Ready to Upload');this.Cache('Remove').val(1);this.Cache('RemoveLink').removeClass('FileUploadRemoveActive');};CUpload.prototype.SendFiles=function(Files){var self=this;var Request=(this.UploadURL!==null)?this.UploadURL:this.UploadAction;for(var i=0;i<Files.length;i++){var File=Files[i];CAJAX.AddUpload(Request,File,{OnBeforeSend:function(XHR){self.OnUploadStart(XHR,File);},OnUploadProgress:function(XHREvent){self.OnUploadProgress(XHREvent,File);},OnSuccess:function(ResponseData,Message){self.OnUploadSuccess(ResponseData,Message,File);},OnError:function(ResponseData,Message){self.OnUploadError(ResponseData,Message,File);}});}};CUpload.prototype.OnUploadStart=function(XHR,File){this.Cache('Progress').attr("data-error",0);this.Cache('Progress').attr("data-success",0);this.Cache('Progress').css("width","0%");this.Cache('Notice').html(File.name);};CUpload.prototype.OnUploadProgress=function(XHREvent,File){if(XHREvent.lengthComputable){var PercentComplete=XHREvent.loaded/XHREvent.total;this.Cache('Progress').css("width",(100*PercentComplete)+"%");this.Cache('Notice').html(File.name);}};CUpload.prototype.OnUploadSuccess=function(ResponseData,Message,File){if(typeof(this.OnBeforeFileComplete)==='function'){this.OnBeforeFileComplete(ResponseData,File);}
this.Cache('Progress').attr('data-success',1);this.Cache('Notice').html('All Files Uploaded');if(typeof(this.OnFileComplete)==='function'){this.OnFileComplete(ResponseData,File);}
if(typeof(this.OnAfterFileComplete)==='function'){this.OnAfterFileComplete(ResponseData,File);}
this.Cache('Remove').val('');this.Cache('RemoveLink').addClass('FileUploadRemoveActive');this.Cache('FileName').trigger('change');};CUpload.prototype.OnUploadError=function(ResponseData,Message,File){this.Cache('Progress').attr('data-error',1);this.Cache('Notice').html(Message);this.Cache('RemoveLink').removeClass('FileUploadRemoveActive');};CUpload.prototype.OnFileComplete=function(ResponseData,File){this.Cache('FileName').val(ResponseData.FileName);this.Cache('TempID').val(ResponseData.TempID);this.Cache('OriginalFileName').val(ResponseData.OriginalFileName);if(typeof(ResponseData.PreviewURL)==='string'){this.Cache('Container').attr("data-filetype","Image");this.Cache('Preview').css('background-image','url('+ResponseData.PreviewURL+')').data('previewurl',ResponseData.PreviewURL);}else{this.Cache('Container').attr("data-filetype","File");this.Cache('Download').attr('href',ResponseData.DownloadURL);}
this.Cache('Container').trigger("change",ResponseData);};var CRTE=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.WebsiteID=Options.WebsiteID||null;this.WebsiteControlID=Options.WebsiteControlID||null;this.PageType=Options.PageType||"CMS";this.ClassType=this.PageType.replace(/[^a-zA-Z]/g,'')+"Page";this.RedactorSettings=Options.RedactorSettings||{};this.Height=Options.Height||400;this.Cache=CElementCacheGlobal.Register('CRTE_'+this.ID,{Input:'#'+this.ID});this.Setup();};CRTE.prototype=Object.create(CControl.prototype);CRTE.prototype.Setup=function(){var self=this;if(typeof($.Redactor)!=='function'){console.error('Redactor plugin has not been loaded: Required for CRTE instance.');return;}
if(typeof(this.Height)!=="number"){this.Height=400;}
var DefaultRedactorSettings={minHeight:this.Height,overrideStyles:false,removeComments:false,replaceTags:false,script:false,toolbarFixed:false,imageTag:'figure',imageResizable:true,imagePosition:true,imageUpload:"./UploadFile?Source=Redactor",imageManagerJson:"./GetImages?Source=Redactor",imageTypes:['image/png','image/jpeg','image/gif','image/bmp','image/svg+xml','image/x-icon'],fileUpload:"./UploadFile?Source=Redactor",plugins:['inlinestyle','alignment','bufferbuttons','fontcolor','imagemanager','source','table','video'],buttons:['source','format','bold','italic','deleted','ul','ol','outdent','indent','image','video','file','table','link','alignment','horizontalrule'],callbacks:{imageUploadError:function(Data){var ErrorData=JSON.parse(Data.xhr.response);CAJAX.HandleErrorByCode(ErrorData.Response.ErrorCode,ErrorData.Response,ErrorData.Message,Data.xhr);},fileUploadError:function(Data){var ErrorData=JSON.parse(Data.xhr.response);CAJAX.HandleErrorByCode(ErrorData.Response.ErrorCode,ErrorData.Response,ErrorData.Message,Data.xhr);}}};var RedactorSettings=$.extend(true,{},DefaultRedactorSettings,this.RedactorSettings);this.Cache('Input').redactor(RedactorSettings);var Redactor=this.Cache('Input').redactor('core.object');$(".redactor-box").addClass("Page").addClass(this.ClassType).prop("id",this.ID+'_Container');$(".redactor-editor").addClass("HTMLContent");$.each(Redactor.button.all(),function(i,s){var key=$(s).attr('rel');var button=Redactor.button.get(key);Redactor.button.setIcon(button,'<i class="RedactorIcon"></i>');});if(this.WebsiteControlID!==null){this.Cache('WebsiteControl','#'+this.WebsiteControlID);this.LoadWebsiteCSS();this.Cache('WebsiteControl').on('change',function(){self.LoadWebsiteCSS();});}else
if(this.WebsiteID!==null){this.LoadWebsiteCSS();}
return this;};CRTE.prototype.LoadWebsiteCSS=function(){var self=this;var WebsiteID=null;if(this.WebsiteControlID!==null){WebsiteID=this.Cache('WebsiteControl').val();}else
if(this.WebsiteID!==null){WebsiteID=this.WebsiteID;}
if(typeof(WebsiteID)==="undefined"||WebsiteID===""||WebsiteID===CValidationObject.prototype.PLACEHOLDER_VALUE){return;}
CAJAX.Add('GetPageStylesheet',{WebsiteID:WebsiteID,PageType:this.PageType},function(ResponseData,Message){$('.WebsiteCSS').remove();if(typeof(ResponseData.Stylesheets)==='undefined'){return;}
if(ResponseData.Stylesheets.length==0){return;}
for(var i in ResponseData.Stylesheets){var StylesheetURL=ResponseData.Stylesheets[i];var Element=$('<link class="WebsiteCSS" rel="stylesheet" type="text/css">').appendTo('head');Element.prop("href",StylesheetURL);}});};CRTE.prototype.Remove=function(){this.Cache('Input').redactor('core.destroy');return this;};CRTE.prototype.SetContent=function(Value){this.Cache('Input').redactor('code.set',Value);return this;};var CCountryList=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Cache=CElementCacheGlobal.Register('CToggle_'+this.ID,{Input:'#'+this.ID});this.Setup();};CCountryList.prototype=Object.create(CControl.prototype);CCountryList.prototype.Setup=function(){};CCountryList.prototype.GetValue=function(){return this.Cache('Input').val();};var CStateList=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.CountryControlID=Options.CountryControlID||null;this.CountryID=Options.CountrID||null;this.PlaceholderLabel=Options.Placeholder||'- Select -';this.PlaceholderValue=Options.PlaceholderValue||CValidationObject.prototype.PLACEHOLDER_VALUE;this.ValueProperty=Options.ValueProperty||'Abbreviation';this.LabelProperty=Options.LabelProperty||'Abbreviation';this.Cache=CElementCacheGlobal.Register('CStateList_'+this.ID,{Input:'#'+this.ID,TextBox:'#'+this.ID+'_TextBox',Select:'#'+this.ID+'_Select'});this.CountryControl=null;this.Setup();};CStateList.prototype=Object.create(CControl.prototype);CStateList.prototype.Setup=function(){var self=this;if(this.Cache('Select').children('option').length<=1){this.Cache('Select').hide();this.Cache('TextBox').show();this.Cache('Input').val(this.Cache('TextBox').val());}else{this.Cache('Select').show();this.Cache('TextBox').hide();}
this.Cache('Select').on('change',function(){self.Cache('TextBox').val($(this).val());self.Cache('Input').val($(this).val()).trigger('change');});this.Cache('TextBox').on('change',function(){self.Cache('Input').val($(this).val()).trigger('change');});};CStateList.prototype.OnAfterSetup=function(){var self=this;if(this.CountryControlID!==null){this.CountryControl=CControls.Get(this.CountryControlID);if(!this.CountryControl instanceof CCountryList){console.error('Invalid country control',this.CountryControlID);}else{this.CountryControl.Cache('Input').on('change',function(){self.UpdateOptions(function(){self.Cache('Select').val(self.PlaceholderValue);self.Cache('TextBox').val('');self.Cache('Input').val(self.PlaceholderValue);});});if(this.CountryControl.GetValue()!==''){self.UpdateOptions();}}}
if(this.CountryID===null&&this.CountryControl!==null){this.CountryID=this.CountryControl.GetValue();}};CStateList.prototype.UpdateOptions=function(Callback){var self=this;var SelectedValue=this.Cache('Input').val();if(typeof(SelectedValue)==='undefined'||SelectedValue===''){SelectedValue=this.PlaceholderValue;}
this.GetStates(this.GetCountryID(),function(States){self.Cache('Select').html(self.GetOptionHTMLString(States)).val(SelectedValue);if(self.Cache('Select').children('option').length<=1){self.Cache('Select').hide();self.Cache('TextBox').show();self.Cache('Input').val(SelectedValue);}else{self.Cache('Select').show();self.Cache('TextBox').hide();}
if(typeof(Callback)==='function'){Callback();}});return this;};CStateList.prototype.GetOptionHTMLString=function(States){var Template=new CTemplateObject('SelectOption',{},{Control:this});Template.SetParameter('Option',{Value:this.PlaceholderValue,Label:this.PlaceholderLabel});var H=Template.Render(true);if(typeof(States)!=='object'){return H;}
var DataSet=new CCollection(States);DataSet.Sort('Name');var i,OptionData;for(i=0;i<DataSet.DataSet.length;i++){OptionData=DataSet.GetInstance(i);Template.SetParameters({Option:{Value:OptionData.Get(this.ValueProperty),Label:OptionData.Get(this.LabelProperty)}});H+=Template.Render(true);}
return H;};CStateList.prototype.GetStates=function(CountryID,Callback){CAJAX.Add('System.ServeLocales',{Type:'States',CountryID:CountryID},function(ResponseData,Message){Callback(ResponseData.States);});};CStateList.prototype.GetCountryID=function(){if(this.CountryControl!==null){return this.CountryControl.GetValue();}
return this.CountryID;};CStateList.prototype.Validate=function(Definitions){return true;};var CDatePicker=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.MinDate=null;if(typeof(Options.MinDate)!=="undefined"){this.MinDate=new Date(Options.MinDate);}else{this.MinDate=new Date(2015,0,1);}
this.MaxDate=null;if(typeof(Options.MaxDate)!=="undefined"){this.MaxDate=new Date(Options.MaxDate);}else{this.MaxDate=new Date(2034,0,1);}
this.Cache=CElementCacheGlobal.Register('CDatePicker_'+this.ID,{Input:'#'+this.ID});this.Setup();};CDatePicker.prototype=Object.create(CControl.prototype);CDatePicker.prototype.Setup=function(){this.Cache('Input').datepicker({showOn:'both',buttonImageOnly:true,buttonText:'',dateFormat:'m/d/yy',minDate:this.MinDate,maxDate:this.MaxDate,prevText:'&lt;',nextText:'&gt;'});};var CAutocomplete=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Action=Options.Action||null;this.DataSet=[];this.SearchLength=2;if(typeof(Options.SearchLength)!=="undefined"){this.SearchLength=Options.SearchLength;}
this.AjaxOnSearch=Options.AjaxOnSearch||true;this.AppendFormData=Options.AppendFormData||null;this.ResultTemplate=Options.ResultTemplate||'AutocompleteResult';this.ContainerTemplate=Options.ContainerTemplate||'AutocompleteContainer';this.Cache=CElementCacheGlobal.Register('CAutocomplete_'+this.ID,{Input:'#'+this.ID,Search:'#'+this.ID+'_Search',Button:'#'+this.ID+'_SearchButton'});this.Visible=false;this.Setup();};CAutocomplete.prototype=Object.create(CControl.prototype);CAutocomplete.prototype.Setup=function(){var self=this;this.Cache('Search').on('keyup',function(Event){if($(this).val().length<=0){self.Cache('Input').val("").trigger('change');}else
if($(this).val().length>=self.SearchLength){self.TriggerSearch();}});this.Cache('Button').on('click',function(Event){if(self.Cache('Search').val().length>=self.SearchLength){self.TriggerSearch();}
if(self.Cache('Search').val().length<=0){self.Cache('Input').val("").trigger('change');}});return this;};CAutocomplete.prototype.TriggerSearch=function(){var self=this;if(this.AjaxOnSearch===true){this.LoadData(function(ResponseData,Message){self.RenderResults().Show();});}
return this;};CAutocomplete.prototype.LoadData=function(Callback){var self=this;var PostData={};if(this.AppendFormData!==null){var FormName;if(typeof(this.AppendFormData)==='string'){FormName=this.AppendFormData;}
if(this.AppendFormData===true){FormName=this.Cache('Input').attr('id').split('_')[0];}
if(typeof(FormName)==='string'){var Form=new CFormObject(FormName);PostData=$.extend(PostData,Form.LoadData().Get());}}
PostData['Search']=this.Cache('Search').val();CAJAX.Add(this.Action,PostData,{OnSuccess:function(ResponseData,Message){self.DataSet=ResponseData.Results;if(typeof(Callback)==='function'){Callback(ResponseData,Message);}}});return this;};CAutocomplete.prototype.RenderResults=function(){if(!this.Cache().IsCached('Container')){var ContainerTemplate=new CTemplateObject(this.ContainerTemplate,{},this);var $Container=$(ContainerTemplate.Render(true));$Container.on('click','.AutocompleteResult',{self:this},this.OnResultClick);this.Cache().Store('Container',$Container);this.Cache().Store('Results',$Container.children('.AutocompleteResults'));}
var ResultTemplate=new CTemplateObject(this.ResultTemplate,{},{});var H='';var HasResult=false;for(var ID in this.DataSet){ResultTemplate.SetParameters(this.DataSet[ID]);H+=ResultTemplate.Render(true);HasResult=true;}
if(!HasResult){H='<div class="AutocompleteNoResults">No Results</div>';}
this.Cache('Results').html(H);this.Cache('Container').appendTo($(document.body));this.Reposition();return this;};CAutocomplete.prototype.Reposition=function(){var Offset=this.Cache('Search').offset();this.Cache('Container').css({width:this.Cache('Search').outerWidth()+"px",top:Offset.top+this.Cache('Search').outerHeight(),left:Offset.left});return this;};CAutocomplete.prototype.Show=function(){if(this.Visible){return;}
this.Cache('Container').addClass('Active');$(document.body).on('click',{self:this},this.OnDocumentClick);this.Visible=true;};CAutocomplete.prototype.Hide=function(){if(!this.Visible){return;}
this.Cache('Container').removeClass('Active');$(document.body).off('click',this.OnDocumentClick);this.Visible=false;};CAutocomplete.prototype.OnDocumentClick=function(Event){Event.data.self.Hide();};CAutocomplete.prototype.OnResultClick=function(Event){var self=Event.data.self;self.Cache('Input').val($(this).data('id'));self.Cache('Search').val($(this).text());self.Cache('Input').trigger('change');if(typeof(self.OnChange)==='function'){self.OnChange(Event,$(this));}
self.Hide();};CAutocomplete.prototype.OnChange=function(Event,$ListItem){};var CPasswordStrength=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.MinimumLength=Options.MinimumLength||10;this.DebounceInterval=Options.DebounceInterval||250;this.Action=Options.Action||'CheckPassword';this.AppendFormData=Options.AppendFormData||null;this.Cache=CElementCacheGlobal.Register('CPasswordStrength_'+this.ID,{Container:'#'+this.ID+'_Container',Input:'#'+this.ID,Feedback:['.PasswordStrengthFeedback','Container'],Meter:['.PasswordStrengthMeter','Container'],LabelCont:['.PasswordStrengthLabelCont','Container'],Label:['.PasswordStrengthLabel','Container'],InfoLink:['.PasswordStrengthInfoLink','Container'],});this.StrengthIndex=['None','Very Weak','Weak','Average','Strong','Very Strong'];this.Strength=0;this.Reason=null;this.Timeout=null;this.__PreviousCheck=null;this.Setup();};CPasswordStrength.prototype=Object.create(CControl.prototype);CPasswordStrength.prototype.Setup=function(){var self=this;this.Cache('Input').on('keyup',function(Event){self.CheckPassword();});this.Cache('InfoLink').on('click',function(Event){self.ShowInfo();Event.stopPropagation();return false;});return this;};CPasswordStrength.prototype.CheckPassword=function(Callback){var self=this;var Password=this.Cache('Input').val();if(Password===''){this.SetStrength(0);return;}
this.DebounceRequest(this.SendPassword);};CPasswordStrength.prototype.DebounceRequest=function(Callback){var self=this;var NextCall=function(){self.Timeout=null;Callback.apply(self);};var CallNow=(self.Timeout===null?true:false);window.clearTimeout(self.Timeout);self.Timeout=window.setTimeout(NextCall,self.DebounceInterval);if(CallNow){Callback.apply(self);}};CPasswordStrength.prototype.SendPassword=function(){var self=this;var PostData={Password:this.Cache('Input').val()};if(this.__PreviousCheck!==null&&PostData.Password.length===this.__PreviousCheck){return;}
this.__PreviousCheck=PostData.Password.length;if(this.AppendFormData!==null){var FormName;if(typeof(this.AppendFormData)==='string'){FormName=this.AppendFormData;}
if(this.AppendFormData===true){FormName=this.Cache('Input').attr('id').split('_')[0];}
if(typeof(FormName)==='string'){var Form=new CFormObject(FormName);PostData=$.extend(PostData,Form.LoadData().Get());}}
CAJAX.Add(this.Action,PostData,{OnSuccess:function(ResponseData,Message){self.SetStrength(ResponseData.Strength,ResponseData.Reason);if(typeof(ResponseData.Entropy)!=='undefined'){self.Entropy=ResponseData.Entropy;}}});return this;};CPasswordStrength.prototype.SetStrength=function(Index,Reason){var Label=this.StrengthIndex[Index];this.Cache('Container').removeClass('PasswordStrength-'+this.Strength);this.Cache('Container').addClass('PasswordStrength-'+Index);this.Strength=Index;this.Reason=Reason;this.Cache('Label').text(Label);if(Index==0){this.Cache('LabelCont, Meter, InfoLink').hide();}else{this.Cache('LabelCont, Meter, InfoLink').show();}
if(typeof(Reason)==='string'){this.Cache('Feedback').text(Reason).show();}else{this.Cache('Feedback').hide();}};CPasswordStrength.prototype.ShowInfo=function(){var self=this;if(typeof(this.__Dialog)==='undefined'){this.__Dialog=new CDialog({ID:this.ID+'_Dialog',Title:' ',Template:'PasswordStrengthDialog',Width:480,Height:480,Modal:true,DisableClose:true});this.__Dialog.AddButton('Close',function(){self.__Dialog.Close();});}
this.__Dialog.Open();return this;};CPasswordStrength.prototype.OnChange=function(Event,$ListItem){};var CColorList=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Cache=CElementCacheGlobal.Register('CColorPicker_'+this.ID,{SelectedChoices:'#'+this.ID+' .ColorListSelectedChoices',Choices:'#'+this.ID+' .ColorListChoice',Inputs:'#'+this.ID+' input[type]'});this.Setup();};CColorList.prototype=Object.create(CControl.prototype);CColorList.prototype.HexFilter=/[^0-9abcdefABCDEF]/;CColorList.prototype.Setup=function(){var self=this;self.Cache("Choices").each(function(){var HexColor=$(this).data("hexcolor");HexColor=HexColor.toString().replace(self.HexFilter,'');$(this).find(".ColorListChoiceSwatch").css("background-color","#"+HexColor);});self.Cache("Inputs").on("change",function(){self.UpdateChecked();});self.UpdateChecked();return this;};CColorList.prototype.UpdateChecked=function(){var $CheckedInputs=this.Cache("Inputs").filter(":checked");this.Cache("Choices").removeClass("ColorListChoiceChecked");$CheckedInputs.parent().addClass("ColorListChoiceChecked");var SelectedChoices=[];$CheckedInputs.each(function(){var Label=$(this).parent().find("label").text();SelectedChoices.push(Label);});this.Cache('SelectedChoices').html(SelectedChoices.join(', '));};var CColorPicker=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Cache=CElementCacheGlobal.Register('CColorPicker_'+this.ID,{Input:'#'+this.ID,Hex:'#'+this.ID+'_Hex',Button:'#'+this.ID+'_Button',Text:'#'+this.ID+'_Text'});this.Visible=false;this.OptionContainer=null;this.Colors=Options.Colors||[['#000000','#333333','#666666','#999999','#ACACAC','#CECECE','#FFFFFF'],['#FF0000','#F0A804','#FFFF00','#008000','#0000FF','#800080']];if(typeof(this.Colors)==="string"){var Colors=this.Colors.split(",");this.Colors=[];for(var i=0;i<Colors.length;i+=7){this.Colors.push(Colors.slice(i,i+7));}}
this.Setup();};CColorPicker.prototype=Object.create(CControl.prototype);CColorPicker.prototype.HexFilter=/[^0-9abcdefABCDEF]/;CColorPicker.prototype.Setup=function(){var self=this;this.Cache('Button').on('click',{self:this},this.OnButtonClick);if(this.Cache('Input').val()===''){this.Cache('Input').val(0);}
this.Cache('Hex').val(this.GetColorHex());this.Cache('Text').text('#'+this.GetColorHex());this.UpdateColor();return this;};CColorPicker.prototype.OnButtonClick=function(Event){Event.data.self.Toggle();Event.stopPropagation();return false;};CColorPicker.prototype.OnDocumentClick=function(Event){Event.data.self.Deactivate();Event.preventDefault();return false;};CColorPicker.prototype.OnOptionSelect=function(Event){var self=Event.data.self;self.Cache('Input').val($(this).data('value'));self.Cache('Hex').val(self.GetColorHex());self.Cache('Text').text('#'+self.GetColorHex());self.UpdateColor();self.Cache('Input').trigger('change');Event.stopPropagation();return false;};CColorPicker.prototype.Toggle=function(){if(this.Visible){this.Deactivate();}else{this.Activate();}
return this;};CColorPicker.prototype.Activate=function(){if(this.Visible===true){return;}
var self=this;var Controls=CControls.GetByType('ColorPicker');for(var i=0;i<Controls.length;i++){var Control=Controls[i];if(Control.ID!==this.ID){Control.Deactivate();}}
if(this.OptionContainer===null){var ColorOptions=[],RowOptions,i,j,Row;for(i=0;i<this.Colors.length;i++){RowOptions=[];Row=this.Colors[i];for(j=0;j<Row.length;j++){RowOptions.push({Value:this.GetColorInt(Row[j]),HexColor:Row[j]});}
ColorOptions.push(RowOptions);}
var Template=new CTemplateObject('ColorPickerOptions',{},{Value:this.GetColorHex(),Options:ColorOptions});this.OptionContainer=$(Template.Render(true));this.OptionContainer.appendTo($(document.body));this.OptionContainer.on('click','.ColorPicker-Input',{self:this},function(Event){Event.stopPropagation();});this.OptionContainer.on('change','.ColorPicker-Input',{self:this},function(Event){self.UpdateColor($(this).val());});this.OptionContainer.on('click','.ColorPicker-Option',{self:this},this.OnOptionSelect);}
var Offset=this.Cache('Button').offset();this.OptionContainer.css({top:Offset.top+this.Cache('Button').height(),left:Offset.left}).show();$(document.body).on('click',{self:this},this.OnDocumentClick);this.Visible=true;return this;};CColorPicker.prototype.Deactivate=function(){if(this.Visible===false){return;}
this.OptionContainer.hide();$(document.body).off('click',this.OnDocumentClick);this.Visible=false;return this;};CColorPicker.prototype.UpdateColor=function(Value){if(typeof(Value)==='undefined'){Value=this.Cache('Hex').val();}else{this.Cache('Hex').val(Value);}
this.Cache('Button').css('background-color','#'+Value);this.Cache('Input').val(this.GetColorInt(Value));this.Cache('Text').text('#'+this.GetColorHex());if(this.OptionContainer!==null){this.OptionContainer.find('.ColorPicker-Input').val(this.GetColorHex());}
return this;};CColorPicker.prototype.GetColorHex=function(Value){if(typeof(Value)==='undefined'){Value=this.Cache('Input').val();}
Value*=1;Value=Value.toString(16);return('000000'+Value).substring(Value.length);};CColorPicker.prototype.GetColorInt=function(Value){if(typeof(Value)==='undefined'){Value=this.Cache('Hex').val();}
Value=Value.replace(this.HexFilter,'');return parseInt(Value,16);};var CMonthPicker=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Year=Options.Year||null;this.StartYear=Options.StartYear||null;this.EndYear=Options.EndYear||null;this.FutureDatesOnly=Options.FutureDatesOnly||false;this.DisabledMonths={};if(typeof(Options.DisabledMonths)==="string"){var DisabledMonths=Options.DisabledMonths.split(",");var Year;var Month;for(var i in DisabledMonths){var YearMonth=DisabledMonths[i].split("-");if(YearMonth.length!==2)continue;Year=CFilters.Integer(YearMonth[0]);Month=CFilters.Integer(YearMonth[1]);if(typeof(this.DisabledMonths[Year])==="undefined"){this.DisabledMonths[Year]={};}
this.DisabledMonths[Year][Month]=true;}}
this.ReadOnly=Options.ReadOnly||false;this.Type=Options.Type||"Single";this.DialogTemplate=Options.DialogTemplate||'MonthPickerDialog';this.Visible=false;this.Cache=CElementCacheGlobal.Register('CMonthPicker_'+this.ID,{Input:'#'+this.ID,Text:'#'+this.ID+'_Text',SelectButton:'#'+this.ID+'_SelectButton'});this.Values={};this.NumMonths=0;this.Setup();};CMonthPicker.prototype=Object.create(CControl.prototype);CMonthPicker.prototype.Setup=function(){var self=this;this.Cache('SelectButton').on('click',function(Event){self.Show();});this.ReadValues();this.StoreValues();if(this.Year===null){var Now=new Date();this.Year=Now.getFullYear();}};CMonthPicker.prototype.ReadValues=function(){var Year;var Month;var LowestYear=null;var InputValues=this.Cache('Input').val();if(typeof(InputValues)==="string"){InputValues=InputValues.split(",");for(var i in InputValues){var YearMonth=InputValues[i].split("-");if(YearMonth.length!==2)continue;Year=CFilters.Integer(YearMonth[0]);Month=CFilters.Integer(YearMonth[1]);if(typeof(this.Values[Year])==="undefined"){this.Values[Year]={};}
this.Values[Year][Month]=true;if(LowestYear===null||Year<LowestYear){LowestYear=Year;}}}
if(this.Year===null){this.Year=LowestYear;}
if(this.StartYear===null){var Now=new Date();this.StartYear=Now.getFullYear();}};CMonthPicker.prototype.StoreValues=function(){var Buffer=[];var StoredMonth=null;var StoredYear=null;this.NumMonths=0;for(var Year in this.Values){for(var Month in this.Values[Year]){var Active=this.Values[Year][Month];if(Active!==true)continue;if(StoredMonth===null)StoredMonth=Month;if(StoredYear===null)StoredYear=Year;Buffer.push(Year+"-"+(Month<10?"0":"")+Month);this.NumMonths++;}}
var ValueChanged=(this.Cache('Input').val()!=Buffer.join(','));this.Cache('Input').val(Buffer.join(','));if(this.Type==="Single"){if(StoredMonth===null){this.Cache('Text').text("No month selected");}else{var SelectedDate=new Date();SelectedDate.setFullYear(StoredYear);SelectedDate.setMonth(StoredMonth-1,1);this.Cache('Text').text(SelectedDate.format("F Y"));}}else{var Plural=(this.NumMonths!=1?"s":"");this.Cache('Text').text(this.NumMonths==0?"No months selected":this.NumMonths+" month"+Plural+" selected");}
if(ValueChanged){this.OnStoreValues();}};CMonthPicker.prototype.Render=function(){var self=this;if(this.Cache().IsCached('Dialog')===false){var TemplateObj=new CTemplateObject(this.DialogTemplate,{"ID":this.ID,"Year":this.Year},this);var $Dialog=$(TemplateObj.Render(true));$Dialog.on('click','.MonthPickerYearPrevious',function(Event){self.OnPreviousYear(Event);});$Dialog.on('click','.MonthPickerYearNext',function(Event){self.OnNextYear(Event);});$Dialog.on('click','.MonthPickerMonth',function(Event){self.OnSelectMonth(Event);});$Dialog.on('click','.MonthPickerQuickLink',function(Event){self.OnQuickLink(Event);});$Dialog.on('click','.MonthPickerButtonClose',function(Event){self.OnClose(Event);});$(window).on('resize',function(Event){self.Reposition();});this.Cache().Store('Dialog',$Dialog);this.Cache('Dialog').appendTo($(document.body));this.Cache().Store('PreviousYear',$Dialog.find(".MonthPickerYearPrevious"));this.Cache().Store('NextYear',$Dialog.find(".MonthPickerYearNext"));this.Cache().Store('Year',$Dialog.find(".MonthPickerYear"));this.Cache().Store('Months',$Dialog.find(".MonthPickerMonth > input"));}
this.RenderYear();this.Reposition();return this;};CMonthPicker.prototype.RenderYear=function(){this.Cache('Year').text(this.Year);this.Cache('PreviousYear').prop("disabled",(this.Year<=this.StartYear));this.Cache('NextYear').prop("disabled",(this.EndYear!==null&&this.Year>=this.EndYear));this.Cache('Months').prop("checked",false);this.Cache('Months').prop("disabled",false);var Now=new Date();if(this.FutureDatesOnly===true&&this.Year<=Now.getFullYear()){for(var i=1;i<=Now.getMonth();i++){this.Cache('Months').filter("[value="+i+"]").prop("disabled",true);}}
for(var i=1;i<=12;i++){if(typeof(this.DisabledMonths[this.Year])!=="undefined"&&typeof(this.DisabledMonths[this.Year][i])!=="undefined"){this.Cache('Months').filter("[value="+i+"]").prop("disabled",true);}}
if(typeof(this.Values[this.Year])!=="undefined"){for(var Month in this.Values[this.Year]){var Active=this.Values[this.Year][Month];this.Cache('Months').filter("[value="+Month+"]").prop("checked",Active);}}};CMonthPicker.prototype.Reposition=function(){var Offset=this.Cache('SelectButton').offset();var ButtonWidth=this.Cache('SelectButton').outerWidth();var ButtonHeight=this.Cache('SelectButton').outerHeight();var DialogWidth=this.Cache('Dialog').outerWidth();var X=Offset.left;this.Cache('Dialog').removeClass('MonthPickerDialogRight');if(X+DialogWidth>=$(window).outerWidth()){X=Offset.left+ButtonWidth-DialogWidth;this.Cache('Dialog').addClass('MonthPickerDialogRight');}
this.Cache('Dialog').css({top:Offset.top+this.Cache('SelectButton').outerHeight(),left:X});return this;};CMonthPicker.prototype.Show=function(){if(this.Visible)return;this.Render();this.Cache('Dialog').addClass('MonthPickerDialogVisible');var self=this;$(document.body).on('click.'+this.ID,function(Event){self.OnDocumentClick(Event);});this.Visible=true;};CMonthPicker.prototype.Hide=function(){if(this.Visible===false)return;this.StoreValues();this.Cache('Dialog').removeClass('MonthPickerDialogVisible');$(document.body).off('click.'+this.ID);this.Visible=false;this.OnHide();};CMonthPicker.prototype.SetMonthYear=function(Month,Year){if(typeof(Month)!=="number")return;if(typeof(Year)!=="number")return;if(Year<this.StartYear){return;}
if(this.EndYear!==null&&Year>this.EndYear){return;}
var Now=new Date();if(this.FutureDatesOnly===true&&Year==Now.getFullYear()&&Month<Now.getMonth()){return;}
this.Year=Year;this.Values={};this.Values[Year]={};this.Values[Year][Month]=true;this.RenderYear();this.StoreValues();};CMonthPicker.prototype.GetMonthYear=function(){var StoredMonth=null;var StoredYear=null;for(var Year in this.Values){for(var Month in this.Values[Year]){var Active=this.Values[Year][Month];if(Active!==true)continue;if(StoredMonth===null){StoredMonth=Month;StoredYear=Year;break;}}}
StoredMonth=CFilters.Integer(StoredMonth);StoredYear=CFilters.Integer(StoredYear);return[StoredMonth,StoredYear];};CMonthPicker.prototype.GetValue=function(){return this.Cache('Input').val();};CMonthPicker.prototype.SetValue=function(Value){this.Cache("Input").val(Value);this.ReadValues();this.StoreValues();};CMonthPicker.prototype.SetValues=function(Values){this.Values=Values;this.StoreValues();};CMonthPicker.prototype.GetNumMonthsSelected=function(){return this.NumMonths;};CMonthPicker.prototype.OnDocumentClick=function(Event){if(this.Cache('Dialog').is(Event.target)===false&&this.Cache('SelectButton').is(Event.target)===false&&this.Cache('Dialog').has(Event.target).length===0){this.Hide();}};CMonthPicker.prototype.OnPreviousYear=function(Event){if(this.Year<=this.StartYear){return;}
this.Year--;this.RenderYear();};CMonthPicker.prototype.OnNextYear=function(Event){if(this.EndYear!==null&&this.Year>=this.EndYear){return;}
this.Year++;this.RenderYear();};CMonthPicker.prototype.OnSelectMonth=function(Event){if(this.ReadOnly===true){Event.preventDefault();Event.stopPropagation();return;}
var $Month=$(Event.target);var Month=CFilters.Integer($Month.val());if(this.Type==="Single"){this.Values={};this.Cache('Months').prop("checked",false);this.Cache('Months').filter("[value="+Month+"]").prop("checked",true);}
if(typeof(this.Values[this.Year])==="undefined"){this.Values[this.Year]={};}
if($Month.is(":checked")){this.Values[this.Year][Month]=true;}else{this.Values[this.Year][Month]=false;}};CMonthPicker.prototype.OnQuickLink=function(Event){if(this.ReadOnly===true){return;}
var Months=$(Event.target).data("months");};CMonthPicker.prototype.OnClose=function(Event){this.Hide();};CMonthPicker.prototype.OnHide=function(){};CMonthPicker.prototype.OnStoreValues=function(){};var CTimePicker=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.DialogTemplate=Options.DialogTemplate||'TimePickerDialog';this.Hour=null;this.Minute=null;this.AMPM=null;this.Visible=false;this.Cache=CElementCacheGlobal.Register('CTimePicker_'+this.ID,{Input:'#'+this.ID});this.Setup();};CTimePicker.prototype=Object.create(CControl.prototype);CTimePicker.prototype.Setup=function(){var self=this;this.Cache('Input').on('click, focus',function(Event){self.ReadValues();self.Show();});this.Cache('Input').on('keydown',function(Event){if(Event.keyCode==9){self.ReadValues();self.StoreValues();self.Hide();this.blur();}});this.Cache('Input').on('keyup',function(Event){if(Event.keyCode==13){self.ReadValues();self.StoreValues();self.Hide();this.blur();}});this.Cache('Input').on('blur',function(Event){self.ReadValues();self.StoreValues();});$(document.body).on('click',function(Event){self.OnDocumentClick(Event);});this.ReadValues();this.StoreValues();};CTimePicker.prototype.ReadValues=function(){var DateTime=this.Cache('Input').val();var DateObj=new Date("01/01/2017 "+DateTime);if(isNaN(DateObj.getTime())===true){DateObj=new Date();}
this.Hour=DateObj.format("g");this.Minute=DateObj.format("i");this.AMPM=DateObj.format("A");};CTimePicker.prototype.StoreValues=function(){var DateObj=new Date("01/01/2017 "+this.Hour+":"+this.Minute+" "+this.AMPM);if(isNaN(DateObj.getTime())===true){this.Hour=null;this.Minute=null;this.AMPM=null;this.Cache('Input').val('');return;}
this.Cache('Input').val(DateObj.format('g:i A'));};CTimePicker.prototype.Render=function(){var self=this;if(this.Cache().IsCached('Dialog')===false){var Params={"ID":this.ID,"Hour":this.Hour,"Minute":this.Minute,"AMPM":this.AMPM};var TemplateObj=new CTemplateObject(this.DialogTemplate,Params,this);var $Dialog=$(TemplateObj.Render(true));$Dialog.on('click','.TimePickerInputHour > .TimePickerInputUp',function(Event){self.OnNextHour(Event);});$Dialog.on('click','.TimePickerInputHour > .TimePickerInputDown',function(Event){self.OnPreviousHour(Event);});$Dialog.on('click','.TimePickerInputMinute > .TimePickerInputUp',function(Event){self.OnNextMinute(Event);});$Dialog.on('click','.TimePickerInputMinute > .TimePickerInputDown',function(Event){self.OnPreviousMinute(Event);});$Dialog.on('click','.TimePickerInputAMPM > .TimePickerInputUp, .TimePickerInputAMPM > .TimePickerInputDown',function(Event){self.OnNextAMPM(Event);});$(window).on('resize',function(Event){self.Reposition();});this.Cache().Store('Dialog',$Dialog);this.Cache('Dialog').appendTo($(document.body));this.Cache().Store('HourInput',$Dialog.find(".TimePickerInputHour > input"));this.Cache().Store('MinuteInput',$Dialog.find(".TimePickerInputMinute > input"));this.Cache().Store('AMPMInput',$Dialog.find(".TimePickerInputAMPM > input"));}else{this.Cache('HourInput').val(this.Hour);this.Cache('MinuteInput').val(this.Minute);this.Cache('AMPMInput').val(this.AMPM);}
this.Reposition();return this;};CTimePicker.prototype.Reposition=function(){var Offset=this.Cache('Input').offset();var ButtonWidth=this.Cache('Input').outerWidth();var ButtonHeight=this.Cache('Input').outerHeight();var DialogWidth=this.Cache('Dialog').outerWidth();var X=Offset.left;this.Cache('Dialog').removeClass('TimePickerDialogRight');if(X+DialogWidth>=$(window).outerWidth()){X=Offset.left+ButtonWidth-DialogWidth;this.Cache('Dialog').addClass('TimePickerDialogRight');}
this.Cache('Dialog').css({top:Offset.top+this.Cache('Input').outerHeight(),left:X});return this;};CTimePicker.prototype.Show=function(){if(this.Visible)return;this.Render();this.Cache('Dialog').addClass('TimePickerDialogVisible');this.Visible=true;};CTimePicker.prototype.Hide=function(){if(this.Visible===false)return;this.StoreValues();this.Cache('Dialog').removeClass('TimePickerDialogVisible');this.Visible=false;};CTimePicker.prototype.OnDocumentClick=function(Event){if(this.Cache('Dialog').is(Event.target)===false&&this.Cache('Input').is(Event.target)===false&&this.Cache('Dialog').has(Event.target).length===0){this.Hide();}};CTimePicker.prototype.OnNextHour=function(Event){this.Hour=CFilters.Integer(this.Hour);this.Hour++;if(this.Hour==13){this.Hour=1;}
this.Cache('HourInput').val(this.Hour);this.StoreValues();};CTimePicker.prototype.OnPreviousHour=function(Event){this.Hour=CFilters.Integer(this.Hour);this.Hour--;if(this.Hour==0){this.Hour=12;}
this.Cache('HourInput').val(this.Hour);this.StoreValues();};CTimePicker.prototype.OnNextMinute=function(Event){this.Minute=CFilters.Integer(this.Minute);this.Minute++;if(this.Minute==60){this.Minute=0;}
if(this.Minute<10){this.Minute='0'+this.Minute;}
this.Cache('MinuteInput').val(this.Minute);this.StoreValues();};CTimePicker.prototype.OnPreviousMinute=function(Event){this.Minute=CFilters.Integer(this.Minute);this.Minute--;if(this.Minute==-1){this.Minute=59;}
if(this.Minute<10){this.Minute='0'+this.Minute;}
this.Cache('MinuteInput').val(this.Minute);this.StoreValues();};CTimePicker.prototype.OnNextAMPM=function(Event){if(this.AMPM==="AM"){this.AMPM="PM";}else{this.AMPM="AM";}
this.Cache('AMPMInput').val(this.AMPM);this.StoreValues();};CTimePicker.prototype.OnStoreValues=function(){};var TooltipManager={};TooltipManager.List=[];TooltipManager.TemplateName='Tooltip';TooltipManager.TemplateObjects={};TooltipManager.HideAll=function(){for(var i in TooltipManager.List){TooltipManager.List[i].Hide();}};TooltipManager.GetTemplate=function(TemplateName){if(typeof(TemplateName)!=='string'){TemplateName=this.TemplateName;}
if(typeof(this.TemplateObjects[TemplateName])==='undefined'){this.TemplateObjects[TemplateName]=new CTemplateObject(TemplateName);}
return this.TemplateObjects[TemplateName];};var CTooltip=function(TargetElement,Content,Options){this.Initialized=false;this.TooltipElement=null;this.TargetElement=TargetElement||null;if(typeof(Options)!=='object'){Options={};}
this.Position=Options.Position||"";this.Container=Options.Container||$('body');this.AutoPosition=Options.AutoPosition||true;this.AutoPositionInterval=Options.AutoPositionInterval||1000;this.Padding={"Top":0,"Right":-3,"Bottom":10,"Left":0};this.Setup();this.SetContent(Content);if(Options.Class!=="undefined"){$(this.TooltipElement).addClass(Options.Class);}
TooltipManager.List.push(this);};CTooltip.prototype.Setup=function(){var self=this;if(this.Initialized===false){var Template=TooltipManager.GetTemplate();this.TooltipElement=$(Template.Render(true)).appendTo(this.Container);this.Initialized=true;$(window).on('resize',function(Event){if(self.Visible){self.Reposition();}});}};CTooltip.prototype.SetContent=function(Content){if(typeof(Content)==="undefined")return;this.Content=Content;$(this.TooltipElement).html(Content);};CTooltip.prototype.GetTooltipInfo=function(){var TooltipDimensions=this.GetHiddenDimensions(this.TooltipElement);var Info={"Width":parseFloat(TooltipDimensions.outerWidth),"Height":parseFloat(TooltipDimensions.outerHeight)};return Info;};CTooltip.prototype.GetTargetInfo=function(){var $Target=this.TargetElement;if(this.TargetElement.length>1){for(var i=0;i<this.TargetElement.length;i++){if(this.TargetElement.eq(i).is(':visible')){$Target=this.TargetElement.eq(i);break;}}}
var TargetDimensions=this.GetHiddenDimensions($Target);var TargetPos=$($Target).offset();if(this.Container){var ContainerPos=this.Container.offset();var Info={"X":parseFloat(TargetPos.left)-parseFloat(ContainerPos.left),"Y":parseFloat(TargetPos.top)-parseFloat(ContainerPos.top),"Width":parseFloat(TargetDimensions.outerWidth),"Height":parseFloat(TargetDimensions.outerHeight)};}else{var Info={"X":parseFloat(TargetPos.left),"Y":parseFloat(TargetPos.top),"Width":parseFloat(TargetDimensions.outerWidth),"Height":parseFloat(TargetDimensions.outerHeight)};}
return Info;};CTooltip.prototype.Show=function(){$(this.TooltipElement).addClass("TooltipActive");this.Reposition();this.Visible=true;};CTooltip.prototype.Hide=function(){$(this.TooltipElement).removeClass("TooltipActive");this.Visible=false;};CTooltip.prototype.Reposition=function(){var X=0;var Y=0;var TooltipInfo=this.GetTooltipInfo();var TargetInfo=this.GetTargetInfo();var Position=this.Position;var Parts=Position.split(/ /);if(Parts.length<2)Parts=["Right","Top"];if(Parts[0]=="Left")X=TargetInfo.X-TooltipInfo.Width;if(Parts[0]=="Center")X=TargetInfo.X+(TargetInfo.Width/2)-(TooltipInfo.Width/2);if(Parts[0]=="Right")X=(TargetInfo.X+TargetInfo.Width)-TooltipInfo.Width-this.Padding.Right;if(Parts[1]=="Top")Y=TargetInfo.Y-TooltipInfo.Height-this.Padding.Bottom;if(Parts[1]=="Center")Y=TargetInfo.Y+(TargetInfo.Height/2)-(TooltipInfo.Height/2);if(Parts[1]=="Bottom")Y=TargetInfo.Y+TargetInfo.Height;$(this.TooltipElement).css({"left":X+"px","top":Y+"px"}).addClass("TooltipActive");};CTooltip.prototype.GetHiddenDimensions=function(Element,includeMargin){var $item=$(Element),props={position:'absolute',visibility:'hidden',display:'block'},dim={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},$hiddenParents=$item.parents().andSelf().not(':visible'),includeMargin=(includeMargin==null)?false:includeMargin;var oldProps=[];$hiddenParents.each(function(){var old={};for(var name in props){old[name]=this.style[name];this.style[name]=props[name];}
oldProps.push(old);});dim.width=$item.width();dim.outerWidth=$item.outerWidth(includeMargin);dim.innerWidth=$item.innerWidth();dim.height=$item.height();dim.innerHeight=$item.innerHeight();dim.outerHeight=$item.outerHeight(includeMargin);$hiddenParents.each(function(i){var old=oldProps[i];for(var name in props){this.style[name]=old[name];}});return dim;};var CSlider=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.Type=Options.Type||"Standard";this.Step=Options.Step||1;this.MinValue=Options.MinValue||0;this.MaxValue=Options.MaxValue||100;this.ValueRange=(this.MaxValue-this.MinValue);this.Value=null;this.ShowTooltips=Options.ShowTooltips||false;this.DragActive=false;this.Focus=false;this.TrackProperties={X:null,Y:null,Width:null,Height:null};this.ActiveButton=null;this.ActiveButtonType=null;this.ButtonLastPosX=0;this.ButtonLastPosY=0;this.Cache=CElementCacheGlobal.Register('CTimePicker_'+this.ID,{Input:'#'+this.ID,Track:'#'+this.ID+'_Track',Buttons:'#'+this.ID+'_FormField .FormFieldSliderButton',TrackRange:'#'+this.ID+'_TrackRange',Button:'#'+this.ID+'_Button',ButtonMin:'#'+this.ID+'_ButtonMin',ButtonMax:'#'+this.ID+'_ButtonMax',Tooltip:'#'+this.ID+'_Tooltip'});this.Setup();};CSlider.prototype=Object.create(CControl.prototype);CSlider.prototype.Setup=function(){var self=this;this.Cache('Buttons').on('focus',function(Event){self.Focus=true;self.ActiveButton=this;self.ActiveButtonType=$(this).data("type");self.ShowTooltip();self.UpdateTrackProperties();self.UpdateTrackRange();});this.Cache('Buttons').on('blur',function(Event){self.Focus=false;self.ActiveButton=null;self.ActiveButtonType=null;self.HideTooltip();});this.Cache('Buttons').on('mouseover',function(Event){if(self.Focus===true){return;}
self.ActiveButton=this;self.ActiveButtonType=$(this).data("type");self.ShowTooltip();});this.Cache('Buttons').on('mouseout',function(Event){if(self.Focus===true){return;}
self.ActiveButton=null;self.ActiveButtonType=null;self.HideTooltip();});this.Cache('Buttons').on('mousedown touchstart',function(Event){self.DragActive=true;self.Focus=true;self.ActiveButton=this;self.ActiveButtonType=$(this).data("type");self.ButtonLastPosX=null;self.UpdateTrackProperties();self.UpdateTrackRange();var Button=this;setTimeout(function(){$(Button).focus();},0);});$(document.body).on('mouseup touchend',function(Event){if(self.DragActive!==true){return;}
self.DragActive=false;if(self.ButtonLastPosX===null){return;}
var Value=(self.ButtonLastPosX*self.ValueRange)+self.MinValue;var RoundedValue=self.RoundValue(Value);if(self.Type==="Range"){if(self.ActiveButtonType==="Min"){Value=[RoundedValue,self.Value[1]];}else
if(self.ActiveButtonType==="Max"){Value=[self.Value[0],RoundedValue];}}
self.SetValue(Value);self.ShowTooltip();});this.Cache('Buttons').on('keyup',function(Event){if(self.Type==="Standard"){if(Event.keyCode===37){self.SetValue(self.Value-self.Step);}else
if(Event.keyCode===39){self.SetValue(self.Value+self.Step);}}else
if(self.Type==="Range"){if(Event.keyCode===37){if(self.ActiveButtonType==="Min"){self.SetValue([self.Value[0]-self.Step,self.Value[1]]);}else
if(self.ActiveButtonType==="Max"){self.SetValue([self.Value[0],self.Value[1]-self.Step]);}}else
if(Event.keyCode===39){if(self.ActiveButtonType==="Min"){self.SetValue([self.Value[0]+self.Step,self.Value[1]]);}else
if(self.ActiveButtonType==="Max"){self.SetValue([self.Value[0],self.Value[1]+self.Step]);}}}
self.ShowTooltip();});$(document.body).on('mousemove touchmove',function(Event){if(self.DragActive!==true){return;}
var MouseX=Event.pageX;var MouseY=Event.pageY;if(Event.type==="touchmove"){MouseX=Event.originalEvent.touches[0].pageX;MouseY=Event.originalEvent.touches[0].pageY;}
var OffsetX=MouseX-self.TrackProperties.X;var OffsetY=MouseY-self.TrackProperties.Y;self.ButtonLastPosX=OffsetX/self.TrackProperties.Width;self.ButtonLastPosY=OffsetY/self.TrackProperties.Height;if(self.ButtonLastPosX<0)self.ButtonLastPosX=0;if(self.ButtonLastPosX>1)self.ButtonLastPosX=1;if(self.ButtonLastPosY<0)self.ButtonLastPosY=0;if(self.ButtonLastPosY>1)self.ButtonLastPosY=1;if(self.Type==="Range"){var ButtonX;if(self.ActiveButtonType==="Min"){ButtonX=CFilters.Integer(self.Cache('ButtonMax').get(0).style.left)/100;if(self.ButtonLastPosX>ButtonX){self.ButtonLastPosX=ButtonX;}}else
if(self.ActiveButtonType==="Max"){ButtonX=CFilters.Integer(self.Cache('ButtonMin').get(0).style.left)/100;if(self.ButtonLastPosX<ButtonX){self.ButtonLastPosX=ButtonX;}}}
$(self.ActiveButton).css({'left':(self.ButtonLastPosX*100)+'%'});self.UpdateTrackRange();var RoundedValue=self.RoundValue((self.ButtonLastPosX*self.ValueRange)+self.MinValue);self.ShowTooltip(RoundedValue);});System.RegisterResizeCallback(function(Type,Width,Height){self.UpdateTrackProperties();self.UpdateTrackRange();self.HideTooltip();});this.ReadValue();this.UpdateTrackProperties();};CSlider.prototype.SetValue=function(NewValue){var OldValue=this.Value;if(this.Type==="Standard"){this.Value=this.RoundValue(NewValue);this.Cache('Input').val(this.Value);var ButtonPosX=((this.Value-this.MinValue)/this.ValueRange)*100;this.Cache('Button').css({'left':ButtonPosX+'%'}).attr('alt',this.Value);}else
if(this.Type==="Range"){var LowValue=this.RoundValue(NewValue[0]);var HighValue=this.RoundValue(NewValue[1]);if(this.ActiveButtonType==="Max"){if(HighValue<=LowValue){HighValue=this.RoundValue(LowValue+this.Step);}else
if(LowValue>=HighValue){LowValue=this.RoundValue(HighValue-this.Step);}}else{if(LowValue>=HighValue){LowValue=this.RoundValue(HighValue-this.Step);}else
if(HighValue<=LowValue){HighValue=this.RoundValue(LowValue+this.Step);}}
this.Value=[LowValue,HighValue];this.Cache('Input').val(LowValue+','+HighValue);var ButtonPosX=((LowValue-this.MinValue)/this.ValueRange)*100;this.Cache('ButtonMin').css({'left':ButtonPosX+'%'}).attr('alt',LowValue);ButtonPosX=((HighValue-this.MinValue)/this.ValueRange)*100;this.Cache('ButtonMax').css({'left':ButtonPosX+'%'}).attr('alt',HighValue);}
this.UpdateTrackRange();this.OnValueChange();if(OldValue!==null&&OldValue!==NewValue){this.Cache('Input').trigger('change');}};CSlider.prototype.RoundValue=function(Value){if(Value<this.MinValue)Value=this.MinValue;if(Value>this.MaxValue)Value=this.MaxValue;Value=Math.round(Value/this.Step)*this.Step;return Value;};CSlider.prototype.ReadValue=function(){var StoredValue=this.Cache('Input').val();if(this.Type==="Standard"){StoredValue=CFilters.Integer(StoredValue);}else
if(this.Type==="Range"){StoredValue=StoredValue.split(',');if(typeof(StoredValue)!=="object"||StoredValue.length!==2){StoredValue=[this.MinValue,this.MaxValue];}}
this.SetValue(StoredValue);};CSlider.prototype.UpdateTrackRange=function(){if(this.Type==="Standard"){var ButtonX=CFilters.Float(this.Cache('Button').css('left'));this.Cache('TrackRange').css({'left':'0','width':ButtonX+'px'});}else
if(this.Type==="Range"){var ButtonMinX=CFilters.Float(this.Cache('ButtonMin').css('left'));var ButtonMaxX=CFilters.Float(this.Cache('ButtonMax').css('left'));var Width=ButtonMaxX-ButtonMinX;this.Cache('TrackRange').css({'left':ButtonMinX+'px','width':Width+'px'});}};CSlider.prototype.UpdateTrackProperties=function(){var TrackPos=this.Cache('Track').offset();this.TrackProperties.X=TrackPos.left;this.TrackProperties.Y=TrackPos.top;this.TrackProperties.Width=this.Cache('Track').outerWidth();this.TrackProperties.Height=this.Cache('Track').outerHeight();};CSlider.prototype.GetActiveButtonValue=function(){if(this.Type==="Standard"){return this.Value;}else
if(this.Type==="Range"){if(this.ActiveButtonType==="Min"){return this.Value[0];}else
if(this.ActiveButtonType==="Max"){return this.Value[1];}}
return null;};CSlider.prototype.ShowTooltip=function(Value){if(this.ShowTooltips===false){return;}
if(typeof(Value)==="undefined"){Value=this.GetActiveButtonValue();}
Value=this.OnFormatTooltip(Value);this.Cache('Tooltip').text(Value);this.RepositionTooltip();this.Cache('Tooltip').addClass('FormFieldSliderTooltipActive');};CSlider.prototype.HideTooltip=function(){if(this.ShowTooltips===false){return;}
this.Cache('Tooltip').removeClass('FormFieldSliderTooltipActive');};CSlider.prototype.RepositionTooltip=function(){var ButtonPos=$(this.ActiveButton).position();var TooltipWidth=this.Cache('Tooltip').outerWidth();var TooltipHeight=this.Cache('Tooltip').outerHeight();var X=ButtonPos.left-(TooltipWidth/2);var Y=ButtonPos.top-TooltipHeight;this.Cache('Tooltip').css({"left":X+"px","top":Y+"px"});};CSlider.prototype.OnFormatTooltip=function(Value){return Value;};CSlider.prototype.OnValueChange=function(){};var CCalloutBlock=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Cache=CElementCacheGlobal.Register('CCalloutBlock_'+this.ControlID,{"Element":"#"+this.ID,"ItemWrapper":"#"+this.ID+" .CalloutBlockItems","Items":"#"+this.ID+" .CalloutBlockItem","Navigation":"#"+this.ID+" .CalloutBlockNavigation","Previous":"#"+this.ID+" .CalloutBlockNavigationPrevious","Next":"#"+this.ID+" .CalloutBlockNavigationNext","Dots":"#"+this.ID+" .CalloutBlockNavigationDots",});if(this.Cache('Items').length===0){console.warn('No items not found',this.ID);return;}
this.Columns=Options.Columns||3;this.Rows=Options.Rows||1;this.CarouselType=Options.CarouselType||"None";this.CarouselArrows=Options.CarouselArrows||false;this.CarouselDots=Options.CarouselDots||false;this.CarouselSettings=Options.CarouselSettings||null;if(this.CarouselType!=="None"){if(this.CarouselType==="Custom"){if(this.CarouselSettings===null||typeof(this.CarouselSettings)!=="object"){console.error("Invalid carousel settings provided.");return;}
if(typeof(this.CarouselSettings['arrows'])==="undefined"||this.CarouselSettings['arrows']===true){this.CarouselArrows=true;}}else{var SlidesToShow=this.Columns;if(SlidesToShow>4){SlidesToShow=4;}
this.CarouselSettings={arrows:this.CarouselArrows,infinite:true,speed:300,slidesToShow:SlidesToShow,slidesToScroll:1,rows:this.Rows,prevArrow:this.Cache('Previous'),nextArrow:this.Cache('Next'),dots:this.CarouselDots,dotsClass:'slick-dots CalloutBlockNavigationDots',responsive:[]};switch(this.CarouselType){case"All":case"Tablet":{if(SlidesToShow===4){SlidesToShow=3;}else
if(SlidesToShow===3){SlidesToShow=2;}else{SlidesToShow=1;}
this.CarouselSettings['responsive'].push({breakpoint:769,settings:{rows:1,slidesToShow:SlidesToShow}});}
case"Mobile":{SlidesToShow=1;this.CarouselSettings['responsive'].push({breakpoint:641,settings:{rows:1,slidesToShow:SlidesToShow}});break;}
default:{console.error("Invalid carousel type provided.");return;}}}
this.CarouselSettings['prevArrow']=this.Cache('Previous');this.CarouselSettings['nextArrow']=this.Cache('Next');this.CarouselSettings['dotsClass']='slick-dots CalloutBlockNavigationDots';}
this.Setup();};CCalloutBlock.prototype=Object.create(CControl.prototype);CCalloutBlock.prototype.Setup=function(){var self=this;if(this.CarouselType!=="None"){this.Cache('ItemWrapper').on('init breakpoint',function(Event,Slick){var $CalloutBlock=$(this).closest(".CalloutBlock");if($CalloutBlock.find(".slick-slide:first > div").length>2){$CalloutBlock.find(".slick-slide > div").css("height","auto");}else
if($CalloutBlock.find(".slick-slide:first > div").length===2){$CalloutBlock.find(".slick-slide > div").css("height","50%");}else{$CalloutBlock.find(".slick-slide > div").css("height","100%");}
$CalloutBlock.addClass("CalloutBlockCarousel");$CalloutBlock.find(".CalloutBlockNavigationDots > li").addClass("slick-dot CalloutBlockNavigationDot");$CalloutBlock.find(".CalloutBlockNavigationDots > li > button").addClass("slick-dot-button CalloutBlockNavigationDotButton");$CalloutBlock.find(".CalloutBlockNavigationDots > li.slick-active").addClass("CalloutBlockNavigationDotActive");if($CalloutBlock.find(".CalloutBlockNavigationDot").length>1){if(self.CarouselArrows){self.Cache("Navigation").addClass("CalloutBlockNavigationActive");}
$CalloutBlock.find(".CalloutBlockNavigationDots").addClass("CalloutBlockNavigationDotsActive");}else{self.Cache("Navigation").removeClass("CalloutBlockNavigationActive");$CalloutBlock.find(".CalloutBlockNavigationDots").removeClass("CalloutBlockNavigationDotsActive");}
Slick.slickGoTo(0,true);Slick.updateDots=function(){var _=this;if(_.$dots!==null){_.$dots.find('li').removeClass('slick-active CalloutBlockNavigationDotActive').end();_.$dots.find('li').eq(Math.floor(_.currentSlide/_.options.slidesToScroll)).addClass('slick-active CalloutBlockNavigationDotActive');}};});this.Cache('ItemWrapper').slick(this.CarouselSettings);}else{this.Cache('Element').addClass("CalloutBlockStatic");}
return this;};var CCarousel=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.CarouselSettings=Options.CarouselSettings||null;this.DisplayCaption=Options.DisplayCaption||false;this.DisplayThumbnails=Options.DisplayThumbnails||false;this.CarouselThumbnailSettings=Options.CarouselThumbnailSettings||null;this.UseLightbox=Options.UseLightbox||false;this.Cache=CElementCacheGlobal.Register('CCarousel_'+this.ControlID,{"Element":"#"+this.ID,"PrimaryCarousel":"#"+this.ID+" .CarouselSlides","PrimaryNavigation":"#"+this.ID+" .CarouselNavigation","PrimaryPrevious":"#"+this.ID+" .CarouselNavigationPrevious","PrimaryNext":"#"+this.ID+" .CarouselNavigationNext","Caption":"#"+this.ID+" .CarouselCaption","ThumbnailCarousel":"#"+this.ID+" .CarouselThumbnailSlides","ThumbnailSlides":"#"+this.ID+" .CarouselThumbnailSlide","ThumbnailNavigation":"#"+this.ID+" .CarouselThumbnailNavigation","ThumbnailPrevious":"#"+this.ID+" .CarouselThumbnailNavigationPrevious","ThumbnailNext":"#"+this.ID+" .CarouselThumbnailNavigationNext"});this.SlickPrimary=null;this.SlickThumbnails=null;if(this.Cache('Element').length===0){console.error('Carousel element not found',this.ID);return;}
if(typeof(this.CarouselSettings)!=="object"||this.CarouselSettings===null){this.CarouselSettings={arrows:true,infinite:false,speed:300,slidesToShow:1,slidesToScroll:1,rows:1,dots:false,responsive:[]};}
if(this.DisplayThumbnails===true&&(typeof(this.CarouselThumbnailSettings)!=="object"||this.CarouselThumbnailSettings===null)){this.CarouselThumbnailSettings={arrows:true,infinite:false,speed:300,slidesToShow:6,slidesToScroll:1,swipeToSlide:true,rows:1,dots:false,responsive:[{breakpoint:960,settings:{slidesToShow:4}}]};}
this.CarouselSettings['prevArrow']=this.Cache('PrimaryPrevious');this.CarouselSettings['nextArrow']=this.Cache('PrimaryNext');if(this.DisplayThumbnails===true){this.CarouselThumbnailSettings['prevArrow']=this.Cache('ThumbnailPrevious');this.CarouselThumbnailSettings['nextArrow']=this.Cache('ThumbnailNext');}
this.Setup();};CCarousel.prototype=Object.create(CControl.prototype);CCarousel.prototype.Setup=function(){var self=this;this.Cache('PrimaryCarousel').on('init afterChange',function(Event,Slick){if(Event.type==="afterChange"){var ViewedSlide=Slick.slickCurrentSlide();self.SelectSlide(ViewedSlide);}
self.Cache('PrimaryNavigation').find('.slick-arrow').removeClass('CarouselNavigationArrowDisabled');self.Cache('PrimaryNavigation').find('.slick-arrow.slick-disabled').addClass('CarouselNavigationArrowDisabled');if(self.DisplayCaption){self.UpdateCaption();}});this.Cache('PrimaryCarousel').slick(this.CarouselSettings);this.SlickPrimary=this.Cache('PrimaryCarousel').slick('getSlick');if(this.DisplayThumbnails){this.Cache('ThumbnailCarousel').on('click','.CarouselThumbnailSlide',function(){var Index=$(this).data('index');self.SelectSlide(Index);});this.Cache('ThumbnailCarousel').on('init afterChange',function(Event,Slick){self.Cache('ThumbnailNavigation').find('.slick-arrow').removeClass('CarouselThumbnailNavigationArrowDisabled');self.Cache('ThumbnailNavigation').find('.slick-arrow.slick-disabled').addClass('CarouselThumbnailNavigationArrowDisabled');});this.Cache('ThumbnailCarousel').on('breakpoint',function(Event,Slick){var ViewedSlide=self.SlickPrimary.slickCurrentSlide();self.SelectSlide(ViewedSlide);});this.Cache('ThumbnailCarousel').slick(this.CarouselThumbnailSettings);this.SlickThumbnails=this.Cache('ThumbnailCarousel').slick('getSlick');this.Cache('ThumbnailSlides').filter('[data-index=0]').addClass('CarouselThumbnailSlideSelected');}
return this;};CCarousel.prototype.SelectSlide=function(Index){var PrimaryCurrentSlide=this.SlickPrimary.slickCurrentSlide();if(PrimaryCurrentSlide!=Index){this.SlickPrimary.slickGoTo(Index,false);}
if(this.DisplayThumbnails){var SlidesToShow=this.SlickThumbnails.options.slidesToShow;var ThumbnailCurrentSlide=this.SlickThumbnails.slickCurrentSlide();var ThumbnailSlideIndex=this.Cache('ThumbnailSlides').filter('.CarouselThumbnailSlideSelected').data('index');if(ThumbnailSlideIndex!=Index){this.Cache('ThumbnailSlides').removeClass('CarouselThumbnailSlideSelected');this.Cache('ThumbnailSlides').filter('[data-index='+Index+']').addClass('CarouselThumbnailSlideSelected');if(Index<ThumbnailCurrentSlide){this.SlickThumbnails.slickGoTo(Index,false);}else
if(Index>=ThumbnailCurrentSlide+SlidesToShow){this.SlickThumbnails.slickGoTo(Index-SlidesToShow+1,false);}}}};CCarousel.prototype.UpdateCaption=function(){var $Image=this.Cache('PrimaryCarousel').find('.slick-active .CarouselSlide > img');var Caption=$Image.data("description");if(typeof(Caption)==="undefined"||Caption==""){Caption=$Image.prop('alt');}
if(typeof(Caption)==="undefined"||Caption==""){this.Cache('Caption').text('').removeClass('CarouselCaptionActive');return;}
this.Cache('Caption').text(Caption).addClass('CarouselCaptionActive');};var CFilterBar=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.FormName=Options.FormName;this.FormView=null;this.MaxCheckBoxes=Options.MaxCheckBoxes||5;this.ShowMoreTemplate=Options.ShowMoreTemplate||'FilterBarShowMore';this.Mode=null;this.CategoryID=Options.CategoryID||null;this.IgnoreFields={};if(typeof(this.FormName)==="undefined"||this.FormName===""){console.error('A valid form must be provided before using this control.');return;}
this.Cache=CElementCacheGlobal.Register('CFilterBar_'+this.ControlID,{"Body":"body","Element":"#"+this.ID,"CloseDialog":"#"+this.ID+" .FilterBarClose","SectionButton":"#"+this.ID+" .FilterBarSectionButton","SectionClose":"#"+this.ID+" .FilterBarSectionClose","SectionTitle":"#"+this.ID+" .FilterBarSectionTitle","AppliedFilters":"#"+this.ID+" .FilterBarAppliedFilter","ClearAll":"#"+this.ID+" .FilterBarAppliedClearAll","Inputs":"#"+this.ID+" input, #"+this.ID+" select","CheckLists":"#"+this.ID+" .FormFieldCheckList","ApplyButton":"#"+this.ID+" .FilterBarSectionApplyButton","Actions":"#"+this.ID+" .FilterBarAction"});if(this.Cache('Element').length===0){console.error('Filter Bar not found',this.ID);return}
this.Setup();};CFilterBar.prototype=Object.create(CControl.prototype);CFilterBar.prototype.Setup=function(){var self=this;this.Cache('SectionButton').on('click',function(e){$(this).parent().addClass('FilterBarSectionActive');var SliderControls=CControls.ControlsByType['Slider'];for(var i in SliderControls){var SliderControl=CControls.Get(SliderControls[i]);SliderControl.UpdateTrackProperties();SliderControl.UpdateTrackRange();}});this.Cache('CloseDialog').on('click',function(e){self.CloseDialog();});this.Cache('SectionClose').on('click',function(e){self.Cache('Element').find('.FilterBarSectionActive').removeClass('FilterBarSectionActive');});this.Cache('SectionTitle').on('click',function(e){if(self.Mode!=="Standard"){return false;}
var $Section=$(this).closest(".FilterBarSection");var Accordion=$Section.data("accordion");if(Accordion!==true){return false;}
$Section.toggleClass('FilterBarSectionMinimized');});this.Cache('Inputs').on('change',function(e){var $Section=$(this).closest('.FilterBarSection');$Section.find('.FilterBarSectionApply').addClass('FilterBarSectionApplyVisible');});this.Cache('AppliedFilters').on('click',function(e){var Name=$(this).data('name');var Value=$(this).data('value');var FilterData={};FilterData[Name]=Value;var URLParams=self.GetURLParams(FilterData);window.location.href=window.location.pathname+URLParams;});this.Cache('ClearAll').on('click',function(e){self.ClearAppliedFilters();});if(this.MaxCheckBoxes>0){this.Cache('CheckLists').each(function(){var CheckList=this;var $Checkboxes=$(this).find('.FormFieldCheckboxContainer');var Count=$Checkboxes.length;var CountDiff=Count-self.MaxCheckBoxes;if(CountDiff<=0){return;}
var $HiddenCheckboxes=$Checkboxes.filter(':gt('+(self.MaxCheckBoxes-1)+')');if($HiddenCheckboxes.find(':checked').length>0){return;}
$HiddenCheckboxes.addClass('FilterBarCheckboxHidden');CTemplateGlobal.OnLoad(function(){var Template=CTemplateGlobal.Load(self.ShowMoreTemplate,null,{"Count":CountDiff});var Content=Template.Render();var $ShowMore=$(Content).appendTo(CheckList);$ShowMore.addClass('FilterBarShowMoreVisible');});});}
this.Cache('Element').on('click','.FilterBarShowMore',function(e){$(this).removeClass('FilterBarShowMoreVisible');$(this).closest('.FilterBarSection').find('.FilterBarCheckboxHidden').removeClass('FilterBarCheckboxHidden');});this.Cache('ApplyButton').on('click',function(e){var URLParams=self.GetURLParams();window.location.href=window.location.pathname+URLParams;});this.Cache('Actions').on('click',function(e){var Name=$(this).data("action");self.OnAction(Name);});System.RegisterResizeCallback(function(Type,Width,Height){self.UpdateMode();if(Type==="Width"){self.CloseDialog();self.Cache('Element').find('.FilterBarSectionActive').removeClass('FilterBarSectionActive');}});this.UpdateMode();var PropertyCallData={};if(this.CategoryID!==null){PropertyCallData.CategoryID=this.CategoryID;}
CAJAX.Add('GetFormProperties',PropertyCallData,function(ResponseData,Message){if(typeof(ResponseData.FormProperties)==="undefined"){console.error('FormProperties not found to setup Filter Bar.');return}
self.FormView=new CFormView({FormName:ResponseData.FormProperties.FormName,FormProperties:ResponseData.FormProperties});});return this;};CFilterBar.prototype.GetData=function(FilterData){if(this.FormView===null){return null;}
if(typeof(FilterData)==="undefined"){FilterData={};}
FilterData=$.extend(this.IgnoreFields,FilterData);var FormData=this.FormView.GetData();var CleanData={};for(var Key in FormData){var Value=FormData[Key];var FilterValues=null;if(typeof(FilterData[Key])!=="undefined"){FilterValues=FilterData[Key];}
switch(typeof(Value)){case"boolean":case"number":case"string":{if(typeof(FilterData[Key])!=="undefined"){break;}
CleanData[Key]=Value;break;}
case"object":{if(Value===null){break;}
var $Element=this.FormView.FormObject.GetElement(Key);var Type=$Element.attr('type');switch(Type){case'checkbox':{var Buffer=[];for(var CheckboxValue in Value){if(CheckboxValue===null||Value[CheckboxValue]===null){continue;}
if(typeof(FilterData[Key])!=="undefined"&&(FilterValues==CheckboxValue||FilterValues===null)){continue;}
Buffer.push(CheckboxValue);}
if(Buffer.length!==0){CleanData[Key]=Buffer.join(',');}
break;}
default:{CleanData[Key]=JSON.stringify(Value);break;}}
break;}
default:{break;}}}
return CleanData;};CFilterBar.prototype.GetURLParams=function(FilterData){var Data=this.GetData(FilterData);if(Data===null){return null;}
return CUtil.BuildURLParams(Data);};CFilterBar.prototype.GetFormElements=function(){var FormData=this.FormView.GetData();var Elements={};for(var Name in FormData){var Element=this.FormView.FormObject.GetElement(Name);if(this.Cache('Element').has(Element[0]).length===0){continue;}
Elements[Name]=Element;}
return Elements;};CFilterBar.prototype.ClearAppliedFilters=function(){var FormElements=this.GetFormElements();var FilterData={};for(var Name in FormElements){FilterData[Name]=null;}
var URLParams=this.GetURLParams(FilterData);window.location.href=window.location.pathname+URLParams;};CFilterBar.prototype.ShowDialog=function(){if(this.Mode!=="Dialog"){return;}
if(this.Cache('Element').hasClass('FilterBarDialogActive')===true){return;}
this.Cache('Body').css('overflow','hidden');this.Cache('Element').addClass('FilterBarDialogActive');};CFilterBar.prototype.CloseDialog=function(){if(this.Cache('Element').hasClass('FilterBarDialogActive')===false){return;}
this.Cache('Body').css('overflow','auto');this.Cache('Element').removeClass('FilterBarDialogActive');};CFilterBar.prototype.UpdateMode=function(){if(System.DeviceWidth<=640){this.Mode='Dialog';}else{this.Mode='Standard';}
this.Cache('Element').removeClass('FilterBarStandard');this.Cache('Element').removeClass('FilterBarDialog');this.Cache('Element').addClass('FilterBar'+this.Mode);};CFilterBar.prototype.OnAction=function(Name){if(Name==="Reset"){this.ClearAppliedFilters();}};var CHeroVideo=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Cache=CElementCacheGlobal.Register('CHeroVideo_'+this.ControlID,{"Element":"#"+this.ID,"Embed":"#"+this.ID+" .HeroVideoEmbed"});if(this.Cache('Element').length===0){console.error('Hero Video not found',this.ID);return;}
this.Setup();};CHeroVideo.prototype=Object.create(CControl.prototype);CHeroVideo.prototype.Setup=function(){var self=this;this.Cache('Element').on('click',function(e){$(this).addClass("HeroVideoActive");this.Pos=$(this).offset();window.scrollTo(0,this.Pos.top);self.Cache('Embed').prop('src',$(this).prop('href'));e.preventDefault();e.stopPropagation();return false;});return this;};var CHTMLContent=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ControlID=Options.ControlID;this.ID=Options.ID||this.ControlID;this.TableExpandTemplate=Options.TableExpandTemplate||'TableExpand';this.Cache=CElementCacheGlobal.Register('CHTMLContent_'+this.ControlID,{"Element":"#"+this.ID,"Tables":"#"+this.ID+" table"});this.Setup();};CHTMLContent.prototype=Object.create(CControl.prototype);CHTMLContent.prototype.Setup=function(){var self=this;this.SetupTables();return this;};CHTMLContent.prototype.SetupTables=function(){var self=this;if(this.Cache("Tables").length===0){return;}
this.Cache("Tables").each(function(){var $Parent=$(this).wrap("<div class='TableWrapper'></div>").parent();$Parent.data("TableHeight",$(this).outerHeight());var MaxHeight=$(this).data("max-height");if(typeof(MaxHeight)!=="undefined"){if(typeof(MaxHeight)==="string"){if(MaxHeight.toLowerCase()==="none"){$Parent.css("max-height","none");$Parent.find(".TableExpand").addClass("TableExpandInactive");}else{$Parent.css("max-height",MaxHeight);}}else
if(typeof(MaxHeight)==="number"){$Parent.css("max-height",MaxHeight+"px");}}});CTemplateGlobal.OnLoad(function(){self.Cache("Tables").each(function(){var $TableWrapper=$(this).parent();var Rows=$TableWrapper.find("tbody > tr").length;var ContainerTemplate=new CTemplateObject(self.TableExpandTemplate,{},{'Rows':Rows});var Expand=$(ContainerTemplate.Render(true)).appendTo($TableWrapper);if($TableWrapper.outerHeight()>=$TableWrapper.find("> table").outerHeight()){$TableWrapper.css("max-height","none");$TableWrapper.find(".TableExpand").addClass("TableExpandInactive");}
$(Expand).on("click",function(){$(this).parent().css("max-height","none");$(this).parent().find(".TableExpand").addClass("TableExpandInactive");});});});};var CMapBlock=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Cache=CElementCacheGlobal.Register('CMapBlock_'+this.ControlID,{"Element":"#"+this.ID,"Overlay":"#"+this.ID+" .MapBlockOverlay"});if(this.Cache('Element').length===0){console.error('Map Block not found',this.ID);return;}
this.Setup();};CMapBlock.prototype=Object.create(CControl.prototype);CMapBlock.prototype.Setup=function(){var self=this;this.Cache('Overlay').on('click',function(e){self.Cache('Overlay').addClass('MapBlockOverlayInactive');});return this;};var CNavigation=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Type=Options.Type||"Static";this.ClickType=Options.ClickType||'Prevent';this.NavTimeout=null;this.Cache=CElementCacheGlobal.Register('CNavigation_'+this.ControlID,{'Navigation':'#'+this.ID});if(this.Cache('Navigation').length===0){console.error('Navigation not found',this.ID);return;}
this.Setup();};CNavigation.prototype=Object.create(CControl.prototype);CNavigation.prototype.Setup=function(){var self=this;switch(this.Type){case'Static':break;case'Standard':this.SetupStandard();break;case'Accordion':this.SetupAccordion();break;default:console.error('Invalid Navigation type',this.Type);break;}
return this;};CNavigation.prototype.SetupStandard=function(){var self=this;this.Cache().Define({"NavItems":"#"+this.ID+" > .NavigationList > .NavigationItem","SubNavLists":"#"+this.ID+" > .NavigationList > .NavigationItem > .NavigationList"});System.RegisterResizeCallback(function(Type,Width,Height){if(Type!=="Width")return;self.RepositionStandardNav();});this.Cache("NavItems").on("mouseover click",function(Event){if(self.NavTimeout!==null){clearTimeout(self.NavTimeout);self.NavTimeout=null;}
if($(this).hasClass("NavigationItemActive")===false){var Timeout=(Event.type==="mouseover"?350:0);var Element=this;if(self.Cache("NavItems").hasClass("NavigationItemActive")===true){Timeout=0;}
self.Cache("NavItems").removeClass("NavigationItemActive");self.NavTimeout=setTimeout(function(){$(Element).addClass("NavigationItemActive");},Timeout);if($(Event.target).is("a")&&$(this).has(".NavigationList").length){Event.preventDefault();return false;}}
if($(Event.target).is("a")&&$(Event.target).attr("href")==="#"){Event.preventDefault();return false;}}).on("mouseout",function(Event){if(self.NavTimeout!==null){clearTimeout(self.NavTimeout);self.NavTimeout=null;}
if(self.Cache("NavItems").hasClass("NavigationItemActive")===false)return;self.NavTimeout=setTimeout(function(){self.Cache("NavItems").removeClass("NavigationItemActive");},500);});$(window).on("click",function(Event){if(self.Cache("NavItems").hasClass("NavigationItemActive")===false)return;if($.contains($(".HeaderNavigation").get(0),Event.target)===false){self.Cache("NavItems").removeClass("NavigationItemActive");}});this.RepositionStandardNav();};CNavigation.prototype.RepositionStandardNav=function(){var WindowWidth=$(window).outerWidth();this.Cache("SubNavLists").each(function(){var NavWidth=$(this).outerWidth();var $Parent=$(this).closest(".NavigationItem");var ParentPosition=$Parent.offset();var ParentWidth=$Parent.outerWidth();$(this).removeClass("NavigationListRight");if(ParentPosition.left+NavWidth<WindowWidth){$(this).css({"left":"0px"});}else
if((ParentPosition.left+ParentWidth)-NavWidth>=0){$(this).css({"left":"auto","right":"0px"});$(this).addClass("NavigationListRight");}else{$(this).css({"left":(-ParentPosition.left)+"px"});}});};CNavigation.prototype.SetupAccordion=function(){var self=this;this.Cache().Define({"NavItems":"#"+this.ID+" > .NavigationList .NavigationItemInner"});this.Cache("NavItems").on("click",function(Event){var $NavItem=$(this).parent();if($NavItem.hasClass("NavigationItemHasChildren")===false){return;}
if($NavItem.hasClass("NavigationItemActive")===false){$NavItem.addClass("NavigationItemActive");}else{if(self.ClickType==="Active"){return;}
$NavItem.removeClass("NavigationItemActive");$NavItem.find(".NavigationItemActive").removeClass("NavigationItemActive");}
if(self.ClickType==="None"){return;}
Event.preventDefault();return false;})};var CSlidingMenu=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Cache=CElementCacheGlobal.Register('CSlidingMenu_'+this.ControlID,{"Body":"body","Element":"#"+this.ID,"ButtonOpen":"#"+this.ID+" .SlidingMenuButtonOpen","ButtonClose":"#"+this.ID+" .SlidingMenuButtonClose"});if(this.Cache('Element').length===0){console.error('Sliding Menu not found',this.ID);return;}
this.Setup();};CSlidingMenu.prototype=Object.create(CControl.prototype);CSlidingMenu.prototype.Setup=function(){var self=this;this.Cache('ButtonOpen').on('click',function(e){self.OpenMenu();self.Cache('ButtonClose').focus();});this.Cache('ButtonClose').on('click',function(e){self.CloseMenu();self.Cache('ButtonOpen').focus();});System.RegisterResizeCallback(function(Type,Width,Height){if(Type!=="Width")return;self.CloseMenu();});return this;};CSlidingMenu.prototype.OpenMenu=function(){if(this.Cache('Element').hasClass('SlidingMenuActive')===true){return;}
this.Cache('Body').css('overflow','hidden');this.Cache('Element').addClass('SlidingMenuActive');};CSlidingMenu.prototype.CloseMenu=function(){if(this.Cache('Element').hasClass('SlidingMenuActive')===false){return;}
this.Cache('Body').css('overflow','auto');this.Cache('Element').removeClass('SlidingMenuActive');};var CAjaxLoading=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.Cache=CElementCacheGlobal.Register('CAjaxLoading_'+this.ControlID,{"Element":"#"+this.ID});if(this.Cache('Element').length===0){console.error('Ajax Loading element not found',this.ID);return;}
this.Setup();};CAjaxLoading.prototype=Object.create(CControl.prototype);CAjaxLoading.prototype.Setup=function(){var self=this;setTimeout(function(){setInterval(function(){self.WatchAjax();},100);},CAJAX.InitInterval);return this;};CAjaxLoading.prototype.WatchAjax=function(){if(CAJAX.Sending){$('body').css('cursor','wait');this.Cache("Element").addClass("AjaxLoadingActive");}else{$('body').css('cursor','auto');this.Cache("Element").removeClass("AjaxLoadingActive");}};var CLightbox=function(Options){if(typeof(Options)!=='object'){Options={};}
this.ID=Options.ID||null;this.ControlID=Options.ControlID;this.TargetClass=Options.TargetClass;this.MediaMaxWidth=Options.MediaMaxWidth||1280;this.MediaMaxHeight=Options.MediaMaxHeight||720;this.Cache=CElementCacheGlobal.Register('CLightbox_'+this.ControlID,{"Body":"body","Lightbox":"#"+this.ID,"Close":"#"+this.ID+" .LightboxClose","Loading":"#"+this.ID+" .LightboxLoading","Caption":"#"+this.ID+" .LightboxCaption","Media":"#"+this.ID+" .LightboxMedia","MediaItem":"#"+this.ID+" .LightboxMediaItem","Previous":"#"+this.ID+" .LightboxButtonPrevious","Next":"#"+this.ID+" .LightboxButtonNext","Targets":"."+this.TargetClass});if(this.Cache('Lightbox').length===0){console.error('Lightbox element not found',this.ID);return;}
this.Loading=false;this.TargetIndex=[];this.Title=null;this.Description=null;this.Setup();};CLightbox.prototype=Object.create(CControl.prototype);CLightbox.prototype.Setup=function(){var self=this;this.RebuildIndex();this.Cache('Targets').on('click',function(Event){if(self.Loading)return;self.Open(this);return false;});this.Cache("Close").on("click",function(Event){self.Close();return false;});this.Cache("Previous").on("click",function(Event){self.Previous();return false;});this.Cache("Next").on("click",function(Event){self.Next();return false;});System.RegisterResizeCallback(function(){if(self.Cache("Lightbox").hasClass("LightboxActive")===false)return;self.ResizeMedia();});return this;};CLightbox.prototype.Open=function(TargetElement){this.Cache('Body').css('overflow','hidden');this.Cache("Lightbox").addClass("LightboxActive");this.OnOpen(TargetElement);this.Title=$(TargetElement).data("title");this.Description=$(TargetElement).data("description");var MediaType=$(TargetElement).data("mediatype");if(MediaType==="Video"){this.DisplayMedia("Video",$(TargetElement).attr("href"));}else{this.DisplayMedia("Image",$(TargetElement).attr("href"));}
this.LastTargetElement=TargetElement;};CLightbox.prototype.Close=function(){this.Cache('Body').css('overflow','auto');this.Cache("Lightbox").removeClass("LightboxActive");this.Cache("Caption").removeClass("LightboxCaptionActive");this.Cache("Media").removeClass("LightboxMediaActive");this.OnClose();};CLightbox.prototype.Previous=function(){if(this.LastTargetElement===null){return;}
var Index=this.TargetIndex.indexOf(this.LastTargetElement);if(typeof(Index)==="undefined"||Index===-1){return;}
Index--;if(Index<0){Index=this.TargetIndex.length-1;}
var NewTarget=this.TargetIndex[Index];this.Open(NewTarget);};CLightbox.prototype.Next=function(){if(this.LastTargetElement===null){return;}
var Index=this.TargetIndex.indexOf(this.LastTargetElement);if(typeof(Index)==="undefined"||Index===-1){return;}
Index++;if(Index>=this.TargetIndex.length){Index=0;}
var NewTarget=this.TargetIndex[Index];this.Open(NewTarget);};CLightbox.prototype.RebuildIndex=function(){var self=this;var i=0;this.Cache('Targets').each(function(){self.TargetIndex[i++]=this;});};CLightbox.prototype.DisplayMedia=function(Type,URL){var self=this;this.Loading=true;this.Cache("Loading").addClass("LightboxLoadingActive");this.Cache("Caption").removeClass("LightboxCaptionActive");this.Cache("Media").removeClass("LightboxMediaActive");var $PrevItem=$(".LightboxMediaElement");setTimeout(function(){$PrevItem.remove();self.LoadMedia(Type,URL);},250);this.OnDisplayMedia();};CLightbox.prototype.LoadMedia=function(Type,URL){var self=this;this.Cache("Caption").find(".LightboxCaptionTitle").text(this.Title);this.Cache("Caption").find(".LightboxCaptionDescription").text(this.Description);if(Type==="Image"){var ImageObject=new Image();ImageObject.src=URL;ImageObject.title=this.Title;ImageObject.alt=this.Title;ImageObject.onload=function(){var Image=this;$(this).data("original-width",this.width);$(this).data("original-height",this.height);$(this).addClass("LightboxMediaElement");$(this).addClass("LightboxMediaImage");$(".LightboxMediaItem").append(Image);self.ResizeMedia();if((typeof(self.Description)==="string"&&self.Description!=="")||typeof(self.Description)==="number"){self.Cache("Media").addClass("LightboxMediaWithCaption");}else{self.Cache("Media").removeClass("LightboxMediaWithCaption");}
self.Cache("Caption").addClass("LightboxCaptionActive");self.Cache("Media").addClass("LightboxMediaActive");self.Loading=false;self.Cache("Loading").removeClass("LightboxLoadingActive");};}else
if(Type==="Video"){var Template=CTemplateGlobal.Load("LightboxVideo",null,{"URL":URL});var Content=Template.Render();var VideoElement=$(Content).appendTo(".LightboxMediaItem");$(VideoElement).data("original-width",1280);$(VideoElement).data("original-height",720);self.ResizeMedia();self.Cache("Caption").addClass("LightboxCaptionActive");self.Cache("Media").addClass("LightboxMediaActive");self.Loading=false;self.Cache("Loading").removeClass("LightboxLoadingActive");}};CLightbox.prototype.ResizeMedia=function(){var MediaElement=this.Cache("Media").find(".LightboxMediaElement").get(0);if(typeof(MediaElement)==="undefined")return;var MediaWidth=$(MediaElement).data("original-width");var MediaHeight=$(MediaElement).data("original-height");var MediaMaxWidth=this.Cache("Media").outerWidth();var MediaMaxHeight=this.Cache("Media").outerHeight();var MaxWidth=this.MediaMaxWidth;var MaxHeight=this.MediaMaxHeight;var Width=0;var Height=0;if(MediaWidth<=MaxWidth&&MediaWidth<=MediaMaxWidth){Width=MediaWidth;}else
if(MediaWidth<=MaxWidth&&MediaWidth>MediaMaxWidth){Width=MediaMaxWidth;}else
if(MediaWidth>MaxWidth&&MaxWidth<=MediaMaxWidth){Width=MaxWidth;}else
if(MediaWidth>MaxWidth&&MaxWidth>MediaMaxWidth){Width=MediaMaxWidth;}
Height=MediaHeight;if(Width<MediaWidth){MediaHeight=Height=(Width/MediaWidth)*MediaHeight;}
if(MediaHeight<=MaxHeight&&MediaHeight<=MediaMaxHeight){Height=MediaHeight;}else
if(MediaHeight<=MaxHeight&&MediaHeight>MediaMaxHeight){Height=MediaMaxHeight;}else
if(MediaHeight>MaxHeight&&MaxHeight<=MediaMaxHeight){Height=MaxHeight;}else
if(MediaHeight>MaxHeight&&MaxHeight>MediaMaxHeight){Height=MediaMaxHeight;}
if(Height<MediaHeight){Width=(Height/MediaHeight)*Width;}
$(MediaElement).css({"margin-left":(-Width/2)+"px","margin-top":(-Height/2)+"px","width":Width+"px","height":Height+"px"});this.OnResizeMedia(MediaElement);};CLightbox.prototype.OnOpen=function(Element){};CLightbox.prototype.OnClose=function(){};CLightbox.prototype.OnDisplayMedia=function(Type,URL){};CLightbox.prototype.OnResizeMedia=function(MediaElement){};var CCollection=function(Data,PatternObject){this.DataSet=[];this.PatternObject=null;this.PatternClass='CObject';if(Data!==undefined&&typeof Data==='object'){if(Data instanceof Array){this.DataSet=Data;}else{for(var i in Data){if(Data.hasOwnProperty(i)){this.DataSet.push(Data[i]);}}}}
if(typeof(PatternObject)!=='undefined'&&PatternObject!==null){this.SetPatternClass(PatternObject);}
this.__ObjectStorage={};this.__DataIndexes={};return this;};CCollection.prototype.SetPatternClass=function(PatternObject){if(typeof(PatternObject)==='string'){this.PatternClass=PatternObject;if(typeof(window[PatternObject])!=='undefined'){this.PatternObject=new window[PatternObject]();}else{if(console!==undefined&&console.log!==undefined){console.log(PatternObject+' is not a valid Pattern to use for CCollection');}}}
if(typeof(PatternObject)==='object'){this.PatternObject=PatternObject;this.PatternClass=PatternObject.constructor.name;}
return this;};CCollection.prototype.Count=function(){return this.DataSet.length;};CCollection.prototype.Reset=function(){};CCollection.prototype.GetInstance=function(Offset){if(Offset===undefined||Offset===null){Offset='null';}
if(this.__ObjectStorage[Offset]===undefined){this.__ObjectStorage[Offset]=new window[this.PatternClass](this.DataSet[Offset]);}
return this.__ObjectStorage[Offset];};CCollection.prototype.RefreshDataFromObjects=function(){for(var Offset in this.__ObjectStorage){if(this.__ObjectStorage[Offset]instanceof CObject){this.DataSet[Offset]=this.__ObjectStorage[Offset].Get();}else{}}
return this;};CCollection.prototype.Add=function(Instance){if(typeof(Instance)==='object'){if(Instance instanceof Array){this.DataSet.push(Instance);Instance=new new window[this.PatternClass](Instance);}else{if(Instance instanceof CObject){this.DataSet.push(Instance.Get());}else{}}}
this.__ObjectStorage[this.DataSet.length]=Instance;return this;};CCollection.prototype.Find=function(SearchCriteria,Limit){if(SearchCriteria===undefined){SearchCriteria={};}
var Matching=Object.keys(this.DataSet);for(var IndexName in SearchCriteria){var SearchValue=SearchCriteria[IndexName];if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
if(typeof(SearchValue)==='object'){var Keys=CUtil.Array.Keys(CUtil.Array.Intersect(this.__DataIndexes[IndexName],SearchValue));Matching=CUtil.Array.Intersect(Matching,Keys);}else{Matching=CUtil.Array.Intersect(Matching,CUtil.Array.Keys(this.__DataIndexes[IndexName],SearchValue));}}
var Data=[];Matching=CUtil.Array.Values(Matching);Data=[];if(typeof(Limit)!=='number'){Limit=Matching.length;}
for(var i=0;i<Limit;i++){Data.push(this.GetInstance(Matching[i]));}
return Data;};CCollection.prototype.FindOne=function(SearchCriteria){return this.Find(SearchCriteria,1)[0];};CCollection.prototype.Search=function(SearchCriteria){if(SearchCriteria===undefined){SearchCriteria={};}
var Matching=Object.keys(this.DataSet);for(var IndexName in SearchCriteria){var SearchValue=SearchCriteria[IndexName];if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
if(typeof(SearchValue)==='object'){var Keys=CUtil.Array.Keys(CUtil.Array.Intersect(this.__DataIndexes[IndexName],SearchValue));Matching=CUtil.Array.Intersect(Matching,Keys);}else{Matching=CUtil.Array.Intersect(Matching,CUtil.Array.Keys(this.__DataIndexes[IndexName],SearchValue));}}
this.DataSet=CUtil.Array.Values(CUtil.Array.IntersectKey(this.DataSet,Matching));this.Reset();this.__DataIndexes={};this.__ObjectStorage={};return this;};CCollection.prototype.Filter=function(SearchCriteria){if(SearchCriteria===undefined){SearchCriteria={};}
var Matching=Object.keys(this.DataSet);for(var IndexName in SearchCriteria){var SearchValue=SearchCriteria[IndexName];if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
if(typeof(SearchValue)==='object'){var Keys=CUtil.Array.Keys(CUtil.Array.Intersect(this.__DataIndexes[IndexName],SearchValue));Matching=CUtil.Array.Intersect(Matching,Keys);}else{Matching=CUtil.Array.Intersect(Matching,CUtil.Array.Keys(this.__DataIndexes[IndexName],SearchValue));}}
this.DataSet=CUtil.Array.Values(CUtil.Array.DiffKey(this.DataSet,Matching));this.Reset();this.__DataIndexes={};this.__ObjectStorage={};return this;};CCollection.prototype.Contains=function(SearchArray){if(SearchCriteria===undefined){SearchCriteria={};}
var Matching=CUtil.Array.Keys(this.DataSet);for(var IndexName in SearchCriteria){var SearchValue=SearchCriteria[IndexName];if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
if(typeof(SearchValue)==='object'){var Keys=CUtil.Array.Keys(CUtil.Array.Intersect(this.__DataIndexes[IndexName],SearchValue));Matching=CUtil.Array.Intersect(Matching,Keys);}else{Matching=CUtil.Array.Intersect(Matching,CUtil.Array.Keys(this.__DataIndexes[IndexName],SearchValue));}}
if(typeof(Matching)==='object'){for(var Key in Matching){return true;}}
return false;};CCollection.prototype.RebuildIndex=function(IndexName){this.__DataIndexes[IndexName]=[];for(var i=0;i<this.DataSet.length;i++){this.__DataIndexes[IndexName][i]=this.DataSet[i][IndexName];}
return this;};CCollection.prototype.RemoveIndex=function(IndexName){delete this.__DataIndexes[IndexName];return this;};CCollection.prototype.Index=function(IDName,ValueName){var Index={};for(var i=0;i<this.DataSet.length;i++){if(this.DataSet[i][ValueName]!==undefined){Index[this.DataSet[i][IDName]]=this.DataSet[i][ValueName];}else{var Inst=this.GetInstance(i);Index[this.DataSet[i][IDName]]=Inst.Get(ValueName);}}
return Index;};CCollection.prototype.Catalog=function(Name){var Catalog={};for(var i=0;i<this.DataSet.length;i++){if(this.DataSet[i][Name]!==undefined){Catalog[this.DataSet[i][Name]]=this.DataSet[i];}else{var Inst=this.GetInstance(i);Catalog[Inst.Get(Name)]=this.DataSet[i];}}
return Catalog;};CCollection.prototype.Pluck=function(IndexName){if(this.__DataIndexes[IndexName]===undefined){this.RebuildIndex(IndexName);}
var Data=[];for(var i=0;i<this.__DataIndexes[IndexName].length;i++){Data.push(this.__DataIndexes[IndexName][i]);}
return Data;};CCollection.prototype.ToJSON=function(Catalog){if(Catalog!==undefined&&Catalog!==null){return JSON.stringify(this.Catalog(Catalog));}
return JSON.stringify(this.DataSet);};CCollection.prototype.ToArray=function(){return this.DataSet;};CCollection.prototype.Sum=function(Properties){if(typeof(Properties)==='string'){Properties=Properties.split(',');}
var Sum=0;for(var i in Properties){var Property=Properties[i];var IndexName=Property.replace(/^\s+|\s+$/gm,'');if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
Sum+=CUtil.Array.Sum(this.__DataIndexes[IndexName]);}
return Sum;};CCollection.prototype.Sums=function(Properties){if(typeof(Properties)==='string'){Properties=Properties.split(',');}
var Sums={};for(var i in Properties){var Property=Properties[i];var IndexName=Property.replace(/^\s+|\s+$/gm,'');if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
Sums[Property]+=CUtil.Array.Sum(this.__DataIndexes[IndexName]);}
return Sums;};CCollection.prototype.Max=function(IndexName){if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
var Keys=CUtil.Array.Keys(this.__DataIndexes[IndexName],Math.max.apply(null,this.__DataIndexes[IndexName]));for(var I in Keys){return this.GetInstance(Keys[I]);}};CCollection.prototype.Min=function(IndexName){if(typeof(this.__DataIndexes[IndexName])==='undefined'){this.RebuildIndex(IndexName);}
var Keys=CUtil.Array.Keys(this.__DataIndexes[IndexName],Math.min.apply(null,this.__DataIndexes[IndexName]));for(var I in Keys){return this.GetInstance(Keys[I]);}};CCollection.prototype.IsEmpty=function(){return(this.DataSet.length===0);};CCollection.prototype.Implode=function(Name,Glue){if(typeof(Glue)!=='string'){Glue='';}
var Data=this.Pluck(Name);return Data.join(Glue);};CCollection.prototype.Merge=function(){var Args=arguments;var Collections=[];Collections.push(this.Dataset);for(var i in Args){var Argument=Args[i];if(typeof(Argument)==='object'){if(Argument instanceof CCollection){Argument=Argument.ToArray();}else{Argument=CUtil.ToArray(Argument);}}
if(Argument instanceof Array){Collections.push(Argument);}}
this.__DataSet=CUtil.Array.Merge.apply(null,Collections);this.Reset();this.__DataIndexes={};this.__ObjectStorage={};return this;};CCollection.prototype.Sort=function(OrderBy){this.DataSet=Multisort(this.DataSet,OrderBy);this.Reset();this.__ObjectStorage={};this.__DataIndexes={};return this;};CCollection.prototype.Invoke=function(Callback){if(typeof(Callback)!=='function'){console.log("Invalid callback passed to CCollection.Invoke: ".$Callback);return[];}
var Data=[];var Count=this.Count();for(var i=0;i<Count;i++){Data.push(Callback.apply(this,[this.GetInstance(i)]));}
return Data;};CCollection.prototype.Join=function(){};var CElementCacheGlobal={__Storage:{},Register:function(CacheID,Definitions){if(typeof(this.__Storage[CacheID])==='undefined'){this.__Storage[CacheID]=new CElementCache(Definitions);}else{this.__Storage[CacheID].Define(Definitions).Dump();}
var CacheObject=this.__Storage[CacheID];var PrimaryCall=function(){var Args=arguments;if(Args.length===0){return CacheObject;}
var Type=typeof(Args[0]);if(Args.length===1){if(Type==='string'){return CacheObject.Get(Args[0]);}
if(Type==='object'){if(Args[0]instanceof Array){return CacheObject.Get(Args[0]);}
return CacheObject.Define(Args[0]);}
return CacheObject;}
if(Args.length===2){var Type2=typeof(Args[1]);if(Type==='string'){if(Type2==='boolean'){return CacheObject.Get(Args[0],Args[1]);}
if(Type2==='string'||Type2==='object'){return CacheObject.Define(Args[0],Args[1]);}}
if(Type==='object'&&Args[0]instanceof Array&&Type2==='boolean'){return CacheObject.Get(Args[0],Args[1]);}}
return CacheObject;};return PrimaryCall;}};var CElementCache=function(Definitions){this.__Storage={};this.Definitions={};if(typeof(Definitions)!=='undefined'){this.Define(Definitions);}
return this;};CElementCache.prototype.Define=function(){var Args=arguments;if(Args.length===0){return this;}
var Type=typeof(Args[0]);if(Type==='string'){var EntryName=Args[0];if(typeof(Args[1])!=='undefined'){this.Definitions[EntryName]=Args[1];}}
if(Type==='object'){var Definitions=Args[0];for(var EntryName in Definitions){this.Definitions[EntryName]=Definitions[EntryName];}}
return this;};CElementCache.prototype.Get=function(EntryName,Reset){if(arguments.length===0){return $();}
if(typeof(Reset)!=='boolean'){Reset=false;}
var Names,Name,i,Element,ReturnCollection=$();if(typeof(EntryName)==='string'){Names=EntryName.split(',');}else{Names=EntryName;}
if(typeof(Names)!=='object'||!(Names instanceof Array)){Names=[];}
for(i=0;i<Names.length;i++){Name=Names[i].trim();if(Reset===true){delete this.__Storage[Name];}
if(typeof(this.__Storage[Name])==='undefined'){Element=this.__Query(Name);}else{Element=this.__Storage[Name];}
if(Element.length>0){ReturnCollection=ReturnCollection.add(Element);}}
return ReturnCollection;};CElementCache.prototype.__Query=function(Name){if(typeof(this.Definitions[Name])==='undefined'){return $();}
var Definition=this.Definitions[Name];if(typeof(Definition)==='string'){this.__Storage[Name]=$(Definition);return this.__Storage[Name];}
if(typeof(Definition)==='object'){if(Definition instanceof Array){var ParentContext;if(typeof(this.__Storage[Definition[1]])==='undefined'){ParentContext=this.__Query(Definition[1]);}else{ParentContext=this.__Storage[Definition[1]];}
this.__Storage[Name]=$(Definition[0],ParentContext);return this.__Storage[Name];}else{}}
return $();};CElementCache.prototype.Reset=function(EntryName){if(typeof(EntryName)==='undefined'){return this;}
var Names,Name,i,Element;if(typeof(EntryName)==='string'){Names=EntryName.split(',');}else{Names=EntryName;}
if(typeof(Names)!=='object'||!(Names instanceof Array)){Names=[];}
for(i=0;i<Names.length;i++){Name=Names[i].trim();delete this.__Storage[Name];}
return this;};CElementCache.prototype.Remove=function(Name){delete this.Definitions[Name];delete this.__Storage[Name];return this;};CElementCache.prototype.Dump=function(){this.__Storage={};return this;};CElementCache.prototype.IsDefined=function(Name){return!(typeof(Name)==='undefined'||typeof(this.Definitions[Name])==='undefined');};CElementCache.prototype.IsCached=function(Name){return!(typeof(Name)==='undefined'||typeof(this.__Storage[Name])==='undefined');};CElementCache.prototype.Exists=function(Name,Reset){if(typeof(Reset)!=='boolean'){Reset=false;}
var Collection=this.Get(Name,Reset);return(Collection.length>0);};CElementCache.prototype.Store=function(Name,Value){this.__Storage[Name]=Value;return this;};var Multisort=function(SortArray,Keys){if(!(SortArray instanceof Array)){SortArray=CUtil.ToArray(SortArray);}
if(typeof Keys==='string'){Keys=Keys.split(',');}
for(var i=0;i<Keys.length;i++){var Key=Keys[i];var Ascending=true;if(Key.toLowerCase().indexOf(' desc',Key.length-' desc'.length)!==-1){Key=Key.slice(0,Key.toLowerCase().indexOf(' desc',Key.length-' desc'.length));Ascending=false;}else{if(Key.toLowerCase().indexOf(' asc',Key.length-' asc'.length)!==-1){Key=Key.slice(0,Key.toLowerCase().indexOf(' asc',Key.length-' asc'.length));}}
var Key=Key.replace(/^\s+|\s+$/g,'');if(Ascending){var SortFunction=function(ObjA,ObjB){var ValA=(1*ObjA[Key]==ObjA[Key])?1*ObjA[Key]:ObjA[Key];var ValB=(1*ObjB[Key]==ObjB[Key])?1*ObjB[Key]:ObjB[Key];if(ValA===ValB){return 0;}
return(ValA>ValB)?1:-1;};}else{var SortFunction=function(ObjA,ObjB){var ValA=(1*ObjA[Key]==ObjA[Key])?1*ObjA[Key]:ObjA[Key];var ValB=(1*ObjB[Key]==ObjB[Key])?1*ObjB[Key]:ObjB[Key];if(ValA===ValB){return 0;}
return(ValA<ValB)?1:-1;};}
SortArray.sort(SortFunction);}
return SortArray;};var CNamespace=function(Name,CacheDefinitions){if(typeof(Name)==='undefined'){Name='Default';}
this.Name=Name;if(typeof(CacheDefinitions)!=='object'){CacheDefinitions={};}
this.Cache=CElementCacheGlobal.Register(Name,CacheDefinitions);this.Initialized=false;};CNamespace.prototype.Init=function(Event){var self=Event.data.self;var i,Name;self.Setup();self.Initialized=true;};CNamespace.prototype.Setup=function(){};CNamespace.prototype.Ajax=function(Action,Data,OnSuccess,OnError){if(typeof(OnSuccess)==='undefined'){OnSuccess=this.AjaxOnSuccess;}
if(typeof(OnError)==='undefined'){OnError=this.AjaxOnError;}
CAJAX.Add(this.Name,"Website",Action,Data,function(Code,Content){if(Code>0){if(typeof(OnSuccess)==='function'){OnSuccess(Content);}
return true;}else{if(typeof(OnError)==='function'){OnError(Content);}
return false;}});};CNamespace.prototype.AjaxOnSuccess=function(Response){};CNamespace.prototype.AjaxOnError=function(Response){alert(Response);};var System={__Initialized:false,DeviceWidth:0,DeviceHeight:0,Mobile:false,TouchDevice:false,ResizeCallbacks:[]};System.Init=function(){if(this.__Initialized===true){return;}
this.TouchDevice=!!('ontouchstart'in window);$(window).on("resize",this.OnResize);this.OnResize();this.__Initialized=true;};System.RegisterResizeCallback=function(Callback){this.ResizeCallbacks.push(Callback);};System.IsMobile=function(){return(this.DeviceWidth<=640);};System.OnResize=function(){var self=System;var Type="Width";if(self.DeviceWidth==window.innerWidth)Type="Height";self.DeviceWidth=window.innerWidth;self.DeviceHeight=window.innerHeight;for(var i in self.ResizeCallbacks){self.ResizeCallbacks[i](Type,self.DeviceWidth,self.DeviceHeight);}};var CWebsite=function(Name,CacheDefinitions){System.Init();if(typeof(Name)==='undefined'){Name='Default';}
this.Name=Name;if(typeof(CacheDefinitions)!=='object'){CacheDefinitions={};}
this.Cache=CElementCacheGlobal.Register(Name,CacheDefinitions);this.Initialized=false;$(document).on('ready',{self:this},this.Init);};CWebsite.prototype=new CNamespace();CWebsite.prototype.__Components=[];CWebsite.prototype.RegisterComponent=function(Component){this.__Components.push(Component);return this;};CWebsite.prototype.Init=function(Event){var self=Event.data.self;var i,Name;self.Setup();for(var i=0;i<self.__Components.length;i++){Name=self.__Components[i].Name;self[Name]=self.__Components[i];self[Name].Website=self;self.__Components[i].Setup();}
self.Initialized=true;};CWebsite.prototype.Ajax=function(){var Action,Data={},OnSuccess,OnError;if(typeof(arguments[0])!=='string'){throw"All ajax calls must have an action";return;}
Action=arguments[0];if(typeof(arguments[1])==='object'){Data=arguments[1];OnSuccess=arguments[2];OnError=arguments[3];}else{OnSuccess=arguments[1];OnError=arguments[2];}
if(typeof(OnSuccess)==='undefined'){OnSuccess=this.AjaxOnSuccess;}
if(typeof(OnError)==='undefined'){OnError=this.AjaxOnError;}
CAJAX.Add(this.Name+'.System.'+Action,Data,{OnSuccess:OnSuccess,OnError:OnError});};CWebsite.prototype.AjaxOnSuccess=function(ResponseData){};CWebsite.prototype.AjaxOnError=function(ResponseData,Message,XHRObject){if(typeof(ResponseData)!=='object'){try{ResponseData=JSON.parse(ResponseData);}catch(Exception){alert(ResponseData);return;}}};var CModule=function(Name,CacheDefinitions){if(typeof(this.Name)==='undefined'&&typeof(Name)==='undefined'){Name='Main';}
this.Name=Name;CAJAX.CurrentModule=this.Name;if(typeof(CacheDefinitions)!=='object'){CacheDefinitions={};}
this.Cache=CElementCacheGlobal.Register(Name,CacheDefinitions);CWebsite.prototype.RegisterComponent(this);};CModule.prototype.Setup=function(){};CModule.prototype.Ajax=function(){var Action,Data={},OnSuccess,OnError;if(typeof(arguments[0])!=='string'){throw"All ajax calls must have an action";return;}
Action=arguments[0];if(typeof(arguments[1])==='object'){Data=arguments[1];OnSuccess=arguments[2];OnError=arguments[3];}else{OnSuccess=arguments[1];OnError=arguments[2];}
if(typeof(OnSuccess)==='undefined'){OnSuccess=this.AjaxOnSuccess;}
if(typeof(OnError)==='undefined'){OnError=this.AjaxOnError;}
CAJAX.Add(this.Website.Name+'.'+this.Name+'.'+Action,Data,{OnSuccess:OnSuccess,OnError:OnError});};CModule.prototype.AjaxOnSuccess=function(ResponseData){};CModule.prototype.AjaxOnError=function(ResponseData,Message,XHRObject){if(typeof(ResponseData)!=='object'){try{ResponseData=JSON.parse(ResponseData);}catch(Exception){alert(ResponseData);return;}}};var CModuleScaffold=function(Name,CacheDefinitions){if(typeof(Name)==='undefined'){Name='Main';}
this.Name=Name;CAJAX.CurrentModule=this.Name;this.RecordObjectName=this.Name;if(this.RecordObjectName.indexOf('s',this.RecordObjectName.length-1)!==-1){this.RecordObjectName=this.RecordObjectName.slice(0,-1);}
if(typeof(CacheDefinitions)!=='object'){CacheDefinitions={};}
this.Cache=CElementCacheGlobal.Register(Name,CacheDefinitions);this.Dialogs=[];this.DialogSizes={View:[640,480],Create:[640,480],Update:[640,480],Delete:[500,"auto"]};this.FormProperties={};this.Forms=[];this.LoadFormPropertiesParams={};this.LoadFormPropertiesOnInit=true;this.RedirectOnSubmit=true;this.AllowRedirectOnDelete=false;this.AllowRedirectOnDeactivate=false;CWebsite.prototype.RegisterComponent(this);};CModuleScaffold.prototype=Object.create(CModule.prototype);CModuleScaffold.prototype.constructor=CModule.constructor;CModuleScaffold.prototype.HandleSpecialKeys=true;CModuleScaffold.prototype.Setup=function(){if(typeof(this.OnBeforeSetup)==='function'){this.OnBeforeSetup();}
var self=this;this.Cache({PrimaryActionButton:'.PageHeaderPrimaryAction',ActionButtons:'.PageHeaderAction',PaginationPage:'.ScaffoldPaginationPage',PaginationPrev:'.ScaffoldPaginationPrevious',PaginationNext:'.ScaffoldPaginationNext'});this.Cache('PrimaryActionButton').on('click',function(Event){var PrimaryAction=$(this).attr('rel');if(PrimaryAction.charAt(0)=='#'){PrimaryAction=PrimaryAction.substr(1);}
if(typeof(self[PrimaryAction])==='function'){self[PrimaryAction]();}else{window.location.href=PrimaryAction;}});this.Cache('ActionButtons').on('click',function(Event){var Action=$(this).attr('rel');if(Action.charAt(0)=='#'){Action=Action.substr(1);}
if(typeof(self[Action])==='function'){self[Action]();}else{window.location.href=Action;}});var Callback=function(ResponseData){if(typeof(self.PageAction)==='string'){switch(self.PageAction){case'Index':self.IndexSetup();break;case'View':self.ViewSetup();break;case'Create':self.CreateSetup();break;case'Update':self.UpdateSetup();break;default:var SetupMethodName=self.PageAction+'Setup';if(typeof(self[SetupMethodName])==='function'){var SetupMethod=self[SetupMethodName];SetupMethod.apply(self);}}}
if(typeof(self.OnAfterSetup)==='function'){self.OnAfterSetup(ResponseData);}};if(this.LoadFormPropertiesOnInit===true){this.LoadFormProperties(Callback);}else{Callback({});}};CModuleScaffold.prototype.LoadFormProperties=function(Callback){var self=this;this.Ajax('GetFormProperties',this.LoadFormPropertiesParams,function(ResponseData,Message){self.FormProperties=ResponseData.Properties;if(typeof(Callback)==='function'){Callback(ResponseData,Message);}});};CModuleScaffold.prototype.OnBeforeSetup=function(){};CModuleScaffold.prototype.OnAfterSetup=function(ResponseData){};CModuleScaffold.prototype.IndexSetup=function(){var self=this;this.Cache('PaginationPrev, PaginationNext').on('click',function(){if($(this).children('img').length>0){var URL=$(this).children('img').attr('data-url');window.location.href=URL;}});this.Cache('PaginationPage').on('change',function(){});$(document.body).on('click','button.ActionView, button.ActionUpdate, button.ActionDelete',function(){var RecordID=$(this).data('id');self.DialogDelete(RecordID);});};CModuleScaffold.prototype.ViewSetup=function(RecordID){var self=this;this.Ajax('GetRecordData',{'ID':RecordID},function(ResponseData){var ID=self.Name+'_View_'+CUtil.UUID();var Form=new CFormObject(self.FormProperties.FormName,{},self.FormProperties);var ContentTemplate=new CTemplateObject('ScaffoldView',{},{Form:Form,Record:ResponseData.Record,Module:self});var Dialog=new CDialog({ID:ID,Template:'ScaffoldDialog',Title:'View '+self.RecordObjectName,Content:ContentTemplate.Render(true),Width:self.DialogSizes.View[0],Height:self.DialogSizes.View[1]}).Open();self.Dialogs.push(Dialog);if(typeof(self.OnView)==='function'){self.OnView(ResponseData.Record);}});};CModuleScaffold.prototype.OnView=function(Record){};CModuleScaffold.prototype.CreateSetup=function(){var self=this;var Form=new CFormView({SubmitAction:'CreateSubmit',FormName:this.FormProperties.FormName,FormProperties:this.FormProperties,HandleSpecialKeys:this.HandleSpecialKeys});if(typeof(self.OnFormGetData)==='function'){Form.OnGetData=self.OnFormGetData;}
if(typeof(self.OnCreateValidate)==='function'){Form.OnAfterValidate=self.OnCreateValidate;}
Form.OnSubmitSuccess=function(ResponseData,Message){if(typeof(self.OnCreateSubmit)==='function'){self.OnCreateSubmit(Form,ResponseData);}
CPageNotice.SetNotice('Success',Message,{"Buttons":[{"Name":"Close","Callback":function(){if(self.RedirectOnSubmit===true){if(typeof(ResponseData.RedirectURL)==='string'){window.location.href=ResponseData.RedirectURL;}else{window.location.href='Index?PageNotice=Created';}}}}]});};Form.OnSubmitFail=function(ResponseData,Message){if(ResponseData.ErrorCode==="00-00000"){return;}
CPageNotice.SetNotice("Failure",Message);}
this.Forms.push(Form);if(typeof(this.OnCreate)==='function'){this.OnCreate(Form);}};CModuleScaffold.prototype.OnCreate=function(Form){};CModuleScaffold.prototype.OnCreateValidate=function(){};CModuleScaffold.prototype.OnCreateSubmit=function(Form,ResponseData){};CModuleScaffold.prototype.UpdateSetup=function(){var self=this;var Form=new CFormView({SubmitAction:'UpdateSubmit',FormName:this.FormProperties.FormName,FormProperties:this.FormProperties,HandleSpecialKeys:this.HandleSpecialKeys});if(this.AllowRedirectOnDeactivate===true){this.InitialActiveStatus=Form.FormObject.GetElement('IsActive').val();Form.DeferredSendSubmit=function(SubmitCallback){if(self.AllowRedirectOnDeactivate===false||self.InitialActiveStatus==0||Form.FormObject.GetElement('IsActive').val()==1){Form.SendSubmit(SubmitCallback);return;}
var RedirectForm=new CFormObject('RedirectForm',{RedirectURL:''});var TemplateData={Module:self};TemplateData.Form=RedirectForm;var ContentTemplate=new CTemplateObject('RedirectDialog',{},TemplateData);var Dialog=new CDialog({ID:CUtil.UUID(),Template:'ScaffoldDialog',Title:'Add Redirect?',Content:ContentTemplate.Render(true),Width:500,Height:'auto',Modal:true}).AddButton('Yes, Save Record',function(){Form.RequestData=function(){return{RedirectURL:RedirectForm.GetElement('RedirectURL').val()};};Form.SendSubmit(SubmitCallback);Dialog.Close().Destroy();},'DialogButton').AddButton('No, Cancel',function(){Dialog.Close().Destroy();Form.EnableForm();},'DialogButtonCancel');Dialog.Open();};}
if(typeof(self.OnFormGetData)==='function'){Form.OnGetData=self.OnFormGetData;}
if(typeof(self.OnUpdateValidate)==='function'){Form.OnAfterValidate=self.OnUpdateValidate;}
Form.OnSubmitSuccess=function(ResponseData,Message){if(typeof(self.OnUpdateSubmit)==='function'){self.OnUpdateSubmit(Form,ResponseData);}
CPageNotice.SetNotice('Success',Message,{"Buttons":[{"Name":"Close","Callback":function(){if(self.RedirectOnSubmit===true){if(typeof(ResponseData.RedirectURL)==='string'){window.location.href=ResponseData.RedirectURL;}else{window.location.href='Index?PageNotice=Created';}}}}]});};Form.OnSubmitFail=function(ResponseData,Message){if(ResponseData.ErrorCode==="00-00000"){return;}
CPageNotice.SetNotice("Failure",Message);}
this.Forms.push(Form);if(typeof(self.OnUpdate)==='function'){self.OnUpdate(Form);}};CModuleScaffold.prototype.OnUpdate=function(Form){};CModuleScaffold.prototype.OnFormGetData=function(FormData){return{};};CModuleScaffold.prototype.OnUpdateValidate=function(){};CModuleScaffold.prototype.OnUpdateSubmit=function(Form,ResponseData){};CModuleScaffold.prototype.DialogDelete=function(RecordID){var self=this;this.Ajax('GetRecordData',{ID:RecordID},function(ResponseData){var ID=self.Name+'_Delete_'+CUtil.UUID();var TemplateData={Record:ResponseData.Record,Module:self};if(self.AllowRedirectOnDelete===true){TemplateData.Form=new CFormObject('DeleteForm',{ID:RecordID,RedirectURL:''});}
var ContentTemplate=new CTemplateObject('ScaffoldDelete',{},TemplateData);var Dialog=new CDialog({ID:ID,Template:'ScaffoldDialog',Title:'Delete '+self.RecordObjectName,Content:ContentTemplate.Render(true),Width:self.DialogSizes.Delete[0],Height:self.DialogSizes.Delete[1],Modal:true}).AddButton('Yes, Delete Record',function(){var DeleteActionData={ID:RecordID};if(self.AllowRedirectOnDelete===true){DeleteActionData.RedirectURL=TemplateData.Form.GetElement('RedirectURL').val();}
self.Ajax('Delete',DeleteActionData,function(ResponseData,Message){CPageNotice.SetNotice('Success',Message);Dialog.Close().Destroy();window.location.reload();});},'DialogButton').AddButton('No, Cancel',function(){Dialog.Close().Destroy();},'DialogButtonCancel');if(ResponseData.UpdateURL){Dialog.AddButton('No, Edit the '+self.RecordObjectName,function(){Dialog.Close().Destroy();window.location.href=ResponseData.UpdateURL;},'DialogButtonCancel');}
Dialog.Open();self.Dialogs.push(Dialog);if(typeof(self.OnDialogDelete)==='function'){self.OnDialogDelete(Dialog,ResponseData.Record);}});};CModuleScaffold.prototype.OnDialogDelete=function(Dialog,Record){};var CPageNotice={};CPageNotice.Options={"ContainerID":"PageNotices","NoticeClass":"PageNotice","ActiveClass":"Active","TypeClasses":{"Success":"TypeSuccess","Failure":"TypeFailure","Warning":"TypeFailure"},"Timeout":6000};CPageNotice.SetupRun=false;CPageNotice.Cache={};CPageNotice.ContainerTimer=null;CPageNotice.NoticeTimer=null;CPageNotice.Count=0;CPageNotice.ExtendOptions=function(Options){var self=this;if(typeof(Options)==='undefined'){return this;}
$.extend(true,self.Options,Options);$.each(self.Options,function(Key,Value){if(typeof(Value)==="string"){self.Options[Key]=CUtil.HtmlSpecialChars(Value);}});$.each(self.Options.TypeClasses,function(Key,Value){if(typeof(Value)==="string"){self.Options.TypeClasses[Key]=CUtil.HtmlSpecialChars(Value);}});return this;};CPageNotice.Setup=function(Options){var self=this;self.ExtendOptions(Options);var Options=self.Options;var CacheDefinitions={Container:'#'+Options.ContainerID,Notice:'.'+Options.NoticeClass};$('body').append('<div id="'+Options.ContainerID+'">');$(CacheDefinitions.Container).append('<div class="'+Options.NoticeClass+'">');self.Cache=CElementCacheGlobal.Register("PageNotice",CacheDefinitions);self.SetupRun=true;self.RegisterHandlers();return this;};CPageNotice.RegisterHandlers=function(){var self=this;var Cache=self.Cache;Cache('Notice').on('click',function(){self.Reset();});Cache('Notice').on('mouseover',function(){self.ClearNoticeTimer();});Cache('Notice').on('mouseout',function(){self.SetNoticeTimer();});};CPageNotice.SetNotice=function(Type,Content,Options){var self=this;if(typeof(Options)==="undefined"){Options={};}
if(typeof(Options.Title)==="undefined"){Options.Title=(Type==="Failure"?"Whoops...":"Success!");}
var Dialog=new CDialog({ID:'PageNoticeDialog_'+self.Count,DialogClass:"Dialog PageNoticeDialog",Template:'PageNoticeDialog',TemplateParams:{"Type":Type},Title:Options.Title,Content:Content,Width:(Options.Width?Options.Width:500),Modal:true,DestroyOnClose:true});if(typeof(Options.Buttons)!=="undefined"){for(var i in Options.Buttons){var Button=Options.Buttons[i];(function(Button){Dialog.AddButton(Button.Name,function(){Button.Callback(Dialog);},Button.ClassName);})(Button);}}else{Dialog.AddButton("Close",function(){Dialog.Close();});}
Dialog.Open();self.Count++;return Dialog;};CPageNotice.SetNoticeTimer=function(){var self=this;var Options=self.Options;self.NoticeTimer=setTimeout(function(){self.Reset();},Options.Timeout*1);return this;};CPageNotice.ClearNoticeTimer=function(){var self=this;var Options=self.Options;if(self.NoticeTimer)
clearTimeout(self.NoticeTimer);};CPageNotice.Reset=function(SetContainerTimer,FullNoticeReset){var self=this;var Options=self.Options;var Cache=self.Cache;if(self.NoticeTimer)
clearTimeout(self.NoticeTimer);if(self.ContainerTimer)
clearTimeout(self.ContainerTimer);var AccessoryClasses=Options.ActiveClass;if(typeof(FullNoticeReset)==='undefined'){FullNoticeReset=false;}
if(FullNoticeReset){$.each(Options.TypeClasses,function(TypeName,TypeValue){AccessoryClasses+=" "+TypeValue;});Cache('Notice').empty();}
Cache('Notice').removeClass(AccessoryClasses);if(typeof(SetContainerTimer)==='undefined'){SetContainerTimer=true;}
if(SetContainerTimer){self.ContainerTimer=setTimeout(function(){Cache('Container').removeClass(Options.ActiveClass);},500);}
return this;};var CDialog=function(Options){this._IsOpen=false;if(typeof(Options)!=='object'){Options={};}
this.Template=Options.Template||'Dialog';this.TemplateParams=Options.TemplateParams||{};this.Title=Options.Title||'Dialog Title';this.ID=Options.ID||'';this.Content=Options.Content||'';this.Width=Options.Width||640;this.Height=Options.Height||"auto";this.Buttons=Options.Buttons||[];this.OnOpen=Options.OnOpen||function(){};this.OnClose=Options.OnClose||function(){};this.DialogClass=Options.DialogClass||'Dialog';this.ContentClass=Options.ContentClass||'DialogContent';this.Modal=Options.Modal||false;this.DestroyOnClose=Options.DestroyOnClose||false;this.DisableClose=Options.DisableClose||false;this.Cache=CElementCacheGlobal.Register('Dialog_'+this.ID);this.Init();return this;};CDialog.prototype.Init=function(){if(this.Content!==''){this.TemplateParams.Content=this.Content;}
var DialogTemplate=new CTemplateObject(this.Template,{id:this.ID},this.TemplateParams);this.Cache().Store('Dialog',$(DialogTemplate.Render(true)));this.Cache().Store('Tabs',this.Cache('Dialog').find('.DialogTabs'));var Options={autoOpen:false,modal:this.Modal,dialogClass:this.DialogClass,width:this.Width,height:this.Height,resizable:false,title:this.Title,buttons:this.Buttons,close:this.OnClose};if(this.DisableClose){Options.closeOnEscape=false;Options.closeText='';Options.open=function(){$(".ui-dialog-titlebar-close").hide();};}else{Options.closeText='X';}
this.Cache('Dialog').dialog(Options);return this;};CDialog.prototype.AddButton=function(ButtonText,Callback,ClassName){var Button={text:ButtonText};if(typeof(Callback)==='function'){Button.click=Callback;}
if(typeof(ClassName)==='string'){Button.icons={primary:ClassName};}
this.Buttons.push(Button);this.Cache('Dialog').dialog('option','buttons',this.Buttons);return this;};CDialog.prototype.OnCloseHandler=function(e){e.data.self.Close();};CDialog.prototype.Open=function(){this.Cache('Dialog').dialog("open");this._IsOpen=true;this.OnOpen();return this;};CDialog.prototype.Close=function(){this.Cache('Dialog').dialog("close");this._IsOpen=false;this.OnClose();if(this.DestroyOnClose){this.Destroy();}
return this;};CDialog.prototype.Destroy=function(){this.Cache('Dialog').dialog("destroy");this.Cache('Dialog').remove();return this;};CDialog.prototype.SetContent=function(Content){this.Cache('Dialog').find('.'+this.ContentClass).html(Content);return this;};CDialog.prototype.SetTitle=function(Content){this.Cache('Dialog').dialog('option','title',Content);return this;};