function wHELPERS(){};wHELPERS.prototype.addEvent=function(obj,type,fn){if(!obj){return;}
if(obj.attachEvent){obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event);}
obj.attachEvent('on'+type,obj[type+fn]);}else if(obj.addEventListener){obj.addEventListener(type,fn,false);}else{var originalHandler=obj["on"+type];if(originalHandler){obj["on"+type]=function(e){originalHandler(e);fn(e);};}else{obj["on"+type]=fn;}}}
wHELPERS.prototype.removeEvent=function(obj,type,fn){if(obj.detachEvent){if(obj[type+fn]){obj.detachEvent('on'+type,obj[type+fn]);obj[type+fn]=null;}}else if(obj.removeEventListener)
obj.removeEventListener(type,fn,false);else{obj["on"+type]=null;}}
wHELPERS.prototype.getSourceElement=function(e){if(!e)e=window.event;if(e.target)
var srcE=e.target;else
var srcE=e.srcElement;if(!srcE)return null;if(srcE.nodeType==3)srcE=srcE.parentNode;if(srcE.tagName.toUpperCase()=='LABEL'&&e.type=='click'){if(srcE.getAttribute('for')){srcE=document.getElementById(srcE.getAttribute('for'));}}
return srcE;}
wHELPERS.prototype.preventEvent=function(e){if(!e)e=window.event;if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;}
wHELPERS.prototype.stopPropagation=function(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();}
wHELPERS.prototype.randomId=function(){var seed=(new Date()).getTime();seed=seed.toString().substr(6);for(var i=0;i<6;i++)
seed+=String.fromCharCode(48+Math.floor((Math.random()*10)));return"id-"+seed;}
wHELPERS.prototype.activateStylesheet=function(sheetref){if(document.getElementsByTagName){var ss=document.getElementsByTagName('link');}else if(document.styleSheets){var ss=document.styleSheets;}
for(var i=0;ss[i];i++){if(ss[i].href.indexOf(sheetref)!=-1){ss[i].disabled=true;ss[i].disabled=false;}}}
wHELPERS.prototype.hasClass=function(element,className){if(element&&element.className){if((' '+element.className+' ').indexOf(' '+className+' ')!=-1){return true;}}
return false;}
wHELPERS.prototype.hasClassPrefix=function(element,className){if(element&&element.className){if((' '+element.className).indexOf(' '+className)!=-1){return true;}}
return false;}
wHELPERS.prototype.hasIdPrefix=function(element,idPrefix){if(element&&element.id){if(element.id.indexOf(idPrefix)!=-1){return true;}}
return false;}
wHELPERS.prototype.getTop=function(obj){var cur=0;if(obj.offsetParent){while(obj.offsetParent){if((new wHELPERS()).getComputedStyle(obj,'position')=='relative'){return cur;}
cur+=obj.offsetTop;obj=obj.offsetParent;}}
return cur;}
wHELPERS.prototype.getLeft=function(obj){var cur=0;if(obj.offsetParent){while(obj.offsetParent){if((new wHELPERS()).getComputedStyle(obj,'position')=='relative'){return cur;}
cur+=obj.offsetLeft;obj=obj.offsetParent;}}
return cur;}
wHELPERS.prototype.getComputedStyle=function(element,styleName){if(window.getComputedStyle){return window.getComputedStyle(element,"").getPropertyValue(styleName);}else if(element.currentStyle){return element.currentStyle[styleName];}
return false;}
var wHelpers=wHELPERS;if(!Array.prototype.push){Array.prototype.push=function(){for(var i=0;i<arguments.length;++i){this[this.length]=arguments[i];}
return this.length;};}
if(wHELPERS){var wFORMS={debugLevel:0,helpers:new wHELPERS(),behaviors:{},onLoadComplete:new Array(),processedForm:null,onLoadHandler:function(){for(var behaviorName in wFORMS.behaviors){wFORMS.debug('wForms/loaded behavior: '+behaviorName);}
for(var i=0;i<document.forms.length;i++){wFORMS.debug('wForms/initialize: '+(document.forms[i].name||document.forms[i].id));wFORMS.addBehaviors(document.forms[i]);}},addBehaviors:function(node){if(!node)return;if(!node.nodeType){node=document.getElementById(node);}
if(!node||node.nodeType!=1)return;deep=(arguments.length>1)?arguments[1]:true;wFORMS._addBehaviors(node,deep);},_addBehaviors:function(node,deep){if(node.getAttribute('rel')=='no-behavior'){return false;}
if(node.nodeType==1){if(node.tagName.toUpperCase()=='FORM'){wFORMS.processedForm=node;}
for(var behaviorName in wFORMS.behaviors){wFORMS.behaviors[behaviorName].evaluate(node);}
if(deep){for(var i=0,l=node.childNodes.length,cn=node.childNodes;i<l;i++){if(cn[i].nodeType==1)
wFORMS._addBehaviors(cn[i],deep);}}
if(node.tagName.toUpperCase()=='FORM'){for(var i=0;i<wFORMS.onLoadComplete.length;i++){wFORMS.onLoadComplete[i]();}
if(wFORMS.onLoadComplete.length>0){wFORMS.onLoadComplete=new Array();}}}},hasBehavior:function(behaviorName){if(wFORMS.behaviors[behaviorName])return true;return false;},debug:function(txt){msgLevel=arguments[1]||10;if(wFORMS.debugLevel>0&&msgLevel>=wFORMS.debugLevel){if(!wFORMS.debugOutput)
wFORMS.initDebug();if(wFORMS.debugOutput)
wFORMS.debugOutput.innerHTML+="<br />"+txt;}},initDebug:function(){var output=document.getElementById('debugOutput');if(!output){output=document.createElement('div');output.id='debugOutput';output.style.position='absolute';output.style.right='10px';output.style.top='10px';output.style.zIndex='300';output.style.fontSize='x-small';output.style.fontFamily='courier';output.style.backgroundColor='#DDD';output.style.padding='5px';if(document.body)
wFORMS.debugOutput=document.body.appendChild(output);}
if(wFORMS.debugOutput)
wFORMS.debugOutput.ondblclick=function(){this.innerHTML=''};}};wFORMS.NAME="wForms";wFORMS.VERSION="2.0";wFORMS.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]";};wFORMS.toString=function(){return this.__repr__();};wFORMS.utilities=wFORMS.helpers;var wf=wFORMS;wf.utilities.getSrcElement=wFORMS.helpers.getSourceElement;wf.utilities.XBrowserPreventEventDefault=wFORMS.helpers.preventEvent;wFORMS.helpers.activateStylesheet('wforms-jsonly.css');wFORMS.helpers.addEvent(window,'load',wFORMS.onLoadHandler);}
if(wFORMS){wFORMS.idSuffix_fieldHint="-H";wFORMS.className_inactiveFieldHint="nota";wFORMS.className_activeFieldHint="nota-active";wFORMS.behaviors['hint']={name:'hint',evaluate:function(node){if(node.id){if(node.id.indexOf(wFORMS.idSuffix_fieldHint)>0){var id=node.id.replace(wFORMS.idSuffix_fieldHint,'');var hinted=document.getElementById(id)||wFORMS.processedForm[id];}
if(hinted){if(hinted.length>0&&hinted[0].type=='radio'){var hintedGroup=hinted;l=hinted.length;}else{var hintedGroup=new Array(hinted);l=1;}
for(var i=0;i<l;i++){hinted=hintedGroup[i];wFORMS.debug('hint/evaluate: '+(node.id||node.name));switch(hinted.tagName.toUpperCase()){case'SELECT':case'TEXTAREA':case'INPUT':wFORMS.helpers.addEvent(hinted,'focus',wFORMS.behaviors['hint'].run);wFORMS.helpers.addEvent(hinted,'blur',wFORMS.behaviors['hint'].remove);break;default:wFORMS.helpers.addEvent(hinted,'mouseover',wFORMS.behaviors['hint'].run);wFORMS.helpers.addEvent(hinted,'mouseout',wFORMS.behaviors['hint'].remove);break;}}}}},run:function(e){var element=wFORMS.helpers.getSourceElement(e);var fieldHint=document.getElementById(element.id+wFORMS.idSuffix_fieldHint);if(!fieldHint)
fieldHint=document.getElementById(element.name+wFORMS.idSuffix_fieldHint);if(fieldHint){fieldHint.className=fieldHint.className.replace(wFORMS.className_inactiveFieldHint,wFORMS.className_activeFieldHint);fieldHint.style.top=(wFORMS.helpers.getTop(element)+element.offsetHeight).toString()+"px";if(element.tagName.toUpperCase()=='SELECT')
fieldHint.style.left=(wFORMS.helpers.getLeft(element)+(element.offsetWidth-8)).toString()+"px";else
fieldHint.style.left=(wFORMS.helpers.getLeft(element)).toString()+"px";}},remove:function(e){var element=wFORMS.helpers.getSourceElement(e);var fieldHint=document.getElementById(element.id+wFORMS.idSuffix_fieldHint);if(!fieldHint)
fieldHint=document.getElementById(element.name+wFORMS.idSuffix_fieldHint);if(fieldHint)
fieldHint.className=fieldHint.className.replace(wFORMS.className_activeFieldHint,wFORMS.className_inactiveFieldHint);}}}
if(wFORMS){wFORMS.className_paging="wfPage";wFORMS.className_pagingCurrent="wfCurrentPage";wFORMS.className_pagingButtons="wfPageButton";wFORMS.className_hideSubmit="wfHideSubmit";wFORMS.idPrefix_pageIndex="wfPgIndex-";wFORMS.runValidationOnPageNext=true;if(!wFORMS.arrMsg)wFORMS.arrMsg=new Array();wFORMS.arrMsg[4]="Next Page";wFORMS.arrMsg[5]="Previous Page";wFORMS.behaviors['paging']={idSuffix_buttonsPlaceholder:"-buttons",className_pageNextButton:wFORMS.className_pagingButtons+" wfPageNextButton",className_pagePreviousButton:wFORMS.className_pagingButtons+" wfPagePreviousButton",behaviorInUse:false,allowNestedPages:false,onPageChange:null,evaluate:function(node){if(wFORMS.helpers.hasClass(node,wFORMS.className_paging)){if(!wFORMS.behaviors['paging'].allowNestedPages&&wFORMS.behaviors['paging'].getPageElement(node)){node.className=node.className.replace(wFORMS.className_paging,"");return;}
wFORMS.behaviors['paging'].behaviorInUse=true;var currentPageIndex=wFORMS.behaviors['paging'].getPageIndex(node);if(currentPageIndex>1){var placeholder=this.getButtonPlaceholder(node);var button=placeholder.insertBefore(this.createPreviousPageButton(),placeholder.firstChild);wFORMS.helpers.addEvent(button,'click',wFORMS.behaviors['paging'].pagingPrevious);}else{node.className+=' '+wFORMS.className_pagingCurrent;var form=wFORMS.behaviors['paging'].getFormElement(node);wFORMS.helpers.addEvent(form,'submit',function(e){var element=wFORMS.helpers.getSourceElement(e);if(element.type&&element.type.toLowerCase()=='text')
return wFORMS.preventEvent(e);});wFORMS.preventSubmissionOnEnter=true;}
if(document.getElementById(wFORMS.idPrefix_pageIndex+(currentPageIndex+1).toString())){var placeholder=this.getButtonPlaceholder(node);var button=placeholder.appendChild(this.createNextPageButton());wFORMS.helpers.addEvent(button,'click',wFORMS.behaviors['paging'].pagingNext);if(currentPageIndex==1){wFORMS.behaviors['paging'].hideSubmitButton(form);}}}},getButtonPlaceholder:function(page){var p=document.getElementById(page.id+this.idSuffix_buttonsPlaceholder);if(!p){var buttonPlaceholder=document.createElement("div");buttonPlaceholder=page.appendChild(buttonPlaceholder);buttonPlaceholder.className='actions';buttonPlaceholder.id=page.id+this.idSuffix_buttonsPlaceholder;return buttonPlaceholder;}
return p;},createNextPageButton:function(){var button=document.createElement("input");button.setAttribute('value',wFORMS.arrMsg[4]);button.setAttribute('type',"button");button.className=this.className_pageNextButton;return button;},createPreviousPageButton:function(){var button=document.createElement("input");button.setAttribute('value',wFORMS.arrMsg[5]);button.setAttribute('type',"button");button.className=this.className_pagePreviousButton;return button;},pagingNext:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e
var pageElement=wFORMS.behaviors['paging'].getPageElement(element);var pageIndex=wFORMS.behaviors['paging'].getPageIndex(pageElement)+1;var nextPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(nextPageElement){if(!wFORMS.hasBehavior('validation')||(wFORMS.hasBehavior('validation')&&!wFORMS.runValidationOnPageNext)||(wFORMS.hasBehavior('validation')&&wFORMS.runValidationOnPageNext&&wFORMS.functionName_formValidation(e,true))){pageElement.className=pageElement.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");nextPageElement.className+=' '+wFORMS.className_pagingCurrent;if(wFORMS.behaviors['paging'].isLastPage(pageIndex)){var form=wFORMS.behaviors['paging'].getFormElement(nextPageElement);wFORMS.behaviors['paging'].showSubmitButton(form);}
if(wFORMS.behaviors['paging'].onPageChange){wFORMS.behaviors['paging'].onPageChange(nextPageElement);}
window.scroll(0,0);}}},pagingPrevious:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e
var pageElement=wFORMS.behaviors['paging'].getPageElement(element);var pageIndex=wFORMS.behaviors['paging'].getPageIndex(pageElement)-1;var previousPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(previousPageElement){pageElement.className=pageElement.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");previousPageElement.className+=' '+wFORMS.className_pagingCurrent;var form=wFORMS.behaviors['paging'].getFormElement(previousPageElement);wFORMS.behaviors['paging'].hideSubmitButton(form);if(wFORMS.behaviors['paging'].onPageChange){wFORMS.behaviors['paging'].onPageChange(previousPageElement);}
window.scroll(0,0);}},showSubmitButton:function(form){var buttons=form.getElementsByTagName('input');for(var i=0;i<buttons.length;i++){if(buttons[i].type&&buttons[i].type.toLowerCase()=='submit'){buttons[i].className=buttons[i].className.replace(wFORMS.className_hideSubmit,"");}}},hideSubmitButton:function(form){var buttons=form.getElementsByTagName('input');for(var i=0;i<buttons.length;i++){if(buttons[i].type&&buttons[i].type.toLowerCase()=='submit'&&!wFORMS.helpers.hasClass(buttons[i],wFORMS.className_hideSubmit)){buttons[i].className+=' '+wFORMS.className_hideSubmit;}}},isLastPage:function(pageIndex){if(isNaN(pageIndex)){pageIndex=parseInt(pageIndex.replace(/[\D]*/,""));}
pageIndex++;var furtherPageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());if(!furtherPageElement)
return true;return false;},gotoPage:function(pageIndex){if(isNaN(pageIndex)){var pageElement=document.getElementById(pageIndex);}else{var pageElement=document.getElementById(wFORMS.idPrefix_pageIndex+pageIndex.toString());}
if(!pageElement)return false;var form=wFORMS.behaviors['paging'].getFormElement(pageElement);var allElements=form.getElementsByTagName("*");for(var i=0;i<allElements.length;i++){var n=allElements[i];if(wFORMS.helpers.hasClass(allElements[i],wFORMS.className_pagingCurrent)){n.className=n.className.replace(new RegExp(wFORMS.className_pagingCurrent,"g"),"");break;}}
if(wFORMS.behaviors['paging'].isLastPage(pageIndex))
wFORMS.behaviors['paging'].showSubmitButton(form);else{wFORMS.behaviors['paging'].hideSubmitButton(form);}
pageElement.className+=' '+wFORMS.className_pagingCurrent;if(wFORMS.behaviors['paging'].onPageChange){wFORMS.behaviors['paging'].onPageChange(pageElement);}},getFormElement:function(element){var form=element.parentNode;while(form&&form.tagName!="FORM")
form=form.parentNode;return form;},getPageElement:function(element){var n=element.parentNode;while(n&&n.tagName!="FORM"&&(!n.className||!wFORMS.helpers.hasClass(n,wFORMS.className_paging)))
n=n.parentNode;if(n&&wFORMS.helpers.hasClass(n,wFORMS.className_paging))
return n;else
return null;},getPageIndex:function(element){if(element&&element.id)
return parseInt(element.id.replace(/[\D]*/,""));else
return null;}}}
if(wFORMS){wFORMS.className_repeat="repeat";wFORMS.className_delete="removeable";wFORMS.className_duplicateLink="duplicateLink";wFORMS.className_removeLink="removeLink";wFORMS.className_preserveRadioName="preserveRadioName";wFORMS.idSuffix_repeatCounter="-RC";wFORMS.idSuffix_duplicateLink="-wfDL";wFORMS.preserveRadioName=false;wFORMS.limitSwitchScope=true;if(!wFORMS.arrMsg)wFORMS.arrMsg=new Array();wFORMS.arrMsg[0]="Add another response";wFORMS.arrMsg[1]="Will duplicate this question or section."
wFORMS.arrMsg[2]="Remove";wFORMS.arrMsg[3]="Will remove this question or section."
wFORMS.behaviors['repeat']={onRepeat:null,onRemove:null,allowRepeat:null,evaluate:function(node){if(wFORMS.helpers.hasClass(node,wFORMS.className_repeat)){if(!node.id)
node.id=wFORMS.helpers.randomId();var repeatLink=document.getElementById(node.id+wFORMS.idSuffix_duplicateLink);if(!repeatLink){repeatLink=wFORMS.behaviors['repeat'].createRepeatLink(node.id);if(node.tagName.toUpperCase()=="TR"){var n=node.lastChild;while(n&&n.nodeType!=1)
n=n.previousSibling;if(n&&n.nodeType==1)
n.appendChild(repeatLink);}else
node.appendChild(repeatLink);}
var counterField=document.getElementById(node.id+wFORMS.idSuffix_repeatCounter);if(!counterField){if(document.all&&!window.opera){var counterFieldId=node.id+wFORMS.idSuffix_repeatCounter;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")==-1)
counterField=document.createElement("INPUT NAME=\""+counterFieldId+"\"");else
counterField=document.createElement("<INPUT NAME=\""+counterFieldId+"\"></INPUT>");counterField.type='hidden';counterField.id=counterFieldId;counterField.value="1";}
else{counterField=document.createElement("INPUT");counterField.setAttribute('type','hidden');counterField.setAttribute('value','1');counterField.setAttribute('name',node.id+wFORMS.idSuffix_repeatCounter);counterField.setAttribute('id',node.id+wFORMS.idSuffix_repeatCounter);}
var form=node.parentNode;while(form&&form.tagName.toUpperCase()!="FORM")
form=form.parentNode;form.appendChild(counterField);}
wFORMS.helpers.addEvent(repeatLink,'click',wFORMS.behaviors['repeat'].duplicateFieldGroup);}
if(wFORMS.helpers.hasClass(node,wFORMS.className_delete)){var removeLink=wFORMS.behaviors['repeat'].createRemoveLink();if(node.tagName.toUpperCase()=="TR"){var n=node.lastChild;while(n&&n.nodeType!=1)
n=n.previousSibling;if(n&&n.nodeType==1)
n.appendChild(removeLink);}else
node.appendChild(removeLink);}},createRepeatLink:function(id){var repeatLink=document.createElement("a");var spanNode=document.createElement("span");var textNode=document.createTextNode(wFORMS.arrMsg[0]);repeatLink.id=id+wFORMS.idSuffix_duplicateLink;repeatLink.setAttribute('href',"#");repeatLink.className=wFORMS.className_duplicateLink;repeatLink.setAttribute('title',wFORMS.arrMsg[1]);spanNode.appendChild(textNode);repeatLink.appendChild(spanNode);return repeatLink;},createRemoveLink:function(){var removeLink=document.createElement("a");var spanNode=document.createElement("span");var textNode=document.createTextNode(wFORMS.arrMsg[2]);removeLink.setAttribute('href',"#");removeLink.className=wFORMS.className_removeLink;removeLink.setAttribute('title',wFORMS.arrMsg[3]);spanNode.appendChild(textNode);removeLink.appendChild(spanNode);wFORMS.helpers.addEvent(removeLink,'click',wFORMS.behaviors['repeat'].removeFieldGroup);return removeLink;},duplicateFieldGroup:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e
var preserveRadioName=wFORMS.helpers.hasClass(element,wFORMS.className_preserveRadioName)?true:wFORMS.preserveRadioName;while(element&&!wFORMS.helpers.hasClass(element,wFORMS.className_duplicateLink)){element=element.parentNode;}
var idOfRepeatedSection=element.id.replace(wFORMS.idSuffix_duplicateLink,"");var element=document.getElementById(idOfRepeatedSection);if(element){var wBehavior=wFORMS.behaviors['repeat'];if(wBehavior.allowRepeat){if(!wBehavior.allowRepeat(element))return false;}
counterField=document.getElementById(element.id+wFORMS.idSuffix_repeatCounter);if(!counterField)return;var rowCount=parseInt(counterField.value)+1;var suffix="-"+rowCount.toString()
var dupTree=wBehavior.replicateTree(element,null,suffix,preserveRadioName);var insertNode=element.nextSibling;while(insertNode&&(insertNode.nodeType==3||wFORMS.helpers.hasClass(insertNode,wFORMS.className_delete))){insertNode=insertNode.nextSibling;}
element.parentNode.insertBefore(dupTree,insertNode);dupTree.className=element.className.replace(wFORMS.className_repeat,wFORMS.className_delete);document.getElementById(element.id+wFORMS.idSuffix_repeatCounter).value=rowCount;wFORMS.addBehaviors(dupTree);if(wBehavior.onRepeat)
wBehavior.onRepeat(element,dupTree);}
return wFORMS.helpers.preventEvent(e);},removeFieldGroup:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e
var element=element.parentNode;while(element&&!wFORMS.helpers.hasClass(element,wFORMS.className_delete)){element=element.parentNode;}
element.parentNode.removeChild(element);if(wFORMS.behaviors['repeat'].onRemove)
wFORMS.behaviors['repeat'].onRemove(element);return wFORMS.helpers.preventEvent(e);},removeRepeatCountSuffix:function(str){return str.replace(/-\d+$/,'');},replicateTree:function(element,parentElement,idSuffix,preserveRadioName){if(element.nodeType==3){if(element.parentNode.tagName.toUpperCase()!='TEXTAREA')
var newElement=document.createTextNode(element.data);}
else if(element.nodeType==1){if(wFORMS.helpers.hasClass(element,wFORMS.className_duplicateLink)||wFORMS.helpers.hasClass(element,wFORMS.className_removeLink))
return null;if(wFORMS.helpers.hasClass(element,wFORMS.className_delete))
return null;if(wFORMS.helpers.hasClass(element,wFORMS.className_repeat)&&parentElement!=null)
idSuffix=idSuffix.replace('-','__');if(!document.all||window.opera){var newElement=document.createElement(element.tagName);}else{var tagHtml=element.tagName;if(element.name)
if(element.tagName.toUpperCase()=="INPUT"&&element.type.toLowerCase()=="radio"&&preserveRadioName)
tagHtml+=" NAME='"+element.name+"' ";else
tagHtml+=" NAME='"+wFORMS.behaviors['repeat'].removeRepeatCountSuffix(element.name)+idSuffix+"' ";if(element.type){tagHtml+=" TYPE='"+element.type+"' ";}
if(element.selected)
tagHtml+=" SELECTED='SELECTED' ";if(element.checked)
tagHtml+=" CHECKED='CHECKED' ";if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")==-1)
var newElement=document.createElement(tagHtml);else
var newElement=document.createElement("<"+tagHtml+"></"+element.tagName+">");try{newElement.type=element.type;}catch(e){};}
for(var i=0;i<element.attributes.length;i++){var attribute=element.attributes[i];if(attribute.specified||attribute.nodeName.toLowerCase()=='value'){if(attribute.nodeName.toLowerCase()=="id"||attribute.nodeName.toLowerCase()=="name"||attribute.nodeName.toLowerCase()=="for"){if(wFORMS.hasBehavior('hint')&&attribute.nodeValue.indexOf(wFORMS.idSuffix_fieldHint)!=-1){var value=attribute.nodeValue;value=wFORMS.behaviors['repeat'].removeRepeatCountSuffix(value.substr(0,value.indexOf(wFORMS.idSuffix_fieldHint)))+idSuffix+wFORMS.idSuffix_fieldHint;}
else{if(element.tagName.toUpperCase()=="INPUT"&&element.getAttribute('type',false).toLowerCase()=="radio"&&attribute.nodeName.toLowerCase()=="name"&&preserveRadioName){var value=attribute.nodeValue;}
else{var value=attribute.nodeValue+idSuffix;}}}else{if(attribute.nodeName.toLowerCase()=="value"&&element.tagName.toUpperCase()=='INPUT'&&(element.type.toLowerCase()=='text'||element.type.toLowerCase()=='password'||element.type.toLowerCase()=='hidden'||element.type.toLowerCase()=='file'))
var value='';else if(attribute.nodeName.toLowerCase()=="rel"&&attribute.nodeValue.indexOf('wfHandled')!=-1){var value=attribute.nodeValue.replace('wfHandled','');}else
var value=attribute.nodeValue;}
switch(attribute.nodeName.toLowerCase()){case"class":newElement.className=value;break;case"style":if(element.style&&element.style.cssText)
newElement.style.cssText=element.style.cssText;break;case"onclick":newElement.onclick=element.onclick;break;case"onchange":newElement.onchange=element.onchange;break;case"onsubmit":newElement.onsubmit=element.onsubmit;break;case"onmouseover":newElement.onmouseover=element.onmouseover;break;case"onmouseout":newElement.onmouseout=element.onmouseout;break;case"onmousedown":newElement.onmousedown=element.onmousedown;break;case"onmouseup":newElement.onmouseup=element.onmouseup;break;case"ondblclick":newElement.ondblclick=element.ondblclick;break;case"onkeydown":newElement.onkeydown=element.onkeydown;break;case"onkeyup":newElement.onkeyup=element.onkeyup;break;case"onblur":newElement.onblur=element.onblur;break;case"onfocus":newElement.onfocus=element.onfocus;break;default:newElement.setAttribute(attribute.name,value,0);}}}}
if(parentElement&&newElement)
parentElement.appendChild(newElement);for(var i=0;i<element.childNodes.length;i++){wFORMS.behaviors['repeat'].replicateTree(element.childNodes[i],newElement,idSuffix,preserveRadioName);}
return newElement;}}}
if(wFORMS){wFORMS.classNamePrefix_switch="switch";wFORMS.className_switchIsOn="swtchIsOn";wFORMS.className_switchIsOff="swtchIsOff";wFORMS.classNamePrefix_offState="offstate";wFORMS.classNamePrefix_onState="onstate";wFORMS.switchScopeRootTag="";wFORMS.switchTriggers={};wFORMS.switchTargets={};wFORMS.behaviors['switch']={evaluate:function(node){if(wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_switch)){if(!node.id)node.id=wFORMS.helpers.randomId();var switchNames=wFORMS.behaviors['switch'].getSwitchNames(node);for(var i=0;i<switchNames.length;i++){if(!wFORMS.switchTriggers[switchNames[i]])
wFORMS.switchTriggers[switchNames[i]]=new Array();if(!wFORMS.switchTriggers[switchNames[i]][node.id])
wFORMS.switchTriggers[switchNames[i]].push(node.id);}
switch(node.tagName.toUpperCase()){case"OPTION":var selectNode=node.parentNode;while(selectNode&&selectNode.tagName.toUpperCase()!='SELECT'){var selectNode=selectNode.parentNode;}
if(!selectNode){alert('Error: invalid markup in SELECT field ?');return false;}
if(!selectNode.id)selectNode.id=wFORMS.helpers.randomId();if(!selectNode.getAttribute('rel')||selectNode.getAttribute('rel').indexOf('wfHandled')==-1){selectNode.setAttribute('rel',(selectNode.getAttribute('rel')||"")+' wfHandled');wFORMS.helpers.addEvent(selectNode,'change',wFORMS.behaviors['switch'].run);}
break;case"INPUT":if(node.type&&node.type.toLowerCase()=='radio'){var formElement=node.form;for(var j=0;j<formElement[node.name].length;j++){var radioNode=formElement[node.name][j];if(radioNode.type.toLowerCase()=='radio'){if(!radioNode.getAttribute('rel')||radioNode.getAttribute('rel').indexOf('wfHandled')==-1){wFORMS.helpers.addEvent(radioNode,'click',wFORMS.behaviors['switch'].run);radioNode.setAttribute('rel',(radioNode.getAttribute('rel')||"")+' wfHandled');}}}}else{wFORMS.helpers.addEvent(node,'click',wFORMS.behaviors['switch'].run);}
break;default:wFORMS.helpers.addEvent(node,'click',wFORMS.behaviors['switch'].run);break;}}
if(wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_offState)||wFORMS.helpers.hasClassPrefix(node,wFORMS.classNamePrefix_onState)){if(!node.id)node.id=wFORMS.helpers.randomId();var switchNames=wFORMS.behaviors['switch'].getSwitchNames(node);for(var i=0;i<switchNames.length;i++){if(!wFORMS.switchTargets[switchNames[i]])
wFORMS.switchTargets[switchNames[i]]=new Array();if(!wFORMS.switchTargets[switchNames[i]][node.id])
wFORMS.switchTargets[switchNames[i]].push(node.id);}}
if(node.tagName&&node.tagName.toUpperCase()=='FORM'){wFORMS.onLoadComplete.push(wFORMS.behaviors['switch'].init);}},init:function(){for(var switchName in wFORMS.switchTriggers){for(var i=0;i<wFORMS.switchTriggers[switchName].length;i++){var element=document.getElementById(wFORMS.switchTriggers[switchName][i]);if(wFORMS.behaviors['switch'].isTriggerOn(element,switchName)){if(element.tagName.toUpperCase()=='OPTION'){var element=element.parentNode;while(element&&element.tagName.toUpperCase()!='SELECT'){var element=element.parentNode;}}
wFORMS.behaviors['switch'].run(element);}}}},run:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var switches_ON=new Array();var switches_OFF=new Array();switch(element.tagName.toUpperCase()){case'SELECT':for(var i=0;i<element.options.length;i++){if(i==element.selectedIndex){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(element.options[i]));}else{switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(element.options[i]));}}
break;case'INPUT':if(element.type.toLowerCase()=='radio'){for(var i=0;i<element.form[element.name].length;i++){var radioElement=element.form[element.name][i];if(radioElement.checked){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(radioElement));}else{switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(radioElement));}}}else{if(element.checked||wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn)){switches_ON=switches_ON.concat(wFORMS.behaviors['switch'].getSwitchNames(element));}else{switches_OFF=switches_OFF.concat(wFORMS.behaviors['switch'].getSwitchNames(element));}}
break;default:break;}
for(var i=0;i<switches_OFF.length;i++){var elements=wFORMS.behaviors['switch'].getElementsBySwitchName(switches_OFF[i]);for(var j=0;j<elements.length;j++){var triggers=wFORMS.switchTriggers[switches_OFF[i]];var doSwitch=true;for(var k=0;k<triggers.length;k++){var trigger=document.getElementById(triggers[k]);if(wFORMS.behaviors['switch'].isTriggerOn(trigger,switches_OFF[i])){if(wFORMS.behaviors['switch'].isWithinSwitchScope(trigger,elements[j])){doSwitch=false;}}}
if(doSwitch){wFORMS.behaviors['switch'].switchState(elements[j],wFORMS.classNamePrefix_onState,wFORMS.classNamePrefix_offState);}}}
for(var i=0;i<switches_ON.length;i++){var elements=wFORMS.behaviors['switch'].getElementsBySwitchName(switches_ON[i]);for(var j=0;j<elements.length;j++){if(wFORMS.behaviors['switch'].isWithinSwitchScope(element,elements[j])){wFORMS.behaviors['switch'].switchState(elements[j],wFORMS.classNamePrefix_offState,wFORMS.classNamePrefix_onState);}}}},clear:function(e){wFORMS.switchTriggers={};wFORMS.switchTargets={};},getSwitchNames:function(element){var switchNames=new Array();var classNames=element.className.split(' ');for(var i=0;i<classNames.length;i++){if(classNames[i].indexOf(wFORMS.classNamePrefix_switch)==0){switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_switch.length+1));}
if(classNames[i].indexOf(wFORMS.classNamePrefix_onState)==0){switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_onState.length+1));}
else if(classNames[i].indexOf(wFORMS.classNamePrefix_offState)==0){switchNames.push(classNames[i].substr(wFORMS.classNamePrefix_offState.length+1));}}
return switchNames;},switchState:function(element,oldStateClass,newStateClass){if(!element||element.nodeType!=1)return;if(element.className){element.className=element.className.replace(oldStateClass,newStateClass);}
if(wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOff)){element.className=element.className.replace(wFORMS.className_switchIsOff,wFORMS.className_switchIsOn);}else if(wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn)){element.className=element.className.replace(wFORMS.className_switchIsOn,wFORMS.className_switchIsOff);}},getElementsBySwitchName:function(switchName){var elements=new Array();if(wFORMS.switchTargets[switchName]){for(var i=0;i<wFORMS.switchTargets[switchName].length;i++){var element=document.getElementById(wFORMS.switchTargets[switchName][i]);if(element)
elements.push(element);}}
return elements;},isTriggerOn:function(element,triggerName){if(!element)return false;if(element.tagName.toUpperCase()=='OPTION'){var selectElement=element.parentNode;while(selectElement&&selectElement.tagName.toUpperCase()!='SELECT'){var selectElement=selectElement.parentNode;}
if(!selectElement)return false;if(selectElement.selectedIndex==-1)return false;if(wFORMS.helpers.hasClass(selectElement.options[selectElement.selectedIndex],wFORMS.classNamePrefix_switch+'-'+triggerName)){return true;}}else{if(element.checked||wFORMS.helpers.hasClass(element,wFORMS.className_switchIsOn))
return true;}
return false;},isWithinSwitchScope:function(trigger,target){if(wFORMS.hasBehavior('repeat')&&wFORMS.limitSwitchScope==true){var scope=trigger;while(scope&&scope.tagName&&scope.tagName.toUpperCase()!='FORM'&&!wFORMS.helpers.hasClass(scope,wFORMS.className_repeat)&&!wFORMS.helpers.hasClass(scope,wFORMS.className_delete)){scope=scope.parentNode;}
if(wFORMS.helpers.hasClass(scope,wFORMS.className_repeat)||wFORMS.helpers.hasClass(scope,wFORMS.className_delete)){var scope2=target;while(scope2&&scope2.tagName&&scope2.tagName.toUpperCase()!='FORM'&&!wFORMS.helpers.hasClass(scope2,wFORMS.className_repeat)&&!wFORMS.helpers.hasClass(scope2,wFORMS.className_delete)){scope2=scope2.parentNode;}
if(scope==scope2){return true;}else{return false;}}else{return true;}}else
return true;}}}
if(wFORMS){wFORMS.preventSubmissionOnEnter=false;wFORMS.showAlertOnError=true;wFORMS.className_required="required";wFORMS.className_validationError_msg="errMsg";wFORMS.className_validationError_fld="errFld";wFORMS.classNamePrefix_validation="validate";wFORMS.idSuffix_fieldError="-E";wFORMS.behaviors['validation']={errMsg_required:"Campo obbligatorio.",errMsg_alpha:"Permessi solo caratteri [es. a-z, A-Z]",errMsg_email:"Indirizzo E-mail non valido.",errMsg_integer:"Please enter an integer.",errMsg_float:"Permessi solo numeri [es. 1-9].",errMsg_password:"Unsafe password. Your password should be between 4 and 12 characters long and use a combinaison of upper-case and lower-case letters.",errMsg_alphanum:"Solo numeri e caratteri [es. a-z 0-9].",errMsg_date:"This does not appear to be a valid date.",errMsg_notification:"%% errore(i) segnalati. Non \u00E8 possibile inviare il form.\nPer favore correggere le informazioni e riprovare.",errMsg_custom:"Please enter a valid value.",className_allRequired:"allrequired",jumpToErrorOnPage:null,currentPageIndex:-1,submitSwitchedOffFields:false,switchedOffFields:[],evaluate:function(node){if(node.tagName.toUpperCase()=="FORM"){if(wFORMS.functionName_formValidation.toString()==wFORMS.functionName_formValidation){wFORMS.functionName_formValidation=eval(wFORMS.functionName_formValidation);}
wFORMS.helpers.addEvent(node,'submit',wFORMS.functionName_formValidation);}},init:function(){},run:function(e){var element=wFORMS.helpers.getSourceElement(e);if(!element)element=e;var currentPageOnly=arguments.length>1?arguments[1]:false;wFORMS.behaviors['validation'].switchedOffFields=[];wFORMS.behaviors['validation'].jumpToErrorOnPage=null;if(wFORMS.preventSubmissionOnEnter){if(element.type&&element.type.toLowerCase()=='text')
return wFORMS.preventEvent(e);}
while(element&&element.tagName.toUpperCase()!='FORM'){element=element.parentNode;}
var nbErrors=wFORMS.behaviors['validation'].validateElement(element,currentPageOnly,true);wFORMS.behaviors['validation'].errorCount=nbErrors;if(nbErrors>0){if(wFORMS.behaviors['validation'].jumpToErrorOnPage){wFORMS.behaviors['paging'].gotoPage(wFORMS.behaviors['validation'].jumpToErrorOnPage);}
if(wFORMS.showAlertOnError){wFORMS.behaviors['validation'].showAlert(nbErrors);}
return wFORMS.helpers.preventEvent(e);}
if(!wFORMS.behaviors['validation'].submitSwitchedOffFields&&!currentPageOnly){for(var i=0;i<wFORMS.behaviors['validation'].switchedOffFields.length;i++){var element=wFORMS.behaviors['validation'].switchedOffFields[i];while(element.childNodes[0])
element.removeChild(element.childNodes[0]);}}
return true;},remove:function(){},validateElement:function(element){if(!element)return;var deep=arguments.length>2?arguments[2]:true;var currentPageOnly=arguments[1]?arguments[1]:false;var wBehavior=wFORMS.behaviors['validation'];if(wFORMS.hasBehavior('switch')&&wFORMS.helpers.hasClassPrefix(element,wFORMS.classNamePrefix_offState)){if(!wBehavior.submitSwitchedOffFields){wBehavior.switchedOffFields.push(element);}
return 0;}
if(wFORMS.hasBehavior('paging')&&wFORMS.helpers.hasClass(element,wFORMS.className_paging)){if(!wFORMS.helpers.hasClass(element,wFORMS.className_pagingCurrent)&&currentPageOnly)
return 0;wBehavior.currentPageIndex=wFORMS.behaviors['paging'].getPageIndex(element);}
var nbErrors=0;if(!wBehavior.checkRequired(element)){wBehavior.showError(element,wBehavior.errMsg_required);nbErrors++;}else{if(wFORMS.helpers.hasClassPrefix(element,wFORMS.classNamePrefix_validation)){var arrClasses=element.className.split(" ");for(j=0;j<arrClasses.length;j++){switch(arrClasses[j]){case"validate-alpha":if(!wBehavior.isAlpha(element.value)){wBehavior.showError(element,wBehavior.errMsg_alpha);nbErrors++;}
break;case"validate-alphanum":if(!wBehavior.isAlphaNum(element.value)){wBehavior.showError(element,wBehavior.errMsg_alphanum);nbErrors++;}
break;case"validate-date":if(!wBehavior.isDate(element.value)){wBehavior.showError(element,wBehavior.errMsg_date);nbErrors++;}
break;case"validate-time":break;case"validate-email":if(!wBehavior.isEmail(element.value)){wBehavior.showError(element,wBehavior.errMsg_email);nbErrors++;}
break;case"validate-integer":if(!wBehavior.isInteger(element.value)){wBehavior.showError(element,wBehavior.errMsg_integer);nbErrors++;}
break;case"validate-float":if(!wBehavior.isFloat(element.value)){wBehavior.showError(element,wBehavior.errMsg_float);nbErrors++;}
break;case"validate-strongpassword":if(!wBehavior.isPassword(element.value)){wBehavior.showError(element,wBehavior.errMsg_password);nbErrors++;}
break;case"validate-custom":var pattern=new RegExp("\/([^\/]*)\/([gi]*)");var matches=element.className.match(pattern);if(matches[0]){var validationPattern=new RegExp(matches[1],matches[2]);if(!element.value.match(validationPattern)){wBehavior.showError(element,wBehavior.errMsg_custom);nbErrors++;}}
break;}}}}
if(nbErrors==0){wBehavior.removeErrorMessage(element);}else{if(wBehavior.currentPageIndex>0&&!wBehavior.jumpToErrorOnPage){wBehavior.jumpToErrorOnPage=wBehavior.currentPageIndex;}}
if(deep){for(var i=0;i<element.childNodes.length;i++){if(element.childNodes[i].nodeType==1){nbErrors+=wBehavior.validateElement(element.childNodes[i],currentPageOnly,deep);}}}
return nbErrors;},checkRequired:function(element){var wBehavior=wFORMS.behaviors['validation'];if(wFORMS.helpers.hasClass(element,wFORMS.className_required)){switch(element.tagName.toUpperCase()){case"INPUT":var inputType=element.getAttribute("type");if(!inputType)inputType='text';switch(inputType.toLowerCase()){case"checkbox":return element.checked;break;case"radio":return element.checked;break;default:return!wBehavior.isEmpty(element.value);}
break;case"SELECT":if(element.selectedIndex==-1){return false;}else
return!wBehavior.isEmpty(element.options[element.selectedIndex].value);break;case"TEXTAREA":return!wBehavior.isEmpty(element.value);break;default:return wBehavior.checkOneRequired(element);break;}}else if(wFORMS.helpers.hasClass(element,wBehavior.className_allRequired)){return wBehavior.checkAllRequired(element);}
return true;},checkOneRequired:function(element){if(element.nodeType!=1)return false;var tagName=element.tagName.toUpperCase();var wBehavior=wFORMS.behaviors['validation'];if(tagName=="INPUT"||tagName=="SELECT"||tagName=="TEXTAREA"){var value=wBehavior.getFieldValue(element);if(!wBehavior.isEmpty(value)){return true;}}
for(var i=0;i<element.childNodes.length;i++){if(wBehavior.checkOneRequired(element.childNodes[i]))return true;}
return false;},checkAllRequired:function(element){if(element.nodeType!=1)return true;var tagName=element.tagName.toUpperCase();var wBehavior=wFORMS.behaviors['validation'];if(tagName=="INPUT"||tagName=="SELECT"||tagName=="TEXTAREA"){var value=wBehavior.getFieldValue(element);if(wBehavior.isEmpty(value)){return false;}}
for(var i=0;i<element.childNodes.length;i++){if(!wBehavior.checkAllRequired(element.childNodes[i]))return false;}
return true;},getFieldValue:function(element){var value=null;if(element&&element.tagName){if(element.tagName.toUpperCase()=="INPUT"){var inputType=element.getAttribute("type");if(!inputType)inputType='text';switch(inputType.toLowerCase()){case"checkbox":value=element.checked?element.value:null;break;case"radio":var radioGroup=element.form[element.name];for(var i=0;i<radioGroup.length;i++){if(radioGroup[i].checked){if(!value)value=new Array();value[value.length]=radioGroup[i].value;}}
break;default:value=element.value;}}else if(element.tagName.toUpperCase()=="SELECT"){if(element.selectedIndex!=-1)
value=element.options[element.selectedIndex].value
else
value=null;}else if(element.tagName.toUpperCase()=="TEXTAREA"){value=element.value;}}
return value;},isEmpty:function(s){var regexpWhitespace=/^\s+$/;return((s==null)||(s.length==0)||regexpWhitespace.test(s));},isAlpha:function(s){var regexpAlphabetic=/^[a-zA-Z\s]+$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexpAlphabetic.test(s);},isAlphaNum:function(s){var validChars=/^[\w\s]+$/;return wFORMS.behaviors['validation'].isEmpty(s)||validChars.test(s);},isDate:function(s){var testDate=new Date(s);return wFORMS.behaviors['validation'].isEmpty(s)||!isNaN(testDate);},isEmail:function(s){var regexpEmail=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexpEmail.test(s);},isInteger:function(s){var regexp=/^[+]?\d+$/;return wFORMS.behaviors['validation'].isEmpty(s)||regexp.test(s);},isFloat:function(s){return wFORMS.behaviors['validation'].isEmpty(s)||!isNaN(parseFloat(s));},isPassword:function(s){return wFORMS.behaviors['validation'].isEmpty(s);},showError:function(element,errorMsg){wFORMS.behaviors['validation'].removeErrorMessage(element);if(!element.id)element.id=wFORMS.helpers.randomId();element.className+=" "+wFORMS.className_validationError_fld;var msgNode=document.createTextNode(" "+errorMsg);var fe=document.getElementById(element.id+wFORMS.idSuffix_fieldError);if(!fe){fe=document.createElement("div");fe.setAttribute('id',element.id+wFORMS.idSuffix_fieldError);var fl=document.getElementById(element.id+wFORMS.idSuffix_fieldLabel);if(fl)
fl.parentNode.insertBefore(fe,fl.nextSibling);else
element.parentNode.insertBefore(fe,element.nextSibling);}
fe.appendChild(msgNode);fe.className+=" "+wFORMS.className_validationError_msg;},showAlert:function(nbTotalErrors){alert(wFORMS.behaviors['validation'].errMsg_notification.replace('%%',nbTotalErrors));},removeErrorMessage:function(element){if(wFORMS.helpers.hasClass(element,wFORMS.className_validationError_fld)){var rErrClass=new RegExp(wFORMS.className_validationError_fld,"gi");element.className=element.className.replace(rErrClass,"");var errorMessage=document.getElementById(element.id+wFORMS.idSuffix_fieldError);if(errorMessage){errorMessage.innerHTML="";}}}}
wFORMS.functionName_formValidation=wFORMS.behaviors['validation'].run;wFORMS.formValidation=wFORMS.behaviors['validation'].run;wFORMS.arrErrorMsg=new Array();wFORMS.arrErrorMsg[0]=wFORMS.behaviors['validation'].errMsg_required;wFORMS.arrErrorMsg[1]=wFORMS.behaviors['validation'].errMsg_alpha;wFORMS.arrErrorMsg[2]=wFORMS.behaviors['validation'].errMsg_email;wFORMS.arrErrorMsg[3]=wFORMS.behaviors['validation'].errMsg_integer;wFORMS.arrErrorMsg[4]=wFORMS.behaviors['validation'].errMsg_float;wFORMS.arrErrorMsg[5]=wFORMS.behaviors['validation'].errMsg_password;wFORMS.arrErrorMsg[6]=wFORMS.behaviors['validation'].errMsg_alphanum;wFORMS.arrErrorMsg[7]=wFORMS.behaviors['validation'].errMsg_date;wFORMS.arrErrorMsg[8]=wFORMS.behaviors['validation'].errMsg_notification;}