var base2={name:"base2",version:"1.0",exports:"Base,Package,Abstract,Module,Enumerable,Map,Collection,RegGrp,Undefined,Null,This,True,False,assignID,detect,global",namespace:""};new function(_no_shrink_){var Undefined=K(),Null=K(null),True=K(true),False=K(false),This=function(){return this};var global=This();var base2=global.base2;var _FORMAT=/%([1-9])/g;var _LTRIM=/^\s\s*/;var _RTRIM=/\s\s*$/;var _RESCAPE=/([\/()[\]{}|*+-.,^$?\\])/g;var _BASE=/try/.test(detect)?/\bbase\b/:/.*/;var _HIDDEN=["constructor","toString","valueOf"];var _MSIE_NATIVE_FUNCTION=detect("(jscript)")?new RegExp("^"+rescape(isNaN).replace(/isNaN/,"\\w+")+"$"):{test:False};var _counter=1;var _slice=Array.prototype.slice;_Function_forEach();function assignID(object){if(!object.base2ID){object.base2ID="b2_"+_counter++}return object.base2ID}var _subclass=function(_instance,_static){base2.__prototyping=this.prototype;var _prototype=new this;if(_instance){extend(_prototype,_instance)}delete base2.__prototyping;var _constructor=_prototype.constructor;function _class(){if(!base2.__prototyping){if(this.constructor==arguments.callee||this.__constructing){this.__constructing=true;_constructor.apply(this,arguments);delete this.__constructing}else{return extend(arguments[0],_prototype)}}return this}_prototype.constructor=_class;for(var i in Base){_class[i]=this[i]}_class.ancestor=this;_class.base=Undefined;if(_static){extend(_class,_static)}_class.prototype=_prototype;if(_class.init){_class.init()}_class["#implements"]=[];_class["#implemented_by"]=[];return _class};var Base=_subclass.call(Object,{constructor:function(){if(arguments.length>0){this.extend(arguments[0])}},base:function(){},extend:delegate(extend)},Base={ancestorOf:function(klass){return _ancestorOf(this,klass)},extend:_subclass,forEach:function(object,block,context){_Function_forEach(this,object,block,context)},implement:function(source){if(typeof source=="function"){if(_ancestorOf(Base,source)){this["#implements"].push(source);source["#implemented_by"].push(this)}source=source.prototype}extend(this.prototype,source);return this}});var Package=Base.extend({constructor:function(_private,_public){this.extend(_public);if(this.init){this.init()}if(this.name&&this.name!="base2"){if(!this.parent){this.parent=base2}this.parent.addName(this.name,this);this.namespace=format("var %1=%2;",this.name,String2.slice(this,1,-1))}if(_private){var JSNamespace=base2.JavaScript?base2.JavaScript.namespace:"";_private.imports=Array2.reduce(csv(this.imports),function(namespace,name){var ns=lookup(name)||lookup("JavaScript."+name);assert(ns,format("Object not found: '%1'.",name),ReferenceError);return namespace+=ns.namespace},"var base2=(function(){return this.base2})();"+base2.namespace+JSNamespace)+lang.namespace;_private.exports=Array2.reduce(csv(this.exports),function(namespace,name){var fullName=this.name+"."+name;this.namespace+="var "+name+"="+fullName+";";return namespace+="if(!"+fullName+")"+fullName+"="+name+";"},"",this)+"this._label_"+this.name+"();";var pkg=this;var packageName=String2.slice(this,1,-1);_private["_label_"+this.name]=function(){Package.forEach(pkg,function(object,name){if(object&&object.ancestorOf==Base.ancestorOf){object.toString=K(format("[%1.%2]",packageName,name));if(object.prototype.toString==Base.prototype.toString){object.prototype.toString=K(format("[object %1.%2]",packageName,name))}}})}}function lookup(names){names=names.split(".");var value=base2,i=0;while(value&&names[i]!=null){value=value[names[i++]]}return value}},exports:"",imports:"",name:"",namespace:"",parent:null,addName:function(name,value){if(!this[name]){this[name]=value;this.exports+=","+name;this.namespace+=format("var %1=%2.%1;",name,this.name)}},addPackage:function(name){this.addName(name,new Package(null,{name:name,parent:this}))},toString:function(){return format("[%1]",this.parent?String2.slice(this.parent,1,-1)+"."+this.name:this.name)}});var Abstract=Base.extend({constructor:function(){throw new TypeError("Abstract class cannot be instantiated.")}});var _moduleCount=0;var Module=Abstract.extend(null,{namespace:"",extend:function(_interface,_static){var module=this.base();var index=_moduleCount++;module.namespace="";module.partial=this.partial;module.toString=K("[base2.Module["+index+"]]");Module[index]=module;module.implement(this);if(_interface){module.implement(_interface)}if(_static){extend(module,_static);if(module.init){module.init()}}return module},forEach:function(block,context){_Function_forEach(Module,this.prototype,function(method,name){if(typeOf(method)=="function"){block.call(context,this[name],name,this)}},this)},implement:function(_interface){var module=this;var id=module.toString().slice(1,-1);if(typeof _interface=="function"){if(!_ancestorOf(_interface,module)){this.base(_interface)}if(_ancestorOf(Module,_interface)){for(var name in _interface){if(module[name]===undefined){var property=_interface[name];if(typeof property=="function"&&property.call&&_interface.prototype[name]){property=_staticModuleMethod(_interface,name)}module[name]=property}}module.namespace+=_interface.namespace.replace(/base2\.Module\[\d+\]/g,id)}}else{extend(module,_interface);_extendModule(module,_interface)}return module},partial:function(){var module=Module.extend();var id=module.toString().slice(1,-1);module.namespace=this.namespace.replace(/(\w+)=b[^\)]+\)/g,"$1="+id+".$1");this.forEach(function(method,name){module[name]=partial(bind(method,module))});return module}});function _extendModule(module,_interface){var proto=module.prototype;var id=module.toString().slice(1,-1);for(var name in _interface){var property=_interface[name],namespace="";if(name.charAt(0)=="@"){if(detect(name.slice(1))){_extendModule(module,property)}}else{if(!proto[name]){if(name==name.toUpperCase()){namespace="var "+name+"="+id+"."+name+";"}else{if(typeof property=="function"&&property.call){namespace="var "+name+"=base2.lang.bind('"+name+"',"+id+");";proto[name]=_moduleMethod(module,name);proto[name]._module=module}}if(module.namespace.indexOf(namespace)==-1){module.namespace+=namespace}}}}}function _staticModuleMethod(module,name){return function(){return module[name].apply(module,arguments)}}function _moduleMethod(module,name){return function(){var args=_slice.call(arguments);args.unshift(this);return module[name].apply(module,args)}}var Enumerable=Module.extend({every:function(object,test,context){var result=true;try{forEach(object,function(value,key){result=test.call(context,value,key,object);if(!result){throw StopIteration}})}catch(error){if(error!=StopIteration){throw error}}return !!result},filter:function(object,test,context){var i=0;return this.reduce(object,function(result,value,key){if(test.call(context,value,key,object)){result[i++]=value}return result},[])},invoke:function(object,method){var args=_slice.call(arguments,2);return this.map(object,(typeof method=="function")?function(item){return item==null?undefined:method.apply(item,args)}:function(item){return item==null?undefined:item[method].apply(item,args)})},map:function(object,block,context){var result=[],i=0;forEach(object,function(value,key){result[i++]=block.call(context,value,key,object)});return result},pluck:function(object,key){return this.map(object,function(item){return item==null?undefined:item[key]})},reduce:function(object,block,result,context){var initialised=arguments.length>2;forEach(object,function(value,key){if(initialised){result=block.call(context,result,value,key,object)}else{result=value;initialised=true}});return result},some:function(object,test,context){return !this.every(object,not(test),context)}});var _HASH="#";var Map=Base.extend({constructor:function(values){if(values){this.merge(values)}},clear:function(){for(var key in this){if(key.indexOf(_HASH)==0){delete this[key]}}},copy:function(){base2.__prototyping=true;var copy=new this.constructor;delete base2.__prototyping;for(var i in this){if(this[i]!==copy[i]){copy[i]=this[i]}}return copy},forEach:function(block,context){for(var key in this){if(key.indexOf(_HASH)==0){block.call(context,this[key],key.slice(1),this)}}},get:function(key){return this[_HASH+key]},getKeys:function(){return this.map(II)},getValues:function(){return this.map(I)},has:function(key){/*@cc_on @*//*@if (@_jscript_version < 5.5) return $Legacy.has(this, _HASH + key); @else @*/return _HASH+key in this;/*@end @*/},merge:function(values){var put=flip(this.put);forEach(arguments,function(values){forEach(values,put,this)},this);return this},put:function(key,value){this[_HASH+key]=value},remove:function(key){delete this[_HASH+key]},size:function(){var size=0;for(var key in this){if(key.indexOf(_HASH)==0){size++}}return size},union:function(values){return this.merge.apply(this.copy(),arguments)}});Map.implement(Enumerable);Map.prototype.filter=function(test,context){return this.reduce(function(result,value,key){if(!test.call(context,value,key,this)){result.remove(key)}return result},this.copy(),this)};var _KEYS="~";var Collection=Map.extend({constructor:function(values){this[_KEYS]=new Array2;this.base(values)},add:function(key,item){assert(!this.has(key),"Duplicate key '"+key+"'.");this.put.apply(this,arguments)},clear:function(){this.base();this[_KEYS].length=0},copy:function(){var copy=this.base();copy[_KEYS]=this[_KEYS].copy();return copy},forEach:function(block,context){var keys=this[_KEYS];var length=keys.length;for(var i=0;i0){var keys=this[_KEYS],removed=keys;sliced[_KEYS]=Array2(_slice.apply(keys,arguments));if(sliced[_KEYS].length){removed=removed.slice(0,start);if(arguments.length>1){removed=removed.concat(keys.slice(end))}}for(var i=0;i2){var key=source;source={};source[key]=arguments[2]}var proto=global[(typeof source=="function"?"Function":"Object")].prototype;if(base2.__prototyping){var i=_HIDDEN.length,key;while((key=_HIDDEN[--i])){var value=source[key];if(value!=proto[key]){if(_BASE.test(value)){_override(object,key,value)}else{object[key]=value}}}}for(key in source){if(proto[key]===undefined){var value=source[key];if(key.charAt(0)=="@"){if(detect(key.slice(1))){extend(object,value)}}else{var ancestor=object[key];if(ancestor&&typeof value=="function"){if(value!=ancestor){if(_BASE.test(value)){_override(object,key,value)}else{value.ancestor=ancestor;object[key]=value}}}else{object[key]=value}}}}}return object}function _ancestorOf(ancestor,fn){while(fn){if(!fn.ancestor){return false}fn=fn.ancestor;if(fn==ancestor){return true}}return false}function _override(object,name,method){var ancestor=object[name];var superObject=base2.__prototyping;if(superObject&&ancestor!=superObject[name]){superObject=null}function _base(){var previous=this.base;this.base=superObject?superObject[name]:ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue}_base.method=method;_base.ancestor=ancestor;object[name]=_base;_base.toString=K(method+"")}if(typeof StopIteration=="undefined"){StopIteration=new Error("StopIteration")}function forEach(object,block,context,fn){if(object==null){return }if(!fn){if(typeof object=="function"&&object.call){fn=Function}else{if(typeof object.forEach=="function"&&object.forEach!=arguments.callee){object.forEach(block,context);return }else{if(typeof object.length=="number"){_Array_forEach(object,block,context);return }}}}_Function_forEach(fn||Object,object,block,context)}forEach.csv=function(string,block,context){forEach(csv(string),block,context)};forEach.detect=function(object,block,context){forEach(object,function(value,key){if(key.charAt(0)=="@"){if(detect(key.slice(1))){forEach(value,arguments.callee)}}else{block.call(context,value,key,object)}})};function _Array_forEach(array,block,context){if(array==null){array=global}var length=array.length||0,i;if(typeof array=="string"){for(i=0;i1)?function(fn,object,block,context){var processed={};for(var key in object){if(!processed[key]&&fn.prototype[key]===undefined){processed[key]=true;block.call(context,object[key],key,object)}}}:function(fn,object,block,context){for(var key in object){if(fn.prototype[key]===undefined){block.call(context,object[key],key,object)}}};_Function_forEach(fn,object,block,context)}function instanceOf(object,klass){if(typeof klass!="function"){throw new TypeError("Invalid 'instanceOf' operand.")}if(object==null){return false;/*@cc_on // COM objects don't have a constructor if (typeof object.constructor != "function") { return typeOf(object) == typeof klass.prototype.valueOf(); } @*/}if(object.constructor==klass){return true}if(klass.ancestorOf){return klass.ancestorOf(object.constructor);/*@if (@_jscript_version < 5.1) // do nothing @else @*/}if(object instanceof klass){return true;/*@end @*/}if(Base.ancestorOf==klass.ancestorOf){return false}if(Base.ancestorOf==object.constructor.ancestorOf){return klass==Object}switch(klass){case Array:return !!(typeof object=="object"&&object.join&&object.splice);case Function:return typeOf(object)=="function";case RegExp:return typeof object.constructor.$1=="string";case Date:return !!object.getTimezoneOffset;case String:case Number:case Boolean:return typeOf(object)==typeof klass.prototype.valueOf();case Object:return true}return false}function typeOf(object){var type=typeof object;switch(type){case"object":return object==null?"null":typeof object.constructor=="undefined"?_MSIE_NATIVE_FUNCTION.test(object)?"function":type:typeof object.constructor.prototype.valueOf();case"function":return typeof object.call=="function"?type:"object";default:return type}}var JavaScript={name:"JavaScript",version:base2.version,exports:"Array2,Date2,Function2,String2",namespace:"",bind:function(host){var top=global;global=host;forEach.csv(this.exports,function(name2){var name=name2.slice(0,-1);extend(host[name],this[name2]);this[name2](host[name].prototype)},this);global=top;return host}};function _createObject2(Native,constructor,generics,extensions){var INative=Module.extend();var id=INative.toString().slice(1,-1);forEach.csv(generics,function(name){INative[name]=unbind(Native.prototype[name]);INative.namespace+=format("var %1=%2.%1;",name,id)});forEach(_slice.call(arguments,3),INative.implement,INative);var Native2=function(){return INative(this.constructor==INative?constructor.apply(null,arguments):arguments[0])};Native2.prototype=INative.prototype;for(var name in INative){if(name!="prototype"&&Native[name]){INative[name]=Native[name];delete INative.prototype[name]}Native2[name]=INative[name]}Native2.ancestor=Object;delete Native2.extend;Native2.namespace=Native2.namespace.replace(/(var (\w+)=)[^,;]+,([^\)]+)\)/g,"$1$3.$2");return Native2}if((new Date).getYear()>1900){Date.prototype.getYear=function(){return this.getFullYear()-1900};Date.prototype.setYear=function(year){return this.setFullYear(year+1900)}}var _testDate=new Date(Date.UTC(2006,1,20));_testDate.setUTCDate(15);if(_testDate.getUTCHours()!=0){forEach.csv("FullYear,Month,Date,Hours,Minutes,Seconds,Milliseconds",function(type){extend(Date.prototype,"setUTC"+type,function(){var value=base(this,arguments);if(value>=57722401000){value-=3600000;this.setTime(value)}return value})})}Function.prototype.prototype={};if("".replace(/^/,K("$$"))=="$"){extend(String.prototype,"replace",function(expression,replacement){if(typeof replacement=="function"){var fn=replacement;replacement=function(){return String(fn.apply(null,arguments)).split("$").join("$$")}}return this.base(expression,replacement)})}var Array2=_createObject2(Array,Array,"concat,join,pop,push,reverse,shift,slice,sort,splice,unshift",Enumerable,{combine:function(keys,values){if(!values){values=keys}return Array2.reduce(keys,function(hash,key,index){hash[key]=values[index];return hash},{})},contains:function(array,item){return Array2.indexOf(array,item)!=-1},copy:function(array){var copy=_slice.call(array);if(!copy.swap){Array2(copy)}return copy},flatten:function(array){var i=0;return Array2.reduce(array,function(result,item){if(Array2.like(item)){Array2.reduce(item,arguments.callee,result)}else{result[i++]=item}return result},[])},forEach:_Array_forEach,indexOf:function(array,item,fromIndex){var length=array.length;if(fromIndex==null){fromIndex=0}else{if(fromIndex<0){fromIndex=Math.max(0,length+fromIndex)}}for(var i=fromIndex;i=0;i--){if(array[i]===item){return i}}return -1},map:function(array,block,context){var result=[];Array2.forEach(array,function(item,index){result[index]=block.call(context,item,index,array)});return result},remove:function(array,item){var index=Array2.indexOf(array,item);if(index!=-1){Array2.removeAt(array,index)}},removeAt:function(array,index){Array2.splice(array,index,1)},swap:function(array,index1,index2){if(index1<0){index1+=array.length}if(index2<0){index2+=array.length}var temp=array[index1];array[index1]=array[index2];array[index2]=temp;return array}});Array2.reduce=Enumerable.reduce;Array2.like=function(object){return typeOf(object)=="object"&&typeof object.length=="number"};Enumerable["#implemented_by"].pop();Enumerable["#implemented_by"].push(Array2);var _DATE_PATTERN=/^((-\d+|\d{4,})(-(\d{2})(-(\d{2}))?)?)?T((\d{2})(:(\d{2})(:(\d{2})(\.(\d{1,3})(\d)?\d*)?)?)?)?(([+-])(\d{2})(:(\d{2}))?|Z)?$/;var _DATE_PARTS={FullYear:2,Month:4,Date:6,Hours:8,Minutes:10,Seconds:12,Milliseconds:14};var _TIMEZONE_PARTS={Hectomicroseconds:15,UTC:16,Sign:17,Hours:18,Minutes:20};var _TRIM_ZEROES=/(((00)?:0+)?:0+)?\.0+$/;var _TRIM_TIMEZONE=/(T[0-9:.]+)$/;var Date2=_createObject2(Date,function(yy,mm,dd,h,m,s,ms){switch(arguments.length){case 0:return new Date;case 1:return typeof yy=="number"?new Date(yy):Date2.parse(yy);default:return new Date(yy,mm,arguments.length==2?1:dd,h||0,m||0,s||0,ms||0)}},"",{toISOString:function(date){var string="####-##-##T##:##:##.###";for(var part in _DATE_PARTS){string=string.replace(/#+/,function(digits){var value=date["getUTC"+part]();if(part=="Month"){value++}return("000"+value).slice(-digits.length)})}return string.replace(_TRIM_ZEROES,"").replace(_TRIM_TIMEZONE,"$1Z")}});delete Date2.forEach;Date2.now=function(){return(new Date).valueOf()};Date2.parse=function(string,defaultDate){if(arguments.length>1){assertType(defaultDate,"number","default date should be of type 'number'.")}var parts=match(string,_DATE_PATTERN);if(parts.length){if(parts[_DATE_PARTS.Month]){parts[_DATE_PARTS.Month]--}if(parts[_TIMEZONE_PARTS.Hectomicroseconds]>=5){parts[_DATE_PARTS.Milliseconds]++}var date=new Date(defaultDate||0);var prefix=parts[_TIMEZONE_PARTS.UTC]||parts[_TIMEZONE_PARTS.Hours]?"UTC":"";for(var part in _DATE_PARTS){var value=parts[_DATE_PARTS[part]];if(!value){continue}date["set"+prefix+part](value);if(date["get"+prefix+part]()!=parts[_DATE_PARTS[part]]){return NaN}}if(parts[_TIMEZONE_PARTS.Hours]){var hours=Number(parts[_TIMEZONE_PARTS.Sign]+parts[_TIMEZONE_PARTS.Hours]);var minutes=Number(parts[_TIMEZONE_PARTS.Sign]+(parts[_TIMEZONE_PARTS.Minutes]||0));date.setUTCMinutes(date.getUTCMinutes()+(hours*60)+minutes)}return date.valueOf()}else{return Date.parse(string)}};var String2=_createObject2(String,function(string){return new String(arguments.length==0?"":string)},"charAt,charCodeAt,concat,indexOf,lastIndexOf,match,replace,search,slice,split,substr,substring,toLowerCase,toUpperCase",{csv:csv,format:format,rescape:rescape,trim:trim});delete String2.forEach;function trim(string){return String(string).replace(_LTRIM,"").replace(_RTRIM,"")}function csv(string){return string?(string+"").split(/\s*,\s*/):[]}function format(string){var args=arguments;var pattern=new RegExp("%([1-"+(arguments.length-1)+"])","g");return(string+"").replace(pattern,function(match,index){return args[index]})}function match(string,expression){return(string+"").match(expression)||[]}function rescape(string){return(string+"").replace(_RESCAPE,"\\$1")}var Function2=_createObject2(Function,Function,"",{I:I,II:II,K:K,bind:bind,compose:compose,delegate:delegate,flip:flip,not:not,partial:partial,unbind:unbind});function I(i){return i}function II(i,ii){return ii}function K(k){return function(){return k}}function bind(fn,context){var lateBound=typeof fn!="function";if(arguments.length>2){var args=_slice.call(arguments,2);return function(){return(lateBound?context[fn]:fn).apply(context,args.concat.apply(args,arguments))}}else{return function(){return(lateBound?context[fn]:fn).apply(context,arguments)}}}function compose(){var fns=_slice.call(arguments);return function(){var i=fns.length,result=fns[--i].apply(this,arguments);while(i--){result=fns[i].call(this,result)}return result}}function delegate(fn,context){return function(){var args=_slice.call(arguments);args.unshift(this);return fn.apply(context,args)}}function flip(fn){return function(){return fn.apply(this,Array2.swap(arguments,0,1))}}function not(fn){return function(){return !fn.apply(this,arguments)}}function partial(fn){var args=_slice.call(arguments,1);return function(){var specialised=args.concat(),i=0,j=0;while(iotherIndex){return 2}}return 0}}},{"@Gecko":{bind:function(node){return extend(this.base(node),"removeEventListener",function(){var args=Array2.slice(arguments);args.unshift(this);EventTarget.removeEventListener.apply(EventTarget,args)})}}});var _getSourceIndex=document.documentElement.sourceIndex?function(node){return node.sourceIndex}:function(node){var key=0;while(node){key=Traversal.getNodeIndex(node)+"."+key;node=node.parentNode}return key};var Document=Node.extend(null,{bind:function(document){extend(document,"createElement",function(tagName){return DOM.bind(this.base(tagName))});AbstractView.bind(document.defaultView);if(document!=window.document){new DOMContentLoadedEvent(document)}return this.base(document)},"@!(document.defaultView)":{bind:function(document){document.defaultView=Traversal.getDefaultView(document);return this.base(document)}}});var _ATTRIBUTES={"class":"className","for":"htmlFor"};var Element=Node.extend({"@MSIE.+win":{getAttribute:function(element,name){if(element.className===undefined){return this.base(element,name)}var attribute=_getAttributeNode(element,name);if(attribute&&(attribute.specified||name=="value")){if(name=="href"||name=="src"){element.base=element.getAttribute.ancestor;return element[element.base?"base":"getAttribute"](name,2)}else{if(name=="style"){return element.style.cssText.toLowerCase()}else{return attribute.nodeValue}}}else{if(name=="type"&&element.nodeName=="INPUT"){var outerHTML=element.outerHTML;with(outerHTML){outerHTML=slice(0,indexOf(">")+1)}return match(outerHTML,/type="?([^\s">]*)"?/i)[1]||null}}return null},removeAttribute:function(element,name){if(element.className!==undefined){name=_ATTRIBUTES[name.toLowerCase()]||name}this.base(element,name)},setAttribute:function(element,name,value){if(element.className===undefined){this.base(element,name,value)}else{if(name=="style"){element.style.cssText=value}else{value=String(value);var attribute=_getAttributeNode(element,name);if(attribute){attribute.nodeValue=value}else{this.base(element,_ATTRIBUTES[name.toLowerCase()]||name,value)}}}}},"@!(element.hasAttribute)":{hasAttribute:function(element,name){if(element.className===undefined){return this.base(element,name)}return this.getAttribute(element,name)!=null}}});if(detect("MSIE.+win")){extend(Element.prototype,"cloneNode",function(deep){var clone=this.base(deep||false);clone.base2ID=undefined;return clone})}var _HTML_ATTRIBUTES="colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc";extend(_ATTRIBUTES,Array2.combine(_HTML_ATTRIBUTES.toLowerCase().split(","),_HTML_ATTRIBUTES.split(",")));var _getAttributeNode=document.documentElement.getAttributeNode?function(element,name){return element.getAttributeNode(name)}:function(element,name){return element.attributes[name]||element.attributes[_ATTRIBUTES[name.toLowerCase()]]};var TEXT=detect("(element.textContent===undefined)")?"innerText":"textContent";var Traversal=Module.extend({getDefaultView:function(node){return this.getDocument(node).defaultView},getNextElementSibling:function(node){while(node&&(node=node.nextSibling)&&!this.isElement(node)){continue}return node},getNodeIndex:function(node){var index=0;while(node&&(node=node.previousSibling)){index++}return index},getOwnerDocument:function(node){return node.ownerDocument},getPreviousElementSibling:function(node){while(node&&(node=node.previousSibling)&&!this.isElement(node)){continue}return node},getTextContent:function(node,isHTML){return node[isHTML?"innerHTML":TEXT]},isEmpty:function(node){node=node.firstChild;while(node){if(node.nodeType==3||this.isElement(node)){return false}node=node.nextSibling}return true},setTextContent:function(node,text,isHTML){return node[isHTML?"innerHTML":TEXT]=text},"@!MSIE":{setTextContent:function(node,text,isHTML){with(node){while(lastChild){parentNode.removeChild(lastChild)}}return this.base(node,text,isHTML)}},"@MSIE":{getDefaultView:function(node){return(node.document||node).parentWindow},"@MSIE5":{getOwnerDocument:function(node){return node.ownerDocument||node.document}}}},{contains:function(node,target){node.nodeType;while(target&&(target=target.parentNode)&&node!=target){continue}return !!target},getDocument:function(node){return this.isDocument(node)?node:node.ownerDocument||node.document},isDocument:function(node){return !!(node&&node.documentElement)},isElement:function(node){return !!(node&&node.nodeType==1)},"@(element.contains)":{contains:function(node,target){return node!=target&&(this.isDocument(node)?node==this.getOwnerDocument(target):node.contains(target))}},"@MSIE5":{isElement:function(node){return !!(node&&node.nodeType==1&&node.nodeName!="!")}}});var AbstractView=Binding.extend();var _CAPTURE_TYPE={},_TYPE_MAP={"2":2,"4":1};var _CAPTURING_PHASE=1,_AT_TARGET=2,_BUBBLING_PHASE=3;var _MOUSE_BUTTON=/^mouse(up|down)|click$/,_MOUSE_CLICK=/click$/,_BUBBLES="abort|error|select|change|resize|scroll|",_CANCELABLE="(dbl)?click|mouse(down|up|over|move|out|wheel)|key(down|up)|submit|reset";_BUBBLES=new RegExp("^("+_BUBBLES+_CANCELABLE+")$");_CANCELABLE=new RegExp("^("+_CANCELABLE+")$");if(_MSIE){var _W3C_EVENT_TYPE={focusin:"focus",focusout:"blur"};_CAPTURE_TYPE={focus:"focusin",blur:"focusout"}}var _CAN_DELEGATE=/^(blur|submit|reset|change|select)$|^(mouse|key|focus)|click$/;var Event=Binding.extend({"@!(document.createEvent)":{initEvent:function(event,type,bubbles,cancelable){event.type=String(type);event.bubbles=!!bubbles;event.cancelable=!!cancelable},preventDefault:function(event){if(event.cancelable!==false){event.returnValue=false}},stopPropagation:function(event){event.cancelBubble=true},"@MSIE":{preventDefault:function(event){this.base(event);if(event.type=="mousedown"){var type="onbeforedeactivate";var document=Traversal.getDocument(event.target);document.attachEvent(type,function(event){event.returnValue=false;document.detachEvent(type,arguments.callee)})}}}}},{CAPTURING_PHASE:_CAPTURING_PHASE,AT_TARGET:_AT_TARGET,BUBBLING_PHASE:_BUBBLING_PHASE,"@!(document.createEvent)":{"@MSIE":{bind:function(event){var type=event.type;if(!event.timeStamp){event.bubbles=_BUBBLES.test(type);event.cancelable=_CANCELABLE.test(type);event.timeStamp=new Date().valueOf()}event.relatedTarget=event[(event.target==event.fromElement?"to":"from")+"Element"];return this.base(event)}}},cloneEvent:function(event){var clone=copy(event);clone.stopPropagation=function(){event.stopPropagation()};clone.preventDefault=function(){event.preventDefault()};return clone},"@MSIE":{cloneEvent:copy}});var EventDispatcher=Base.extend({constructor:function(state){this.state=state;this.events=state.events},dispatch:function(nodes,event,phase){event.eventPhase=phase;var map=this.events[event.type][phase];if(map){var i=nodes.length;while(i--&&!event.cancelBubble){var currentTarget=nodes[i];var listeners=map[currentTarget.base2ID];if(listeners){listeners=copy(listeners);event.currentTarget=currentTarget;event.eventPhase=currentTarget==event.target?_AT_TARGET:phase;for(var listenerID in listeners){var listener=listeners[listenerID];if(typeof listener=="function"){listener.call(currentTarget,event)}else{listener.handleEvent(event)}}}}}},handleEvent:function(event,fixed){Event.bind(event);var type=event.type;var w3cType=_W3C_EVENT_TYPE[type];if(w3cType){event=copy(event);type=event.type=w3cType}if(this.events[type]){if(_MOUSE_BUTTON.test(type)){var button=_MOUSE_CLICK.test(type)?this.state._button:event.button;button=_TYPE_MAP[button]||0;if(event.button!=button){event=copy(event);event.button=button}}var currentTarget=event.target;var nodes=[],i=0;while(currentTarget){nodes[i++]=currentTarget;currentTarget=currentTarget.parentNode}this.dispatch(nodes,event,_CAPTURING_PHASE);if(!event.cancelBubble){if(!event.bubbles){nodes.length=1}nodes.reverse();this.dispatch(nodes,event,_BUBBLING_PHASE)}}return event.returnValue!==false},"@MSIE.+win":{handleEvent:function(event){if(event.type=="scroll"){setTimeout(bind(this.base,this,copy(event),true),0);return true}else{return this.base(event)}},"@MSIE5":{dispatch:function(nodes,event,phase){if(phase==_CAPTURING_PHASE&&!Array2.item(nodes,-1).documentElement){nodes.push(nodes[0].document)}this.base(nodes,event,phase)}}}});var _wrappedListeners={};var EventTarget=Interface.extend({"@!(element.addEventListener)":{addEventListener:function(target,type,listener,useCapture){var documentState=DocumentState.getInstance(target);var targetID=assignID(target);var listenerID=assignID(listener);var phase=useCapture?_CAPTURING_PHASE:_BUBBLING_PHASE;var typeMap=documentState.registerEvent(type,target);var phaseMap=typeMap[phase];if(!phaseMap){phaseMap=typeMap[phase]={}}if(useCapture){type=_CAPTURE_TYPE[type]||type}var listeners=phaseMap[targetID];if(!listeners){listeners=phaseMap[targetID]={}}listeners[listenerID]=listener},dispatchEvent:function(target,event){event.target=target;return DocumentState.getInstance(target).handleEvent(event)},removeEventListener:function(target,type,listener,useCapture){var events=DocumentState.getInstance(target).events;var typeMap=events[type];if(typeMap){var phaseMap=typeMap[useCapture?_CAPTURING_PHASE:_BUBBLING_PHASE];if(phaseMap){var listeners=phaseMap[target.base2ID];if(listeners){delete listeners[listener.base2ID]}}}}},"@(element.addEventListener)":{"@Gecko":{addEventListener:function(target,type,listener,useCapture){if(type=="mousewheel"){type="DOMMouseScroll";var originalListener=listener;listener=_wrappedListeners[assignID(listener)]=function(event){event=Event.cloneEvent(event);event.type="mousewheel";event.wheelDelta=(-event.detail*40)||0;_handleEvent(target,originalListener,event)}}this.base(target,type,listener,useCapture)}},"@webkit[1-4]|KHTML[34]":{addEventListener:function(target,type,listener,useCapture){if(_MOUSE_BUTTON.test(type)){var originalListener=listener;listener=_wrappedListeners[assignID(listener)]=function(event){var button=_TYPE_MAP[event.button]||0;if(event.button!=button){event=Event.cloneEvent(event);event.button=button}_handleEvent(target,originalListener,event)}}else{if(typeof listener=="object"){listener=_wrappedListeners[assignID(listener)]=bind("handleEvent",listener)}}this.base(target,type,listener,useCapture)}},"@Linux|Mac|opera":{addEventListener:function(target,type,listener,useCapture){if(type=="keydown"){var originalListener=listener;listener=_wrappedListeners[assignID(listener)]=function(keydownEvent){var firedCount=0,cancelled=false;extend(keydownEvent,"preventDefault",function(){this.base();cancelled=true});function handleEvent(event){if(cancelled){event.preventDefault()}if(event==keydownEvent||firedCount>1){_handleEvent(target,originalListener,keydownEvent)}firedCount++}handleEvent(keydownEvent);target.addEventListener("keyup",function(){target.removeEventListener("keypress",handleEvent,true);target.removeEventListener("keyup",arguments.callee,true)},true);target.addEventListener("keypress",handleEvent,true)}}this.base(target,type,listener,useCapture)}},removeEventListener:function(target,type,listener,useCapture){this.base(target,type,_wrappedListeners[listener.base2ID]||listener,useCapture)}}});if(detect("Gecko")){EventTarget.removeEventListener._delegate="removeEventListener";delete EventTarget.prototype.removeEventListener}function _handleEvent(target,listener,event){if(typeof listener=="function"){listener.call(target,event)}else{listener.handleEvent(event)}}var DocumentEvent=Interface.extend({"@!(document.createEvent)":{createEvent:function(document,type){var event=document.createEventObject?document.createEventObject():{};event.bubbles=false;event.cancelable=false;event.eventPhase=0;event.target=document;event.currentTarget=null;event.relatedTarget=null;event.timeStamp=new Date().valueOf();return Event(event)}},"@(document.createEvent)":{"@!(document.createEvent('Events'))":{createEvent:function(document,type){return this.base(document,type=="Events"?"UIEvents":type)}}}});var DOMContentLoadedEvent=Base.extend({constructor:function(document){var fired=false;this.fire=function(){if(!fired){fired=true;setTimeout(function(){var event=DocumentEvent.createEvent(document,"Events");Event.initEvent(event,"DOMContentLoaded",true,false);EventTarget.dispatchEvent(document,event)},1)}};EventTarget.addEventListener(document,"DOMContentLoaded",function(){fired=true},false);this.listen(document)},listen:Undefined,"@!Gecko20([^0]|0[3-9])|Webkit52[5-9]|Webkit5[3-9]|Webkit[6-9]|Opera[19]|MSIE.+mac":{listen:function(document){EventTarget.addEventListener(Traversal.getDefaultView(document),"load",this.fire,false)},"@MSIE.+win":{listen:function(document){try{document.body.doScroll("left");if(!this.__constructing){this.fire()}}catch(e){setTimeout(bind(this.listen,this,document),10)}}},"@KHTML":{listen:function(document){if(/loaded|complete/.test(document.readyState)){if(!this.__constructing){this.fire()}}else{setTimeout(bind(this.listen,this,document),10)}}}}});Document.implement(DocumentEvent);Document.implement(EventTarget);Element.implement(EventTarget);var _PIXEL=/^\d+(px)?$/i,_METRICS=/(width|height|top|bottom|left|right|fontSize)$/,_COLOR=/^(color|backgroundColor)$/,_RGB_BLACK="rgb(0, 0, 0)",_BLACK={black:1,"#000":1,"#000000":1};var ViewCSS=Interface.extend({"@!(document.defaultView.getComputedStyle)":{"@MSIE":{getComputedStyle:function(view,element,pseudoElement){var currentStyle=element.currentStyle;var computedStyle={};for(var propertyName in currentStyle){if(_METRICS.test(propertyName)||_COLOR.test(propertyName)){computedStyle[propertyName]=this.getComputedPropertyValue(view,element,propertyName)}else{if(propertyName.indexOf("ruby")!=0){computedStyle[propertyName]=currentStyle[propertyName]}}}return computedStyle}}},getComputedStyle:function(view,element,pseudoElement){return _CSSStyleDeclaration_ReadOnly.bind(this.base(view,element,pseudoElement))}},{getComputedPropertyValue:function(view,element,propertyName){return CSSStyleDeclaration.getPropertyValue(this.getComputedStyle(view,element,null),propertyName)},"@MSIE":{getComputedPropertyValue:function(view,element,propertyName){propertyName=this.toCamelCase(propertyName);var value=element.currentStyle[propertyName];if(_METRICS.test(propertyName)){return _MSIE_getPixelValue(element,value)+"px"}if(!_MSIE5&&_COLOR.test(propertyName)){var rgb=_MSIE_getColorValue(element,propertyName=="color"?"ForeColor":"BackColor");return(rgb==_RGB_BLACK&&!_BLACK[value])?value:rgb}return value}},toCamelCase:function(string){return string.replace(/\-([a-z])/g,flip(String2.toUpperCase))}});function _MSIE_getPixelValue(element,value){if(_PIXEL.test(value)){return parseInt(value)}var styleLeft=element.style.left;var runtimeStyleLeft=element.runtimeStyle.left;element.runtimeStyle.left=element.currentStyle.left;element.style.left=value||0;value=element.style.pixelLeft;element.style.left=styleLeft;element.runtimeStyle.left=runtimeStyleLeft;return value}function _MSIE_getColorValue(element,type){if(element.createTextRange){var range=element.createTextRange()}else{range=element.document.body.createTextRange();range.moveToElementText(element)}try{var color=range.queryCommandValue("type")}catch(e){color=0}return format("rgb(%1, %2, %3)",color&255,(color&65280)>>8,(color&16711680)>>16)}var _CSSStyleDeclaration_ReadOnly=Binding.extend({getPropertyValue:function(style,propertyName){return this.base(style,_CSSPropertyNameMap[propertyName]||propertyName)},"@MSIE.+win":{getPropertyValue:function(style,propertyName){return propertyName=="float"?style.styleFloat:style[ViewCSS.toCamelCase(propertyName)]}}});var CSSStyleDeclaration=_CSSStyleDeclaration_ReadOnly.extend({setProperty:function(style,propertyName,value,priority){return this.base(style,_CSSPropertyNameMap[propertyName]||propertyName,value,priority)},"@MSIE.+win":{setProperty:function(style,propertyName,value,priority){if(propertyName=="opacity"){value*=100;style.opacity=value;style.zoom=1;style.filter="Alpha(opacity="+value+")"}else{if(priority=="important"){style.cssText+=format(";%1:%2!important;",propertyName,value)}else{style.setAttribute(ViewCSS.toCamelCase(propertyName),value)}}}}},{"@MSIE":{bind:function(style){style.getPropertyValue=this.prototype.getPropertyValue;style.setProperty=this.prototype.setProperty;return style}}});var _CSSPropertyNameMap=new Base({"@Gecko":{opacity:"-moz-opacity"},"@KHTML":{opacity:"-khtml-opacity"}});with(CSSStyleDeclaration.prototype){getPropertyValue.toString=setProperty.toString=K("[base2]")}AbstractView.implement(ViewCSS);var NodeSelector=Interface.extend({"@(element.querySelector)":{querySelector:function(node,selector){try{var element=this.base(node,trim(selector));if(element){return element}}catch(x){}return new Selector(selector).exec(node,1)},querySelectorAll:function(node,selector){try{var nodeList=this.base(node,trim(selector));if(nodeList){return new StaticNodeList(nodeList)}}catch(x){}return new Selector(selector).exec(node)}},"@!(element.querySelector)":{querySelector:function(node,selector){return new Selector(selector).exec(node,1)},querySelectorAll:function(node,selector){return new Selector(selector).exec(node)}}});extend(NodeSelector.prototype,{querySelector:function(selector){return DOM.bind(this.base(selector))},querySelectorAll:function(selector){return extend(this.base(selector),"item",function(index){return DOM.bind(this.base(index))})}});var DocumentSelector=NodeSelector.extend();var ElementSelector=NodeSelector.extend({"@!(element.matchesSelector)":{matchesSelector:function(element,selector){return new Selector(selector).test(element)}}});var _CSS_ESCAPE=/'(\\.|[^'\\])*'|"(\\.|[^"\\])*"/g,_CSS_IMPLIED_ASTERISK=/([\s>+~,]|[^(]\+|^)([#.:\[])/g,_CSS_IMPLIED_SPACE=/(^|,)([^\s>+~])/g,_CSS_WHITESPACE=/\s*([\s>+~,]|^|$)\s*/g,_CSS_WILD_CARD=/\s\*\s/g,_CSS_UNESCAPE=/\x01(\d+)/g,_QUOTE=/'/g;var CSSParser=RegGrp.extend({constructor:function(items){this.base(items);this.cache={};this.sorter=new RegGrp;this.sorter.add(/:not\([^)]*\)/,RegGrp.IGNORE);this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/,"$1$3$6$4")},cache:null,ignoreCase:true,escape:function(selector,simple){var strings=this._strings=[];selector=this.optimise(this.format(String(selector).replace(_CSS_ESCAPE,function(string){return"\x01"+strings.push(string.slice(1,-1).replace(_QUOTE,"\\'"))})));if(simple){selector=selector.replace(/^ \*?/,"")}return selector},format:function(selector){return selector.replace(_CSS_WHITESPACE,"$1").replace(_CSS_IMPLIED_SPACE,"$1 $2").replace(_CSS_IMPLIED_ASTERISK,"$1*$2")},optimise:function(selector){return this.sorter.exec(selector.replace(_CSS_WILD_CARD,">* "))},parse:function(selector,simple){return this.cache[selector]||(this.cache[selector]=this.unescape(this.exec(this.escape(selector,simple))))},unescape:function(selector){var strings=this._strings;return selector.replace(_CSS_UNESCAPE,function(match,index){return strings[index-1]})}});function _nthChild(match,args,position,last,not,and,mod,equals){last=/last/i.test(match)?last+"+1-":"";if(!isNaN(args)){args="0n+"+args}else{if(args=="even"){args="2n"}else{if(args=="odd"){args="2n+1"}}}args=args.split("n");var a=args[0]?(args[0]=="-")?-1:parseInt(args[0]):1;var b=parseInt(args[1])||0;var negate=a<0;if(negate){a=-a;if(a==1){b++}}var query=format(a==0?"%3%7"+(last+b):"(%4%3-%2)%6%1%70%5%4%3>=%2",a,b,position,last,and,mod,equals);if(negate){query=not+"("+query+")"}return query}var XPathParser=CSSParser.extend({constructor:function(){this.base(XPathParser.build());this.sorter.putAt(1,"$1$4$3$6")},escape:function(selector,simple){return this.base(selector,simple).replace(/,/g,"\x02")},unescape:function(selector){return this.base(selector.replace(/\[self::\*\]/g,"").replace(/(^|\x02)\//g,"$1./").replace(/\x02/g," | ")).replace(/'[^'\\]*\\'(\\.|[^'\\])*'/g,function(match){return"concat("+match.split("\\'").join("',\"'\",'")+")"})},"@opera(7|8|9\\.[1-4])":{unescape:function(selector){return this.base(selector.replace(/last\(\)/g,"count(preceding-sibling::*)+count(following-sibling::*)+1"))}}},{build:function(){this.values.attributes[""]="[@$1]";forEach(this.types,function(add,type){forEach(this.values[type],add,this.rules)},this);this.build=K(this.rules);return this.rules},optimised:{pseudoClasses:{"first-child":"[1]","last-child":"[last()]","only-child":"[last()=1]"}},rules:extend({},{"@!KHTML|opera":{"(^|\\x02) (\\*|[\\w-]+)#([\\w-]+)":"$1id('$3')[self::$2]"},"@!KHTML":{"([ >])(\\*|[\\w-]+):([\\w-]+-child(\\(([^)]+)\\))?)":function(match,token,tagName,pseudoClass,$4,args){var replacement=(token==" ")?"//*":"/*";if(/^nth/i.test(pseudoClass)){replacement+=_xpath_nthChild(pseudoClass,args,"position()")}else{replacement+=XPathParser.optimised.pseudoClasses[pseudoClass]}return replacement+"[self::"+tagName+"]"}}}),types:{identifiers:function(replacement,token){this[rescape(token)+"([\\w-]+)"]=replacement},combinators:function(replacement,combinator){this[rescape(combinator)+"(\\*|[\\w-]+)"]=replacement},attributes:function(replacement,operator){this["\\[\\s*([\\w-]+)\\s*"+rescape(operator)+"\\s*([^\\]\\s]*)\\s*\\]"]=replacement},pseudoClasses:function(replacement,pseudoClass){this[":"+pseudoClass.replace(/\(\)$/,"\\(([^)]+)\\)")]=replacement}},values:{identifiers:{"#":"[@id='$1'][1]",".":"[contains(concat(' ',@class,' '),' $1 ')]"},combinators:{" ":"/descendant::$1",">":"/child::$1","+":"/following-sibling::*[1][self::$1]","~":"/following-sibling::$1"},attributes:{"*=":"[contains(@$1,'$2')]","^=":"[starts-with(@$1,'$2')]","$=":"[substring(@$1,string-length(@$1)-string-length('$2')+1)='$2']","~=":"[contains(concat(' ',@$1,' '),' $2 ')]","|=":"[contains(concat('-',@$1,'-'),'-$2-')]","!=":"[not(@$1='$2')]","=":"[@$1='$2']"},pseudoClasses:{"link":"[false]","visited":"[false]","empty":"[not(child::*) and not(text())]","first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","not()":_xpath_not,"nth-child()":_xpath_nthChild,"nth-last-child()":_xpath_nthChild,"only-child":"[not(preceding-sibling::*) and not(following-sibling::*)]","root":"[not(parent::*)]"}},"@opera(7|8|9\\.[1-4])":{build:function(){this.optimised.pseudoClasses["last-child"]=this.values.pseudoClasses["last-child"];this.optimised.pseudoClasses["only-child"]=this.values.pseudoClasses["only-child"];return this.base()}}});var _notParser;function _xpath_not(match,args){if(!_notParser){_notParser=new XPathParser}return"[not("+_notParser.exec(trim(args)).replace(/\[1\]/g,"").replace(/^(\*|[\w-]+)/,"[self::$1]").replace(/\]\[/g," and ").slice(1,-1)+")]"}function _xpath_nthChild(match,args,position){return"["+_nthChild(match,args,position||"count(preceding-sibling::*)+1","last()","not"," and "," mod ","=")+"]"}var Selector=Base.extend({constructor:function(selector){this.toString=K(trim(selector))},exec:function(context,count,simple){return Selector.parse(this,simple)(context,count)},isSimple:function(){if(!_parser.exec){_parser=new CSSParser(_parser)}return !_COMBINATOR.test(trim(_parser.escape(this)))},test:function(element){if(this.isSimple()){return !!Selector.parse(this,true)(element,1)}else{element.setAttribute("b2-test",true);var result=new Selector(this+"[b2-test]").exec(Traversal.getOwnerDocument(element),1);element.removeAttribute("b2-test");return result==element}},toXPath:function(simple){return Selector.toXPath(this,simple)},"@(XPathResult)":{exec:function(context,count,simple){if(_NOT_XPATH.test(this)){return this.base(context,count,simple)}var document=Traversal.getDocument(context);var type=count==1?9:7;var result=document.evaluate(this.toXPath(simple),context,null,type,null);return count==1?result.singleNodeValue:result}},"@MSIE":{exec:function(context,count,simple){if(typeof context.selectNodes!="undefined"&&!_NOT_XPATH.test(this)){var method=single?"selectSingleNode":"selectNodes";return context[method](this.toXPath(simple))}return this.base(context,count,simple)}},"@(true)":{exec:function(context,count,simple){try{var result=this.base(context||document,count,simple)}catch(error){throw new SyntaxError(format("'%1' is not a valid CSS selector.",this))}return count==1?result:new StaticNodeList(result)}}},{toXPath:function(selector,simple){if(!_xpathParser){_xpathParser=new XPathParser}return _xpathParser.parse(selector,simple)}});var _COMBINATOR=/[^,]\s|[+>~]/;var _NOT_XPATH=":(checked|disabled|enabled|contains|hover|active|focus)|^(#[\\w-]+\\s*)?\\w+$";if(detect("KHTML")){if(detect("WebKit5")){_NOT_XPATH+="|nth\\-|,"}else{_NOT_XPATH="."}}_NOT_XPATH=new RegExp(_NOT_XPATH);Selector.operators={"=":"%1=='%2'","~=":/(^| )%1( |$)/,"|=":/^%1(-|$)/,"^=":/^%1/,"$=":/%1$/,"*=":/%1/};Selector.operators[""]="%1!=null";Selector.pseudoClasses={"checked":"e%1.checked","contains":"e%1[TEXT].indexOf('%2')!=-1","disabled":"e%1.disabled","empty":"Traversal.isEmpty(e%1)","enabled":"e%1.disabled===false","first-child":"!Traversal.getPreviousElementSibling(e%1)","last-child":"!Traversal.getNextElementSibling(e%1)","only-child":"!Traversal.getPreviousElementSibling(e%1)&&!Traversal.getNextElementSibling(e%1)","root":"e%1==Traversal.getDocument(e%1).documentElement","target":"e%1.id&&e%1.id==location.hash.slice(1)","hover":"DocumentState.getInstance(d).isHover(e%1)","active":"DocumentState.getInstance(d).isActive(e%1)","focus":"DocumentState.getInstance(d).hasFocus(e%1)","link":"false","visited":"false"};var _INDEXED=document.documentElement.sourceIndex!==undefined,_VAR="var p%2=0,i%2,e%3,n%2=e%1.",_ID=_INDEXED?"e%1.sourceIndex":"assignID(e%1)",_TEST="var g="+_ID+";if(!p[g]){p[g]=1;",_STORE="r[k++]=e%1;if(s==1)return e%1;if(k===s){_query.state=[%2];_query.complete=%3;return r;",_FN="var _query=function(e0,s%1){_indexed++;var r=[],p={},p0=0,reg=[%4],d=Traversal.getDocument(e0),c=d.writeln?'toUpperCase':'toString',k=0;";var _xpathParser;var _reg,_index,_wild,_list,_group,_listAll,_duplicate,_cache={},_simple={};function sum(list){var total=0;for(var i=0;i(\\*|[\\w-]+)":function(match,tagName){var children=_MSIE&&_index;_wild=tagName=="*";var replacement=_VAR+(children?"children":"childNodes");replacement=format(replacement,_index++,"%2",_index);if(!_wild&&_MSIE&&children){replacement+=".tags('%3')"}replacement+=";for(i%2=a%2||0;(e%1=n%2[i%2]);i%2++){";if(_wild){replacement+="if(e%1.nodeType==1){";_wild=_MSIE5}else{if(!_MSIE||!children){replacement+="if(e%1.nodeName=='%3'[c]()){"}}_list[_group]++;return format(replacement,_index,sum(_list),tagName)},"\\+(\\*|[\\w-]+)":function(match,tagName){var replacement="";if(_wild&&_MSIE){replacement+="if(e%1.nodeName!='!'){"}_wild=false;replacement+="e%1=Traversal.getNextElementSibling(e%1);if(e%1";if(tagName!="*"){replacement+="&&e%1.nodeName=='%2'[c]()"}replacement+="){";return format(replacement,_index,tagName)},"~(\\*|[\\w-]+)":function(match,tagName){var replacement="";if(_wild&&_MSIE){replacement+="if(e%1.nodeName!='!'){"}_wild=false;_duplicate=2;replacement+="while(e%1=e%1.nextSibling){if(e%1.b2_adjacent==_indexed)break;if(";if(tagName=="*"){replacement+="e%1.nodeType==1";if(_MSIE5){replacement+="&&e%1.nodeName!='!'"}}else{replacement+="e%1.nodeName=='%2'[c]()"}replacement+="){e%1.b2_adjacent=_indexed;";return format(replacement,_index,tagName)},"#([\\w-]+)":function(match,id){_wild=false;var replacement="if(e%1.id=='%2'){";if(_list[_group]){replacement+=format("i%1=n%1.length;",sum(_list))}return format(replacement,_index,id)},"\\.([\\w-]+)":function(match,className){_wild=false;_reg.push(new RegExp("(^|\\s)"+rescape(className)+"(\\s|$)"));return format("if(e%1.className&®[%2].test(e%1.className)){",_index,_reg.length-1)},":not\\((\\*|[\\w-]+)?([^)]*)\\)":function(match,tagName,filters){var replacement=(tagName&&tagName!="*")?format("if(e%1.nodeName=='%2'[c]()){",_index,tagName):"";replacement+=_parser.exec(filters);return"if(!"+replacement.slice(2,-1).replace(/\)\{if\(/g,"&&")+"){"},":nth(-last)?-child\\(([^)]+)\\)":function(match,last,args){_wild=false;last=format("e%1.parentNode.b2_length",_index);var replacement="if(p%1!==e%1.parentNode)p%1=_register(e%1.parentNode);";replacement+="var i=e%1[p%1.b2_lookup];if(p%1.b2_lookup!='b2_index')i++;if(";return format(replacement,_index)+_nthChild(match,args,"i",last,"!","&&","% ","==")+"){"},":([\\w-]+)(\\(([^)]+)\\))?":function(match,pseudoClass,$2,args){return"if("+format(Selector.pseudoClasses[pseudoClass]||"throw",_index,args||"")+"){"},"\\[\\s*([\\w-]+)\\s*([^=]?=)?\\s*([^\\]\\s]*)\\s*\\]":function(match,attr,operator,value){value=trim(value);if(_MSIE){var getAttribute="Element.getAttribute(e%1,'%2')"}else{getAttribute="e%1.getAttribute('%2')"}getAttribute=format(getAttribute,_index,attr);var replacement=Selector.operators[operator||""];if(instanceOf(replacement,RegExp)){_reg.push(new RegExp(format(replacement.source,rescape(_parser.unescape(value)))));replacement="reg[%2].test(%1)";value=_reg.length-1}return"if("+format(replacement,getAttribute,value)+"){"}};(function(_no_shrink_){var _byId=detect("MSIE[5-7]")?function(document,id){var result=document.all[id]||null;if(!result||result.id==id){return result}for(var i=0;i1?2:0;var block=_parser.exec(selectors[_group])||"throw;";if(_wild&&_MSIE){block+=format("if(e%1.tagName!='!'){",_index)}var store=(_duplicate>1)?_TEST:"";block+=format(store+_STORE,_index,"%2");block+=Array(match(block,/\{/g).length+1).join("}");fn+=block}fn=_parser.unescape(fn);if(selectors.length>1){fn+="r.unsorted=1;"}var args="";var state=[];var total=sum(_list);for(var i=1;i<=total;i++){args+=",a"+i;state.push("i"+i+"?(i"+i+"-1):0")}if(total){var complete=[],k=0;for(var i=0;i<_group;i++){k+=_list[i];if(_list[i]){complete.push(format("n%1&&i%1==n%1.length",k))}}}fn+="_query.state=[%2];_query.complete=%3;return s==1?null:r}";eval(format(_FN+fn,args,state.join(","),total?complete.join("&&"):true,_reg));cache[selector]=_query}return cache[selector]}})();var StaticNodeList=Base.extend({constructor:function(nodes){nodes=nodes||[];this.length=nodes.length;this.item=function(index){if(index<0){index+=this.length}return nodes[index]};if(nodes.unsorted){nodes.sort(_SORTER)}},length:0,forEach:function(block,context){for(var i=0;i0&&document.defaultView.getComputedStyle(B,"").getPropertyValue("position")=="absolute"){return C}}catch(A){}C+=B.offsetLeft;B=B.offsetParent}if(!window.opera&&document.all&&document.compatMode&&document.compatMode!="BackCompat"){C+=parseInt(document.body.currentStyle.marginTop)}return C};wFORMS.helpers.getTop=function(B){var C=0;while(B.offsetParent){try{if(document.defaultView.getComputedStyle(B,"").getPropertyValue("position")=="relative"){return C}if(C>0&&document.defaultView.getComputedStyle(B,"").getPropertyValue("position")=="absolute"){return C}}catch(A){}C+=B.offsetTop;B=B.offsetParent}if(!window.opera&&document.all&&document.compatMode&&document.compatMode!="BackCompat"){C+=parseInt(document.body.currentStyle.marginLeft)+1}return C};wFORMS.helpers.position=function(B){var A=B.offsetLeft;var D=B.offsetTop;if(B.offsetParent){var C=this.position(B.offsetParent);A+=C.left;D+=C.top}return{left:A,top:D}};wFORMS.helpers.useSpotlight=false;wFORMS.helpers.spotlight=function(A){};wFORMS.helpers.activateStylesheet=function(C){if(document.getElementsByTagName){var B=document.getElementsByTagName("link")}else{if(document.styleSheets){var B=document.styleSheets}}for(var A=0;B[A];A++){if(B[A].href.indexOf(C)!=-1){B[A].rel="stylesheet";B[A].title="";B[A].disabled=true;B[A].disabled=false}}};wFORMS.helpers.contains=function(D,C){var A=D.length;for(var B=0;B= 5.8)!@end @*/true;if(doBind){base2.DOM.bind(f)}if(wFORMS.behaviors["switch"]){var b=wFORMS.behaviors["switch"].applyTo(f);if(!wFORMS.instances["switch"]){wFORMS.instances["switch"]=[b]}else{wFORMS.removeBehavior(f,"switch");wFORMS.instances["switch"].push(b)}}for(var behaviorName in wFORMS.behaviors){if(behaviorName=="switch"){continue}if(wFORMS.behaviors[behaviorName].applyTo){var b=wFORMS.behaviors[behaviorName].applyTo(f);if(b&&b.constructor!=Array){b=[b]}for(var i=0;b&&i<\/script>"); var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { wFORMS.onLoadHandler(); // call the onload handler } }; @end @*/if(!loadIE){base2.DOM.Element.addEventListener(document,"DOMContentLoaded",wFORMS.onLoadHandler,false)}wFORMS.helpers.activateStylesheet("wforms-jsonly.css");if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.hint={CSS_INACTIVE:"field-hint-inactive",CSS_ACTIVE:"field-hint",HINT_SELECTOR:'*[id$="-H"]',HINT_SUFFIX:"-H",instance:function(A){this.behavior=wFORMS.behaviors.hint;this.target=A}};wFORMS.behaviors.hint.applyTo=function(C){var A=new wFORMS.behaviors.hint.instance(C);if(!C.querySelectorAll){base2.DOM.bind(C)}var B=C.querySelectorAll(wFORMS.behaviors.hint.HINT_SELECTOR);if(!B.forEach){B.forEach=NodeList.prototype.forEach}B.forEach(function(D){var E=A.getElementByHintId(D.id);if(E){if(!E.addEventListener){base2.DOM.bind(E)}if(E.tagName=="SELECT"||E.tagName=="TEXTAREA"||(E.tagName=="INPUT"&&E.type!="radio"&&E.type!="checkbox")){E.addEventListener("focus",function(F){A.run(F,this)},false);E.addEventListener("blur",function(F){A.run(F,this)},false)}else{E.addEventListener("mouseover",function(F){A.run(F,E)},false);E.addEventListener("mouseout",function(F){A.run(F,E)},false)}}});A.onApply();return A};wFORMS.behaviors.hint.instance.prototype.onApply=function(){};wFORMS.behaviors.hint.instance.prototype.run=function(B,A){var C=this.getHintElement(A);if(!C){return }if(!C.removeClass){base2.DOM.bind(C)}if(B.type=="focus"||B.type=="mouseover"){C.removeClass(wFORMS.behaviors.hint.CSS_INACTIVE);C.addClass(wFORMS.behaviors.hint.CSS_ACTIVE);if(!wFORMS.helpers.getForm(A).hasClass("hintsSide")){this.setup(C,A)}}else{C.addClass(wFORMS.behaviors.hint.CSS_INACTIVE);C.removeClass(wFORMS.behaviors.hint.CSS_ACTIVE)}};wFORMS.behaviors.hint.instance.prototype.getElementByHintId=function(C){var B=C.substr(0,C.length-wFORMS.behaviors.hint.HINT_SUFFIX.length);var A=document.getElementById(B);return A};wFORMS.behaviors.hint.instance.prototype.getHintElement=function(A){var B=document.getElementById(A.id+this.behavior.HINT_SUFFIX);if(B&&!B.hasClass){base2.DOM.bind(B)}return B&&B!=""?B:null};wFORMS.behaviors.hint.instance.prototype.setup=function(E,D){var A=wFORMS.helpers.position(D);var B=wFORMS.helpers.position(E);var C={left:A.left-B.left,top:A.top-B.top};if(D.tagName.toLowerCase()=="select"){E.style.left=E.offsetLeft+C.left+D.offsetWidth+"px";E.style.top=E.offsetTop+C.top+"px"}else{E.style.left=E.offsetLeft+C.left+"px";E.style.top=E.offsetTop+C.top+D.offsetHeight+"px"}};wFORMS.behaviors.hint.isHintId=function(A){return A.match(new RegExp(wFORMS.behaviors.hint.HINT_SUFFIX+"$"))!=null};if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.paging={SELECTOR:".wfPage",CSS_PAGE:"wfPage",CSS_CURRENT_PAGE:"wfCurrentPage",CSS_BUTTON_NEXT:"wfPageNextButton",CSS_BUTTON_PREVIOUS:"wfPagePreviousButton",CSS_BUTTON_PLACEHOLDER:"wfPagingButtons",CSS_PAGETAB:"wfPageTab",CSS_TABS:"wfTab",CSS_TABSID:"wfTabNav",CSS_TABNAVLABEL:"wfTabNavLabel",CSS_TABSCURRENT:"wfTabCurrentPage",CSS_TABSEPARATOR_SPAN:"wfTabSep",CSS_TABSEPARATOR:" | ",ID_BUTTON_NEXT_PREFIX:"wfPageNextId",ID_BUTTON_PREVIOUS_PREFIX:"wfPagePreviousId",CSS_SUBMIT_HIDDEN:"wfHideSubmit",ID_PAGE_PREFIX:"wfPgIndex-",ID_PLACEHOLDER_SUFFIX:"-buttons",ATTR_INDEX:"wfPageIndex_activate",CAPTCHA_ERROR:"#tfa_captcha_text-E",MESSAGES:{CAPTION_NEXT:"Next Page",CAPTION_PREVIOUS:"Previous Page",CAPTION_UNLOAD:"Any data entered on ANY PAGE of this form will be LOST.",NAV_LABEL:"Page: ",TAB_LABEL:"Page "},showTabNavigation:false,runValidationOnPageNext:true,warnOnUnload:true,onPageNext:function(){},onPagePrevious:function(){},onPageChange:function(){},instance:function(A){this.behavior=wFORMS.behaviors.paging;this.target=A;this.currentPageIndex=1}};wFORMS.behaviors.paging.applyTo=function(G){var A=null;var E=wFORMS.behaviors.paging;if(E.showTabNavigation){}var C=(wFORMS.behaviors.validation&&wFORMS.behaviors.paging.runValidationOnPageNext);base2.DOM.Element.querySelectorAll(G,wFORMS.behaviors.paging.SELECTOR).forEach(function(L){if(!A){A=new wFORMS.behaviors.paging.instance(G)}var N=A.getOrCreatePlaceHolder(L);var H=wFORMS.behaviors.paging.getPageIndex(L);if(H==1){var M=base2.DOM.bind(N.appendChild(E._createNextPageButton(H)));if(C){M.addEventListener("click",function(P){var O=wFORMS.getBehaviorInstance(A.target,"validation");if(O.run(P,L)){A.run(P,M)}},false)}else{M.addEventListener("click",function(O){A.run(O,M)},false)}wFORMS.behaviors.paging.showPage(L)}else{var M=base2.DOM.bind(E._createPreviousPageButton(H));N.insertBefore(M,N.firstChild);M.addEventListener("click",function(O){A.run(O,M)},false);if(!wFORMS.behaviors.paging.isLastPageIndex(H,true)){var J=base2.DOM.bind(N.appendChild(E._createNextPageButton(H)));if(C){J.addEventListener("click",function(P){var O=wFORMS.getBehaviorInstance(A.target,"validation");if(O.run(P,L)){A.run(P,J)}},false)}else{J.addEventListener("click",function(O){A.run(O,J)},false)}}}});if(A){p=A.findNextPage(0);A.currentPageIndex=0;A.activatePage(wFORMS.behaviors.paging.getPageIndex(p),false);if(!window.onbeforeunload){window.onbeforeunload=function(){if(A.behavior.warnOnUnload){return A.behavior.MESSAGES.CAPTION_UNLOAD}}}if(A.behavior.showTabNavigation){A.generateTabs()}var B=base2.DOM.Element.querySelector(document,wFORMS.behaviors.paging.CAPTCHA_ERROR);if(B){var F=1;for(var D=1;D<100;D++){if(A.behavior.isLastPageIndex(D)){F=D;break}}A.jumpTo(F)}A.onApply();base2.DOM.Element.addEventListener(G,"submit",function(H){A.onSubmit(H,A)})}return A};wFORMS.behaviors.paging.instance.prototype.onApply=function(){};wFORMS.behaviors.paging.instance.prototype.onSubmit=function(E,A){if(!wFORMS.behaviors.paging.isLastPageIndex(A.currentPageIndex)&&wFORMS.behaviors.paging.runValidationOnPageNext){var D=wFORMS.behaviors.paging.getPageByIndex(A.currentPageIndex);var B=A.findNextPage(A.currentPageIndex);var C=wFORMS.getBehaviorInstance(A.target,"validation");if(C.run(E,D)){A.activatePage(A.currentPageIndex+1);var F=base2.DOM.Element.querySelector(B,"input, textarea, select");if(F){F.focus()}}E.stopPropagation();E.preventDefault();E.pagingStopPropagation=true}else{if(window.onbeforeunload){window.onbeforeunload=null}}};wFORMS.behaviors.paging.instance.prototype.onPageNext=function(A){this.behavior.onPageNext(A)};wFORMS.behaviors.paging.instance.prototype.onPagePrevious=function(A){this.behavior.onPagePrevious(A)};wFORMS.behaviors.paging.instance.prototype.onPageChange=function(A){this.behavior.onPageChange(A)};wFORMS.behaviors.paging.getPageIndex=function(B){if(B&&B.id){var A=B.id.replace(new RegExp(wFORMS.behaviors.paging.ID_PAGE_PREFIX+"(\\d+)"),"$1");A=parseInt(A);return !isNaN(A)?A:false}return false};wFORMS.behaviors.paging.isElementVisible=function(A){while(A&&A.tagName!="BODY"){if(A.className){if(A.className.indexOf(this.CSS_CURRENT_PAGE)!=-1){return true}if(A.className.indexOf(this.CSS_PAGE)!=-1){return false}}A=A.parentNode}return true};wFORMS.behaviors.paging._createNextPageButton=function(A){var B=this.createNextPageButton();B.setAttribute(this.ATTR_INDEX,A+1);B.id=this.ID_BUTTON_NEXT_PREFIX+A;return B};wFORMS.behaviors.paging.createNextPageButton=function(){var A=document.createElement("input");A.setAttribute("value",this.MESSAGES.CAPTION_NEXT);A.type="button";A.className=this.CSS_BUTTON_NEXT;return A};wFORMS.behaviors.paging._createPreviousPageButton=function(A){var B=this.createPreviousPageButton();B.setAttribute(this.ATTR_INDEX,A-1);B.id=this.ID_BUTTON_PREVIOUS_PREFIX+A;return B};wFORMS.behaviors.paging.createPreviousPageButton=function(){var A=document.createElement("input");A.setAttribute("value",this.MESSAGES.CAPTION_PREVIOUS);A.type="button";A.className=this.CSS_BUTTON_PREVIOUS;return A};wFORMS.behaviors.paging.instance.prototype.getOrCreatePlaceHolder=function(A){var C=A.id+this.behavior.ID_PLACEHOLDER_SUFFIX;var B=document.getElementById(C);if(!B){B=A.appendChild(document.createElement("div"));B.id=C;B.className=this.behavior.CSS_BUTTON_PLACEHOLDER}return B};wFORMS.behaviors.paging.hidePage=function(A){if(A){if(!A.removeClass){A.removeClass=function(B){return base2.DOM.HTMLElement.removeClass(this,B)}}if(!A.addClass){A.addClass=function(B){return base2.DOM.HTMLElement.addClass(this,B)}}A.removeClass(wFORMS.behaviors.paging.CSS_CURRENT_PAGE);A.addClass(wFORMS.behaviors.paging.CSS_PAGE)}};wFORMS.behaviors.paging.showPage=function(A){if(A){if(!A.removeClass){A.removeClass=function(B){return base2.DOM.HTMLElement.removeClass(this,B)}}A.removeClass(wFORMS.behaviors.paging.CSS_PAGE);if(!A.addClass){A.addClass=function(B){return base2.DOM.HTMLElement.addClass(this,B)}}A.addClass(wFORMS.behaviors.paging.CSS_CURRENT_PAGE)}};wFORMS.behaviors.paging.instance.prototype.activatePage=function(B){if(arguments.length>1){var E=arguments[1]}else{var E=true}if(B==this.currentPageIndex){return false}B=parseInt(B);if(B>this.currentPageIndex){var C=this.findNextPage(this.currentPageIndex)}else{var C=this.findPreviousPage(this.currentPageIndex)}if(C){var A=this;var B=A.behavior.getPageIndex(C);A.setupManagedControls(B);A.behavior.hidePage(A.behavior.getPageByIndex(A.currentPageIndex));A.behavior.showPage(C);var D=A.currentPageIndex;A.currentPageIndex=B;if(E){if(C.scrollIntoView){C.scrollIntoView()}else{location.hash="#"+wFORMS.behaviors.paging.ID_PAGE_PREFIX+B}}A.labelCurrentPageTab(C);A.onPageChange(C);if(B>D){A.onPageNext(C)}else{A.onPagePrevious(C)}}};wFORMS.behaviors.paging.instance.prototype.setupManagedControls=function(B){if(!B){B=this.currentPageIndex}var A=wFORMS.behaviors.paging;if(A.isFirstPageIndex(B)){if(ctrl=A.getPreviousButton(B)){ctrl.style.visibility="hidden"}}else{if(ctrl=A.getPreviousButton(B)){ctrl.style.visibility="visible"}}if(A.isLastPageIndex(B)){if(ctrl=A.getNextButton(B)){ctrl.style.visibility="hidden"}this.showSubmitButtons()}else{if(ctrl=A.getNextButton(B)){ctrl.style.visibility="visible"}this.hideSubmitButtons()}};wFORMS.behaviors.paging.instance.prototype.showSubmitButtons=function(){var A=this.target.getElementsByTagName("input");for(var B=0;B=A){document.getElementById(F).style.display="none"}}this.behavior.onRepeat(C);wFORMS.helpers.spotlight(C)};_i.prototype.removeSection=function(C){if(C){var B=this.behavior.getMasterSection(C);this.logRemovedSection(C);var C=C.parentNode.removeChild(C);this.callRemoveCompleteObservers(C);this.counterRepeatedFields--;var A=C.getAttribute("data-repeatlimit");var D=B.id+this.behavior.ID_SUFFIX_DUPLICATE_LINK;if(A!=null){if(this.counterRepeatedFields<=A){document.getElementById(D).style.display=""}}this.behavior.onRemove(C)}};_i.prototype.logRemovedSection=function(C){if(!C||!C.id){return }var F=C.id;var B=this.behavior.getMasterSection(C);var D=this.getOrCreateCounterField(B);if(D){var A=D.value.split("|");var E=[];if(A[1]){E=A[1].split(",")}A=A[0];E.push(F);D.value=A+"|"+E.join(",")}};_i.prototype.getInsertNode=function(B){var A=B.nextSibling;if(A&&A.nodeType==1&&!A.hasClass){A.hasClass=function(C){return base2.DOM.HTMLElement.hasClass(this,C)}}while(A&&(A.nodeType!=1||A.hasClass(this.behavior.CSS_REMOVEABLE))){A=A.nextSibling;if(A&&A.nodeType==1&&!A.hasClass){A.hasClass=function(C){return base2.DOM.HTMLElement.hasClass(this,C)}}}return A};_i.prototype.onRemoveLinkClick=function(B,A){var C=document.getElementById(A.getAttribute(this.behavior.ATTR_LINK_SECTION_ID));this.removeSection(C);if(B){B.preventDefault()}};_i.prototype.updateMasterSection=function(A){if(A.doItOnce==true){return true}else{A.doItOnce=true}var C=A.id;var B=this.createSuffix(A);A.id=this.clearSuffix(A.id)+B;if(A.id!=C){this.callMasterIdChangeObservers(C,A.id)}this.updateMasterElements(A,B)};_i.prototype.updateMasterElements=function(C,L){if(!C||C.nodeType!=1){return }var H=C.childNodes;for(var F=0;F';var fixedRadio=e.parentNode.insertBefore(document.createElement(tagHtml),e);fixedRadio.id=e.id;fixedRadio.className=e.className;fixedRadio.value=e.value;e=e.parentNode.removeChild(e);var l=this.behavior.UPDATEABLE_ATTR_ARRAY.length;for(var j=0;j0?"|"+E.join(","):"");return D};_i.prototype.getOrCreateCounterField=function(C){var A=C.id+this.behavior.ID_SUFFIX_COUNTER;var B=document.getElementById(A);if(!B||B==""){B=this.createCounterField(A);var D=C.parentNode;while(D&&D.tagName.toUpperCase()!="FORM"){D=D.parentNode}D.appendChild(B)}return B};_i.prototype.createCounterField=function(A){cElem=document.createElement("input");cElem.id=A;cElem.setAttribute("type","hidden");cElem.setAttribute("name",A);cElem.value="0";return cElem};_i.prototype.getSectionsCount=function(){if(this.behavior.isDuplicate(this.target)){return false}return parseInt(this.getOrCreateCounterField(this.target).value.split("|")[0])+1};_i.prototype.setInDuplicateGroup=function(A){return A.setAttribute(this.behavior.ATTR_DUPLICATE_ELEM,true)};_i.prototype.setElementHandled=function(A){return A.setAttribute(this.behavior.ATTR_HANDLED,true)};_i.prototype.removeHandled=function(A){return A.removeAttribute(this.behavior.ATTR_HANDLED)};_b.isDuplicate=function(A){if(!A.hasClass){A.hasClass=function(B){return base2.DOM.HTMLElement.hasClass(this,B)}}return A.hasClass(this.CSS_REMOVEABLE)};_b.isMaster=function(A){if(!A.hasClass){A.hasClass=function(B){return base2.DOM.HTMLElement.hasClass(this,B)}}return A.hasClass(this.CSS_REPEATABLE)};_b.isInDuplicateGroup=function(A){return A.getAttribute(this.ATTR_DUPLICATE_ELEM)?true:false};_b.getRepeatedElement=function(A){while(A&&A.nodeType==1&&A.tagName!="BODY"){if(base2.DOM.HTMLElement.hasClass(A,this.CSS_REMOVEABLE)||base2.DOM.HTMLElement.hasClass(A,this.CSS_REPEATABLE)){return A}A=A.parentNode}return null};_b.isHandled=function(A){return A.getAttribute(this.ATTR_HANDLED)};_b.getMasterSection=function(A){if(!this.isDuplicate(A)){return false}if(A[this.ATTR_MASTER_SECTION]){return document.getElementById(A[this.ATTR_MASTER_SECTION])}else{A=A.previousSibling;while(A&&(A.nodeType!=1||!this.isMaster(A))){A=A.previousSibling}return A}};_b.observeMasterIdChange=function(A){this.stopObservingMasterIdChange(A);this._callbacks.onMasterIdChange.push(A)};_b.stopObservingMasterIdChange=function(B){for(var A=0;A1){return" ("+components.join(this.operator)+") "}return components[0]}});var COMPONENT_PATTERN=new RegExp(" ?"+DELIMITER+"([^"+DELIMITER+"]+)"+DELIMITER+" ?","g");var COMPOUND_COMPONENT_PATTERN=new RegExp("((AND)|(OR))\\s*"+DELIMITER+"([^"+DELIMITER+"]+)"+DELIMITER,"g");var BRACKETED_SINGLE_TRIGGER_PATTERN=new RegExp("\\(\\s*"+DELIMITER+"([^"+DELIMITER+"]+)"+DELIMITER+"\\s*\\)","g");function _getActiveTriggers(instance){var triggers=instance.getTriggers();return filter(triggers,function(trigger){return trigger.getTriggerElement()!==null})}function _mergeImplicitRules(){var rule=this.getConditionRuleString();var replaceRule=false;var domElement=this.getConditionalElement();var parentElement=domElement.parentNode;while(parentElement&&parentElement.nodeType==1){var parentRule=parentElement.getAttribute(CONDITIONAL_ATTRIBUTE_NAME);if(parentRule&&rule.indexOf(parentRule)===-1){rule="("+rule+") AND ("+parentRule+")";replaceRule=true}parentElement=parentElement.parentNode}if(replaceRule){this.unlinkTriggers();domElement.setAttribute(CONDITIONAL_ATTRIBUTE_NAME,rule);this.linkTriggers()}}extend(Conditional.prototype,{getConditionRuleString:function(){var domElement=this.getConditionalElement();if(!domElement){return null}return domElement.getAttribute(CONDITIONAL_ATTRIBUTE_NAME)},getTriggers:function(){var conditionRuleString=this.getConditionRuleString();if(!conditionRuleString){return null}var triggerIdentifiers=[],match;COMPONENT_PATTERN.lastIndex=0;while(match=COMPONENT_PATTERN.exec(conditionRuleString)){triggerIdentifiers.push(match[1])}return map(triggerIdentifiers,function(identifier){var e;try{return new Trigger(identifier)}catch(e){return null}})},getConditionalElement:function(){try{return base2.DOM.Element.querySelector(this.referenceDOMTree,this._conditionalDomIdentifier)}catch(e){return null}},getIdentifier:function(){return this._conditionalDomIdentifier},equals:function(conditional){if(this.getIdentifier()===conditional.getIdentifier()){return true}var domElementOne=this.getConditionalElement();var domElementAnother=conditional.getConditionalElement();if(!domElementAnother||!domElementOne){return false}return domElementAnother===domElementOne},linkTriggers:function(){map(_getActiveTriggers(this),function(conditional){return function(trigger){trigger.addConditional(conditional)}}(this))},unlinkTriggers:function(){map(_getActiveTriggers(this),function(conditional){return function(trigger){trigger.removeConditional(conditional)}}(this))},refresh:function(){if(this.isConditionMet()){this.show()}else{this.hide()}var b=wFORMS.getBehaviorInstance(wFORMS.helpers.getForm(this.getConditionalElement()),"paging");if(b){b.setupManagedControls()}},isConditionMet:function(){_mergeImplicitRules.call(this);var conditionRuleString=this.getConditionRuleString();if(!conditionRuleString){throw new Error("The inferred DOM element doesn't have a rule string")}COMPONENT_PATTERN.lastIndex=0;var rawBooleanExpression=conditionRuleString.replace(COMPONENT_PATTERN,function($,$sub){var trigger=new Trigger($sub);return trigger.getValue()?"true":"false"});var booleanExpression=rawBooleanExpression.replace(/AND/g," && ").replace(/OR/g," || ").replace(/NOT/g," ! ");return eval(booleanExpression)},show:function(){var n=this.getConditionalElement();var id=n.id;if(n.tagName=="INPUT"||n.tagName=="SELECT"||n.tagName=="TEXTAREA"||base2.DOM.HTMLElement.hasClass(n,"choices")){var p=n.parentNode;while(p&&p.nodeType==1&&!base2.DOM.HTMLElement.hasClass(p,"oneField")){p=p.parentNode}if(p&&p.nodeType==1&&base2.DOM.HTMLElement.hasClass(p,"oneField")){n=p}else{if(n.tagName=="INPUT"){if(n._wforms_disabled){n.disabled=false}if(n.getAttribute(TRIGGER_CONDITIONALS)){(new Trigger(n)).trigger()}this.flagCalculationForUpdate(n)}}}else{if(base2.DOM.HTMLElement.hasClass(n,"pageSection")){n=n.parentNode}}var self=this;var _traverse=function(element){switch(element.tagName){case"INPUT":if(element._wforms_disabled){element.disabled=false}if(element.getAttribute(TRIGGER_CONDITIONALS)){(new Trigger(element)).trigger()}self.flagCalculationForUpdate(element);break;case"TEXTAREA":if(element._wforms_disabled){element.disabled=false}self.flagCalculationForUpdate(element);break;case"SELECT":if(element._wforms_disabled){element.disabled=false}var opts=element.getElementsByTagName("OPTION");for(var j=0;j1}function _isLeaf(node){if(typeof node==="string"||isHTMLElement(node)){return true}var notTerminalProperties=filter(node||{},function(value,key){return inArray(["NOT","AND","OR"],(key||"").toUpperCase())});return !notTerminalProperties||notTerminalProperties.length===0}function _expandGroup(node){return filter(map(node,function(value,key){var obj={};obj[(key||"").toUpperCase()]=value;return obj}),function(entry){var keys=map(entry,function(value,key){return key});return inArray(["NOT","AND","OR"],keys[0])})}function _unpackObject(object){var transformed={};map(object,function(value,key){transformed.name=key;transformed.value=value});return transformed}function recursive(node){node=node||{};if(_isLeaf(node)){return transform(node)}if(_isObjectDescribingGroup(node)){return new PolishExpression("AND",map(_expandGroup(node),recursive))}var nonTerminal=_unpackObject(node);var value=nonTerminal.value;if(!(value instanceof Array)){value=[value]}var children=[];map(value,function(element){var result=recursive(element);if(result instanceof Array){children=children.concat(result)}else{children.push(result)}});return new PolishExpression(nonTerminal.name,children)}var result=recursive(relationshipObject);return(result&&result.toStringy())||null}})})();var Trigger=(function(){function Trigger(domElement,referenceDOMTree){var identifier=domElement;if(typeof domElement!=="string"){identifier="#"+getOrAssignID(domElement)}this._triggerElementIdentifier=_escapeQuerySelector(identifier);this.referenceDOMTree=referenceDOMTree||document}function _retrieveConditionals(instance){var triggerDOMElement=instance.getTriggerElement();if(!triggerDOMElement){return[]}var conditionalsDef=triggerDOMElement.getAttribute(TRIGGER_CONDITIONALS);if(!conditionalsDef){return[]}return map(conditionalsDef.split(","),function(conditionalSelector){var e;try{return new Conditional(trim(conditionalSelector))}catch(e){return null}})}function _conditionalToPattern(conditionals){return map(conditionals,function(conditonal){return conditonal.getIdentifier()}).join(",")}function _storeConditionalsToPatternAttribute(instance,conditionals){conditionals=filter(conditionals,function(conditional){return conditional instanceof Conditional});if(!conditionals){return null}var domElement=instance.getTriggerElement();if(!isHTMLElement(domElement)){throw new Error("Cannot store Conditionals to this Trigger object. The inferred DOM object doesn't exist")}var pattern=_conditionalToPattern(conditionals);domElement.setAttribute(TRIGGER_CONDITIONALS,pattern);return pattern}extend(Trigger.prototype,{attachedConditionals:[],_getConditionalsPattern:function(){return _conditionalToPattern(this.getConditionals())},setEventListener:function(){var n=this.getTriggerElement();if(n&&n.tagName=="OPTION"){while(n&&n.tagName!="SELECT"){n=n.parentNode}}if(!n||n.__wforms_event_handled){return }if(n.tagName=="INPUT"&&n.getAttribute("type")=="radio"){var radioButtons=n.form[n.getAttribute("name")];if(!radioButtons.length){radioButtons=[radioButtons]}for(var i=0;i0){return true}for(var i=0,l=triggerElement.options.length;i0){return true}}return false}}}}return false},getConditionals:function(){return _retrieveConditionals(this)},replaceConditionals:function(conditionals){return _storeConditionalsToPatternAttribute(this,conditionals)},addConditional:function(conditional){var existingConditionals=this.getConditionals();var duplicatedEntries=filter(existingConditionals,function(_conditional){return _conditional.equals(conditional)});if(duplicatedEntries.length!==0){return null}existingConditionals.push(conditional);return _storeConditionalsToPatternAttribute(this,existingConditionals)},removeConditional:function(conditional){var existingConditionals=this.getConditionals();var unduplicatedEntries=filter(existingConditionals,function(_conditional,index){return !_conditional.equals(conditional)});return _storeConditionalsToPatternAttribute(this,unduplicatedEntries)},trigger:function(){var element=this.getTriggerElement();if(wFORMS.behaviors.condition._triggerChain&&(element.id in wFORMS.behaviors.condition._triggerChain)){return }else{wFORMS.behaviors.condition._triggerChain[element.id]=true;var activeConditionals=filter(this.getConditionals(),function(conditional){return conditional&&conditional.getConditionalElement()});map(activeConditionals,function(conditional){conditional.refresh()})}},isValid:function(){var triggerDOMElement;return(triggerDOMElement=this.getTriggerElement())&&triggerDOMElement.getAttribute(TRIGGER_CONDITIONALS)}});return Trigger})();var EventHandlers={onChange:function(event){var target=event.target;if(!target){return }wFORMS.behaviors.condition.resetTriggerExecutionChain();if(target.tagName==="SELECT"){for(var i=0;i0){if(wFORMS.behaviors.repeat){wFORMS.behaviors.repeat.observeRepeatComplete(EventHandlers.onRepeatableDuplicated);wFORMS.behaviors.repeat.observeRemoveComplete(EventHandlers.onRepeatableRemoved)}}},getConditional:function(domElement){return new Conditional(domElement)},getTrigger:function(domElement){return new Trigger(domElement)},Conditional:Conditional,Trigger:Trigger,mockup:function(){},isInitialized:function(){return initialized},hasOffState:function(n){return base2.DOM.HTMLElement.hasClass(n,"offstate")},resetTriggerExecutionChain:function(){wFORMS.behaviors.condition._triggerChain={};wFORMS.behaviors.condition._dirtyCalculations={}},updateCalculations:function(){for(var id in wFORMS.behaviors.condition._dirtyCalculations){var element=wFORMS.behaviors.condition._dirtyCalculations[id];if(!wFORMS.behaviors.condition.calculationInstance){wFORMS.behaviors.condition.calculationInstance=wFORMS.getBehaviorInstance(wFORMS.helpers.getForm(element),"calculation")}wFORMS.behaviors.condition.calculationInstance.refresh(null,element)}wFORMS.behaviors.condition._dirtyCalculations={}}}})();if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.validation={skip:false,ERROR_PLACEHOLDER_SUFFIX:"-E",LOWER_BOUND_ATTRIBUTE:"min",UPPER_BOUND_ATTRIBUTE:"max",rules:{oneRequired:{selector:".required-one",check:"validateOneRequired"},isRequired:{selector:".required",check:"validateRequired"},isAlpha:{selector:".validate-alpha",check:"validateAlpha"},isAlphanum:{selector:".validate-alphanum",check:"validateAlphanum"},isDateTime:{selector:".validate-datetime",check:"validateDateTime"},isDate:{selector:".validate-date",check:"validateDate",range_verifier:"dateRangeTest",range_error_message:"rangeDate"},isTime:{selector:".validate-time",check:"validateTime",range_verifier:"timeRangeTest",range_error_message:"rangeDate"},isEmail:{selector:".validate-email",check:"validateEmail"},isInteger:{selector:".validate-integer",check:"validateInteger",range_verifier:"numberRangeTest",range_error_message:"rangeNumber"},isFloat:{selector:".validate-float",check:"validateFloat",range_verifier:"numberRangeTest",range_error_message:"rangeNumber"},isPhone:{selector:".validate-phone",check:"validatePhone"},isCustom:{selector:".validate-custom",check:"validateCustom"},wordCount:{selector:".count-words",check:"validateWordCount"}},styling:{fieldError:"errFld",errorMessage:"errMsg"},messages:{oneRequired:"This section is required.",isRequired:"This field is required.",isAlpha:"The text must use alphabetic characters only (a-z, A-Z). Numbers are not allowed.",isEmail:"This does not appear to be a valid email address.",isInteger:"Please enter an integer.",isFloat:"Please enter a number (ex. 1.9).",isAlphanum:"Please use alpha-numeric characters only [a-z 0-9].",isDateTime:"This does not appear to be a valid date/time.",isDate:"This does not appear to be a valid date.",isTime:"This does not appear to be a valid time.",isPhone:"Please enter a valid phone number.",isCustom:"Please enter a valid value.",wordCount:"This field is over the word limit.",wordsRemPos:" words remaining",wordsRemNeg:" words over the limit",notification:"The form is not complete and has not been submitted yet. There was %% problem(s) with your submission.",rangeNumber:{max:"The value must be smaller than the upper bound %1",min:"The value must be greater than the lower bound %1"},rangeDate:{max:"The date must be before %1",min:"The date must be after %1"},wait:"Please wait..."},instance:function(B){this.behavior=wFORMS.behaviors.validation;this.target=B;var A=this;if(!B.__wFormsValidationHandled){if(!B.addEventListener){wFORMS.standardizeElement(B)}B.addEventListener("submit",function(C){return A.run(C,this)},false);B.__wFormsValidationHandled=true}},onPass:function(B,A){},onFail:function(N,H){var E=wFORMS.behaviors.validation.messages.notification;var C=null;var L=0;for(var B in N.elementsInError){L++;if(!C){C=B}}E=E.replace("%%",L);if(wFORMS.behaviors.paging&&wFORMS.behaviors.paging.showTabNavigation){N.errorPages=new Array();var F=9999;for(var B in N.elementsInError){var J=wFORMS.behaviors.paging.helpers.findPage(document.getElementById(B));if(J){var G=wFORMS.behaviors.paging.getPageIndex(J);if(G0){var A=new Array();for(var B=0;B0){if(F){F.preventDefault?F.preventDefault():F.returnValue=false}if(this.behavior.onFail){this.behavior.onFail(this,F)}return false}if(F&&F.type=="submit"){var C=base2.DOM.Element.querySelector(this.target,'.actions .primaryAction[type="submit"]');C.setAttribute("disabled","disabled");C.setAttribute("style","color: grey");C.setAttribute("value",wFORMS.behaviors.validation.messages.wait)}if(this.behavior.onPass){this.behavior.onPass(this,F)}return true};wFORMS.behaviors.validation.instance.prototype.fail=function(B,D){var F=document.getElementById(B.id+"-D");if(!F&&wFORMS.behaviors.repeat){if(B.id){var A=B.id.replace(/(\[\d+\])+(\-[HED])?$/,"$2");var E=B.id.split(A).join("");A+="-D";if(E){A+=E}F=document.getElementById(A)}}if(F){if(!F.hasClass||!F.addClass){wFORMS.standardizeElement(F)}F.addClass(this.behavior.styling.fieldError)}else{if(!B.hasClass||!B.addClass){wFORMS.standardizeElement(B)}B.addClass(this.behavior.styling.fieldError)}var C=(D in this.behavior.messages)?this.behavior.messages[D]:D;this.addErrorMessage(B,C)},wFORMS.behaviors.validation.instance.prototype.pass=function(A){};wFORMS.behaviors.validation.instance.prototype.addErrorMessage=function(A,B){if(!A.id){A.id=wFORMS.helpers.randomId()}var C=document.createElement("span");C.appendChild(document.createTextNode(B));var D=document.getElementById(A.id+this.behavior.ERROR_PLACEHOLDER_SUFFIX);if(!D){D=document.createElement("div");D.setAttribute("id",A.id+this.behavior.ERROR_PLACEHOLDER_SUFFIX);if(A.tagName=="TR"){if(A.getElementsByTagName("TH").length>0){D=(A.getElementsByTagName("TH")[0]).appendChild(D)}else{D=(A.getElementsByTagName("TD")[0]).appendChild(D)}}else{if(A.hasClass("wfSection")||A.hasClass("inlineSection")){D=A.appendChild(D)}else{var E=document.getElementById(A.id+"-D");if(E){D=E.appendChild(D)}else{D=A.parentNode.insertBefore(D,A.nextSibling)}}}}D.appendChild(C);wFORMS.standardizeElement(D);D.addClass(this.behavior.styling.errorMessage)};wFORMS.behaviors.validation.instance.prototype.removeErrorMessage=function(C){var D=document.getElementById(C.id+"-D");if(!C.hasClass){wFORMS.standardizeElement(C)}if(!C.addClass){wFORMS.standardizeElement(C)}if(!C.removeClass){wFORMS.standardizeElement(C)}if(D&&!D.hasClass){wFORMS.standardizeElement(D)}if(D&&!D.addClass){wFORMS.standardizeElement(D)}if(D&&!D.removeClass){wFORMS.standardizeElement(D)}if(C.hasClass(this.behavior.styling.fieldError)){C.removeClass(this.behavior.styling.fieldError)}if(D&&D.hasClass(this.behavior.styling.fieldError)){D.removeClass(this.behavior.styling.fieldError)}var B=document.getElementById(C.id+this.behavior.ERROR_PLACEHOLDER_SUFFIX);if(B){B.parentNode.removeChild(B)}else{if(C.id){var A=C.id.split("-D").join("");var B=document.getElementById(A+this.behavior.ERROR_PLACEHOLDER_SUFFIX);if(B){B.parentNode.removeChild(B)}}}};wFORMS.behaviors.validation.instance.prototype.isSwitchedOff=function(B){switch(B.tagName){case"INPUT":return B.disabled?true:false;case"TEXTAREA":return B.disabled?true:false;case"SELECT":return B.disabled?true:false;default:if(B.disabled===true){return true}var C=B.getElementsByTagName("INPUT");for(var A=0;A50)?"19"+L:"20"+L}if(L<0||L>3000){return null}var B=parseInt(C[E.MDY_MONTH_POSITION-1],10);if(B<0||B>12){return null}var J=parseInt(C[E.MDY_DAY_POSITION-1],10);if(J<0||J>31){return null}var G=new Date(L,B-1,J);if(!(G.getMonth()+1==B&&G.getDate()==J&&G.getFullYear()==L)){return null}return G};wFORMS.behaviors.validation.instance.prototype.validateTime=function(A,B){if(this.isEmpty(B)){return true}return this.analyzeTimeComponents(B)!==null};wFORMS.behaviors.validation.instance.prototype.analyzeTimeComponents=function(F){var E=false,B=false,D;if(D=F.match(/a[^\da-z]?m/ig)){if(D.length>1){return null}else{if(D.length==1){E=true}}}if(D=F.match(/p[^\da-z]?m/ig)){if(D.length>1){return null}else{if(D.length==1){B=true}}}if(E&&B){return null}var G=null;var A=0,H=0,C=0;D=false;if((G=F.match(/(\d{1,2})[-:](\d{1,2})[-:](\d{1,2})/))&&G.length==4){A=parseInt(G[1]);H=parseInt(G[2]);C=parseInt(G[3]);D=true}else{if((G=F.match(/(\d{1,2})[-:](\d{1,2})/))&&G.length==3){A=parseInt(G[1]);H=parseInt(G[2]);D=true}else{if((G=F.match(/(\d{1,2})/))&&G.length==2){A=parseInt(G[1]);D=true}}}if(!D){return null}if(B){A+=12;if(A==24){A=0}}else{if(E&&A>12){return null}}if(A<0||A>23||H<0||H>59||C<0||C>59){return null}return new Date(0,0,0,A,H,C,0)};wFORMS.behaviors.validation.instance.prototype.validateEmail=function(D,E){var F=/^\w[\w\.\-\+]*\w[@][\w\-]{1,}([.]([\w\-]{1,})){1,}$/;if(this.isEmpty(E)){return true}var A=E.split(",");for(var C=0;CA.getAttribute("data-maxwords")){return false}else{return true}};wFORMS.behaviors.validation.instance.prototype.numberRangeTest=function(D,E,H){var G=null,B=null,F,C;if(this.isEmpty(E)){return true}F=D.getAttribute(wFORMS.behaviors.validation.LOWER_BOUND_ATTRIBUTE);if(F&&(this.validateFloat(F)||this.validateInteger(F))){G=parseFloat(F)}if(G==null){G=-Infinity}C=D.getAttribute(wFORMS.behaviors.validation.UPPER_BOUND_ATTRIBUTE);if(C&&(this.validateFloat(C)||this.validateInteger(C))){B=parseFloat(C)}if(B==null){B=Infinity}E=parseFloat(E);if(isNaN(E)||E===undefined||E===null){return false}var A=null;if(EB){A=(A==null?"":A+" ")+H.max.replace(/%1/g,B)}return A==null?true:A};wFORMS.behaviors.validation.instance.prototype.dateRangeTest=function(A,B,C){return this.dateTimeRangeTestCommon(A,B,C,"analyzeDateComponents")};wFORMS.behaviors.validation.instance.prototype.timeRangeTest=function(A,B,C){return this.dateTimeRangeTestCommon(A,B,C,"analyzeTimeComponents")};wFORMS.behaviors.validation.instance.prototype.dateTimeRangeTestCommon=function(D,E,H,C){var G=null,A=null,F,B;if(this.isEmpty(E)){return true}F=D.getAttribute(wFORMS.behaviors.validation.LOWER_BOUND_ATTRIBUTE);if(F){G=this[C](F)}B=D.getAttribute(wFORMS.behaviors.validation.UPPER_BOUND_ATTRIBUTE);if(B){A=this[C](B)}if((E=this[C](E))===null){return false}if(G&&(E.getTime()A.getTime())){if(G){return H.min.replace(/%1/g,F)+" "+H.max.replace(/%1/g,B)}return H.max.replace(/%1/g,B)}return true};wFORMS.behaviors.validation.enableResumeLater=function(){var A=document.getElementById("tfa_resumeLater");if(A){if(!wFORMS.behaviors.validation.messages.isPasswordConfirmed){wFORMS.behaviors.validation.messages.isPasswordConfirmed="Your password and confirmation field did not match."}wFORMS.behaviors.validation.instance.prototype.isPasswordConfirmed=function(D,C){if(document.getElementById("tfa_confirmPassword")){if(C!=document.getElementById("tfa_confirmPassword").value){return false}}return true};if(!wFORMS.behaviors.validation.messages.isPasswordStrong){wFORMS.behaviors.validation.messages.isPasswordStrong="Please choose a more secure password. Passwords must contain 8 or more characters, with at least 1 letter (a to z), 1 number (0 to 9), and 1 symbol (like '%', '$' or '!')."}wFORMS.behaviors.validation.instance.prototype.isPasswordStrong=function(E,C){var F=[/^([^\s]{8,})/,/[a-zA-Z]/i,/[0-9]/,/[\"!#$%&'()*+,-.\/:;<=>?@\[\]\\\^_`{|}~]/];for(var D=0;D=0){this.counter.message=wFORMS.behaviors.validation.messages.wordsRemPos;this.counter.className=this.counter.className.replace(/errMsg/,"")}else{if(!this.counter.className.match(/errMsg/)){this.counter.message=wFORMS.behaviors.validation.messages.wordsRemNeg;this.counter.className+=" errMsg"}}this.counter.innerHTML=Math.abs(this.maxWords-this.wordCount)+this.counter.message;A.count=this.wordCount}};if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.calculation={skip:false,VARIABLE_SELECTOR_PREFIX:"calc-",CHOICE_VALUE_SELECTOR_PREFIX:"calcval-",CALCULATION_SELECTOR:'*[class*="formula="]',CALCULATION_ERROR_MESSAGE:"There was an error computing this field.",instance:function(A){this.behavior=wFORMS.behaviors.calculation;this.target=A;this.calculations=[]}};wFORMS.behaviors.calculation.applyTo=function(C){if(wFORMS.behaviors.calculation.skip){return null}while(C&&C.tagName!="FORM"){C=C.parentNode}var B=wFORMS.getBehaviorInstance(C,"calculation");if(!B){B=new wFORMS.behaviors.calculation.instance(C)}else{B.calculations=[]}if(wFORMS.behaviors.repeat&&!B._repeatRemoveHandler){var A=wFORMS.behaviors.repeat.onRemove;B._repeatRemoveHandler=function(){wFORMS.behaviors.calculation.applyTo(C);if(A){A.apply(this,arguments)}};wFORMS.behaviors.repeat.onRemove=B._repeatRemoveHandler}base2.DOM.Element.querySelectorAll(C,wFORMS.behaviors.calculation.CALCULATION_SELECTOR).forEach(function(F){var H=F.className.substr(F.className.indexOf("formula=")+8).split(" ")[0];var G=H.split(/[^a-zA-Z]+/g);B.varFields=[];for(var E=0;E=0;E--){if(C.isMaskChar(C.format[E])){break}}return E}());this.caret=new wFORMS.behaviors.autoformat.Caret(this);if(this.element.value!==""){var B=this.element.value.split("");for(var A=0;A0){B=this.caret.nudge()}}else{while(!this.isMaskChar(this.format[B.start])&&B.startthis.firstInputChar){this.caret.nudge(-1)}else{if(this.isRtl&&A.position<=this.lastInputChar){this.caret.nudge(-1)}}}this.reformat()};wFORMS.behaviors.autoformat.Mask.prototype.forwardDel=function(){var A=this.caret.getPosition();this.caret.savePosition();if(A.isRange){this.backspace()}else{this.Vals.splice(this.valIndex.start,1);this.caret.nudge(0);this.reformat()}};wFORMS.behaviors.autoformat.Mask.prototype.cut=function(){var B=0,A=this.caret.getPosition();this.Vals.splice(this.valIndex.start,this.valIndex.end-this.valIndex.start);if(this.isRtl){B=this.element.value.length-A.position;this.reformat();this.caret.setPosition(this.format.length-B)}else{this.reformat()}};wFORMS.behaviors.autoformat.Mask.prototype.paste=function(){var B,E,C,D,A,F=this.caret.previousPosition();C=F.isRange?F.end-F.start:0;E=this.element.value.length-this.contents.length+C;if(F.isRange){this.Vals.splice(this.valIndex.start,this.valIndex.end-this.valIndex.start)}this.caret.setPosition(F.start);D=this.element.value.substr(F.start,E).split("");if(this.isRtl){A=this.caret.getPosition().position+C;this.caret.setPosition(A)}for(B=0;B=0;C--){E.call(this,C)}}else{for(C=0;C=0;B--){if(C===A.length){break}D=this.contents[B]+D;if(this.isMaskChar(this.format[B])){C+=1}}}else{for(B=0;B-1){G=B=A}else{G=-C.moveStart("character",-A);B=(C.compareEndPoints("EndToEnd",F)>-1)?A:-C.moveEnd("character",-A)}}}return{start:G,end:B}};wFORMS.behaviors.autoformat.Caret.prototype.setSelection=function(D,A){var C=this.mask.element;if(C.setSelectionRange){C.setSelectionRange(D,A)}else{var B=C.createTextRange();B.collapse(true);if(D===A){B.move("character",D)}else{B.moveEnd("character",A);B.moveStart("character",D)}B.select()}};wFORMS.behaviors.autoformat.Caret.prototype.update=function(){this.setSelection(this.caretPos.start,this.caretPos.start);this.savePosition();return this.caretPos};wFORMS.behaviors.autoformat.Caret.prototype.getPosition=function(){var D=this.getSelection(),C=D.start,A=D.end,B={isRange:null,position:null,start:C,end:A};if(A-C===0){B.isRange=false;B.position=C}else{B.isRange=true}return B};wFORMS.behaviors.autoformat.Caret.prototype.savePosition=function(){this.prevCaretPos=this.cloneCaretPos();this.caretPos=this.getPosition();this._setValIndex();return this.caretPos};wFORMS.behaviors.autoformat.Caret.prototype.setPosition=function(A){this.caretPos.isRange=false;this.caretPos.start=this.caretPos.end=this.caretPos.position=A;return this.update()};wFORMS.behaviors.autoformat.Caret.prototype.cloneCaretPos=function(){return{isRange:this.caretPos.isRange,position:this.caretPos.position,start:this.caretPos.start,end:this.caretPos.end}};wFORMS.behaviors.autoformat.Caret.prototype.nudge=function(A){A=(A!==undefined)?A:1;if(this.isRtl){A=-A}if(this.caretPos.isRange){if(this.isRtl){this.caretPos.position=this.caretPos.start=this.caretPos.end}else{this.caretPos.position=this.caretPos.end=this.caretPos.start}}this.caretPos.position+=A;if(this.isRtl){while(this.caretPos.position>=0&&this.caretPos.position<=this.mask.format.length&&!this.mask.isMaskChar(this.mask.format[this.caretPos.position-1])){if(A===0){this.caretPos.position-=1}else{this.caretPos.position+=(A>0)?1:-1}}}else{while(this.caretPos.position>=0&&this.caretPos.position<=this.mask.format.length&&!this.mask.isMaskChar(this.mask.format[this.caretPos.position])){if(A===0){this.caretPos.position+=1}else{this.caretPos.position+=(A>0)?1:-1}}}this.caretPos.start=this.caretPos.end=this.caretPos.position;return this.update()};wFORMS.behaviors.autoformat.Caret.prototype.preventOverflow=function(){var A,B;this.savePosition();if(this.caretPos.isRange){return }if(this.isRtl){for(B=this.mask.contents.length-1;B>=0;B--){if(this.mask.isMaskChar(this.mask.contents[B])){A=B;break}}if(this.caretPos.position>this.mask.lastInputChar){this.caretPos.position=this.mask.lastInputChar+1}else{if(this.caretPos.position<=A){this.caretPos.position=A+1}}}else{for(B=0;BA){this.caretPos.position=A}}}this.caretPos.start=this.caretPos.end=this.caretPos.position;return this.update()};wFORMS.behaviors.autoformat.Caret.prototype.previousPosition=function(){return this.prevCaretPos};wFORMS.behaviors.autoformat.Caret.prototype._setValIndex=function(){var B,C=0,A=0;if(this.mask.isRtl){for(B=this.mask.format.length;B>this.caretPos.end;B--){if(this.mask.isMaskChar(this.mask.format[B-1])){C+=1}}A=C;for(B=this.caretPos.end;B>this.caretPos.start;B--){if(this.mask.isMaskChar(this.mask.format[B-1])){A+=1}}}else{for(B=0;B=wFORMS.behaviors.lengthPrompt.MONITOR_CHECK_TIMES){window.clearInterval(A._pasteMonitorHandler)}}})(),10)},textarea_input:function(B){var A=wFORMS.behaviors.lengthPrompt._globalCache[this.id];if(!A){return }A.restrictInput(B)}},messages:"%1 characters left.",_getActorsSelector:function(){if(!wFORMS.behaviors.lengthPrompt.ACTORS_SELECTOR){var A="";for(var B=0;B=0){E=B.selectionStart;F=B.selectionEnd-B.selectionStart}else{if(document.selection){var C,D,A;if(B.tagName&&B.tagName==="TEXTAREA"){C=document.selection.createRange().duplicate();D=B.createTextRange();D.collapse(false);D.moveToBookmark(C.getBookmark());if(C.text===""){A=D.duplicate();A.moveEnd("character",1);if(C.boundingWidth===A.boundingWidth&&C.boundingHeight===A.boundingHeight){D=A}}}else{D=document.selection.createRange().duplicate()}F=D.text.length;E=Math.abs(D.moveStart("character",-1000000))}else{if(document.getSelection){E=0;F=document.getSelection().length}}}return{caret:E,length:F}},setCaretPosition:function(B,C){if(B.setSelectionRange){B.focus();B.setSelectionRange(C,C)}else{if(B.createTextRange){var A=B.createTextRange();A.collapse(true);A.moveEnd("character",C);A.moveStart("character",C);A.select()}}}};(function(B){for(var A in B){wFORMS.behaviors.lengthPrompt.instance.prototype[A]=B[A]}})({deployUI:function(){var A=this.element.parentNode;if(!base2.DOM.Element.matchesSelector(this.element.parentNode,wFORMS.INPUT_CONTROL_WRAPPER_SELECTOR)){A=this.mirrorWrapperDiv()}var B=document.createElement("div");A.appendChild(B);B.style.position="absolute";B.style.top="0px";B.style.display="none";B.style.width="100%";B.className=wFORMS.behaviors.lengthPrompt.CUSTOM_INDICATOR_STYLE;this.ui_indicator=B;this.adjustIndicatorPosition();this.checkUpdate()},adjustIndicatorPosition:function(){var B=(function(F){return function(G){return parseFloat(base2.DOM.AbstractView.getComputedStyle(window,F,"").getPropertyValue(G).replace(/px$/,""))||0}})(this.element);var E=this.element.offsetWidth||B("width");var D=["margin-left","margin-right","border-left-width","border-right-width","padding-left","padding-right"];for(var C=0,A=D.length;C0){D=D.substr(0,D.length-C)}this.element.value=this.inputCache.substr(0,A.caret)+D+this.inputCache.substr(A.caret+A.length,this.inputCache.length);wFORMS.behaviors.lengthPrompt.setCaretPosition(this.element,A.caret+D.length);this.checkUpdate()},restrictInput:function(A){if(this.element.value.length==this.maxLength&&!this.testSpecialKey(A)&&(wFORMS.behaviors.lengthPrompt.getSelection(this.element).length==0)){A.preventDefault()}},testSpecialKey:function(A){var B=A.which||A.keyCode;return((A.ctrlKey&&(B==65||B==88||B==67||B==86))||(B==wFORMS.behaviors.lengthPrompt.keyCode["END"])||(B==wFORMS.behaviors.lengthPrompt.keyCode["HOME"])||(B==wFORMS.behaviors.lengthPrompt.keyCode["LEFT"])||(B==wFORMS.behaviors.lengthPrompt.keyCode["RIGHT"])||(B==wFORMS.behaviors.lengthPrompt.keyCode["DELETE"])||(B==wFORMS.behaviors.lengthPrompt.keyCode["BACKSPACE"]))},showIndicator:function(){this.adjustIndicatorPosition();this.ui_indicator.style.display="block";this.bindMonitorEvent()},hideIndicator:function(){this.ui_indicator.style.display="none";this.releaseMonitorEvent()},updateIndicator:function(){var A=this.element.value.length;var B=this.maxLength-A;this.ui_indicator.innerHTML=wFORMS.behaviors.lengthPrompt.messages.replace(/%1/g,B)},checkUpdate:function(){var A=this.element.value.length;if(A!=this.previousLength){this.updateIndicator();this.previousLength=A}}});if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.dependent_list={skip:false,instance:function(A){this.behavior=wFORMS.behaviors.dependent_list;this.target=A}};wFORMS.behaviors.dependent_list.applyTo=function(C){if(wFORMS.behaviors.dependent_list.skip){return null}var A=new wFORMS.behaviors.dependent_list.instance(C);if(!C.querySelectorAll){base2.DOM.bind(C)}var B=C.querySelectorAll("option[data-filter-dependent], select[data-filter-dependent], input[data-filter-dependent]");B.forEach(function(D){if(!D.addEventListener){base2.DOM.bind(D)}D.addEventListener("change",function(E){A.run(E,this)},false);A.run(null,D)});if(B.length>0&&wFORMS.behaviors.repeat){wFORMS.behaviors.repeat.observeRepeatComplete(function(E,D,F){A.onRepeatableDuplicated(E,D,F)});wFORMS.behaviors.repeat.observeRemoveComplete(function(D){A.onRepeatableRemoved(D)})}A.onApply();return A};wFORMS.behaviors.dependent_list.instance.prototype.onApply=function(){};wFORMS.behaviors.dependent_list.instance.prototype.run=function(E,C){var B=this;var D=wFORMS.helpers.getForm(this.target);var A=C.getAttribute("data-filter-dependent");var F=D.querySelectorAll(A);F.forEach(function(G){B.applyFiltersTo(G)})};wFORMS.behaviors.dependent_list.instance.prototype.applyFiltersTo=function(D){var B=this;var E=wFORMS.helpers.getForm(this.target);var A=D.getAttribute("data-filter-control");var C=E.querySelectorAll(A);C.forEach(function(F){B.filter(F,D)})};wFORMS.behaviors.dependent_list.instance.prototype.filter=function(D,B){var A=this;this._dirtyCalculations={};var E=function(J,O){var M=(J.checked||J.selected)&&!J.disabled;var N=J.getAttribute("data-filter-include");var H=J.getAttribute("data-filter-exclude");if(!N&&!H){var L=A.getChoiceLabel(J);N="optgroup[label='"+L.replace("\\","\\\\").replace("'","\\'")+"']"}if(N){if(M){if(O=="selected"){A.include(B,N)}}else{if(O=="deselected"){A.exclude(B,N)}}}if(H){if(M){if(O=="selected"){A.exclude(B,H)}}else{if(O=="deselected"){A.include(B,H)}}}};if(D.tagName=="INPUT"){E(D,"deselected");E(D,"selected")}else{var G=D.querySelectorAll("input[type=checkbox],input[type=radio],option");G.forEach(function(H){E(H,"deselected")});G.forEach(function(H){E(H,"selected")})}var C=wFORMS.getBehaviorInstance(wFORMS.helpers.getForm(this.target),"calculation");for(var F in this._dirtyCalculations){C.run(null,this._dirtyCalculations[F])}this._dirtyCalculations={};if(B.getAttribute("data-filter-dependent")){this.run(null,B)}};wFORMS.behaviors.dependent_list.instance.prototype.include=function(C,A){var B=C.querySelectorAll(A);B.forEach(function(D){D.disabled=false;D.style.display="";if(D.tagName=="OPTGROUP"||D.tagName=="OPTION"){if(D.parentNode.tagName=="SPAN"){var E=D.parentNode;E.parentNode.insertBefore(D,E);E.parentNode.removeChild(E)}}fields=D.querySelectorAll("input,select,textarea,option");fields.forEach(function(F){F.disabled=false})})};wFORMS.behaviors.dependent_list.instance.prototype.exclude=function(D,A){var C=D.querySelectorAll(A);var E=wFORMS.getBehaviorInstance(wFORMS.helpers.getForm(this.target),"calculation");var B=this;C.forEach(function(F){F.disabled="disabled";F.style.display="none";if(F.selected){F.selected=false}if(F.checked){F.checked=false}if(F.tagName=="OPTGROUP"||F.tagName=="OPTION"){if(F.parentNode.tagName!="SPAN"){F.parentNode.insertBefore(document.createElement("span"),F).appendChild(F)}var G=F.parentNode;while(G&&G.tagName!="SELECT"){G=G.parentNode}if(G&&E&&E.isVariable(G)){B._dirtyCalculations[G.id]=G}}else{if(E&&E.isVariable(F)){B._dirtyCalculations[G.id]=G}}fields=F.querySelectorAll("input,select,textarea,option");fields.forEach(function(H){H.disabled="disabled";H.selected=false;if(E&&E.isVariable(H)){B._dirtyCalculations[H.id]=H}})})};wFORMS.behaviors.dependent_list.instance.prototype.getChoiceLabel=function(A){if(A.tagName!="OPTION"){A=this.target.querySelector("label[for='"+A.getAttribute("id")+"']")}var B=A.textContent||A.innerText;return B};wFORMS.behaviors.dependent_list.instance.prototype.updateReference=function(D,G,F,C,J){var B=D.getAttribute(G);var H=B?B.split(","):[];if(H.length>0){if(J){for(var E=0;E0){C.forEach(function(P){var O=P.id;var Q=H(O,F.master);if(O==Q){return }var M=L.updateSelectors(P.getAttribute("data-filter-dependent"),F.master);if(M){var R=E.querySelectorAll(M);R.forEach(function(S){L.updateReference(S,"data-filter-control",Q,O,true)})}var M=L.updateSelectors(P.getAttribute("data-filter-control"),F.master);if(M){var N=E.querySelectorAll(M);N.forEach(function(S){L.updateReference(S,"data-filter-dependent",Q,O,true)})}});var C=G.querySelectorAll("option[data-filter-dependent], select[data-filter-dependent], input[data-filter-dependent], option[data-filter-control], select[data-filter-control], input[data-filter-control]");var B={};for(var D in F.repeat){var A=H(D,F.master);B[A]=F.repeat[D]}C.forEach(function(P){var O=P.id;var Q=H(O,F.repeat);Q=H(Q,F.master);var M=L.updateSelectors(P.getAttribute("data-filter-dependent"),B);if(M){var R=E.querySelectorAll(M);R.forEach(function(T){var S=L.isInSameScope(P,T);L.updateReference(T,"data-filter-control",Q,O,S)})}var M=L.updateSelectors(P.getAttribute("data-filter-control"),F.repeat);if(M){var N=E.querySelectorAll(M);N.forEach(function(T){var S=L.isInSameScope(P,T);L.updateReference(T,"data-filter-dependent",Q,O,S)})}})}};wFORMS.behaviors.dependent_list.instance.prototype.onRepeatableRemoved=function(A){};if(typeof (wFORMS)=="undefined"){throw new Error("wFORMS core not found. This behavior depends on the wFORMS core.")}wFORMS.behaviors.prefill={instance:function(B){this.behavior=wFORMS.behaviors.prefill;this.target=B;var A=this},skip:false};wFORMS.behaviors.prefill.applyTo=function(J){if(wFORMS.behaviors.prefill.skip){return }var F=new wFORMS.behaviors.prefill.instance(J);var H=wFORMS.getBehaviorInstance(J,"switch");var D=wFORMS.getBehaviorInstance(J,"calculation");var E=F.getParameters();for(var M in E){try{var C=J.elements[M];if(C){F.populateField(C,E[M],H,D)}else{var B=document.getElementById(M);var A=B.getElementsByTagName("input");for(var G=0;G=1){return l.item(0).innerHTML}return null};wFORMS.behaviors.prefill.instance.prototype.getParameters=function(){var D=Array();if(arguments.length==1){var C=arguments[0]}else{var C=document.location.search}if(C.length==0){return }if(C.split("?")[1]){var A=C.split("?")[1].split("&")}else{var A=C.split("&")}for(var B=0;B