/*! DatePicker v6 MIT/GPL2 @freqdec */ ;var datePickerController=(function datePickerController(){var debug=false,isOpera=Object.prototype.toString.call(window.opera)==="[object Opera]",describedBy="",languageInfo=parseUILanguage(),nbsp=String.fromCharCode(160),datePickers={},weeksInYearCache={},bespokeTitles={},uniqueId=0,finalOpacity=100,buttonTabIndex=true,mouseWheel=true,deriveLocale=true,localeImport=false,nodrag=false,returnLocaleDate=false,kbEvent=false,cellFormat="%d %F %Y",titleFormat="%F %d, %Y",statusFormat="",formatParts=isOpera?["%j"]:["%j"," %F %Y"],dPartsRegExp=/%([d|j])/,mPartsRegExp=/%([M|F|m|n])/,yPartsRegExp=/%[y|Y]/,noSelectionRegExp=/date-picker-unused|out-of-range|day-disabled|not-selectable/,formatTestRegExp=/%([d|j|M|F|m|n|Y|y])/,formatSplitRegExp=/%([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]))$/,wsCharClass="\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029";(function(){var scriptFiles=document.getElementsByTagName("script"),json=parseJSON(String(scriptFiles[scriptFiles.length-1].innerHTML).replace(/[\n\r\s\t]+/g," ").replace(/^\s+/,"").replace(/\s+$/,""));if(typeof json==="object"&&!("err" in json)){affectJSON(json)}if(deriveLocale&&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,i;for(i=0;ilastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(!cbSplit._compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i1&&match.index=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===str.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(str.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output};cbSplit._compliantExecNpcg=/()??/.exec("")[1]===undefined;cbSplit._nativeSplit=String.prototype.split;function affectJSON(json){if(!(typeof json==="object")){return}var key,switchObj={debug:function(value){debug=!!value;return true},lang:function(value){if(typeof value==="string"&&value.search(/^[a-z]{2,3}(-([a-z]{2}))?$/i)!=-1){languageInfo=[value.toLowerCase()];returnLocaleDate=true;deriveLocale=true}return true},nodrag:function(value){nodrag=!!value;return true},buttontabindex:function(value){buttonTabIndex=!!value;return true},derivelocale:function(value){deriveLocale=!!value;return true},mousewheel:function(value){mouseWheel=!!value;return true},cellformat:function(value){if(typeof value==="string"){parseCellFormat(value)}return true},titleformat:function(value){if(typeof value==="string"){titleFormat=value}return true},statusformat:function(value){if(typeof value==="string"){statusFormat=value}return true},describedby:function(value){if(typeof value==="string"){describedBy=value}return true},finalopacity:function(value){if(typeof value==="number"&&(+value>20&&+value<=100)){finalOpacity=parseInt(value,10)}return true},bespoketitles:function(value){if(typeof value==="object"){bespokeTitles={};for(var dt in value){if(value.hasOwnProperty(dt)&&String(dt).match(wcDateRegExp)!=-1){bespokeTitles[dt]=String(value[dt])}}}return true},_default:function(){if(debug){throw"Unknown key located within JSON data: "+key}return true}};for(key in json){if(!json.hasOwnProperty(key)){continue}(switchObj.hasOwnProperty(String(key).toLowerCase())&&switchObj[key]||switchObj._default)(json[key])}}function parseJSON(str){if(!(typeof str==="string")||str==""){return{}}try{if(typeof JSON==="object"&&JSON.parse){return window.JSON.parse(str)}else{if(/debug|lang|nodrag|buttontabindex|derivelocale|mousewheel|cellformat|titleformat|statusformat|describedby|finalopacity|bespoketitles/.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:1}}function parseCellFormat(value){if(isOpera){formatParts=["%j"];cellFormat="%j %F %Y";return}if(value.match(/%([d|j])/)==-1){return}formatParts=cbSplit(value,/%([d|j])/);cellFormat=value}function pad(value,length){length=Math.min(4,length||2);return"0000".substr(0,length-Math.min(String(value).length,length))+value}function addEvent(obj,type,fn){try{if(obj.attachEvent){obj.attachEvent("on"+type,fn)}else{obj.addEventListener(type,fn,true)}}catch(err){}}function removeEvent(obj,type,fn){try{if(obj.detachEvent){obj.detachEvent("on"+type,fn)}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 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 setTabIndex(e,i){e.setAttribute(!false?"tabIndex":"tabindex",i);e.tabIndex=i}function dateToYYYYMMDD(dt){return dt instanceof Date&&!isNaN(dt)?dt.getFullYear()+pad(dt.getMonth()+1)+""+pad(dt.getDate()):dt}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),5,0,0):new Date();this.defaults={};this.dynDisabledDates={};this.dateList=[];this.bespokeClass=options.bespokeClass;this.firstDayOfWeek=localeImport.firstDayOfWeek;this.interval=new Date();this.clickActivated=false;this.noFocus=true;this.kbEvent=false;this.delayedUpdate=false;this.bespokeTitles={};this.bespokeTabIndex=options.bespokeTabIndex;for(var thing in options){if(!options.hasOwnProperty(thing)||String(thing).search(/^(callbacks|formElements|enabledDates|disabledDates)$/)!=-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"][i];i++){this[prop]={};if(prop in options){for(thing in options[prop]){if(options[prop].hasOwnProperty(thing)){this[prop][thing]=options[prop][thing]}}}}this.date.setHours(5);this.changeHandler=function(){if(o.disabled){return}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.getDateExceptions=function(y,m){m=pad(m);var obj={},lower=o.firstDateShown,upper=o.lastDateShown,rLength=o.dateList.length,rNumber,workingDt,workingY,workingM,dtLower,dtUpper,i,dt,dt1,dt2,rngLower,rngUpper,cDate;if(!upper||!lower){lower=o.firstDateShown=y+pad(m)+"01";upper=o.lastDateShown=y+pad(m)+pad(daysInMonth(m,y))}dtLower=Number(lower.substr(0,6));dtUpper=Number(upper.substr(0,6));workingDt=String(dtLower);while(+workingDt<=dtUpper){workingY=workingDt.substr(0,4);workingM=workingDt.substr(4,2);for(rNumber=0;rNumber=+o.firstDateShown&&+dt1<=+o.lastDateShown){obj[dt1]=o.dateList[rNumber].type}continue}if(+dt1<=+dt2&&+workingDt>=dt1.substr(0,6)&&+workingDt<=dt2.substr(0,6)){rngLower=Math.max(dt1,Math.max(String(workingDt)+"01",this.firstDateShown));rngUpper=Math.min(dt2,Math.min(String(workingDt)+"31",this.lastDateShown));for(var i=rngLower;i<=rngUpper;i++){obj[i]=o.dateList[rNumber].type}}}workingDt=new Date(workingY,+workingM,2);workingDt=workingDt.getFullYear()+""+pad(workingDt.getMonth()+1)}return obj};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],tSpace=parseInt(pos[1]-2)-parseInt(scrollTop),bSpace=parseInt(trueBody.clientHeight+scrollTop)-parseInt(pos[1]+elem.offsetHeight+2);o.div.style.visibility="visible";o.div.style.left=Number(parseInt(trueBody.clientWidth+scrollLeft)tSpace)?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{setTabIndex(td,-1);removeClass(td,"date-picker-hover");td.id="";td.onblur=null;td.onfocus=null}catch(err){}}};this.setNewFocus=function(){var td=document.getElementById(o.id+"-date-picker-hover");if(td){try{setTabIndex(td,0);addClass(td,"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.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(noSelectionRegExp)!=-1,spn=document.createElement("span"),spnC;spn.className="fd-screen-reader";removeChildNodes(td);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=="%j"||part=="%d"){td.appendChild(document.createTextNode(printFormattedDate(new Date(ymd[1],+ymd[2]-1,ymd[3],5,0,0),part,true)))}else{spnC=spn.cloneNode(false);spnC.appendChild(document.createTextNode(printFormattedDate(new Date(ymd[1],+ymd[2]-1,ymd[3],5,0,0),part,true)));td.appendChild(spnC)}}}};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),5,0,0);this.cursorDate=yyyymmdd;if(this.staticPos){this.updateTable()}}};this.updateTable=function(noCallback){if(!o||o.inUpdate||!o.created){return}o.inUpdate=true;o.removeOldFocus();o.div.dir=localeImport.rtl?"rtl":"ltr";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,5,0,0);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(),today=today.getFullYear()+pad(today.getMonth()+1)+pad(today.getDate()),stub=String(tmpDate.getFullYear())+pad(tmpDate.getMonth()+1),cellAdded=[4,4,4,4,4,4],lm=new Date(cy,cm-1,1,5,0,0),nm=new Date(cy,cm+1,1,5,0,0),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,spn=document.createElement("span");spn.className="fd-screen-reader";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.getDateExceptions(cy,cm+1);o.checkSelectedDate();dateSetD=(o.dateSet!=null)?o.dateSet.getFullYear()+pad(o.dateSet.getMonth()+1)+pad(o.dateSet.getDate()):false;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);removeChildNodes(td);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-"+weekDay+" cell-"+curr);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,5,0,0),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,5,0,0),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(((currentDate in dts)&&dts[currentDate]==1)||(o.disabledDays[weekDay]&&!((currentDate in dts)&&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){removeChildNodes(o.wkThs[row]);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");removeChildNodes(span[0]);removeChildNodes(span[1]);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.reset=function(){var elemID,elem;for(elemID in o.formElements){elem=document.getElementById(elemID);if(elem){if(elem.tagName.toLowerCase()=="select"){elem.selectedIndex=o.formElements[elemID.defaultVal]}else{elem.value=o.formElements[elemID.defaultVal]}}}o.changeHandler()};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 @*/ }th.unselectable="on";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||"";but.unselectable="on";th.appendChild(but)}}this.div=document.createElement("div");this.div.id="fd-"+this.id;this.div.className="date-picker"+this.bespokeClass;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="date-picker-table";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:'';"; 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,"application");setARIARole(this.table,"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");tableHead.className="date-picker-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,formElemId,formElem;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;cols0&&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(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;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];removeClass(b,"fd-drag-active");removeEvent(document,"mousemove",o.trackDrag,false);removeEvent(document,"mouseup",o.stopDrag,false);o.div.style.zIndex=9999;o.callback("stopdrag",{id:o.id})};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.currentYYYYMMdateYYYYMM&&(o.yearInc==1||o.monthInc==1))){o.delayedUpdate=false;o.timerInc=1200}else{o.delayedUpdate=true}}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,10);o.y=parseInt(o.div.style.top,10);addEvent(document,"mousemove",o.trackDrag,false);addEvent(document,"mouseup",o.stopDrag,false);addClass(document.getElementsByTagName("body")[0],"fd-drag-active");o.div.style.zIndex=10000;o.callback("startdrag",{id:o.id});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(noSelectionRegExp)!=-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),5,0,0);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){addClass(butt,"date-picker-button-active")}this.callback("show",{id:this.id})};this.hide=function(){if(!this.visible||!this.created||!document.getElementById("fd-"+this.id)){return}this.kbEvent=false;removeClass(o.div,"date-picker-focus");this.stopTimer();this.removeOnFocusEvents();this.clickActivated=false;this.noFocus=true;this.setNewFocus();if(this.staticPos){return}if(this.statusBar){this.updateStatus(getTitleTranslation(9))}var butt=document.getElementById("fd-but-"+this.id);if(butt){removeClass(butt,"date-picker-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.callback("hide",{id:this.id})};this.onblur=function(e){o.hide()};this.onfocus=function(e){o.noFocus=false;addClass(o.div,"date-picker-focus");if(o.statusBar){o.updateStatus(printFormattedDate(o.date,o.statusFormat,true))}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(/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();var butt=document.getElementById("fd-but-"+o.id);if(butt){setTimeout(function(){try{butt.focus()}catch(err){}},0)}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((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),cursorYYYYMM=o.date.getFullYear()+pad(o.date.getMonth()+1),tmp;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,5,0,0)}else{if(kc==39||kc==34){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()+1,5,0,0)}else{if(kc==38){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()-7,5,0,0)}else{if(kc==40){d=new Date(o.date.getFullYear(),o.date.getMonth(),o.date.getDate()+7,5,0,0)}}}}}}}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)||to.lastDateShown){o.updateTable(); /*@cc_on @if(@_win32) o.interval = new Date(); @end @*/ }else{if(!o.noToday){o.disableTodayButton()}o.removeOldFocus();o.showHideButtons(o.date);for(var i=0,td;td=o.tds[i];i++){if(td.className.search("cd-"+t)==-1){continue}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.dateSet?o.getBespokeTitle(o.dateSet.getFullYear(),o.dateSet.getMonth()+1,o.dateSet.getDate())||printFormattedDate(o.dateSet,o.statusFormat,true):getTitleTranslation(9))}};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}o.noFocus=true;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),5,0,0);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(/day-([0-6])/)!=-1){var day=el.className.match(/day-([0-6])/)[1];statusText=getTitleTranslation(11,[getDayTranslation(day,false)])}else{if(el.className.search(/(drag-enabled|today-but|prev-(year|month)|next-(year|month))/)!=-1&&el.className.search(/disabled/)==-1){statusText=getTitleTranslation({"drag-enabled":10,"prev-year":2,"prev-month":0,"next-year":3,"next-month":1,"today-but":12}[el.className.match(/(drag-enabled|today-but|prev-(year|month)|next-(year|month))/)[0]])}}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,elemCnt=0;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(elemCnt==0&&elem.form){addEvent(elem.form,"reset",o.reset)}elemCnt++}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){removeClass(this,"date-picker-button-active");hideAll();return stopEvent(e)}autoFocus=true}else{datePickers[inpId].kbEvent=false}if(!dpVisible){addClass(this,"date-picker-button-active");hideAll(inpId);showDatePicker(inpId,autoFocus)}else{removeClass(this,"date-picker-button-active");hideAll()}return stopEvent(e)}but.onclick=buttonEvent;but.onkeydown=buttonEvent;if(!buttonTabIndex){setTabIndex(but,-1)}else{setTabIndex(but,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={};this.addBespokeTitles(titles)};datePicker.prototype.addBespokeTitles=function(titles){for(var dt in titles){if(titles.hasOwnProperty(dt)){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){if(this.bespokeTitles.hasOwnProperty(dt)){dtFull=String(dt).replace(/^(\*\*\*\*)/,y).replace(/^(\d\d\d\d)(\*\*)/,"$1"+pad(m));if(dtFull==yyyymmdd){return this.bespokeTitles[dt]}}}for(dt in bespokeTitles){if(bespokeTitles.hasOwnProperty(dt)){dtFull=String(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){if(String(range).search(rangeRegExp)==-1){if(debug){throw"Invalid value passed to setRangeLow method: "+range}return false}this.rangeLow=range;if(!this.inUpdate){this.setDateFromInput()}};datePicker.prototype.setRangeHigh=function(range){if(String(range).search(rangeRegExp)==-1){if(debug){throw"Invalid value passed to setRangeHigh method: "+range}return false}this.rangeHigh=range;if(!this.inUpdate){this.setDateFromInput()}};datePicker.prototype.setDisabledDays=function(dayArray){if(!dayArray.length||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.filterDateList(dateObj,true)};datePicker.prototype.setEnabledDates=function(dateObj){this.filterDateList(dateObj,false)};datePicker.prototype.addDisabledDates=function(dateObj){this.addDatesToList(dateObj,true)};datePicker.prototype.addEnabledDates=function(dateObj){this.addDatesToList(dateObj,false)};datePicker.prototype.filterDateList=function(dateObj,type){var tmpDates=[];for(var i=0;iNumber(String(dateObj[startD]).replace(/^\*\*\*\*/,2010).replace(/^(\d\d\d\d)(\*\*)/,"$122"))){continue}this.dateList.push({type:!!(areDisabled),rLow:startD,rHigh: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],5,0,0);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.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.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||isNaN(tmpDate)){return false}var d=pad(tmpDate.getDate()),m=pad(tmpDate.getMonth()+1),y=tmpDate.getFullYear(),dt=y+""+m+""+d,dd=this.getDateExceptions(y,m),wd=tmpDate.getDay()==0?7:tmpDate.getDay();if((this.rangeLow&&+dt<+this.rangeLow)||(this.rangeHigh&&+dt>+this.rangeHigh)||((dt in dd)&&dd[dt]==1)||(this.disabledDays[wd-1]&&(!(dt in dd)||((dt in dd)&&dd[dt]==1)))){return false}return true};datePicker.prototype.updateStatus=function(msg){removeChildNodes(this.statusBar);if(msg&&this.statusFormat.search(/%S/)!=-1&&msg.search(/([0-9]{1,2})(st|nd|rd|th)/)!=-1){msg=cbSplit(msg.replace(/([0-9]{1,2})(st|nd|rd|th)/,"$1$2"),/|<\/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,but=this.staticPos?false:document.getElementById("fd-but-"+this.id),i,dt,elemID,elem,elemFmt,d,y,elemVal,dp,mp,yp,dpt;this.dateSet=null;for(elemID in this.formElements){elem=document.getElementById(elemID);if(!elem){return false}elemVal=String(elem.value);elemFmt=this.formElements[elemID];dt=false;dp=elemFmt.search(dPartsRegExp)!=-1?1:0;mp=elemFmt.search(mPartsRegExp)!=-1?1:0;yp=elemFmt.search(yPartsRegExp)!=-1?1:0;dpt=dp+mp+yp;allFormats=[];allFormats.push(elemFmt);if(dp&&mp&&yp){allFormats=allFormats.concat(["%Y%m%d","%Y/%m/%d","%Y/%n/%d","%Y/%n/%j","%d/%m/%Y","%j/%m/%Y","%j/%n/%Y","%d/%m/%y","%d/%M/%Y","%d/%F/%Y","%d/%M/%y","%d/%F/%y","%d%m%Y","%j%m%Y","%d%n%Y","%j%n%Y","%d%m%y","%j%m%y","%j%n%y"])}else{if(yp){allFormats=allFormats.concat(["%Y","%y"])}else{if(mp){allFormats=allFormats.concat(["%M","%F","%m","%n"])}else{if(dp){allFormats=allFormats.concat(["%d%","%j"])}}}}for(i=0;idaysInMonth(+m-1,+y)){d=daysInMonth(+m-1,+y);dt=false}else{dt=new Date(+y,+m-1,+d,5,0,0)}}if(but){removeClass(but,"date-picker-dateval")}if(!dt||isNaN(dt)){var newDate=new Date(y||new Date().getFullYear(),!(m===false)?m-1:new Date().getMonth(),1,5,0,0);this.date=this.cursorDate?new Date(+this.cursorDate.substr(0,4),+this.cursorDate.substr(4,2)-1,+this.cursorDate.substr(6,2),5,0,0):new Date(newDate.getFullYear(),newDate.getMonth(),Math.min(+d||new Date().getDate(),daysInMonth(newDate.getMonth(),newDate.getFullYear())),5,0,0);this.outOfRange();if(this.fullCreate){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(but){addClass(but,"date-picker-dateval")}}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){var but=this.staticPos?false:document.getElementById("fd-but-"+this.id);if(!this.dateSet){if(but){removeClass(but,"date-picker-dateval")}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}else{if(but){addClass(but,"date-picker-dateval")}}if(this.fullCreate){if(el.type&&el.type!="hidden"&&!noFocus){try{if(!Mobile){el.focus()}}catch(err){}}}if(!noFocus){this.callback("datereturned",this.createCbArgObj())}};datePicker.prototype.disableDatePicker=function(){if(this.disabled){return}if(this.staticPos){this.removeOnFocusEvents();this.removeOldFocus();this.noFocus=true;addClass(this.div,"date-picker-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){addClass(but,"date-picker-control-disabled");setARIAProperty(but,"disabled",true);but.onkeydown=but.onclick=function(){return false};setTabIndex(but,-1)}}clearTimeout(this.timer);this.disabled=true};datePicker.prototype.enableDatePicker=function(){if(!this.disabled){return}if(this.staticPos){this.removeOldFocus();if(this.dateSet!=null){this.date=this.dateSet}this.noFocus=true;this.updateTable();removeClass(this.div,"date-picker-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){removeClass(but,"date-picker-control-disabled");setARIAProperty(but,"disabled",false);this.addButtonEvents(but)}}this.disabled=false};datePicker.prototype.disableTodayButton=function(){var today=new Date();removeClass(this.butToday,"fd-disabled");if(this.outOfRange(today)||(this.date.getDate()==today.getDate()&&this.date.getMonth()==today.getMonth()&&this.date.getFullYear()==today.getFullYear())){addClass(this.butToday,"fd-disabled")}};datePicker.prototype.updateTableHeaders=function(){var colspanTotal=this.showWeeks?8:7,colOffset=this.showWeeks?1:0,d,but;for(var col=colOffset;colcolOffset){but=this.ths[col].getElementsByTagName("span")[0];removeChildNodes(but);but.appendChild(document.createTextNode(getDayTranslation(d,true)));but.title=this.ths[col].title;but=null}else{removeChildNodes(this.ths[col]);this.ths[col].appendChild(document.createTextNode(getDayTranslation(d,true)))}removeClass(this.ths[col],"date-picker-highlight");if(this.highlightDays[d]){addClass(this.ths[col],"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,func;for(func=0;funcnum){var txt=localeImport.titles[num];if(replacements&&replacements.length){for(var i=0;iday?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=new Date(Y,0,4),X2=new Date(Y,11,28);X1.setDate(X1.getDate()-(6+X1.getDay())%7);X2.setDate(X2.getDate()+(7-X2.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),DoW=d.getDay(),ms;d.setDate(d.getDate()-(DoW+6)%7+3);ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*86400000))+1};var printFormattedDate=function(date,fmt,useImportedLocale){if(!date||isNaN(date)){return fmt}var d=date.getDate(),D=date.getDay(),m=date.getMonth(),y=date.getFullYear(),locale=useImportedLocale?localeImport:localeDefaults,fmtParts=String(fmt).split(formatSplitRegExp),fmtParts=cbSplit(fmt,formatSplitRegExp),fmtNewParts=[],flags={d:pad(d),D:locale.dayAbbrs[D==0?6:D-1],l:locale.fullDays[D==0?6:D-1],j:d,N:D==0?7:D,w:D,W:getWeekNumber(y,m,d),M:locale.monthAbbrs[m],F:locale.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]},len=fmtParts.length,currFlag,f;for(f=0;fdaysInMonth(+m-1,+y)){return false}return{d:dp?+d:false,m:mp?+m:false,y:yp?+y:false}};var findLabelForElement=function(element){var label;if(element.parentNode&&element.parentNode.tagName.toLowerCase()=="label"){label=element.parentNode}else{var labelList=document.getElementsByTagName("label");for(var lbl=0;lbl+myMax){myMax=dtPartStr}}}if(!options.cursorDate&&cursorDate){options.cursorDate=cursorDate}options.disabledDates[myMin]=myMax}else{if(fmt.m&&fmt.y){for(i=0;i+myMax){myMax=dtPartStr}}}myMin+="01";myMax+=""+daysInMonth(+myMax.substr(4,2)-1,+myMax.substr(0,4))}else{if(fmt.y){for(i=0;i+myMax){myMax=dt.y}}}myMin+="0101";myMax+="1231"}}}}}if(!(partsFound.d==1&&partsFound.m==1&&partsFound.y==1)){if(debug){throw"Could not find all of the required date parts within the date format for element: "+elem.id}return false}if(myMin&&(!options.rangeLow||(+options.rangeLow<+myMin))){options.rangeLow=myMin}if(myMax&&(!options.rangeHigh||(+options.rangeHigh>+myMin))){options.rangeHigh=myMax}opts={formElements:options.formElements,id:options.id,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||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||(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],bespokeClass:options.bespokeClass?" "+options.bespokeClass:""};datePickers[options.id]=new datePicker(opts);if("disabledDates" in options&&!(options.disabledDates===false)){datePickers[options.id].setDisabledDates(options.disabledDates)}if("enabledDates" in options&&!(options.enabledDates===false)){datePickers[options.id].setEnabledDates(options.enabledDates)}datePickers[options.id].callback("create",datePickers[options.id].createCbArgObj())};var isVisible=function(id){return(!id||!(id in datePickers))?false:datePickers[id].visible};var updateStatic=function(){var dp;for(dp in datePickers){if(datePickers.hasOwnProperty(dp)){datePickers[dp].changeHandler()}}};addEvent(window,"unload",destroy);addEvent(window,"load",function(){setTimeout(updateStatic,0)}); /*@cc_on @if (@_jscript_version < 9) addClass(document.documentElement, "oldie"); @end @*/ ;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(dateToYYYYMMDD(yyyymmdd))},setRangeHigh:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers)){return false}datePickers[inpID].setRangeHigh(dateToYYYYMMDD(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)},setGlobalOptions:function(json){affectJSON(json)},setSelectedDate:function(inpID,yyyymmdd){if(!inpID||!(inpID in datePickers)){return false}datePickers[inpID].setSelectedDate(dateToYYYYMMDD(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(dateToYYYYMMDD(yyyymmdd))},getSelectedDate:function(inpID){return(!inpID||!(inpID in datePickers))?false:datePickers[inpID].returnSelectedDate()},loadLanguage:function(){loadLanguage()},setDebug:function(dbg){debug=!!(dbg)},dateToYYYYMMDDStr:function(dt){return dateToYYYYMMDD(dt)},reposition:function(inpID){if(!inpID||!(inpID in datePickers)){return false}datePickers[inpID].reposition();return true}}})();