var datePickerController=(function datePickerController(){var debug=false,isOpera=Object.prototype.toString.call(window.opera)==="[object Opera]",isMoz=/mozilla/.test(navigator.userAgent.toLowerCase())&&!/(compatible|webkit)/.test(navigator.userAgent.toLowerCase()),languageInfo=parseUILanguage(),datePickers={},uniqueId=0,weeksInYearCache={},localeImport=false,nbsp=String.fromCharCode(160),describedBy="",nodrag=false,buttonTabIndex=true,returnLocaleDate=false,mouseWheel=true,cellFormat="d-sp-F-sp-Y",titleFormat="F-sp-d-cc-sp-Y",formatParts=isOpera?["placeholder"]:["placeholder","sp-F-sp-Y"],dividors=["dt","sl","ds","cc","sp"],dvParts="dt|sl|ds|cc|sp",dParts="d|j",mParts="m|n|M|F",yParts="Y|y",kbEvent=false,bespokeTitles={},finalOpacity=100,validFmtRegExp=/^((sp|dt|sl|ds|cc)|([d|D|l|j|N|w|S|W|M|F|m|n|t|Y|y]))(-((sp|dt|sl|ds|cc)|([d|D|l|j|N|w|S|W|M|F|m|n|t|Y|y])))*$/,rangeRegExp=/^((\d\d\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))$/,wcDateRegExp=/^(((\d\d\d\d)|(\*\*\*\*))((0[1-9]|1[012])|(\*\*))(0[1-9]|[12][0-9]|3[01]))$/;(function(){var scriptFiles=document.getElementsByTagName('script'),scriptInner=String(scriptFiles[scriptFiles.length-1].innerHTML).replace(/[\n\r\s\t]+/g," ").replace(/^\s+/,"").replace(/\s+$/,""),json=parseJSON(scriptInner);if(typeof json==="object"&&!("err"in json)){affectJSON(json);};if(typeof(fdLocale)!="object"){var head=document.getElementsByTagName("head")[0]||document.documentElement,loc=scriptFiles[scriptFiles.length-1].src.substr(0,scriptFiles[scriptFiles.length-1].src.lastIndexOf("/"))+"/lang/",script;for(var i=0;i<languageInfo.length;i++){script=document.createElement('script');script.type="text/javascript";script.src=loc+languageInfo[i]+".js";script.charSet="utf-8";/*@cc_on
                                /*@if(@_win32)
                                var bases = document.getElementsByTagName('base');
                                if (bases.length && bases[0].childNodes.length) {
                                        bases[0].appendChild(script);
                                } else {
                                        document.getElementsByTagName('head')[0].appendChild(script);
                                };
                                bases = null;
                                @else @*/
head.appendChild(script);/*@end
                                @*/};script=null;}else{returnLocaleDate=true;};})();function parseUILanguage(){var languageTag=document.getElementsByTagName('html')[0].getAttribute('lang')||document.getElementsByTagName('html')[0].getAttribute('xml:lang');if(!languageTag){languageTag="en";}else{languageTag=languageTag.toLowerCase();};return languageTag.search(/^([a-z]{2,3})-([a-z]{2})$/)!=-1?[languageTag.match(/^([a-z]{2,3})-([a-z]{2})$/)[1],languageTag]:[languageTag];};function affectJSON(json){if(typeof json!=="object"){return;};for(key in json){value=json[key];switch(key.toLowerCase()){case"lang":if(value.search(/^[a-z]{2,3}(-([a-z]{2}))?$/i)!=-1){languageInfo=[value.toLowerCase()];returnLocaleDate=true;};break;case"nodrag":nodrag=!!value;break;case"buttontabindex":buttonTabIndex=!!value;break;case"mousewheel":mouseWheel=!!value;break;case"cellformat":if(typeof value=="string"&&value.match(validFmtRegExp)){parseCellFormat(value);};break;case"titleformat":if(typeof value=="string"&&value.match(validFmtRegExp)){titleFormat=value;};break;case"describedby":if(typeof value=="string"){describedBy=value;};break;case"finalopacity":if(typeof value=='number'&&(+value>20&&+value<=100)){finalOpacity=parseInt(value,10);};break;case"bespoketitles":bespokeTitles={};for(var dt in value){bespokeTitles[dt]=value[dt];};};};};function parseCellFormat(value){if(isOpera){formatParts=["placeholder"];cellFormat="j-sp-F-sp-Y";return;};var parts=value.split("-"),fullParts=[],tmpParts=[],part;for(var pt=0;pt<parts.length;pt++){part=parts[pt];if(part=="j"||part=="d"){if(tmpParts.length){fullParts.push(tmpParts.join("-"));tmpParts=[];};fullParts.push("placeholder");}else{tmpParts.push(part);};};if(tmpParts.length){fullParts.push(tmpParts.join("-"));};if(!fullParts.length||fullParts.length>3){formatParts=["placeholder","sp-F-sp-Y"];cellFormat="j-sp-F-sp-Y";return;};formatParts=fullParts;cellFormat=value;};function pad(value,length){length=length||2;return"0000".substr(0,length-Math.min(String(value).length,length))+value;};function addEvent(obj,type,fn){try{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{obj.addEventListener(type,fn,true);};}catch(err){}};function removeEvent(obj,type,fn){try{if(obj.detachEvent){obj.detachEvent("on"+type,obj[type+fn]);obj[type+fn]=null;}else{obj.removeEventListener(type,fn,true);};}catch(err){};};function stopEvent(e){e=e||document.parentWindow.event;if(e.stopPropagation){e.stopPropagation();e.preventDefault();};/*@cc_on
                @if(@_win32)
                e.cancelBubble = true;
                e.returnValue = false;
                @end
                @*/
return false;};function parseJSON(str){if(typeof str!=='string'||str==""){return{};};try{if(typeof JSON==="object"&&JSON.parse){return window.JSON.parse(str);}else if(/lang|buttontabindex|mousewheel|cellformat|titleformat|nodrag|describedby/.test(str.toLowerCase())){var f=Function(['var document,top,self,window,parent,Number,Date,Object,Function,','Array,String,Math,RegExp,Image,ActiveXObject;','return (',str.replace(/<\!--.+-->/gim,'').replace(/\bfunction\b/g,'functionÂ­'),');'].join(''));return f();};}catch(e){};if(debug){throw"Could not parse the JSON object";};return{"err":"Could not parse the JSON object"};};function setARIARole(element,role){if(element&&element.tagName){element.setAttribute("role",role);};};function setARIAProperty(element,property,value){if(element&&element.tagName){element.setAttribute("aria-"+property,value);};};function datePicker(options){this.dateSet=null;this.timerSet=false;this.visible=false;this.fadeTimer=null;this.timer=null;this.yearInc=0;this.monthInc=0;this.dayInc=0;this.mx=0;this.my=0;this.x=0;this.y=0;this.created=false;this.disabled=false;this.opacity=0;this.opacityTo=99;this.inUpdate=false;this.kbEventsAdded=false;this.fullCreate=false;this.selectedTD=null;this.cursorTD=null;this.cursorDate=options.cursorDate?options.cursorDate:"",this.date=options.cursorDate?new Date(+options.cursorDate.substr(0,4),+options.cursorDate.substr(4,2)-1,+options.cursorDate.substr(6,2)):new Date();this.defaults={};this.dynDisabledDates={};this.firstDayOfWeek=localeImport.firstDayOfWeek;this.interval=new Date();this.clickActivated=false;this.noFocus=true;this.kbEvent=false;this.disabledDates=false;this.enabledDates=false;this.delayedUpdate=false;this.bespokeTitles={};for(var thing in options){if(thing.search(/callbacks|formElements|formatMasks/)!=-1)continue;this[thing]=options[thing];};/*@cc_on
                @if(@_win32)                   
                this.iePopUp             = null;
                this.isIE7               = false;                 
                @end
                @*/
/*@cc_on
                @if(@_jscript_version <= 5.7)
                this.isIE7               = document.documentElement && typeof document.documentElement.style.maxHeight != "undefined";
                @end
                @*/
for(var i=0,prop;prop=["callbacks","formElements","formatMasks"][i];i++){this[prop]={};for(var thing in options[prop]){this[prop][thing]=options[prop][thing];};};this.date.setHours(5);this.changeHandler=function(){o.setDateFromInput();o.callback("dateset",o.createCbArgObj());};this.createCbArgObj=function(){return this.dateSet?{"id":this.id,"date":this.dateSet,"dd":pad(this.date.getDate()),"mm":pad(this.date.getMonth()+1),"yyyy":this.date.getFullYear()}:{"id":this.id,"date":null,"dd":null,"mm":null,"yyyy":null};};this.getScrollOffsets=function(){if(typeof(window.pageYOffset)=='number'){return[window.pageXOffset,window.pageYOffset];}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){return[document.body.scrollLeft,document.body.scrollTop];}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){return[document.documentElement.scrollLeft,document.documentElement.scrollTop];};return[0,0];};this.reposition=function(){if(!o.created||o.staticPos){return;};o.div.style.visibility="hidden";o.div.style.left=o.div.style.top="0px";o.div.style.display="block";var osh=o.div.offsetHeight,osw=o.div.offsetWidth,elem=document.getElementById('fd-but-'+o.id),pos=o.truePosition(elem),trueBody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body,sOffsets=o.getScrollOffsets(),scrollTop=sOffsets[1],scrollLeft=sOffsets[0],fitsBottom=parseInt(trueBody.clientHeight+scrollTop)>parseInt(osh+pos[1]+elem.offsetHeight+2),fitsTop=parseInt(pos[1]-(osh+elem.offsetHeight+2))>parseInt(scrollTop);o.div.style.visibility="visible";o.div.style.left=Number(parseInt(trueBody.clientWidth+scrollLeft)<parseInt(osw+pos[0])?Math.abs(parseInt((trueBody.clientWidth+scrollLeft)-osw)):pos[0])+"px";o.div.style.top=(fitsBottom||!fitsTop)?Math.abs(parseInt(pos[1]+elem.offsetHeight+2))+"px":Math.abs(parseInt(pos[1]-(osh+2)))+"px";/*@cc_on
                        @if(@_jscript_version <= 5.7)
                        if(o.isIE7) return;
                        o.iePopUp.style.top    = o.div.style.top;
                        o.iePopUp.style.left   = o.div.style.left;
                        o.iePopUp.style.width  = osw + "px";
                        o.iePopUp.style.height = (osh - 2) + "px";
                        @end
                        @*/};this.removeOldFocus=function(){var td=document.getElementById(o.id+"-date-picker-hover");if(td){try{td.setAttribute(!/*@cc_on!@*/false?"tabIndex":"tabindex","-1");td.tabIndex=-1;td.className=td.className.replace(/date-picker-hover/,"");td.id="";td.onblur=null;td.onfocus=null;}catch(err){};};};this.addAccessibleDate=function(){var td=document.getElementById(o.id+"-date-picker-hover");if(td&&!(td.getElementsByTagName("span").length)){var ymd=td.className.match(/cd-([\d]{4})([\d]{2})([\d]{2})/),noS=(td.className.search(/date-picker-unused|out-of-range|day-disabled|no-selection|not-selectable/)!=-1),spn=document.createElement('span'),spnC;spn.className="fd-screen-reader";;while(td.firstChild)td.removeChild(td.firstChild);if(noS){spnC=spn.cloneNode(false);spnC.appendChild(document.createTextNode(getTitleTranslation(13)));td.appendChild(spnC);};for(var pt=0,part;part=formatParts[pt];pt++){if(part=="placeholder"){td.appendChild(document.createTextNode(+ymd[3]));}else{spnC=spn.cloneNode(false);spnC.appendChild(document.createTextNode(printFormattedDate(new Date(ymd[1],+ymd[2]-1,ymd[3]),part,true)));td.appendChild(spnC);};};};};this.setNewFocus=function(){var td=document.getElementById(o.id+"-date-picker-hover");if(td){try{td.setAttribute(!/*@cc_on!@*/false?"tabIndex":"tabindex","0");td.tabIndex=0;td.className=td.className.replace(/date-picker-hover/,"")+" date-picker-hover";if(!this.clickActivated){td.onblur=o.onblur;td.onfocus=o.onfocus;};if(!isOpera&&!this.clickActivated)o.addAccessibleDate();if(!this.noFocus&&!this.clickActivated){setTimeout(function(){try{td.focus();}catch(err){};},0);};}catch(err){};};};this.setCursorDate=function(yyyymmdd){if(String(yyyymmdd).search(/^([0-9]{8})$/)!=-1){this.date=new Date(+yyyymmdd.substr(0,4),+yyyymmdd.substr(4,2)-1,+yyyymmdd.substr(6,2));this.cursorDate=yyyymmdd;if(this.staticPos){this.updateTable();};};};this.updateTable=function(noCallback){if(!o||o.inUpdate||!o.created)return;o.inUpdate=true;o.removeOldFocus();if(o.timerSet&&!o.delayedUpdate){if(o.monthInc){var n=o.date.getDate(),d=new Date(o.date);d.setDate(2);d.setMonth(d.getMonth()+o.monthInc*1);d.setDate(Math.min(n,daysInMonth(d.getMonth(),d.getFullYear())));o.date=new Date(d);}else{o.date.setDate(Math.min(o.date.getDate()+o.dayInc,daysInMonth(o.date.getMonth()+o.monthInc,o.date.getFullYear()+o.yearInc)));o.date.setMonth(o.date.getMonth()+o.monthInc);o.date.setFullYear(o.date.getFullYear()+o.yearInc);};};o.outOfRange();if(!o.noToday){o.disableTodayButton();};o.showHideButtons(o.date);var cd=o.date.getDate(),cm=o.date.getMonth(),cy=o.date.getFullYear(),cursorDate=(String(cy)+pad(cm+1)+pad(cd)),tmpDate=new Date(cy,cm,1);tmpDate.setHours(5);var dt,cName,td,i,currentDate,cellAdded,col,currentStub,abbr,bespokeRenderClass,spnC,dateSetD,weekDayC=(tmpDate.getDay()+6)%7,firstColIndex=(((weekDayC-o.firstDayOfWeek)+7)%7)-1,dpm=daysInMonth(cm,cy),today=new Date(),stub=String(tmpDate.getFullYear())+pad(tmpDate.getMonth()+1),cellAdded=[4,4,4,4,4,4],lm=new Date(cy,cm-1,1),nm=new Date(cy,cm+1,1),daySub=daysInMonth(lm.getMonth(),lm.getFullYear()),stubN=String(nm.getFullYear())+pad(nm.getMonth()+1),stubP=String(lm.getFullYear())+pad(lm.getMonth()+1),weekDayN=(nm.getDay()+6)%7,weekDayP=(lm.getDay()+6)%7,today=today.getFullYear()+pad(today.getMonth()+1)+pad(today.getDate()),spn=document.createElement('span');o.firstDateShown=!o.constrainSelection&&o.fillGrid&&(0-firstColIndex<1)?String(stubP)+(daySub+(0-firstColIndex)):stub+"01";o.lastDateShown=!o.constrainSelection&&o.fillGrid?stubN+pad(41-firstColIndex-dpm):stub+String(dpm);o.currentYYYYMM=stub;bespokeRenderClass=o.callback("redraw",{id:o.id,dd:pad(cd),mm:pad(cm+1),yyyy:cy,firstDateDisplayed:o.firstDateShown,lastDateDisplayed:o.lastDateShown})||{};dts=o.getDates(cy,cm+1);o.checkSelectedDate();dateSetD=(o.dateSet!=null)?o.dateSet.getFullYear()+pad(o.dateSet.getMonth()+1)+pad(o.dateSet.getDate()):false;spn.className="fd-screen-reader";if(this.selectedTD!=null){setARIAProperty(this.selectedTD,"selected",false);this.selectedTD=null;};for(var curr=0;curr<42;curr++){row=Math.floor(curr/7);td=o.tds[curr];spnC=spn.cloneNode(false);while(td.firstChild)td.removeChild(td.firstChild);if((curr>firstColIndex&&curr<=(firstColIndex+dpm))||o.fillGrid){currentStub=stub;weekDay=weekDayC;dt=curr-firstColIndex;cName=[];selectable=true;if(dt<1){dt=daySub+dt;currentStub=stubP;weekDay=weekDayP;selectable=!o.constrainSelection;cName.push("month-out");}else if(dt>dpm){dt-=dpm;currentStub=stubN;weekDay=weekDayN;selectable=!o.constrainSelection;cName.push("month-out");};weekDay=(weekDay+dt+6)%7;cName.push("day-"+localeDefaults.dayAbbrs[weekDay].toLowerCase());currentDate=currentStub+String(dt<10?"0":"")+dt;if(o.rangeLow&&+currentDate<+o.rangeLow||o.rangeHigh&&+currentDate>+o.rangeHigh){td.className="out-of-range";td.title="";td.appendChild(document.createTextNode(dt));if(o.showWeeks){cellAdded[row]=Math.min(cellAdded[row],2);};}else{if(selectable){td.title=titleFormat?printFormattedDate(new Date(+String(currentStub).substr(0,4),+String(currentStub).substr(4,2)-1,+dt),titleFormat,true):"";cName.push("cd-"+currentDate+" yyyymm-"+currentStub+" mmdd-"+currentStub.substr(4,2)+pad(dt));}else{td.title=titleFormat?getTitleTranslation(13)+" "+printFormattedDate(new Date(+String(currentStub).substr(0,4),+String(currentStub).substr(4,2)-1,+dt),titleFormat,true):"";cName.push("yyyymm-"+currentStub+" mmdd-"+currentStub.substr(4,2)+pad(dt)+" not-selectable");};if(currentDate==today){cName.push("date-picker-today");};if(dateSetD==currentDate){cName.push("date-picker-selected-date");setARIAProperty(td,"selected","true");this.selectedTD=td;};if(o.disabledDays[weekDay]||dts[currentDate]==0){cName.push("day-disabled");if(titleFormat&&selectable){td.title=getTitleTranslation(13)+" "+td.title;};}
if(currentDate in bespokeRenderClass){cName.push(bespokeRenderClass[currentDate]);}
if(o.highlightDays[weekDay]){cName.push("date-picker-highlight");};if(cursorDate==currentDate){td.id=o.id+"-date-picker-hover";};td.appendChild(document.createTextNode(dt));td.className=cName.join(" ");if(o.showWeeks){cellAdded[row]=Math.min(cName[0]=="month-out"?3:1,cellAdded[row]);};};}else{td.className="date-picker-unused";td.appendChild(document.createTextNode(nbsp));td.title="";};if(o.showWeeks&&curr-(row*7)==6){while(o.wkThs[row].firstChild)o.wkThs[row].removeChild(o.wkThs[row].firstChild);o.wkThs[row].appendChild(document.createTextNode(cellAdded[row]==4&&!o.fillGrid?nbsp:getWeekNumber(cy,cm,curr-firstColIndex-6)));o.wkThs[row].className="date-picker-week-header"+(["",""," out-of-range"," month-out",""][cellAdded[row]]);};};var span=o.titleBar.getElementsByTagName("span");while(span[0].firstChild)span[0].removeChild(span[0].firstChild);while(span[1].firstChild)span[1].removeChild(span[1].firstChild);span[0].appendChild(document.createTextNode(getMonthTranslation(cm,false)+nbsp));span[1].appendChild(document.createTextNode(cy));if(o.timerSet){o.timerInc=50+Math.round(((o.timerInc-50)/1.8));o.timer=window.setTimeout(o.updateTable,o.timerInc);};o.inUpdate=o.delayedUpdate=false;o.setNewFocus();};this.destroy=function(){if(document.getElementById("fd-but-"+this.id)){document.getElementById("fd-but-"+this.id).parentNode.removeChild(document.getElementById("fd-but-"+this.id));};if(!this.created){return;};removeEvent(this.table,"mousedown",o.onmousedown);removeEvent(this.table,"mouseover",o.onmouseover);removeEvent(this.table,"mouseout",o.onmouseout);removeEvent(document,"mousedown",o.onmousedown);removeEvent(document,"mouseup",o.clearTimer);if(window.addEventListener&&!window.devicePixelRatio){try{window.removeEventListener('DOMMouseScroll',this.onmousewheel,false);}catch(err){};}else{removeEvent(document,"mousewheel",this.onmousewheel);removeEvent(window,"mousewheel",this.onmousewheel);};o.removeOnFocusEvents();clearTimeout(o.fadeTimer);clearTimeout(o.timer);/*@cc_on
                        @if(@_jscript_version <= 5.7)                         
                        if(!o.staticPos && !o.isIE7) {
                                try {
                                        o.iePopUp.parentNode.removeChild(o.iePopUp);
                                        o.iePopUp = null;
                                } catch(err) {};
                        };
                        @end
                        @*/
if(this.div&&this.div.parentNode){this.div.parentNode.removeChild(this.div);};o=null;};this.resizeInlineDiv=function(){o.div.style.width=o.table.offsetWidth+"px";o.div.style.height=o.table.offsetHeight+"px";};this.create=function(){if(document.getElementById("fd-"+this.id))return;this.noFocus=true;function createTH(details){var th=document.createElement('th');if(details.thClassName)th.className=details.thClassName;if(details.colspan){/*@cc_on
                                        /*@if (@_win32)
                                        th.setAttribute('colSpan',details.colspan);
                                        @else @*/
th.setAttribute('colspan',details.colspan);/*@end
                                        @*/};/*@cc_on
                                /*@if (@_win32)
                                th.unselectable = "on";
                                /*@end@*/
return th;};function createThAndButton(tr,obj){for(var i=0,details;details=obj[i];i++){var th=createTH(details);tr.appendChild(th);var but=document.createElement('span');but.className=details.className;but.id=o.id+details.id;but.appendChild(document.createTextNode(details.text||o.nbsp));but.title=details.title||"";/*@cc_on
                                        /*@if(@_win32)
                                        th.unselectable = but.unselectable = "on";
                                        /*@end@*/
th.appendChild(but);};};this.div=document.createElement('div');this.div.id="fd-"+this.id;this.div.className="datePicker";this.div.style.visibility="hidden";this.div.style.display="none";if(this.describedBy&&document.getElementById(this.describedBy)){setARIAProperty(this.div,"describedby",this.describedBy);};if(this.labelledBy){setARIAProperty(this.div,"labelledby",this.labelledBy.id);};var tr,row,col,tableHead,tableBody,tableFoot;this.table=document.createElement('table');this.table.className="datePickerTable";this.table.onmouseover=this.onmouseover;this.table.onmouseout=this.onmouseout;this.table.onclick=this.onclick;if(this.staticPos){this.table.onmousedown=this.onmousedown;};this.div.appendChild(this.table);var dragEnabledCN=!this.dragDisabled?" drag-enabled":"";if(!this.staticPos){this.div.style.visibility="hidden";this.div.className+=dragEnabledCN;document.getElementsByTagName('body')[0].appendChild(this.div);/*@cc_on
                                @if(@_jscript_version <= 5.7) 
                                
                                if(!this.isIE7) {                                         
                                        this.iePopUp = document.createElement('iframe');
                                        this.iePopUp.src = "javascript:'<html></html>';";
                                        this.iePopUp.setAttribute('className','iehack');
                                        // Remove iFrame from tabIndex                                        
			                this.iePopUp.setAttribute("tabIndex", -1);  			                
                                        // Hide it from ARIA aware technologies
			                setARIARole(this.iePopUp, "presentation");
                                        setARIAProperty(this.iePopUp, "hidden", "true"); 			                
                                        this.iePopUp.scrolling = "no";
                                        this.iePopUp.frameBorder = "0";
                                        this.iePopUp.name = this.iePopUp.id = this.id + "-iePopUpHack";
                                        document.body.appendChild(this.iePopUp);                                        
                                };
                                
                                @end
                                @*/
setARIAProperty(this.div,"hidden","true");}else{elem=document.getElementById(this.positioned?this.positioned:this.id);if(!elem){this.div=null;if(debug)throw this.positioned?"Could not locate a datePickers associated parent element with an id:"+this.positioned:"Could not locate a datePickers associated input with an id:"+this.id;return;};this.div.className+=" static-datepicker";if(this.positioned){elem.appendChild(this.div);}else{elem.parentNode.insertBefore(this.div,elem.nextSibling);};if(this.hideInput){for(var elemID in this.formElements){elem=document.getElementById(elemID);if(elem){elem.className+=" fd-hidden-input";};};};setTimeout(this.resizeInlineDiv,300);};setARIARole(this.div,"grid");if(this.statusFormat){tableFoot=document.createElement('tfoot');this.table.appendChild(tableFoot);tr=document.createElement('tr');tr.className="date-picker-tfoot";tableFoot.appendChild(tr);this.statusBar=createTH({thClassName:"date-picker-statusbar"+dragEnabledCN,colspan:this.showWeeks?8:7});tr.appendChild(this.statusBar);this.updateStatus();};tableHead=document.createElement('thead');this.table.appendChild(tableHead);tr=document.createElement('tr');setARIARole(tr,"presentation");tableHead.appendChild(tr);this.titleBar=createTH({thClassName:"date-picker-title"+dragEnabledCN,colspan:this.showWeeks?8:7});tr.appendChild(this.titleBar);tr=null;var span=document.createElement('span');span.appendChild(document.createTextNode(nbsp));span.className="month-display"+dragEnabledCN;this.titleBar.appendChild(span);span=document.createElement('span');span.appendChild(document.createTextNode(nbsp));span.className="year-display"+dragEnabledCN;this.titleBar.appendChild(span);span=null;tr=document.createElement('tr');setARIARole(tr,"presentation");tableHead.appendChild(tr);createThAndButton(tr,[{className:"prev-but prev-year",id:"-prev-year-but",text:"\u00AB",title:getTitleTranslation(2)},{className:"prev-but prev-month",id:"-prev-month-but",text:"\u2039",title:getTitleTranslation(0)},{colspan:this.showWeeks?4:3,className:"today-but",id:"-today-but",text:getTitleTranslation(4)},{className:"next-but next-month",id:"-next-month-but",text:"\u203A",title:getTitleTranslation(1)},{className:"next-but next-year",id:"-next-year-but",text:"\u00BB",title:getTitleTranslation(3)}]);tableBody=document.createElement('tbody');this.table.appendChild(tableBody);var colspanTotal=this.showWeeks?8:7,colOffset=this.showWeeks?0:-1,but,abbr;for(var rows=0;rows<7;rows++){row=document.createElement('tr');if(rows!=0){setARIARole(row,"row");tableBody.appendChild(row);}else{tableHead.appendChild(row);};for(var cols=0;cols<colspanTotal;cols++){if(rows===0||(this.showWeeks&&cols===0)){col=document.createElement('th');}else{col=document.createElement('td');setARIAProperty(col,"describedby",this.id+"-col-"+cols+(this.showWeeks?" "+this.id+"-row-"+rows:""));setARIAProperty(col,"selected","false");};/*@cc_on@*/
/*@if(@_win32)
                                        col.unselectable = "on";
                                        /*@end@*/
row.appendChild(col);if((this.showWeeks&&cols>0&&rows>0)||(!this.showWeeks&&rows>0)){setARIARole(col,"gridcell");}else{if(rows===0&&cols>colOffset){col.className="date-picker-day-header";col.scope="col";setARIARole(col,"columnheader");col.id=this.id+"-col-"+cols;}else{col.className="date-picker-week-header";col.scope="row";setARIARole(col,"rowheader");col.id=this.id+"-row-"+rows;};};};};col=row=null;this.ths=this.table.getElementsByTagName('thead')[0].getElementsByTagName('tr')[2].getElementsByTagName('th');for(var y=0;y<colspanTotal;y++){if(y==0&&this.showWeeks){this.ths[y].appendChild(document.createTextNode(getTitleTranslation(6)));this.ths[y].title=getTitleTranslation(8);continue;};if(y>(this.showWeeks?0:-1)){but=document.createElement("span");but.className="fd-day-header";/*@cc_on@*/
/*@if(@_win32)
                                        but.unselectable = "on";
                                        /*@end@*/
this.ths[y].appendChild(but);};};but=null;this.trs=this.table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');this.tds=this.table.getElementsByTagName('tbody')[0].getElementsByTagName('td');this.butPrevYear=document.getElementById(this.id+"-prev-year-but");this.butPrevMonth=document.getElementById(this.id+"-prev-month-but");this.butToday=document.getElementById(this.id+"-today-but");this.butNextYear=document.getElementById(this.id+"-next-year-but");this.butNextMonth=document.getElementById(this.id+"-next-month-but");if(this.noToday){this.butToday.style.display="none";};if(this.showWeeks){this.wkThs=this.table.getElementsByTagName('tbody')[0].getElementsByTagName('th');this.div.className+=" weeks-displayed";};tableBody=tableHead=tr=createThAndButton=createTH=null;if(this.rangeLow&&this.rangeHigh&&(this.rangeHigh-this.rangeLow<7)){this.equaliseDates();};this.updateTableHeaders();this.created=true;this.updateTable();if(this.staticPos){this.visible=true;this.opacity=this.opacityTo=this.finalOpacity;this.div.style.visibility="visible";this.div.style.display="block";this.noFocus=true;this.fade();}else{this.reposition();this.div.style.visibility="visible";this.fade();this.noFocus=true;};this.callback("domcreate",{"id":this.id});};this.fade=function(){window.clearTimeout(o.fadeTimer);o.fadeTimer=null;var diff=Math.round(o.opacity+((o.opacityTo-o.opacity)/4));o.setOpacity(diff);if(Math.abs(o.opacityTo-diff)>3&&!o.noFadeEffect){o.fadeTimer=window.setTimeout(o.fade,50);}else{o.setOpacity(o.opacityTo);if(o.opacityTo==0){o.div.style.display="none";o.div.style.visibility="hidden";setARIAProperty(o.div,"hidden","true");o.visible=false;}else{setARIAProperty(o.div,"hidden","false");o.visible=true;};};};this.trackDrag=function(e){e=e||window.event;var diffx=(e.pageX?e.pageX:e.clientX?e.clientX:e.x)-o.mx;var diffy=(e.pageY?e.pageY:e.clientY?e.clientY:e.Y)-o.my;o.div.style.left=Math.round(o.x+diffx)>0?Math.round(o.x+diffx)+'px':"0px";o.div.style.top=Math.round(o.y+diffy)>0?Math.round(o.y+diffy)+'px':"0px";/*@cc_on
                        @if(@_jscript_version <= 5.7)                         
                        if(o.staticPos || o.isIE7) return;
                        o.iePopUp.style.top    = o.div.style.top;
                        o.iePopUp.style.left   = o.div.style.left;
                        @end
                        @*/};this.stopDrag=function(e){var b=document.getElementsByTagName("body")[0];b.className=b.className.replace(/fd-drag-active/g,"");removeEvent(document,'mousemove',o.trackDrag,false);removeEvent(document,'mouseup',o.stopDrag,false);o.div.style.zIndex=9999;};this.onmousedown=function(e){e=e||document.parentWindow.event;var el=e.target!=null?e.target:e.srcElement,origEl=el,hideDP=true,reg=new RegExp("^fd-(but-)?"+o.id+"$");o.mouseDownElem=null;while(el){if(el.id&&el.id.length&&el.id.search(reg)!=-1){hideDP=false;break;};try{el=el.parentNode;}catch(err){break;};};if(hideDP){hideAll();return true;};if((o.div.className+origEl.className).search('fd-disabled')!=-1){return true;};if(origEl.id.search(new RegExp("^"+o.id+"(-prev-year-but|-prev-month-but|-next-month-but|-next-year-but)$"))!=-1){o.mouseDownElem=origEl;addEvent(document,"mouseup",o.clearTimer);addEvent(origEl,"mouseout",o.clearTimer);var incs={"-prev-year-but":[0,-1,0],"-prev-month-but":[0,0,-1],"-next-year-but":[0,1,0],"-next-month-but":[0,0,1]},check=origEl.id.replace(o.id,""),dateYYYYMM=Number(o.date.getFullYear()+pad(o.date.getMonth()+1));o.timerInc=800;o.timerSet=true;o.dayInc=incs[check][0];o.yearInc=incs[check][1];o.monthInc=incs[check][2];o.accellerator=1;if(!(o.currentYYYYMM==dateYYYYMM)){if((o.currentYYYYMM<dateYYYYMM&&(o.yearInc==-1||o.monthInc==-1))||(o.currentYYYYMM>dateYYYYMM&&(o.yearInc==1||o.monthInc==1))){o.delayedUpdate=false;o.timerInc=1200;}else{o.delayedUpdate=true;o.timerInc=800;};};o.updateTable();return stopEvent(e);}else if(el.className.search("drag-enabled")!=-1){o.mx=e.pageX?e.pageX:e.clientX?e.clientX:e.x;o.my=e.pageY?e.pageY:e.clientY?e.clientY:e.Y;o.x=parseInt(o.div.style.left);o.y=parseInt(o.div.style.top);addEvent(document,'mousemove',o.trackDrag,false);addEvent(document,'mouseup',o.stopDrag,false);var b=document.getElementsByTagName("body")[0];b.className=b.className.replace(/fd-drag-active/g,"")+" fd-drag-active";o.div.style.zIndex=10000;return stopEvent(e);};return true;};this.onclick=function(e){if(o.opacity!=o.opacityTo||o.disabled)return stopEvent(e);e=e||document.parentWindow.event;var el=e.target!=null?e.target:e.srcElement;while(el.parentNode){if(el.tagName&&el.tagName.toLowerCase()=="td"){if(el.className.search(/cd-([0-9]{8})/)==-1||el.className.search(/date-picker-unused|out-of-range|day-disabled|no-selection|not-selectable/)!=-1)return stopEvent(e);var cellDate=el.className.match(/cd-([0-9]{8})/)[1];o.date=new Date(cellDate.substr(0,4),cellDate.substr(4,2)-1,cellDate.substr(6,2));o.dateSet=new Date(o.date);o.noFocus=true;o.callback("dateset",{"id":o.id,"date":o.dateSet,"dd":o.dateSet.getDate(),"mm":o.dateSet.getMonth()+1,"yyyy":o.dateSet.getFullYear()});o.returnFormattedDate();o.hide();o.stopTimer();break;}else if(el.id&&el.id==o.id+"-today-but"){o.date=new Date();o.updateTable();o.stopTimer();break;}else if(el.className.search(/date-picker-day-header/)!=-1){var cnt=o.showWeeks?-1:0,elem=el;while(elem.previousSibling){elem=elem.previousSibling;if(elem.tagName&&elem.tagName.toLowerCase()=="th")cnt++;};o.firstDayOfWeek=(o.firstDayOfWeek+cnt)%7;o.updateTableHeaders();break;};try{el=el.parentNode;}catch(err){break;};};return stopEvent(e);};this.show=function(autoFocus){if(this.staticPos){return;};var elem,elemID;for(elemID in this.formElements){elem=document.getElementById(this.id);if(!elem||(elem&&elem.disabled)){return;};};this.noFocus=true;if(!this.created||!document.getElementById('fd-'+this.id)){this.created=false;this.fullCreate=false;this.create();this.fullCreate=true;}else{this.setDateFromInput();this.reposition();};this.noFocus=!!!autoFocus;if(this.noFocus){this.clickActivated=true;addEvent(document,"mousedown",this.onmousedown);if(mouseWheel){if(window.addEventListener&&!window.devicePixelRatio)window.addEventListener('DOMMouseScroll',this.onmousewheel,false);else{addEvent(document,"mousewheel",this.onmousewheel);addEvent(window,"mousewheel",this.onmousewheel);};};}else{this.clickActivated=false;};this.opacityTo=this.finalOpacity;this.div.style.display="block";/*@cc_on
                        @if(@_jscript_version <= 5.7)                          
                        if(!o.isIE7) {
                                this.iePopUp.style.width = this.div.offsetWidth + "px";
                                this.iePopUp.style.height = this.div.offsetHeight + "px";
                                this.iePopUp.style.display = "block";
                        };                                
                        @end
                        @*/
this.setNewFocus();this.fade();var butt=document.getElementById('fd-but-'+this.id);if(butt){butt.className=butt.className.replace("dp-button-active","")+" dp-button-active";};};this.hide=function(){if(!this.visible||!this.created||!document.getElementById('fd-'+this.id))return;this.kbEvent=false;o.div.className=o.div.className.replace("datepicker-focus","");this.stopTimer();this.removeOnFocusEvents();this.clickActivated=false;if(this.statusBar){this.updateStatus(getTitleTranslation(9));};this.noFocus=true;this.setNewFocus();if(this.staticPos){return;};var butt=document.getElementById('fd-but-'+this.id);if(butt)butt.className=butt.className.replace("dp-button-active","");removeEvent(document,"mousedown",this.onmousedown);if(mouseWheel){if(window.addEventListener&&!window.devicePixelRatio){try{window.removeEventListener('DOMMouseScroll',this.onmousewheel,false);}catch(err){};}else{removeEvent(document,"mousewheel",this.onmousewheel);removeEvent(window,"mousewheel",this.onmousewheel);};};/*@cc_on
                        @if(@_jscript_version <= 5.7)
                        if(!this.isIE7) { this.iePopUp.style.display = "none"; };
                        @end
                        @*/
this.opacityTo=0;this.fade();};this.onblur=function(e){o.hide();};this.onfocus=function(e){o.noFocus=false;o.div.className=o.div.className.replace("datepicker-focus","")+" datepicker-focus";o.addOnFocusEvents();};this.onmousewheel=function(e){e=e||document.parentWindow.event;var delta=0;if(e.wheelDelta){delta=e.wheelDelta/120;if(isOpera&&window.opera.version()<9.2)delta=-delta;}else if(e.detail){delta=-e.detail/3;};var n=o.date.getDate(),d=new Date(o.date),inc=delta>0?1:-1;d.setDate(2);d.setMonth(d.getMonth()+inc*1);d.setDate(Math.min(n,daysInMonth(d.getMonth(),d.getFullYear())));if(o.outOfRange(d)){return stopEvent(e);};o.date=new Date(d);o.updateTable();if(o.statusBar){o.updateStatus(printFormattedDate(o.date,o.statusFormat,true));};return stopEvent(e);};this.onkeydown=function(e){o.stopTimer();if(!o.visible)return false;e=e||document.parentWindow.event;var kc=e.keyCode?e.keyCode:e.charCode;if(kc==13){var td=document.getElementById(o.id+"-date-picker-hover");if(!td||td.className.search(/cd-([0-9]{8})/)==-1||td.className.search(/no-selection|out-of-range|day-disabled/)!=-1){return stopEvent(e);};o.dateSet=new Date(o.date);o.callback("dateset",o.createCbArgObj());o.returnFormattedDate();o.hide();return stopEvent(e);}else if(kc==27){if(!o.staticPos){o.hide();return stopEvent(e);};return true;}else if(kc==32||kc==0){o.date=new Date();o.updateTable();return stopEvent(e);}else if(kc==9){if(!o.staticPos){return stopEvent(e);};return true;};/*@cc_on
                        @if(@_win32)                                 
                        if(new Date().getTime() - o.interval.getTime() < 50) { return stopEvent(e); }; 
                        o.interval = new Date();                                 
                        @end
                        @*/
if(isMoz){if(new Date().getTime()-o.interval.getTime()<50){return stopEvent(e);};o.interval=new Date();};if((kc>49&&kc<56)||(kc>97&&kc<104)){if(kc>96)kc-=(96-48);kc-=49;o.firstDayOfWeek=(o.firstDayOfWeek+kc)%7;o.updateTableHeaders();return stopEvent(e);};if(kc<33||kc>40)return true;var d=new Date(o.date),tmp,cursorYYYYMM=o.date.getFullYear()+pad(o.date.getMonth()+1);if(kc==36){d.setDate(1);}else if(kc==35){d.setDate(daysInMonth(d.getMonth(),d.getFullYear()));}else if(kc==33||kc==34){var inc=(kc==34)?1:-1;if(e.ctrlKey){d.setFullYear(d.getFullYear()+inc*1);}else{var n=o.date.getDate();d.setDate(2);d.setMonth(d.getMonth()+inc*1);d.setDate(Math.min(n,daysInMonth(d.getMonth(),d.getFullYear())));};}else if(kc==37){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()-1);}else if(kc==39||kc==34){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()+1);}else if(kc==38){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()-7);}else if(kc==40){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()+7);};if(o.outOfRange(d)){return stopEvent(e);};o.date=d;if(o.statusBar){o.updateStatus(o.getBespokeTitle(o.date.getFullYear(),o.date.getMonth()+1,o.date.getDate())||printFormattedDate(o.date,o.statusFormat,true));};var t=String(o.date.getFullYear())+pad(o.date.getMonth()+1)+pad(o.date.getDate());if(e.ctrlKey||(kc==33||kc==34)||t<o.firstDateShown||t>o.lastDateShown){o.updateTable();/*@cc_on
                                @if(@_win32)
                                o.interval = new Date();                        
                                @end
                                @*/}else{if(!o.noToday){o.disableTodayButton();};o.removeOldFocus();for(var i=0,td;td=o.tds[i];i++){if(td.className.search("cd-"+t)==-1){continue;};o.showHideButtons(o.date);td.id=o.id+"-date-picker-hover";o.setNewFocus();break;};};return stopEvent(e);};this.onmouseout=function(e){e=e||document.parentWindow.event;var p=e.toElement||e.relatedTarget;while(p&&p!=this)try{p=p.parentNode}catch(e){p=this;};if(p==this)return false;if(o.currentTR){o.currentTR.className="";o.currentTR=null;};if(o.statusBar){o.updateStatus(o.getBespokeTitle(o.date.getFullYear(),o.date.getMonth()+1,o.date.getDate())||printFormattedDate(o.date,o.statusFormat,true));};};this.onmouseover=function(e){e=e||document.parentWindow.event;var el=e.target!=null?e.target:e.srcElement;while(el.nodeType!=1){el=el.parentNode;};if(!el||!el.tagName){return;};var statusText=getTitleTranslation(9);switch(el.tagName.toLowerCase()){case"td":if(el.className.search(/date-picker-unused|out-of-range/)!=-1){statusText=getTitleTranslation(9);}if(el.className.search(/cd-([0-9]{8})/)!=-1){o.stopTimer();var cellDate=el.className.match(/cd-([0-9]{8})/)[1];o.removeOldFocus();el.id=o.id+"-date-picker-hover";o.setNewFocus();o.date=new Date(+cellDate.substr(0,4),+cellDate.substr(4,2)-1,+cellDate.substr(6,2));if(!o.noToday){o.disableTodayButton();};statusText=o.getBespokeTitle(+cellDate.substr(0,4),+cellDate.substr(4,2),+cellDate.substr(6,2))||printFormattedDate(o.date,o.statusFormat,true);};break;case"th":if(!o.statusBar){break;};if(el.className.search(/drag-enabled/)!=-1){statusText=getTitleTranslation(10);}else if(el.className.search(/date-picker-week-header/)!=-1){var txt=el.firstChild?el.firstChild.nodeValue:"";statusText=txt.search(/^(\d+)$/)!=-1?getTitleTranslation(7,[txt,txt<3&&o.date.getMonth()==11?getWeeksInYear(o.date.getFullYear())+1:getWeeksInYear(o.date.getFullYear())]):getTitleTranslation(9);};break;case"span":if(!o.statusBar){break;};if(el.className.search(/drag-enabled/)!=-1){statusText=getTitleTranslation(10);}else if(el.className.search(/day-([0-6])/)!=-1){var day=el.className.match(/day-([0-6])/)[1];statusText=getTitleTranslation(11,[getDayTranslation(day,false)]);}else if(el.className.search(/prev-year/)!=-1){statusText=getTitleTranslation(2);}else if(el.className.search(/prev-month/)!=-1){statusText=getTitleTranslation(0);}else if(el.className.search(/next-year/)!=-1){statusText=getTitleTranslation(3);}else if(el.className.search(/next-month/)!=-1){statusText=getTitleTranslation(1);}else if(el.className.search(/today-but/)!=-1&&el.className.search(/disabled/)==-1){statusText=getTitleTranslation(12);};break;default:statusText="";};while(el.parentNode){el=el.parentNode;if(el.nodeType==1&&el.tagName.toLowerCase()=="tr"){if(o.currentTR){if(el==o.currentTR)break;o.currentTR.className="";};el.className="dp-row-highlight";o.currentTR=el;break;};};if(o.statusBar&&statusText){o.updateStatus(statusText);};};this.clearTimer=function(){o.stopTimer();o.timerInc=800;o.yearInc=0;o.monthInc=0;o.dayInc=0;removeEvent(document,"mouseup",o.clearTimer);if(o.mouseDownElem!=null){removeEvent(o.mouseDownElem,"mouseout",o.clearTimer);};o.mouseDownElem=null;};var o=this;this.setDateFromInput();if(this.staticPos){this.create();}else{this.createButton();};(function(){var elemID,elem;for(elemID in o.formElements){elem=document.getElementById(elemID);if(elem&&elem.tagName&&elem.tagName.search(/select|input/i)!=-1){addEvent(elem,"change",o.changeHandler);};if(!elem||elem.disabled==true){o.disableDatePicker();};};})();this.fullCreate=true;};datePicker.prototype.addButtonEvents=function(but){function buttonEvent(e){e=e||window.event;var inpId=this.id.replace('fd-but-',''),dpVisible=isVisible(inpId),autoFocus=false,kbEvent=datePickers[inpId].kbEvent;if(kbEvent){datePickers[inpId].kbEvent=false;return;};if(e.type=="keydown"){datePickers[inpId].kbEvent=true;var kc=e.keyCode!=null?e.keyCode:e.charCode;if(kc!=13)return true;if(dpVisible){this.className=this.className.replace("dp-button-active","");hideAll();return stopEvent(e);};autoFocus=true;}else{datePickers[inpId].kbEvent=false;};this.className=this.className.replace("dp-button-active","");if(!dpVisible){this.className+=" dp-button-active";hideAll(inpId);showDatePicker(inpId,autoFocus);}else{hideAll();};return stopEvent(e);};but.onkeydown=buttonEvent;but.onclick=buttonEvent;if(!buttonTabIndex||this.bespokeTabIndex===false){but.setAttribute(!/*@cc_on!@*/false?"tabIndex":"tabindex","-1");but.tabIndex=-1;but.onkeydown=null;removeEvent(but,"keydown",buttonEvent);}else{but.setAttribute(!/*@cc_on!@*/false?"tabIndex":"tabindex",this.bespokeTabIndex);but.tabIndex=this.bespokeTabIndex;};};datePicker.prototype.createButton=function(){if(this.staticPos||document.getElementById("fd-but-"+this.id)){return;};var inp=document.getElementById(this.id),span=document.createElement('span'),but=document.createElement('a');but.href="#"+this.id;but.className="date-picker-control";but.title=getTitleTranslation(5);but.id="fd-but-"+this.id;span.appendChild(document.createTextNode(nbsp));but.appendChild(span);span=document.createElement('span');span.className="fd-screen-reader";span.appendChild(document.createTextNode(but.title));but.appendChild(span);setARIARole(but,"button");setARIAProperty(but,"haspopup",true);if(this.positioned&&document.getElementById(this.positioned)){document.getElementById(this.positioned).appendChild(but);}else{inp.parentNode.insertBefore(but,inp.nextSibling);};this.addButtonEvents(but);but=null;this.callback("dombuttoncreate",{id:this.id});};datePicker.prototype.setBespokeTitles=function(titles){this.bespokeTitles=titles;};datePicker.prototype.addBespokeTitles=function(titles){for(var dt in titles){this.bespokeTitles[dt]=titles[dt];};};datePicker.prototype.getBespokeTitle=function(y,m,d){var dt,dtFull,yyyymmdd=y+String(pad(m))+pad(d);for(dt in this.bespokeTitles){dtFull=dt.replace(/^(\*\*\*\*)/,y).replace(/^(\d\d\d\d)(\*\*)/,"$1"+pad(m));if(dtFull==yyyymmdd)return this.bespokeTitles[dt];};for(dt in bespokeTitles){dtFull=dt.replace(/^(\*\*\*\*)/,y).replace(/^(\d\d\d\d)(\*\*)/,"$1"+pad(m));if(dtFull==yyyymmdd)return bespokeTitles[dt];};return false;};datePicker.prototype.returnSelectedDate=function(){return this.dateSet;};datePicker.prototype.setRangeLow=function(range){this.rangeLow=(String(range).search(/^(\d\d\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/)==-1)?false:range;if(!this.inUpdate)this.setDateFromInput();};datePicker.prototype.setRangeHigh=function(range){this.rangeHigh=(String(range).search(/^(\d\d\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/)==-1)?false:range;if(!this.inUpdate)this.setDateFromInput();};datePicker.prototype.setDisabledDays=function(dayArray){if(!dayArray.length||dayArray.length!=7||dayArray.join("").search(/^([0|1]{7})$/)==-1){if(debug){throw"Invalid values located when attempting to call setDisabledDays";};return false;};this.disabledDays=dayArray;if(!this.inUpdate)this.setDateFromInput();};datePicker.prototype.setDisabledDates=function(dateObj){this.disabledDates={};this.addDisabledDates(dateObj);};datePicker.prototype.setEnabledDates=function(dateObj){this.enabledDates={};this.addEnabledDates(dateObj);};datePicker.prototype.addDisabledDates=function(dateObj){this.enabledDates=false;this.disabledDates=this.disabledDates||{};var startD;for(startD in dateObj){if((String(startD).search(wcDateRegExp)!=-1&&dateObj[startD]==1)||(String(startD).search(rangeRegExp)!=-1&&String(dateObj[startD]).search(rangeRegExp)!=-1)){this.disabledDates[startD]=dateObj[startD];};};if(!this.inUpdate)this.setDateFromInput();};datePicker.prototype.addEnabledDates=function(dateObj){this.disabledDates=false;this.enabledDates=this.enabledDates||{};var startD;for(startD in dateObj){if((String(startD).search(wcDateRegExp)!=-1&&dateObj[startD]==1)||(String(startD).search(rangeRegExp)!=-1&&String(dateObj[startD]).search(rangeRegExp)!=-1)){this.enabledDates[startD]=dateObj[startD];};};if(!this.inUpdate)this.setDateFromInput();};datePicker.prototype.setSelectedDate=function(yyyymmdd){if(String(yyyymmdd).search(wcDateRegExp)==-1){return false;};var match=yyyymmdd.match(rangeRegExp),dt=new Date(+match[2],+match[3]-1,+match[4]);if(!dt||isNaN(dt)||!this.canDateBeSelected(dt)){return false;};this.dateSet=new Date(dt);if(!this.inUpdate)this.updateTable();this.callback("dateset",this.createCbArgObj());this.returnFormattedDate();};datePicker.prototype.checkSelectedDate=function(){if(this.dateSet&&!this.canDateBeSelected(this.dateSet)){this.dateSet=null;};if(!this.inUpdate)this.updateTable();};datePicker.prototype.addOnFocusEvents=function(){if(this.kbEventsAdded||this.noFocus){return;};addEvent(document,"keypress",this.onkeydown);addEvent(document,"mousedown",this.onmousedown);/*@cc_on
                @if(@_win32)
                removeEvent(document, "keypress", this.onkeydown);
                addEvent(document, "keydown", this.onkeydown);                 
                @end
                @*/
if(window.devicePixelRatio){removeEvent(document,"keypress",this.onkeydown);addEvent(document,"keydown",this.onkeydown);};this.noFocus=false;this.kbEventsAdded=true;};datePicker.prototype.removeOnFocusEvents=function(){if(!this.kbEventsAdded){return;};removeEvent(document,"keypress",this.onkeydown);removeEvent(document,"keydown",this.onkeydown);removeEvent(document,"mousedown",this.onmousedown);this.kbEventsAdded=false;};datePicker.prototype.stopTimer=function(){this.timerSet=false;window.clearTimeout(this.timer);};datePicker.prototype.setOpacity=function(op){this.div.style.opacity=op/100;this.div.style.filter='alpha(opacity='+op+')';this.opacity=op;};datePicker.prototype.getDates=function(y,m){var dpm=daysInMonth(m-1,y),obj={},dds=this.getGenericDates(y,m,false),eds=this.getGenericDates(y,m,true),dts=y+pad(m);for(var i=1;i<=dpm;i++){dt=dts+""+pad(i);if(dds){obj[dt]=(dt in dds)?0:1;}else if(eds){obj[dt]=(dt in eds)?1:0;}else{obj[dt]=1;};};return obj;};datePicker.prototype.getGenericDates=function(y,m,enabled){var deDates=enabled?this.enabledDates:this.disabledDates;if(!deDates){return false;};m=pad(m);var obj={},lower=this.firstDateShown,upper=this.lastDateShown,dt1,dt2,rngLower,rngUpper;if(!upper||!lower){lower=this.firstDateShown=y+pad(m)+"01";upper=this.lastDateShown=y+pad(m)+pad(daysInMonth(m,y));};for(dt in deDates){dt1=dt.replace(/^(\*\*\*\*)/,y).replace(/^(\d\d\d\d)(\*\*)/,"$1"+m);dt2=deDates[dt];if(dt2==1){if(Number(dt1.substr(0,6))>=+String(this.firstDateShown).substr(0,6)&&Number(dt1.substr(0,6))<=+String(this.lastDateShown).substr(0,6)){obj[dt1]=1;};continue;};if(+String(this.firstDateShown).substr(0,6)>=Number(dt1.substr(0,6))&&+String(this.lastDateShown).substr(0,6)<=Number(dt2.substr(0,6))){if(Number(dt1.substr(0,6))==Number(dt2.substr(0,6))){for(var i=dt1;i<=dt2;i++){obj[i]=1;};continue;};rngLower=Number(dt1.substr(0,6))==+String(this.firstDateShown).substr(0,6)?dt1:lower;rngUpper=Number(dt2.substr(0,6))==+String(this.lastDateShown).substr(0,6)?dt2:upper;for(var i=+rngLower;i<=+rngUpper;i++){obj[i]=1;};};};return obj;};datePicker.prototype.truePosition=function(element){var pos=this.cumulativeOffset(element);if(isOpera){return pos;};var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body,dsocleft=document.all?iebody.scrollLeft:window.pageXOffset,dsoctop=document.all?iebody.scrollTop:window.pageYOffset,posReal=this.realOffset(element);return[pos[0]-posReal[0]+dsocleft,pos[1]-posReal[1]+dsoctop];};datePicker.prototype.realOffset=function(element){var t=0,l=0;do{t+=element.scrollTop||0;l+=element.scrollLeft||0;element=element.parentNode;}while(element);return[l,t];};datePicker.prototype.cumulativeOffset=function(element){var t=0,l=0;do{t+=element.offsetTop||0;l+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[l,t];};datePicker.prototype.equaliseDates=function(){var clearDayFound=false,tmpDate;for(var i=this.rangeLow;i<=this.rangeHigh;i++){tmpDate=String(i);if(!this.disabledDays[new Date(tmpDate.substr(0,4),tmpDate.substr(6,2),tmpDate.substr(4,2)).getDay()-1]){clearDayFound=true;break;};};if(!clearDayFound){this.disabledDays=[0,0,0,0,0,0,0]};};datePicker.prototype.outOfRange=function(tmpDate){if(!this.rangeLow&&!this.rangeHigh){return false;};var level=false;if(!tmpDate){level=true;tmpDate=this.date;};var d=pad(tmpDate.getDate()),m=pad(tmpDate.getMonth()+1),y=tmpDate.getFullYear(),dt=String(y)+String(m)+String(d);if(this.rangeLow&&+dt<+this.rangeLow){if(!level){return true;};this.date=new Date(this.rangeLow.substr(0,4),this.rangeLow.substr(4,2)-1,this.rangeLow.substr(6,2),5,0,0);return false;};if(this.rangeHigh&&+dt>+this.rangeHigh){if(!level){return true;};this.date=new Date(this.rangeHigh.substr(0,4),this.rangeHigh.substr(4,2)-1,this.rangeHigh.substr(6,2),5,0,0);};return false;};datePicker.prototype.canDateBeSelected=function(tmpDate){if(!tmpDate)return false;var d=pad(tmpDate.getDate()),m=pad(tmpDate.getMonth()+1),y=tmpDate.getFullYear(),dt=String(y)+String(m)+String(d),dd=this.getDates(y,m),wd=tmpDate.getDay()==0?7:tmpDate.getDay();if((this.rangeLow&&+dt<+this.rangeLow)||(this.rangeHigh&&+dt>+this.rangeHigh)||(dd[dt]==0)||this.disabledDays[wd-1]){return false;};return true;};datePicker.prototype.updateStatus=function(msg){while(this.statusBar.firstChild){this.statusBar.removeChild(this.statusBar.firstChild);};if(msg&&this.statusFormat.search(/-S|S-/)!=-1&&msg.search(/([0-9]{1,2})(st|nd|rd|th)/)!=-1){msg=msg.replace(/([0-9]{1,2})(st|nd|rd|th)/,"$1<sup>$2</sup>").split(/<sup>|<\/sup>/);var dc=document.createDocumentFragment();for(var i=0,nd;nd=msg[i];i++){if(/^(st|nd|rd|th)$/.test(nd)){var sup=document.createElement("sup");sup.appendChild(document.createTextNode(nd));dc.appendChild(sup);}else{dc.appendChild(document.createTextNode(nd));};};this.statusBar.appendChild(dc);}else{this.statusBar.appendChild(document.createTextNode(msg?msg:getTitleTranslation(9)));};};datePicker.prototype.setDateFromInput=function(){var origDateSet=this.dateSet,m=false,dt,elemID,elem,elemFmt,d,y,elemVal;this.dateSet=null;for(elemID in this.formElements){elem=document.getElementById(elemID);if(!elem){return;};elemVal=String(elem.value);elemFmt=this.formElements[elemID];dt=false;if(!(elemVal=="")){for(var i=0,fmt;fmt=this.formatMasks[elemID][i];i++){dt=parseDateString(elemVal,fmt);if(dt){break;};};};if(dt){if(elemFmt.search(new RegExp('['+dParts+']'))!=-1){d=dt.getDate();};if(elemFmt.search(new RegExp('['+mParts+']'))!=-1){m=dt.getMonth();};if(elemFmt.search(new RegExp('['+yParts+']'))!=-1){y=dt.getFullYear()};};};dt=false;if(d&&!(m===false)&&y){if(+d>daysInMonth(+m,+y)){d=daysInMonth(+m,+y);dt=false;}else{dt=new Date(+y,+m,+d);};};if(!dt||isNaN(dt)){var newDate=new Date(y||new Date().getFullYear(),!(m===false)?m:new Date().getMonth(),1);this.date=this.cursorDate?new Date(+this.cursorDate.substr(0,4),+this.cursorDate.substr(4,2)-1,+this.cursorDate.substr(6,2)):new Date(newDate.getFullYear(),newDate.getMonth(),Math.min(+d||new Date().getDate(),daysInMonth(newDate.getMonth(),newDate.getFullYear())));this.date.setHours(5);this.outOfRange();this.updateTable();return;};dt.setHours(5);this.date=new Date(dt);this.outOfRange();if(dt.getTime()==this.date.getTime()&&this.canDateBeSelected(this.date)){this.dateSet=new Date(this.date);};if(this.fullCreate)this.updateTable();this.returnFormattedDate(true);};datePicker.prototype.setSelectIndex=function(elem,indx){for(var opt=elem.options.length-1;opt>=0;opt--){if(elem.options[opt].value==indx){elem.selectedIndex=opt;return;};};};datePicker.prototype.returnFormattedDate=function(noFocus){if(!this.dateSet){return;};var d=pad(this.dateSet.getDate()),m=pad(this.dateSet.getMonth()+1),y=this.dateSet.getFullYear(),el=false,elemID,elem,elemFmt,fmtDate;noFocus=!!noFocus;for(elemID in this.formElements){elem=document.getElementById(elemID);if(!elem)return;if(!el)el=elem;elemFmt=this.formElements[elemID];fmtDate=printFormattedDate(this.dateSet,elemFmt,returnLocaleDate);if(elem.tagName.toLowerCase()=="input"){elem.value=fmtDate;}else{this.setSelectIndex(elem,fmtDate);};};if(this.staticPos){this.noFocus=true;this.updateTable();this.noFocus=false;};if(this.fullCreate){if(el.type&&el.type!="hidden"&&!noFocus){el.focus();};};};datePicker.prototype.disableDatePicker=function(){if(this.disabled)return;if(this.staticPos){this.removeOnFocusEvents();this.removeOldFocus();this.noFocus=true;this.div.className=this.div.className.replace(/dp-disabled/,"")+" dp-disabled";this.table.onmouseover=this.table.onclick=this.table.onmouseout=this.table.onmousedown=null;removeEvent(document,"mousedown",this.onmousedown);removeEvent(document,"mouseup",this.clearTimer);}else{if(this.visible)this.hide();var but=document.getElementById("fd-but-"+this.id);if(but){but.className=but.className.replace(/dp-disabled/,"")+" dp-disabled";setARIAProperty(but,"disabled",true);but.onkeydown=but.onclick=function(){return false;};but.setAttribute(!/*@cc_on!@*/false?"tabIndex":"tabindex","-1");but.tabIndex=-1;};};clearTimeout(this.timer);this.disabled=true;};datePicker.prototype.enableDatePicker=function(){if(!this.disabled)return;if(this.staticPos){this.removeOldFocus();this.noFocus=true;this.updateTable();this.div.className=this.div.className.replace(/dp-disabled/,"");this.disabled=false;this.table.onmouseover=this.onmouseover;this.table.onmouseout=this.onmouseout;this.table.onclick=this.onclick;this.table.onmousedown=this.onmousedown;}else{var but=document.getElementById("fd-but-"+this.id);if(but){but.className=but.className.replace(/dp-disabled/,"");setARIAProperty(but,"disabled",false);this.addButtonEvents(but);};};this.disabled=false;};datePicker.prototype.disableTodayButton=function(){var today=new Date();this.butToday.className=this.butToday.className.replace("fd-disabled","");if(this.outOfRange(today)||(this.date.getDate()==today.getDate()&&this.date.getMonth()==today.getMonth()&&this.date.getFullYear()==today.getFullYear())){this.butToday.className+=" fd-disabled";};};datePicker.prototype.updateTableHeaders=function(){var colspanTotal=this.showWeeks?8:7,colOffset=this.showWeeks?1:0,d,but;for(var col=colOffset;col<colspanTotal;col++){d=(this.firstDayOfWeek+(col-colOffset))%7;this.ths[col].title=getDayTranslation(d,false);if(col>colOffset){but=this.ths[col].getElementsByTagName("span")[0];while(but.firstChild){but.removeChild(but.firstChild);};but.appendChild(document.createTextNode(getDayTranslation(d,true)));but.title=this.ths[col].title;but.className=but.className.replace(/day-([0-6])/,"")+" day-"+d;but=null;}else{while(this.ths[col].firstChild){this.ths[col].removeChild(this.ths[col].firstChild);};this.ths[col].appendChild(document.createTextNode(getDayTranslation(d,true)));};this.ths[col].className=this.ths[col].className.replace(/date-picker-highlight/g,"");if(this.highlightDays[d]){this.ths[col].className+=" date-picker-highlight";};};if(this.created){this.updateTable();}};datePicker.prototype.callback=function(type,args){if(!type||!(type in this.callbacks)){return false;};var ret=false;for(var func=0;func<this.callbacks[type].length;func++){ret=this.callbacks[type][func](args||this.id);};return ret;};datePicker.prototype.showHideButtons=function(tmpDate){if(!this.butPrevYear){return;};var tdm=tmpDate.getMonth(),tdy=tmpDate.getFullYear();if(this.outOfRange(new Date((tdy-1),tdm,daysInMonth(+tdm,tdy-1)))){if(this.butPrevYear.className.search(/fd-disabled/)==-1){this.butPrevYear.className+=" fd-disabled";};if(this.yearInc==-1)this.stopTimer();}else{this.butPrevYear.className=this.butPrevYear.className.replace(/fd-disabled/g,"");};if(this.outOfRange(new Date(tdy,(+tdm-1),daysInMonth(+tdm-1,tdy)))){if(this.butPrevMonth.className.search(/fd-disabled/)==-1){this.butPrevMonth.className+=" fd-disabled";};if(this.monthInc==-1)this.stopTimer();}else{this.butPrevMonth.className=this.butPrevMonth.className.replace(/fd-disabled/g,"");};if(this.outOfRange(new Date((tdy+1),+tdm,1))){if(this.butNextYear.className.search(/fd-disabled/)==-1){this.butNextYear.className+=" fd-disabled";};if(this.yearInc==1)this.stopTimer();}else{this.butNextYear.className=this.butNextYear.className.replace(/fd-disabled/g,"");};if(this.outOfRange(new Date(tdy,+tdm+1,1))){if(this.butNextMonth.className.search(/fd-disabled/)==-1){this.butNextMonth.className+=" fd-disabled";};if(this.monthInc==1)this.stopTimer();}else{this.butNextMonth.className=this.butNextMonth.className.replace(/fd-disabled/g,"");};};var localeDefaults={fullMonths:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbrs:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],fullDays:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],dayAbbrs:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],titles:["Previous month","Next month","Previous year","Next year","Today","Show Calendar","wk","Week [[%0%]] of [[%1%]]","Week","Select a date","Click \u0026 Drag to move","Display \u201C[[%0%]]\u201D first","Go to Today\u2019s date","Disabled date :"],firstDayOfWeek:0,imported:false};var joinNodeLists=function(){if(!arguments.length){return[];}
var nodeList=[];for(var i=0;i<arguments.length;i++){for(var j=0,item;item=arguments[i][j];j++){nodeList[nodeList.length]=item;};};return nodeList;};var cleanUp=function(){var dp,fe;for(dp in datePickers){for(fe in datePickers[dp].formElements){if(!document.getElementById(fe)){datePickers[dp].destroy();datePickers[dp]=null;delete datePickers[dp];break;}};};};var hideAll=function(exception){var dp;for(dp in datePickers){if(!datePickers[dp].created||(exception&&exception==datePickers[dp].id))continue;datePickers[dp].hide();};};var hideDatePicker=function(inpID){if(inpID in datePickers){if(!datePickers[inpID].created||datePickers[inpID].staticPos)return;datePickers[inpID].hide();};};var showDatePicker=function(inpID,autoFocus){if(!(inpID in datePickers))return false;datePickers[inpID].clickActivated=!!!autoFocus;datePickers[inpID].show(autoFocus);return true;};var destroy=function(e){e=e||window.event;if(e.persisted){return;};for(dp in datePickers){datePickers[dp].destroy();datePickers[dp]=null;delete datePickers[dp];};datePickers=null;removeEvent(window,'unload',datePickerController.destroy);};var destroySingleDatePicker=function(id){if(id&&(id in datePickers)){datePickers[id].destroy();datePickers[id]=null;delete datePickers[id];};};var getTitleTranslation=function(num,replacements){replacements=replacements||[];if(localeImport.titles.length>num){var txt=localeImport.titles[num];if(replacements&&replacements.length){for(var i=0;i<replacements.length;i++){txt=txt.replace("[[%"+i+"%]]",replacements[i]);};};return txt.replace(/[[%(\d)%]]/g,"");};return"";};var getDayTranslation=function(day,abbreviation){var titles=localeImport[abbreviation?"dayAbbrs":"fullDays"];return titles.length&&titles.length>day?titles[day]:"";};var getMonthTranslation=function(month,abbreviation){var titles=localeImport[abbreviation?"monthAbbrs":"fullMonths"];return titles.length&&titles.length>month?titles[month]:"";};var daysInMonth=function(nMonth,nYear){nMonth=(nMonth+12)%12;return(((0==(nYear%4))&&((0!=(nYear%100))||(0==(nYear%400))))&&nMonth==1)?29:[31,28,31,30,31,30,31,31,30,31,30,31][nMonth];};var getWeeksInYear=function(Y){if(Y in weeksInYearCache){return weeksInYearCache[Y];};var X1,X2,NW;with(X1=new Date(Y,0,4)){setDate(getDate()-(6+getDay())%7);};with(X2=new Date(Y,11,28)){setDate(getDate()+(7-getDay())%7);};weeksInYearCache[Y]=Math.round((X2-X1)/604800000);return weeksInYearCache[Y];};var getWeekNumber=function(y,m,d){var d=new Date(y,m,d,0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};var printFormattedDate=function(date,fmt,useImportedLocale){if(!date||isNaN(date)){return"";};var parts=fmt.split("-"),str=[],d=date.getDate(),D=date.getDay(),m=date.getMonth(),y=date.getFullYear(),flags={"sp":" ","dt":".","sl":"/","ds":"-","cc":",","d":pad(d),"D":useImportedLocale?localeImport.dayAbbrs[D==0?6:D-1]:localeDefaults.dayAbbrs[D==0?6:D-1],"l":useImportedLocale?localeImport.fullDays[D==0?6:D-1]:localeDefaults.fullDays[D==0?6:D-1],"j":d,"N":D==0?7:D,"w":D,"W":getWeekNumber(y,m,d),"M":useImportedLocale?localeImport.monthAbbrs[m]:localeDefaults.monthAbbrs[m],"F":useImportedLocale?localeImport.fullMonths[m]:localeDefaults.fullMonths[m],"m":pad(m+1),"n":m+1,"t":daysInMonth(m,y),"y":String(y).substr(2,2),"Y":y,"S":["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};for(var pt=0,part;part=parts[pt];pt++){str.push(!(part in flags)?"":flags[part]);};return str.join("");};var parseDateString=function(str,fmt){var d=false,m=false,y=false,now=new Date(),parts=fmt.replace(/-sp(-sp)+/g,"-sp").split("-"),divds={"dt":".","sl":"/","ds":"-","cc":","},str=""+str;loopLabel:for(var pt=0,part;part=parts[pt];pt++){if(str.length==0){return false;};switch(part){case"sp":case"dt":case"sl":case"ds":case"cc":str=str.replace(/^(\s|\.|\/|,|-){1,}/,"");break;case"d":case"j":if(str.search(/^(3[01]|[12][0-9]|0?[1-9])/)!=-1){d=+str.match(/^(3[01]|[12][0-9]|0?[1-9])/)[0];str=str.substr(str.match(/^(3[01]|[12][0-9]|0?[1-9])/)[0].length);break;}else{return"";};case"D":case"l":l=localeDefaults.fullDays.concat(localeDefaults.dayAbbrs);if(localeImport.imported){l=l.concat(localeImport.fullDays).concat(localeImport.dayAbbrs);};for(var i=0;i<l.length;i++){if(new RegExp("^"+l[i],"i").test(str)){str=str.substr(l[i].length);continue loopLabel;};};break;case"N":case"w":if(str.search(part=="N"?/^([1-7])/:/^([0-6])/)!=-1){str=str.substr(1);};break;case"S":if(str.search(/^(st|nd|rd|th)/i)!=-1){str=str.substr(2);};break;case"W":if(str.search(/^([1-9]|[1234[0-9]|5[0-3])/)!=-1){str=str.substr(str.match(/^([1-9]|[1234[0-9]|5[0-3])/)[0].length);};break;case"M":case"F":l=localeDefaults.fullMonths.concat(localeDefaults.monthAbbrs);if(localeImport.imported){l=l.concat(localeImport.fullMonths).concat(localeImport.monthAbbrs);};for(var i=0;i<l.length;i++){if(str.search(new RegExp("^"+l[i],"i"))!=-1){str=str.substr(l[i].length);m=((i+12)%12);continue loopLabel;};};return"";case"m":case"n":l=/^(1[012]|0?[1-9])/;if(str.search(l)!=-1){m=+str.match(l)[0]-1;str=str.substr(str.match(l)[0].length);break;}else{return"";};case"t":if(str.search(/2[89]|3[01]/)!=-1){str=str.substr(2);break;};break;case"Y":if(str.search(/^(\d{4})/)!=-1){y=str.substr(0,4);str=str.substr(4);break;}else{return"";};case"y":if(str.search(/^(\d{4})/)!=-1){y=str.substr(0,4);str=str.substr(4);break;}else if(str.search(/^(0[0-9]|[1-9][0-9])/)!=-1){y=str.substr(0,2);y=+y<50?'20'+""+String(y):'19'+""+String(y);str=str.substr(2);break;}else return"";default:return"";};};if(!(str=="")||(d===false&&m===false&&y===false)){return false;};m=m===false?11:m;y=y===false?now.getFullYear():y;d=d===false?daysInMonth(+m,+y):d;if(d>daysInMonth(+m,+y)){return false;};var tmpDate=new Date(y,m,d);return!tmpDate||isNaN(tmpDate)?false:tmpDate;};var findLabelForElement=function(element){var label;if(element.parentNode&&element.parentNode.tagName.toLowerCase()=="label")lebel=element.parentNode;else{var labelList=document.getElementsByTagName('label');for(var lbl=0;lbl<labelList.length;lbl++){if((labelList[lbl]['htmlFor']&&labelList[lbl]['htmlFor']==element.id)||(labelList[lbl].getAttribute('for')==element.id)){label=labelList[lbl];break;};};};if(label&&!label.id){label.id=element.id+"_label";};return label;};var updateLanguage=function(){if(typeof(window.fdLocale)=="object"){localeImport={titles:fdLocale.titles,fullMonths:fdLocale.fullMonths,monthAbbrs:fdLocale.monthAbbrs,fullDays:fdLocale.fullDays,dayAbbrs:fdLocale.dayAbbrs,firstDayOfWeek:("firstDayOfWeek"in fdLocale)?fdLocale.firstDayOfWeek:0,imported:true};}else if(!localeImport){localeImport=localeDefaults;};};var loadLanguage=function(){updateLanguage();for(dp in datePickers){if(!datePickers[dp].created)continue;datePickers[dp].updateTable();};};var checkElem=function(elem){return!(!elem||!elem.tagName||!((elem.tagName.toLowerCase()=="input"&&(elem.type=="text"||elem.type=="hidden"))||elem.tagName.toLowerCase()=="select"));};var addDatePicker=function(options){updateLanguage();if(!options.formElements){if(debug)throw"No form elements stipulated within initialisation parameters";return;};options.id=(options.id&&(options.id in options.formElements))?options.id:"";options.formatMasks={};var testParts=[dParts,mParts,yParts],partsFound=[0,0,0],tmpPartsFound,matchedPart,newParts,indParts,fmt,fmtBag,fmtParts,newFormats,myMin,myMax;for(var elemID in options.formElements){elem=document.getElementById(elemID);if(!checkElem(elem)){if(debug)throw"The element with and id of '"+elemID+"' is of the wrong type or does not exist within the DOM";return false;};if(!options.id)options.id=elemID;fmt=options.formElements[elemID];if(!(fmt.match(validFmtRegExp))){if(debug)throw"The element with and id of '"+elemID+"' has the following incorrect date format assigned to it: "+fmt;return false;};fmtBag=[fmt];if(options.dateFormats&&(elemID in options.dateFormats)&&options.dateFormats[elemID].length){newFormats=[];for(var f=0,bDft;bDft=options.dateFormats[elemID][f];f++){if(!(bDft.match(validFmtRegExp))){if(debug)throw"The element with and id of '"+elemID+"' has the following incorrect date format assigned to it within the dateFormats parameter: "+bDft;return false;};newFormats.push(bDft);};fmtBag=fmtBag.concat(newFormats);};tmpPartsFound=[0,0,0];for(var i=0,testPart;testPart=testParts[i];i++){if(fmt.search(new RegExp('('+testPart+')'))!=-1){partsFound[i]=tmpPartsFound[i]=1;if(elem.tagName.toLowerCase()=="input"){matchedPart=fmt.match(new RegExp('('+testPart+')'))[0];newParts=String(matchedPart+"|"+testPart.replace(new RegExp("("+matchedPart+")"),"")).replace("||","|");indParts=newParts.split("|");newFormats=[];for(var z=0,bFmt;bFmt=fmtBag[z];z++){for(var x=0,indPart;indPart=indParts[x];x++){if(indPart==matchedPart)continue;newFormats.push(bFmt.replace(new RegExp('('+testPart+')(-|$)','g'),indPart+"-").replace(/-$/,""));};};fmtBag=fmtBag.concat(newFormats);};};};options.formatMasks[elemID]=fmtBag.concat();if(elem.tagName.toLowerCase()=="select"){myMin=myMax=0;var selOptions=elem.options;if(tmpPartsFound[0]&&tmpPartsFound[1]&&tmpPartsFound[2]){var yyyymmdd,cursorDate=false;if("disabledDates"in options){delete(options.disabledDates);};options.enabledDates={};for(i=0;i<selOptions.length;i++){for(var f=0,fmt;fmt=fmtBag[f];f++){dt=parseDateString(selOptions[i].value,fmt);if(dt){yyyymmdd=dt.getFullYear()+""+pad(dt.getMonth()+1)+""+pad(dt.getDate());if(!cursorDate)cursorDate=yyyymmdd;options.enabledDates[yyyymmdd]=1;if(!myMin||Number(yyyymmdd)<myMin){myMin=yyyymmdd;};if(!myMax||Number(yyyymmdd)>myMax){myMax=yyyymmdd;};break;};};};if(!options.cursorDate&&cursorDate)options.cursorDate=cursorDate;}else if(tmpPartsFound[1]&&tmpPartsFound[2]){var yyyymm;for(i=0;i<selOptions.length;i++){for(var f=0,fmt;fmt=fmtBag[f];f++){dt=parseDateString(selOptions[i].value,fmt);if(dt){yyyymm=dt.getFullYear()+""+pad(dt.getMonth()+1);if(!myMin||Number(yyyymm)<myMin){myMin=yyyymm;};if(!myMax||Number(yyyymm)>myMax){myMax=yyyymm;};break;};};};myMin+=""+"01";myMax+=""+daysInMonth(+myMax.substr(4,2)-1,+myMax.substr(0,4));}else if(tmpPartsFound[2]){var yyyy;for(i=0;i<selOptions.length;i++){for(var f=0,fmt;fmt=fmtBag[f];f++){dt=parseDateString(selOptions[i].value,fmt);if(dt){yyyy=dt.getFullYear();if(!myMin||Number(yyyy)<myMin){myMin=yyyy;};if(!myMax||Number(yyyy)>myMax){myMax=yyyy;};break;};};};myMin+="0101";myMax+="1231";};if(myMin&&(!options.rangeLow||(+options.rangeLow<+myMin)))options.rangeLow=myMin;if(myMax&&(!options.rangeHigh||(+options.rangeHigh>+myMin)))options.rangeHigh=myMax;};};if(!(partsFound[0]&&partsFound[1]&&partsFound[2])){if(debug)throw"Could not find all of the required date parts for element: "+elem.id;return false;};var opts={formElements:options.formElements,id:options.id,formatMasks:options.formatMasks,staticPos:!!(options.staticPos),positioned:options.positioned&&document.getElementById(options.positioned)?options.positioned:"",rangeLow:options.rangeLow&&String(options.rangeLow).search(rangeRegExp)!=-1?options.rangeLow:"",rangeHigh:options.rangeHigh&&String(options.rangeHigh).search(rangeRegExp)!=-1?options.rangeHigh:"",statusFormat:options.statusFormat&&String(options.statusFormat).search(validFmtRegExp)!=-1?options.statusFormat:"",noFadeEffect:!!(options.staticPos)?true:!!(options.noFadeEffect),dragDisabled:nodrag||!!(options.staticPos)?true:!!(options.dragDisabled),bespokeTabIndex:options.bespokeTabindex&&typeof options.bespokeTabindex=='number'?parseInt(options.bespokeTabindex,10):0,bespokeTitles:options.bespokeTitles||{},finalOpacity:options.finalOpacity&&typeof options.finalOpacity=='number'&&(options.finalOpacity>20&&options.finalOpacity<=100)?parseInt(+options.finalOpacity,10):(!!(options.staticPos)?100:finalOpacity),hideInput:!!(options.hideInput),noToday:!!(options.noTodayButton),showWeeks:!!(options.showWeeks),fillGrid:!!(options.fillGrid),constrainSelection:"constrainSelection"in options?!!(options.constrainSelection):true,cursorDate:options.cursorDate&&String(options.cursorDate).search(rangeRegExp)!=-1?options.cursorDate:"",labelledBy:findLabelForElement(elem),describedBy:(options.describedBy&&document.getElementById(options.describedBy))?options.describedBy:describedBy&&document.getElementById(describedBy)?describedBy:"",callbacks:options.callbackFunctions?options.callbackFunctions:{},highlightDays:options.highlightDays&&options.highlightDays.length&&options.highlightDays.length==7?options.highlightDays:[0,0,0,0,0,1,1],disabledDays:options.disabledDays&&options.disabledDays.length&&options.disabledDays.length==7?options.disabledDays:[0,0,0,0,0,0,0]};if(options.disabledDates){if(options.enabledDates)delete(options.enabledDates);opts.disabledDates={};var startD;for(startD in options.disabledDates){if((String(startD).search(wcDateRegExp)!=-1&&options.disabledDates[startD]==1)||(String(startD).search(rangeRegExp)!=-1&&String(options.disabledDates[startD]).search(rangeRegExp)!=-1)){opts.disabledDates[startD]=options.disabledDates[startD];};};}else if(options.enabledDates){var startD;opts.enabledDates={};for(startD in options.enabledDates){if((String(startD).search(wcDateRegExp)!=-1&&options.enabledDates[startD]==1)||(String(startD).search(rangeRegExp)!=-1&&String(options.enabledDates[startD]).search(rangeRegExp)!=-1)){opts.enabledDates[startD]=options.enabledDates[startD];};};};datePickers[options.id]=new datePicker(opts);datePickers[options.id].callback("create",datePickers[options.id].createCbArgObj());};var isVisible=function(id){return(!id||!(id in datePickers))?false:datePickers[id].visible;};addEvent(window,'unload',destroy);return{addEvent:function(obj,type,fn){return addEvent(obj,type,fn);},removeEvent:function(obj,type,fn){return removeEvent(obj,type,fn);},stopEvent:function(e){return stopEvent(e);},show:function(inpID){return showDatePicker(inpID,false);},hide:function(inpID){return hideDatePicker(inpID);},createDatePicker:function(options){addDatePicker(options);},destroyDatePicker:function(inpID){destroySingleDatePicker(inpID);},cleanUp:function(){cleanUp();},printFormattedDate:function(dt,fmt,useImportedLocale){return printFormattedDate(dt,fmt,useImportedLocale);},setDateFromInput:function(inpID){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].setDateFromInput();},setRangeLow:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers)){return false;};datePickers[inpID].setRangeLow(yyyymmdd);},setRangeHigh:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers)){return false;};datePickers[inpID].setRangeHigh(yyyymmdd);},setBespokeTitles:function(inpID,titles){if(!inpID||!(inpID in datePickers)){return false;};datePickers[inpID].setBespokeTitles(titles);},addBespokeTitles:function(inpID,titles){if(!inpID||!(inpID in datePickers)){return false;};datePickers[inpID].addBespokeTitles(titles);},parseDateString:function(str,format){return parseDateString(str,format);},setGlobalVars:function(json){affectJSON(json);},setSelectedDate:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers)){return false;};datePickers[inpID].setSelectedDate(yyyymmdd);},dateValidForSelection:function(inpID,dt){if(!inpID||!(inpID in datePickers))return false;return datePickers[inpID].canDateBeSelected(dt);},addDisabledDates:function(inpID,dts){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].addDisabledDates(dts);},setDisabledDates:function(inpID,dts){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].setDisabledDates(dts);},addEnabledDates:function(inpID,dts){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].addEnabledDates(dts);},setEnabledDates:function(inpID,dts){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].setEnabledDates(dts);},disable:function(inpID){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].disableDatePicker();},enable:function(inpID){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].enableDatePicker();},setCursorDate:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers))return false;datePickers[inpID].setCursorDate(yyyymmdd);},getSelectedDate:function(inpID){return(!inpID||!(inpID in datePickers))?false:datePickers[inpID].returnSelectedDate();},loadLanguage:function(){loadLanguage();},setDebug:function(dbg){debug=!!(dbg);}};})();function ddpanel(setting){setting.dir="up"
if(setting.stateconfig.persiststate&&ddpanel.getCookie(setting.ids[0])=="down"){setting.dir="up"}
if(setting.dir=="up"){document.write('<style type="text/css">\n')
document.write('#'+setting.ids[1]+'{height:'+parseInt(setting.stateconfig.initial)+'px; overflow:hidden}\n')
document.write('</style>\n')}
setting.stateconfig.initial=parseInt(setting.stateconfig.initial)
this.setting=setting
if(setting.pointerimage.enabled){var img1=new Image(),img2=new Image()
img1.src=setting.pointerimage.src[0]
img2.src=setting.pointerimage.src[1]}
var thispanel=this
if(window.addEventListener)
ddpanel.addEvent(window,function(e){thispanel.initpanel(setting)},"load")
else
ddpanel.addEvent(window,function(e){setTimeout(function(){thispanel.initpanel(setting)},100)},"load")
ddpanel.addEvent(window,function(e){thispanel.uninit(setting)},"unload")}
ddpanel.events_array=[]
ddpanel.addEvent=function(target,functionref,tasktype){var evtmodel=target.addEventListener?"w3c":"ie"
var evtaction=evtmodel=="w3c"?"addEventListener":"attachEvent"
var i=this.events_array.push({target:target,tasktype:(evtmodel=="ie"?"on":"")+tasktype,listener:evtmodel=="ie"?function(){return functionref.call(target,window.event)}:functionref})-1
target[evtaction](this.events_array[i].tasktype,this.events_array[i].listener,evtmodel=="w3c"?false:null)}
ddpanel.removeEvent=function(target,functionref,tasktype){var evtmodel=target.removeEventListener?"w3c":"ie"
var evtaction=evtmodel=="w3c"?"removeEventListener":"detachEvent"
target[evtaction](tasktype,functionref,evtmodel=="w3c"?false:null)}
ddpanel.getCookie=function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null}
ddpanel.setCookie=function(name,value){document.cookie=name+"="+value+";path=/"}
ddpanel.addpointer=function(target,className,imagesrc){var pointer=document.createElement("img")
pointer.src=imagesrc
pointer.className=className
pointer.style.borderWidth=0
target.appendChild(pointer)
return pointer}
ddpanel.prototype={togglepanel:function(dir){var setting=this.setting
setting.dir=dir||((setting.dir=="up")?"down":"up")
var pcontent=setting.pcontent,dir=setting.dir
pcontent._currentheight=(dir=="down")?pcontent._actualheight:setting.stateconfig.initial
pcontent.style.height=pcontent._currentheight+"px"
if(setting.pointerimage.enabled){setting.arrow.src=setting.pointerimage.src[(setting.dir=="down")?1:0]
setting.arrow.style.visibility="visible"}
ddpanel.setCookie(setting.ids[0],setting.dir)},togglepanelplus:function(dir){var setting=this.setting
setting.dir=dir||((setting.dir=="up")?"down":"up")
if(setting.pointerimage.enabled)
setting.arrow.style.visibility="hidden"
clearTimeout(setting.revealtimer)
this.revealcontent()},revealcontent:function(){var setting=this.setting
var pcontent=setting.pcontent,curH=pcontent._currentheight,maxH=pcontent._actualheight,minH=setting.stateconfig.initial,steps=setting.animate.steps,dir=setting.dir
if(dir=="down"&&curH<maxH||dir=="up"&&curH>minH){var newH=curH+(Math.round((maxH-curH)/steps)+1)*(dir=="up"?-1:1)
newH=(dir=="down")?Math.min(maxH,newH):Math.max(minH,newH)
pcontent.style.height=newH+"px"
pcontent._currentheight=newH}
else{if(setting.pointerimage.enabled){setting.arrow.src=setting.pointerimage.src[(setting.dir=="down")?1:0]
setting.arrow.style.visibility="visible"}
return}
var thispanel=this
setting.revealtimer=setTimeout(function(){thispanel.revealcontent()},10)},initpanel:function(){var setting=this.setting
var pcontainer=setting.pcontainer=document.getElementById(setting.ids[0])
var pcontent=setting.pcontent=document.getElementById(setting.ids[1])
var tdiv=setting.tdiv=document.getElementById(setting.ids[2])
pcontent.style.overflow="scroll"
pcontent._actualheight=pcontent.scrollHeight
setTimeout(function(){pcontent._actualheight=pcontent.scrollHeight},100)
pcontent.style.overflow="hidden"
pcontent._currentheight=(setting.dir=="down")?pcontent._actualheight:setting.stateconfig.initial
var thispanel=this
ddpanel.addEvent(tdiv,function(e){if(setting.animate.enabled)
thispanel.togglepanelplus()
else
thispanel.togglepanel()
if(e.preventDefault)e.preventDefault()
return false},"click")
if(setting.pointerimage.enabled){var pointer1=new Image(),pointer2=new Image()
pointer1.src=setting.pointerimage.src[0]
pointer2.src=setting.pointerimage.src[1]
setting.arrow=ddpanel.addpointer(tdiv.getElementsByTagName("span")[0],"pointerimage",setting.pointerimage.src[setting.dir=="down"?1:0])}
if(setting.closepanelonclick.enabled){ddpanel.addEvent(pcontent,function(e){var target=e.srcElement||e.target
if(/(^|\s+)closepanel($|\s+)/.test(target.className)||target.tagName=="A"||(target.parentNode&&target.parentNode.tagName=="A")){thispanel.togglepanel("up")}},"click")}},uninit:function(){var setting=this.setting
if(setting.stateconfig.persiststate){ddpanel.setCookie(setting.ids[0],setting.dir)}
for(prop in setting){setting[prop]=null}}}
var defaultpanel=new ddpanel({ids:["mypanel","mypanelcontent","mypaneltab"],stateconfig:{initial:"0px",persiststate:true},animate:{enabled:true,steps:10},pointerimage:{enabled:false,src:["arrow-down.gif","arrow-up.gif"]},closepanelonclick:{enabled:true}})
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_showHideLayers(){var i,p,v,obj,args=MM_showHideLayers.arguments;for(i=0;i<(args.length-2);i+=3)
with(document)if(getElementById&&((obj=getElementById(args[i]))!=null)){v=args[i+2];if(obj.style){obj=obj.style;v=(v=='show')?'visible':(v=='hide')?'hidden':v;}
obj.visibility=v;}}
var Spry;if(!Spry)Spry={};if(!Spry.Widget)Spry.Widget={};Spry.Widget.TabbedPanels=function(element,opts)
{this.element=this.getElement(element);this.defaultTab=0;this.tabSelectedClass="TabbedPanelsTabSelected";this.tabHoverClass="TabbedPanelsTabHover";this.tabFocusedClass="TabbedPanelsTabFocused";this.panelVisibleClass="TabbedPanelsContentVisible";this.focusElement=null;this.hasFocus=false;this.currentTabIndex=0;this.enableKeyboardNavigation=true;this.nextPanelKeyCode=Spry.Widget.TabbedPanels.KEY_RIGHT;this.previousPanelKeyCode=Spry.Widget.TabbedPanels.KEY_LEFT;Spry.Widget.TabbedPanels.setOptions(this,opts);if(typeof(this.defaultTab)=="number")
{if(this.defaultTab<0)
this.defaultTab=0;else
{var count=this.getTabbedPanelCount();if(this.defaultTab>=count)
this.defaultTab=(count>1)?(count-1):0;}
this.defaultTab=this.getTabs()[this.defaultTab];}
if(this.defaultTab)
this.defaultTab=this.getElement(this.defaultTab);this.attachBehaviors();};Spry.Widget.TabbedPanels.prototype.getElement=function(ele)
{if(ele&&typeof ele=="string")
return document.getElementById(ele);return ele;};Spry.Widget.TabbedPanels.prototype.getElementChildren=function(element)
{var children=[];var child=element.firstChild;while(child)
{if(child.nodeType==1)
children.push(child);child=child.nextSibling;}
return children;};Spry.Widget.TabbedPanels.prototype.addClassName=function(ele,className)
{if(!ele||!className||(ele.className&&ele.className.search(new RegExp("\\b"+className+"\\b"))!=-1))
return;ele.className+=(ele.className?" ":"")+className;};Spry.Widget.TabbedPanels.prototype.removeClassName=function(ele,className)
{if(!ele||!className||(ele.className&&ele.className.search(new RegExp("\\b"+className+"\\b"))==-1))
return;ele.className=ele.className.replace(new RegExp("\\s*\\b"+className+"\\b","g"),"");};Spry.Widget.TabbedPanels.setOptions=function(obj,optionsObj,ignoreUndefinedProps)
{if(!optionsObj)
return;for(var optionName in optionsObj)
{if(ignoreUndefinedProps&&optionsObj[optionName]==undefined)
continue;obj[optionName]=optionsObj[optionName];}};Spry.Widget.TabbedPanels.prototype.getTabGroup=function()
{if(this.element)
{var children=this.getElementChildren(this.element);if(children.length)
return children[0];}
return null;};Spry.Widget.TabbedPanels.prototype.getTabs=function()
{var tabs=[];var tg=this.getTabGroup();if(tg)
tabs=this.getElementChildren(tg);return tabs;};Spry.Widget.TabbedPanels.prototype.getContentPanelGroup=function()
{if(this.element)
{var children=this.getElementChildren(this.element);if(children.length>1)
return children[1];}
return null;};Spry.Widget.TabbedPanels.prototype.getContentPanels=function()
{var panels=[];var pg=this.getContentPanelGroup();if(pg)
panels=this.getElementChildren(pg);return panels;};Spry.Widget.TabbedPanels.prototype.getIndex=function(ele,arr)
{ele=this.getElement(ele);if(ele&&arr&&arr.length)
{for(var i=0;i<arr.length;i++)
{if(ele==arr[i])
return i;}}
return-1;};Spry.Widget.TabbedPanels.prototype.getTabIndex=function(ele)
{var i=this.getIndex(ele,this.getTabs());if(i<0)
i=this.getIndex(ele,this.getContentPanels());return i;};Spry.Widget.TabbedPanels.prototype.getCurrentTabIndex=function()
{return this.currentTabIndex;};Spry.Widget.TabbedPanels.prototype.getTabbedPanelCount=function(ele)
{return Math.min(this.getTabs().length,this.getContentPanels().length);};Spry.Widget.TabbedPanels.addEventListener=function(element,eventType,handler,capture)
{try
{if(element.addEventListener)
element.addEventListener(eventType,handler,capture);else if(element.attachEvent)
element.attachEvent("on"+eventType,handler);}
catch(e){}};Spry.Widget.TabbedPanels.prototype.cancelEvent=function(e)
{if(e.preventDefault)e.preventDefault();else e.returnValue=false;if(e.stopPropagation)e.stopPropagation();else e.cancelBubble=true;return false;};Spry.Widget.TabbedPanels.prototype.onTabClick=function(e,tab)
{this.showPanel(tab);return this.cancelEvent(e);};Spry.Widget.TabbedPanels.prototype.onTabMouseOver=function(e,tab)
{this.addClassName(tab,this.tabHoverClass);return false;};Spry.Widget.TabbedPanels.prototype.onTabMouseOut=function(e,tab)
{this.removeClassName(tab,this.tabHoverClass);return false;};Spry.Widget.TabbedPanels.prototype.onTabFocus=function(e,tab)
{this.hasFocus=true;this.addClassName(tab,this.tabFocusedClass);return false;};Spry.Widget.TabbedPanels.prototype.onTabBlur=function(e,tab)
{this.hasFocus=false;this.removeClassName(tab,this.tabFocusedClass);return false;};Spry.Widget.TabbedPanels.KEY_UP=38;Spry.Widget.TabbedPanels.KEY_DOWN=40;Spry.Widget.TabbedPanels.KEY_LEFT=37;Spry.Widget.TabbedPanels.KEY_RIGHT=39;Spry.Widget.TabbedPanels.prototype.onTabKeyDown=function(e,tab)
{var key=e.keyCode;if(!this.hasFocus||(key!=this.previousPanelKeyCode&&key!=this.nextPanelKeyCode))
return true;var tabs=this.getTabs();for(var i=0;i<tabs.length;i++)
if(tabs[i]==tab)
{var el=false;if(key==this.previousPanelKeyCode&&i>0)
el=tabs[i-1];else if(key==this.nextPanelKeyCode&&i<tabs.length-1)
el=tabs[i+1];if(el)
{this.showPanel(el);el.focus();break;}}
return this.cancelEvent(e);};Spry.Widget.TabbedPanels.prototype.preorderTraversal=function(root,func)
{var stopTraversal=false;if(root)
{stopTraversal=func(root);if(root.hasChildNodes())
{var child=root.firstChild;while(!stopTraversal&&child)
{stopTraversal=this.preorderTraversal(child,func);try{child=child.nextSibling;}catch(e){child=null;}}}}
return stopTraversal;};Spry.Widget.TabbedPanels.prototype.addPanelEventListeners=function(tab,panel)
{var self=this;Spry.Widget.TabbedPanels.addEventListener(tab,"click",function(e){return self.onTabClick(e,tab);},false);Spry.Widget.TabbedPanels.addEventListener(tab,"mouseover",function(e){return self.onTabMouseOver(e,tab);},false);Spry.Widget.TabbedPanels.addEventListener(tab,"mouseout",function(e){return self.onTabMouseOut(e,tab);},false);if(this.enableKeyboardNavigation)
{var tabIndexEle=null;var tabAnchorEle=null;this.preorderTraversal(tab,function(node){if(node.nodeType==1)
{var tabIndexAttr=tab.attributes.getNamedItem("tabindex");if(tabIndexAttr)
{tabIndexEle=node;return true;}
if(!tabAnchorEle&&node.nodeName.toLowerCase()=="a")
tabAnchorEle=node;}
return false;});if(tabIndexEle)
this.focusElement=tabIndexEle;else if(tabAnchorEle)
this.focusElement=tabAnchorEle;if(this.focusElement)
{Spry.Widget.TabbedPanels.addEventListener(this.focusElement,"focus",function(e){return self.onTabFocus(e,tab);},false);Spry.Widget.TabbedPanels.addEventListener(this.focusElement,"blur",function(e){return self.onTabBlur(e,tab);},false);Spry.Widget.TabbedPanels.addEventListener(this.focusElement,"keydown",function(e){return self.onTabKeyDown(e,tab);},false);}}};Spry.Widget.TabbedPanels.prototype.showPanel=function(elementOrIndex)
{var tpIndex=-1;if(typeof elementOrIndex=="number")
tpIndex=elementOrIndex;else
tpIndex=this.getTabIndex(elementOrIndex);if(!tpIndex<0||tpIndex>=this.getTabbedPanelCount())
return;var tabs=this.getTabs();var panels=this.getContentPanels();var numTabbedPanels=Math.max(tabs.length,panels.length);for(var i=0;i<numTabbedPanels;i++)
{if(i!=tpIndex)
{if(tabs[i])
this.removeClassName(tabs[i],this.tabSelectedClass);if(panels[i])
{this.removeClassName(panels[i],this.panelVisibleClass);panels[i].style.display="none";}}}
this.addClassName(tabs[tpIndex],this.tabSelectedClass);this.addClassName(panels[tpIndex],this.panelVisibleClass);panels[tpIndex].style.display="block";this.currentTabIndex=tpIndex;};Spry.Widget.TabbedPanels.prototype.attachBehaviors=function(element)
{var tabs=this.getTabs();var panels=this.getContentPanels();var panelCount=this.getTabbedPanelCount();for(var i=0;i<panelCount;i++)
this.addPanelEventListeners(tabs[i],panels[i]);this.showPanel(this.defaultTab);};var Spry;if(!Spry)Spry={};if(!Spry.Widget)Spry.Widget={};Spry.Widget.BrowserSniff=function()
{var b=navigator.appName.toString();var up=navigator.platform.toString();var ua=navigator.userAgent.toString();this.mozilla=this.ie=this.opera=this.safari=false;var re_opera=/Opera.([0-9\.]*)/i;var re_msie=/MSIE.([0-9\.]*)/i;var re_gecko=/gecko/i;var re_safari=/(applewebkit|safari)\/([\d\.]*)/i;var r=false;if((r=ua.match(re_opera))){this.opera=true;this.version=parseFloat(r[1]);}else if((r=ua.match(re_msie))){this.ie=true;this.version=parseFloat(r[1]);}else if((r=ua.match(re_safari))){this.safari=true;this.version=parseFloat(r[2]);}else if(ua.match(re_gecko)){var re_gecko_version=/rv:\s*([0-9\.]+)/i;r=ua.match(re_gecko_version);this.mozilla=true;this.version=parseFloat(r[1]);}
this.windows=this.mac=this.linux=false;this.Platform=ua.match(/windows/i)?"windows":(ua.match(/linux/i)?"linux":(ua.match(/mac/i)?"mac":ua.match(/unix/i)?"unix":"unknown"));this[this.Platform]=true;this.v=this.version;if(this.safari&&this.mac&&this.mozilla){this.mozilla=false;}};Spry.is=new Spry.Widget.BrowserSniff();Spry.Widget.ValidationTextField=function(element,type,options)
{type=Spry.Widget.Utils.firstValid(type,"none");if(typeof type!='string'){this.showError('The second parameter in the constructor should be the validation type, the options are the third parameter.');return;}
if(typeof Spry.Widget.ValidationTextField.ValidationDescriptors[type]=='undefined'){this.showError('Unknown validation type received as the second parameter.');return;}
options=Spry.Widget.Utils.firstValid(options,{});this.type=type;if(!this.isBrowserSupported()){options.useCharacterMasking=false;}
this.init(element,options);var validateOn=['submit'].concat(Spry.Widget.Utils.firstValid(this.options.validateOn,[]));validateOn=validateOn.join(",");this.validateOn=0;this.validateOn=this.validateOn|(validateOn.indexOf('submit')!=-1?Spry.Widget.ValidationTextField.ONSUBMIT:0);this.validateOn=this.validateOn|(validateOn.indexOf('blur')!=-1?Spry.Widget.ValidationTextField.ONBLUR:0);this.validateOn=this.validateOn|(validateOn.indexOf('change')!=-1?Spry.Widget.ValidationTextField.ONCHANGE:0);if(Spry.Widget.ValidationTextField.onloadDidFire)
this.attachBehaviors();else
Spry.Widget.ValidationTextField.loadQueue.push(this);};Spry.Widget.ValidationTextField.ONCHANGE=1;Spry.Widget.ValidationTextField.ONBLUR=2;Spry.Widget.ValidationTextField.ONSUBMIT=4;Spry.Widget.ValidationTextField.ERROR_REQUIRED=1;Spry.Widget.ValidationTextField.ERROR_FORMAT=2;Spry.Widget.ValidationTextField.ERROR_RANGE_MIN=4;Spry.Widget.ValidationTextField.ERROR_RANGE_MAX=8;Spry.Widget.ValidationTextField.ERROR_CHARS_MIN=16;Spry.Widget.ValidationTextField.ERROR_CHARS_MAX=32;Spry.Widget.ValidationTextField.ValidationDescriptors={'none':{},'custom':{},'integer':{characterMasking:/[\-\+\d]/,regExpFilter:/^[\-\+]?\d*$/,validation:function(value,options){if(value==''||value=='-'||value=='+'){return false;}
var regExp=/^[\-\+]?\d*$/;if(!regExp.test(value)){return false;}
options=options||{allowNegative:false};var ret=parseInt(value,10);if(!isNaN(ret)){var allowNegative=true;if(typeof options.allowNegative!='undefined'&&options.allowNegative==false){allowNegative=false;}
if(!allowNegative&&value<0){ret=false;}}else{ret=false;}
return ret;}},'real':{characterMasking:/[\d\.,\-\+e]/i,regExpFilter:/^[\-\+]?\d(?:|\.,\d{0,2})|(?:|e{0,1}[\-\+]?\d{0,})$/i,validation:function(value,options){var regExp=/^[\+\-]?[0-9]+([\.,][0-9]+)?([eE]{0,1}[\-\+]?[0-9]+)?$/;if(!regExp.test(value)){return false;}
var ret=parseFloat(value);if(isNaN(ret)){ret=false;}
return ret;}},'currency':{formats:{'dot_comma':{characterMasking:/[\d\.\,\-\+\$]/,regExpFilter:/^[\-\+]?(?:[\d\.]*)+(|\,\d{0,2})$/,validation:function(value,options){var ret=false;if(/^(\-|\+)?\d{1,3}(?:\.\d{3})*(?:\,\d{2}|)$/.test(value)||/^(\-|\+)?\d+(?:\,\d{2}|)$/.test(value)){value=value.toString().replace(/\./gi,'').replace(/\,/,'.');ret=parseFloat(value);}
return ret;}},'comma_dot':{characterMasking:/[\d\.\,\-\+\$]/,regExpFilter:/^[\-\+]?(?:[\d\,]*)+(|\.\d{0,2})$/,validation:function(value,options){var ret=false;if(/^(\-|\+)?\d{1,3}(?:\,\d{3})*(?:\.\d{2}|)$/.test(value)||/^(\-|\+)?\d+(?:\.\d{2}|)$/.test(value)){value=value.toString().replace(/\,/gi,'');ret=parseFloat(value);}
return ret;}}}},'email':{characterMasking:/[^\s]/,validation:function(value,options){var rx=/^[\w\.-]+@[\w\.-]+\.\w+$/i;return rx.test(value);}},'date':{validation:function(value,options){var formatRegExp=/^([mdy]+)[\.\-\/\\\s]+([mdy]+)[\.\-\/\\\s]+([mdy]+)$/i;var valueRegExp=this.dateValidationPattern;var formatGroups=options.format.match(formatRegExp);var valueGroups=value.match(valueRegExp);if(formatGroups!==null&&valueGroups!==null){var dayIndex=-1;var monthIndex=-1;var yearIndex=-1;for(var i=1;i<formatGroups.length;i++){switch(formatGroups[i].toLowerCase()){case"dd":dayIndex=i;break;case"mm":monthIndex=i;break;case"yy":case"yyyy":yearIndex=i;break;}}
if(dayIndex!=-1&&monthIndex!=-1&&yearIndex!=-1){var maxDay=-1;var theDay=parseInt(valueGroups[dayIndex],10);var theMonth=parseInt(valueGroups[monthIndex],10);var theYear=parseInt(valueGroups[yearIndex],10);if(theMonth<1||theMonth>12){return false;}
switch(theMonth){case 1:case 3:case 5:case 7:case 8:case 10:case 12:maxDay=31;break;case 4:case 6:case 9:case 11:maxDay=30;break;case 2:if((parseInt(theYear/4,10)*4==theYear)&&(theYear%100!=0||theYear%400==0)){maxDay=29;}else{maxDay=28;}
break;}
if(theDay<1||theDay>maxDay){return false;}
return(new Date(theYear,theMonth-1,theDay));}}else{return false;}}},'time':{validation:function(value,options){var formatRegExp=/([hmst]+)/gi;var valueRegExp=/(\d+|AM?|PM?)/gi;var formatGroups=options.format.match(formatRegExp);var valueGroups=value.match(valueRegExp);if(formatGroups!==null&&valueGroups!==null){if(formatGroups.length!=valueGroups.length){return false;}
var hourIndex=-1;var minuteIndex=-1;var secondIndex=-1;var tIndex=-1;var theHour=0,theMinute=0,theSecond=0,theT='AM';for(var i=0;i<formatGroups.length;i++){switch(formatGroups[i].toLowerCase()){case"hh":hourIndex=i;break;case"mm":minuteIndex=i;break;case"ss":secondIndex=i;break;case"t":case"tt":tIndex=i;break;}}
if(hourIndex!=-1){var theHour=parseInt(valueGroups[hourIndex],10);if(isNaN(theHour)||theHour>(formatGroups[hourIndex]=='HH'?23:12)){return false;}}
if(minuteIndex!=-1){var theMinute=parseInt(valueGroups[minuteIndex],10);if(isNaN(theMinute)||theMinute>59){return false;}}
if(secondIndex!=-1){var theSecond=parseInt(valueGroups[secondIndex],10);if(isNaN(theSecond)||theSecond>59){return false;}}
if(tIndex!=-1){var theT=valueGroups[tIndex].toUpperCase();if(formatGroups[tIndex].toUpperCase()=='TT'&&!/^a|pm$/i.test(theT)||formatGroups[tIndex].toUpperCase()=='T'&&!/^a|p$/i.test(theT)){return false;}}
var date=new Date(2000,0,1,theHour+(theT.charAt(0)=='P'?12:0),theMinute,theSecond);return date;}else{return false;}}},'credit_card':{characterMasking:/\d/,validation:function(value,options){var regExp=null;options.format=options.format||'ALL';switch(options.format.toUpperCase()){case'ALL':regExp=/^[3-6]{1}[0-9]{12,18}$/;break;case'VISA':regExp=/^4(?:[0-9]{12}|[0-9]{15})$/;break;case'MASTERCARD':regExp=/^5[1-5]{1}[0-9]{14}$/;break;case'AMEX':regExp=/^3(4|7){1}[0-9]{13}$/;break;case'DISCOVER':regExp=/^6011[0-9]{12}$/;break;case'DINERSCLUB':regExp=/^3(?:(0[0-5]{1}[0-9]{11})|(6[0-9]{12})|(8[0-9]{12}))$/;break;}
if(!regExp.test(value)){return false;}
var digits=[];var j=1,digit='';for(var i=value.length-1;i>=0;i--){if((j%2)==0){digit=parseInt(value.charAt(i),10)*2;digits[digits.length]=digit.toString().charAt(0);if(digit.toString().length==2){digits[digits.length]=digit.toString().charAt(1);}}else{digit=value.charAt(i);digits[digits.length]=digit;}
j++;}
var sum=0;for(i=0;i<digits.length;i++){sum+=parseInt(digits[i],10);}
if((sum%10)==0){return true;}
return false;}},'zip_code':{formats:{'zip_us9':{pattern:'00000-0000'},'zip_us5':{pattern:'00000'},'zip_uk':{characterMasking:/[\dA-Z\s]/,validation:function(value,options){return/^[A-Z]{1,2}\d[\dA-Z]?\s?\d[A-Z]{2}$/.test(value);}},'zip_canada':{characterMasking:/[\dA-Z\s]/,pattern:'A0A 0A0'},'zip_custom':{}}},'phone_number':{formats:{'phone_us':{pattern:'(000) 000-0000'},'phone_custom':{}}},'social_security_number':{pattern:'000-00-0000'},'ip':{characterMaskingFormats:{'ipv4':/[\d\.]/i,'ipv6_ipv4':/[\d\.\:A-F\/]/i,'ipv6':/[\d\.\:A-F\/]/i},validation:function(value,options){return Spry.Widget.ValidationTextField.validateIP(value,options.format);}},'url':{characterMasking:/[^\s]/,validation:function(value,options){var URI_spliter=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;var parts=value.match(URI_spliter);if(parts&&parts[4]){var host=parts[4].split(".");var punyencoded='';for(var i=0;i<host.length;i++){punyencoded=Spry.Widget.Utils.punycode_encode(host[i],64);if(!punyencoded){return false;}else{if(punyencoded!=(host[i]+"-")){host[i]='xn--'+punyencoded;}}}
host=host.join(".");value=value.replace(URI_spliter,"$1//"+host+"$5$6$8");}
var regExp=/^(?:https?|ftp)\:\/\/(?:(?:[a-z0-9\-\._~\!\$\&\'\(\)\*\+\,\;\=:]|%[0-9a-f]{2,2})*\@)?(?:((?:(?:[a-z0-9][a-z0-9\-]*[a-z0-9]|[a-z0-9])\.)*(?:[a-z][a-z0-9\-]*[a-z0-9]|[a-z])|(?:\[[^\]]*\]))(?:\:[0-9]*)?)(?:\/(?:[a-z0-9\-\._~\!\$\&\'\(\)\*\+\,\;\=\:\@]|%[0-9a-f]{2,2})*)*(?:\?(?:[a-z0-9\-\._~\!\$\&\'\(\)\*\+\,\;\=\:\@\/\?]|%[0-9a-f]{2,2})*)?(?:\#(?:[a-z0-9\-\._~\!\$\&\'\(\)\*\+\,\;\=\:\@\/\?]|%[0-9a-f]{2,2})*)?$/i;var valid=value.match(regExp);if(valid){var address=valid[1];if(address){if(address=='[]'){return false;}
if(address.charAt(0)=='['){address=address.replace(/^\[|\]$/gi,'');return Spry.Widget.ValidationTextField.validateIP(address,'ipv6_ipv4');}else{if(/[^0-9\.]/.test(address)){return true;}else{return Spry.Widget.ValidationTextField.validateIP(address,'ipv4');}}}else{return true;}}else{return false;}}}};Spry.Widget.ValidationTextField.validateIP=function(value,format)
{var validIPv6Addresses=[/^(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}(?:\/\d{1,3})?$/i,/^[a-f0-9]{0,4}::(?:\/\d{1,3})?$/i,/^:(?::[a-f0-9]{1,4}){1,6}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){1,6}:(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:)(?::[a-f0-9]{1,4}){1,6}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){2}(?::[a-f0-9]{1,4}){1,5}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){3}(?::[a-f0-9]{1,4}){1,4}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){4}(?::[a-f0-9]{1,4}){1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){5}(?::[a-f0-9]{1,4}){1,2}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){6}(?::[a-f0-9]{1,4})(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){6}(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^:(?::[a-f0-9]{1,4}){0,4}:(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){1,5}:(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:)(?::[a-f0-9]{1,4}){1,4}:(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){2}(?::[a-f0-9]{1,4}){1,3}:(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){3}(?::[a-f0-9]{1,4}){1,2}:(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i,/^(?:[a-f0-9]{1,4}:){4}(?::[a-f0-9]{1,4}):(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,3})?$/i];var validIPv4Addresses=[/^(\d{1,3}\.){3}\d{1,3}$/i];var validAddresses=[];if(format=='ipv6'||format=='ipv6_ipv4'){validAddresses=validAddresses.concat(validIPv6Addresses);}
if(format=='ipv4'||format=='ipv6_ipv4'){validAddresses=validAddresses.concat(validIPv4Addresses);}
var ret=false;for(var i=0;i<validAddresses.length;i++){if(validAddresses[i].test(value)){ret=true;break;}}
if(ret&&value.indexOf(".")!=-1){var ipv4=value.match(/:?(?:\d{1,3}\.){3}\d{1,3}/i);if(!ipv4){return false;}
ipv4=ipv4[0].replace(/^:/,'');var pieces=ipv4.split('.');if(pieces.length!=4){return false;}
var regExp=/^[\-\+]?\d*$/;for(var i=0;i<pieces.length;i++){if(pieces[i]==''){return false;}
var piece=parseInt(pieces[i],10);if(isNaN(piece)||piece>255||!regExp.test(pieces[i])||pieces[i].length>3||/^0{2,3}$/.test(pieces[i])){return false;}}}
if(ret&&value.indexOf("/")!=-1){var prefLen=value.match(/\/\d{1,3}$/);if(!prefLen)return false;var prefLenVal=parseInt(prefLen[0].replace(/^\//,''),10);if(isNaN(prefLenVal)||prefLenVal>128||prefLenVal<1){return false;}}
return ret;};Spry.Widget.ValidationTextField.onloadDidFire=false;Spry.Widget.ValidationTextField.loadQueue=[];Spry.Widget.ValidationTextField.prototype.isBrowserSupported=function()
{return Spry.is.ie&&Spry.is.v>=5&&Spry.is.windows||Spry.is.mozilla&&Spry.is.v>=1.4||Spry.is.safari||Spry.is.opera&&Spry.is.v>=9;};Spry.Widget.ValidationTextField.prototype.init=function(element,options)
{this.element=this.getElement(element);this.errors=0;this.flags={locked:false,restoreSelection:true};this.options={};this.event_handlers=[];this.validClass="textfieldValidState";this.focusClass="textfieldFocusState";this.requiredClass="textfieldRequiredState";this.hintClass="textfieldHintState";this.invalidFormatClass="textfieldInvalidFormatState";this.invalidRangeMinClass="textfieldMinValueState";this.invalidRangeMaxClass="textfieldMaxValueState";this.invalidCharsMinClass="textfieldMinCharsState";this.invalidCharsMaxClass="textfieldMaxCharsState";this.textfieldFlashTextClass="textfieldFlashText";if(Spry.is.safari){this.flags.lastKeyPressedTimeStamp=0;}
switch(this.type){case'phone_number':options.format=Spry.Widget.Utils.firstValid(options.format,'phone_us');break;case'currency':options.format=Spry.Widget.Utils.firstValid(options.format,'comma_dot');break;case'zip_code':options.format=Spry.Widget.Utils.firstValid(options.format,'zip_us5');break;case'date':options.format=Spry.Widget.Utils.firstValid(options.format,'mm/dd/yy');break;case'time':options.format=Spry.Widget.Utils.firstValid(options.format,'HH:mm');options.pattern=options.format.replace(/[hms]/gi,"0").replace(/TT/gi,'AM').replace(/T/gi,'A');break;case'ip':options.format=Spry.Widget.Utils.firstValid(options.format,'ipv4');options.characterMasking=Spry.Widget.ValidationTextField.ValidationDescriptors[this.type].characterMaskingFormats[options.format];break;}
var validationDescriptor={};if(options.format&&Spry.Widget.ValidationTextField.ValidationDescriptors[this.type].formats){if(Spry.Widget.ValidationTextField.ValidationDescriptors[this.type].formats[options.format]){Spry.Widget.Utils.setOptions(validationDescriptor,Spry.Widget.ValidationTextField.ValidationDescriptors[this.type].formats[options.format]);}}else{Spry.Widget.Utils.setOptions(validationDescriptor,Spry.Widget.ValidationTextField.ValidationDescriptors[this.type]);}
options.useCharacterMasking=Spry.Widget.Utils.firstValid(options.useCharacterMasking,false);options.hint=Spry.Widget.Utils.firstValid(options.hint,'');options.isRequired=Spry.Widget.Utils.firstValid(options.isRequired,true);options.additionalError=Spry.Widget.Utils.firstValid(options.additionalError,false);if(options.additionalError)
options.additionalError=this.getElement(options.additionalError);options.characterMasking=Spry.Widget.Utils.firstValid(options.characterMasking,validationDescriptor.characterMasking);options.regExpFilter=Spry.Widget.Utils.firstValid(options.regExpFilter,validationDescriptor.regExpFilter);options.pattern=Spry.Widget.Utils.firstValid(options.pattern,validationDescriptor.pattern);options.validation=Spry.Widget.Utils.firstValid(options.validation,validationDescriptor.validation);if(typeof options.validation=='string'){options.validation=eval(options.validation);}
options.minValue=Spry.Widget.Utils.firstValid(options.minValue,validationDescriptor.minValue);options.maxValue=Spry.Widget.Utils.firstValid(options.maxValue,validationDescriptor.maxValue);options.minChars=Spry.Widget.Utils.firstValid(options.minChars,validationDescriptor.minChars);options.maxChars=Spry.Widget.Utils.firstValid(options.maxChars,validationDescriptor.maxChars);Spry.Widget.Utils.setOptions(this,options);Spry.Widget.Utils.setOptions(this.options,options);};Spry.Widget.ValidationTextField.prototype.destroy=function(){if(this.event_handlers)
for(var i=0;i<this.event_handlers.length;i++){Spry.Widget.Utils.removeEventListener(this.event_handlers[i][0],this.event_handlers[i][1],this.event_handlers[i][2],false);}
try{delete this.element;}catch(err){}
try{delete this.input;}catch(err){}
try{delete this.form;}catch(err){}
try{delete this.event_handlers;}catch(err){}
try{this.selection.destroy();}catch(err){}
try{delete this.selection;}catch(err){}
var q=Spry.Widget.Form.onSubmitWidgetQueue;var qlen=q.length;for(var i=0;i<qlen;i++){if(q[i]==this){q.splice(i,1);break;}}};Spry.Widget.ValidationTextField.prototype.attachBehaviors=function()
{if(this.element){if(this.element.nodeName=="INPUT"){this.input=this.element;}else{this.input=Spry.Widget.Utils.getFirstChildWithNodeNameAtAnyLevel(this.element,"INPUT");}}
if(this.input){if(this.maxChars){this.input.removeAttribute("maxLength");}
this.putHint();this.compilePattern();if(this.type=='date'){this.compileDatePattern();}
this.input.setAttribute("AutoComplete","off");this.selection=new Spry.Widget.SelectionDescriptor(this.input);this.oldValue=this.input.value;var self=this;this.event_handlers=[];this.event_handlers.push([this.input,"keydown",function(e){if(self.isDisabled())return true;return self.onKeyDown(e||event);}]);this.event_handlers.push([this.input,"keypress",function(e){if(self.isDisabled())return true;return self.onKeyPress(e||event);}]);if(Spry.is.opera){this.event_handlers.push([this.input,"keyup",function(e){if(self.isDisabled())return true;return self.onKeyUp(e||event);}]);}
this.event_handlers.push([this.input,"focus",function(e){if(self.isDisabled())return true;return self.onFocus(e||event);}]);this.event_handlers.push([this.input,"blur",function(e){if(self.isDisabled())return true;return self.onBlur(e||event);}]);this.event_handlers.push([this.input,"mousedown",function(e){if(self.isDisabled())return true;return self.onMouseDown(e||event);}]);var changeEvent=Spry.is.mozilla||Spry.is.opera||Spry.is.safari?"input":Spry.is.ie?"propertychange":"change";this.event_handlers.push([this.input,changeEvent,function(e){if(self.isDisabled())return true;return self.onChange(e||event);}]);if(Spry.is.mozilla||Spry.is.safari){this.event_handlers.push([this.input,"dragdrop",function(e){if(self.isDisabled())return true;self.removeHint();return self.onChange(e||event);}]);}else if(Spry.is.ie){this.event_handlers.push([this.input,"drop",function(e){if(self.isDisabled())return true;return self.onDrop(e||event);}]);}
for(var i=0;i<this.event_handlers.length;i++){Spry.Widget.Utils.addEventListener(this.event_handlers[i][0],this.event_handlers[i][1],this.event_handlers[i][2],false);}
this.form=Spry.Widget.Utils.getFirstParentWithNodeName(this.input,"FORM");if(this.form){if(!this.form.attachedSubmitHandler&&!this.form.onsubmit){this.form.onsubmit=function(e){e=e||event;return Spry.Widget.Form.onSubmit(e,e.srcElement||e.currentTarget)};this.form.attachedSubmitHandler=true;}
if(!this.form.attachedResetHandler){Spry.Widget.Utils.addEventListener(this.form,"reset",function(e){e=e||event;return Spry.Widget.Form.onReset(e,e.srcElement||e.currentTarget)},false);this.form.attachedResetHandler=true;}
Spry.Widget.Form.onSubmitWidgetQueue.push(this);}}};Spry.Widget.ValidationTextField.prototype.isDisabled=function(){return this.input&&(this.input.disabled||this.input.readOnly)||!this.input;};Spry.Widget.ValidationTextField.prototype.getElement=function(ele)
{if(ele&&typeof ele=="string")
return document.getElementById(ele);return ele;};Spry.Widget.ValidationTextField.addLoadListener=function(handler)
{if(typeof window.addEventListener!='undefined')
window.addEventListener('load',handler,false);else if(typeof document.addEventListener!='undefined')
document.addEventListener('load',handler,false);else if(typeof window.attachEvent!='undefined')
window.attachEvent('onload',handler);};Spry.Widget.ValidationTextField.processLoadQueue=function(handler)
{Spry.Widget.ValidationTextField.onloadDidFire=true;var q=Spry.Widget.ValidationTextField.loadQueue;var qlen=q.length;for(var i=0;i<qlen;i++)
q[i].attachBehaviors();};Spry.Widget.ValidationTextField.addLoadListener(Spry.Widget.ValidationTextField.processLoadQueue);Spry.Widget.ValidationTextField.addLoadListener(function(){Spry.Widget.Utils.addEventListener(window,"unload",Spry.Widget.Form.destroyAll,false);});Spry.Widget.ValidationTextField.prototype.setValue=function(newValue){this.flags.locked=true;this.input.value=newValue;this.flags.locked=false;this.oldValue=newValue;if(!Spry.is.ie){this.onChange();}};Spry.Widget.ValidationTextField.prototype.saveState=function()
{this.oldValue=this.input.value;this.selection.update();};Spry.Widget.ValidationTextField.prototype.revertState=function(revertValue)
{if(revertValue!=this.input.value){this.input.readOnly=true;this.input.value=revertValue;this.input.readOnly=false;if(Spry.is.safari&&this.flags.active){this.input.focus();}}
if(this.flags.restoreSelection){this.selection.moveTo(this.selection.start,this.selection.end);}
this.redTextFlash();};Spry.Widget.ValidationTextField.prototype.removeHint=function()
{if(this.flags.hintOn){this.input.value="";this.flags.hintOn=false;this.removeClassName(this.element,this.hintClass);this.removeClassName(this.additionalError,this.hintClass);}};Spry.Widget.ValidationTextField.prototype.putHint=function()
{if(this.hint&&this.input&&this.input.type=="text"&&this.input.value==""){this.flags.hintOn=true;this.input.value=this.hint;this.addClassName(this.element,this.hintClass);this.addClassName(this.additionalError,this.hintClass);}};Spry.Widget.ValidationTextField.prototype.redTextFlash=function()
{var self=this;this.addClassName(this.element,this.textfieldFlashTextClass);setTimeout(function(){self.removeClassName(self.element,self.textfieldFlashTextClass)},100);};Spry.Widget.ValidationTextField.prototype.doValidations=function(testValue,revertValue)
{if(this.isDisabled())return false;if(this.flags.locked){return false;}
if(testValue.length==0&&!this.isRequired){this.errors=0;return false;}
this.flags.locked=true;var mustRevert=false;var continueValidations=true;if(!this.options.isRequired&&testValue.length==0){continueValidations=false;}
var errors=0;var fixedValue=testValue;if(this.useCharacterMasking&&this.characterMasking){for(var i=0;i<testValue.length;i++){if(!this.characterMasking.test(testValue.charAt(i))){errors=errors|Spry.Widget.ValidationTextField.ERROR_FORMAT;fixedValue=revertValue;mustRevert=true;break;}}}
if(!mustRevert&&this.useCharacterMasking&&this.regExpFilter){if(!this.regExpFilter.test(fixedValue)){errors=errors|Spry.Widget.ValidationTextField.ERROR_FORMAT;mustRevert=true;}}
if(!mustRevert&&this.pattern){var currentRegExp=this.patternToRegExp(testValue.length);if(!currentRegExp.test(testValue)){errors=errors|Spry.Widget.ValidationTextField.ERROR_FORMAT;mustRevert=true;}else if(this.patternLength!=testValue.length){errors=errors|Spry.Widget.ValidationTextField.ERROR_FORMAT;}}
if(fixedValue==''){errors=errors|Spry.Widget.ValidationTextField.ERROR_REQUIRED;}
if(!mustRevert&&this.pattern&&this.useCharacterMasking){var n=this.getAutoComplete(testValue.length);if(n){fixedValue+=n;}}
if(!mustRevert&&this.minChars!==null&&continueValidations){if(testValue.length<this.minChars){errors=errors|Spry.Widget.ValidationTextField.ERROR_CHARS_MIN;continueValidations=false;}}
if(!mustRevert&&this.maxChars!==null&&continueValidations){if(testValue.length>this.maxChars){errors=errors|Spry.Widget.ValidationTextField.ERROR_CHARS_MAX;continueValidations=false;}}
if(!mustRevert&&this.validation&&continueValidations){var value=this.validation(fixedValue,this.options);if(false===value){errors=errors|Spry.Widget.ValidationTextField.ERROR_FORMAT;continueValidations=false;}else{this.typedValue=value;}}
if(!mustRevert&&this.validation&&this.minValue!==null&&continueValidations){var minValue=this.validation(this.minValue.toString(),this.options);if(minValue!==false){if(this.typedValue<minValue){errors=errors|Spry.Widget.ValidationTextField.ERROR_RANGE_MIN;continueValidations=false;}}}
if(!mustRevert&&this.validation&&this.maxValue!==null&&continueValidations){var maxValue=this.validation(this.maxValue.toString(),this.options);if(maxValue!==false){if(this.typedValue>maxValue){errors=errors|Spry.Widget.ValidationTextField.ERROR_RANGE_MAX;continueValidations=false;}}}
if(this.useCharacterMasking&&mustRevert){this.revertState(revertValue);}
this.errors=errors;this.fixedValue=fixedValue;this.flags.locked=false;return mustRevert;};Spry.Widget.ValidationTextField.prototype.onChange=function(e)
{if(Spry.is.opera&&this.flags.operaRevertOnKeyUp){return true;}
if(Spry.is.ie&&e&&e.propertyName!='value'){return true;}
if(this.flags.drop){var self=this;setTimeout(function(){self.flags.drop=false;self.onChange(null);},0);return;}
if(this.flags.hintOn){return true;}
if(this.keyCode==8||this.keyCode==46){var mustRevert=this.doValidations(this.input.value,this.input.value);this.oldValue=this.input.value;if((mustRevert||this.errors)&&this.validateOn&Spry.Widget.ValidationTextField.ONCHANGE){var self=this;setTimeout(function(){self.validate();},0);return true;}}
var mustRevert=this.doValidations(this.input.value,this.oldValue);if((!mustRevert||this.errors)&&this.validateOn&Spry.Widget.ValidationTextField.ONCHANGE){var self=this;setTimeout(function(){self.validate();},0);}
return true;};Spry.Widget.ValidationTextField.prototype.onKeyUp=function(e){if(this.flags.operaRevertOnKeyUp){this.setValue(this.oldValue);Spry.Widget.Utils.stopEvent(e);this.selection.moveTo(this.selection.start,this.selection.start);this.flags.operaRevertOnKeyUp=false;return false;}
if(this.flags.operaPasteOperation){window.clearInterval(this.flags.operaPasteOperation);this.flags.operaPasteOperation=null;}};Spry.Widget.ValidationTextField.prototype.operaPasteMonitor=function(){if(this.input.value!=this.oldValue){var mustRevert=this.doValidations(this.input.value,this.input.value);if(mustRevert){this.setValue(this.oldValue);this.selection.moveTo(this.selection.start,this.selection.start);}else{this.onChange();}}};Spry.Widget.ValidationTextField.prototype.compileDatePattern=function()
{var dateValidationPatternString="";var groupPatterns=[];var fullGroupPatterns=[];var autocompleteCharacters=[];var formatRegExp=/^([mdy]+)([\.\-\/\\\s]+)([mdy]+)([\.\-\/\\\s]+)([mdy]+)$/i;var formatGroups=this.options.format.match(formatRegExp);if(formatGroups!==null){for(var i=1;i<formatGroups.length;i++){switch(formatGroups[i].toLowerCase()){case"dd":groupPatterns[i-1]="\\d{1,2}";fullGroupPatterns[i-1]="\\d\\d";dateValidationPatternString+="("+groupPatterns[i-1]+")";autocompleteCharacters[i-1]=null;break;case"mm":groupPatterns[i-1]="\\d{1,2}";fullGroupPatterns[i-1]="\\d\\d";dateValidationPatternString+="("+groupPatterns[i-1]+")";autocompleteCharacters[i-1]=null;break;case"yy":groupPatterns[i-1]="\\d{1,2}";fullGroupPatterns[i-1]="\\d\\d";dateValidationPatternString+="(\\d\\d)";autocompleteCharacters[i-1]=null;break;case"yyyy":groupPatterns[i-1]="\\d{1,4}";fullGroupPatterns[i-1]="\\d\\d\\d\\d";dateValidationPatternString+="(\\d\\d\\d\\d)";autocompleteCharacters[i-1]=null;break;default:groupPatterns[i-1]=fullGroupPatterns[i-1]=Spry.Widget.ValidationTextField.regExpFromChars(formatGroups[i]);dateValidationPatternString+="["+groupPatterns[i-1]+"]";autocompleteCharacters[i-1]=formatGroups[i];}}}
this.dateValidationPattern=new RegExp("^"+dateValidationPatternString+"$","");this.dateAutocompleteCharacters=autocompleteCharacters;this.dateGroupPatterns=groupPatterns;this.dateFullGroupPatterns=fullGroupPatterns;this.lastDateGroup=formatGroups.length-2;};Spry.Widget.ValidationTextField.prototype.getRegExpForGroup=function(group)
{var ret='^';for(var j=0;j<=group;j++)ret+=this.dateGroupPatterns[j];ret+='$';return new RegExp(ret,"");};Spry.Widget.ValidationTextField.prototype.getRegExpForFullGroup=function(group)
{var ret='^';for(var j=0;j<group;j++)ret+=this.dateGroupPatterns[j];ret+=this.dateFullGroupPatterns[group];return new RegExp(ret,"");};Spry.Widget.ValidationTextField.prototype.getDateGroup=function(value,pos)
{if(pos==0)return 0;var test_value=value.substring(0,pos);for(var i=0;i<=this.lastDateGroup;i++)
if(this.getRegExpForGroup(i).test(test_value))return i;return-1;};Spry.Widget.ValidationTextField.prototype.isDateGroupFull=function(value,group)
{return this.getRegExpForFullGroup(group).test(value);};Spry.Widget.ValidationTextField.prototype.isValueValid=function(value,pos,group)
{var test_value=value.substring(0,pos);return this.getRegExpForGroup(group).test(test_value);};Spry.Widget.ValidationTextField.prototype.isPositionAtEndOfGroup=function(value,pos,group)
{var test_value=value.substring(0,pos);return this.getRegExpForFullGroup(group).test(test_value);};Spry.Widget.ValidationTextField.prototype.nextDateDelimiterExists=function(value,pos,group)
{var autocomplete=this.dateAutocompleteCharacters[group+1];if(value.length<pos+autocomplete.length)
return false;else
{var test_value=value.substring(pos,pos+autocomplete.length);if(test_value==autocomplete)
return true;}
return false;};Spry.Widget.ValidationTextField.prototype.onKeyPress=function(e)
{if(this.flags.skp){this.flags.skp=false;Spry.Widget.Utils.stopEvent(e);return false;}
if(e.ctrlKey||e.metaKey||!this.useCharacterMasking){return true;}
if(Spry.is.opera&&this.flags.operaRevertOnKeyUp){Spry.Widget.Utils.stopEvent(e);return false;}
if(this.keyCode==8||this.keyCode==46){var mr=this.doValidations(this.input.value,this.input.value);if(mr){return true;}}
var pressed=Spry.Widget.Utils.getCharacterFromEvent(e);if(pressed&&this.characterMasking){if(!this.characterMasking.test(pressed)){Spry.Widget.Utils.stopEvent(e);this.redTextFlash();return false;}}
if(pressed&&this.pattern){var currentPatternChar=this.patternCharacters[this.selection.start];if(/[ax]/i.test(currentPatternChar)){if(currentPatternChar.toLowerCase()==currentPatternChar){pressed=pressed.toLowerCase();}else{pressed=pressed.toUpperCase();}}
var autocomplete=this.getAutoComplete(this.selection.start);if(this.selection.start==this.oldValue.length){if(this.oldValue.length<this.patternLength){if(autocomplete){Spry.Widget.Utils.stopEvent(e);var futureValue=this.oldValue.substring(0,this.selection.start)+autocomplete+pressed;var mustRevert=this.doValidations(futureValue,this.oldValue);if(!mustRevert){this.setValue(this.fixedValue);this.selection.moveTo(this.fixedValue.length,this.fixedValue.length);}else{this.setValue(this.oldValue.substring(0,this.selection.start)+autocomplete);this.selection.moveTo(this.selection.start+autocomplete.length,this.selection.start+autocomplete.length);}
return false;}}else{Spry.Widget.Utils.stopEvent(e);this.setValue(this.input.value);return false;}}else if(autocomplete){Spry.Widget.Utils.stopEvent(e);this.selection.moveTo(this.selection.start+autocomplete.length,this.selection.start+autocomplete.length);return false;}
Spry.Widget.Utils.stopEvent(e);var futureValue=this.oldValue.substring(0,this.selection.start)+pressed+this.oldValue.substring(this.selection.start+1);var mustRevert=this.doValidations(futureValue,this.oldValue);if(!mustRevert){autocomplete=this.getAutoComplete(this.selection.start+1);this.setValue(this.fixedValue);this.selection.moveTo(this.selection.start+1+autocomplete.length,this.selection.start+1+autocomplete.length);}else{this.selection.moveTo(this.selection.start,this.selection.start);}
return false;}
if(pressed&&this.type=='date'&&this.useCharacterMasking)
{var group=this.getDateGroup(this.oldValue,this.selection.start);if(group!=-1){Spry.Widget.Utils.stopEvent(e);if((group%2)!=0)
group++;if(this.isDateGroupFull(this.oldValue,group))
{if(this.isPositionAtEndOfGroup(this.oldValue,this.selection.start,group))
{if(group==this.lastDateGroup)
{this.redTextFlash();return false;}
else
{var autocomplete=this.dateAutocompleteCharacters[group+1];if(this.nextDateDelimiterExists(this.oldValue,this.selection.start,group))
{var autocomplete=this.dateAutocompleteCharacters[group+1];this.selection.moveTo(this.selection.start+autocomplete.length,this.selection.start+autocomplete.length);if(pressed==autocomplete)
return false;if(this.isDateGroupFull(this.oldValue,group+2))
futureValue=this.oldValue.substring(0,this.selection.start)+pressed+this.oldValue.substring(this.selection.start+1);else
futureValue=this.oldValue.substring(0,this.selection.start)+pressed+this.oldValue.substring(this.selection.start);if(!this.isValueValid(futureValue,this.selection.start+1,group+2))
{this.redTextFlash();return false;}
else
{this.setValue(futureValue);this.selection.moveTo(this.selection.start+1,this.selection.start+1);}
return false;}
else
{var autocomplete=this.dateAutocompleteCharacters[group+1];var insertedValue=autocomplete+pressed;futureValue=this.oldValue.substring(0,this.selection.start)+insertedValue+this.oldValue.substring(this.selection.start);if(!this.isValueValid(futureValue,this.selection.start+insertedValue.length,group+2))
{insertedValue=autocomplete;futureValue=this.oldValue.substring(0,this.selection.start)+insertedValue+this.oldValue.substring(this.selection.start);this.setValue(futureValue);this.selection.moveTo(this.selection.start+insertedValue.length,this.selection.start+insertedValue.length);this.redTextFlash();return false;}
else
{this.setValue(futureValue);this.selection.moveTo(this.selection.start+insertedValue.length,this.selection.start+insertedValue.length);return false;}}}}
else
{var movePosition=1;futureValue=this.oldValue.substring(0,this.selection.start)+pressed+this.oldValue.substring(this.selection.start+1);if(!this.isValueValid(futureValue,this.selection.start+1,group))
{this.redTextFlash();return false;}
else
{if(this.isPositionAtEndOfGroup(futureValue,this.selection.start+1,group))
{if(group!=this.lastDateGroup)
{if(this.nextDateDelimiterExists(futureValue,this.selection.start+1,group))
{var autocomplete=this.dateAutocompleteCharacters[group+1];movePosition=1+autocomplete.length;}
else
{var autocomplete=this.dateAutocompleteCharacters[group+1];futureValue=this.oldValue.substring(0,this.selection.start)+pressed+autocomplete+this.oldValue.substring(this.selection.start+1);movePosition=1+autocomplete.length;}}}
this.setValue(futureValue);this.selection.moveTo(this.selection.start+movePosition,this.selection.start+movePosition);return false;}}}
else
{futureValue=this.oldValue.substring(0,this.selection.start)+pressed+this.oldValue.substring(this.selection.start);var movePosition=1;if(!this.isValueValid(futureValue,this.selection.start+1,group)&&!this.isValueValid(futureValue,this.selection.start+1,group+1))
{this.redTextFlash();return false;}
else
{var autocomplete=this.dateAutocompleteCharacters[group+1];if(pressed==autocomplete)
{if(this.nextDateDelimiterExists(this.oldValue,this.selection.start,group))
{futureValue=this.oldValue;movePosition=1;}}
else
{if(this.isPositionAtEndOfGroup(futureValue,this.selection.start+1,group))
{if(group!=this.lastDateGroup)
{if(this.nextDateDelimiterExists(futureValue,this.selection.start+1,group))
{var autocomplete=this.dateAutocompleteCharacters[group+1];movePosition=1+autocomplete.length;}
else
{var autocomplete=this.dateAutocompleteCharacters[group+1];futureValue=this.oldValue.substring(0,this.selection.start)+pressed+autocomplete+this.oldValue.substring(this.selection.start+1);movePosition=1+autocomplete.length;}}}}
this.setValue(futureValue);this.selection.moveTo(this.selection.start+movePosition,this.selection.start+movePosition);return false;}}}
return false;}};Spry.Widget.ValidationTextField.prototype.onKeyDown=function(e)
{this.saveState();this.keyCode=e.keyCode;if(Spry.is.opera){if(this.flags.operaPasteOperation){window.clearInterval(this.flags.operaPasteOperation);this.flags.operaPasteOperation=null;}
if(e.ctrlKey){var pressed=Spry.Widget.Utils.getCharacterFromEvent(e);if(pressed&&'vx'.indexOf(pressed.toLowerCase())!=-1){var self=this;this.flags.operaPasteOperation=window.setInterval(function(){self.operaPasteMonitor();},1);return true;}}}
if(this.keyCode!=8&&this.keyCode!=46&&Spry.Widget.Utils.isSpecialKey(e)){return true;}
if(this.keyCode==8||this.keyCode==46){var mr=this.doValidations(this.input.value,this.input.value);if(mr){return true;}}
if(this.useCharacterMasking&&this.pattern&&this.keyCode==46){if(e.ctrlKey){this.setValue(this.input.value.substring(0,this.selection.start));}else if(this.selection.end==this.input.value.length||this.selection.start==this.input.value.length-1){return true;}else{this.flags.operaRevertOnKeyUp=true;}
if(Spry.is.mozilla&&Spry.is.mac){this.flags.skp=true;}
Spry.Widget.Utils.stopEvent(e);return false;}
if(this.useCharacterMasking&&this.pattern&&!e.ctrlKey&&this.keyCode==8){if(this.selection.start==this.input.value.length){var n=this.getAutoComplete(this.selection.start,-1);this.setValue(this.input.value.substring(0,this.input.value.length-(Spry.is.opera?0:1)-n.length));if(Spry.is.opera){this.selection.start=this.selection.start-1-n.length;this.selection.end=this.selection.end-1-n.length;}}else if(this.selection.end==this.input.value.length){return true;}else{this.flags.operaRevertOnKeyUp=true;}
if(Spry.is.mozilla&&Spry.is.mac){this.flags.skp=true;}
Spry.Widget.Utils.stopEvent(e);return false;}
return true;};Spry.Widget.ValidationTextField.prototype.onMouseDown=function(e)
{if(this.flags.active){this.saveState();}};Spry.Widget.ValidationTextField.prototype.onDrop=function(e)
{this.flags.drop=true;this.removeHint();this.saveState();this.flags.active=true;this.addClassName(this.element,this.focusClass);this.addClassName(this.additionalError,this.focusClass);};Spry.Widget.ValidationTextField.prototype.onFocus=function(e)
{if(this.flags.drop){return;}
this.removeHint();if(this.pattern&&this.useCharacterMasking){var autocomplete=this.getAutoComplete(this.selection.start);this.setValue(this.input.value+autocomplete);this.selection.moveTo(this.input.value.length,this.input.value.length);}
this.saveState();this.flags.active=true;this.addClassName(this.element,this.focusClass);this.addClassName(this.additionalError,this.focusClass);};Spry.Widget.ValidationTextField.prototype.onBlur=function(e)
{this.flags.active=false;this.removeClassName(this.element,this.focusClass);this.removeClassName(this.additionalError,this.focusClass);this.flags.restoreSelection=false;var mustRevert=this.doValidations(this.input.value,this.input.value);this.flags.restoreSelection=true;if(this.validateOn&Spry.Widget.ValidationTextField.ONBLUR){this.validate();}
var self=this;setTimeout(function(){self.putHint();},10);return true;};Spry.Widget.ValidationTextField.prototype.compilePattern=function(){if(!this.pattern){return;}
var compiled=[];var regexps=[];var patternCharacters=[];var idx=0;var c='',p='';for(var i=0;i<this.pattern.length;i++){c=this.pattern.charAt(i);if(p=='\\'){if(/[0ABXY\?]/i.test(c)){regexps[idx-1]=c;}else{regexps[idx-1]=Spry.Widget.ValidationTextField.regExpFromChars(c);}
compiled[idx-1]=c;patternCharacters[idx-1]=null;p='';continue;}
regexps[idx]=Spry.Widget.ValidationTextField.regExpFromChars(c);if(/[0ABXY\?]/i.test(c)){compiled[idx]=null;patternCharacters[idx]=c;}else if(c=='\\'){compiled[idx]=c;patternCharacters[idx]='\\';}else{compiled[idx]=c;patternCharacters[idx]=null;}
idx++;p=c;}
this.autoCompleteCharacters=compiled;this.compiledPattern=regexps;this.patternCharacters=patternCharacters;this.patternLength=compiled.length;};Spry.Widget.ValidationTextField.prototype.getAutoComplete=function(from,direction){if(direction==-1){var n='',m='';while(from&&(n=this.getAutoComplete(--from))){m=n;}
return m;}
var ret='',c='';for(var i=from;i<this.autoCompleteCharacters.length;i++){c=this.autoCompleteCharacters[i];if(c){ret+=c;}else{break;}}
return ret;};Spry.Widget.ValidationTextField.regExpFromChars=function(string){var ret='',character='';for(var i=0;i<string.length;i++){character=string.charAt(i);switch(character){case'0':ret+='\\d';break;case'A':ret+='[A-Z]';break;case'a':ret+='[a-z]';break;case'B':case'b':ret+='[a-zA-Z]';break;case'x':ret+='[0-9a-z]';break;case'X':ret+='[0-9A-Z]';break;case'Y':case'y':ret+='[0-9a-zA-Z]';break;case'?':ret+='.';break;case'1':case'2':case'3':case'4':case'5':case'6':case'7':case'8':case'9':ret+=character;break;case'c':case'C':case'e':case'E':case'f':case'F':case'r':case'd':case'D':case'n':case's':case'S':case'w':case'W':case't':case'v':ret+=character;break;default:ret+='\\'+character;}}
return ret;};Spry.Widget.ValidationTextField.prototype.patternToRegExp=function(len){var ret='^';var end=Math.min(this.compiledPattern.length,len);for(var i=0;i<end;i++){ret+=this.compiledPattern[i];}
ret+='$';ret=new RegExp(ret,"");return ret;};Spry.Widget.ValidationTextField.prototype.resetClasses=function(){var classes=[this.requiredClass,this.invalidFormatClass,this.invalidRangeMinClass,this.invalidRangeMaxClass,this.invalidCharsMinClass,this.invalidCharsMaxClass,this.validClass];for(var i=0;i<classes.length;i++)
{this.removeClassName(this.element,classes[i]);this.removeClassName(this.additionalError,classes[i]);}};Spry.Widget.ValidationTextField.prototype.reset=function(){this.removeHint();this.oldValue=this.input.defaultValue;this.resetClasses();if(Spry.is.ie){this.input.forceFireFirstOnPropertyChange=true;this.input.removeAttribute("forceFireFirstOnPropertyChange");}
var self=this;setTimeout(function(){self.putHint();},10);};Spry.Widget.ValidationTextField.prototype.validate=function(){this.resetClasses();if(this.validateOn&Spry.Widget.ValidationTextField.ONSUBMIT){this.removeHint();this.doValidations(this.input.value,this.input.value);if(!this.flags.active){var self=this;setTimeout(function(){self.putHint();},10);}}
if(this.isRequired&&this.errors&Spry.Widget.ValidationTextField.ERROR_REQUIRED){this.addClassName(this.element,this.requiredClass);this.addClassName(this.additionalError,this.requiredClass);return false;}
if(this.errors&Spry.Widget.ValidationTextField.ERROR_FORMAT){this.addClassName(this.element,this.invalidFormatClass);this.addClassName(this.additionalError,this.invalidFormatClass);return false;}
if(this.errors&Spry.Widget.ValidationTextField.ERROR_RANGE_MIN){this.addClassName(this.element,this.invalidRangeMinClass);this.addClassName(this.additionalError,this.invalidRangeMinClass);return false;}
if(this.errors&Spry.Widget.ValidationTextField.ERROR_RANGE_MAX){this.addClassName(this.element,this.invalidRangeMaxClass);this.addClassName(this.additionalError,this.invalidRangeMaxClass);return false;}
if(this.errors&Spry.Widget.ValidationTextField.ERROR_CHARS_MIN){this.addClassName(this.element,this.invalidCharsMinClass);this.addClassName(this.additionalError,this.invalidCharsMinClass);return false;}
if(this.errors&Spry.Widget.ValidationTextField.ERROR_CHARS_MAX){this.addClassName(this.element,this.invalidCharsMaxClass);this.addClassName(this.additionalError,this.invalidCharsMaxClass);return false;}
this.addClassName(this.element,this.validClass);this.addClassName(this.additionalError,this.validClass);return true;};Spry.Widget.ValidationTextField.prototype.addClassName=function(ele,className)
{if(!ele||!className||(ele.className&&ele.className.search(new RegExp("\\b"+className+"\\b"))!=-1))
return;ele.className+=(ele.className?" ":"")+className;};Spry.Widget.ValidationTextField.prototype.removeClassName=function(ele,className)
{if(!ele||!className||(ele.className&&ele.className.search(new RegExp("\\b"+className+"\\b"))==-1))
return;ele.className=ele.className.replace(new RegExp("\\s*\\b"+className+"\\b","g"),"");};Spry.Widget.ValidationTextField.prototype.showError=function(msg)
{alert('Spry.Widget.TextField ERR: '+msg);};Spry.Widget.SelectionDescriptor=function(element)
{this.element=element;this.update();};Spry.Widget.SelectionDescriptor.prototype.update=function()
{if(Spry.is.ie&&Spry.is.windows){var sel=this.element.ownerDocument.selection;if(this.element.nodeName=="TEXTAREA"){if(sel.type!='None'){try{var range=sel.createRange();}catch(err){return;}
if(range.parentElement()==this.element){var range_all=this.element.ownerDocument.body.createTextRange();range_all.moveToElementText(this.element);for(var sel_start=0;range_all.compareEndPoints('StartToStart',range)<0;sel_start++){range_all.moveStart('character',1);}
this.start=sel_start;range_all=this.element.ownerDocument.body.createTextRange();range_all.moveToElementText(this.element);for(var sel_end=0;range_all.compareEndPoints('StartToEnd',range)<0;sel_end++){range_all.moveStart('character',1);}
this.end=sel_end;this.length=this.end-this.start;this.text=range.text;}}}else if(this.element.nodeName=="INPUT"){try{this.range=sel.createRange();}catch(err){return;}
this.length=this.range.text.length;var clone=this.range.duplicate();this.start=-clone.moveStart("character",-10000);clone=this.range.duplicate();clone.collapse(false);this.end=-clone.moveStart("character",-10000);this.text=this.range.text;}}else{var tmp=this.element;var selectionStart=0;var selectionEnd=0;try{selectionStart=tmp.selectionStart;}catch(err){}
try{selectionEnd=tmp.selectionEnd;}catch(err){}
if(Spry.is.safari){if(selectionStart==2147483647){selectionStart=0;}
if(selectionEnd==2147483647){selectionEnd=0;}}
this.start=selectionStart;this.end=selectionEnd;this.length=selectionEnd-selectionStart;this.text=this.element.value.substring(selectionStart,selectionEnd);}};Spry.Widget.SelectionDescriptor.prototype.destroy=function(){try{delete this.range}catch(err){}
try{delete this.element}catch(err){}};Spry.Widget.SelectionDescriptor.prototype.move=function(amount)
{if(Spry.is.ie&&Spry.is.windows){this.range.move("character",amount);this.range.select();}else{try{this.element.selectionStart++;}catch(err){}}
this.update();};Spry.Widget.SelectionDescriptor.prototype.moveTo=function(start,end)
{if(Spry.is.ie&&Spry.is.windows){if(this.element.nodeName=="TEXTAREA"){var ta_range=this.element.createTextRange();this.range=this.element.createTextRange();this.range.move("character",start);this.range.moveEnd("character",end-start);var c1=this.range.compareEndPoints("StartToStart",ta_range);if(c1<0){this.range.setEndPoint("StartToStart",ta_range);}
var c2=this.range.compareEndPoints("EndToEnd",ta_range);if(c2>0){this.range.setEndPoint("EndToEnd",ta_range);}}else if(this.element.nodeName=="INPUT"){this.range=this.element.ownerDocument.selection.createRange();this.range.move("character",-10000);this.start=this.range.moveStart("character",start);this.end=this.start+this.range.moveEnd("character",end-start);}
this.range.select();}else{this.start=start;try{this.element.selectionStart=start;}catch(err){}
this.end=end;try{this.element.selectionEnd=end;}catch(err){}}
this.ignore=true;this.update();};Spry.Widget.SelectionDescriptor.prototype.moveEnd=function(amount)
{if(Spry.is.ie&&Spry.is.windows){this.range.moveEnd("character",amount);this.range.select();}else{try{this.element.selectionEnd++;}catch(err){}}
this.update();};Spry.Widget.SelectionDescriptor.prototype.collapse=function(begin)
{if(Spry.is.ie&&Spry.is.windows){this.range=this.element.ownerDocument.selection.createRange();this.range.collapse(begin);this.range.select();}else{if(begin){try{this.element.selectionEnd=this.element.selectionStart;}catch(err){}}else{try{this.element.selectionStart=this.element.selectionEnd;}catch(err){}}}
this.update();};if(!Spry.Widget.Form)Spry.Widget.Form={};if(!Spry.Widget.Form.onSubmitWidgetQueue)Spry.Widget.Form.onSubmitWidgetQueue=[];if(!Spry.Widget.Form.validate){Spry.Widget.Form.validate=function(vform){var isValid=true;var isElementValid=true;var q=Spry.Widget.Form.onSubmitWidgetQueue;var qlen=q.length;for(var i=0;i<qlen;i++){if(!q[i].isDisabled()&&q[i].form==vform){isElementValid=q[i].validate();isValid=isElementValid&&isValid;}}
return isValid;}};if(!Spry.Widget.Form.onSubmit){Spry.Widget.Form.onSubmit=function(e,form)
{if(Spry.Widget.Form.validate(form)==false){return false;}
return true;};};if(!Spry.Widget.Form.onReset){Spry.Widget.Form.onReset=function(e,vform)
{var q=Spry.Widget.Form.onSubmitWidgetQueue;var qlen=q.length;for(var i=0;i<qlen;i++){if(!q[i].isDisabled()&&q[i].form==vform&&typeof(q[i].reset)=='function'){q[i].reset();}}
return true;};};if(!Spry.Widget.Form.destroy){Spry.Widget.Form.destroy=function(form)
{var q=Spry.Widget.Form.onSubmitWidgetQueue;for(var i=0;i<Spry.Widget.Form.onSubmitWidgetQueue.length;i++){if(q[i].form==form&&typeof(q[i].destroy)=='function'){q[i].destroy();i--;}}}};if(!Spry.Widget.Form.destroyAll){Spry.Widget.Form.destroyAll=function()
{var q=Spry.Widget.Form.onSubmitWidgetQueue;for(var i=0;i<Spry.Widget.Form.onSubmitWidgetQueue.length;i++){if(typeof(q[i].destroy)=='function'){q[i].destroy();i--;}}}};if(!Spry.Widget.Utils)Spry.Widget.Utils={};Spry.Widget.Utils.punycode_constants={base:36,tmin:1,tmax:26,skew:38,damp:700,initial_bias:72,initial_n:0x80,delimiter:0x2D,maxint:2<<26-1};Spry.Widget.Utils.punycode_encode_digit=function(d){return String.fromCharCode(d+22+75*(d<26));};Spry.Widget.Utils.punycode_adapt=function(delta,numpoints,firsttime){delta=firsttime?delta/this.punycode_constants.damp:delta>>1;delta+=delta/numpoints;for(var k=0;delta>((this.punycode_constants.base-this.punycode_constants.tmin)*this.punycode_constants.tmax)/2;k+=this.punycode_constants.base){delta/=this.punycode_constants.base-this.punycode_constants.tmin;}
return k+(this.punycode_constants.base-this.punycode_constants.tmin+1)*delta/(delta+this.punycode_constants.skew);};Spry.Widget.Utils.punycode_encode=function(input,max_out){var inputc=input.split("");input=[];for(var i=0;i<inputc.length;i++){input.push(inputc[i].charCodeAt(0));}
var output='';var h,b,j,m,q,k,t;var input_len=input.length;var n=this.punycode_constants.initial_n;var delta=0;var bias=this.punycode_constants.initial_bias;var out=0;for(j=0;j<input_len;j++){if(input[j]<128){if(max_out-out<2){return false;}
output+=String.fromCharCode(input[j]);out++;}}
h=b=out;if(b>0){output+=String.fromCharCode(this.punycode_constants.delimiter);out++;}
while(h<input_len){for(m=this.punycode_constants.maxint,j=0;j<input_len;j++){if(input[j]>=n&&input[j]<m){m=input[j];}}
if(m-n>(this.punycode_constants.maxint-delta)/(h+1)){return false;}
delta+=(m-n)*(h+1);n=m;for(j=0;j<input_len;j++){if(input[j]<n){if(++delta==0){return false;}}
if(input[j]==n){for(q=delta,k=this.punycode_constants.base;true;k+=this.punycode_constants.base){if(out>=max_out){return false;}
t=k<=bias?this.punycode_constants.tmin:k>=bias+this.punycode_constants.tmax?this.punycode_constants.tmax:k-bias;if(q<t){break;}
output+=this.punycode_encode_digit(t+(q-t)%(this.punycode_constants.base-t));out++;q=(q-t)/(this.punycode_constants.base-t);}
output+=this.punycode_encode_digit(q);out++;bias=this.punycode_adapt(delta,h+1,h==b);delta=0;h++;}}
delta++,n++;}
return output;};Spry.Widget.Utils.setOptions=function(obj,optionsObj,ignoreUndefinedProps)
{if(!optionsObj)
return;for(var optionName in optionsObj)
{if(ignoreUndefinedProps&&optionsObj[optionName]==undefined)
continue;obj[optionName]=optionsObj[optionName];}};Spry.Widget.Utils.firstValid=function(){var ret=null;for(var i=0;i<Spry.Widget.Utils.firstValid.arguments.length;i++){if(typeof(Spry.Widget.Utils.firstValid.arguments[i])!='undefined'){ret=Spry.Widget.Utils.firstValid.arguments[i];break;}}
return ret;};Spry.Widget.Utils.specialCharacters=",8,9,16,17,18,20,27,33,34,35,36,37,38,40,45,144,192,63232,";Spry.Widget.Utils.specialSafariNavKeys="63232,63233,63234,63235,63272,63273,63275,63276,63277,63289,";Spry.Widget.Utils.specialNotSafariCharacters="39,46,91,92,93,";Spry.Widget.Utils.specialCharacters+=Spry.Widget.Utils.specialSafariNavKeys;if(!Spry.is.safari){Spry.Widget.Utils.specialCharacters+=Spry.Widget.Utils.specialNotSafariCharacters;}
Spry.Widget.Utils.isSpecialKey=function(ev){return Spry.Widget.Utils.specialCharacters.indexOf(","+ev.keyCode+",")!=-1;};Spry.Widget.Utils.getCharacterFromEvent=function(e){var keyDown=e.type=="keydown";var code=null;var character=null;if(Spry.is.mozilla&&!keyDown){if(e.charCode){character=String.fromCharCode(e.charCode);}else{code=e.keyCode;}}else{code=e.keyCode||e.which;if(code!=13){character=String.fromCharCode(code);}}
if(Spry.is.safari){if(keyDown){code=e.keyCode||e.which;character=String.fromCharCode(code);}else{code=e.keyCode||e.which;if(Spry.Widget.Utils.specialCharacters.indexOf(","+code+",")!=-1){character=null;}else{character=String.fromCharCode(code);}}}
if(Spry.is.opera){if(Spry.Widget.Utils.specialCharacters.indexOf(","+code+",")!=-1){character=null;}else{character=String.fromCharCode(code);}}
return character;};Spry.Widget.Utils.getFirstChildWithNodeNameAtAnyLevel=function(node,nodeName)
{var elements=node.getElementsByTagName(nodeName);if(elements){return elements[0];}
return null;};Spry.Widget.Utils.getFirstParentWithNodeName=function(node,nodeName)
{while(node.parentNode&&node.parentNode.nodeName.toLowerCase()!=nodeName.toLowerCase()&&node.parentNode.nodeName!='BODY'){node=node.parentNode;}
if(node.parentNode&&node.parentNode.nodeName.toLowerCase()==nodeName.toLowerCase()){return node.parentNode;}else{return null;}};Spry.Widget.Utils.destroyWidgets=function(container)
{if(typeof container=='string'){container=document.getElementById(container);}
var q=Spry.Widget.Form.onSubmitWidgetQueue;for(var i=0;i<Spry.Widget.Form.onSubmitWidgetQueue.length;i++){if(typeof(q[i].destroy)=='function'&&Spry.Widget.Utils.contains(container,q[i].element)){q[i].destroy();i--;}}};Spry.Widget.Utils.contains=function(who,what)
{if(typeof who.contains=='object'){return what&&who&&(who==what||who.contains(what));}else{var el=what;while(el){if(el==who){return true;}
el=el.parentNode;}
return false;}};Spry.Widget.Utils.addEventListener=function(element,eventType,handler,capture)
{try
{if(element.addEventListener)
element.addEventListener(eventType,handler,capture);else if(element.attachEvent)
element.attachEvent("on"+eventType,handler,capture);}
catch(e){}};Spry.Widget.Utils.removeEventListener=function(element,eventType,handler,capture)
{try
{if(element.removeEventListener)
element.removeEventListener(eventType,handler,capture);else if(element.detachEvent)
element.detachEvent("on"+eventType,handler,capture);}
catch(e){}};Spry.Widget.Utils.stopEvent=function(ev)
{try
{this.stopPropagation(ev);this.preventDefault(ev);}
catch(e){}};Spry.Widget.Utils.stopPropagation=function(ev)
{if(ev.stopPropagation)
{ev.stopPropagation();}
else
{ev.cancelBubble=true;}};Spry.Widget.Utils.preventDefault=function(ev)
{if(ev.preventDefault)
{ev.preventDefault();}
else
{ev.returnValue=false;}};


<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function pad(value, length) { 
        length = length || 2; 
        return "0000".substr(0,length - Math.min(String(value).length, length)) + value; 
};
//-->

