﻿// PLEASE PACK IT WITH http://www.xmlforasp.net/jscompressor.aspx IN ORDER: DATEPICKER,LIGHTBOX,VALIDATIONENGINE,VALIDATIONENGINE LANGUAGE FILE,LIBRARY.
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=true,buttonTabIndex=true,returnLocaleDate=false,mouseWheel=true,cellFormat="d-ds-m-ds-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";head.appendChild(script);};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="pl";}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();};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];};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";};this.removeOldFocus=function(){var td=document.getElementById(o.id+"-date-picker-hover");if(td){try{td.setAttribute(!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(!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);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){th.setAttribute('colspan',details.colspan);};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||"";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);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");};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";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";};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";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);};};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;};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();}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(!false?"tabIndex":"tabindex","-1");but.tabIndex=-1;but.onkeydown=null;removeEvent(but,"keydown",buttonEvent);}else{but.setAttribute(!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);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(!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:["Stycze\u0144","Luty","Marzec","Kwiecie\u0144","Maj","Czerwiec","Lipiec","Sierpie\u0144","Wrzesie\u0144","Pa\u017Adziernik","Listopad","Grudzie\u0144"],monthAbbrs:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Pa\u017A","Lis","Gru"],fullDays:["Poniedzia\u0142ek","Wtorek","\u015Aroda","Czwartek","Pi\u0105tek","Sobota","Niedziela"],dayAbbrs:["Pon","Wto","\u015Aro","Czw","Pi\u0105","Sob","Nie"],titles:["Poprzedni miesi\u0105c","Nast\u0119pny miesi\u0105c","Poprzedni rok","Nast\u0119pny rok","Dzi\u015B","Poka\u017C kalendarz","Tyd","Tydzie\u0144 [[%0%]] z [[%1%]]","Tydzie\u0144","Wybierz dat\u0119","Przeci\u0105gnij i upu\u015B\u0107","Wy\u015Bwietla \u201C[[%0%]]\u201D Jako pierwszy","Zaznacza dzie\u0144 dzisiejszy","Data wy\u0142\u0105czona"],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($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'img/lightbox/lightbox-ico-loading.gif',imageBtnPrev:'img/lightbox/lightbox-btn-prev.gif',imageBtnNext:'img/lightbox/lightbox-btn-next.gif',imageBtnClose:'img/lightbox/lightbox-btn-close.gif',imageBlank:'img/lightbox/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);(function($){var methods={init:function(options){var form=this;if(!form.data('jqv')||form.data('jqv')==null){methods._saveOptions(form,options);$(".formError").live("click",function(){$(this).fadeOut(150,function(){$(this).remove();});});}},attach:function(userOptions){var form=this;var options;if(userOptions)
options=methods._saveOptions(form,userOptions);else
options=form.data('jqv');var validateAttribute=(form.find("[data-validation-engine*=validate]"))?"data-validation-engine":"class";if(!options.binded){if(options.bindMethod=="bind"){form.find("[class*=validate]:not([type=checkbox])").bind(options.validationEventTrigger,methods._onFieldEvent);form.find("[class*=validate][type=checkbox]").bind("click",methods._onFieldEvent);form.bind("submit",methods._onSubmitEvent);}else if(options.bindMethod=="live"){form.find("[class*=validate]:not([type=checkbox])").live(options.validationEventTrigger,methods._onFieldEvent);form.find("[class*=validate][type=checkbox]").live("click",methods._onFieldEvent);form.live("submit",methods._onSubmitEvent);}
options.binded=true;}},detach:function(){var form=this;var options=form.data('jqv');if(options.binded){form.find("[class*=validate]").not("[type=checkbox]").unbind(options.validationEventTrigger,methods._onFieldEvent);form.find("[class*=validate][type=checkbox]").unbind("click",methods._onFieldEvent);form.unbind("submit",methods.onAjaxFormComplete);form.find("[class*=validate]").not("[type=checkbox]").die(options.validationEventTrigger,methods._onFieldEvent);form.find("[class*=validate][type=checkbox]").die("click",methods._onFieldEvent);form.die("submit",methods.onAjaxFormComplete);form.removeData('jqv');}},validate:function(){return methods._validateFields(this);},validateField:function(el){var options=$(this).data('jqv');return methods._validateField($(el),options);},validateform:function(){return methods._onSubmitEvent.call(this);},showPrompt:function(promptText,type,promptPosition,showArrow){var form=this.closest('form');var options=form.data('jqv');if(!options)options=methods._saveOptions(this,options);if(promptPosition)
options.promptPosition=promptPosition;options.showArrow=showArrow==true;methods._showPrompt(this,promptText,type,false,options);},hidePrompt:function(){var promptClass="."+methods._getClassName($(this).attr("id"))+"formError";$(promptClass).fadeTo("fast",0.3,function(){$(this).remove();});},hide:function(){var closingtag;if($(this).is("form")){closingtag="parentForm"+$(this).attr('id');}else{closingtag=$(this).attr('id')+"formError";}
$('.'+closingtag).fadeTo("fast",0.3,function(){$(this).remove();});},hideAll:function(){$('.formError').fadeTo("fast",0.3,function(){$(this).remove();});},_onFieldEvent:function(){var field=$(this);var form=field.closest('form');var options=form.data('jqv');methods._validateField(field,options);},_onSubmitEvent:function(){var form=$(this);var options=form.data('jqv');var r=methods._validateFields(form,true);if(r&&options.ajaxFormValidation){methods._validateFormWithAjax(form,options);return false;}
if(options.onValidationComplete){options.onValidationComplete(form,r);return false;}
return r;},_checkAjaxStatus:function(options){var status=true;$.each(options.ajaxValidCache,function(key,value){if(!value){status=false;return false;}});return status;},_validateFields:function(form,skipAjaxValidation){var options=form.data('jqv');var errorFound=false;form.trigger("jqv.form.validating");form.find('[class*=validate]').not(':hidden').each(function(){var field=$(this);errorFound|=methods._validateField(field,options,skipAjaxValidation);});form.trigger("jqv.form.result",[errorFound]);if(errorFound){if(options.scroll){var destination=Number.MAX_VALUE;var fixleft=0;var lst=$(".formError:not('.greenPopup')");for(var i=0;i<lst.length;i++){var d=$(lst[i]).offset().top;if(d<destination){destination=d;fixleft=$(lst[i]).offset().left;}}
if(!options.isOverflown)
$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination,scrollLeft:fixleft},1100);else{var overflowDIV=$(options.overflownDIV);var scrollContainerScroll=overflowDIV.scrollTop();var scrollContainerPos=-parseInt(overflowDIV.offset().top);destination+=scrollContainerScroll+scrollContainerPos-5;var scrollContainer=$(options.overflownDIV+":not(:animated)");scrollContainer.animate({scrollTop:destination},1100);$("html:not(:animated),body:not(:animated)").animate({scrollTop:overflowDIV.offset().top,scrollLeft:fixleft},1100);}}
return false;}
return true;},_validateFormWithAjax:function(form,options){var data=form.serialize();var url=(options.ajaxFormValidationURL)?options.ajaxFormValidationURL:form.attr("action");$.ajax({type:"GET",url:url,cache:false,dataType:"json",data:data,form:form,methods:methods,options:options,beforeSend:function(){return options.onBeforeAjaxFormValidation(form,options);},error:function(data,transport){methods._ajaxError(data,transport);},success:function(json){if(json!==true){var errorInForm=false;for(var i=0;i<json.length;i++){var value=json[i];var errorFieldId=value[0];var errorField=$($("#"+errorFieldId)[0]);if(errorField.length==1){var msg=value[2];if(value[1]==true){if(msg==""||!msg){methods._closePrompt(errorField);}else{if(options.allrules[msg]){var txt=options.allrules[msg].alertTextOk;if(txt)
msg=txt;}
methods._showPrompt(errorField,msg,"pass",false,options,true);}}else{errorInForm|=true;if(options.allrules[msg]){var txt=options.allrules[msg].alertText;if(txt)
msg=txt;}
methods._showPrompt(errorField,msg,"",false,options,true);}}}
options.onAjaxFormComplete(!errorInForm,form,json,options);}else
options.onAjaxFormComplete(true,form,"",options);}});},_validateField:function(field,options,skipAjaxValidation){if(!field.attr("id"))
$.error("jQueryValidate: an ID attribute is required for this field: "+field.attr("name")+" class:"+
field.attr("class"));var rulesParsing=field.attr('class');var getRules=/validate\[(.*)\]/.exec(rulesParsing);if(!getRules)
return false;var str=getRules[1];var rules=str.split(/\[|,|\]/);var isAjaxValidator=false;var fieldName=field.attr("name");var promptText="";var required=false;options.isError=false;options.showArrow=true;for(var i=0;i<rules.length;i++){var errorMsg=undefined;switch(rules[i]){case"required":required=true;errorMsg=methods._required(field,rules,i,options);break;case"custom":errorMsg=methods._customRegex(field,rules,i,options);break;case"ajax":if(!skipAjaxValidation){methods._ajax(field,rules,i,options);isAjaxValidator=true;}
break;case"minSize":errorMsg=methods._minSize(field,rules,i,options);break;case"maxSize":errorMsg=methods._maxSize(field,rules,i,options);break;case"min":errorMsg=methods._min(field,rules,i,options);break;case"max":errorMsg=methods._max(field,rules,i,options);break;case"past":errorMsg=methods._past(field,rules,i,options);break;case"future":errorMsg=methods._future(field,rules,i,options);break;case"maxCheckbox":errorMsg=methods._maxCheckbox(field,rules,i,options);field=$($("input[name='"+fieldName+"']"));break;case"minCheckbox":errorMsg=methods._minCheckbox(field,rules,i,options);field=$($("input[name='"+fieldName+"']"));break;case"equals":errorMsg=methods._equals(field,rules,i,options);break;case"funcCall":errorMsg=methods._funcCall(field,rules,i,options);break;default:}
if(errorMsg!==undefined){promptText+=errorMsg+"<br/>";options.isError=true;}}
if(!required){if(field.val()=="")options.isError=false;}
var fieldType=field.attr("type");if((fieldType=="radio"||fieldType=="checkbox")&&$("input[name='"+fieldName+"']").size()>1){field=$($("input[name='"+fieldName+"'][type!=hidden]:first"));options.showArrow=false;}
if(options.isError){methods._showPrompt(field,promptText,"",false,options);}else{if(!isAjaxValidator)methods._closePrompt(field);}
field.trigger("jqv.field.result",[field,options.isError,promptText]);return options.isError;},_required:function(field,rules,i,options){switch(field.attr("type")){case"text":case"password":case"textarea":case"file":default:if(!field.val())
return options.allrules[rules[i]].alertText;break;case"radio":case"checkbox":var name=field.attr("name");if($("input[name='"+name+"']:checked").size()==0){if($("input[name='"+name+"']").size()==1)
return options.allrules[rules[i]].alertTextCheckboxe;else
return options.allrules[rules[i]].alertTextCheckboxMultiple;}
break;case"select-one":if(!field.val())
return options.allrules[rules[i]].alertText;break;case"select-multiple":if(!field.find("option:selected").val())
return options.allrules[rules[i]].alertText;break;}},_customRegex:function(field,rules,i,options){var customRule=rules[i+1];var rule=options.allrules[customRule];if(!rule){alert("jqv:custom rule not found "+customRule);return;}
var ex=rule.regex;if(!ex){alert("jqv:custom regex not found "+customRule);return;}
var pattern=new RegExp(ex);if(!pattern.test(field.val()))
return options.allrules[customRule].alertText;},_funcCall:function(field,rules,i,options){var functionName=rules[i+1];var fn=window[functionName];if(typeof(fn)=='function')
return fn(field,rules,i,options);},_equals:function(field,rules,i,options){var equalsField=rules[i+1];if(field.val()!=$("#"+equalsField).val())
return options.allrules.equals.alertText;},_maxSize:function(field,rules,i,options){var max=rules[i+1];var len=field.val().length;if(len>max){var rule=options.allrules.maxSize;return rule.alertText+max+rule.alertText2;}},_minSize:function(field,rules,i,options){var min=rules[i+1];var len=field.val().length;if(len<min){var rule=options.allrules.minSize;return rule.alertText+min+rule.alertText2;}},_min:function(field,rules,i,options){var min=parseFloat(rules[i+1]);var len=parseFloat(field.val());if(len<min){var rule=options.allrules.min;if(rule.alertText2)return rule.alertText+min+rule.alertText2;return rule.alertText+min;}},_max:function(field,rules,i,options){var max=parseFloat(rules[i+1]);var len=parseFloat(field.val());if(len>max){var rule=options.allrules.max;if(rule.alertText2)return rule.alertText+max+rule.alertText2;return rule.alertText+max;}},_past:function(field,rules,i,options){var p=rules[i+1];var pdate=(p.toLowerCase()=="now")?new Date():methods._parseDate(p);var vdate=methods._parseDate(field.val());if(vdate<pdate){var rule=options.allrules.past;if(rule.alertText2)return rule.alertText+methods._dateToString(pdate)+rule.alertText2;return rule.alertText+methods._dateToString(pdate);}},_future:function(field,rules,i,options){var p=rules[i+1];var pdate=(p.toLowerCase()=="now")?new Date():methods._parseDate(p);var vdate=methods._parseDate(field.val());if(vdate>pdate){var rule=options.allrules.future;if(rule.alertText2)return rule.alertText+methods._dateToString(pdate)+rule.alertText2;return rule.alertText+methods._dateToString(pdate);}},_maxCheckbox:function(field,rules,i,options){var nbCheck=rules[i+1];var groupname=field.attr("name");var groupSize=$("input[name='"+groupname+"']:checked").size();if(groupSize>nbCheck){options.showArrow=false;if(options.allrules.maxCheckbox.alertText2)return options.allrules.maxCheckbox.alertText+" "+nbCheck+" "+options.allrules.maxCheckbox.alertText2;return options.allrules.maxCheckbox.alertText;}},_minCheckbox:function(field,rules,i,options){var nbCheck=rules[i+1];var groupname=field.attr("name");var groupSize=$("input[name='"+groupname+"']:checked").size();if(groupSize<nbCheck){options.showArrow=false;return options.allrules.minCheckbox.alertText+" "+nbCheck+" "+
options.allrules.minCheckbox.alertText2;}},_ajax:function(field,rules,i,options){var errorSelector=rules[i+1];var rule=options.allrules[errorSelector];var extraData=rule.extraData;var extraDataDynamic=rule.extraDataDynamic;if(!extraData)
extraData="";if(extraDataDynamic){var tmpData=[];var domIds=String(extraDataDynamic).split(",");for(var i=0;i<domIds.length;i++){var id=domIds[i];if($(id).length){var inputValue=field.closest("form").find(id).val();var keyValue=id.replace('#','')+'='+escape(inputValue);tmpData.push(keyValue);}}
extraDataDynamic=tmpData.join("&");}else{extraDataDynamic="";}
if(!options.isError){$.ajax({type:"GET",url:rule.url,cache:false,dataType:"json",data:"fieldId="+field.attr("id")+"&fieldValue="+field.val()+"&extraData="+extraData+"&"+extraDataDynamic,field:field,rule:rule,methods:methods,options:options,beforeSend:function(){var loadingText=rule.alertTextLoad;if(loadingText)
methods._showPrompt(field,loadingText,"load",true,options);},error:function(data,transport){methods._ajaxError(data,transport);},success:function(json){var errorFieldId=json[0];var errorField=$($("#"+errorFieldId)[0]);if(errorField.length==1){var status=json[1];var msg=json[2];if(!status){options.ajaxValidCache[errorFieldId]=false;options.isError=true;if(msg){if(options.allrules[msg]){var txt=options.allrules[msg].alertText;if(txt)
msg=txt;}}
else
msg=rule.alertText;methods._showPrompt(errorField,msg,"",true,options);}else{if(options.ajaxValidCache[errorFieldId]!==undefined)
options.ajaxValidCache[errorFieldId]=true;if(msg){if(options.allrules[msg]){var txt=options.allrules[msg].alertTextOk;if(txt)
msg=txt;}}
else
msg=rule.alertTextOk;if(msg)
methods._showPrompt(errorField,msg,"pass",true,options);else
methods._closePrompt(errorField);}}}});}},_ajaxError:function(data,transport){if(data.status==0&&transport==null)
alert("The page is not served from a server! ajax call failed");else if(typeof console!="undefined")
console.log("Ajax error: "+data.status+" "+transport);},_dateToString:function(date){return date.getDate()+"-"+(date.getMonth()+1)+"-"+date.getFullYear();},_parseDate:function(d){var dateParts=d.split("-");if(dateParts==d)
dateParts=d.split("/");return new Date(dateParts[0],(dateParts[1]-1),dateParts[2]);},_showPrompt:function(field,promptText,type,ajaxed,options,ajaxform){var prompt=methods._getPrompt(field);if(ajaxform)prompt=false;if(prompt)
methods._updatePrompt(field,prompt,promptText,type,ajaxed,options);else
methods._buildPrompt(field,promptText,type,ajaxed,options);},_buildPrompt:function(field,promptText,type,ajaxed,options){var prompt=$('<div>');prompt.addClass(methods._getClassName(field.attr("id"))+"formError");if(field.is(":input"))prompt.addClass("parentForm"+methods._getClassName(field.parents('form').attr("id")));prompt.addClass("formError");switch(type){case"pass":prompt.addClass("greenPopup");break;case"load":prompt.addClass("blackPopup");}
if(ajaxed)
prompt.addClass("ajaxed");var promptContent=$('<div>').addClass("formErrorContent").html(promptText).appendTo(prompt);if(options.showArrow){var arrow=$('<div>').addClass("formErrorArrow");switch(options.promptPosition){case"bottomLeft":case"bottomRight":prompt.find(".formErrorContent").before(arrow);arrow.addClass("formErrorArrowBottom").html('<div class="line1"><!-- --></div><div class="line2"><!-- --></div><div class="line3"><!-- --></div><div class="line4"><!-- --></div><div class="line5"><!-- --></div><div class="line6"><!-- --></div><div class="line7"><!-- --></div><div class="line8"><!-- --></div><div class="line9"><!-- --></div><div class="line10"><!-- --></div>');break;case"topLeft":case"topRight":arrow.html('<div class="line10"><!-- --></div><div class="line9"><!-- --></div><div class="line8"><!-- --></div><div class="line7"><!-- --></div><div class="line6"><!-- --></div><div class="line5"><!-- --></div><div class="line4"><!-- --></div><div class="line3"><!-- --></div><div class="line2"><!-- --></div><div class="line1"><!-- --></div>');prompt.append(arrow);break;}}
if(options.isOverflown)
field.before(prompt);else
$("body").append(prompt);var pos=methods._calculatePosition(field,prompt,options);prompt.css({"top":pos.callerTopPosition,"left":pos.callerleftPosition,"marginTop":pos.marginTopSize,"opacity":0});return prompt.animate({"opacity":0.87});},_updatePrompt:function(field,prompt,promptText,type,ajaxed,options){if(prompt){if(type=="pass")
prompt.addClass("greenPopup");else
prompt.removeClass("greenPopup");if(type=="load")
prompt.addClass("blackPopup");else
prompt.removeClass("blackPopup");if(ajaxed)
prompt.addClass("ajaxed");else
prompt.removeClass("ajaxed");prompt.find(".formErrorContent").html(promptText);var pos=methods._calculatePosition(field,prompt,options);prompt.animate({"top":pos.callerTopPosition,"marginTop":pos.marginTopSize});}},_closePrompt:function(field){var prompt=methods._getPrompt(field);if(prompt)
prompt.fadeTo("fast",0,function(){prompt.remove();});},closePrompt:function(field){return methods._closePrompt(field);},_getPrompt:function(field){var className="."+methods._getClassName(field.attr("id"))+"formError";var match=$(className)[0];if(match)
return $(match);},_calculatePosition:function(field,promptElmt,options){var promptTopPosition,promptleftPosition,marginTopSize;var fieldWidth=field.width();var promptHeight=promptElmt.height();var overflow=options.isOverflown;if(overflow){promptTopPosition=promptleftPosition=0;marginTopSize=-promptHeight;}else{var offset=field.offset();promptTopPosition=offset.top;promptleftPosition=offset.left;marginTopSize=0;}
switch(options.promptPosition){default:case"topRight":if(overflow)
promptleftPosition+=fieldWidth-30;else{promptleftPosition+=fieldWidth-30;promptTopPosition+=-promptHeight;}
break;case"topLeft":promptTopPosition+=-promptHeight-10;break;case"centerRight":promptleftPosition+=fieldWidth+13;break;case"bottomLeft":promptTopPosition=promptTopPosition+field.height()+15;break;case"bottomRight":promptleftPosition+=fieldWidth-30;promptTopPosition+=field.height()+5;}
return{"callerTopPosition":promptTopPosition+"px","callerleftPosition":promptleftPosition+"px","marginTopSize":marginTopSize+"px"};},_saveOptions:function(form,options){if($.validationEngineLanguage)
var allRules=$.validationEngineLanguage.allRules;else
$.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page");var userOptions=$.extend({validationEventTrigger:"blur",scroll:true,promptPosition:"topRight",bindMethod:"bind",inlineAjax:false,ajaxFormValidation:false,ajaxFormValidationURL:false,onAjaxFormComplete:$.noop,onBeforeAjaxFormValidation:$.noop,onValidationComplete:false,isOverflown:false,overflownDIV:"",allrules:allRules,binded:false,showArrow:true,isError:false,ajaxValidCache:{}},options);form.data('jqv',userOptions);return userOptions;},_getClassName:function(className){return className.replace(":","_").replace(".","_");}};$.fn.validationEngine=function(method){var form=$(this);if(!form[0])return false;if(typeof(method)=='string'&&method.charAt(0)!='_'&&methods[method]){if(method!="showPrompt"&&method!="hidePrompt"&&method!="hide"&&method!="hideAll")
methods.init.apply(form);return methods[method].apply(form,Array.prototype.slice.call(arguments,1));}else if(typeof method=='object'||!method){methods.init.apply(form,arguments);return methods.attach.apply(form);}else{$.error('Method '+method+' does not exist in jQuery.validationEngine');}};})(jQuery);(function($){$.fn.validationEngineLanguage=function(){};$.validationEngineLanguage={newLang:function(){$.validationEngineLanguage.allRules={"required":{"regex":"none","alertText":"* Pole wymagane","alertTextCheckboxMultiple":"* Proszę wybrać opcję","alertTextCheckboxe":"* Pole wymagane"},"minSize":{"regex":"none","alertText":"* Minimalna liczba znaków to ","alertText2":""},"maxSize":{"regex":"none","alertText":"* Maksymalna liczba znaków to ","alertText2":""},"min":{"regex":"none","alertText":"* Najmniejsza wartoć to "},"max":{"regex":"none","alertText":"* Największa wartoć to "},"past":{"regex":"none","alertText":"* Data musi być wczeniejsza niż "},"future":{"regex":"none","alertText":"* Data musi być póniejsza niż "},"maxCheckbox":{"regex":"none","alertText":"* Przekroczona maksymalna liczba opcji"},"minCheckbox":{"regex":"none","alertText":"* Minimalna liczba opcji to ","alertText2":""},"equals":{"regex":"none","alertText":"* Pola nie sš jednakowe"},"phone":{"regex":/^([\+][0-9]{1,4})([ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"alertText":"* Nieprawidłowy numer telefonu"},"email":{"regex":/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"alertText":"* Nieprawidłowy adres e-mail"},"integer":{"regex":/^[\-\+]?\d+$/,"alertText":"* Nieprawidłowa liczba całkowita"},"number":{"regex":/^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/,"alertText":"* Nieprawidłowa liczba dziesiętna"},"CZdate":{"regex":/^(0[1-9]|[12][0-9]|3[01])[. /.](0[1-9]|1[012])[./.](19|20)\d{2}$/,"alertText":"* Data musi być w postaci DD.MM.RRRR"},"date":{"regex":/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/,"alertText":"* Data musi być w postaci RRRR-MM-DD"},"ipv4":{"regex":/^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,"alertText":"* Nieprawidłowy adres IP"},"url":{"regex":/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,"alertText":"* Nieprawidłowy adres internetowy"},"onlyNumberSp":{"regex":/^[0-9\ ]+$/,"alertText":"* Tylko liczby"},"onlyLetterSp":{"regex":/^[a-zA-Z\ \']+$/,"alertText":"* Tylko litery"},"onlyLetterNumber":{"regex":/^[0-9a-zA-Z]+$/,"alertText":"* Tylko litery i liczby"},"ajaxUserCall":{"url":"ajaxValidateFieldUser","extraData":"name=eric","alertText":"* Nazwa użytkownika jest już zajęta","alertTextLoad":"* Walidacja, proszę czekać"},"ajaxNameCall":{"url":"ajaxValidateFieldName","alertText":"* Nazwa jest już zajęta","alertTextOk":"* Nazwa jest dostępna","alertTextLoad":"* Walidacja, proszę czekać"},"validate2fields":{"alertText":"* Proszę wpisać HELLO"}};}};$.validationEngineLanguage.newLang();})(jQuery);function zegar(){var data=new Date();var godzina=data.getHours();var min=data.getMinutes();var sek=data.getSeconds();var terazjest=""+godzina+((min<10)?":0":":")+min+((sek<10)?":0":":")+sek;if($("#zegarek")){$("#zegarek").html(terazjest);}}
var today=new Date();var rangeL=String(today.getFullYear())+String(today.getMonth()+1<10?"0"+(today.getMonth()+1):today.getMonth()+1)+String(today.getDate()<10?"0"+today.getDate():today.getDate());var rangeH=String(today.getFullYear()+1)+String(today.getMonth()+1<10?"0"+(today.getMonth()+1):today.getMonth()+1)+String(today.getDate()<10?"0"+today.getDate():today.getDate());datePickerController.addEvent(window,'load',setReservationDates);function setReservationDates(){var sd=datePickerController.getSelectedDate("lSearchDate1");var ed=datePickerController.getSelectedDate("lSearchDate2");var sd2=datePickerController.getSelectedDate("lSearchDate3");var ed2=datePickerController.getSelectedDate("lSearchDate4");if(sd){sd=new Date(sd.getFullYear(),sd.getMonth(),sd.getDate()+1);var rangeL2=String(sd.getFullYear())+String(sd.getMonth()+1<10?"0"+(sd.getMonth()+1):sd.getMonth()+1)+String(sd.getDate()<10?"0"+sd.getDate():sd.getDate());datePickerController.setRangeLow("lSearchDate2",rangeL2);if(ed<=sd){document.getElementById('lSearchDate2').value='';}}
if(sd2){sd2=new Date(sd2.getFullYear(),sd2.getMonth(),sd2.getDate()+1);var rangeL4=String(sd2.getFullYear())+String(sd2.getMonth()+1<10?"0"+(sd2.getMonth()+1):sd2.getMonth()+1)+String(sd2.getDate()<10?"0"+sd2.getDate():sd2.getDate());datePickerController.setRangeLow("lSearchDate4",rangeL4);if(ed2<=sd2){document.getElementById('lSearchDate4').value='';}}}
function searchdateOpts(int)
{if(int==1)
{var opts={formElements:{"lSearchDate1":"d-ds-m-ds-Y"},rangeLow:rangeL,rangeHigh:rangeH,noFadeEffect:true,callbackFunctions:{"dateset":[setReservationDates]}};datePickerController.createDatePicker(opts);}
if(int==2)
{var opts={formElements:{"lSearchDate2":"d-ds-m-ds-Y"},rangeLow:rangeL,rangeHigh:rangeH,noFadeEffect:true};datePickerController.createDatePicker(opts);}
if(int==3)
{var opts={formElements:{"lSearchDate3":"d-ds-m-ds-Y"},rangeLow:rangeL,rangeHigh:rangeH,noFadeEffect:true};datePickerController.createDatePicker(opts);}
if(int==4)
{var opts={formElements:{"lSearchDate4":"d-ds-m-ds-Y"},rangeLow:rangeL,rangeHigh:rangeH,noFadeEffect:true};datePickerController.createDatePicker(opts);}}
var property_width=new Array();var details_width=new Array();var itemWidthArray=new Array();var miliseconds=1000;itemWidthArray[0]=253;itemWidthArray[1]=150;var itemsToSlide=3;var pause=false;$(window).load(function(){$("#properties101").width(property_width[101]);$("#properties1").width(property_width[1]);$("#properties2").width(property_width[2]);$("#properties3").width(property_width[3]);$("#properties200").width(property_width[200]);});function sliderButton(itemId,direction){if(!pause){slide(itemId,direction);}};function slide(itemId,direction)
{pause=true;setTimeout("unPause()",miliseconds);if(direction=="right")
{if($("#properties"+itemId).width()+(parseInt($("#properties"+itemId).css("left"),10)-(itemsToSlide*itemWidth))-margin>=0)
{$("#properties"+itemId).animate({left:"-="+itemWidth},miliseconds);}}
else if(direction=="left")
{if(parseInt($("#properties"+itemId).css("left"),10)<-5)
{$("#properties"+itemId).animate({left:"+="+itemWidth},miliseconds);}}}
function unPause(){pause=false;}
var pictures=new Array();function setMainPic(picIndex)
{$(".toggleVisibility").each(function(i)
{document.getElementById("mainPicture"+i).style.display="none";});document.getElementById("mainPicture"+picIndex).style.display="block";}
$(function(){$('a.lightbox ').lightBox();});function calculateDiff(dat1,dat2)
{var aRes=new Array();var diffs=3;var xD=new Date();var cDt=new Date(xD.getFullYear(),xD.getMonth(),xD.getDate());if(dat1&&dat2)
{arrDt1=dat1.split("-");arrDt2=dat2.split("-");dt1=new Date(~~(arrDt1[2]),~~(arrDt1[1])-1,~~(arrDt1[0]));dt2=new Date(~~(arrDt2[2]),~~(arrDt2[1])-1,~~(arrDt2[0]));diffs=(dt2-dt1)/86400000;aRes[0]=diffs;aRes[1]=(dt1-cDt)/86400000;d1=parseInt("1"+arrDt1[1]+arrDt1[0]);d2=parseInt("1"+arrDt2[1]+arrDt2[0]);if(d2<d1){d2=10000+d2;}
if((d1>=11230&&d1<=20104)||(d2>=11230&&d2<=20104)||(d1<11230&&d2>20104)){aRes[2]=1;}}
return aRes;}
function checkAvail(form,firstCheck)
{var endofAjax=0;var spd=0;var special_discount_msg="Special Discount: ";var longterm_discount_msg="Long Term Discount: ";var pricing_ajax_info=new Array();var people=$('#people').val();var prpIDval=$('#prpId').val();var noCheck=$('#noCheckFields').val();var SearchDate1=$('#lSearchDate1').val();var SearchDate2=$('#lSearchDate2').val();var dataString='prpId='+prpIDval+'&people='+people+'&lSearchDate1='+SearchDate1+'&lSearchDate2='+SearchDate2+'&noCheckFields='+noCheck;$('#qbookform input').attr("disabled","disabled");$('#infoAboutCheck').html("<img src='img/ajax-loading.gif'></img>");$.ajax({url:'checkPrp.php',type:"GET",timeout:5000,data:dataString,success:function(data)
{$('#qbookform input').removeAttr('disabled');eval('var ret = '+data);if(ret.final==1)
{$('#infoAboutCheck').html(ret.msg);textFlash('#infoAboutCheck');$('#bookButton').css('display','block');$('#bookButton').html("<a class='small_btn' href='book.html?prpId="+prpIDval+"'>zarezerwuj</a>");$('#priceCheck_forAvail > .detailed_price_1').html("<span class='crossed'>"+ret.pricing_info.PLN.average_rate+"</span>=><span>"+ret.pricing_info.PLN.price_pro_day_after_second_discount+"</span> PLN");$('#priceCheck_forAvail > .detailed_price_2').html(""+ret.pricing_info.EUR.price_pro_day_after_second_discount+" &euro;/&pound; "+ret.pricing_info.GBP.price_pro_day_after_second_discount+"");$('#priceCheck_forAvail').css('display','block');$('#priceCheck_forNonAvail').css('display','none');$('#p_calc').css('display','block');textFlash('.detailed_price_1');textFlash('.detailed_price_2');$('#discountMsg_lt').html('');$('#discountMsg_lt').css('display','block');$('#discountMsg_sp').html('');$('#discountMsg_sp').css('display','block');if(ret.pricing_info.special_discount_perc>0&&ret.pricing_info.special_discount_perc!='undefined')
{$('#discountMsg_sp').html(ret.pricing_info.special_discount_name_pl+": -"+ret.pricing_info.special_discount_perc+"%");spd=1;textFlash('#discountMsg_sp');}
else
{$('#discountMsg_sp').html('');$('#discountMsg_sp').css('display','none');}
if(ret.pricing_info.long_term_discount_perc>0&&ret.pricing_info.long_term_discount_perc!='undefined')
{if(spd==1){$('#discountMsg_lt').html(" Rabat za długi pobyt: -"+ret.pricing_info.long_term_discount_perc+"%");textFlash('#discountMsg_lt');}
if(spd==0){$('#discountMsg_sp').html('');$('#discountMsg_lt').html(" Rabat za długi pobyt: -"+ret.pricing_info.long_term_discount_perc+"%");textFlash('#discountMsg_lt');}}
else
{$('#discountMsg_lt').html('');$('#discountMsg_lt').css('display','none');}}
else
{rExp=/w podanym terminie/g;results=ret.msg.search(rExp);if(results!=-1){openPricingInfo('detailsNoApt');}
rExp=/dzisiejsza noc/g;results=ret.msg.search(rExp);if(results!=-1){openPricingInfo('detailsOverTime');$('#bookButton').css('display','none');}
$('#infoAboutCheck').html(ret.msg);textFlash('#infoAboutCheck');$('#discountMsg_sp').html('Zniżki dostępne.');textFlash('#discountMsg_sp');$('#discountMsg_lt').html('');$('#discountMsg_lt').css('display','none');$('#bookButton').html("<a class='small_btn' href='reservation_centre.html?dzial=rc&prpId="+prpIDval+"'>zarezerwuj</a>");$('#priceCheck_forAvail').css('display','none');$('#priceCheck_forNonAvail').css('display','block');$('#p_calc').css('display','none');}
endofAjax=1;},complete:function()
{$('#qbookform input').removeAttr('disabled');endofAjax=1;},error:function()
{$('#infoAboutCheck').html('<a href="http://www.krakow-apartamenty.biz/reservation_centre.html?dzial=rc">Skontaktuj się z nami </a>by uzyskać ceny dla tych dni');endofAjax=1;}});return false;}
function validateCaptcha()
{challengeField=$("input#recaptcha_challenge_field").val();responseField=$("input#recaptcha_response_field").val();var html=$.ajax({type:"GET",url:"ajax.recaptcha.php",data:"recaptcha_challenge_field="+challengeField+"&recaptcha_response_field="+responseField,async:false}).responseText;rExp=/success/g;results=html.search(rExp);if(results!=-1){return true;}else{Recaptcha.reload();return false;}}
function sendPageForm(form,type){if(type=='contact'){var url='mail.php';}
else if(type=='enquiry'){var url='mail_group_booking.php';}
else if(type=='testimonial'){var url='testimonials_add.php';}
var dataString=$('#'+form).serialize();$.ajax({url:url,type:"POST",data:dataString,success:function(data)
{rExp=/#send/g;results=data.search(rExp);if(results!=-1)
{if(type=='testimonial')
{$('#'+type+'PageMsg').html('<span class="form_msg_ok">Dziękujemy za przesłanie opinii.</span>');}
else
{$('#'+type+'PageMsg').html('<span class="form_msg_ok">Dziękujemy za zapytanie. Odpowiemy na nie w przeciągu jednego dnia roboczego</span>');}
resetForm(form);}
else
{$('#'+type+'PageMsg').html('<span class="form_msg_error">Błąd wysyłania zapytania. Prosimy spróbować ponownie.</span>');}}});}
function sendFeedback(form){var dataString=$('#'+form).serialize();var url='check_feedback_form.php';$.ajax({url:url,type:"POST",data:dataString,success:function(data)
{$('#feedbackMsg').html('<span class="form_msg_ok">Opinia przesłana pomyślnie</span>');resetForm(form);}});}
function resetForm(id){$('#'+id).each(function(){this.reset();});}
function showHideInv(){if($('#inv').attr("checked")=="checked"){$('#invoice').slideDown('slow',function(){$('#book_field_16').attr("class","required ,validate[required] text-input");$('#book_field_17').attr("class","required ,validate[required] text-input");$('#book_field_18').attr("class","required ,validate[required] text-input");$('#book_field_20').attr("class","required ,validate[required] text-input");$('#book_field_21').attr("class","required ,validate[required] text-input");$('#book_field_22').attr("class","required ,validate[required] text-input");});}else{$('#invoice').slideUp('slow',function(){$('#book_field_16').attr("class","required");$('#book_field_16').validationEngine('hide');$('#book_field_17').attr("class","required");$('#book_field_17').validationEngine('hide');$('#book_field_18').attr("class","required");$('#book_field_18').validationEngine('hide');$('#book_field_20').attr("class","required");$('#book_field_20').validationEngine('hide');$('#book_field_21').attr("class","required");$('#book_field_21').validationEngine('hide');$('#book_field_22').attr("class","required");$('#book_field_22').validationEngine('hide');});}}
function togglePricingDetails(type)
{if(type=='main')
{$('#pricing_table').slideToggle('slow');}
else if(type=='details')
{$('#detailed_calculation').slideToggle('slow');}
else if(type=='extras')
{$('.extras').slideToggle('slow');if($('.extras').attr('name')=='collapsed')
{$('.extras_icon').attr("src","/img/Collapse_Vertical.png");$('.extras').attr('name','expanded');}
else
{$('.extras_icon').attr("src","/img/Expand_Vertical.png");$('.extras').attr('name','collapsed');}}}
function dismissRadioError()
{$('#male').validationEngine('hide');$('#female').validationEngine('hide');$('#contact_page_method').validationEngine('hide');$('#contact_page_method2').validationEngine('hide');}
function getCtrCode(form){$('#cgb_country').attr("disabled","disabled");var index=document.getElementById('cgb_country').selectedIndex;var str=document.getElementById('cgb_country').options[index].text;var success;var html=$.ajax({url:'getCtrCode.php',type:"GET",data:'WWB_COUNTRY='+str,async:false,success:function(data)
{success=true;},complete:function()
{$('#cgb_country').removeAttr('disabled');},error:function()
{$('#cgb_country').removeAttr('disabled');}}).responseText;if(success==true)
{var ret=$.parseJSON(html);$('#field_phone_mobile').val('+'+ret.CTR_DIAL_CODE+'-');$('#field_phone_second').val('+'+ret.CTR_DIAL_CODE+'-');}}
function refreshGuests(){field=document.getElementById('enquiryForm');if(field.cgb_apartment.value=='Grand Central Apartment'){field.cgb_people.options[11]=new Option("11",11);field.cgb_people.options[12]=new Option("12",12);field.cgb_people.options[13]=new Option("13",13);field.cgb_people.options[14]=new Option("14",14);field.cgb_people.options[15]=new Option("15",15);field.cgb_people.options[16]=new Option("16",16);field.cgb_people.options[17]=new Option("17",17);field.cgb_couples.options[7]=new Option("6",6);field.cgb_couples.options[8]=new Option("7",7);field.cgb_couples.options[9]=new Option("8",8);return;}else{field.cgb_people.options.length=11;field.cgb_couples.options.length=7;return;}}
function refreshCouples(){field=document.getElementById('enquiryForm');if(field.cgb_people.value!='')
{var couples=Math.floor(field.cgb_people.value/2);field.cgb_couples.options.length=couples+1;for(i=0;i<=couples;i++)
{var j=i+1;field.cgb_couples.options[j]=new Option(i,i);}
return;}
else
{field.cgb_couples.options.length=6;for(i=0;i<6;i++)
{var j=i+1;field.cgb_couples.options[j]=new Option(i,i);}
refreshGuests();return;}}
function saveBeforePayment(form,checkOnly){var dataString=$('#bookpay').serialize();if(checkOnly)dataString=dataString+'&checkOnly=true';$.ajax({url:'saveBooking.php',type:"POST",data:dataString,success:function(data)
{eval('var ret = '+data);if(ret!='allocated')
{if(checkOnly)
{window.location.href="book_confirm.html?opt=1";}
else
{if(ret>0)
{field=document.getElementById('bookpay');field.control.value=ret;$('#bookpay').submit();}
else
{$('#saveBtn').val('Błąd wysyłania zapytania. Prosimy spróbować ponownie.');}}}
else
{document.getElementById('calculator_canvas').style.display='block';document.getElementById('no_available_apartment_popup').style.display='block';window.location.href='#';$('#saveBtn').val('Apartament obecnie zajęty');}}});}
function openPricingInfo(rePrice){if(rePrice==undefined)
{$('#calculator_black_bg').css('width','733px');$('#calculator_black_bg').css('height','');var dataString='ajax_request=AJAX'
+'&lSearchDate1='+$('#lSearchDate1').val()
+'&lSearchDate2='+$('#lSearchDate2').val()
+'&prpId='+$('#prpId').val()
+'&people='+$('#people').val();var html=$.ajax({url:'recalculatePrice.php',type:"POST",async:false,data:dataString,success:function(data)
{}}).responseText;$('#container').html(html);document.getElementById('calculator_canvas').style.display='block';document.getElementById('calculator').style.display='block';}
else if(rePrice=='detailsNoApt')
{document.getElementById('calculator_canvas').style.display='block';document.getElementById('no_available_apartment_popup').style.display='block';}
else if(rePrice=='detailsOverTime')
{document.getElementById('calculator_canvas').style.display='block';document.getElementById('over_time_popup').style.display='block';}}
function closePricingInfo(){document.getElementById('calculator_canvas').style.display='none';document.getElementById('calculator').style.display='none';document.getElementById('no_available_apartment_popup').style.display='none';document.getElementById('over_time_popup').style.display='none';textFlash('#infoAboutCheck');}
function openMapPopup(x,y){document.getElementById('calculator_canvas').style.display='block';document.getElementById('calculator').style.display='block';$('#calculator_black_bg').css('width','700px');$('#calculator_black_bg').css('height','500px');$('#container').html('<div id="mapCont" style="left:0px; top:0px; display:none;"><div id="map" style="width: 670px; height: 470px;"></div></div>');openPricingInfo('noReprice');loadMapCont(x,y);}
function openMap(x,y){$('#book_map').html('<div id="mapCont" style="left:0px; top:0px; display:block;"><div id="map" style="width: 100%; height: 320px;"></div></div>');loadMapCont(x,y);}
function loadMapCont(x,y){var scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop+50;}
var leftMargin=($("body").width()/2)-283;$('#mapCont').css('left',leftMargin+'px');$('#mapCont').css('top',scrOfY+'px');$('#mapCont').css('display','block');loadMap(x,y);}
function loadMap(x,y){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl3D());map.addControl(new GMapTypeControl());if(x==0||y==0){map.setCenter(new GLatLng(50.0638,19.9366),16);}else{map.setCenter(new GLatLng(x,y),16);var icon=new GIcon();icon.image="/img/map/pointb.png"
icon.shadow="/img/map/pointshadow.png";icon.iconSize=new GSize(18,18);icon.shadowSize=new GSize(34,18);icon.iconAnchor=new GPoint(18,18);icon.infoWindowAnchor=new GPoint(9,2);icon.infoShadowAnchor=new GPoint(18,25);var point=new GLatLng(parseFloat(x),parseFloat(y));map.addOverlay(new GMarker(point,icon));}}}
function textFlash(divID)
{$(divID).fadeOut("fast");$(divID).fadeIn("fast");$(divID).fadeOut("fast");$(divID).fadeIn("fast");$(divID).fadeOut("fast");$(divID).fadeIn("fast");}
function locationMap(showParking,language)
{var html=$.ajax({url:'getAllPrp.php',type:"POST",async:true,success:function(data)
{var ret=$.parseJSON(data);var map=new GMap2(document.getElementById("lmap"));map.addControl(new GLargeMapControl3D());map.addControl(new GMapTypeControl());map.setCenter(new GLatLng(50.0638,19.9366),15);var bh_added=null;var vh_added=null;var a_added=null;var s_added=null;var r_added=null;$(ret).each(function(s)
{var icon=null;var image1=null;var image2=null;var marker=null;icon=new GIcon();icon2=new GIcon();point=new GLatLng(ret[s]['PRP_GOOGLE_X'],ret[s]['PRP_GOOGLE_Y']);if(/Barbican/i.test(ret[s]['PRP_TITLE'])&&bh_added==null)
{var locHref="/Barbican_House.html";var image1="/img/locsearch_barbican_house.png";var image2="/img/locsearch_barbican_house_over.png";var iconed_location=true;bh_added=true;}
else if(/Venetian/i.test(ret[s]['PRP_TITLE'])&&vh_added==null)
{var locHref="/Venetian_House.html";var image1="/img/locsearch_venetian_house.png";var image2="/img/locsearch_venetian_house_over.png";var iconed_location=true;vh_added=true;}
else if(/Atlantis/i.test(ret[s]['PRP_TITLE'])&&a_added==null)
{var locHref="/Atlantis_Apartments.html";var image1="/img/locsearch_atlantis.png";var image2="/img/locsearch_atlantis_over_"+language+".png";var image3="/img/ico/ico82.gif";var iconed_location=true;a_added=true;}
else if(/Royal/i.test(ret[s]['PRP_TITLE'])&&r_added==null)
{var locHref="/Royal_Apartments.html";var image1="/img/locsearch_royal.png";var image2="/img/locsearch_royal_over_"+language+".png";var image3="/img/ico/ico82.gif";var iconed_location=true;r_added=true;}
else if(/Spring/i.test(ret[s]['PRP_TITLE'])&&s_added==null)
{var locHref="/details.html?prpId=409";var image1="/img/map/pointb.png";var image2="/img/locsearch_spring_over_"+language+".png";var iconed_location=false;var s_added=true;}
if(iconed_location==true)
{icon.image=image1;icon.iconSize=new GSize(108,87)
icon.shadow="";icon.iconAnchor=new GPoint(1,38);icon.infoWindowAnchor=new GPoint(80,0);icon.shadowSize=new GSize(0,0);icon.infoShadowAnchor=new GPoint(80,0);icon2.image=image2;icon2.iconSize=new GSize(208,94)
icon2.shadow="";icon2.iconAnchor=new GPoint(2,44);icon2.infoWindowAnchor=new GPoint(80,0);icon2.shadowSize=new GSize(0,0);icon2.infoShadowAnchor=new GPoint(80,0);}
else
{icon.image=image1;icon.iconSize=new GSize(18,18);icon.shadow="";icon.iconAnchor=new GPoint(9,16);icon.infoWindowAnchor=new GPoint(10,50);icon.shadowSize=new GSize(34,19);icon.infoShadowAnchor=new GPoint(10,50);if(/Spring/i.test(ret[s]['PRP_TITLE']))
{icon2.image=image2;icon2.iconSize=new GSize(130,54);icon2.iconAnchor=new GPoint(9,52);}
else if(/Grand/i.test(ret[s]['PRP_TITLE']))
{icon2.image=image2;icon2.iconSize=new GSize(154,58);icon2.iconAnchor=new GPoint(145,55);}
else
{icon2.image=image2;icon2.iconSize=new GSize(18,18);icon2.iconAnchor=new GPoint(9,16);}
icon2.shadow="";icon2.infoWindowAnchor=new GPoint(10,50);icon2.shadowSize=new GSize(34,19);icon2.infoShadowAnchor=new GPoint(10,50);}
var marker=new GMarker(point,icon);var marker2=new GMarker(point,icon2);map.addOverlay(marker);map.addOverlay(marker2);marker2.hide();if(image3&&showParking==true)
{icon3=new GIcon();icon3.image=image3;icon3.iconSize=new GSize(32,25);icon3.iconAnchor=new GPoint(-45,65);var marker3=new GMarker(point,icon3);map.addOverlay(marker3);}
GEvent.addListener(marker,"mouseover",function(){marker.hide();marker2.show();});GEvent.addListener(marker2,"mouseout",function(){marker2.hide();marker.show();});GEvent.addListener(marker2,"click",function(){window.location.href=locHref;});if(showParking==true)
{$('label[for="7"]').mouseenter(function(){$('#spp_popup').css('display','block');map.checkResize();map.setCenter(new GLatLng(50.0638,19.9366),15);});$('label[for="7"]').mouseleave(function(){$('#spp_popup').css('display','none')});}});}}).responseText;}
