forked from westonruter/webforms2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webforms2-p.js
1 lines (1 loc) · 43 KB
/
webforms2-p.js
1
if(!window.$wf2){var $wf2={};if(document.implementation&&document.implementation.hasFeature&&!document.implementation.hasFeature("WebForms","2.0")){$wf2={version:"0.5.4",isInitialized:false,libpath:"",globalEvent:null,hasElementExtensions:window.HTMLElement&&HTMLElement.prototype,hasGettersAndSetters:$wf2.__defineGetter__&&$wf2.__defineSetter__,hasBadImplementation:navigator.userAgent.indexOf("WebKit"),callBeforeValidation:[],callAfterValidation:[],callAfterDOMContentLoaded:[],onDOMContentLoaded:function(){if(!$wf2.isInitialized){$wf2.isInitialized= true;var a;if(document.createEventObject)$wf2.globalEvent=document.createEventObject();else if(document.createEvent)$wf2.globalEvent=document.createEvent("HTMLEvents");a=document.createElement("link");a.setAttribute("type","text/css");a.setAttribute("rel","stylesheet");a.setAttribute("href",$wf2.libpath+"webforms2.css");var b=document.getElementsByTagName("head")[0];b||(b=document.getElementsByTagName("*")[0]);b.insertBefore(a,b.firstChild);$wf2.zeroPoint={};$wf2.zeroPoint.datetime=$wf2.parseISO8601("1970-01-01T00:00:00.0Z"); $wf2.zeroPoint["datetime-local"]=$wf2.parseISO8601("1970-01-01T00:00:00.0");$wf2.zeroPoint.date=$wf2.zeroPoint.datetime;$wf2.zeroPoint.month=$wf2.zeroPoint.datetime;$wf2.zeroPoint.week=$wf2.parseISO8601("1970-W01");$wf2.zeroPoint.time=$wf2.zeroPoint.datetime;$wf2.xhr=null;if(window.XMLHttpRequest)$wf2.xhr=new XMLHttpRequest;else if(window.ActiveXObject)try{$wf2.xhr=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{$wf2.xhr=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}if($wf2.xhr){$wf2.prefillSelectElements(); $wf2.prefillFormElements()}$wf2.initRepetitionBlocks();$wf2.initRepetitionTemplates();$wf2.initRepetitionButtons("add");$wf2.initRepetitionButtons("remove");$wf2.initRepetitionButtons("move-up");$wf2.initRepetitionButtons("move-down");$wf2.updateAddButtons();$wf2.updateMoveButtons();if(document.addEventListener){document.addEventListener("mousedown",$wf2.clearInvalidIndicators,false);document.addEventListener("keydown",$wf2.clearInvalidIndicators,false)}else if(document.attachEvent){document.attachEvent("onmousedown", $wf2.clearInvalidIndicators);document.attachEvent("onkeydown",$wf2.clearInvalidIndicators)}$wf2.initNonRepetitionFunctionality();for(a=0;a<$wf2.callAfterDOMContentLoaded.length;a++)$wf2.callAfterDOMContentLoaded[a]()}},prefillSelectElements:function(){for(var a,b=$wf2.getElementsByTagNames.apply(document.documentElement,["select","datalist"]),c=0;a=b[c];c++){var d=$wf2.loadDataURI(a);if(d&&d.documentElement&&/:?\bselect$/i.test(d.documentElement.nodeName)&&d.documentElement.namespaceURI=="http://www.w3.org/1999/xhtml"){d= d.documentElement;if(d.getAttribute("type")!="incremental")for(;a.lastChild;)a.removeChild(a.lastChild);for(node=d.firstChild;node;){a.appendChild($wf2.cloneNode(node));node=node.nextSibling}}}},prefillFormElements:function(){for(var a,b=document.getElementsByTagName("form"),c=0;a=b[c];c++){var d=$wf2.loadDataURI(a);if(d&&d.documentElement&&/:?\bformdata$/.test(d.documentElement.nodeName)&&d.documentElement.namespaceURI=="http://n.whatwg.org/formdata"){var e,f=d.documentElement;f.getAttribute("type")!= "incremental"&&a.reset();var g=f.getElementsByTagName("clear");for(j=0;d=g[j];j++)if(d.namespaceURI=="http://n.whatwg.org/formdata"&&d.parentNode==f&&!d.firstChild&&(e=document.getElementById(d.getAttribute("template")))&&e.getAttribute("repeat")=="template"){var k,h;for(d=e.parentNode.firstChild;d;)if(d.nodeType==1&&(k=d.getAttributeNode("repeat"))&&k.value!="template"){h=d.nextSibling;d.parentNode.removeChild(d);d=h}else d=d.nextSibling}var q;g=f.getElementsByTagName("repeat");for(j=0;d=g[j];j++)if(d.namespaceURI== "http://n.whatwg.org/formdata"&&d.parentNode==f&&!d.firstChild&&(e=document.getElementById(d.getAttribute("template")))&&e.getAttribute("repeat")=="template"&&/^-?\d+$/.test(q=d.getAttribute("index"))){var m;for(d=e.parentNode.firstChild;d;){if(d.nodeType==1&&(k=d.getAttributeNode("repeat"))&&k.value==q){m=true;break}d=d.nextSibling}m||$wf2.addRepetitionBlockByIndex.apply(e,[null,q])}var n;f=f.getElementsByTagName("field");g=$wf2.getFormElements.apply(a);for(j=0;n=f[j];j++){var l=n.getAttributeNode("index"), o=n.getAttribute("name");if(!(!o||l&&!/^\d+$/.test(l.value))){h="";for(p=0;d=n.childNodes[p];p++)if(d.nodeType==3||d.nodeType==4)h+=d.data;else break;for(p=n=0;d=g[p];p++)if(d.type=="image"){if(d.name?d.name+".x"==o||d.name+".y"==o:o=="x"||o=="y")if(!l||++n-1>=l.value)break}else if(d.name==o){if(l){if(++n-1<l.value)continue}else if((d.type=="radio"||d.type=="checkbox")&&h&&d.value!=h)continue;break}if(!(d.type=="file"||d.type=="button"||d.type=="image"))if(!d.getAttributeNode("multiple")||!d.wf2Prefilled){if(d.type== "checkbox"||d.type=="radio")if(h)if(d.value==h)d.checked=true;else break;else d.checked=false;else if(d.nodeName.toLowerCase()=="select"){d.selectedIndex=-1;for(var p=0;l=d.options[p];p++)if(l.value?l.value==h:l.text==h){l.selected=true;break}}else{d.value=h;$wf2.updateValidityState(d);if(!d.validity.valid){d.value=d.defaultValue;$wf2.updateValidityState(d)}}d.wf2Prefilled=true}else if(d.getAttributeNode("multiple"))for(p=0;l=d.options[p];p++)if(!l.selected&&(l.value?l.value==h:l.text==h)){l.selected= true;break}}}g=$wf2.getFormElements.apply(a);for(j=0;j<g.length;j++);}}},repetitionTemplates:[],constructRepetitionTemplate:function(){if(!this.wf2Initialized){this.wf2Initialized=true;this.style.display="none";this.repetitionType=RepetitionElement.REPETITION_TEMPLATE;if(!this.repetitionIndex)this.repetitionIndex=0;this.repetitionTemplate=null;if(!this.repetitionBlocks)this.repetitionBlocks=[];var a;this.repeatStart=/^\d+$/.test(a=this.getAttribute("repeat-start"))?parseInt(a):1;this.repeatMin=/^\d+$/.test(a= this.getAttribute("repeat-min"))?parseInt(a):0;this.repeatMax=/^\d+$/.test(a=this.getAttribute("repeat-max"))?parseInt(a):Number.MAX_VALUE;if(!this.addRepetitionBlock)this.addRepetitionBlock=function(e,f){return $wf2.addRepetitionBlock.apply(this,[e,f])};if(!this.addRepetitionBlockByIndex)this.addRepetitionBlockByIndex=this.addRepetitionBlock;for(a=this;a=a.parentNode;)if(a.nodeName.toLowerCase()=="form")break;var b;if(a&&(b=$wf2.getElementsByTagNames.apply(this,["button","input","select","textarea", "isindex"])).length)for(var c=0;a=b[c];c++)a.disabled=true;var d;for(b=this.parentNode.firstChild;b&&b!=this;){if(b.nodeType==1&&(d=b.getAttributeNode("repeat"))&&/^-?\d+$/.test(d.value)&&!b.getAttribute("repeat-template")){b.repetitionTemplate=this;b.setAttribute("repeat-template",this.id);this.repetitionBlocks.push(b)}b=b.nextSibling}for(c=0;c<this.repeatStart||this.repetitionBlocks.length<this.repeatMin;c++)if(!this.addRepetitionBlock())break;$wf2.repetitionTemplates.push(this);this.wf2Initialized= true}},initRepetitionTemplates:function(a){a=$wf2.getElementsByTagNamesAndAttribute.apply(a||document.documentElement,[["*"],"repeat","template"]);for(var b=0;b<a.length;b++)$wf2.constructRepetitionTemplate.apply(a[b])},constructRepetitionBlock:function(){if(!this.wf2Initialized){this.style.display="";this.repetitionType=RepetitionElement.REPETITION_BLOCK;var a;this.repetitionIndex=/^\d+$/.test(a=this.getAttribute("repeat"))?parseInt(a):0;this.repetitionTemplate=this.repetitionBlocks=null;var b;if((b= document.getElementById(this.getAttribute("repeat-template")))&&b.getAttribute("repeat")=="template")this.repetitionTemplate=b;else for(b=this;b=b.nextSibling;)if(b.nodeType==1&&b.getAttribute("repeat")=="template"){this.repetitionTemplate=b;break}if(!this.removeRepetitionBlock)this.removeRepetitionBlock=function(){return $wf2.removeRepetitionBlock.apply(this)};if(!this.moveRepetitionBlock)this.moveRepetitionBlock=function(c){return $wf2.moveRepetitionBlock.apply(this,[c])};this.wf2Initialized=true}}, initRepetitionBlocks:function(a){a=$wf2.getElementsByTagNamesAndAttribute.apply(a||document.documentElement,[["*"],"repeat","template",true]);for(var b=0;b<a.length;b++)$wf2.constructRepetitionBlock.apply(a[b])},repetitionButtonDefaultLabels:{add:"Add",remove:"Remove","move-up":"Move-up","move-down":"Move-down"},constructRepetitionButton:function(a){if(!this.wf2Initialized){this.htmlTemplate=$wf2.getHtmlTemplate(this);this.firstChild||this.appendChild(document.createTextNode($wf2.repetitionButtonDefaultLabels[a])); if(a!="add")this.disabled=!$wf2.getRepetitionBlock(this);else{var b;this.disabled=!((b=$wf2.getRepetitionBlock(this))&&b.repetitionTemplate||this.htmlTemplate)}if(this.addEventListener)this.addEventListener("click",$wf2.clickRepetitionButton,false);else if(this.attachEvent)this.attachEvent("onclick",$wf2.clickRepetitionButton);else this.onclick=$wf2.clickRepetitionButton;this.wf2Initialized=true}},initRepetitionButtons:function(a,b){var c;if(!b)b=document.documentElement;var d=$wf2.getElementsByTagNamesAndAttribute.apply(b, [["input"],"type",a]);for(c=0;c<d.length;c++){for(var e=document.createElement("button"),f=0,g;g=d[c].attributes[f];f++)e.setAttribute(g.nodeName,d[c].getAttribute(g.nodeName));d[c].parentNode.replaceChild(e,d[c])}d=$wf2.getElementsByTagNamesAndAttribute.apply(b,[["button"],"type",a]);for(c=0;c<d.length;c++)$wf2.constructRepetitionButton.apply(d[c],[a])},clickRepetitionButton:function(a){a&&a.preventDefault&&a.preventDefault();var b;if(a&&a.target)b=a.target;else if(window.event)b=event.srcElement; else if(this.nodeName.toLowerCase()=="button")b=this;var c=String(b.getAttribute("type")).toLowerCase();if(b.onclick){b._onclick=b.onclick;b.removeAttribute("onclick");b.onclick=null}if(b.returnValue!==undefined&&!b.returnValue){b.returnValue=undefined;return false}if(b._onclick&&b.returnValue===undefined){b.returnValue=b._onclick(a);if(b.returnValue!==undefined&&!b.returnValue){b.returnValue=undefined;return false}}b.returnValue=undefined;if(c!="add"){a=$wf2.getRepetitionBlock(b);this.disabled=!a; if(a)if(c.indexOf("move")===0){a._clickedMoveBtn=b;a.moveRepetitionBlock(c=="move-up"?-1:1)}else c=="remove"&&a.removeRepetitionBlock()}else{var d;if(b.htmlTemplate)d=b.htmlTemplate;else if((a=$wf2.getRepetitionBlock(b))&&a.repetitionTemplate)d=a.repetitionTemplate;if(d)d.addRepetitionBlock();else b.disabled=true}return false},addRepetitionBlock:function(a,b){if(this.getAttribute("repeat")!="template")throw $wf2.DOMException(9);if(!this.repetitionBlocks)this.repetitionBlocks=[];if(!this.repetitionIndex)this.repetitionIndex= 0;if(!this.repeatMin)this.repeatMin=0;if(!this.repeatMax)this.repeatMax=Number.MAX_VALUE;if(!this.repeatStart)this.repeatStart=1;if(this.parentNode==null)return null;for(var c=this;c=c.parentNode;)if(c.nodeType==1&&c.getAttribute("repeat")=="template")return false;c=this.previousSibling;for(var d=0;c!=null;){if(c.nodeType==1){var e;repeat=parseInt(c.getAttribute("repeat"));e=c.getAttributeNode("repeat-template");if(!isNaN(repeat)&&(!e||e.value==this.id)){this.repetitionIndex=Math.max(this.repetitionIndex, repeat+1);d++}}c=c.previousSibling}if(this.repeatMax<=d)return null;if(b!==undefined&&b>this.repetitionIndex)this.repetitionIndex=b;c=this.getAttribute("id")?"id":this.getAttribute("name")?"name":"";d=this.getAttribute(c);var f,g=this.repetitionIndex,k;if(d&&!/\u005B|\u02D1|\u005D|\u00B7/.test(d)){k=RegExp("(\\[|\u02d1)"+d+"(\\]|\u00b7)","g");f=function(n){if(!n)return n;n=n.toString();if(n.indexOf("\ufeff")===0)return n.replace(/^\uFEFF/,"");return n.replace(k,g)}}f=$wf2.cloneNode(this,f);f.wf2Initialized= false;k=null;f.setAttribute("repeat",this.repetitionIndex);f.removeAttribute("repeat-min");f.removeAttribute("repeat-max");f.removeAttribute("repeat-start");if(c){f.setAttribute("repeat-template",d);f.removeAttribute(c)}if(a){a.parentNode.insertBefore(f,a.nextSibling);this.repetitionBlocks.push(f);$wf2.sortNodes&&this.repetitionBlocks.sort($wf2.sortNodes)}else{for(a=this;a.previousSibling&&a.previousSibling.repetitionType!=RepetitionElement.REPETITION_BLOCK;)a=a.previousSibling;this.parentNode.insertBefore(f, a);this.repetitionBlocks.push(f)}this.repetitionIndex++;$wf2.constructRepetitionBlock.apply(f);$wf2.initRepetitionTemplates(f);$wf2.initRepetitionButtons("add",f);$wf2.initRepetitionButtons("remove",f);$wf2.initRepetitionButtons("move-up",f);$wf2.initRepetitionButtons("move-down",f);if($wf2.isInitialized){$wf2.updateAddButtons(this);$wf2.updateMoveButtons(this.parentNode)}$wf2.initNonRepetitionFunctionality(f);var h;try{if(document.createEvent)h=document.createEvent("UIEvents");else if(document.createEventObject)h= document.createEventObject();RepetitionEvent._upgradeEvent.apply(h);h.initRepetitionEvent("added",true,false,f);this.dispatchEvent&&this.dispatchEvent(h)}catch(q){h={};RepetitionEvent._upgradeEvent.apply(h);h.initRepetitionEvent("added",true,false,f)}if((c=this.getAttribute("onadded"))&&(!this.onadded||typeof this.onadded!="function"))this.onadded=new Function("event",c);else if((c=this.getAttribute("onadd"))&&(!this.onadd||typeof this.onadd!="function"))this.onadd=new Function("event",c);try{if(this.onadded)this.onadded.apply(this, [h]);else this.onadd&&this.onadd.apply(this,[h])}catch(m){setTimeout(function(){throw m;},0)}return f},addRepetitionBlockByIndex:function(a,b){$wf2.addRepetitionBlock.apply(this,[a,b])},removeRepetitionBlock:function(){if(this.repetitionType!=RepetitionElement.REPETITION_BLOCK)throw $wf2.DOMException(9);var a=this.parentNode;a.removeChild(this);$wf2.updateMoveButtons(a);if(this.repetitionTemplate!=null)for(a=0;a<this.repetitionTemplate.repetitionBlocks.length;a++)if(this.repetitionTemplate.repetitionBlocks[a]== this){this.repetitionTemplate.repetitionBlocks.splice(a,1);break}if(this.repetitionTemplate!=null){var b;try{if(document.createEvent)b=document.createEvent("UIEvents");else if(document.createEventObject)b=document.createEventObject();RepetitionEvent._upgradeEvent.apply(b);b.initRepetitionEvent("removed",true,false,this);this.repetitionTemplate.dispatchEvent&&this.repetitionTemplate.dispatchEvent(b)}catch(c){b={};RepetitionEvent._upgradeEvent.apply(b);b.initRepetitionEvent("removed",true,false,this)}if((a= this.repetitionTemplate.getAttribute("onremoved"))&&(!this.repetitionTemplate.onremoved||typeof this.repetitionTemplate.onremoved!="function"))this.repetitionTemplate.onremoved=new Function("event",a);else if((a=this.repetitionTemplate.getAttribute("onremove"))&&(!this.repetitionTemplate.onremove||typeof this.repetitionTemplate.onremove!="function"))this.repetitionTemplate.onremove=new Function("event",a);try{if(this.repetitionTemplate.onremoved)this.repetitionTemplate.onremoved.apply(this,[b]);else this.repetitionTemplate.onremove&& this.repetitionTemplate.onremove.apply(this,[b])}catch(d){setTimeout(function(){throw d;},0)}}if(this.repetitionTemplate!=null){this.repetitionTemplate.repetitionBlocks.length<this.repetitionTemplate.repeatMin&&this.repetitionTemplate.repetitionBlocks.length<this.repetitionTemplate.repeatMax&&this.repetitionTemplate.addRepetitionBlock();if(this.repetitionTemplate.repetitionBlocks.length<this.repetitionTemplate.repeatMax){b=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["button"], "type","add"]);for(a=0;a<b.length;a++)if(b[a].htmlTemplate==this.repetitionTemplate)b[a].disabled=false}}},moveRepetitionBlock:function(a){if(this.repetitionType!=RepetitionElement.REPETITION_BLOCK)throw $wf2.DOMException(9);if(!(a==0||this.parentNode==null)){var b=this;if(this.repetitionTemplate){for(var c=0,d=this.repetitionTemplate.repetitionBlocks;c<d.length&&d[c]!=this;)c++;d.splice(c,1);d.splice(a<0?Math.max(c+a,0):Math.min(c+a,d.length),0,this)}if(a<0)for(;a!=0&&b.previousSibling&&b.previousSibling.repetitionType!= RepetitionElement.REPETITION_TEMPLATE;){b=b.previousSibling;b.repetitionType==RepetitionElement.REPETITION_BLOCK&&a++}else{for(;a!=0&&b.nextSibling&&b.nextSibling.repetitionType!=RepetitionElement.REPETITION_TEMPLATE;){b=b.nextSibling;b.repetitionType==RepetitionElement.REPETITION_BLOCK&&a--}b=b.nextSibling}this.parentNode.insertBefore(this,b);if(this._clickedMoveBtn){this._clickedMoveBtn.focus();this._clickedMoveBtn=null}$wf2.updateMoveButtons(this.parentNode);if(this.repetitionTemplate!=null){var e; try{if(document.createEvent)e=document.createEvent("UIEvents");else if(document.createEventObject)e=document.createEventObject();RepetitionEvent._upgradeEvent.apply(e);e.initRepetitionEvent("moved",true,false,this);this.repetitionTemplate.dispatchEvent&&this.repetitionTemplate.dispatchEvent(e)}catch(f){e={};RepetitionEvent._upgradeEvent.apply(e);e.initRepetitionEvent("moved",true,false,this)}if((a=this.repetitionTemplate.getAttribute("onmoved"))&&(!this.repetitionTemplate.onmoved||typeof this.repetitionTemplate.onmoved!= "function"))this.repetitionTemplate.onmoved=new Function("event",a);else if(a=this.repetitionTemplate.getAttribute("onmove")){if(!this.repetitionTemplate.onmove||typeof this.repetitionTemplate.onmove!="function")this.repetitionTemplate.onmove=new Function("event",a);var g;if(typeof a=="function"&&(g=a.toString().match(/^\s*function\s+anonymous\(\s*\)\s*\{((?:.|\n)+)\}\s*$/)))this.repetitionTemplate.onmove=new Function("event",g[1])}try{if(this.repetitionTemplate.onmoved)this.repetitionTemplate.onmoved.apply(this, [e]);else this.repetitionTemplate.onmove&&this.repetitionTemplate.onmove.apply(this,[e])}catch(k){setTimeout(function(){throw k;},0)}}}},getRepetitionBlock:function(a){for(;a=a.parentNode;)if(a.repetitionType==RepetitionElement.REPETITION_BLOCK)return a;return null},getHtmlTemplate:function(a){a=a.getAttribute("template");var b;if(a&&(b=document.getElementById(a))&&b.getAttribute("repeat")=="template")return b;return null},updateAddButtons:function(a){a=a?[a]:$wf2.repetitionTemplates;for(var b=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement, [["button"],"type","add"]),c=0;c<b.length;c++)for(var d,e=0;d=a[e];e++)if(b[c].htmlTemplate==d&&d.repetitionBlocks.length>=d.repeatMax)b[c].disabled=true},updateMoveButtons:function(a){var b=[];if(a){var c,d,e;for(a=a.firstChild;a;){a.repetitionType==RepetitionElement.REPETITION_BLOCK&&b.push(a);a=a.nextSibling}for(a=0;e=b[a];a++){var f=$wf2.getElementsByTagNamesAndAttribute.apply(e,[["button"],"type","move-up"]);for(c=0;d=f[c];c++)d.disabled=!(rb=$wf2.getRepetitionBlock(d))||a==0;e=$wf2.getElementsByTagNamesAndAttribute.apply(e, [["button"],"type","move-down"]);for(c=0;d=e[c];c++)d.disabled=!(rb=$wf2.getRepetitionBlock(d))||a==b.length-1}}else{c=[];b=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["*"],"repeat","template",true]);for(a=0;e=b[a];a++)if(!$wf2.arrayHasItem(c,e.parentNode)){$wf2.updateMoveButtons(e.parentNode);c.push(e.parentNode)}}},initNonRepetitionFunctionality:function(a){a=a||document.documentElement;var b,c,d=a.getElementsByTagName("form");for(b=0;c=d[b];b++)if(!(c.checkValidity&& !$wf2.hasBadImplementation)){c.checkValidity=$wf2.formCheckValidity;c.addEventListener?c.addEventListener("submit",$wf2.onsubmitValidityHandler,false):c.attachEvent("onsubmit",$wf2.onsubmitValidityHandler)}d=$wf2.getElementsByTagNames.apply(a,["input","select","textarea","button"]);for(b=0;c=d[b];b++){$wf2.applyValidityInterface(c);$wf2.updateValidityState(c)}c=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["*"],"autofocus"]);a.getAttribute("autofocus")&&c.unshift(a);for(b= 0;b<c.length;b++)$wf2.initAutofocusElement(c[b]);c=$wf2.getElementsByTagNamesAndAttribute.apply(a,[["textarea"],"maxlength"]);a.nodeName.toLowerCase()=="textarea"&&c.unshift(a);for(b=0;b<c.length;b++)c[b].maxLength=parseInt(c[b].getAttribute("maxlength"))},initAutofocusElement:function(a){if(!(a.autofocus===false||a.autofocus===true)){a.autofocus=true;if(!a.disabled){for(var b=a;b&&b.nodeType==1;){if($wf2.getElementStyle(b,"visibility")=="hidden"||$wf2.getElementStyle(b,"display")=="none")return; b=b.parentNode}a.focus()}}},formCheckValidity:function(){var a,b,c=true,d=$wf2.getFormElements.apply(this);for(a=0;b=d[a];a++){var e=b.getAttribute("type")?b.getAttribute("type").toLowerCase():b.type;b.willValidate=!(/(hidden|button|reset|add|remove|move-up|move-down)/.test(e)||!b.name||b.disabled);if(b.checkValidity&&b.willValidate)if(!b.checkValidity()&&b.checkValidity()!=undefined)c=false}c||$wf2.hiliteFirstError();return c},hiliteFirstError:function(){if($wf2.invalidIndicators.length){$wf2.invalidIndicators[0].errorMsg.className+= " wf2_firstErrorMsg";el=$wf2.invalidIndicators[0].target;if(el.style.display=="none"||!el.offsetParent){for(;el&&(el.nodeType!=1||el.style.display=="none"||!el.offsetParent);)el=el.previousSibling;var a=el,b=0;if(a&&a.offsetParent)for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;scrollTo(0,b)}else{setTimeout(function(){el.focus();$wf2.fireEvent(el,"focus")},10);scrollBy(0,$wf2.invalidIndicators[0].errorMsg.offsetHeight)}}},controlCheckValidity:function(){return $wf2.controlCheckValidityOfElement(this)}, controlCheckValidityOfElement:function(a){$wf2.updateValidityState(a);if(a.validity.valid)return true;var b=false,c;try{if(document.createEvent)c=document.createEvent("Events");else if(document.createEventObject)c=document.createEventObject();c.initEvent("invalid",true,true);c.srcElement=a;if(a.dispatchEvent)b=!a.dispatchEvent(c)}catch(d){c={};if(c.initEvent)c.initEvent("invalid",true,true);else{c.type="invalid";c.cancelBubble=false}c.target=c.srcElement=a}var e=a.getAttribute("oninvalid");if(e&& (!a.oninvalid||typeof a.oninvalid!="function"))a.oninvalid=new Function("event",e);try{if(a.oninvalid)b=a.oninvalid.apply(a,[c])===false||b}catch(f){setTimeout(function(){throw f;},0)}c=false;if(a.type=="radio"||a.type=="checkbox")for(e=0;e<$wf2.invalidIndicators.length;e++)if(a.form[a.name][0]==$wf2.invalidIndicators[e].target){c=true;break}!b&&!c&&$wf2.addInvalidIndicator(a);return false},numberRegExp:/^-?\d+(.\d+)?(e-?\d+)?$/,urlRegExp:/^(\w+):(\/\/)?.+$/i,emailRegExp:/^\S+@\S+$/i,copyOf:function(a){if(a!== null&&a!==undefined){var b={};for(i in a)try{b[i]=a[i]}catch(c){}}else b=null;return b},getOriginalAttrNode:function(a,b){var c,d=b+"AttrNode";if($wf2.getDatasetItem(a,d)==null){c=$wf2.copyOf(a.getAttributeNode(b));$wf2.setDatasetItem(a,d,c)}else{c=$wf2.getDatasetItem(a,d);if(c=="null")c=null}return c},updateValidityState:function(a){var b,c,d;b=$wf2.getOriginalAttrNode(a,"min");c=$wf2.getOriginalAttrNode(a,"max");d=$wf2.getOriginalAttrNode(a,"value");a.min=undefined;a.max=undefined;a.step=undefined; a.validity=$wf2.createValidityState();a.validity.customError=!!a.validationMessage;var e=a.getAttribute("type")?a.getAttribute("type").toLowerCase():a.type,f=e=="datetime"||e=="datetime-local"||e=="time",g=e=="date"||e=="month"||e=="week",k=e=="number"||e=="range",h=e=="file",q=f||g||k,m=q||a.nodeName.toLowerCase()=="textarea",n=q||h,l=e=="radio"||e=="checkbox";h=m||h||e=="email"||e=="url"||e=="text"||e=="password"||e=="tel"||l;if(e=="range"){a.min=b&&$wf2.numberRegExp.test(b.value)?Number(b.value): 0;if((!d||!d.specified)&&a.value===""&&!a.wf2ValueProvided){a.setAttribute("value",a.min);a.value=a.min;a.wf2ValueProvided=true}}a.wf2Value=a.value;e=a.getAttribute("type")?a.getAttribute("type").toLowerCase():a.type;a.willValidate=!(/(hidden|button|reset|add|remove|move-up|move-down)/.test(e)||!a.name||a.disabled);if(h&&a.willValidate)if(l){if(a.form&&a.form[a.name]){h=l=false;var o=a.form[a.name];if(o.length==undefined){if(o.getAttributeNode("required"))l=true;if(o.checked)h=true}else for(d=0;d< o.length;d++){if(o[d].getAttributeNode("required"))l=true;if(o[d].checked)h=true}a.validity.valueMissing=l&&!h}}else if(a.getAttributeNode("required"))a.validity.valueMissing=a.value=="";if(!a.validity.valueMissing&&a.value){if(d=a.getAttributeNode("pattern")){d=RegExp("^(?:"+d.value+")$");d.global=false;d.ignoreCase=false;d.multiline=false;if(d)a.validity.patternMismatch=!d.test(a.value)}if(g||f)a.validity.typeMismatch=(a.wf2Value=$wf2.parseISO8601(a.value,e))==null;else switch(e){case "number":case "range":a.validity.typeMismatch= !$wf2.numberRegExp.test(a.value);break;case "email":a.validity.typeMismatch=!$wf2.emailRegExp.test(a.value);break;case "url":a.validity.typeMismatch=!$wf2.urlRegExp.test(a.value)}if(!a.validity.patternMismatch&&!a.validity.typeMismatch){if(n)if(k){if(e=="range")a.max=c&&$wf2.numberRegExp.test(c.value)?Number(c.value):100;else{if(b&&$wf2.numberRegExp.test(b.value))a.min=Number(b.value);if(c&&$wf2.numberRegExp.test(c.value))a.max=Number(c.value)}a.validity.rangeUnderflow=a.min!=undefined&&Number(a.value)< a.min;a.validity.rangeOverflow=a.max!=undefined&&Number(a.value)>a.max}else if(e=="file"){a.min=b&&/^\d+$/.test(b.value)?Number(b.value):0;a.max=c&&/^\d+$/.test(c.value)?Number(c.value):1}else{if(b){a.min=$wf2.parseISO8601(b.value,e);a.validity.rangeUnderflow=a.min&&a.wf2Value<a.min}if(c){a.max=$wf2.parseISO8601(c.value,e);a.validity.rangeOverflow=a.max&&a.wf2Value>a.max}}if(q&&!a.validity.rangeUnderflow&&!a.validity.rangeOverflow){g=$wf2.getOriginalAttrNode(a,"step");a.step=g?g.value=="any"?"any": $wf2.numberRegExp.test(g.value)&&g.value>0?Number(g.value):f?60:1:f?60:1;if(a.step!="any"){a.wf2StepDatum=null;a.wf2StepDatum=b?a.min:c?a.max:$wf2.zeroPoint[e]?$wf2.zeroPoint[e]:0;b=a.step;if(e=="month"&&a.wf2StepDatum&&a.wf2StepDatum.getUTCFullYear){e=a.wf2StepDatum.getUTCFullYear()*12+a.wf2StepDatum.getUTCMonth();c=a.wf2Value.getUTCFullYear()*12+a.wf2Value.getUTCMonth();a.validity.stepMismatch=(c-e)%b!=0}else{switch(e){case "datetime":case "datetime-local":case "time":b=parseInt(b*1E3);break;case "date":b= parseInt(b*24*60*60*1E3);break;case "week":b=parseInt(b*7*24*60*60*1E3)}a.validity.stepMismatch=Math.round((a.wf2Value-a.wf2StepDatum)*1E3)%Math.round(b*1E3)!=0}}}}if(m&&a.maxLength>=0&&a.value!=a.defaultValue){m=a.value;a.wf2ValueLength=m.length;for(d=1;d<m.length;d++)if(m[d]==="\n"&&m[d-1]!=="\r"||m[d]=="\r"&&m[d+1]&&m[d+1]!=="\n")a.wf2ValueLength++;a.validity.tooLong=a.wf2ValueLength>a.maxLength}}a.validity.valid=!$wf2.hasInvalidState(a.validity)},applyValidityInterface:function(a){if($wf2.hasBadImplementation){if(a.type== "submit"||a.type=="button")a.formNoValidate=true}else if(a.validity&&a.validity.typeMismatch!==undefined)return a;a.validationMessage="";a.validity=$wf2.createValidityState();a.willValidate=true;var b=a.nodeName.toLowerCase();if(b=="button"||b=="fieldset"){a.setCustomValidity=function(){throw $wf2.DOMException(9);};a.checkValidity=function(){return true};return a}if(!a.setCustomValidity)a.setCustomValidity=$wf2.controlSetCustomValidity;a.checkValidity=$wf2.controlCheckValidity;if(/(hidden|button|reset|add|remove|move-up|move-down)/.test(a.getAttribute("type")? a.getAttribute("type").toLowerCase():a.type)||!a.name||a.disabled)a.willValidate=false;else if(window.RepetitionElement)for(b=a;b=b.parentNode;)if(b.repetitionType==RepetitionElement.REPETITION_TEMPLATE){a.willValidate=false;break}return a},onsubmitValidityHandler:function(a){for(var b=a.currentTarget||a.srcElement,c=0;c<$wf2.callBeforeValidation.length;c++)$wf2.callBeforeValidation[c](a);if(b.checkValidity())b=a.returnValue=true;else{a.preventDefault&&a.preventDefault();b=a.returnValue=false}for(c= 0;c<$wf2.callAfterValidation.length;c++)$wf2.callAfterValidation[c](a,b);return b},controlSetCustomValidity:function(a){if(a){this.validationMessage=String(a);this.validity.customError=true}else{this.validationMessage="";this.validity.customError=false}this.validity.valid=!$wf2.hasInvalidState(this.validity)},hasInvalidState:function(a){return a.typeMismatch||a.rangeUnderflow||a.rangeOverflow||a.stepMismatch||a.tooLong||a.patternMismatch||a.valueMissing||a.customError},createValidityState:function(){return{typeMismatch:false, rangeUnderflow:false,rangeOverflow:false,stepMismatch:false,tooLong:false,patternMismatch:false,valueMissing:false,customError:false,valid:true}},invalidIndicators:[],indicatorTimeoutId:null,indicatorIntervalId:null,stepUnits:{datetime:"second","datetime-local":"second",time:"second",date:"day",week:"week",month:"month"},invalidMessages:{valueMissing:"A value must be supplied or selected.",typeMismatch:"The value is invalid for %s type.",rangeUnderflow:"The value must be equal to or greater than %s.", rangeOverflow:"The value must be equal to or less than %s.",stepMismatch:"The value has a step mismatch; it must be a certain number multiples of %s from %s.",tooLong:"The value is too long. The field may have a maximum of %s characters but you supplied %s. Note that each line-break counts as two characters.",patternMismatch:"The value is not in the format required."},valueToWF2Type:function(a,b){switch(String(b).toLowerCase()){case "datetime":case "datetime-local":case "date":case "month":case "week":case "time":return $wf2.dateToISO8601(a, b);default:return a}},addInvalidIndicator:function(a){var b=document.createElement("div");b.className="wf2_errorMsg";b.id=(a.id||a.name)+"_wf2_errorMsg";b.onmousedown=function(){this.parentNode.removeChild(this)};var c=a.getAttribute("type")?a.getAttribute("type").toLowerCase():a.type,d=document.createElement("ol");a.validity.valueMissing&&d.appendChild($wf2.createLI($wf2.invalidMessages.valueMissing));a.validity.typeMismatch&&d.appendChild($wf2.createLI($wf2.invalidMessages.typeMismatch.replace(/%s/, c)));a.validity.rangeUnderflow&&d.appendChild($wf2.createLI($wf2.invalidMessages.rangeUnderflow.replace(/%s/,$wf2.valueToWF2Type(a.min,c))));a.validity.rangeOverflow&&d.appendChild($wf2.createLI($wf2.invalidMessages.rangeOverflow.replace(/%s/,$wf2.valueToWF2Type(a.max,c))));if(a.validity.stepMismatch)d.appendChild($wf2.createLI($wf2.invalidMessages.stepMismatch.replace(/%s/,a.step+($wf2.stepUnits[c]?" "+$wf2.stepUnits[c]+"(s)":"")).replace(/%s/,$wf2.valueToWF2Type(a.wf2StepDatum,c))));if(a.validity.tooLong)d.appendChild($wf2.createLI($wf2.invalidMessages.tooLong.replace(/%s/, a.maxLength).replace(/%s/,a.wf2ValueLength?a.wf2ValueLength:a.value.length)));if(a.validity.patternMismatch)d.appendChild($wf2.createLI($wf2.invalidMessages.patternMismatch.replace(/%s/,a.title?a.title:' "'+a.getAttribute("pattern")+'"')));a.validity.customError&&d.appendChild($wf2.createLI(a.validationMessage));if(d.childNodes.length==1)d.className="single";b.appendChild(d);c=document.body?document.body:document.documentElement;$wf2.invalidIndicators.length?c.insertBefore(b,$wf2.invalidIndicators[$wf2.invalidIndicators.length- 1].errorMsg):c.insertBefore(b,null);for(c=a;c&&(c.nodeType!=1||c.style.display=="none"||c.style.visibility=="hidden"||!c.offsetParent);)c=c.parentNode;d=left=0;var e=c;if(e&&e.offsetParent){left=e.offsetLeft;for(d=e.offsetTop;e=e.offsetParent;){left+=e.offsetLeft;d+=e.offsetTop}d+=c.offsetHeight}b.style.top=d+"px";b.style.left=left+"px";$wf2.invalidIndicators.push({target:a,errorMsg:b});a.className.match(/\bwf2_invalid\b/)||(a.className+=" wf2_invalid");if($wf2.indicatorIntervalId==null){$wf2.indicatorIntervalId= setInterval(function(){for(var f,g=0;f=$wf2.invalidIndicators[g];g++)if(f.target.className.match(/\bwf2_invalid\b/))f.target.className=f.target.className.replace(/\s?wf2_invalid/,"");else f.target.className+=" wf2_invalid"},500);setTimeout(function(){for(var f=0;f<$wf2.callAfterValidation.length;f++)$wf2.callAfterValidation[f](null,false)},1);$wf2.indicatorTimeoutId=setTimeout($wf2.clearInvalidIndicators,4E3)}},clearInvalidIndicators:function(){clearTimeout($wf2.indicatorTimeoutId);$wf2.indicatorTimeoutId= null;clearInterval($wf2.indicatorIntervalId);$wf2.indicatorIntervalId=null;for(var a;a=$wf2.invalidIndicators[0];){a.errorMsg&&a.errorMsg.parentNode&&a.errorMsg.parentNode.removeChild(a.errorMsg);a=a.target;a.className=a.className.replace(/\s?wf2_invalid/,"");$wf2.invalidIndicators.shift()}},cloneNode_customAttrs:{type:1,template:1,repeat:1,"repeat-template":1,"repeat-min":1,"repeat-max":1,"repeat-start":1,value:1,"class":1,required:1,pattern:1,form:1,autocomplete:1,autofocus:1,inputmode:1,max:1, min:1,step:1,onmoved:1,onadded:1,onremoved:1,onadd:1,onremove:1,onmove:1},cloneNode_skippedAttrs:{name:1,"class":1,"for":1,style:1,checked:1,addRepetitionBlock:1,addRepetitionBlockByIndex:1,moveRepetitionBlock:1,removeRepetitionBlock:1,repetitionBlocks:1,setCustomValidity:1,checkValidity:1,validity:1,validationMessage:1,willValidate:1,wf2StepDatum:1,wf2Value:1,wf2Initialized:1,wf2ValueLength:1},cloneNode_rtEventHandlerAttrs:{onmoved:1,onadded:1,onremoved:1,onadd:1,onremove:1,onmove:1},cloneNode:function(a, b,c){c||(c=0);var d,e,f;switch(a.nodeType){case 1:var g=a.getAttribute("repeat")=="template";g&&c++;d=[];if(a.name)d.name=b?b(a.name):a.name;if(a.type=="radio")d.type=a.type;if(a.checked)d.checked="checked";d=$wf2.createElement(a.nodeName,d);for(e=0;f=a.attributes[e];e++)if((f.specified||$wf2.cloneNode_customAttrs[f.name])&&!$wf2.cloneNode_skippedAttrs[f.name]&&(!g||c>1||!$wf2.cloneNode_rtEventHandlerAttrs[f.name]))if(c<2&&f.name.indexOf("on")===0&&typeof a[f.name]=="function"){var k=b(a[f.name].toString().match(/{((?:.|\n)+)}/)[1]); k=b(k);d[f.name]=new Function("event",k)}else{k=a.getAttribute(f.name);k=b?b(k):k;d.setAttribute(f.name,k)}if(a.className){g=b?b(a.className):a.className;if(d.getAttributeNode("class"))for(e=0;e<d.attributes.length;e++){if(d.attributes[e].name=="class")d.attributes[e].value=g}else d.setAttribute("class",g)}if(!/\bdisabled\b/.test(a.className))d.disabled=false;if(a.style&&a.style.cssText)d.style.cssText=b?b(a.style.cssText):a.style.cssText;if(a.nodeName&&a.nodeName.toLowerCase()=="label"&&a.htmlFor)d.htmlFor= b?b(a.htmlFor):a.htmlFor;if(d.nodeName.toLowerCase()=="option"){d.selected=a.selected;d.defaultSelected=a.defaultSelected}for(e=0;e<a.childNodes.length;e++)d.appendChild($wf2.cloneNode(a.childNodes[e],b,c));break;case 3:case 4:d=document.createTextNode(a.data);break;case 8:d=document.createComment(a.data);break;default:d=a.cloneNode(true)}return d},getFormElements:function(){for(var a=[],b=$wf2.getElementsByTagNames.apply(this,["input","output","select","textarea","button"]),c=0;c<b.length;c++){for(var d= b[c].parentNode;d&&d.nodeType==1&&d.getAttribute("repeat")!="template";)d=d.parentNode;if(!d||d.nodeType!=1)a.push(b[c])}return a},loadDataURI:function(a){a=a.data||a.getAttribute("data");if(!a)return null;var b=null,c;try{if(c=a.match(/^data:[^,]*xml[^,]*,((?:.|\n)+)/)){var d=decodeURI(c[1].replace(/%3D/ig,"=").replace(/%3A/ig,":").replace(/%2F/ig,"/"));if(window.DOMParser)b=(new DOMParser).parseFromString(d,"text/xml");else if(window.ActiveXObject){b=new ActiveXObject("Microsoft.XMLDOM");b.async= "false";b.loadXML(d)}}else{$wf2.xhr.open("GET",a,false);$wf2.xhr.send(null);b=$wf2.xhr.responseXML}}catch(e){return null}return b},getAttributeByName:function(a,b){var c,d=a.attributes;for(c=0;c<d.length;c++){var e=d[c];if(e.nodeName==b&&e.specified)return e}return null},getAttributeValue:function(a,b){var c=$wf2.getAttributeByName(a,b);return c!=null?c.nodeValue:null},setAttributeValue:function(a,b,c){a=$wf2.getAttributeByName(a,b);if(a!=null)a.nodeValue=c},getDatasetItem:function(a,b){var c=$wf2.getAttributeValue(a, "data-"+b);c||(c=$wf2.getAttributeValue(a,"data-"+b.toLowerCase()));c||(c=a["data-"+b.toLowerCase()]);return c},setDatasetItem:function(a,b,c){b="data-"+b.toLowerCase();$wf2.setAttributeValue(a,b,c);if($wf2.getAttributeValue(a,b)==null)a[b]=c},getElementsByTagNames:function(){var a,b,c=[];if(document.evaluate){a=[];for(b=0;b<arguments.length;b++)a.push(".//"+arguments[b]);a=document.evaluate(a.join("|"),this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(b=0;b<a.snapshotLength;b++)c.push(a.snapshotItem(b))}else{for(b= 0;b<arguments.length;b++){a=this.getElementsByTagName(arguments[b]);for(var d=0;d<a.length;d++)c.push(a[d])}$wf2.sortNodes&&c.sort($wf2.sortNodes)}return c},getElementsByTagNamesAndAttribute:function(a,b,c,d){var e,f,g,k,h=[];if(document.evaluate){e="";if(b)e="[@"+b+(c?(d?"!=":"=")+'"'+c+'"':"")+"]";b=[];for(g=0;g<a.length;g++)b.push(".//"+a[g]+e);e=document.evaluate(b.join("|"),this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(g=0;g<e.snapshotLength;g++)h.push(e.snapshotItem(g))}else{for(g= 0;g<a.length;g++){e=this.getElementsByTagName(a[g]);for(k=0;f=e[k];k++){var q=f.getAttributeNode(b),m=f.getAttribute(b);if(!b||q&&(c===undefined||(d?m!=c:m==c)))h.push(f)}}$wf2.sortNodes&&h.sort($wf2.sortNodes)}return h},arrayHasItem:function(a,b){for(var c=0;c<a.length;c++)if(a[c]==b)return true;return false},getElementStyle:function(a,b){return a.currentStyle?a.currentStyle[b]:window.getComputedStyle?getComputedStyle(a,"").getPropertyValue(b):a.style?a.style[b]:""},createElement:function(){try{var a= document.createElement('<div name="foo">');if(a.tagName.toLowerCase()!="div"||a.name!="foo")throw"create element error";return function(c,d){var e="<"+c,f;for(f in d)e+=" "+f+'="'+d[f]+'"';e+=">";if(c.toLowerCase()!="input")e+="</"+c+">";return document.createElement(e)}}catch(b){return function(c,d){var e=document.createElement(c),f;for(f in d)e.setAttribute(f,d[f]);return e}}}(),sortNodes:function(){var a=document.documentElement.firstChild;if(a.sourceIndex)return function(b,c){return b.sourceIndex- c.sourceIndex};else if(a.compareDocumentPosition)return function(b,c){return 3-(b.compareDocumentPosition(c)&6)}}(),createLI:function(a){var b=document.createElement("li");b.appendChild(document.createTextNode(a));return b},ISO8601RegExp:/^(?:(\d\d\d\d)-(W(0[1-9]|[1-4]\d|5[0-2])|(0\d|1[0-2])(-(0\d|[1-2]\d|3[0-1])(T(0\d|1\d|2[0-4]):([0-5]\d)(:([0-5]\d)(\.(\d+))?)?(Z)?)?)?)|(0\d|1\d|2[0-4]):([0-5]\d)(:([0-5]\d)(\.(\d+))?)?)$/,parseISO8601:function(a,b){var c=$wf2.validateDateTimeType(a,b);if(!c)return null; var d=new Date(0),e=8;if(c[15]){if(b&&b!="time")return null;e=15}else{d.setUTCFullYear(c[1]);if(c[3]){if(b&&b!="week")return null;d.setUTCDate(d.getUTCDate()+(8-d.getUTCDay())%7+(c[3]-1)*7);return d}else{d.setUTCMonth(c[4]-1);c[6]&&d.setUTCDate(c[6])}}c[e+0]&&d.setUTCHours(c[e+0]);c[e+1]&&d.setUTCMinutes(c[e+1]);c[e+2]&&d.setUTCSeconds(c[e+3]);c[e+4]&&d.setUTCMilliseconds(Math.round(Number(c[e+4])*1E3));c[4]&&c[e+0]&&!c[e+6]&&d.setUTCMinutes(d.getUTCMinutes()+d.getTimezoneOffset());return d},validateDateTimeType:function(a, b){var c=false,d=$wf2.ISO8601RegExp.exec(a);if(!d||!b)return d;b=b.toLowerCase();if(b=="week")c=d[2].toString().indexOf("W")===0;else if(b=="time")c=!!d[15];else if(b=="month")c=!d[5];else if(d[6])if((new Date(d[1],d[4]-1,d[6])).getMonth()!=d[4]-1)c=false;else switch(b){case "date":c=d[4]&&!d[7];break;case "datetime":c=!!d[14];break;case "datetime-local":c=d[7]&&!d[14]}return c?d:null},zeroPad:function(a,b){b||(b=2);for(var c=a.toString();c.length<b;)c="0"+c;return c},dateToISO8601:function(a,b){b= String(b).toLowerCase();var c="";if(a.getUTCMilliseconds())c="."+$wf2.zeroPad(a.getUTCMilliseconds(),3).replace(/0+$/,"");switch(b){case "date":return a.getUTCFullYear()+"-"+$wf2.zeroPad(a.getUTCMonth()+1)+"-"+$wf2.zeroPad(a.getUTCDate());case "datetime-local":return a.getFullYear()+"-"+$wf2.zeroPad(a.getMonth()+1)+"-"+$wf2.zeroPad(a.getDate())+"T"+$wf2.zeroPad(a.getHours())+":"+$wf2.zeroPad(a.getMinutes())+":"+$wf2.zeroPad(a.getMinutes())+c+"Z";case "month":return a.getUTCFullYear()+"-"+$wf2.zeroPad(a.getUTCMonth()+ 1);case "week":c=$wf2.parseISO8601(a.getUTCFullYear()+"-W01");return a.getUTCFullYear()+"-W"+$wf2.zeroPad((a.valueOf()-c.valueOf())/6048E5+1);case "time":return $wf2.zeroPad(a.getUTCHours())+":"+$wf2.zeroPad(a.getUTCMinutes())+":"+$wf2.zeroPad(a.getUTCMinutes())+c;default:return a.getUTCFullYear()+"-"+$wf2.zeroPad(a.getUTCMonth()+1)+"-"+$wf2.zeroPad(a.getUTCDate())+"T"+$wf2.zeroPad(a.getUTCHours())+":"+$wf2.zeroPad(a.getUTCMinutes())+":"+$wf2.zeroPad(a.getUTCMinutes())+c+"Z"}},fireEvent:function(a, b){if(a)if(document.createEventObject)return a.fireEvent("on"+b,$wf2.globalEvent);else{$wf2.globalEvent.initEvent(b,true,true);return!a.dispatchEvent($wf2.globalEvent)}},DOMException:function(a){var b="DOMException: ";switch(a){case 1:b+="INDEX_SIZE_ERR";break;case 9:b+="NOT_SUPPORTED_ERR";break;case 11:b+="INVALID_STATE_ERR";break;case 12:b+="SYNTAX_ERR";break;case 13:b+="INVALID_MODIFICATION_ERR"}b=Error(b);b.code=a;b.name="DOMException";b.INDEX_SIZE_ERR=1;b.NOT_SUPPORTED_ERR=9;b.INVALID_STATE_ERR= 11;b.SYNTAX_ERR=12;b.INVALID_MODIFICATION_ERR=13;return b}};var RepetitionElement={REPETITION_NONE:0,REPETITION_TEMPLATE:1,REPETITION_BLOCK:2},RepetitionEvent={_upgradeEvent:function(){this.initRepetitionEvent=RepetitionEvent.initRepetitionEvent;this.initRepetitionEventNS=RepetitionEvent.initRepetitionEventNS},initRepetitionEvent:function(a,b,c,d){if(this.initEvent)this.initEvent(a,b,c);else{this.type=a;if(!this.preventDefault)this.preventDefault=function(){this.returnValue=false};if(!this.stopPropagation)this.stopPropagation= function(){this.cancelBubble=true}}this.relatedNode=this.element=d},initRepetitionEventNS:function(){throw Error("NOT IMPLEMENTED: RepetitionEvent.initRepetitionEventNS");}};if(window.Element&&Element.prototype){Element.prototype.REPETITION_NONE=RepetitionElement.REPETITION_NONE;Element.prototype.REPETITION_TEMPLATE=RepetitionElement.REPETITION_TEMPLATE;Element.prototype.REPETITION_BLOCK=RepetitionElement.REPETITION_BLOCK;Element.prototype.repetitionType=RepetitionElement.REPETITION_NONE;Element.prototype.repetitionIndex= 0;Element.prototype.repetitionTemplate=null;Element.prototype.repetitionBlocks=null;Element.prototype.repeatStart=1;Element.prototype.repeatMin=0;Element.prototype.repeatMax=Number.MAX_VALUE;Element.prototype.addRepetitionBlock=$wf2.addRepetitionBlock;Element.prototype.addRepetitionBlockByIndex=$wf2.addRepetitionBlockByIndex;Element.prototype.moveRepetitionBlock=$wf2.moveRepetitionBlock;Element.prototype.removeRepetitionBlock=$wf2.removeRepetitionBlock}if(document.addEventListener){document.addEventListener("DOMNodeInsertedIntoDocument", function(a){a.target.nodeType==1&&a.target.hasAttribute("autofocus")&&$wf2.initAutofocusElement(a.target)},false);document.addEventListener("DOMAttrModified",function(a){if(a.attrName=="autofocus")if(a.attrChange==a.ADDITION)$wf2.initAutofocusElement(a.target);else if(a.attrChange==a.REMOVAL)a.target.autofocus=false},false)}(function(){for(var a,b=document.documentElement.getElementsByTagName("script"),c=0;c<b.length;c++)if(a=b[c].src.match(/^(.*)webforms2[^\/]+$/))$wf2.libpath=a[1];if(document.body)$wf2.onDOMContentLoaded(); else{a=0;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){$wf2.onDOMContentLoaded()},false);window.addEventListener("load",function(){$wf2.onDOMContentLoaded()},false);a=1}if(/WebKit/i.test(navigator.userAgent)){var d=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(d);delete d;$wf2.onDOMContentLoaded()}},10);a=1}else if(/MSIE/i.test(navigator.userAgent)&&!document.addEventListener&&window.attachEvent){window.attachEvent("onload", function(){$wf2.onDOMContentLoaded()});document.write("<script defer src='"+$wf2.libpath+"webforms2-msie.js'><\/script>");document.write("<script id='__wf2_ie_onload' defer src='//:'><\/script>");a=document.getElementById("__wf2_ie_onload");a.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);$wf2.onDOMContentLoaded();if($wf2.repetitionTemplates.length==0)$wf2.isInitialized=false}};a=null;a=1}if(!a)if(window.onload){var e=window.onload;window.onload=function(){$wf2.onDOMContentLoaded(); e()}}else window.onload=function(){$wf2.onDOMContentLoaded()}}})()}else if(document.addEventListener&&($wf2.oldRepetitionEventModelEnabled===undefined||$wf2.oldRepetitionEventModelEnabled)){$wf2.oldRepetitionEventModelEnabled=true;(function(){function a(c){if($wf2.oldRepetitionEventModelEnabled){if(!c.element&&c.relatedNode)c.element=c.relatedNode;if(c.element&&c.element.repetitionTemplate){var d=c.element.repetitionTemplate,e="on"+c.type,f=d.getAttribute(e)||d.getAttribute(b[c.type]);if(f&&(!d[e]|| typeof d[e]!="function"))d[e]=new Function("event",f);if(c.element.repetitionTemplate[e])c.element.repetitionTemplate[e](c);else c.element.repetitionTemplate[b[c.type]]&&c.element.repetitionTemplate[b[c.type]](c)}}}var b={added:"onadd",removed:"onremove",moved:"onmove"};document.addEventListener("added",a,false);document.addEventListener("removed",a,false);document.addEventListener("moved",a,false)})()}};