html5forms-rails 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG.md +5 -0
  2. data/Gemfile +11 -0
  3. data/README.md +208 -0
  4. data/Rakefile +49 -0
  5. data/VERSION +1 -0
  6. data/demos/html5-form-demo.html +79 -0
  7. data/html5forms-rails.gemspec +142 -0
  8. data/lib/html5forms.rb +6 -0
  9. data/vendor/assets/images/colorpicker/blank.gif +0 -0
  10. data/vendor/assets/images/colorpicker/colorpicker_background.png +0 -0
  11. data/vendor/assets/images/colorpicker/colorpicker_hex.png +0 -0
  12. data/vendor/assets/images/colorpicker/colorpicker_hsb_b.png +0 -0
  13. data/vendor/assets/images/colorpicker/colorpicker_hsb_h.png +0 -0
  14. data/vendor/assets/images/colorpicker/colorpicker_hsb_s.png +0 -0
  15. data/vendor/assets/images/colorpicker/colorpicker_indic.gif +0 -0
  16. data/vendor/assets/images/colorpicker/colorpicker_overlay.png +0 -0
  17. data/vendor/assets/images/colorpicker/colorpicker_rgb_b.png +0 -0
  18. data/vendor/assets/images/colorpicker/colorpicker_rgb_g.png +0 -0
  19. data/vendor/assets/images/colorpicker/colorpicker_rgb_r.png +0 -0
  20. data/vendor/assets/images/colorpicker/colorpicker_select.gif +0 -0
  21. data/vendor/assets/images/colorpicker/colorpicker_submit.png +0 -0
  22. data/vendor/assets/images/colorpicker/custom_background.png +0 -0
  23. data/vendor/assets/images/colorpicker/custom_hex.png +0 -0
  24. data/vendor/assets/images/colorpicker/custom_hsb_b.png +0 -0
  25. data/vendor/assets/images/colorpicker/custom_hsb_h.png +0 -0
  26. data/vendor/assets/images/colorpicker/custom_hsb_s.png +0 -0
  27. data/vendor/assets/images/colorpicker/custom_indic.gif +0 -0
  28. data/vendor/assets/images/colorpicker/custom_rgb_b.png +0 -0
  29. data/vendor/assets/images/colorpicker/custom_rgb_g.png +0 -0
  30. data/vendor/assets/images/colorpicker/custom_rgb_r.png +0 -0
  31. data/vendor/assets/images/colorpicker/custom_submit.png +0 -0
  32. data/vendor/assets/images/colorpicker/select.png +0 -0
  33. data/vendor/assets/images/colorpicker/select2.png +0 -0
  34. data/vendor/assets/images/colorpicker/slider.png +0 -0
  35. data/vendor/assets/images/h5f/form_validation.png +0 -0
  36. data/vendor/assets/images/html5form-shim/asterisk.png +0 -0
  37. data/vendor/assets/images/html5form-shim/down.png +0 -0
  38. data/vendor/assets/images/html5form-shim/fail.png +0 -0
  39. data/vendor/assets/images/html5form-shim/ok.png +0 -0
  40. data/vendor/assets/images/html5forms/jscolor/arrow.gif +0 -0
  41. data/vendor/assets/images/html5forms/jscolor/cross.gif +0 -0
  42. data/vendor/assets/images/html5forms/jscolor/hs.png +0 -0
  43. data/vendor/assets/images/html5forms/jscolor/hv.png +0 -0
  44. data/vendor/assets/images/html5forms/slider/slider-1.png +0 -0
  45. data/vendor/assets/images/html5forms/slider/slider-disabled-1.png +0 -0
  46. data/vendor/assets/images/html5forms/slider/slider-disabled.png +0 -0
  47. data/vendor/assets/images/html5forms/slider/slider.png +0 -0
  48. data/vendor/assets/javascripts/colorpicker.js +484 -0
  49. data/vendor/assets/javascripts/colorpicker.min.js +9 -0
  50. data/vendor/assets/javascripts/h5f.js +328 -0
  51. data/vendor/assets/javascripts/h5f.min.js +4 -0
  52. data/vendor/assets/javascripts/html5forms/EventHelpers.min.js +15 -0
  53. data/vendor/assets/javascripts/html5forms/autocomplete.min.js +1 -0
  54. data/vendor/assets/javascripts/html5forms/cssQuery-p.min.js +6 -0
  55. data/vendor/assets/javascripts/html5forms/dev/EventHelpers.js +486 -0
  56. data/vendor/assets/javascripts/html5forms/dev/autocomplete.js +387 -0
  57. data/vendor/assets/javascripts/html5forms/dev/cssQuery-p.js +6 -0
  58. data/vendor/assets/javascripts/html5forms/dev/html5.js +121 -0
  59. data/vendor/assets/javascripts/html5forms/dev/html5Forms.js +892 -0
  60. data/vendor/assets/javascripts/html5forms/dev/html5Widgets.js +1417 -0
  61. data/vendor/assets/javascripts/html5forms/dev/jscolor.js +840 -0
  62. data/vendor/assets/javascripts/html5forms/dev/slider.js +797 -0
  63. data/vendor/assets/javascripts/html5forms/dev/timer.js +137 -0
  64. data/vendor/assets/javascripts/html5forms/dev/visibleIf.js +1100 -0
  65. data/vendor/assets/javascripts/html5forms/html5.min.js +2 -0
  66. data/vendor/assets/javascripts/html5forms/html5Forms.min.js +1 -0
  67. data/vendor/assets/javascripts/html5forms/html5Widgets.min.js +20 -0
  68. data/vendor/assets/javascripts/html5forms/jscolor.min.js +10 -0
  69. data/vendor/assets/javascripts/html5forms/slider.min.js +25 -0
  70. data/vendor/assets/javascripts/html5forms/timer.min.js +1 -0
  71. data/vendor/assets/javascripts/html5forms/visibleIf.min.js +19 -0
  72. data/vendor/assets/javascripts/html5forms.fallback.js +115 -0
  73. data/vendor/assets/javascripts/html5forms.fallback.min.js +11 -0
  74. data/vendor/assets/javascripts/jquery.html5form-shim.js +402 -0
  75. data/vendor/assets/javascripts/jquery.html5form.min.js +4 -0
  76. data/vendor/assets/javascripts/jquery.placehold.min.js +7 -0
  77. data/vendor/assets/javascripts/ui.spinner.js +649 -0
  78. data/vendor/assets/javascripts/ui.spinner.min.js +7 -0
  79. data/vendor/assets/javascripts/webforms2/webforms2-msie.js +1 -0
  80. data/vendor/assets/javascripts/webforms2/webforms2-p.js +14 -0
  81. data/vendor/assets/javascripts/webforms2/webforms2.js +14 -0
  82. data/vendor/assets/javascripts/webforms2/webforms2_src.js +3195 -0
  83. data/vendor/assets/stylesheets/colorpicker.css +161 -0
  84. data/vendor/assets/stylesheets/h5f.css +86 -0
  85. data/vendor/assets/stylesheets/html5form-shim.css +109 -0
  86. data/vendor/assets/stylesheets/html5forms/number.css +35 -0
  87. data/vendor/assets/stylesheets/html5forms/slider.css +169 -0
  88. data/vendor/assets/stylesheets/html5forms/slider_ie.css +41 -0
  89. data/vendor/assets/stylesheets/html5forms/visibleIf.css +23 -0
  90. data/vendor/assets/stylesheets/html5forms.layout.css +116 -0
  91. data/vendor/assets/stylesheets/ui.spinner.css +3 -0
  92. data/vendor/assets/stylesheets/webforms2.css +42 -0
  93. metadata +221 -0
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Web Forms 2.0 Cross-browser Implementation <http://code.google.com/p/webforms2/>
3
+ * Version: 0.5.4 (2008-07-29)
4
+ * Copyright: 2007, Weston Ruter <http://weston.ruter.net/>
5
+ * License: GNU General Public License, Free Software Foundation
6
+ * <http://creativecommons.org/licenses/GPL/2.0/>
7
+ *
8
+ * The comments contained in this code are largely quotations from the
9
+ * WebForms 2.0 specification: <http://whatwg.org/specs/web-forms/current-work/>
10
+ *
11
+ * Usage: <script type="text/javascript" src="webforms2-p.js"></script>
12
+ */
13
+
14
+ 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)})()}};
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Web Forms 2.0 Cross-browser Implementation <http://code.google.com/p/webforms2/>
3
+ * Version: 0.5.4 (2008-07-29)
4
+ * Copyright: 2007, Weston Ruter <http://weston.ruter.net/>
5
+ * License: GNU General Public License, Free Software Foundation
6
+ * <http://creativecommons.org/licenses/GPL/2.0/>
7
+ *
8
+ * The comments contained in this code are largely quotations from the
9
+ * WebForms 2.0 specification: <http://whatwg.org/specs/web-forms/current-work/>
10
+ *
11
+ * Usage: <script type="text/javascript" src="webforms2.js"></script>
12
+ */
13
+
14
+ 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:new Array,callAfterValidation:new Array,callAfterDOMContentLoaded:new Array, onDOMContentLoaded:function(){if($wf2.isInitialized)return;$wf2.isInitialized=true;var i,j,k,node;if(document.createEventObject)$wf2.globalEvent=document.createEventObject();else if(document.createEvent)$wf2.globalEvent=document.createEvent("HTMLEvents");var style=document.createElement("link");style.setAttribute("type","text/css");style.setAttribute("rel","stylesheet");style.setAttribute("href",$wf2.libpath+"webforms2.css");var parent=document.getElementsByTagName("head")[0];if(!parent)parent=document.getElementsByTagName("*")[0]; parent.insertBefore(style,parent.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(e){try{$wf2.xhr= new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}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(var i=0;i<$wf2.callAfterDOMContentLoaded.length;i++)$wf2.callAfterDOMContentLoaded[i]()},prefillSelectElements:function(){var select,selects=$wf2.getElementsByTagNames.apply(document.documentElement,["select","datalist"]);for(var i=0;select=selects[i];i++){var xmlDoc= $wf2.loadDataURI(select);if(xmlDoc&&xmlDoc.documentElement&&/:?\bselect$/i.test(xmlDoc.documentElement.nodeName)&&xmlDoc.documentElement.namespaceURI=="http://www.w3.org/1999/xhtml"){var root=xmlDoc.documentElement;if(root.getAttribute("type")!="incremental")while(select.lastChild)select.removeChild(select.lastChild);node=root.firstChild;while(node){select.appendChild($wf2.cloneNode(node));node=node.nextSibling}}}},prefillFormElements:function(){var frm,frms=document.getElementsByTagName("form"); for(var i=0;frm=frms[i];i++){var xmlDoc=$wf2.loadDataURI(frm);if(xmlDoc&&xmlDoc.documentElement&&/:?\bformdata$/.test(xmlDoc.documentElement.nodeName)&&xmlDoc.documentElement.namespaceURI=="http://n.whatwg.org/formdata"){var rt;var root=xmlDoc.documentElement;if(root.getAttribute("type")!="incremental")frm.reset();var clr,clrs=root.getElementsByTagName("clear");for(j=0;clr=clrs[j];j++)if(clr.namespaceURI=="http://n.whatwg.org/formdata"&&clr.parentNode==root&&!clr.firstChild&&(rt=document.getElementById(clr.getAttribute("template")))&& rt.getAttribute("repeat")=="template"){var attr,node,next;node=rt.parentNode.firstChild;while(node)if(node.nodeType==1&&(attr=node.getAttributeNode("repeat"))&&attr.value!="template"){next=node.nextSibling;node.parentNode.removeChild(node);node=next}else node=node.nextSibling}var index,rpt,rpts=root.getElementsByTagName("repeat");for(j=0;rpt=rpts[j];j++)if(rpt.namespaceURI=="http://n.whatwg.org/formdata"&&rpt.parentNode==root&&!rpt.firstChild&&(rt=document.getElementById(rpt.getAttribute("template")))&& rt.getAttribute("repeat")=="template"&&/^-?\d+$/.test(index=rpt.getAttribute("index"))){var hasIndex,attr,node,next;node=rt.parentNode.firstChild;while(node){if(node.nodeType==1&&(attr=node.getAttributeNode("repeat"))&&attr.value==index){hasIndex=true;break}node=node.nextSibling}if(!hasIndex)$wf2.addRepetitionBlockByIndex.apply(rt,[null,index])}var fld,flds=root.getElementsByTagName("field");var formElements=$wf2.getFormElements.apply(frm);for(j=0;fld=flds[j];j++){var indexAttr=fld.getAttributeNode("index"); var name=fld.getAttribute("name");if(!name||indexAttr&&!/^\d+$/.test(indexAttr.value))continue;var value="";for(k=0;node=fld.childNodes[k];k++)if(node.nodeType==3||node.nodeType==4)value+=node.data;else break;var ctrl,count=0;for(k=0;ctrl=formElements[k];k++)if(ctrl.type=="image"){if(ctrl.name?ctrl.name+".x"==name||ctrl.name+".y"==name:name=="x"||name=="y")if(!indexAttr||++count-1>=indexAttr.value)break}else if(ctrl.name==name){if(indexAttr){if(++count-1<indexAttr.value)continue}else if((ctrl.type== "radio"||ctrl.type=="checkbox")&&value&&ctrl.value!=value)continue;break}if(ctrl.type=="file"||ctrl.type=="button"||ctrl.type=="image")continue;if(!ctrl.getAttributeNode("multiple")||!ctrl.wf2Prefilled){if(ctrl.type=="checkbox"||ctrl.type=="radio")if(!value)ctrl.checked=false;else if(ctrl.value==value)ctrl.checked=true;else break;else if(ctrl.nodeName.toLowerCase()=="select"){ctrl.selectedIndex=-1;for(var opt,k=0;opt=ctrl.options[k];k++)if(opt.value?opt.value==value:opt.text==value){opt.selected= true;break}}else{ctrl.value=value;$wf2.updateValidityState(ctrl);if(!ctrl.validity.valid){ctrl.value=ctrl.defaultValue;$wf2.updateValidityState(ctrl)}}ctrl.wf2Prefilled=true}else if(ctrl.getAttributeNode("multiple"))for(var opt,k=0;opt=ctrl.options[k];k++)if(!opt.selected&&(opt.value?opt.value==value:opt.text==value)){opt.selected=true;break}}var formElements=$wf2.getFormElements.apply(frm);for(j=0;j<formElements.length;j++);}}},repetitionTemplates:[],constructRepetitionTemplate:function(){if(this.wf2Initialized)return; 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 _attr;this.repeatStart=/^\d+$/.test(_attr=this.getAttribute("repeat-start"))?parseInt(_attr):1;this.repeatMin=/^\d+$/.test(_attr=this.getAttribute("repeat-min"))?parseInt(_attr):0;this.repeatMax=/^\d+$/.test(_attr=this.getAttribute("repeat-max"))?parseInt(_attr): Number.MAX_VALUE;if(!this.addRepetitionBlock)this.addRepetitionBlock=function(refNode,index){return $wf2.addRepetitionBlock.apply(this,[refNode,index])};if(!this.addRepetitionBlockByIndex)this.addRepetitionBlockByIndex=this.addRepetitionBlock;var frm=this;while(frm=frm.parentNode)if(frm.nodeName.toLowerCase()=="form")break;var _templateElements;if(frm&&(_templateElements=$wf2.getElementsByTagNames.apply(this,["button","input","select","textarea","isindex"])).length)for(var el,i=0;el=_templateElements[i];i++)el.disabled= true;var attr,sibling=this.parentNode.firstChild;while(sibling&&sibling!=this){if(sibling.nodeType==1&&(attr=sibling.getAttributeNode("repeat"))&&/^-?\d+$/.test(attr.value)&&!sibling.getAttribute("repeat-template")){sibling.repetitionTemplate=this;sibling.setAttribute("repeat-template",this.id);this.repetitionBlocks.push(sibling)}sibling=sibling.nextSibling}for(var i=0;i<this.repeatStart||this.repetitionBlocks.length<this.repeatMin;i++)if(!this.addRepetitionBlock())break;$wf2.repetitionTemplates.push(this); this.wf2Initialized=true},initRepetitionTemplates:function(parentNode){var repetitionTemplates=$wf2.getElementsByTagNamesAndAttribute.apply(parentNode||document.documentElement,[["*"],"repeat","template"]);for(var i=0,rt;i<repetitionTemplates.length;i++)$wf2.constructRepetitionTemplate.apply(repetitionTemplates[i])},constructRepetitionBlock:function(){if(this.wf2Initialized)return;this.style.display="";this.repetitionType=RepetitionElement.REPETITION_BLOCK;var _attr;this.repetitionIndex=/^\d+$/.test(_attr= this.getAttribute("repeat"))?parseInt(_attr):0;this.repetitionBlocks=null;this.repetitionTemplate=null;var node;if((node=document.getElementById(this.getAttribute("repeat-template")))&&node.getAttribute("repeat")=="template")this.repetitionTemplate=node;else{node=this;while(node=node.nextSibling)if(node.nodeType==1&&node.getAttribute("repeat")=="template"){this.repetitionTemplate=node;break}}if(!this.removeRepetitionBlock)this.removeRepetitionBlock=function(){return $wf2.removeRepetitionBlock.apply(this)}; if(!this.moveRepetitionBlock)this.moveRepetitionBlock=function(distance){return $wf2.moveRepetitionBlock.apply(this,[distance])};this.wf2Initialized=true},initRepetitionBlocks:function(parentNode){var repetitionBlocks=$wf2.getElementsByTagNamesAndAttribute.apply(parentNode||document.documentElement,[["*"],"repeat","template",true]);for(var i=0;i<repetitionBlocks.length;i++)$wf2.constructRepetitionBlock.apply(repetitionBlocks[i])},repetitionButtonDefaultLabels:{add:"Add",remove:"Remove","move-up":"Move-up", "move-down":"Move-down"},constructRepetitionButton:function(btnType){if(this.wf2Initialized)return;this.htmlTemplate=$wf2.getHtmlTemplate(this);if(!this.firstChild)this.appendChild(document.createTextNode($wf2.repetitionButtonDefaultLabels[btnType]));if(btnType!="add")this.disabled=!$wf2.getRepetitionBlock(this);else{var rb;this.disabled=!((rb=$wf2.getRepetitionBlock(this))&&rb.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(btnType,parent){var i;if(!parent)parent=document.documentElement;var inpts=$wf2.getElementsByTagNamesAndAttribute.apply(parent,[["input"],"type",btnType]);for(i=0;i<inpts.length;i++){var btn=document.createElement("button");for(var j=0,attr;attr=inpts[i].attributes[j];j++)btn.setAttribute(attr.nodeName,inpts[i].getAttribute(attr.nodeName)); inpts[i].parentNode.replaceChild(btn,inpts[i]);btn=null}var btns=$wf2.getElementsByTagNamesAndAttribute.apply(parent,[["button"],"type",btnType]);for(var i=0;i<btns.length;i++)$wf2.constructRepetitionButton.apply(btns[i],[btnType])},clickRepetitionButton:function(e){if(e&&e.preventDefault)e.preventDefault();var btn;if(e&&e.target)btn=e.target;else if(window.event)btn=event.srcElement;else if(this.nodeName.toLowerCase()=="button")btn=this;var btnType=String(btn.getAttribute("type")).toLowerCase(); if(btn.onclick){btn._onclick=btn.onclick;btn.removeAttribute("onclick");btn.onclick=null}if(btn.returnValue!==undefined&&!btn.returnValue){btn.returnValue=undefined;return false}if(btn._onclick&&btn.returnValue===undefined){btn.returnValue=btn._onclick(e);if(btn.returnValue!==undefined&&!btn.returnValue){btn.returnValue=undefined;return false}}btn.returnValue=undefined;var block;if(btnType!="add"){block=$wf2.getRepetitionBlock(btn);this.disabled=!block;if(block)if(btnType.indexOf("move")===0){block._clickedMoveBtn= btn;block.moveRepetitionBlock(btnType=="move-up"?-1:1)}else if(btnType=="remove")block.removeRepetitionBlock()}else{var rt;if(btn.htmlTemplate)rt=btn.htmlTemplate;else{block=$wf2.getRepetitionBlock(btn);if(block&&block.repetitionTemplate)rt=block.repetitionTemplate}if(rt)rt.addRepetitionBlock();else btn.disabled=true}return false},addRepetitionBlock:function(refNode,index){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;var node=this;while(node=node.parentNode)if(node.nodeType==1&&node.getAttribute("repeat")=="template")return false;var sibling=this.previousSibling;var currentBlockCount=0;while(sibling!=null){if(sibling.nodeType==1){var repeatAttr,repeatTemplateAttr;repeat=parseInt(sibling.getAttribute("repeat"));repeatTemplateAttr=sibling.getAttributeNode("repeat-template"); if(!isNaN(repeat)&&(!repeatTemplateAttr||repeatTemplateAttr.value==this.id)){this.repetitionIndex=Math.max(this.repetitionIndex,repeat+1);currentBlockCount++}}sibling=sibling.previousSibling}if(this.repeatMax<=currentBlockCount)return null;if(index!==undefined&&index>this.repetitionIndex)this.repetitionIndex=index;var IDAttrName=this.getAttribute("id")?"id":this.getAttribute("name")?"name":"";var IDAttrValue=this.getAttribute(IDAttrName);var block;var replaceValue=this.repetitionIndex;var reTemplateName, processAttr;if(IDAttrValue&&!/\u005B|\u02D1|\u005D|\u00B7/.test(IDAttrValue)){reTemplateName=new RegExp("(\\[|\u02d1)"+IDAttrValue+"(\\]|\u00b7)","g");processAttr=function(attrVal){if(!attrVal)return attrVal;attrVal=attrVal.toString();if(attrVal.indexOf("\ufeff")===0)return attrVal.replace(/^\uFEFF/,"");return attrVal.replace(reTemplateName,replaceValue)}}block=$wf2.cloneNode(this,processAttr);block.wf2Initialized=false;reTemplateName=null;block.setAttribute("repeat",this.repetitionIndex);block.removeAttribute("repeat-min"); block.removeAttribute("repeat-max");block.removeAttribute("repeat-start");if(IDAttrName){block.setAttribute("repeat-template",IDAttrValue);block.removeAttribute(IDAttrName)}if(!refNode){refNode=this;while(refNode.previousSibling&&refNode.previousSibling.repetitionType!=RepetitionElement.REPETITION_BLOCK)refNode=refNode.previousSibling;this.parentNode.insertBefore(block,refNode);this.repetitionBlocks.push(block)}else{refNode.parentNode.insertBefore(block,refNode.nextSibling);this.repetitionBlocks.push(block); if($wf2.sortNodes)this.repetitionBlocks.sort($wf2.sortNodes)}this.repetitionIndex++;$wf2.constructRepetitionBlock.apply(block);$wf2.initRepetitionTemplates(block);$wf2.initRepetitionButtons("add",block);$wf2.initRepetitionButtons("remove",block);$wf2.initRepetitionButtons("move-up",block);$wf2.initRepetitionButtons("move-down",block);if($wf2.isInitialized){$wf2.updateAddButtons(this);$wf2.updateMoveButtons(this.parentNode)}$wf2.initNonRepetitionFunctionality(block);var addEvt;try{if(document.createEvent)addEvt= document.createEvent("UIEvents");else if(document.createEventObject)addEvt=document.createEventObject();RepetitionEvent._upgradeEvent.apply(addEvt);addEvt.initRepetitionEvent("added",true,false,block);if(this.dispatchEvent)this.dispatchEvent(addEvt);else if(this.fireEvent);}catch(err){addEvt=new Object;RepetitionEvent._upgradeEvent.apply(addEvt);addEvt.initRepetitionEvent("added",true,false,block)}var handlerAttr;if((handlerAttr=this.getAttribute("onadded"))&&(!this.onadded||typeof this.onadded!= "function"))this.onadded=new Function("event",handlerAttr);else if((handlerAttr=this.getAttribute("onadd"))&&(!this.onadd||typeof this.onadd!="function"))this.onadd=new Function("event",handlerAttr);try{if(this.onadded)this.onadded.apply(this,[addEvt]);else if(this.onadd)this.onadd.apply(this,[addEvt])}catch(err){setTimeout(function(){throw err;},0)}return block},addRepetitionBlockByIndex:function(refNode,index){$wf2.addRepetitionBlock.apply(this,[refNode,index])},removeRepetitionBlock:function(){if(this.repetitionType!= RepetitionElement.REPETITION_BLOCK)throw $wf2.DOMException(9);var parentNode=this.parentNode;var block=parentNode.removeChild(this);$wf2.updateMoveButtons(parentNode);if(this.repetitionTemplate!=null)for(var i=0;i<this.repetitionTemplate.repetitionBlocks.length;i++)if(this.repetitionTemplate.repetitionBlocks[i]==this){this.repetitionTemplate.repetitionBlocks.splice(i,1);break}if(this.repetitionTemplate!=null){var removeEvt;try{if(document.createEvent)removeEvt=document.createEvent("UIEvents");else if(document.createEventObject)removeEvt= document.createEventObject();RepetitionEvent._upgradeEvent.apply(removeEvt);removeEvt.initRepetitionEvent("removed",true,false,this);if(this.repetitionTemplate.dispatchEvent)this.repetitionTemplate.dispatchEvent(removeEvt);else if(this.repetitionTemplate.fireEvent);}catch(err){removeEvt=new Object;RepetitionEvent._upgradeEvent.apply(removeEvt);removeEvt.initRepetitionEvent("removed",true,false,this)}var handlerAttr;if((handlerAttr=this.repetitionTemplate.getAttribute("onremoved"))&&(!this.repetitionTemplate.onremoved|| typeof this.repetitionTemplate.onremoved!="function"))this.repetitionTemplate.onremoved=new Function("event",handlerAttr);else if((handlerAttr=this.repetitionTemplate.getAttribute("onremove"))&&(!this.repetitionTemplate.onremove||typeof this.repetitionTemplate.onremove!="function"))this.repetitionTemplate.onremove=new Function("event",handlerAttr);try{if(this.repetitionTemplate.onremoved)this.repetitionTemplate.onremoved.apply(this,[removeEvt]);else if(this.repetitionTemplate.onremove)this.repetitionTemplate.onremove.apply(this, [removeEvt])}catch(err){setTimeout(function(){throw err;},0)}}if(this.repetitionTemplate!=null){if(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){var addBtns=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["button"],"type","add"]); for(i=0;i<addBtns.length;i++)if(addBtns[i].htmlTemplate==this.repetitionTemplate)addBtns[i].disabled=false}}},moveRepetitionBlock:function(distance){if(this.repetitionType!=RepetitionElement.REPETITION_BLOCK)throw $wf2.DOMException(9);if(distance==0||this.parentNode==null)return;var target=this;if(this.repetitionTemplate){var pos=0;var rp=this.repetitionTemplate.repetitionBlocks;while(pos<rp.length&&rp[pos]!=this)pos++;rp.splice(pos,1);rp.splice(distance<0?Math.max(pos+distance,0):Math.min(pos+distance, rp.length),0,this)}if(distance<0)while(distance!=0&&target.previousSibling&&target.previousSibling.repetitionType!=RepetitionElement.REPETITION_TEMPLATE){target=target.previousSibling;if(target.repetitionType==RepetitionElement.REPETITION_BLOCK)distance++}else{while(distance!=0&&target.nextSibling&&target.nextSibling.repetitionType!=RepetitionElement.REPETITION_TEMPLATE){target=target.nextSibling;if(target.repetitionType==RepetitionElement.REPETITION_BLOCK)distance--}target=target.nextSibling}this.parentNode.insertBefore(this, target);if(this._clickedMoveBtn){this._clickedMoveBtn.focus();this._clickedMoveBtn=null}$wf2.updateMoveButtons(this.parentNode);if(this.repetitionTemplate!=null){var moveEvt;try{if(document.createEvent)moveEvt=document.createEvent("UIEvents");else if(document.createEventObject)moveEvt=document.createEventObject();RepetitionEvent._upgradeEvent.apply(moveEvt);moveEvt.initRepetitionEvent("moved",true,false,this);if(this.repetitionTemplate.dispatchEvent)this.repetitionTemplate.dispatchEvent(moveEvt); else if(this.repetitionTemplate.fireEvent);}catch(err){moveEvt=new Object;RepetitionEvent._upgradeEvent.apply(moveEvt);moveEvt.initRepetitionEvent("moved",true,false,this)}var handlerAttr;if((handlerAttr=this.repetitionTemplate.getAttribute("onmoved"))&&(!this.repetitionTemplate.onmoved||typeof this.repetitionTemplate.onmoved!="function"))this.repetitionTemplate.onmoved=new Function("event",handlerAttr);else if(handlerAttr=this.repetitionTemplate.getAttribute("onmove")){if(!this.repetitionTemplate.onmove|| typeof this.repetitionTemplate.onmove!="function")this.repetitionTemplate.onmove=new Function("event",handlerAttr);var funcMatches;if(typeof handlerAttr=="function"&&(funcMatches=handlerAttr.toString().match(/^\s*function\s+anonymous\(\s*\)\s*\{((?:.|\n)+)\}\s*$/)))this.repetitionTemplate.onmove=new Function("event",funcMatches[1])}try{if(this.repetitionTemplate.onmoved)this.repetitionTemplate.onmoved.apply(this,[moveEvt]);else if(this.repetitionTemplate.onmove)this.repetitionTemplate.onmove.apply(this, [moveEvt])}catch(err){setTimeout(function(){throw err;},0)}}},getRepetitionBlock:function(node){while(node=node.parentNode)if(node.repetitionType==RepetitionElement.REPETITION_BLOCK)return node;return null},getHtmlTemplate:function(button){var attr=button.getAttribute("template");var node;if(attr&&(node=document.getElementById(attr))&&node.getAttribute("repeat")=="template")return node;return null},updateAddButtons:function(rt){var repetitionTemplates=rt?[rt]:$wf2.repetitionTemplates;var btns=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement, [["button"],"type","add"]);for(var i=0;i<btns.length;i++)for(var t,j=0;t=repetitionTemplates[j];j++)if(btns[i].htmlTemplate==t&&t.repetitionBlocks.length>=t.repeatMax)btns[i].disabled=true},updateMoveButtons:function(parent){var i;var rbs=[];if(!parent){var visitedParents=[];rbs=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["*"],"repeat","template",true]);for(i=0;block=rbs[i];i++)if(!$wf2.arrayHasItem(visitedParents,block.parentNode)){$wf2.updateMoveButtons(block.parentNode); visitedParents.push(block.parentNode)}return}var j,btn,block;var child=parent.firstChild;while(child){if(child.repetitionType==RepetitionElement.REPETITION_BLOCK)rbs.push(child);child=child.nextSibling}for(i=0;block=rbs[i];i++){var moveUpBtns=$wf2.getElementsByTagNamesAndAttribute.apply(block,[["button"],"type","move-up"]);for(j=0;btn=moveUpBtns[j];j++)btn.disabled=!(rb=$wf2.getRepetitionBlock(btn))||i==0;var moveDownBtns=$wf2.getElementsByTagNamesAndAttribute.apply(block,[["button"],"type","move-down"]); for(j=0;btn=moveDownBtns[j];j++)btn.disabled=!(rb=$wf2.getRepetitionBlock(btn))||i==rbs.length-1}},initNonRepetitionFunctionality:function(parent){parent=parent||document.documentElement;var i,j,frm,frms=parent.getElementsByTagName("form");for(i=0;frm=frms[i];i++){if(frm.checkValidity&&!$wf2.hasBadImplementation)continue;frm.checkValidity=$wf2.formCheckValidity;if(frm.addEventListener)frm.addEventListener("submit",$wf2.onsubmitValidityHandler,false);else frm.attachEvent("onsubmit",$wf2.onsubmitValidityHandler)}var ctrl, ctrls=$wf2.getElementsByTagNames.apply(parent,["input","select","textarea","button"]);for(i=0;ctrl=ctrls[i];i++){$wf2.applyValidityInterface(ctrl);$wf2.updateValidityState(ctrl)}var els=$wf2.getElementsByTagNamesAndAttribute.apply(document.documentElement,[["*"],"autofocus"]);if(parent.getAttribute("autofocus"))els.unshift(parent);for(i=0;i<els.length;i++)$wf2.initAutofocusElement(els[i]);var textareas=$wf2.getElementsByTagNamesAndAttribute.apply(parent,[["textarea"],"maxlength"]);if(parent.nodeName.toLowerCase()== "textarea")textareas.unshift(parent);for(i=0;i<textareas.length;i++)textareas[i].maxLength=parseInt(textareas[i].getAttribute("maxlength"))},initAutofocusElement:function(el){if(el.autofocus===false||el.autofocus===true)return;el.autofocus=true;if(el.disabled)return;var node=el;while(node&&node.nodeType==1){if($wf2.getElementStyle(node,"visibility")=="hidden"||$wf2.getElementStyle(node,"display")=="none")return;node=node.parentNode}el.focus()},formCheckValidity:function(){var i,el,valid=true;var formElements= $wf2.getFormElements.apply(this);for(i=0;el=formElements[i];i++){var type=el.getAttribute("type")?el.getAttribute("type").toLowerCase():el.type;el.willValidate=!(/(hidden|button|reset|add|remove|move-up|move-down)/.test(type)||!el.name||el.disabled);if(el.checkValidity&&el.willValidate)if(!el.checkValidity()&&el.checkValidity()!=undefined)valid=false}if(!valid)$wf2.hiliteFirstError();return valid},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){while(el&&(el.nodeType!=1||el.style.display=="none"||!el.offsetParent))el=el.previousSibling;var cur=el;var top=0;if(cur&&cur.offsetParent){top=cur.offsetTop;while(cur=cur.offsetParent)top+=cur.offsetTop}scrollTo(0,top)}else{setTimeout(function(){el.focus();$wf2.fireEvent(el,"focus")},10);scrollBy(0,$wf2.invalidIndicators[0].errorMsg.offsetHeight)}}},controlCheckValidity:function(){$wf2.controlCheckValidityOfElement(this)}, controlCheckValidityOfElement:function(el){$wf2.updateValidityState(el);if(el.validity.valid)return true;var canceled=false;var evt;try{if(document.createEvent)evt=document.createEvent("Events");else if(document.createEventObject)evt=document.createEventObject();evt.initEvent("invalid",true,true);evt.srcElement=el;if(el.dispatchEvent)canceled=!el.dispatchEvent(evt);else if(el.fireEvent);}catch(err){evt=new Object;if(evt.initEvent)evt.initEvent("invalid",true,true);else{evt.type="invalid";evt.cancelBubble= false}evt.target=evt.srcElement=el}var oninvalidAttr=el.getAttribute("oninvalid");if(oninvalidAttr&&(!el.oninvalid||typeof el.oninvalid!="function"))el.oninvalid=new Function("event",oninvalidAttr);try{if(el.oninvalid)canceled=el.oninvalid.apply(el,[evt])===false||canceled}catch(err){setTimeout(function(){throw err;},0)}var hasInvalidIndicator=false;if(el.type=="radio"||el.type=="checkbox")for(var i=0;i<$wf2.invalidIndicators.length;i++)if(el.form[el.name][0]==$wf2.invalidIndicators[i].target){hasInvalidIndicator= true;break}if(!canceled&&!hasInvalidIndicator)$wf2.addInvalidIndicator(el);return false},numberRegExp:/^-?\d+(.\d+)?(e-?\d+)?$/,urlRegExp:/^(\w+):(\/\/)?.+$/i,emailRegExp:/^\S+@\S+$/i,copyOf:function(obj){if(obj!==null&&obj!==undefined){var r=new Object;for(i in obj)try{r[i]=obj[i]}catch(ex){}}else r=null;return r},getOriginalAttrNode:function(node,attrName){var r;var dataSetItemName=attrName+"AttrNode";if($wf2.getDatasetItem(node,dataSetItemName)==null){r=$wf2.copyOf(node.getAttributeNode(attrName)); $wf2.setDatasetItem(node,dataSetItemName,r)}else{r=$wf2.getDatasetItem(node,dataSetItemName);if(r=="null")r=null}return r},updateValidityState:function(node){var minAttrNode,maxAttrNode,valueAttrNode;minAttrNode=$wf2.getOriginalAttrNode(node,"min");maxAttrNode=$wf2.getOriginalAttrNode(node,"max");valueAttrNode=$wf2.getOriginalAttrNode(node,"value");node.min=undefined;node.max=undefined;node.step=undefined;node.validity=$wf2.createValidityState();node.validity.customError=!!node.validationMessage; var type=node.getAttribute("type")?node.getAttribute("type").toLowerCase():node.type;var isTimeRelated=type=="datetime"||type=="datetime-local"||type=="time";var isDateRelated=type=="date"||type=="month"||type=="week";var isNumberRelated=type=="number"||type=="range";var isFileInput=type=="file";var doCheckPrecision=isTimeRelated||isDateRelated||isNumberRelated;var doMaxLengthCheck=doCheckPrecision||node.nodeName.toLowerCase()=="textarea";var doCheckRange=doCheckPrecision||isFileInput;var isRadioOrCheckbox= type=="radio"||type=="checkbox";var doRequiredCheck=doMaxLengthCheck||isFileInput||type=="email"||type=="url"||type=="text"||type=="password"||type=="tel"||isRadioOrCheckbox;if(type=="range"){node.min=minAttrNode&&$wf2.numberRegExp.test(minAttrNode.value)?Number(minAttrNode.value):0;if((!valueAttrNode||!valueAttrNode.specified)&&node.value===""&&!node.wf2ValueProvided){node.setAttribute("value",node.min);node.value=node.min;node.wf2ValueProvided=true}}node.wf2Value=node.value;var type=node.getAttribute("type")? node.getAttribute("type").toLowerCase():node.type;node.willValidate=!(/(hidden|button|reset|add|remove|move-up|move-down)/.test(type)||!node.name||node.disabled);if(doRequiredCheck&&node.willValidate)if(isRadioOrCheckbox){if(node.form&&node.form[node.name]){var isRequired=false;var hasChecked=false;var inputs=node.form[node.name];if(inputs.length==undefined){if(inputs.getAttributeNode("required"))isRequired=true;if(inputs.checked)hasChecked=true}else for(var i=0;i<inputs.length;i++){if(inputs[i].getAttributeNode("required"))isRequired= true;if(inputs[i].checked)hasChecked=true}node.validity.valueMissing=isRequired&&!hasChecked}}else if(node.getAttributeNode("required"))node.validity.valueMissing=node.value=="";if(!node.validity.valueMissing&&node.value){var patternAttr=node.getAttributeNode("pattern");if(patternAttr){var rePattern=new RegExp("^(?:"+patternAttr.value+")$");rePattern.global=false;rePattern.ignoreCase=false;rePattern.multiline=false;if(rePattern)node.validity.patternMismatch=!rePattern.test(node.value)}if(isDateRelated|| isTimeRelated)node.validity.typeMismatch=(node.wf2Value=$wf2.parseISO8601(node.value,type))==null;else switch(type){case "number":case "range":node.validity.typeMismatch=!$wf2.numberRegExp.test(node.value);break;case "email":node.validity.typeMismatch=!$wf2.emailRegExp.test(node.value);break;case "url":node.validity.typeMismatch=!$wf2.urlRegExp.test(node.value);break}if(!node.validity.patternMismatch&&!node.validity.typeMismatch){if(doCheckRange)if(isNumberRelated){if(type=="range")node.max=maxAttrNode&& $wf2.numberRegExp.test(maxAttrNode.value)?Number(maxAttrNode.value):100;else{if(minAttrNode&&$wf2.numberRegExp.test(minAttrNode.value))node.min=Number(minAttrNode.value);if(maxAttrNode&&$wf2.numberRegExp.test(maxAttrNode.value))node.max=Number(maxAttrNode.value)}node.validity.rangeUnderflow=node.min!=undefined&&Number(node.value)<node.min;node.validity.rangeOverflow=node.max!=undefined&&Number(node.value)>node.max}else if(type=="file"){if(minAttrNode&&/^\d+$/.test(minAttrNode.value))node.min=Number(minAttrNode.value); else node.min=0;if(maxAttrNode&&/^\d+$/.test(maxAttrNode.value))node.max=Number(maxAttrNode.value);else node.max=1}else{if(minAttrNode){node.min=$wf2.parseISO8601(minAttrNode.value,type);node.validity.rangeUnderflow=node.min&&node.wf2Value<node.min}if(maxAttrNode){node.max=$wf2.parseISO8601(maxAttrNode.value,type);node.validity.rangeOverflow=node.max&&node.wf2Value>node.max}}if(doCheckPrecision&&!node.validity.rangeUnderflow&&!node.validity.rangeOverflow){var stepAttrNode=$wf2.getOriginalAttrNode(node, "step");if(!stepAttrNode)node.step=isTimeRelated?60:1;else if(stepAttrNode.value=="any")node.step="any";else if($wf2.numberRegExp.test(stepAttrNode.value)&&stepAttrNode.value>0)node.step=Number(stepAttrNode.value);else node.step=isTimeRelated?60:1;if(node.step!="any"){node.wf2StepDatum=null;if(minAttrNode)node.wf2StepDatum=node.min;else if(maxAttrNode)node.wf2StepDatum=node.max;else node.wf2StepDatum=$wf2.zeroPoint[type]?$wf2.zeroPoint[type]:0;var _step=node.step;if(type=="month"&&node.wf2StepDatum&& node.wf2StepDatum.getUTCFullYear){var month1=node.wf2StepDatum.getUTCFullYear()*12+node.wf2StepDatum.getUTCMonth();var month2=node.wf2Value.getUTCFullYear()*12+node.wf2Value.getUTCMonth();node.validity.stepMismatch=(month2-month1)%_step!=0}else{switch(type){case "datetime":case "datetime-local":case "time":_step=parseInt(_step*1E3);break;case "date":_step=parseInt(_step*24*60*60*1E3);break;case "week":_step=parseInt(_step*7*24*60*60*1E3);break}node.validity.stepMismatch=Math.round((node.wf2Value- node.wf2StepDatum)*1E3)%Math.round(_step*1E3)!=0}}}}if(doMaxLengthCheck&&node.maxLength>=0&&node.value!=node.defaultValue){var shortNewlines=0;var v=node.value;node.wf2ValueLength=v.length;for(var i=1;i<v.length;i++)if(v[i]==="\n"&&v[i-1]!=="\r"||v[i]=="\r"&&v[i+1]&&v[i+1]!=="\n")node.wf2ValueLength++;node.validity.tooLong=node.wf2ValueLength>node.maxLength}}node.validity.valid=!$wf2.hasInvalidState(node.validity)},applyValidityInterface:function(node){if($wf2.hasBadImplementation){if(node.type== "submit"||node.type=="button")node.formNoValidate=true}else if(node.validity&&node.validity.typeMismatch!==undefined)return node;node.validationMessage="";node.validity=$wf2.createValidityState();node.willValidate=true;var nodeName=node.nodeName.toLowerCase();if(nodeName=="button"||nodeName=="fieldset"){node.setCustomValidity=function(error){throw $wf2.DOMException(9);};node.checkValidity=function(){return true};return node}if(!node.setCustomValidity)node.setCustomValidity=$wf2.controlSetCustomValidity; node.checkValidity=$wf2.controlCheckValidity;var type=node.getAttribute("type")?node.getAttribute("type").toLowerCase():node.type;if(/(hidden|button|reset|add|remove|move-up|move-down)/.test(type)||!node.name||node.disabled)node.willValidate=false;else if(window.RepetitionElement){var parent=node;while(parent=parent.parentNode)if(parent.repetitionType==RepetitionElement.REPETITION_TEMPLATE){node.willValidate=false;break}}return node},onsubmitValidityHandler:function(event){var frm=event.currentTarget|| event.srcElement;var r;for(var i=0;i<$wf2.callBeforeValidation.length;i++)$wf2.callBeforeValidation[i](event);if(!frm.checkValidity()){if(event.preventDefault)event.preventDefault();event.returnValue=false;r=false}else{event.returnValue=true;r=true}for(var i=0;i<$wf2.callAfterValidation.length;i++)$wf2.callAfterValidation[i](event,r);return r},controlSetCustomValidity:function(error){if(error){this.validationMessage=String(error);this.validity.customError=true}else{this.validationMessage="";this.validity.customError= false}this.validity.valid=!$wf2.hasInvalidState(this.validity)},hasInvalidState:function(validity){return validity.typeMismatch||validity.rangeUnderflow||validity.rangeOverflow||validity.stepMismatch||validity.tooLong||validity.patternMismatch||validity.valueMissing||validity.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(value,type){switch(String(type).toLowerCase()){case "datetime":case "datetime-local":case "date":case "month":case "week":case "time":return $wf2.dateToISO8601(value,type);default:return value}},addInvalidIndicator:function(target){var msg=document.createElement("div");msg.className="wf2_errorMsg";msg.id=(target.id||target.name)+"_wf2_errorMsg";msg.onmousedown=function(){this.parentNode.removeChild(this)};var type= target.getAttribute("type")?target.getAttribute("type").toLowerCase():target.type;var isDateTimeRelated=type=="datetime"||type=="datetime-local"||type=="time"||type=="date"||type=="month"||type=="week";var ol=document.createElement("ol");if(target.validity.valueMissing)ol.appendChild($wf2.createLI($wf2.invalidMessages.valueMissing));if(target.validity.typeMismatch)ol.appendChild($wf2.createLI($wf2.invalidMessages.typeMismatch.replace(/%s/,type)));if(target.validity.rangeUnderflow)ol.appendChild($wf2.createLI($wf2.invalidMessages.rangeUnderflow.replace(/%s/, $wf2.valueToWF2Type(target.min,type))));if(target.validity.rangeOverflow)ol.appendChild($wf2.createLI($wf2.invalidMessages.rangeOverflow.replace(/%s/,$wf2.valueToWF2Type(target.max,type))));if(target.validity.stepMismatch)ol.appendChild($wf2.createLI($wf2.invalidMessages.stepMismatch.replace(/%s/,target.step+($wf2.stepUnits[type]?" "+$wf2.stepUnits[type]+"(s)":"")).replace(/%s/,$wf2.valueToWF2Type(target.wf2StepDatum,type))));if(target.validity.tooLong)ol.appendChild($wf2.createLI($wf2.invalidMessages.tooLong.replace(/%s/, target.maxLength).replace(/%s/,target.wf2ValueLength?target.wf2ValueLength:target.value.length)));if(target.validity.patternMismatch)ol.appendChild($wf2.createLI($wf2.invalidMessages.patternMismatch.replace(/%s/,target.title?target.title:' "'+target.getAttribute("pattern")+'"')));if(target.validity.customError)ol.appendChild($wf2.createLI(target.validationMessage));if(ol.childNodes.length==1)ol.className="single";msg.appendChild(ol);var parent=document.body?document.body:document.documentElement; if($wf2.invalidIndicators.length)parent.insertBefore(msg,$wf2.invalidIndicators[$wf2.invalidIndicators.length-1].errorMsg);else parent.insertBefore(msg,null);var el=target;while(el&&(el.nodeType!=1||el.style.display=="none"||el.style.visibility=="hidden"||!el.offsetParent))el=el.parentNode;var top=left=0;var cur=el;if(cur&&cur.offsetParent){left=cur.offsetLeft;top=cur.offsetTop;while(cur=cur.offsetParent){left+=cur.offsetLeft;top+=cur.offsetTop}top+=el.offsetHeight}msg.style.top=top+"px";msg.style.left= left+"px";$wf2.invalidIndicators.push({target:target,errorMsg:msg});if(!target.className.match(/\bwf2_invalid\b/))target.className+=" wf2_invalid";if($wf2.indicatorIntervalId==null){$wf2.indicatorIntervalId=setInterval(function(){var invalidIndicator;for(var i=0;invalidIndicator=$wf2.invalidIndicators[i];i++)if(!invalidIndicator.target.className.match(/\bwf2_invalid\b/))invalidIndicator.target.className+=" wf2_invalid";else invalidIndicator.target.className=invalidIndicator.target.className.replace(/\s?wf2_invalid/, "")},500);setTimeout(function(){for(var i=0;i<$wf2.callAfterValidation.length;i++)$wf2.callAfterValidation[i](null,false)},1);$wf2.indicatorTimeoutId=setTimeout($wf2.clearInvalidIndicators,4E3)}},clearInvalidIndicators:function(){clearTimeout($wf2.indicatorTimeoutId);$wf2.indicatorTimeoutId=null;clearInterval($wf2.indicatorIntervalId);$wf2.indicatorIntervalId=null;var invalidIndicator;while(invalidIndicator=$wf2.invalidIndicators[0]){if(invalidIndicator.errorMsg&&invalidIndicator.errorMsg.parentNode)invalidIndicator.errorMsg.parentNode.removeChild(invalidIndicator.errorMsg); var target=invalidIndicator.target;target.className=target.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(node,processAttr,rtNestedDepth){if(!rtNestedDepth)rtNestedDepth=0;var clone,i,attr;switch(node.nodeType){case 1:var isTemplate=node.getAttribute("repeat")== "template";if(isTemplate)rtNestedDepth++;var attrs=[];if(node.name)attrs.name=processAttr?processAttr(node.name):node.name;if(node.type=="radio")attrs.type=node.type;if(node.checked)attrs.checked="checked";clone=$wf2.createElement(node.nodeName,attrs);for(i=0;attr=node.attributes[i];i++)if((attr.specified||$wf2.cloneNode_customAttrs[attr.name])&&!$wf2.cloneNode_skippedAttrs[attr.name]&&(!isTemplate||rtNestedDepth>1||!$wf2.cloneNode_rtEventHandlerAttrs[attr.name]))if(rtNestedDepth<2&&attr.name.indexOf("on")=== 0&&typeof node[attr.name]=="function"){var funcBody=processAttr(node[attr.name].toString().match(/{((?:.|\n)+)}/)[1]);funcBody=processAttr(funcBody);clone[attr.name]=new Function("event",funcBody)}else{var attrValue=node.getAttribute(attr.name);attrValue=processAttr?processAttr(attrValue):attrValue;clone.setAttribute(attr.name,attrValue)}if(node.className){var _className=processAttr?processAttr(node.className):node.className;if(clone.getAttributeNode("class"))for(i=0;i<clone.attributes.length;i++){if(clone.attributes[i].name== "class")clone.attributes[i].value=_className}else clone.setAttribute("class",_className)}if(!/\bdisabled\b/.test(node.className))clone.disabled=false;if(node.style&&node.style.cssText)clone.style.cssText=processAttr?processAttr(node.style.cssText):node.style.cssText;if(node.nodeName&&node.nodeName.toLowerCase()=="label"&&node.htmlFor)clone.htmlFor=processAttr?processAttr(node.htmlFor):node.htmlFor;if(clone.nodeName.toLowerCase()=="option"){clone.selected=node.selected;clone.defaultSelected=node.defaultSelected}for(i= 0;i<node.childNodes.length;i++)clone.appendChild($wf2.cloneNode(node.childNodes[i],processAttr,rtNestedDepth));break;case 3:case 4:clone=document.createTextNode(node.data);break;case 8:clone=document.createComment(node.data);break;default:clone=node.cloneNode(true)}return clone},getFormElements:function(){var elements=[];var allElements=$wf2.getElementsByTagNames.apply(this,["input","output","select","textarea","button"]);for(var i=0;i<allElements.length;i++){var node=allElements[i].parentNode;while(node&& node.nodeType==1&&node.getAttribute("repeat")!="template")node=node.parentNode;if(!node||node.nodeType!=1)elements.push(allElements[i])}return elements},loadDataURI:function(el){var uri=el.data||el.getAttribute("data");if(!uri)return null;var doc=null,matches;try{if(matches=uri.match(/^data:[^,]*xml[^,]*,((?:.|\n)+)/)){var xml=decodeURI(matches[1].replace(/%3D/ig,"=").replace(/%3A/ig,":").replace(/%2F/ig,"/"));if(window.DOMParser){var parser=new DOMParser;doc=parser.parseFromString(xml,"text/xml")}else if(window.ActiveXObject){doc= new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(xml)}}else{$wf2.xhr.open("GET",uri,false);$wf2.xhr.send(null);doc=$wf2.xhr.responseXML}}catch(e){return null}return doc},getAttributeByName:function(obj,attrName){var i;var attributes=obj.attributes;for(i=0;i<attributes.length;i++){var attr=attributes[i];if(attr.nodeName==attrName&&attr.specified)return attr}return null},getAttributeValue:function(obj,attrName){var attr=$wf2.getAttributeByName(obj,attrName);if(attr!=null)return attr.nodeValue; else return null},setAttributeValue:function(obj,attrName,attrValue){var attr=$wf2.getAttributeByName(obj,attrName);if(attr!=null)attr.nodeValue=attrValue;else return},getDatasetItem:function(obj,name){var r=$wf2.getAttributeValue(obj,"data-"+name);if(!r)r=$wf2.getAttributeValue(obj,"data-"+name.toLowerCase());if(!r)r=obj["data-"+name.toLowerCase()];return r},setDatasetItem:function(obj,name,value){var attrName="data-"+name.toLowerCase();var val=$wf2.setAttributeValue(obj,attrName,value);if($wf2.getAttributeValue(obj, attrName)==null)obj[attrName]=value},getElementsByTagNames:function(){var els,i,results=[];if(document.evaluate){var _tagNames=[];for(i=0;i<arguments.length;i++)_tagNames.push(".//"+arguments[i]);els=document.evaluate(_tagNames.join("|"),this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(i=0;i<els.snapshotLength;i++)results.push(els.snapshotItem(i))}else{for(i=0;i<arguments.length;i++){els=this.getElementsByTagName(arguments[i]);for(var j=0;j<els.length;j++)results.push(els[j])}if($wf2.sortNodes)results.sort($wf2.sortNodes)}return results}, getElementsByTagNamesAndAttribute:function(elNames,attrName,attrValue,isNotEqual){var els,el,i,j,results=[];if(document.evaluate){var attrExpr="";if(attrName)attrExpr="[@"+attrName+(attrValue?(isNotEqual?"!=":"=")+'"'+attrValue+'"':"")+"]";var xPaths=[];for(i=0;i<elNames.length;i++)xPaths.push(".//"+elNames[i]+attrExpr);els=document.evaluate(xPaths.join("|"),this,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(i=0;i<els.snapshotLength;i++)results.push(els.snapshotItem(i))}else{for(i=0;i<elNames.length;i++){els= this.getElementsByTagName(elNames[i]);for(j=0;el=els[j];j++){var thisAttrNode=el.getAttributeNode(attrName);var thisAttrValue=el.getAttribute(attrName);if(!attrName||thisAttrNode&&(attrValue===undefined||(isNotEqual?thisAttrValue!=attrValue:thisAttrValue==attrValue)))results.push(el)}}if($wf2.sortNodes)results.sort($wf2.sortNodes)}return results},arrayHasItem:function(arr,item){for(var i=0;i<arr.length;i++)if(arr[i]==item)return true;return false},getElementStyle:function(el,property){if(el.currentStyle)return el.currentStyle[property]; else if(window.getComputedStyle)return getComputedStyle(el,"").getPropertyValue(property);else if(el.style)return el.style[property];else return""},createElement:function(){try{var el=document.createElement('<div name="foo">');if(el.tagName.toLowerCase()!="div"||el.name!="foo")throw"create element error";return function(tag,attrs){var html="<"+tag;for(var name in attrs)html+=" "+name+'="'+attrs[name]+'"';html+=">";if(tag.toLowerCase()!="input")html+="</"+tag+">";return document.createElement(html)}}catch(err){return function(tag, attrs){var el=document.createElement(tag);for(var name in attrs)el.setAttribute(name,attrs[name]);return el}}}(),sortNodes:function(){var n=document.documentElement.firstChild;if(n.sourceIndex)return function(a,b){return a.sourceIndex-b.sourceIndex};else if(n.compareDocumentPosition)return function(a,b){return 3-(a.compareDocumentPosition(b)&6)}}(),createLI:function(text){var li=document.createElement("li");li.appendChild(document.createTextNode(text));return li},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(str,type){var d=$wf2.validateDateTimeType(str,type);if(!d)return null;var date=new Date(0);var _timePos=8;if(d[15]){if(type&&type!="time")return null;_timePos=15}else{date.setUTCFullYear(d[1]);if(d[3]){if(type&&type!="week")return null;date.setUTCDate(date.getUTCDate()+(8-date.getUTCDay())%7+(d[3]-1)*7);return date}else{date.setUTCMonth(d[4]-1);if(d[6])date.setUTCDate(d[6])}}if(d[_timePos+0])date.setUTCHours(d[_timePos+0]);if(d[_timePos+1])date.setUTCMinutes(d[_timePos+1]);if(d[_timePos+ 2])date.setUTCSeconds(d[_timePos+3]);if(d[_timePos+4])date.setUTCMilliseconds(Math.round(Number(d[_timePos+4])*1E3));if(d[4]&&d[_timePos+0]&&!d[_timePos+6])date.setUTCMinutes(date.getUTCMinutes()+date.getTimezoneOffset());return date},validateDateTimeType:function(value,type){var isValid=false;var d=$wf2.ISO8601RegExp.exec(value);if(!d||!type)return d;type=type.toLowerCase();if(type=="week")isValid=d[2].toString().indexOf("W")===0;else if(type=="time")isValid=!!d[15];else if(type=="month")isValid= !d[5];else if(d[6]){var date=new Date(d[1],d[4]-1,d[6]);if(date.getMonth()!=d[4]-1)isValid=false;else switch(type){case "date":isValid=d[4]&&!d[7];break;case "datetime":isValid=!!d[14];break;case "datetime-local":isValid=d[7]&&!d[14];break}}return isValid?d:null},zeroPad:function(num,pad){if(!pad)pad=2;var str=num.toString();while(str.length<pad)str="0"+str;return str},dateToISO8601:function(date,type){type=String(type).toLowerCase();var ms="";if(date.getUTCMilliseconds())ms="."+$wf2.zeroPad(date.getUTCMilliseconds(), 3).replace(/0+$/,"");switch(type){case "date":return date.getUTCFullYear()+"-"+$wf2.zeroPad(date.getUTCMonth()+1)+"-"+$wf2.zeroPad(date.getUTCDate());case "datetime-local":return date.getFullYear()+"-"+$wf2.zeroPad(date.getMonth()+1)+"-"+$wf2.zeroPad(date.getDate())+"T"+$wf2.zeroPad(date.getHours())+":"+$wf2.zeroPad(date.getMinutes())+":"+$wf2.zeroPad(date.getMinutes())+ms+"Z";case "month":return date.getUTCFullYear()+"-"+$wf2.zeroPad(date.getUTCMonth()+1);case "week":var week1=$wf2.parseISO8601(date.getUTCFullYear()+ "-W01");return date.getUTCFullYear()+"-W"+$wf2.zeroPad((date.valueOf()-week1.valueOf())/(7*24*60*60*1E3)+1);case "time":return $wf2.zeroPad(date.getUTCHours())+":"+$wf2.zeroPad(date.getUTCMinutes())+":"+$wf2.zeroPad(date.getUTCMinutes())+ms;case "datetime":default:return date.getUTCFullYear()+"-"+$wf2.zeroPad(date.getUTCMonth()+1)+"-"+$wf2.zeroPad(date.getUTCDate())+"T"+$wf2.zeroPad(date.getUTCHours())+":"+$wf2.zeroPad(date.getUTCMinutes())+":"+$wf2.zeroPad(date.getUTCMinutes())+ms+"Z"}},fireEvent:function(element, event,options){if(!element)return;if(document.createEventObject)return element.fireEvent("on"+event,$wf2.globalEvent);else{$wf2.globalEvent.initEvent(event,true,true);return!element.dispatchEvent($wf2.globalEvent)}},DOMException:function(code){var message="DOMException: ";switch(code){case 1:message+="INDEX_SIZE_ERR";break;case 9:message+="NOT_SUPPORTED_ERR";break;case 11:message+="INVALID_STATE_ERR";break;case 12:message+="SYNTAX_ERR";break;case 13:message+="INVALID_MODIFICATION_ERR";break}var err= new Error(message);err.code=code;err.name="DOMException";err.INDEX_SIZE_ERR=1;err.NOT_SUPPORTED_ERR=9;err.INVALID_STATE_ERR=11;err.SYNTAX_ERR=12;err.INVALID_MODIFICATION_ERR=13;return err}};var RepetitionElement={REPETITION_NONE:0,REPETITION_TEMPLATE:1,REPETITION_BLOCK:2};var RepetitionEvent={_upgradeEvent:function(){this.initRepetitionEvent=RepetitionEvent.initRepetitionEvent;this.initRepetitionEventNS=RepetitionEvent.initRepetitionEventNS},initRepetitionEvent:function(typeArg,canBubbleArg,cancelableArg, elementArg){if(this.initEvent)this.initEvent(typeArg,canBubbleArg,cancelableArg);else{this.type=typeArg;if(!this.preventDefault)this.preventDefault=function(){this.returnValue=false};if(!this.stopPropagation)this.stopPropagation=function(){this.cancelBubble=true}}this.element=elementArg;this.relatedNode=elementArg},initRepetitionEventNS:function(namespaceURIArg,typeArg,canBubbleArg,cancelableArg,elementArg){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(evt){if(evt.target.nodeType==1&&evt.target.hasAttribute("autofocus"))$wf2.initAutofocusElement(evt.target)},false);document.addEventListener("DOMAttrModified", function(evt){if(evt.attrName=="autofocus")if(evt.attrChange==evt.ADDITION)$wf2.initAutofocusElement(evt.target);else if(evt.attrChange==evt.REMOVAL)evt.target.autofocus=false},false)}(function(){var match;var scripts=document.documentElement.getElementsByTagName("script");for(var i=0;i<scripts.length;i++)if(match=scripts[i].src.match(/^(.*)webforms2[^\/]+$/))$wf2.libpath=match[1];if(document.body){$wf2.onDOMContentLoaded();return}var eventSet=0;if(document.addEventListener){document.addEventListener("DOMContentLoaded", function(){$wf2.onDOMContentLoaded()},false);window.addEventListener("load",function(){$wf2.onDOMContentLoaded()},false);eventSet=1}if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(_timer);delete _timer;$wf2.onDOMContentLoaded()}},10);eventSet=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("<scr"+"ipt id='__wf2_ie_onload' defer src='//:'><\/script>");var script=document.getElementById("__wf2_ie_onload");script.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);$wf2.onDOMContentLoaded();if($wf2.repetitionTemplates.length==0)$wf2.isInitialized=false}};script=null;eventSet=1}if(!eventSet)if(window.onload){var oldonload=window.onload;window.onload=function(){$wf2.onDOMContentLoaded(); oldonload()}}else window.onload=function(){$wf2.onDOMContentLoaded()}})()}else if(document.addEventListener&&($wf2.oldRepetitionEventModelEnabled===undefined||$wf2.oldRepetitionEventModelEnabled)){$wf2.oldRepetitionEventModelEnabled=true;(function(){var deprecatedAttrs={added:"onadd",removed:"onremove",moved:"onmove"};function handleRepetitionEvent(evt){if(!$wf2.oldRepetitionEventModelEnabled)return;if(!evt.element&&evt.relatedNode)evt.element=evt.relatedNode;if(!evt.element||!evt.element.repetitionTemplate)return; var rt=evt.element.repetitionTemplate;var attrName="on"+evt.type;var handlerAttr=rt.getAttribute(attrName)||rt.getAttribute(deprecatedAttrs[evt.type]);if(handlerAttr&&(!rt[attrName]||typeof rt[attrName]!="function"))rt[attrName]=new Function("event",handlerAttr);if(evt.element.repetitionTemplate[attrName])evt.element.repetitionTemplate[attrName](evt);else if(evt.element.repetitionTemplate[deprecatedAttrs[evt.type]])evt.element.repetitionTemplate[deprecatedAttrs[evt.type]](evt)}document.addEventListener("added", handleRepetitionEvent,false);document.addEventListener("removed",handleRepetitionEvent,false);document.addEventListener("moved",handleRepetitionEvent,false)})()}};