Date.CultureInfo={name:"de-CH",englishName:"German (Switzerland)",nativeName:"Deutsch (Schweiz)",dayNames:"Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag".split(","),abbreviatedDayNames:"So,Mo,Di,Mi,Do,Fr,Sa".split(","),shortestDayNames:"So,Mo,Di,Mi,Do,Fr,Sa".split(","),firstLetterDayNames:"S,M,D,M,D,F,S".split(","),monthNames:"Januar,Februar,M\u00e4rz,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember".split(","),abbreviatedMonthNames:"Jan,Feb,Mrz,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez".split(","),
amDesignator:"",pmDesignator:"",firstDayOfWeek:1,twoDigitYearMax:2029,dateElementOrder:"dmy",formatPatterns:{shortDate:"dd.MM.yyyy",longDate:"dddd, d. MMMM yyyy",shortTime:"HH:mm",longTime:"HH:mm:ss",fullDateTime:"dddd, d. MMMM yyyy HH:mm:ss",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"dd MMMM",yearMonth:"MMMM yyyy"},regexPatterns:{jan:/^jan(uar)?/i,feb:/^feb(ruar)?/i,mar:/^m\u00e4rz/i,apr:/^apr(il)?/i,may:/^mai/i,
jun:/^jun(i)?/i,jul:/^jul(i)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^okt(ober)?/i,nov:/^nov(ember)?/i,dec:/^dez(ember)?/i,sun:/^sonntag/i,mon:/^montag/i,tue:/^dienstag/i,wed:/^mittwoch/i,thu:/^donnerstag/i,fri:/^freitag/i,sat:/^samstag/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,
hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
Date.getMonthNumberFromName=function(b){for(var a=Date.CultureInfo.monthNames,c=Date.CultureInfo.abbreviatedMonthNames,b=b.toLowerCase(),f=0;f<a.length;f++)if(a[f].toLowerCase()==b||c[f].toLowerCase()==b)return f;return-1};Date.getDayNumberFromName=function(b){for(var a=Date.CultureInfo.dayNames,c=Date.CultureInfo.abbreviatedDayNames,b=b.toLowerCase(),f=0;f<a.length;f++)if(a[f].toLowerCase()==b||c[f].toLowerCase()==b)return f;return-1};
Date.isLeapYear=function(b){return 0===b%4&&0!==b%100||0===b%400};Date.getDaysInMonth=function(b,a){return[31,Date.isLeapYear(b)?29:28,31,30,31,30,31,31,30,31,30,31][a]};Date.getTimezoneOffset=function(b,a){return a?Date.CultureInfo.abbreviatedTimeZoneDST[b.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[b.toUpperCase()]};
Date.getTimezoneAbbreviation=function(b,a){var c=a?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,f;for(f in c)if(c[f]===b)return f;return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(b){if(isNaN(this))throw Error(this);if(b instanceof Date&&!isNaN(b))return this>b?1:this<b?-1:0;throw new TypeError(b);};Date.prototype.equals=function(b){return 0===this.compareTo(b)};
Date.prototype.between=function(b,a){var c=this.getTime();return c>=b.getTime()&&c<=a.getTime()};Date.prototype.addMilliseconds=function(b){this.setMilliseconds(this.getMilliseconds()+b);return this};Date.prototype.addSeconds=function(b){return this.addMilliseconds(1E3*b)};Date.prototype.addMinutes=function(b){return this.addMilliseconds(6E4*b)};Date.prototype.addHours=function(b){return this.addMilliseconds(36E5*b)};Date.prototype.addDays=function(b){return this.addMilliseconds(864E5*b)};
Date.prototype.addWeeks=function(b){return this.addMilliseconds(6048E5*b)};Date.prototype.addMonths=function(b){var a=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+b);this.setDate(Math.min(a,this.getDaysInMonth()));return this};Date.prototype.addYears=function(b){return this.addMonths(12*b)};
Date.prototype.add=function(b){if("number"==typeof b)return this._orient=b,this;if(b.millisecond||b.milliseconds)this.addMilliseconds(b.millisecond||b.milliseconds);if(b.second||b.seconds)this.addSeconds(b.second||b.seconds);if(b.minute||b.minutes)this.addMinutes(b.minute||b.minutes);if(b.hour||b.hours)this.addHours(b.hour||b.hours);if(b.month||b.months)this.addMonths(b.month||b.months);if(b.year||b.years)this.addYears(b.year||b.years);if(b.day||b.days)this.addDays(b.day||b.days);return this};
Date._validate=function(b,a,c,f){if("number"!=typeof b)throw new TypeError(b+" is not a Number.");if(b<a||b>c)throw new RangeError(b+" is not a valid value for "+f+".");return!0};Date.validateMillisecond=function(b){return Date._validate(b,0,999,"milliseconds")};Date.validateSecond=function(b){return Date._validate(b,0,59,"seconds")};Date.validateMinute=function(b){return Date._validate(b,0,59,"minutes")};Date.validateHour=function(b){return Date._validate(b,0,23,"hours")};
Date.validateDay=function(b,a,c){return Date._validate(b,1,Date.getDaysInMonth(a,c),"days")};Date.validateMonth=function(b){return Date._validate(b,0,11,"months")};Date.validateYear=function(b){return Date._validate(b,1,9999,"seconds")};
Date.prototype.set=function(b){if(!b.millisecond&&0!==b.millisecond)b.millisecond=-1;if(!b.second&&0!==b.second)b.second=-1;if(!b.minute&&0!==b.minute)b.minute=-1;if(!b.hour&&0!==b.hour)b.hour=-1;if(!b.day&&0!==b.day)b.day=-1;if(!b.month&&0!==b.month)b.month=-1;if(!b.year&&0!==b.year)b.year=-1;-1!=b.millisecond&&Date.validateMillisecond(b.millisecond)&&this.addMilliseconds(b.millisecond-this.getMilliseconds());-1!=b.second&&Date.validateSecond(b.second)&&this.addSeconds(b.second-this.getSeconds());
-1!=b.minute&&Date.validateMinute(b.minute)&&this.addMinutes(b.minute-this.getMinutes());-1!=b.hour&&Date.validateHour(b.hour)&&this.addHours(b.hour-this.getHours());-1!==b.month&&Date.validateMonth(b.month)&&this.addMonths(b.month-this.getMonth());-1!=b.year&&Date.validateYear(b.year)&&this.addYears(b.year-this.getFullYear());-1!=b.day&&Date.validateDay(b.day,this.getFullYear(),this.getMonth())&&this.addDays(b.day-this.getDate());b.timezone&&this.setTimezone(b.timezone);b.timezoneOffset&&this.setTimezoneOffset(b.timezoneOffset);
return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var b=this.getFullYear();return 0===b%4&&0!==b%100||0===b%400};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};
Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(b,a){var c=(b-this.getDay()+7*(a||1))%7;return this.addDays(0===c?c+7*(a||1):c)};Date.prototype.moveToMonth=function(b,a){var c=(b-this.getMonth()+12*(a||1))%12;return this.addMonths(0===c?c+12*(a||1):c)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/864E5)};
Date.prototype.getWeekOfYear=function(b){var a=this.getFullYear(),c=this.getMonth(),f=this.getDate(),b=b||Date.CultureInfo.firstDayOfWeek,e=8-(new Date(a,0,1)).getDay();8==e&&(e=1);c=(Date.UTC(a,c,f,0,0,0)-Date.UTC(a,0,1,0,0,0))/864E5+1;c=Math.floor((c-e+7)/7);c===b&&(a--,a=8-(new Date(a,0,1)).getDay(),c=2==a||8==a?53:52);return c};Date.prototype.isDST=function(){console.log("isDST");return"D"==this.toString().match(/(E|C|M|P)(S|D)T/)[2]};
Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(b){var a=this.getTimezoneOffset();this.addMinutes(-6*Number(b)/10-a);return this};Date.prototype.setTimezone=function(b){return this.setTimezoneOffset(Date.getTimezoneOffset(b))};Date.prototype.getUTCOffset=function(){var b=-10*this.getTimezoneOffset()/6;if(0>b)return b=(b-1E4).toString(),b[0]+b.substr(2);b=(b+1E4).toString();return"+"+b.substr(1)};
Date.prototype.getDayName=function(b){return b?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(b){return b?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;
Date.prototype.toString=function(b){var a=this,c=function(a){return 1==a.toString().length?"0"+a:a};return b?b.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(b){switch(b){case "hh":return c(13>a.getHours()?a.getHours():a.getHours()-12);case "h":return 13>a.getHours()?a.getHours():a.getHours()-12;case "HH":return c(a.getHours());case "H":return a.getHours();case "mm":return c(a.getMinutes());case "m":return a.getMinutes();case "ss":return c(a.getSeconds());case "s":return a.getSeconds();
case "yyyy":return a.getFullYear();case "yy":return a.getFullYear().toString().substring(2,4);case "dddd":return a.getDayName();case "ddd":return a.getDayName(!0);case "dd":return c(a.getDate());case "d":return a.getDate().toString();case "MMMM":return a.getMonthName();case "MMM":return a.getMonthName(!0);case "MM":return c(a.getMonth()+1);case "M":return a.getMonth()+1;case "t":return 12>a.getHours()?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case "tt":return 12>
a.getHours()?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case "zzz":case "zz":case "z":return""}}):this._toString()};Date.now=function(){return new Date};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=1;Date.prototype.next=function(){this._orient=1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=!1;Date.prototype.is=function(){this._is=!0;return this};
Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var b={};b[this._dateElement]=this;return Date.now().add(b)};Number.prototype.ago=function(){var b={};b[this._dateElement]=-1*this;return Date.now().add(b)};
(function(){for(var b=Date.prototype,a=Number.prototype,c="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),f="january february march april may june july august september october november december".split(/\s/),e="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),h=function(a){return function(){return this._is?(this._is=!1,this.getDay()==a):this.moveToDayOfWeek(a,this._orient)}},g=0;g<c.length;g++)b[c[g]]=b[c[g].substring(0,3)]=h(g);c=function(a){return function(){return this._is?
(this._is=!1,this.getMonth()===a):this.moveToMonth(a,this._orient)}};for(h=0;h<f.length;h++)b[f[h]]=b[f[h].substring(0,3)]=c(h);c=function(a){return function(){"s"!=a.substring(a.length-1)&&(a+="s");return this["add"+a](this._orient)}};h=function(a){return function(){this._dateElement=a;return this}};for(g=0;g<e.length;g++)f=e[g].toLowerCase(),b[f]=b[f+"s"]=c(e[g]),a[f]=a[f+"s"]=h(f)})();Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};
Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};
Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};
(function(){Date.Parsing={Exception:function(a){this.message="Parse error at '"+a.substring(0,10)+" ...'"}};for(var b=Date.Parsing,a=b.Operators={rtoken:function(a){return function(c){var f=c.match(a);if(f)return[f[0],c.substring(f[0].length)];throw new b.Exception(c);}},token:function(){return function(c){return a.rtoken(RegExp("^s*"+c+"s*"))(c)}},stoken:function(c){return a.rtoken(RegExp("^"+c))},until:function(a){return function(c){for(var b=[],f=null;c.length;){try{f=a.call(this,c)}catch(e){b.push(f[0]);
c=f[1];continue}break}return[b,c]}},many:function(a){return function(c){for(var b=[],f=null;c.length;){try{f=a.call(this,c)}catch(e){break}b.push(f[0]);c=f[1]}return[b,c]}},optional:function(a){return function(c){var b=null;try{b=a.call(this,c)}catch(f){return[null,c]}return[b[0],b[1]]}},not:function(a){return function(c){try{a.call(this,c)}catch(f){return[null,c]}throw new b.Exception(c);}},ignore:function(a){return a?function(c){var b=null,b=a.call(this,c);return[null,b[1]]}:null},product:function(){for(var c=
arguments[0],b=Array.prototype.slice.call(arguments,1),f=[],e=0;e<c.length;e++)f.push(a.each(c[e],b));return f},cache:function(a){var c={},f=null;return function(e){try{f=c[e]=c[e]||a.call(this,e)}catch(k){f=c[e]=k}if(f instanceof b.Exception)throw f;return f}},any:function(){var a=arguments;return function(c){for(var f=null,e=0;e<a.length;e++)if(null!=a[e]){try{f=a[e].call(this,c)}catch(k){f=null}if(f)return f}throw new b.Exception(c);}},each:function(){var a=arguments;return function(c){for(var f=
[],e=null,k=0;k<a.length;k++)if(null!=a[k]){try{e=a[k].call(this,c)}catch(l){throw new b.Exception(c);}f.push(e[0]);c=e[1]}return[f,c]}},all:function(){var a=a;return a.each(a.optional(arguments))},sequence:function(c,f,e){f=f||a.rtoken(/^\s*/);e=e||null;return 1==c.length?c[0]:function(a){for(var k=null,l=null,n=[],o=0;o<c.length;o++){try{k=c[o].call(this,a)}catch(p){break}n.push(k[0]);try{l=f.call(this,k[1])}catch(v){l=null;break}a=l[1]}if(!k)throw new b.Exception(a);if(l)throw new b.Exception(l[1]);
if(e)try{k=e.call(this,k[1])}catch(x){throw new b.Exception(k[1]);}return[n,k?k[1]:a]}},between:function(c,b,f){var f=f||c,e=a.each(a.ignore(c),b,a.ignore(f));return function(a){a=e.call(this,a);return[[a[0][0],r[0][2]],a[1]]}},list:function(c,b,f){b=b||a.rtoken(/^\s*/);f=f||null;return c instanceof Array?a.each(a.product(c.slice(0,-1),a.ignore(b)),c.slice(-1),a.ignore(f)):a.each(a.many(a.each(c,a.ignore(b))),px,a.ignore(f))},set:function(c,f,e){f=f||a.rtoken(/^\s*/);e=e||null;return function(s){for(var k=
null,l=k=null,n=null,o=[[],s],p=!1,v=0;v<c.length;v++){k=l=null;p=1==c.length;try{k=c[v].call(this,s)}catch(x){continue}n=[[k[0]],k[1]];if(0<k[1].length&&!p)try{l=f.call(this,k[1])}catch(A){p=!0}else p=!0;!p&&0===l[1].length&&(p=!0);if(!p){k=[];for(p=0;p<c.length;p++)v!=p&&k.push(c[p]);k=a.set(k,f).call(this,l[1]);0<k[0].length&&(n[0]=n[0].concat(k[0]),n[1]=k[1])}n[1].length<o[1].length&&(o=n);if(0===o[1].length)break}if(0===o[0].length)return o;if(e){try{l=e.call(this,o[1])}catch(z){throw new b.Exception(o[1]);
}o[1]=l[1]}return o}},forward:function(a,c){return function(b){return a[c].call(this,b)}},replace:function(a,c){return function(b){b=a.call(this,b);return[c,b[1]]}},process:function(a,c){return function(b){b=a.call(this,b);return[c.call(this,b[0]),b[1]]}},min:function(a,c){return function(f){var e=c.call(this,f);if(e[0].length<a)throw new b.Exception(f);return e}}},c=function(a){return function(){var c=null,b=[];1<arguments.length?c=Array.prototype.slice.call(arguments):arguments[0]instanceof Array&&
(c=arguments[0]);if(c)for(var f=c.shift();0<f.length;)return c.unshift(f[0]),b.push(a.apply(null,c)),c.shift(),b;else return a.apply(null,arguments)}},f="optional not ignore cache".split(/\s/),e=0;e<f.length;e++)a[f[e]]=c(a[f[e]]);c=function(a){return function(){return arguments[0]instanceof Array?a.apply(null,arguments[0]):a.apply(null,arguments)}};f="each any all".split(/\s/);for(e=0;e<f.length;e++)a[f[e]]=c(a[f[e]])})();
(function(){var b=function(a){for(var c=[],f=0;f<a.length;f++)a[f]instanceof Array?c=c.concat(b(a[f])):a[f]&&c.push(a[f]);return c};Date.Grammar={};Date.Translator={hour:function(a){return function(){this.hour=Number(a)}},minute:function(a){return function(){this.minute=Number(a)}},second:function(a){return function(){this.second=Number(a)}},meridian:function(a){return function(){this.meridian=a.slice(0,1).toLowerCase()}},timezone:function(a){return function(){var c=a.replace(/[^\d\+\-]/g,"");c.length?
this.timezoneOffset=Number(c):this.timezone=a.toLowerCase()}},day:function(a){var c=a[0];return function(){this.day=Number(c.match(/\d+/)[0])}},month:function(a){return function(){this.month=3==a.length?Date.getMonthNumberFromName(a):Number(a)-1}},year:function(a){return function(){var c=Number(a);this.year=2<a.length?c:c+(c+2E3<Date.CultureInfo.twoDigitYearMax?2E3:1900)}},rday:function(a){return function(){switch(a){case "yesterday":this.days=-1;break;case "tomorrow":this.days=1;break;case "today":this.days=
0;break;case "now":this.days=0,this.now=!0}}},finishExact:function(a){var a=a instanceof Array?a:[a],c=new Date;this.year=c.getFullYear();this.month=c.getMonth();this.day=1;for(c=this.second=this.minute=this.hour=0;c<a.length;c++)a[c]&&a[c].call(this);this.hour="p"==this.meridian&&13>this.hour?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");a=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);
this.timezone?a.set({timezone:this.timezone}):this.timezoneOffset&&a.set({timezoneOffset:this.timezoneOffset});return a},finish:function(a){a=a instanceof Array?b(a):[a];if(0===a.length)return null;for(var c=0;c<a.length;c++)"function"==typeof a[c]&&a[c].call(this);if(this.now)return new Date;a=Date.today();if(null!=this.days||this.orient||this.operator){var f,e;e="past"==this.orient||"subtract"==this.operator?-1:1;if(this.weekday)this.unit="day",c=Date.getDayNumberFromName(this.weekday)-a.getDay(),
f=7,this.days=c?(c+e*f)%f:e*f;if(this.month)this.unit="month",c=this.month-a.getMonth(),f=12,this.months=c?(c+e*f)%f:e*f,this.month=null;if(!this.unit)this.unit="day";if(null==this[this.unit+"s"]||null!=this.operator){if(!this.value)this.value=1;if("week"==this.unit)this.unit="day",this.value*=7;this[this.unit+"s"]=this.value*e}return a.add(this)}if(this.meridian&&this.hour)this.hour=13>this.hour&&"p"==this.meridian?this.hour+12:this.hour;if(this.weekday&&!this.day)this.day=a.addDays(Date.getDayNumberFromName(this.weekday)-
a.getDay()).getDate();if(this.month&&!this.day)this.day=1;return a.set(this)}};var a=Date.Parsing.Operators,c=Date.Grammar,f=Date.Translator,e;c.datePartDelimiter=a.rtoken(/^([\s\-\.\,\/\x27]+)/);c.timePartDelimiter=a.stoken(":");c.whiteSpace=a.rtoken(/^\s*/);c.generalDelimiter=a.rtoken(/^(([\s\,]|at|on)+)/);var h={};c.ctoken=function(c){var b=h[c];if(!b){for(var b=Date.CultureInfo.regexPatterns,f=c.split(/\s+/),e=[],g=0;g<f.length;g++)e.push(a.replace(a.rtoken(b[f[g]]),f[g]));b=h[c]=a.any.apply(null,
e)}return b};c.ctoken2=function(c){return a.rtoken(Date.CultureInfo.regexPatterns[c])};c.h=a.cache(a.process(a.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),f.hour));c.hh=a.cache(a.process(a.rtoken(/^(0[0-9]|1[0-2])/),f.hour));c.H=a.cache(a.process(a.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),f.hour));c.HH=a.cache(a.process(a.rtoken(/^([0-1][0-9]|2[0-3])/),f.hour));c.m=a.cache(a.process(a.rtoken(/^([0-5][0-9]|[0-9])/),f.minute));c.mm=a.cache(a.process(a.rtoken(/^[0-5][0-9]/),f.minute));c.s=a.cache(a.process(a.rtoken(/^([0-5][0-9]|[0-9])/),
f.second));c.ss=a.cache(a.process(a.rtoken(/^[0-5][0-9]/),f.second));c.hms=a.cache(a.sequence([c.H,c.mm,c.ss],c.timePartDelimiter));c.t=a.cache(a.process(c.ctoken2("shortMeridian"),f.meridian));c.tt=a.cache(a.process(c.ctoken2("longMeridian"),f.meridian));c.z=a.cache(a.process(a.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),f.timezone));c.zz=a.cache(a.process(a.rtoken(/^(\+|\-)\s*\d\d\d\d/),f.timezone));c.zzz=a.cache(a.process(c.ctoken2("timezone"),f.timezone));c.timeSuffix=a.each(a.ignore(c.whiteSpace),a.set([c.tt,
c.zzz]));c.time=a.each(a.optional(a.ignore(a.stoken("T"))),c.hms,c.timeSuffix);c.d=a.cache(a.process(a.each(a.rtoken(/^([0-2]\d|3[0-1]|\d)/),a.optional(c.ctoken2("ordinalSuffix"))),f.day));c.dd=a.cache(a.process(a.each(a.rtoken(/^([0-2]\d|3[0-1])/),a.optional(c.ctoken2("ordinalSuffix"))),f.day));c.ddd=c.dddd=a.cache(a.process(c.ctoken("sun mon tue wed thu fri sat"),function(a){return function(){this.weekday=a}}));c.M=a.cache(a.process(a.rtoken(/^(1[0-2]|0\d|\d)/),f.month));c.MM=a.cache(a.process(a.rtoken(/^(1[0-2]|0\d)/),
f.month));c.MMM=c.MMMM=a.cache(a.process(c.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),f.month));c.y=a.cache(a.process(a.rtoken(/^(\d\d?)/),f.year));c.yy=a.cache(a.process(a.rtoken(/^(\d\d)/),f.year));c.yyy=a.cache(a.process(a.rtoken(/^(\d\d?\d?\d?)/),f.year));c.yyyy=a.cache(a.process(a.rtoken(/^(\d\d\d\d)/),f.year));e=function(){return a.each(a.any.apply(null,arguments),a.not(c.ctoken2("timeContext")))};c.day=e(c.d,c.dd);c.month=e(c.M,c.MMM);c.year=e(c.yyyy,c.yy);c.orientation=a.process(c.ctoken("past future"),
function(a){return function(){this.orient=a}});c.operator=a.process(c.ctoken("add subtract"),function(a){return function(){this.operator=a}});c.rday=a.process(c.ctoken("yesterday tomorrow today now"),f.rday);c.unit=a.process(c.ctoken("minute hour day week month year"),function(a){return function(){this.unit=a}});c.value=a.process(a.rtoken(/^\d\d?(st|nd|rd|th)?/),function(a){return function(){this.value=a.replace(/\D/g,"")}});c.expression=a.set([c.rday,c.operator,c.value,c.unit,c.orientation,c.ddd,
c.MMM]);e=function(){return a.set(arguments,c.datePartDelimiter)};c.mdy=e(c.ddd,c.month,c.day,c.year);c.ymd=e(c.ddd,c.year,c.month,c.day);c.dmy=e(c.ddd,c.day,c.month,c.year);c.date=function(a){return(c[Date.CultureInfo.dateElementOrder]||c.mdy).call(this,a)};c.format=a.process(a.many(a.any(a.process(a.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(a){if(c[a])return c[a];throw Date.Parsing.Exception(a);}),a.process(a.rtoken(/^[^dMyhHmstz]+/),function(c){return a.ignore(a.stoken(c))}))),
function(c){return a.process(a.each.apply(null,c),f.finishExact)});var g={};c.formats=function(b){if(b instanceof Array){for(var f=[],e=0;e<b.length;e++)f.push(g[b[e]]=g[b[e]]||c.format(b[e])[0]);return a.any.apply(null,f)}return g[b]=g[b]||c.format(b)[0]};c._formats=c.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);c._start=a.process(a.set([c.date,c.time,c.expression],c.generalDelimiter,c.whiteSpace),f.finish);c.start=function(a){try{var b=c._formats.call({},
a);if(0===b[1].length)return b}catch(f){}return c._start.call({},a)}})();Date._parse=Date.parse;Date.parse=function(b){var a=null;if(!b)return null;try{a=Date.Grammar.start.call({},b)}catch(c){return null}return 0===a[1].length?a[0]:null};Date.getParseFunction=function(b){var a=Date.Grammar.formats(b);return function(c){var b=null;try{b=a.call({},c)}catch(e){return null}return 0===b[1].length?b[0]:null}};Date.parseExact=function(b,a){return Date.getParseFunction(a)(b)};var datePickerController;datePicker.languageinfo=navigator.language?navigator.language:navigator.userLanguage;datePicker.languageinfo=datePicker.languageinfo?datePicker.languageinfo.toLowerCase().replace(/-[a-z]+$/,""):"en";var loc="fileadmin/scripts/lang/"+datePicker.languageinfo+".js",script=document.createElement("script");script.type="text/javascript";script.src=loc;script.setAttribute("charset","utf-8");document.getElementsByTagName("head")[0].appendChild(script);script=null;
datePicker.months="January,February,March,April,May,June,July,August,September,October,November,December".split(",");datePicker.fullDay="Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday".split(",");datePicker.titles="Previous month,Next month,Previous year,Next year,Today,Show Calendar".split(",");datePicker.getDaysPerMonth=function(b,a){b=(b+12)%12;return 0==a%4&&(0!=a%100||0==a%400)&&1==b?29:[31,28,31,30,31,30,31,31,30,31,30,31][b]};
function datePicker(b){this.defaults={};for(opt in b)this[opt]=this.defaults[opt]=b[opt];this.date=new Date;this.yearinc=1;this.timer=null;this.pause=1E3;this.timerSet=!1;this.fadeTimer=null;this.interval=new Date;this.firstDayOfWeek=this.defaults.firstDayOfWeek=this.dayInc=this.monthInc=this.yearInc=this.opacity=this.opacityTo=0;this.dateSet=null;this.visible=!1;this.disabledDates=[];this.enabledDates=[];this.nbsp=String.fromCharCode(160);var a=this;a.events={onblur:function(){a.removeKeyboardEvents()},
onfocus:function(){a.addKeyboardEvents()},onkeydown:function(c){a.stopTimer();if(!a.visible)return!1;if(null==c)c=document.parentWindow.event;var b=c.keyCode?c.keyCode:c.charCode;if(13==b){var e=document.getElementById(a.id+"-date-picker-hover");if(!e||-1!=e.className.search(/out-of-range|day-disabled/))return a.killEvent(c);a.returnFormattedDate();a.hide();return a.killEvent(c)}if(27==b)return a.hide(),a.killEvent(c);if(32==b||0==b)return a.date=new Date,a.updateTable(),a.killEvent(c);if(49<b&&56>
b||97<b&&104>b)return 96<b&&(b-=48),a.firstDayOfWeek=(a.firstDayOfWeek+(b-49))%7,a.updateTable(),a.killEvent(c);if(37>b||40<b)return!0;e=(new Date(a.date)).valueOf();37==b?c.ctrlKey?(e=new Date(a.date),e.setDate(Math.min(e.getDate(),datePicker.getDaysPerMonth(e.getMonth()-1,e.getFullYear()))),e.setMonth(e.getMonth()-1)):e=new Date(a.date.getFullYear(),a.date.getMonth(),a.date.getDate()-1):39==b?c.ctrlKey?(e=new Date(a.date),e.setDate(Math.min(e.getDate(),datePicker.getDaysPerMonth(e.getMonth()+1,
e.getFullYear()))),e.setMonth(e.getMonth()+1)):e=new Date(a.date.getFullYear(),a.date.getMonth(),a.date.getDate()+1):38==b?c.ctrlKey?(e=new Date(a.date),e.setDate(Math.min(e.getDate(),datePicker.getDaysPerMonth(e.getMonth(),e.getFullYear()+1))),e.setFullYear(e.getFullYear()+1)):e=new Date(a.date.getFullYear(),a.date.getMonth(),a.date.getDate()-7):40==b&&(c.ctrlKey?(e=new Date(a.date),e.setDate(Math.min(e.getDate(),datePicker.getDaysPerMonth(e.getMonth(),e.getFullYear()-1))),e.setFullYear(e.getFullYear()-
1)):e=new Date(a.date.getFullYear(),a.date.getMonth(),a.date.getDate()+7));b=new Date(e);if(a.outOfRange(b))return a.killEvent(c);e=new Date(a.date);a.date=b;if(e.getFullYear()!=a.date.getFullYear()||e.getMonth()!=a.date.getMonth())a.updateTable();else{a.disableTodayButton();var b=a.table.getElementsByTagName("td"),h,e=a.date.getDate()-6;0>e&&(e=0);for(var g=e;e=b[g];g++)if(h=Number(e.firstChild.nodeValue),!(isNaN(h)||h!=a.date.getDate()))a.removeHighlight(),e.id=a.id+"-date-picker-hover",e.className=
e.className.replace(/date-picker-hover/g,"")+" date-picker-hover"}return a.killEvent(c)},gotoToday:function(c){a.date=new Date;a.updateTable();return a.killEvent(c)},onmousedown:function(c){if(null==c)c=document.parentWindow.event;for(var c=null!=c.target?c.target:c.srcElement,b=!1;c.parentNode;){if(c.id&&(c.id=="fd-"+a.id||c.id=="fd-but-"+a.id)){b=!0;break}try{c=c.parentNode}catch(e){break}}if(b)return!0;a.stopTimer();datePickerController.hideAll()},onmouseover:function(){a.stopTimer();var c=this.firstChild.nodeValue;
if(!("out-of-range"==this.className||-1==c.search(/^[\d]+$/)))a.removeHighlight(),this.id=a.id+"-date-picker-hover",this.className=this.className.replace(/date-picker-hover/g,"")+" date-picker-hover",a.date.setDate(this.firstChild.nodeValue),a.disableTodayButton()},onclick:function(c){if(a.opacity!=a.opacityTo||-1!=this.className.search(/out-of-range|day-disabled/))return!1;if(null==c)c=document.parentWindow.event;for(var b=null!=c.target?c.target:c.srcElement;1!=b.nodeType;)b=b.parentNode;var e=
new Date(a.date),b=b.firstChild.data;if(-1!=b.search(/^[\d]+$/)){b=Number(b);if(isNaN(b))return!0;e.setDate(b);a.date=e;a.returnFormattedDate();a.staticPos||a.hide();a.stopTimer();return a.killEvent(c)}},incDec:function(c,b,e,h){if(null==c)c=document.parentWindow.event;if((c=null!=c.target?c.target:c.srcElement)&&c.className&&-1!=c.className.search("fd-disabled"))return!1;datePickerController.addEvent(document,"mouseup",a.events.clearTimer);a.timerInc=800;a.dayInc=b;a.yearInc=e;a.monthInc=h;a.timerSet=
!0;a.updateTable();return!0},clearTimer:function(){a.stopTimer();a.timerInc=1E3;a.yearInc=0;a.monthInc=0;a.dayInc=0;datePickerController.removeEvent(document,"mouseup",a.events.clearTimer)}};a.stopTimer=function(){a.timerSet=!1;window.clearTimeout(a.timer)};a.removeHighlight=function(){if(document.getElementById(a.id+"-date-picker-hover"))document.getElementById(a.id+"-date-picker-hover").className=document.getElementById(a.id+"-date-picker-hover").className.replace("date-picker-hover",""),document.getElementById(a.id+
"-date-picker-hover").id=""};a.reset=function(){for(def in a.defaults)a[def]=a.defaults[def]};a.setOpacity=function(c){a.div.style.opacity=c/100;a.div.style.filter="alpha(opacity="+c+")";a.opacity=c};a.fade=function(){window.clearTimeout(a.fadeTimer);a.fadeTimer=null;delete a.fadeTimer;var c=Math.round(a.opacity+(a.opacityTo-a.opacity)/4);a.setOpacity(c);3<Math.abs(a.opacityTo-c)&&!a.noTransparency?a.fadeTimer=window.setTimeout(a.fade,50):(a.setOpacity(a.opacityTo),0==a.opacityTo?(a.div.style.display=
"none",a.visible=!1):a.visible=!0)};a.killEvent=function(a){a=a||document.parentWindow.event;a.stopPropagation&&(a.stopPropagation(),a.preventDefault());return!1};a.getElem=function(){return document.getElementById(a.id.replace(/^fd-/,""))||!1};a.setRangeLow=function(c){-1==(""+c).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/)&&(c="");a.low=a.defaults.low=c;a.staticPos&&a.updateTable(!0)};a.setRangeHigh=function(c){-1==(""+c).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/)&&
(c="");a.high=a.defaults.high=c;a.staticPos&&a.updateTable(!0)};a.setDisabledDays=function(c){a.disableDays=a.defaults.disableDays=c;a.staticPos&&a.updateTable(!0)};a.setDisabledDates=function(c){for(var b=[],e=c.length;e--;)-1!=c[e].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01])$/)&&(b[b.length]=c[e]);if(b.length)a.disabledDates=b,a.enabledDates=[],a.staticPos&&a.updateTable(!0)};a.setEnabledDates=function(c){for(var b=[],e=c.length;e--;)-1!=c[e].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01]|\*\*)$/)&&
"********"!=c[e]&&(b[b.length]=c[e]);if(b.length)a.disabledDates=[],a.enabledDates=b,a.staticPos&&a.updateTable(!0)};a.getDisabledDates=function(c,b){if(a.enabledDates.length)return a.getEnabledDates(c,b);for(var e={},h=datePicker.getDaysPerMonth(b-1,c),b=10>b?"0"+b:b,g=a.disabledDates.length;g--;){var j=a.disabledDates[g].replace("****",c).replace("**",b);j<Number(""+c+b+"01")||j>Number(c+(""+b)+h)||(e[j]=1)}return e};a.getEnabledDates=function(c,b){var f;for(var e={},h=datePicker.getDaysPerMonth(b-
1,c),b=10>b?"0"+b:b,g,j,s,k,l,n,o=1;o<=h;o++){g=10>o?"0"+o:o;n=!0;for(var p=a.enabledDates.length;p--;){j=a.enabledDates[p];l=(""+a.enabledDates[p]).substr(0,4);k=(""+a.enabledDates[p]).substr(4,2);s=(""+a.enabledDates[p]).substr(6,2);if(l==c&&k==b&&s==g){n=!1;break}if("****"==l||"**"==k||"**"==s)if("****"==l&&(j=j.replace(/^\*\*\*\*/,c)),"**"==k&&(f=j=j.substr(0,4)+(""+b)+j.substr(6,2),j=f),"**"==s&&(j=j.replace(/\*\*/,g)),j==""+(c+(""+b)+g)){n=!1;break}}n&&(e[""+(c+(""+b)+g)]=1)}return e};a.setFirstDayOfWeek=
function(c){if(null==c)c=document.parentWindow.event;var b=null!=c.target?c.target:c.srcElement;if("th"!=b.tagName.toLowerCase())for(;"th"!=b.tagName.toLowerCase();)b=b.parentNode;for(var e=0;b.previousSibling;)b=b.previousSibling,"th"==b.tagName.toLowerCase()&&e++;a.firstDayOfWeek=(a.firstDayOfWeek+e)%7;a.updateTableHeaders();return a.killEvent(c)};a.truePosition=function(c){var b=a.cumulativeOffset(c);if(window.opera)return b;var e=document.compatMode&&"BackCompat"!=document.compatMode?document.documentElement:
document.body,h=document.all?e.scrollLeft:window.pageXOffset,e=document.all?e.scrollTop:window.pageYOffset,c=a.realOffset(c);return[b[0]-c[0]+h,b[1]-c[1]+e]};a.realOffset=function(a){var b=0,e=0;do b+=a.scrollTop||0,e+=a.scrollLeft||0,a=a.parentNode;while(a);return[e,b]};a.cumulativeOffset=function(a){var b=0,e=0;do b+=a.offsetTop||0,e+=a.offsetLeft||0,a=a.offsetParent;while(a);return[e,b]};a.resize=function(){if(a.created&&a.getElem()){a.div.style.visibility="hidden";if(!a.staticPos)a.div.style.left=
a.div.style.top="0px";a.div.style.display="block";var c=a.div.offsetHeight,b=a.div.offsetWidth;a.div.style.visibility="visible";a.div.style.display="none";if(!a.staticPos){var e=document.getElementById("fd-but-"+a.id),h=a.truePosition(a.getElem()),g=document.compatMode&&"BackCompat"!=document.compatMode?document.documentElement:document.body,j=window.devicePixelRatio||window.opera?0:g.scrollTop,s=window.devicePixelRatio||window.opera?0:g.scrollLeft;a.div.style.left=parseInt(g.clientWidth+s)<parseInt(b+
h[0])?Math.abs(parseInt(g.clientWidth+s-b))+"px":h[0]+"px";a.div.style.top=parseInt(g.clientHeight+j)<parseInt(c+h[1]+e.offsetHeight+2)?Math.abs(parseInt(h[1]-(c+2)))+"px":Math.abs(parseInt(h[1]+e.offsetHeight+2))+"px"}}};a.equaliseDates=function(){for(var c=!1,b,e=a.low;e<=a.high;e++)if(b=""+e,!a.disableDays[(new Date(b.substr(0,4),b.substr(6,2),b.substr(4,2))).getDay()-1]){c=!0;break}if(!c)a.disableDays=a.defaults.disableDays=[0,0,0,0,0,0,0]};a.outOfRange=function(c){if(!a.low&&!a.high)return!1;
var b=!1;if(!c)b=!0,c=a.date;var e=10>c.getDate()?"0"+c.getDate():c.getDate(),h=10>c.getMonth()+1?"0"+(c.getMonth()+1):c.getMonth()+1,c=""+c.getFullYear()+(""+h)+(""+e);if(a.low&&parseInt(c)<parseInt(a.low)){if(!b)return!0;a.date=new Date(a.low.substr(0,4),a.low.substr(4,2)-1,a.low.substr(6,2),5,0,0);return!1}if(a.high&&parseInt(c)>parseInt(a.high)){if(!b)return!0;a.date=new Date(a.high.substr(0,4),a.high.substr(4,2)-1,a.high.substr(6,2),5,0,0)}return!1};a.createButton=function(){if(!a.staticPos){var c;
if(document.getElementById("fd-but-"+a.id))c=document.getElementById("fd-but-"+a.id);else{var f=a.getElem();c=document.createElement("a");c.href="#";var e=document.createElement("span");e.appendChild(document.createTextNode(String.fromCharCode(160)));c.className="date-picker-control";c.title="object"==typeof fdLocale&&b.locale&&5<fdLocale.titles.length?fdLocale.titles[5]:"";c.id="fd-but-"+a.id;c.appendChild(e);f.nextSibling?f.parentNode.insertBefore(c,f.nextSibling):f.parentNode.appendChild(c)}c.onclick=
c.onpress=function(a){var a=a||window.event,c=this.id.replace("fd-but-","");try{var b=datePickerController.getDatePicker(c)}catch(e){return!1}if("press"==a.type){if(13!=(null!=a.keyCode?a.keyCode:a.charCode))return!0;if(b.visible)return hideAll(),!1}b.visible?datePickerController.hideAll():(datePickerController.hideAll(c),b.show());return!1};c=null}};a.create=function(){function c(a){var c=document.createElement("th");if(a.thClassName)c.className=a.thClassName;a.colspan&&c.setAttribute("colspan",
a.colspan);return c}function b(e,f){for(var h=0,g;g=f[h];h++){var j=c(g);e.appendChild(j);var k=document.createElement("span");k.className=g.className;k.id=a.id+g.id;k.appendChild(document.createTextNode(g.text));k.title=g.title||"";if(g.onmousedown)k.onmousedown=g.onmousedown;if(g.onclick)k.onclick=g.onclick;if(g.onmouseout)k.onmouseout=g.onmouseout;j.appendChild(k)}}if("object"==typeof fdLocale&&a.locale){datePicker.titles=fdLocale.titles;datePicker.months=fdLocale.months;datePicker.fullDay=fdLocale.fullDay;
if(fdLocale.dayAbbr)datePicker.dayAbbr=fdLocale.dayAbbr;if(fdLocale.firstDayOfWeek)a.firstDayOfWeek=a.defaults.firstDayOfWeek=fdLocale.firstDayOfWeek}a.div=document.createElement("div");a.div.style.zIndex=9999;a.div.id="fd-"+a.id;a.div.className="datePicker";if(a.staticPos){elem=a.getElem();if(!elem){a.div=null;return}a.div.className+=" staticDP";a.div.setAttribute("tabIndex","0");a.div.onfocus=a.events.onfocus;a.div.onblur=a.events.onblur;elem.parentNode.insertBefore(a.div,elem.nextSibling);a.hideInput&&
elem.type&&"text"==elem.type&&elem.setAttribute("type","hidden")}else document.getElementsByTagName("body")[0].appendChild(a.div);var e,h,g,j;a.table=document.createElement("table");a.div.appendChild(a.table);g=document.createElement("thead");a.table.appendChild(g);e=document.createElement("tr");g.appendChild(e);a.titleBar=c({thClassName:"date-picker-title",colspan:7});e.appendChild(a.titleBar);e=null;e=document.createElement("span");e.className="month-display";a.titleBar.appendChild(e);e=document.createElement("span");
e.className="year-display";a.titleBar.appendChild(e);e=null;e=document.createElement("tr");g.appendChild(e);b(e,[{className:"prev-but",id:"-prev-year-but",text:"\u00ab",title:datePicker.titles[2],onmousedown:function(c){a.events.incDec(c,0,-1,0)},onmouseout:a.events.clearTimer},{className:"prev-but",id:"-prev-month-but",text:"\u2039",title:datePicker.titles[0],onmousedown:function(c){a.events.incDec(c,0,0,-1)},onmouseout:a.events.clearTimer},{colspan:3,className:"today-but",id:"-today-but",text:4<
datePicker.titles.length?datePicker.titles[4]:"Today",onclick:a.events.gotoToday},{className:"next-but",id:"-next-month-but",text:"\u203a",title:datePicker.titles[1],onmousedown:function(c){a.events.incDec(c,0,0,1)},onmouseout:a.events.clearTimer},{className:"next-but",id:"-next-year-but",text:"\u00bb",title:datePicker.titles[3],onmousedown:function(c){a.events.incDec(c,0,1,0)},onmouseout:a.events.clearTimer}]);j=document.createElement("tbody");a.table.appendChild(j);for(var s=0;7>s;s++){e=document.createElement("tr");
0!=s?j.appendChild(e):g.appendChild(e);for(var k=0;7>k;k++)h=0==s?document.createElement("th"):document.createElement("td"),e.appendChild(h),0!=s?(h.appendChild(document.createTextNode(a.nbsp)),h.onmouseover=a.events.onmouseover,h.onclick=a.events.onclick):(h.className="date-picker-day-header",h.scope="col"),h=null;e=null}e=a.table.getElementsByTagName("thead")[0].getElementsByTagName("tr")[2].getElementsByTagName("th");for(h=0;7>h;h++)0<h?(g=document.createElement("span"),g.className="fd-day-header",
g.onclick=e[h].onclick=a.setFirstDayOfWeek,g.appendChild(document.createTextNode(a.nbsp)),e[h].appendChild(g),g=null):e[h].appendChild(document.createTextNode(a.nbsp));a.ths=a.table.getElementsByTagName("thead")[0].getElementsByTagName("tr")[2].getElementsByTagName("th");a.trs=a.table.getElementsByTagName("tbody")[0].getElementsByTagName("tr");a.updateTableHeaders();j=g=e=b=c=null;a.low&&a.high&&7>a.high-a.low&&a.equaliseDates();a.created=!0;a.staticPos?(g=document.getElementById(a.id),datePickerController.addEvent(g,
"change",a.changeHandler),a.splitDate&&(g=document.getElementById(a.id+"-mm"),e=document.getElementById(a.id+"-dd"),datePickerController.addEvent(g,"change",a.changeHandler),datePickerController.addEvent(e,"change",a.changeHandler)),a.show()):(a.createButton(),a.resize(),a.fade())};a.changeHandler=function(){a.setDateFromInput();a.updateTable()};a.setDateFromInput=function(){function c(a){return 2>(""+a).length?"00".substring(0,2-(""+a).length)+(""+a):a}a.dateSet=null;var b=a.getElem();if(b){if(a.splitDate)var e=
document.getElementById(a.id+"-mm"),h=document.getElementById(a.id+"-dd"),e=parseInt("input"==e.tagName.toLowerCase()?e.value:e.options[e.selectedIndex].value,10),h=parseInt("input"==h.tagName.toLowerCase()?h.value:h.options[h.selectedIndex].value,10),b=parseInt("input"==b.tagName.toLowerCase()?b.value:b.options[b.selectedIndex||0].value,10),g=datePickerController.dateFormat(e+"/"+h+"/"+b,!0);else var g=datePickerController.dateFormat(b.value,-1!=a.format.search(/m-d-y/i));b=!1;g||(b=!0,g=""+(new Date).getFullYear()+
c((new Date).getMonth()+1)+c((new Date).getDate()));var h=Number(g.substr(0,4)),e=Number(g.substr(4,2))-1,g=Number(g.substr(6,2)),j=datePicker.getDaysPerMonth(e,h);g>j&&(g=j);if("Invalid Date"==new Date(h,e,g)||"NaN"==new Date(h,e,g))b=!0,a.date=new Date,a.date.setHours(5);else{a.date=new Date(h,e,g);a.date.setHours(5);if(!b)a.dateSet=new Date(a.date);c=null}}};a.setSelectIndex=function(a,b){for(var e=a.options.length,b=Number(b),h=0;h<e;h++)if(a.options[h].value==b){a.selectedIndex=h;break}};a.returnFormattedDate=
function(){var c=a.getElem();if(c){var b=10>a.date.getDate()?"0"+a.date.getDate():a.date.getDate(),e=10>a.date.getMonth()+1?"0"+(a.date.getMonth()+1):a.date.getMonth()+1,h=a.date.getFullYear(),g=a.getDisabledDates(h,e),j=(a.date.getDay()+6)%7;if(!(a.disableDays[j]||""+h+e+b in g)){a.splitDate?(g=document.getElementById(a.id+"-dd"),j=document.getElementById(a.id+"-mm"),"input"==g.tagName.toLowerCase()?g.value=b:a.setSelectIndex(g,b),"input"==j.tagName.toLowerCase()?j.value=e:a.setSelectIndex(j,e),
"input"==c.tagName.toLowerCase()?c.value=h:a.setSelectIndex(c,h)):c.value=a.format.replace("y",h).replace("m",e).replace("d",b).replace(/-/g,a.divider);(!c.type||c.type&&"hidden"!=c.type)&&c.focus();if(a.staticPos)a.dateSet=new Date(a.date),a.updateTable();document.createEvent?(b=document.createEvent("HTMLEvents"),b.initEvent("change",!0,!1),c.dispatchEvent(b)):document.createEventObject&&c.fireEvent("onchange")}}};a.disableTodayButton=function(){var c=new Date;document.getElementById(a.id+"-today-but").className=
document.getElementById(a.id+"-today-but").className.replace("fd-disabled","");a.outOfRange(c)||a.date.getDate()==c.getDate()&&a.date.getMonth()==c.getMonth()&&a.date.getFullYear()==c.getFullYear()?(document.getElementById(a.id+"-today-but").className+=" fd-disabled",document.getElementById(a.id+"-today-but").onclick=null):document.getElementById(a.id+"-today-but").onclick=a.events.gotoToday};a.updateTableHeaders=function(){for(var c,b,e=a.ths,h=0;7>h;h++)c=(a.firstDayOfWeek+h)%7,e[h].title=datePicker.fullDay[c],
0<h?(b=e[h].getElementsByTagName("span")[0],b.removeChild(b.firstChild),b.appendChild(document.createTextNode(datePicker.dayAbbr?datePicker.dayAbbr[c]:datePicker.fullDay[c].charAt(0))),b.title=datePicker.fullDay[c]):(e[h].removeChild(e[h].firstChild),e[h].appendChild(document.createTextNode(datePicker.dayAbbr?datePicker.dayAbbr[c]:datePicker.fullDay[c].charAt(0))));a.updateTable()};a.updateTable=function(c){if(a.timerSet){var b=new Date(a.date);b.setDate(Math.min(b.getDate()+a.dayInc,datePicker.getDaysPerMonth(b.getMonth()+
a.monthInc,b.getFullYear()+a.yearInc)));b.setMonth(b.getMonth()+a.monthInc);b.setFullYear(b.getFullYear()+a.yearInc);a.date=b}if(!c&&"onupdate"in datePickerController&&"function"==typeof datePickerController.onupdate)datePickerController.onupdate(a);a.outOfRange();a.disableTodayButton();c=new Date(a.date.getFullYear(),a.date.getMonth(),2);c.setHours(5);var b=c.getMonth(),e=c.getFullYear(),h=a.getDisabledDates(a.date.getFullYear(),a.date.getMonth()+1),g=new Date,j=document.getElementById(a.id+"-prev-year-but");
j.className=j.className.replace("fd-disabled","");a.outOfRange(new Date(e-1,Number(b),datePicker.getDaysPerMonth(Number(b),e-1)))&&(j.className+=" fd-disabled",-1==a.yearInc&&a.stopTimer());j=document.getElementById(a.id+"-prev-month-but");j.className=j.className.replace("fd-disabled","");a.outOfRange(new Date(e,Number(b)-1,datePicker.getDaysPerMonth(Number(b)-1,e)))&&(j.className+=" fd-disabled",-1==a.monthInc&&a.stopTimer());j=document.getElementById(a.id+"-next-year-but");j.className=j.className.replace("fd-disabled",
"");a.outOfRange(new Date(e+1,Number(b),1))&&(j.className+=" fd-disabled",1==a.yearInc&&a.stopTimer());j=document.getElementById(a.id+"-next-month-but");j.className=j.className.replace("fd-disabled","");a.outOfRange(new Date(e,Number(b)+1,1))&&(j.className+=" fd-disabled",1==a.monthInc&&a.stopTimer());for(var j=a.date.getDate(),s=a.date.getMonth(),k=a.date.getFullYear(),l=a.titleBar.getElementsByTagName("span");l[0].firstChild;)l[0].removeChild(l[0].firstChild);for(;l[1].firstChild;)l[1].removeChild(l[1].firstChild);
l[0].appendChild(document.createTextNode(datePicker.months[s]+a.nbsp));l[1].appendChild(document.createTextNode(k));c.setDate(1);var n,o,p,v;v=(c.getDay()+6)%7;for(var l=(v-a.firstDayOfWeek+7)%7-1,x=datePicker.getDaysPerMonth(s,k),A=g.getDate(),z=g.getMonth(),q=g.getFullYear(),t=""+e+(2>(""+(b+1)).length?"0"+(b+1):b+1),u=0;6>u;u++){p=a.trs[u].getElementsByTagName("td");for(var w=0;7>w;w++)g=p[w],g.removeChild(g.firstChild),g.setAttribute("id",""),g.setAttribute("title",""),v=7*u+w,v>l&&v<=l+x?(n=
v-l,c.setDate(n),g.appendChild(document.createTextNode(n)),a.outOfRange(c)?g.setAttribute("class","out-of-range"):(o=[],v=(c.getDay()+6)%7,n==A&&b==z&&e==q&&o.push("date-picker-today"),null!=a.dateSet&&a.dateSet.getDate()==n&&a.dateSet.getMonth()==b&&a.dateSet.getFullYear()==e&&o.push("date-picker-selected-date"),a.disableDays[v]||t+(""+(10>n?"0"+n:n))in h?o.push("day-disabled"):a.highlightDays[v]&&o.push("date-picker-highlight"),j==n&&(g.setAttribute("id",a.id+"-date-picker-hover"),o.push("date-picker-hover")),
o.push("dm-"+n+"-"+(b+1)+"  dmy-"+n+"-"+(b+1)+"-"+e),g.setAttribute("class",o.join(" ")),g.setAttribute("title",datePicker.months[s]+a.nbsp+n+","+a.nbsp+k))):(g.appendChild(document.createTextNode(a.nbsp)),g.setAttribute("class","date-picker-unused"))}if(a.timerSet)a.timerInc=50+Math.round((a.timerInc-50)/1.8),a.timer=window.setTimeout(a.updateTable,a.timerInc)};a.addKeyboardEvents=function(){datePickerController.addEvent(document,"keypress",a.events.onkeydown);window.devicePixelRatio&&(datePickerController.removeEvent(document,
"keypress",a.events.onkeydown),datePickerController.addEvent(document,"keydown",a.events.onkeydown))};a.removeKeyboardEvents=function(){datePickerController.removeEvent(document,"keypress",a.events.onkeydown);datePickerController.removeEvent(document,"keydown",a.events.onkeydown)};a.show=function(){var b=a.getElem();if(b&&!a.visible&&!b.disabled)a.reset(),a.setDateFromInput(),a.updateTable(),a.staticPos||a.resize(),datePickerController.addEvent(a.staticPos?a.table:document,"mousedown",a.events.onmousedown),
a.staticPos||a.addKeyboardEvents(),a.opacityTo=a.noTransparency?99:90,a.div.style.display="block",a.fade(),a.visible=!0};a.hide=function(){if(a.visible&&(a.stopTimer(),!a.staticPos)){datePickerController.removeEvent(document,"mousedown",a.events.onmousedown);datePickerController.removeEvent(document,"mouseup",a.events.clearTimer);a.removeKeyboardEvents();a.opacityTo=0;a.fade();a.visible=!1;var b=a.getElem();(!b.type||b.type&&"hidden"!=b.type)&&b.focus()}};a.destroy=function(){var c;datePickerController.removeEvent(a.staticPos?
a.table:document,"mousedown",a.events.onmousedown);datePickerController.removeEvent(document,"mouseup",a.events.clearTimer);a.removeKeyboardEvents();if(a.staticPos){var b=document.getElementById(a.id);datePickerController.removeEvent(b,"change",a.changeHandler);if(a.splitDate){var b=document.getElementById(a.id+"-mm"),f=document.getElementById(a.id+"-dd");datePickerController.removeEvent(b,"change",a.changeHandler);datePickerController.removeEvent(f,"change",a.changeHandler)}a.div.onfocus=a.div.onblur=
null}for(var f=a.table.getElementsByTagName("th"),b=0,e;e=f[b];b++)e.onmouseover=e.onmouseout=e.onmousedown=e.onclick=null;f=a.table.getElementsByTagName("td");for(b=0;e=f[b];b++)e.onmouseover=e.onclick=null;f=a.table.getElementsByTagName("span");for(b=0;e=f[b];b++)e.onmousedown=e.onclick=e.onkeypress=null;a.ths=a.trs=null;clearTimeout(a.fadeTimer);clearTimeout(a.timer);a.fadeTimer=a.timer=null;if(!a.staticPos&&document.getElementById(a.id.replace(/^fd-/,"fd-but-")))e=document.getElementById(a.id.replace(/^fd-/,
"fd-but-")),e.onclick=e.onpress=null;a.div&&a.div.parentNode&&a.div.parentNode.removeChild(a.div);c=a.titleBar=a.table=a.div=null,a=c};a.create()}
datePickerController=function(){var b={},a=0,c=function(a,b,c){try{a.detachEvent?(a.detachEvent("on"+b,a[b+c]),a[b+c]=null):a.removeEventListener(b,c,!0)}catch(e){}},f=function(){if(!arguments.length)return[];for(var a=[],b=0;b<arguments.length;b++)for(var c=0,e;e=arguments[b][c];c++)a[a.length]=e;return a},e=function(a,c){a in b||(b[a]=new datePicker(c))};return{addEvent:function(a,b,c){a.attachEvent?(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event)},a.attachEvent("on"+b,a[b+c])):a.addEventListener(b,
c,!0)},removeEvent:c,create:function(b){if("undefined"!=typeof document.createElement&&"undefined"!=typeof document.documentElement&&"number"==typeof document.documentElement.offsetWidth)for(var c=b&&b.tagName?[b]:f(document.getElementsByTagName("input"),document.getElementsByTagName("select")),j=/disable-days-([1-7]){1,6}/g,s=/no-transparency/g,k=/highlight-days-([1-7]){1,7}/g,l=/range-low-(\d\d\d\d-\d\d-\d\d)/g,n=/range-high-(\d\d\d\d-\d\d-\d\d)/g,o=/format-(d-m-y|m-d-y|y-m-d)/g,p=/divider-(dot|slash|space|dash)/g,
v=/no-locale/g,x=/no-fade/g,A=/hide-input/g,z=0;b=c[z];z++)if(b.className&&(-1!=b.className.search(o)||-1!=b.className.search(/split-date/))&&("input"==b.tagName.toLowerCase()&&("text"==b.type||"hidden"==b.type)||"select"==b.tagName.toLowerCase())&&(!b.id||!document.getElementById("fd-"+b.id))){if(!b.id)b.id="fdDatePicker-"+a++;var q={id:b.id,low:"",high:"",divider:"/",format:"d-m-y",highlightDays:[0,0,0,0,0,1,1],disableDays:[0,0,0,0,0,0,0],locale:-1==b.className.search(v),splitDate:0,noTransparency:-1!=
b.className.search(s),staticPos:-1!=b.className.search(x),hideInput:-1!=b.className.search(A)};q.staticPos?q.noTransparency=!0:q.hideInput=!1;if(-1!=b.className.search(/split-date/)&&document.getElementById(b.id+"-dd")&&document.getElementById(b.id+"-mm")&&-1!=document.getElementById(b.id+"-dd").tagName.search(/input|select/i)&&-1!=document.getElementById(b.id+"-mm").tagName.search(/input|select/i))q.splitDate=1;if(-1!=b.className.search(o))q.format=b.className.match(o)[0].replace("format-","");if(-1!=
b.className.search(p)){var t={dot:".",space:" ",dash:"-",slash:"/"};q.divider=-1!=b.className.search(p)&&b.className.match(p)[0].replace("divider-","")in t?t[b.className.match(p)[0].replace("divider-","")]:"/"}if(-1!=b.className.search(k)){t=b.className.match(k)[0].replace(/highlight-days-/,"");q.highlightDays=[0,0,0,0,0,0,0];for(var u=0;u<t.length;u++)q.highlightDays[t.charAt(u)-1]=1}if(-1!=b.className.search(j)){t=b.className.match(j)[0].replace(/disable-days-/,"");q.disableDays=[0,0,0,0,0,0,0];
for(u=0;u<t.length;u++)q.disableDays[t.charAt(u)-1]=1}if(-1!=b.className.search(/range-low-today/i))q.low=datePickerController.dateFormat((new Date).getMonth()+1+"/"+(new Date).getDate()+"/"+(new Date).getFullYear(),!0);else if(-1!=b.className.search(l)&&(q.low=datePickerController.dateFormat(b.className.match(l)[0].replace(/range-low-/,""),!1),!q.low))q.low="";if(-1!=b.className.search(/range-high-today/i)&&-1==b.className.search(/range-low-today/i))q.high=datePickerController.dateFormat((new Date).getMonth()+
1+"/"+(new Date).getDate()+"/"+(new Date).getFullYear(),!0);else if(-1!=b.className.search(n)&&(q.high=datePickerController.dateFormat(b.className.match(n)[0].replace(/range-high-/,""),!1),!q.high))q.high="";if(-1!=b.tagName.search(/select/i)){for(var t=b,u=[],w=0;w<t.options.length;w++)if(-1!=t.options[w].value.search(/^\d\d\d\d$/)){if(!u[0]||Number(t.options[w].value)<u[0])u[0]=Number(t.options[w].value);if(!u[1]||Number(t.options[w].value)>u[1])u[1]=Number(t.options[w].value)}t=u;q.low=q.low?t[0]+
(""+q.low).substr(4,4):datePickerController.dateFormat(t[0]+"/01/01");q.high=q.high?t[1]+(""+q.low).substr(4,4):datePickerController.dateFormat(t[1]+"/12/31")}e(b.id,q)}},destroy:function(){for(dp in b)b[dp].created&&(b[dp].destroy(),b[dp]=null,delete b[dp]);b=null;datePicker.script=null;c(window,"load",datePickerController.create);c(window,"unload",datePickerController.destroy)},cleanUp:function(){for(var a in b)!document.getElementById(b[a].id)&&b[a].created&&(b[a].destroy(),b[a]=null,delete b[a])},
addDatePicker:e,getDatePicker:function(a){if(!(a in b))throw"No datePicker has been created for the form element with an id of '"+a.toString()+"'";return b[a]},dateFormat:function(a,b){for(var c=[{regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,d:1,m:3,y:5},{regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,d:3,m:1,y:5},{regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,d:5,m:3,y:1}],e,f=0;3>f;){e=
(f+(b?4:3))%3;if(a.match(c[e].regExp))return res=a.match(c[e].regExp),y=res[c[e].y],m=res[c[e].m],d=res[c[e].d],1==m.length&&(m="0"+m),1==d.length&&(d="0"+d),4!=y.length&&(y=50>parseInt(y)?"20"+y:"19"+y),""+y+m+d;f++}return 0},datePickers:b,hideAll:function(a){for(var c in b)b[c].created&&!b[c].staticPos&&(a&&a==b[c].id||document.getElementById(b[c].id)&&b[c].hide())}}}();datePickerController.addEvent(window,"load",datePickerController.create);datePickerController.addEvent(window,"unload",datePickerController.destroy);var LiveValidation=Class.create();Object.extend(LiveValidation,{VERSION:"1.3 prototype",TEXTAREA:1,TEXT:2,PASSWORD:3,CHECKBOX:4,SELECT:5,FILE:6,massValidate:function(b){for(var a=!0,c=0,f=b.length;c<f;++c){var e=b[c].validate();a&&(a=e)}return a}});
LiveValidation.prototype={validClass:"LV_valid",invalidClass:"LV_invalid",messageClass:"LV_validation_message",validFieldClass:"LV_valid_field",invalidFieldClass:"LV_invalid_field",initialize:function(b,a){if(!b)throw Error("LiveValidation::initialize - No element reference or element id has been provided!");this.element=$(b);if(!this.element)throw Error("LiveValidation::initialize - No element with reference or id of '"+b+"' exists!");this.elementType=this.getElementType();this.validations=[];this.form=
this.element.form;this.options=Object.extend({validMessage:"Thankyou!",onValid:function(){this.insertMessage(this.createMessageSpan());this.addFieldClass()},onInvalid:function(){this.insertMessage(this.createMessageSpan());this.addFieldClass()},insertAfterWhatNode:this.element,onlyOnBlur:!1,wait:0,onlyOnSubmit:!1},a||{});this.options.insertAfterWhatNode=$(this.options.insertAfterWhatNode||this.element);Object.extend(this,this.options);if(this.form)this.formObj=LiveValidationForm.getInstance(this.form),
this.formObj.addField(this);this.boundFocus=this.doOnFocus.bindAsEventListener(this);Event.observe(this.element,"focus",this.boundFocus);if(!this.onlyOnSubmit)switch(this.elementType){case LiveValidation.CHECKBOX:this.boundClick=this.validate.bindAsEventListener(this),Event.observe(this.element,"click",this.boundClick);case LiveValidation.SELECT:case LiveValidation.FILE:this.boundChange=this.validate.bindAsEventListener(this);Event.observe(this.element,"change",this.boundChange);break;default:if(!this.onlyOnBlur)this.boundKeyup=
this.deferValidation.bindAsEventListener(this),Event.observe(this.element,"keyup",this.boundKeyup);this.boundBlur=this.validate.bindAsEventListener(this);Event.observe(this.element,"blur",this.boundBlur)}},destroy:function(){this.formObj&&(this.formObj.removeField(this),this.formObj.destroy());Event.stopObserving(this.element,"focus",this.boundFocus);if(!this.onlyOnSubmit)switch(this.elementType){case LiveValidation.CHECKBOX:Event.stopObserving(this.element,"click",this.boundClick);case LiveValidation.SELECT:case LiveValidation.FILE:Event.stopObserving(this.element,
"change",this.boundChange);break;default:this.onlyOnBlur||Event.stopObserving(this.element,"keyup",this.boundKeyup),Event.stopObserving(this.element,"blur",this.boundBlur)}this.validations=[];this.removeMessageAndFieldClass()},add:function(b,a){this.validations.push({type:b,params:a||{}});return this},remove:function(b,a){this.validations=this.validations.reject(function(c){return c.type==b&&c.params==a});return this},deferValidation:function(){300<=this.wait&&this.removeMessageAndFieldClass();this.timeout&&
clearTimeout(this.timeout);this.timeout=setTimeout(this.validate.bind(this),this.wait)},doOnBlur:function(){this.focused=!1;this.validate()},doOnFocus:function(){this.focused=!0;this.removeMessageAndFieldClass()},getElementType:function(){switch(!0){case "TEXTAREA"==this.element.nodeName.toUpperCase():return LiveValidation.TEXTAREA;case "INPUT"==this.element.nodeName.toUpperCase()&&"TEXT"==this.element.type.toUpperCase():return LiveValidation.TEXT;case "INPUT"==this.element.nodeName.toUpperCase()&&
"PASSWORD"==this.element.type.toUpperCase():return LiveValidation.PASSWORD;case "INPUT"==this.element.nodeName.toUpperCase()&&"CHECKBOX"==this.element.type.toUpperCase():return LiveValidation.CHECKBOX;case "INPUT"==this.element.nodeName.toUpperCase()&&"FILE"==this.element.type.toUpperCase():return LiveValidation.FILE;case "SELECT"==this.element.nodeName.toUpperCase():return LiveValidation.SELECT;case "INPUT"==this.element.nodeName.toUpperCase():throw Error("LiveValidation::getElementType - Cannot use LiveValidation on an "+
this.element.type+" input!");default:throw Error("LiveValidation::getElementType - Element must be an input, select, or textarea!");}},doValidations:function(){this.validationFailed=!1;for(var b=0,a=this.validations.length;b<a;++b){var c=this.validations[b];switch(c.type){case Validate.Presence:case Validate.Confirmation:case Validate.Acceptance:this.displayMessageWhenEmpty=!0;this.validationFailed=!this.validateElement(c.type,c.params);break;default:this.validationFailed=!this.validateElement(c.type,
c.params)}if(this.validationFailed)return!1}this.message=this.validMessage;return!0},validateElement:function(b,a){var c=this.elementType==LiveValidation.SELECT?this.element.options[this.element.selectedIndex].value:this.element.value;if(b==Validate.Acceptance){if(this.elementType!=LiveValidation.CHECKBOX)throw Error("LiveValidation::validateElement - Element to validate acceptance must be a checkbox!");c=this.element.checked}var f=!0;try{b(c,a)}catch(e){if(e instanceof Validate.Error){if(""!==c||
""===c&&this.displayMessageWhenEmpty)this.validationFailed=!0,this.message=e.message,f=!1}else throw e;}finally{return f}},validate:function(){if(this.element.disabled)return!0;if(this.doValidations())return this.onValid(),!0;this.onInvalid();return!1},enable:function(){this.element.disabled=!1;return this},disable:function(){this.element.disabled=!0;this.removeMessageAndFieldClass();return this},createMessageSpan:function(){var b=document.createElement("span"),a=document.createTextNode(this.message);
b.appendChild(a);return b},insertMessage:function(b){this.removeMessage();var a=this.validationFailed?this.invalidClass:this.validClass;if(this.displayMessageWhenEmpty&&(this.elementType==LiveValidation.CHECKBOX||""==this.element.value)||""!=this.element.value)$(b).addClassName(this.messageClass+(" "+a)),(nxtSibling=this.insertAfterWhatNode.nextSibling)?this.insertAfterWhatNode.parentNode.insertBefore(b,nxtSibling):this.insertAfterWhatNode.parentNode.appendChild(b)},addFieldClass:function(){this.removeFieldClass();
if(this.validationFailed)this.element.hasClassName(this.invalidFieldClass)||this.element.addClassName(this.invalidFieldClass);else if(this.displayMessageWhenEmpty||""!=this.element.value)this.element.hasClassName(this.validFieldClass)||this.element.addClassName(this.validFieldClass)},removeMessage:function(){(nxtEl=this.insertAfterWhatNode.next("."+this.messageClass))&&nxtEl.remove()},removeFieldClass:function(){this.element.removeClassName(this.invalidFieldClass);this.element.removeClassName(this.validFieldClass)},
removeMessageAndFieldClass:function(){this.removeMessage();this.removeFieldClass()}};var LiveValidationForm=Class.create();Object.extend(LiveValidationForm,{instances:{},getInstance:function(b){var a=Math.random()*Math.random();if(!b.id)b.id="formId_"+a.toString().replace(/\./,"")+(new Date).valueOf();LiveValidationForm.instances[b.id]||(LiveValidationForm.instances[b.id]=new LiveValidationForm(b));return LiveValidationForm.instances[b.id]}});
LiveValidationForm.prototype={initialize:function(b){this.element=$(b);this.fields=[];this.oldOnSubmit=this.element.onsubmit||function(){};this.element.onsubmit=function(a){LiveValidation.massValidate(this.fields)&&!1!==this.oldOnSubmit.call(this.element,a)||Event.stop(a)}.bindAsEventListener(this)},addField:function(b){this.fields.push(b)},removeField:function(b){this.fields=this.fields.without(b)},destroy:function(b){if(0!=this.fields.length&&!b)return!1;this.element.onsubmit=this.oldOnSubmit;LiveValidationForm.instances[this.element.id]=
null;return!0}};
var Validate={Presence:function(b,a){var c=Object.extend({failureMessage:"Can't be empty!"},a||{});(""===b||null===b||void 0===b)&&Validate.fail(c.failureMessage);return!0},Numericality:function(b,a){var c=b,b=Number(b),a=a||{},f=a.notANumberMessage||"Must be a number!",e=a.notAnIntegerMessage||"Must be an integer!",h=a.wrongNumberMessage||"Must be "+a.is+"!",g=a.tooLowMessage||"Must not be less than "+a.minimum+"!",j=a.tooHighMessage||"Must not be more than "+a.maximum+"!",s=a.is||0==a.is?a.is:null,
k=a.minimum||0==a.minimum?a.minimum:null,l=a.maximum||0==a.maximum?a.maximum:null,n=a.onlyInteger||!1;isFinite(b)||Validate.fail(f);n&&(/\.0+$|\.$/.test(""+c)||b!=parseInt(b))&&Validate.fail(e);switch(!0){case null!==s:b!=Number(s)&&Validate.fail(h);break;case null!==k&&null!==l:Validate.Numericality(b,{tooLowMessage:g,minimum:k});Validate.Numericality(b,{tooHighMessage:j,maximum:l});break;case null!==k:b<Number(k)&&Validate.fail(g);break;case null!==l:b>Number(l)&&Validate.fail(j)}return!0},Format:function(b,
a){var b=""+b,c=Object.extend({failureMessage:"Not valid!",pattern:/./,negate:!1},a||{});!c.negate&&!c.pattern.test(b)&&Validate.fail(c.failureMessage);c.negate&&c.pattern.test(b)&&Validate.fail(c.failureMessage);return!0},Email:function(b,a){var c=Object.extend({failureMessage:"Must be a valid email address!"},a||{});Validate.Format(b,{failureMessage:c.failureMessage,pattern:/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i});return!0},Length:function(b,a){var b=""+b,a=a||{},c=a.wrongLengthMessage||"Must be "+
a.is+" characters long!",f=a.tooShortMessage||"Must not be less than "+a.minimum+" characters long!",e=a.tooLongMessage||"Must not be more than "+a.maximum+" characters long!",h=a.is||0==a.is?a.is:null,g=a.minimum||0==a.minimum?a.minimum:null,j=a.maximum||0==a.maximum?a.maximum:null;switch(!0){case null!==h:b.length!=Number(h)&&Validate.fail(c);break;case null!==g&&null!==j:Validate.Length(b,{tooShortMessage:f,minimum:g});Validate.Length(b,{tooLongMessage:e,maximum:j});break;case null!==g:b.length<
Number(g)&&Validate.fail(f);break;case null!==j:b.length>Number(j)&&Validate.fail(e);break;default:throw Error("Validate::Length - Length(s) to validate against must be provided!");}return!0},Inclusion:function(b,a){var c=Object.extend({failureMessage:"Must be included in the list!",within:[],allowNull:!1,partialMatch:!1,caseSensitive:!0,negate:!1},a||{});if(c.allowNull&&null==b)return!0;!c.allowNull&&null==b&&Validate.fail(c.failureMessage);if(!c.caseSensitive){var f=[];c.within.each(function(a){"string"==
typeof a&&(a=a.toLowerCase());f.push(a)});c.within=f;"string"==typeof b&&(b=b.toLowerCase())}var e=-1==c.within.indexOf(b)?!1:!0;c.partialMatch&&(e=!1,c.within.each(function(a){-1!=b.indexOf(a)&&(e=!0)}));(!c.negate&&!e||c.negate&&e)&&Validate.fail(c.failureMessage);return!0},Exclusion:function(b,a){var c=Object.extend({failureMessage:"Must not be included in the list!",within:[],allowNull:!1,partialMatch:!1,caseSensitive:!0},a||{});c.negate=!0;Validate.Inclusion(b,c);return!0},Confirmation:function(b,
a){if(!a.match)throw Error("Validate::Confirmation - Error validating confirmation: Id of element to match must be provided!");var c=Object.extend({failureMessage:"Does not match!",match:null},a||{});c.match=$(a.match);if(!c.match)throw Error("Validate::Confirmation - There is no reference with name of, or element with id of '"+c.match+"'!");b!=c.match.value&&Validate.fail(c.failureMessage);return!0},Acceptance:function(b,a){var c=Object.extend({failureMessage:"Must be accepted!"},a||{});b||Validate.fail(c.failureMessage);
return!0},Custom:function(b,a){var c=Object.extend({against:function(){return!0},args:{},failureMessage:"Not valid!"},a||{});c.against(b,c.args)||Validate.fail(c.failureMessage);return!0},now:function(b,a,c){if(!b)throw Error("Validate::now - Validation function must be provided!");var f=!0;try{b(a,c||{})}catch(e){if(e instanceof Validate.Error)f=!1;else throw e;}finally{return f}},Error:function(b){this.message=b;this.name="ValidationError"},fail:function(b){throw new Validate.Error(b);}};var invalidValidations=[],MyValidation=Class.create(LiveValidation,{initialize:function($super,a,c){$super(a,Object.extend(c,{validMessage:"",onlyOnBlur:!0,onInvalid:function(){invalidValidations.push(this);this.addFieldClass();if(Object.isUndefined(this.msgBox.forElement)||this.msgBox.forElement==this.element)this.msgBox.appear({duration:0.3}),this.msgBoxText.innerHTML=this.message,this.msgBox.forElement=this.element,this.positionMsgBox()},positionMsgBox:function(){this.boxHeight=this.msgBox.getDimensions().height;
this.element.getOffsetParent().viewportOffset();new Effect.Move(this.msgBox,{x:this.element.positionedOffset().left-15,y:this.element.positionedOffset().top-this.boxHeight+2,mode:"absolute",duration:0.3,afterFinish:this.checkForRepositioning.bind(this)})},checkForRepositioning:function(){this.boxHeight!=this.msgBox.getDimensions().height&&this.positionMsgBox()},onValid:function(){invalidValidations=invalidValidations.without(this);if(this.msgBox.forElement==this.element)this.msgBox.forElement=void 0;
this.addFieldClass();invalidValidations.each(function(a){if(!a.validate())throw $break;});0==invalidValidations.length&&this.hideMsgBox()},doOnFocus:function(){this.wasEverFocused=this.focused=!0}}));this.msgBox=$("validation_box");Event.observe(this.msgBox,"click",this.hideMsgBox.bind(this));this.msgBoxText=$("validation_box_text");this.form.onsubmit=this.onSubmit.bindAsEventListener(this)},hideMsgBox:function(){this.msgBox.fade({duration:0.3})},onSubmit:function(b){if(!this.alreadyTriedToSubmit&&
!LiveValidation.massValidate(this.formObj.fields))this.alreadyTriedToSubmit=!0,window.alert("Wir ben\u00f6tigen mehr Informationen um Ihr Angebot erstellen k\u00f6nnen. \nBitte \u00fcberpr\u00fcfen Sie Ihre Eingaben, bevor Sie Ihre Anfrage senden."),Event.stop(b),new Effect.ScrollTo(this.msgBox)}});
function makeRequired(b,a,c){var f=$(b);Element.addClassName(f,"required");Element.addClassName($("label_"+b),"required");b=new MyValidation(b,{});b.add(Validate.Presence,{failureMessage:c?"<b>Bitte geben Sie "+a+" ein.</b>":a});return b}
Validate.Date=function(b,a){var c=Object.extend({failureMessage:"<b>Bitte geben Sie ein g\u00fcltiges Datum ein.</b>"},a||{});if(this.element.prompt==b||""==b)return!0;var f=Date.parse(b);null==f&&Validate.fail(c.failureMessage);this.element.value=f.toString("dd.MM.yyyy");null!=c.notBefore&&0>f.compareTo(c.notBefore)&&Validate.fail(c.notBeforeMsg);return!0};function setUpFocusHilighting(b){Event.observe(b,"focus",function(a){a.element().addClassName("focused")});Event.observe(b,"blur",function(a){a.element().removeClassName("focused")})}function setUpFoldableSection(b,a){if("1"!=$(b).value)$(a).style.display="none";Event.observe(b,"change",function(){"1"==this.value?$(a).style.display="block":$(a).style.display="none"})}
function isInViewPort(b){x1=document.viewport.getScrollOffsets().left;x2=document.viewport.getWidth()+document.viewport.getScrollOffsets().left;y1=document.viewport.getScrollOffsets().top;y2=document.viewport.getHeight()+document.viewport.getScrollOffsets().top;px=b.cumulativeOffset().left;py=b.cumulativeOffset().top;return px>=x1&&px<=x2&&py>=y1&&py<=y2?!0:!1}
function initialize(){setUpFoldableSection("from_cleanup","reinigung");setUpFoldableSection("storage","lagerung");setUpFoldableSection("survey","umfrage");Event.observe($("items_to_dismantle"),"change",function(){if(""==$("items_to_assemble").value)$("items_to_assemble").value=$("items_to_dismantle").value});Event.observe(window,"scroll",function(){if(isInViewPort($("customer_first_name"))&&!$("request").initialized)$("request").focusFirstElement(),$("request").initialized=!0});formfields=$("request").getElements();
for(i=0;i<formfields.length;i++)setUpFocusHilighting(formfields[i]);makeDateField("up_relocation_date",{notBefore:Date.today(),notBeforeMsg:"<b>Dieses Datum liegt in der Vergangenheit.</b><br>Wir k\u00f6nnen Ihre Umsiedlung leider fr\u00fchestens heute vornehmen."});makeDateField("up_decision_date");makeDateField("up_storage_from");makeDateField("up_from_last_cleanup");makeRequired("customer_first_name","Ihren Vornamen",!0);autoCapitalize("customer_first_name");makeRequired("customer_last_name","Ihren Nachnamen",
!0);autoCapitalize("customer_last_name");makeRequired("customer_phone","<b>Bitte geben Sie eine Telefonnummer ein, unter der wir Sie bei R\u00fcckfragen erreichen k\u00f6nnen.</b>");makeRequired("customer_ac","<b>Bitte geben Sie eine Telefonnummer ein, unter der wir Sie bei R\u00fcckfragen erreichen k\u00f6nnen.</b>");makeRequired("customer_mail","Ihre E-Mail Adresse",!0).add(Validate.Email,{failureMessage:"<b>Bitte \u00fcberpr\u00fcfen Sie die E-Mail Adresse.</b><br/>Die eingegebene Adresse scheint nicht g\u00fcltig zu sein."});
enableAutocompletion("from_street","from_postal_code","from_city","from_number_of_rooms");enableAutocompletion("to_street","to_postal_code","to_city","to_walking_distance");showOnlyWhen("from_floor","from_elevator",isElevetorRelevant);showOnlyWhen("to_floor","to_elevator",isElevetorRelevant);$("customer_phone").onfocus=function(){Form.Element.select(this)}}function isElevetorRelevant(b){return!b.value.empty()&&"0"!=b.value}
function autoCapitalize(b){Event.observe(b,"blur",function(){var a=$(b);a.value=capitalizeParts(capitalizeParts(a.value," "),"-")})}function capitalizeParts(b,a){var c="";b.split(a).each(function(b){c+=b.substring(0,1).toUpperCase()+b.substring(1)+a});return c.substring(0,c.length-1)}function showOnlyWhen(b,a,c){function f(){c($(b))?($("label_"+a).show(),$(a).show()):($("label_"+a).hide(),$(a).hide())}Event.observe(b,"change",f);f()}
function makeDateField(b,a){setPrompt(b,"TT.MM.JJ");var c=new MyValidation(b,{});c.add(Validate.Date.bind(c),a);!Object.isUndefined(a)&&!Object.isUndefined(a.notBefore)&&(c=datePickerController.datePickers[b],Object.isUndefined(c)&&(datePickerController.create(),c=datePickerController.datePickers[b]),c.setRangeLow(a.notBefore.toString("yyyyMMdd")))}
function setPrompt(b,a){var c=$(b);c.prompt=a;c.value=a;c.addClassName("prompt");Event.observe(c,"focus",function(){if(c.value==c.prompt)this.value="",this.removeClassName("prompt")});Event.observe(c,"blur",function(){this.value.toString().empty()?(this.value=this.prompt,this.addClassName("prompt")):this.removeClassName("prompt")})}function scrollIntoViewIfNecessary(b,a){isInVerticalView(b,a)||b.scrollIntoView(a)}
function isInVerticalView(b,a){var c=document.viewport.getScrollOffsets().top,f=c+(Prototype.Browser.IE?document.documentElement.clientHeight:window.innerHeight),e=b.cumulativeOffset().top;a||(e+=b.offsetHeight);return a?e>c:e<f}
BetterAutocompleter=Class.create(Ajax.Autocompleter,{initialize:function($super,a,c,f,e){$super(a,c,f,e)},markPrevious:function(){0<this.index?this.index--:this.index=this.entryCount-1;scrollIntoViewIfNecessary(this.getEntry(this.index),!0)},markNext:function(){this.index<this.entryCount-1?this.index++:this.index=0;scrollIntoViewIfNecessary(this.getEntry(this.index),!1)}});
function enableAutocompletion(b,a,c,f){new BetterAutocompleter(a,"autocomplete_choices","fileadmin/ajax/postalcodes_cities.php",{updateElement:function(b){selectedPLZ=b.innerHTML.toString().slice(0,4);selectedOrt=b.innerHTML.toString().slice(5);$(a).value=selectedPLZ;$(c).value=selectedOrt;null!=f&&$(f).focus()},onShow:function(a,b){var f=$(c);if(!b.style.position||"absolute"==b.style.position)b.style.position="absolute",Element.clonePosition(b,a,{setHeight:!1,setWidth:!1,offsetTop:a.offsetHeight}),
b.style.width=f.offsetLeft+Element.getWidth(f)-a.offsetLeft+"px";Effect.Appear(b,{duration:0.15})},paramName:"postalCode"});new BetterAutocompleter(b,"autocomplete_choices","fileadmin/ajax/streets.php",{updateElement:function(a){selectedStreet=a.innerHTML.toString();$(b).value=selectedStreet+" "},paramName:"street"});new BetterAutocompleter(c,"autocomplete_choices","fileadmin/ajax/cities.php",{paramName:"city"})}Event.observe(window,"load",function(){initialize()});
