-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.js
1 lines (1 loc) · 59.9 KB
/
date.js
1
(function(e){e.widget("mobile.datebox",{initSelector:"input[data-role='datebox']",options:{version:"3-1.4.5-01",theme:false,themeDefault:"a",themeHeader:"a",themeSetButton:"a",mode:false,transition:"fade",useAnimation:true,hideInput:false,hideContainer:false,lockInput:true,zindex:"1100",clickEvent:"vclick",clickEventAlt:"click",defaultValue:false,showInitialValue:false,popupPosition:false,popupForceX:false,popupForceY:false,useModal:true,useModalTheme:"b",useInline:false,useInlineBlind:false,useHeader:true,useImmediate:false,useButton:true,buttonIcon:false,buttonIconDate:"calendar",buttonIconTime:"clock",useFocus:false,useClearButton:false,useCollapsedBut:false,usePlaceholder:false,beforeOpenCallback:false,beforeOpenCallbackArgs:[],openCallback:false,openCallbackArgs:[],closeCallback:false,closeCallbackArgs:[],startOffsetYears:false,startOffsetMonths:false,startOffsetDays:false,afterToday:false,beforeToday:false,notToday:false,maxDays:false,minDays:false,maxYear:false,minYear:false,blackDates:false,blackDatesRec:false,blackDays:false,whiteDates:true,minHour:false,maxHour:false,minuteStep:1,minuteStepRound:0,rolloverMode:{m:true,d:true,h:true,i:true,s:true},useLang:"default",lang:{"default":{setDateButtonLabel:"Set Date",setTimeButtonLabel:"Set Time",setDurationButtonLabel:"Set Duration",calTodayButtonLabel:"Jump to Today",calTomorrowButtonLabel:"Jump to Tomorrow",titleDateDialogLabel:"Set Date",titleTimeDialogLabel:"Set Time",daysOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysOfWeekShort:["Su","Mo","Tu","We","Th","Fr","Sa"],monthsOfYear:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsOfYearShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],durationLabel:["Days","Hours","Minutes","Seconds"],durationDays:["Day","Days"],timeFormat:24,headerFormat:"%A, %B %-d, %Y",tooltip:"Open Date Picker",nextMonth:"Next Month",prevMonth:"Previous Month",dateFieldOrder:["m","d","y"],timeFieldOrder:["h","i","a"],slideFieldOrder:["y","m","d"],dateFormat:"%Y-%m-%d",useArabicIndic:false,isRTL:false,calStartDay:0,clearButton:"Clear",durationOrder:["d","h","i","s"],meridiem:["AM","PM"],timeOutput:"%k:%M",durationFormat:"%Dd %DA, %Dl:%DM:%DS",calDateListLabel:"Other Dates",calHeaderFormat:"%B %Y"}}},_enhanceDate:function(){e.extend(this._date.prototype,{copy:function(t,n){t=e.extend([0,0,0,0,0,0,0],t);n=e.extend([0,0,0,0,0,0,0],n);return new Date(n[0]>0?n[0]:this.get(0)+t[0],n[1]>0?n[1]:this.get(1)+t[1],n[2]>0?n[2]:this.get(2)+t[2],n[3]>0?n[3]:this.get(3)+t[3],n[4]>0?n[4]:this.get(4)+t[4],n[5]>0?n[5]:this.get(5)+t[5],n[6]>0?n[5]:this.get(6)+t[6])},adj:function(e,t){if(typeof t!=="number"||typeof e!=="number"){throw new Error("Invalid Arguments")}switch(e){case 0:this.setD(0,this.get(0)+t);break;case 1:this.setD(1,this.get(1)+t);break;case 2:this.setD(2,this.get(2)+t);break;case 3:t*=60;case 4:t*=60;case 5:t*=1e3;case 6:this.setTime(this.getTime()+t);break}return this},setD:function(e,t){switch(e){case 0:this.setFullYear(t);break;case 1:this.setMonth(t);break;case 2:this.setDate(t);break;case 3:this.setHours(t);break;case 4:this.setMinutes(t);break;case 5:this.setSeconds(t);break;case 6:this.setMilliseconds(t);break}return this},get:function(e){switch(e){case 0:return this.getFullYear();case 1:return this.getMonth();case 2:return this.getDate();case 3:return this.getHours();case 4:return this.getMinutes();case 5:return this.getSeconds();case 6:return this.getMilliseconds()}return false},get12hr:function(){if(this.get(3)===0){return 12}if(this.get(3)<13){return this.get(3)}return this.get(3)-12},iso:function(){var e=[0,0,0],t=0;for(t=0;t<3;t++){e[t]=this.get(t);if(t===1){e[t]++}if(e[t]<10){e[t]="0"+String(e[t])}}return e.join("-")},comp:function(){return parseInt(this.iso().replace(/-/g,""),10)},getEpoch:function(){return Math.floor(this.getTime()/1e3)},getArray:function(){var e=[0,0,0,0,0,0],t=0;for(t=0;t<6;t++){e[t]=this.get(t)}return e},setFirstDay:function(e){this.setD(2,1).adj(2,e-this.getDay());if(this.get(2)>10){this.adj(2,7)}return this},setDWeek:function(e,t){if(e===4){return this.setD(1,0).setD(2,1).setFirstDay(4).adj(2,-3).adj(2,(t-1)*7)}return this.setD(1,0).setD(2,1).setFirstDay(e).adj(2,(t-1)*7)},getDWeek:function(e){var t,n;switch(e){case 0:t=this.copy([0,-1*this.getMonth()]).setFirstDay(0);return Math.floor((this.getTime()-(t.getTime()+(this.getTimezoneOffset()-t.getTimezoneOffset())*6e4))/6048e5)+1;case 1:t=this.copy([0,-1*this.getMonth()]).setFirstDay(1);return Math.floor((this.getTime()-(t.getTime()+(this.getTimezoneOffset()-t.getTimezoneOffset())*6e4))/6048e5)+1;case 4:if(this.getMonth()===11&&this.getDate()>28){return 1}t=this.copy([0,-1*this.getMonth()],true).setFirstDay(4).adj(2,-3);n=Math.floor((this.getTime()-(t.getTime()+(this.getTimezoneOffset()-t.getTimezoneOffset())*6e4))/6048e5)+1;if(n<1){t=this.copy([-1,-1*this.getMonth()]).setFirstDay(4).adj(2,-3);return Math.floor((this.getTime()-t.getTime())/6048e5)+1}return n;default:return 0}}})},_event:function(t,n){var r,i=e(this).data("mobile-datebox");if(!t.isPropagationStopped()){switch(n.method){case"close":i.close();break;case"open":i.open();break;case"set":if(typeof n.value==="object"){i.theDate=n.value;i._t({method:"doset"})}else{e(this).val(n.value);e(this).trigger("change")}break;case"doset":r="_"+i.options.mode+"DoSet";if(e.isFunction(i[r])){i[r].apply(i,[])}else{i._t({method:"set",value:i._formatter(i.__fmt(),i.theDate),date:i.theDate})}break;case"dooffset":if(n.type){i._offset(n.type,n.amount,true)}break;case"dorefresh":i.refresh();break;case"doclear":e(this).val("").trigger("change");break;case"clear":e(this).trigger("change");break}}},_ord:{"default":function(e){var t=e%10;if(e>9&&e<21||t>3){return"th"}return["th","st","nd","rd"][t]}},_dur:function(t){var n=[t/(60*60*1e3*24),t/(60*60*1e3)%24,t/(60*1e3)%60,t/1e3%60];e.each(n,function(e,t){n[e]=parseInt(t,10)});return n},_gridblk:{g:[0,0,"a","b","c","d","e"],b:["a","b","c","d","e","f"]},__:function(e){var t=this.options,n=t.lang[t.useLang],r=t[t.mode+"lang"],i="override"+e.charAt(0).toUpperCase()+e.slice(1);if(typeof t[i]!=="undefined"){return t[i]}if(typeof n[e]!=="undefined"){return n[e]}if(typeof r!=="undefined"&&typeof r[e]!=="undefined"){return r[e]}return t.lang["default"][e]},__fmt:function(){var e=this,t=this.options;if(typeof e.fmtOver!=="undefined"&&e.fmtOver!==false){return e.fmtOver}switch(t.mode){case"timebox":case"timeflipbox":return e.__("timeOutput");case"durationbox":case"durationflipbox":return e.__("durationFormat");default:return e.__("dateFormat")}},_zPad:function(e,t){if(typeof t!=="undefined"&&t==="-"){return String(e)}return(e<10?"0":"")+String(e)},_dRep:function(e,t){var n,r,i=48,s=57,o=1584,u="";if(t===-1){i+=o;s+=o;o=-1584}for(r=0;r<e.length;r++){n=e.charCodeAt(r);if(n>=i&&n<=s){u=u+String.fromCharCode(n+o)}else{u=u+String.fromCharCode(n)}}return u},_doIndic:function(){var t=this;t.d.intHTML.find("*").each(function(){if(e(this).children().length<1){e(this).text(t._dRep(e(this).text()))}else if(e(this).hasClass("ui-datebox-slideday")){e(this).html(t._dRep(e(this).html()))}});t.d.intHTML.find("input").each(function(){e(this).val(t._dRep(e(this).val()))})},_parser:{"default":function(){return false}},_n:function(e,t){return e<0?t:e},_pa:function(e,t){if(typeof t==="boolean"){return new this._date(e[0],e[1],e[2],0,0,0,0)}return new this._date(t.get(0),t.get(1),t.get(2),e[0],e[1],e[2],0)},_makeDate:function(t){var n,r,i,s,o=this,u=this.options,a=this.options.defaultValue,f=o.__fmt(),l=null,c=[],h=new o._date,p={year:-1,mont:-1,date:-1,hour:-1,mins:-1,secs:-1,week:false,wtyp:4,wday:false,yday:false,meri:0};t=e.trim(o.__("useArabicIndic")===true?o._dRep(t,-1):t);if(typeof u.mode==="undefined"){return h}if(typeof o._parser[u.mode]!=="undefined"){return o._parser[u.mode].apply(o,[t])}if(u.mode==="durationbox"||u.mode==="durationflipbox"){f=f.replace(/%D([a-z])/gi,function(e,t){switch(t){case"d":case"l":case"M":case"S":return"("+e+"|[0-9]+)";default:return".+?"}});f=new RegExp("^"+f+"$");l=f.exec(t);i=f.exec(o.__fmt());if(l===null||l.length!==i.length){if(typeof a==="number"&&a>0){return new o._date((o.initDate.getEpoch()+parseInt(a,10))*1e3)}return new o._date(o.initDate.getTime())}r=o.initDate.getEpoch();for(n=1;n<l.length;n++){s=parseInt(l[n],10);if(i[n].match(/^%Dd$/i)){r=r+s*86400}if(i[n].match(/^%Dl$/i)){r=r+s*3600}if(i[n].match(/^%DM$/i)){r=r+s*60}if(i[n].match(/^%DS$/i)){r=r+s}}return new o._date(r*1e3)}f=f.replace(/%(0|-)*([a-z])/gi,function(e,t,n){c.push(n);switch(n){case"p":case"P":case"b":case"B":return"("+e+"|.+?)";case"H":case"k":case"I":case"l":case"m":case"M":case"S":case"V":case"U":case"u":case"W":case"d":return"("+e+"|[0-9]{"+(t==="-"?"1,":"")+"2})";case"j":return"("+e+"|[0-9]{3})";case"s":return"("+e+"|[0-9]+)";case"g":case"y":return"("+e+"|[0-9]{2})";case"E":case"G":case"Y":return"("+e+"|[0-9]{1,4})";default:c.pop();return".+?"}});f=new RegExp("^"+f+"$");l=f.exec(t);i=f.exec(o.__fmt());if(l===null||l.length!==i.length){if(a!==false){switch(typeof a){case"object":if(e.isFunction(a.getDay)){h=a}else{if(a.length===3){h=o._pa(a,u.mode.substr(0,4)==="time"?h:false)}}break;case"number":h=new o._date(a*1e3);break;case"string":if(u.mode.substr(0,4)==="time"){r=e.extend([0,0,0],a.split(":")).slice(0,3);h=o._pa(r,h)}else{r=e.extend([0,0,0],a.split("-")).slice(0,3);r[1]--;h=o._pa(r,false)}break}}if(isNaN(h.getDate())){h=new o._date}}else{for(n=1;n<l.length;n++){s=parseInt(l[n],10);switch(c[n-1]){case"s":return new o._date(parseInt(l[n],10)*1e3);case"Y":case"G":p.year=s;break;case"E":p.year=s-543;break;case"y":case"g":if(u.afterToday||s<38){p.year=2e3+s}else{p.year=1900+s}break;case"m":p.mont=s-1;break;case"d":p.date=s;break;case"H":case"k":case"I":case"l":p.hour=s;break;case"M":p.mins=s;break;case"S":p.secs=s;break;case"u":p.wday=s-1;break;case"w":p.wday=s;break;case"j":p.yday=s;break;case"V":p.week=s;p.wtyp=4;break;case"U":p.week=s;p.wtyp=0;break;case"W":p.week=s;p.wtyp=1;break;case"p":case"P":s=new RegExp("^"+l[n]+"$","i");p.meri=s.test(o.__("meridiem")[0])?-1:1;break;case"b":r=e.inArray(l[n],o.__("monthsOfYearShort"));if(r>-1){p.mont=r}break;case"B":r=e.inArray(l[n],o.__("monthsOfYear"));if(r>-1){p.mont=r}break}}if(p.meri!==0){if(p.meri===-1&&p.hour===12){p.hour=0}if(p.meri===1&&p.hour!==12){p.hour=p.hour+12}}h=new o._date(o._n(p.year,0),o._n(p.mont,0),o._n(p.date,1),o._n(p.hour,0),o._n(p.mins,0),o._n(p.secs,0),0);if(p.year<100&&p.year!==-1){h.setFullYear(p.year)}if(p.mont>-1&&p.date>-1||p.hour>-1&&p.mins>-1&&p.secs>-1){return h}if(p.week!==false){h.setDWeek(p.wtyp,p.week);if(p.date>-1){h.setDate(p.date)}}if(p.yday!==false){h.setD(1,0).setD(2,1).adj(2,p.yday-1)}if(p.wday!==false){h.adj(2,p.wday-h.getDay())}}return h},_customformat:{"default":function(){return false}},_formatter:function(e,t){var n=this,r=this.options,i,s=0;if(r.mode.substr(0,4)==="dura"){s=n._dur(this.theDate.getTime()-this.initDate.getTime());if(!e.match(/%Dd/)){s[1]+=s[0]*24}if(!e.match(/%Dl/)){s[2]+=s[1]*60}if(!e.match(/%DM/)){s[3]+=s[2]*60}}e=e.replace(/%(D|X|0|-)*([1-9a-zA-Z])/g,function(e,u,a){if(u==="X"){if(typeof n._customformat[r.mode]!=="undefined"){return n._customformat[r.mode](a,t,r)}return e}if(u==="D"){switch(a){case"d":return s[0];case"l":return n._zPad(s[1]);case"M":return n._zPad(s[2]);case"S":return n._zPad(s[3]);case"A":return n.__("durationDays")[s[0]===1?0:1];default:return e}}switch(a){case"a":return n.__("daysOfWeekShort")[t.getDay()];case"A":return n.__("daysOfWeek")[t.getDay()];case"b":return n.__("monthsOfYearShort")[t.getMonth()];case"B":return n.__("monthsOfYear")[t.getMonth()];case"C":return parseInt(t.getFullYear()/100);case"d":return n._zPad(t.getDate(),u);case"H":case"k":return n._zPad(t.getHours(),u);case"I":case"l":return n._zPad(t.get12hr(),u);case"m":return n._zPad(t.getMonth()+1,u);case"M":return n._zPad(t.getMinutes(),u);case"p":case"P":i=n.__("meridiem")[t.get(3)<12?0:1].toUpperCase();return a==="P"?i.toLowerCase():i;case"s":return t.getEpoch();case"S":return n._zPad(t.getSeconds(),u);case"u":return n._zPad(t.getDay()+1,u);case"w":return t.getDay();case"y":return n._zPad(t.getFullYear()%100);case"Y":return t.getFullYear();case"E":return t.getFullYear()+543;case"V":return n._zPad(t.getDWeek(4),u);case"U":return n._zPad(t.getDWeek(0),u);case"W":return n._zPad(t.getDWeek(1),u);case"o":if(typeof n._ord[r.useLang]!=="undefined"){return n._ord[r.useLang](t.getDate())}return n._ord["default"](t.getDate());case"j":i=new Date(t.getFullYear(),0,1);i="000"+String(Math.ceil((t-i)/864e5)+1);return i.slice(-3);case"G":i=t.getFullYear();if(t.getDWeek(4)===1&&t.getMonth()>0){return i+1}if(t.getDWeek(4)>51&&t.getMonth()<11){return i-1}return i;case"g":i=t.getFullYear%100;if(t.getDWeek(4)===1&&t.getMonth()>0){++i}if(t.getDWeek(4)>51&&t.getMonth()<11){--i}return n._zpad(i);default:return e}});if(n.__("useArabicIndic")===true){e=n._dRep(e)}return e},_btwn:function(e,t,n){return e>t&&e<n},_minStepFix:function(){var e=this.theDate.get(4),t=this.options.minuteStep,n=this.options.minStepRound,r=e%t;if(t>1&&r>0){if(n<0){e=e-r}else if(n>0){e=e+(t-r)}else{if(e%t<t/2){e=e-r}else{e=e+(t-r)}}this.theDate.setMinutes(e)}},_offset:function(t,n,r){var i=this,s=this.options,o=this.theDate,u=false;t=(t||"").toLowerCase();if(typeof r==="undefined"){r=true}if(t!=="a"&&(typeof s.rolloverMode[t]==="undefined"||s.rolloverMode[t]===true)){u=e.inArray(t,["y","m","d","h","i","s"])}else{switch(t){case"y":u=0;break;case"m":if(i._btwn(o.get(1)+n,-1,12)){u=1}break;case"d":if(i._btwn(o.get(2)+n,0,32-o.copy([0],[0,0,32,13]).get(3)+1)){u=2}break;case"h":if(i._btwn(o.get(3)+n,-1,24)){u=3}break;case"i":if(i._btwn(o.get(4)+n,-1,60)){u=4}break;case"s":if(i._btwn(o.get(5)+n,-1,60)){u=5}break;case"a":i._offset("h",(n>0?1:-1)*12,false);break}}if(u!==false){i.theDate.adj(u,n)}if(r===true){i.refresh()}if(s.useImmediate){i._t({method:"doset"})}i._t({method:"offset",type:t,amount:n,newDate:i.theDate})},_startOffset:function(e){var t=this.options;if(t.startOffsetYears!==false){e.adj(0,t.startOffsetYears)}if(t.startOffsetMonths!==false){e.adj(1,t.startOffsetMonths)}if(t.startOffsetDays!==false){e.adj(2,t.startOffsetDays)}return e},_destroy:function(){var t=this,n=this.options,r=this.d.wrap.find("a");t.d.wrap.removeClass("ui-input-has-clear");r.remove();if(n.lockInput){t.d.input.removeAttr("readonly")}t.d.input.off("datebox").off("focus.datebox").off("blur.datebox").off("change.datebox");e(document).off(t.drag.eMove).off(t.drag.eEnd).off(t.drag.eEndA)},_create:function(){e(document).trigger("dateboxcreate");var t=this,n=e.extend(this.options,this._getLongOptions(this.element),this.element.data("options")),r=n.theme===false?e.mobile.getInheritedTheme(this.element):n.theme,i=n.useAnimation?n.transition:"none",s={input:this.element,wrap:this.element.parent(),mainWrap:e("<div>",{"class":"ui-datebox-container ui-overlay-shadow "+"ui-corner-all ui-datebox-hidden "+i+" ui-body-"+r}).css("zIndex",n.zindex),intHTML:false},o=".datebox"+this.uuid,u=typeof window.ontouchstart!=="undefined",a={eStart:(u?"touchstart":"mousedown")+o,eMove:(u?"touchmove":"mousemove")+o,eEnd:(u?"touchend":"mouseup")+o,eEndA:u?["mouseup","touchend","touchcanel","touchmove"].join(o+" ")+o:"mouseup"+o,move:false,start:false,end:false,pos:false,target:false,delta:false,tmp:false};e.extend(t,{d:s,drag:a,touch:u});if(n.usePlaceholder!==false){if(n.usePlaceholder===true&&t._grabLabel()!==""){t.d.input.attr("placeholder",t._grabLabel())}if(typeof n.usePlaceholder==="string"){t.d.input.attr("placeholder",n.usePlaceholder)}}n.theme=r;t.disabled=false;t.runButton=false;t._date=window.Date;t._enhanceDate();t.baseID=t.d.input.attr("id");t.initDate=new t._date;t.initDate.setMilliseconds(0);t.theDate=n.defaultValue?t._makeDate():t.d.input.val()!==""?t._makeDate(t.d.input.val()):new t._date;if(t.d.input.val()===""){t._startOffset(t.theDate)}t.initDone=false;if(n.showInitialValue){t.d.input.val(t._formatter(t.__fmt(),t.theDate))}if(n.useButton){if(n.mode!==false){t.d.wrap.addClass("ui-input-has-clear");if(n.buttonIcon===false){if(n.mode.substr(0,4)==="time"||n.mode.substr(0,3)==="dur"){n.buttonIcon=n.buttonIconTime}else{n.buttonIcon=n.buttonIconDate}}e("<a href='#' class='ui-input-clear ui-btn ui-icon-"+n.buttonIcon+" ui-btn-icon-notext ui-corner-all'></a>").attr("title",t.__("tooltip")).text(t.__("tooltip")).appendTo(t.d.wrap).on(n.clickEvent,function(e){e.preventDefault();if(n.useFocus){t.d.input.focus()}else{if(!t.disabled){t._t({method:"open"})}}})}}if(n.hideInput){t.d.wrap.hide()}if(n.hideContainer){t.d.wrap.parent().hide()}t.d.input.on("focus.datebox",function(){t.d.input.addClass("ui-focus");if(t.disabled===false&&n.useFocus){t._t({method:"open"})}}).on("blur.datebox",function(){t.d.input.removeClass("ui-focus")}).on("change.datebox",function(){t.theDate=t._makeDate(t.d.input.val());t.refresh()}).on("datebox",t._event);if(n.lockInput){t.d.input.attr("readonly","readonly")}if(typeof e.event.special.mousewheel!=="undefined"){t.wheelExists=true}if(t.d.input.is(":disabled")){t.disable()}t.applyMinMax(false,false);if(n.useInline||n.useInlineBlind){t.open()}e(document).trigger("dateboxaftercreate")},applyMinMax:function(e,t){var n,r,i,s,o=this,u=this.options,a=new this._date,f=24*60*60*1e3;n=o._pa([0,0,0],a);if(typeof e==="undefined"){e=true}if(typeof t==="undefined"){t=true}if((t===true||u.minDays===false)&&typeof o.d.input.attr("min")!=="undefined"){r=o.d.input.attr("min").split("-");i=new o._date(r[0],r[1]-1,r[2],0,0,0,0);s=(i.getTime()-n.getTime())/f;u.minDays=parseInt(s*-1,10)+0}if((t===true||u.maxDays===false)&&typeof o.d.input.attr("max")!=="undefined"){r=o.d.input.attr("max").split("-");i=new o._date(r[0],r[1]-1,r[2],0,0,0,0);s=(i.getTime()-n.getTime())/f;u.maxDays=parseInt(s,10)-1}if(e===true){o._t({method:"refresh"})}},_build:{"default":function(){this.d.headerText="Error";if(this.d.intHTML!==false){this.d.intHTML.remove().empty()}this.d.intHTML=e("<div class='ui-body-b'><h2 style='text-align:center'>"+"Unknown Mode</h2></div>")}},_drag:{"default":function(){return false}},open:function(){var t=this,n=this.options,r={transition:n.useAnimation?n.transition:"none"},i={history:false,transition:n.useAnimation?n.transition:"none"};if(n.useFocus&&t.fastReopen===true){t.d.input.blur();return false}t.theDate=t._makeDate(t.d.input.val());if(t.d.input.val()===""){t._startOffset(t.theDate)}t.d.input.blur();if(typeof t._build[n.mode]==="undefined"){t._build["default"].apply(t,[])}else{t._build[n.mode].apply(t,[])}if(typeof t._drag[n.mode]!=="undefined"){t._drag[n.mode].apply(t,[])}t._t({method:"refresh"});if(t.__("useArabicIndic")===true){t._doIndic()}if((n.useInline||n.useInlineBlind)&&t.initDone===false){t.d.mainWrap.append(t.d.intHTML);if(n.hideContainer){if(n.useHeader){t.d.mainWrap.prepend(e("<div class='ui-header ui-bar-"+n.themeHeader+"'>"+"<h1 class='ui-title'>"+t.d.headerText+"</h1>"+"</div>"))}t.d.wrap.parent().after(t.d.mainWrap)}else{t.d.wrap.parent().append(t.d.mainWrap)}t.d.mainWrap.removeClass("ui-datebox-hidden ui-overlay-shadow");if(n.useInline){t.d.mainWrap.addClass("ui-datebox-inline");if(!n.hideInput&&!n.hideContainer){t.d.mainWrap.addClass("ui-datebox-inline-has-input")}setTimeout(function(e){return function(){e._t({method:"postrefresh"})}}(t),100);return true}else{t.d.mainWrap.addClass("ui-datebox-inline ui-datebox-inline-has-input");t.d.mainWrap.hide()}t.initDone=false;t._t({method:"postrefresh"})}if(n.useInlineBlind){if(t.initDone){t.refresh();t.d.mainWrap.slideDown();t._t({method:"postrefresh"})}else{t.initDone=true}return true}if(t.d.intHTML.is(":visible")){return false}t.d.mainWrap.empty();if(n.useHeader){t.d.mainWrap.append(e("<a href='#'>Close</a>").addClass("ui-btn-left ui-link ui-btn ui-btn-a ui-icon-delete "+"ui-btn-icon-notext ui-shadow ui-corner-all").on(n.clickEventAlt,function(e){e.preventDefault();t._t({method:"close"})}));t.d.mainWrap.append(e("<div class='ui-header ui-bar-"+n.themeHeader+"'>"+"<h1 class='ui-title'>"+t.d.headerText+"</h1>"+"</div>"))}t.d.mainWrap.append(t.d.intHTML).css("zIndex",n.zindex);t._t({method:"postrefresh"});if(n.popupPosition!==false){r.positionTo=n.popupPosition}else{if(typeof t.baseID!=="undefined"){r.positionTo="#"+t.baseID}else{r.positionTo="window"}}if(n.popupForceX!==false&&n.popupForceY!==false){r.x=parseInt(n.popupForceX,10);r.y=parseInt(n.popupForceY,10);r.positionTo="origin"}if(n.useModal){i.overlayTheme=n.useModalTheme;i.dismissible=false}if(n.openCallback!==false){if(!e.isFunction(n.openCallback)){if(typeof window[n.openCallback]==="function"){n.openCallback=window[n.openCallback]}}i.afteropen=function(){t._t({method:"postrefresh"});if(n.openCallback.apply(t,e.merge([{custom:t.customCurrent,initDate:t.initDate,date:t.theDate,duration:t.lastDuration}],n.openCallbackArgs))===false){t._t({method:"close"})}}}else{i.afteropen=function(){t._t({method:"postrefresh"})}}if(n.closeCallback!==false){if(!e.isFunction(n.closeCallback)){if(typeof window[n.closeCallback]==="function"){n.closeCallback=window[n.closeCallback]}}i.afterclose=function(){n.closeCallback.apply(t,e.merge([{custom:t.customCurrent,initDate:t.initDate,date:t.theDate,duration:t.lastDuration}],n.closeCallbackArgs))}}if(n.beforeOpenCallback!==false){if(!e.isFunction(n.beforeOpenCallback)){if(typeof window[n.beforeOpenCallback]==="function"){n.beforeOpenCallback=window[n.beforeOpenCallback]}}if(n.beforeOpenCallback.apply(t,e.merge([{custom:t.customCurrent,initDate:t.initDate,date:t.theDate,duration:t.lastDuration}],n.beforeOpenCallbackArgs))===false){return false}}t.d.mainWrap.removeClass("ui-datebox-hidden").popup(i).popup("open",r)},close:function(){var t=this,n=this.options;if(n.useInlineBlind){t.d.mainWrap.slideUp();return true}if(n.useInline||t.d.intHTML===false){return true}t.d.mainWrap.popup("close");e(document).off(t.drag.eMove).off(t.drag.eEnd).off(t.drag.eEndA);if(n.useFocus){t.fastReopen=true;setTimeout(function(e){return function(){e.fastReopen=false}}(t),300)}},refresh:function(){var e=this,t=this.options;if(typeof e._build[t.mode]==="undefined"){e._build["default"].apply(e,[])}else{e._build[t.mode].apply(e,[])}if(e.__("useArabicIndic")===true){e._doIndic()}e.d.mainWrap.append(e.d.intHTML);e._t({method:"postrefresh"})},_check:function(){var t,n,r,i,s,o=this,u=this.options,a=this.theDate;o.dateOK=true;if(typeof u.mode==="undefined"){return true}if(u.afterToday){t=new o._date;if(a<t){a=t}}if(u.beforeToday){t=new o._date;if(a>t){a=t}}if(u.maxDays!==false){t=new o._date;t.adj(2,u.maxDays);if(a>t){a=t}}if(u.minDays!==false){t=new o._date;t.adj(2,-1*u.minDays);if(a<t){a=t}}if(u.minHour!==false){if(a.get(3)<u.minHour){a.setD(3,u.minHour)}}if(u.maxHour!==false){if(a.get(3)>u.maxHour){a.setD(3,u.maxHour)}}if(u.maxYear!==false){t=new o._date(u.maxYear,11,31);if(a>t){a=t}}if(u.minYear!==false){t=new o._date(u.minYear,0,1);if(a<t){a=t}}if(u.mode.substr(0,4)==="time"||u.mode.substr(0,3)==="dur"){if(u.mode==="timeflipbox"&&u.validHours!==false){if(e.inArray(a.get(3),u.validHours)<0){o.dateOK=false}}}else{if(u.blackDatesRec!==false){n=a.get(0);r=a.get(1);i=a.get(2);for(s=0;s<u.blackDatesRec.length;s++){if((u.blackDatesRec[s][0]===-1||u.blackDatesRec[s][0]===n)&&(u.blackDatesRec[s][1]===-1||u.blackDatesRec[s][1]===r)&&(u.blackDatesRec[s][2]===-1||u.blackDatesRec[s][2]===i)){o.dateOK=false}}}if(u.blackDates!==false){if(e.inArray(a.iso(),u.blackDates)>-1){o.dateOK=false}}if(u.blackDays!==false){if(e.inArray(a.getDay(),u.blackDays)>-1){o.dateOK=false}}if(u.whiteDates!==false){if(e.inArray(a.iso(),u.whiteDates)>-1){o.dateOK=true}}}o.theDate=a},_grabLabel:function(){var t,n,r=this,i=this.options,s=false;if(typeof i.overrideDialogLabel==="undefined"){t=r.d.input.attr("placeholder");n=r.d.input.attr("title");if(typeof t!=="undefined"){return t}if(typeof n!=="undefined"){return n}s=e(document).find("label[for='"+r.d.input.attr("id")+"']").text();return s===""?false:s}return i.overrideDialogLabel},_stdBtn:{clear:function(){var t=this,n=this.options;return e("<a href='#' role='button'>"+t.__("clearButton")+"</a>").addClass("ui-btn ui-btn-"+n.theme+" ui-icon-delete ui-btn-icon-left ui-shadow ui-corner-all").on(n.clickEventAlt,function(e){e.preventDefault();t.d.input.val("");t._t({method:"clear"});t._t({method:"close"})})},close:function(t){var n=this,r=this.options;return e("<a href='#' role='button'>"+t+"</a>").addClass("ui-btn ui-btn-"+r.themeSetButton+" ui-icon-check ui-btn-icon-left ui-shadow ui-corner-all"+(n.dateOK===true?"":" ui-state-disabled")).on(r.clickEventAlt,function(e){e.preventDefault();if(n.dateOK===true){n._t({method:"set",value:n._formatter(n.__fmt(),n.theDate),date:n.theDate});n._t({method:"close"})}})}},_makeEl:function(e,t){var n=false,r=false;r=e.clone();if(typeof t.attr!=="undefined"){for(n in t.attr){if(t.attr.hasOwnProperty(n)){r.data(n,t.attr[n])}}}return r},_getLongOptions:function(e){var t,n,r={},i="datebox",s=7;for(t in e.data()){if(t.substr(0,s)===i&&t.length>s){n=t.substr(s);n=n.charAt(0).toLowerCase()+n.slice(1);if(n!=="options"){r[n]=e.data(t)}}}return r},disable:function(){var e=this;e.d.input.attr("disabled",true);e.d.wrap.addClass("ui-state-disabled").blur();e.disabled=true;e.d.mainWrap.addClass("ui-state-disabled");e._t({method:"disable"})},enable:function(){var e=this;e.d.input.attr("disabled",false);e.d.wrap.removeClass("ui-state-disabled");e.disabled=false;e.d.mainWrap.removeClass("ui-state-disabled");e._t({method:"enable"})},_setOption:function(){e.Widget.prototype._setOption.apply(this,arguments);this.refresh()},getTheDate:function(){return this.theDate},getLastDur:function(){return this.lastDuration},setTheDate:function(e){if(typeof e==="object"){this.theDate=e}else{this.theDate=this._makeDate(e)}this.refresh();this._t({method:"doset"})},parseDate:function(e,t){var n,r=this;r.fmtOver=e;n=r._makeDate(t);r.fmtOver=false;return n},callFormat:function(e,t){return this._formatter(e,t)},getOption:function(e){var t=this.__(e);if(typeof t!=="undefined"){return t}else{return this.options[e]}},_t:function(e){this.d.input.trigger("datebox",e)}})})(jQuery);(function(e){e.extend(e.mobile.datebox.prototype.options,{themeDateToday:"b",themeDayHigh:"b",themeDatePick:"b",themeDateHigh:"b",themeDateHighAlt:"b",themeDateHighRec:"b",themeDate:"a",calNextMonthIcon:"plus",calPrevMonthIcon:"minus",calHighToday:true,calHighPick:true,calShowDays:true,calOnlyMonth:false,calWeekMode:false,calWeekModeDay:1,calControlGroup:false,calShowWeek:false,calUsePickers:false,calNoHeader:false,calFormatter:false,calYearPickMin:-6,calYearPickMax:6,useTodayButton:false,useTomorrowButton:false,useCollapsedBut:false,highDays:false,highDates:false,highDatesRec:false,highDatesAlt:false,enableDates:false,calDateList:false,calShowDateList:false});e.extend(e.mobile.datebox.prototype,{_cal_gen:function(e,t,n,r,i){var s=0,o=0,u=1,a=1,f=[],l=[],c=false;for(s=0;s<=5;s++){if(c===false){l=[];for(o=0;o<=6;o++){if(s===0&&o<e){if(r===true){l.push([t+(o-e)+1,i-1])}else{l.push(false)}}else if(s>3&&u>n){if(r===true){l.push([a,i+1]);a++}else{l.push(false)}c=true}else{l.push([u,i]);u++;if(u>n){c=true}}}f.push(l)}}return f},_cal_check:function(t,n,r,i,s){var o=this,u,a=this.options,f=s.x,l=s.i,c=s.t,h=s.p,p=(new this._date(n,r,i,0,0,0,0)).getDay(),d=a.blackDatesRec,v=a.highDatesRec,m={ok:true,iso:n+"-"+o._zPad(r+1)+"-"+o._zPad(i),theme:a.themeDate,recok:true,rectheme:false};m.comp=parseInt(m.iso.replace(/-/g,""),10);if(d!==false){for(u=0;u<d.length;u++){if((d[u][0]===-1||d[u][0]===n)&&(d[u][1]===-1||d[u][1]===r)&&(d[u][2]===-1||d[u][2]===i)){m.ok=false}}}if(e.isArray(a.enableDates)&&e.inArray(m.iso,a.enableDates)<0){m.ok=false}else if(t){if(m.recok!==true||a.afterToday&&c.comp()>m.comp||a.beforeToday&&c.comp()<m.comp||a.notToday&&c.comp()===m.comp||a.maxDays!==false&&f.comp()<m.comp||a.minDays!==false&&l.comp()>m.comp||e.isArray(a.blackDays)&&e.inArray(p,a.blackDays)>-1||e.isArray(a.blackDates)&&e.inArray(m.iso,a.blackDates)>-1){m.ok=false}}if(e.isArray(a.whiteDates)&&e.inArray(m.iso,a.whiteDates)>-1){m.ok=true}if(m.ok){if(v!==false){for(u=0;u<v.length;u++){if((v[u][0]===-1||v[u][0]===n)&&(v[u][1]===-1||v[u][1]===r)&&(v[u][2]===-1||v[u][2]===i)){m.rectheme=true}}}if(a.calHighPick&&i===h&&(o.d.input.val()!==""||a.defaultValue!==false)){m.theme=a.themeDatePick}else if(a.calHighToday&&m.comp===c.comp()){m.theme=a.themeDateToday}else if(e.isArray(a.highDatesAlt)&&e.inArray(m.iso,a.highDatesAlt)>-1){m.theme=a.themeDateHighAlt}else if(e.isArray(a.highDates)&&e.inArray(m.iso,a.highDates)>-1){m.theme=a.themeDateHigh}else if(e.isArray(a.highDays)&&e.inArray(p,a.highDays)>-1){m.theme=a.themeDayHigh}else if(e.isArray(a.highDatesRec)&&m.rectheme===true){m.theme=a.themeDateHighRec}}return m}});e.extend(e.mobile.datebox.prototype._build,{calbox:function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g=this,y=this.options,b=y.calDateList,w="ui-datebox-",E=g.theDate,S=false,x={},T=g.initDate.copy(),N=g.initDate.copy(),C=(E.copy([0],[0,0,1]).getDay()-g.__("calStartDay")+7)%7,k=E.get(1),L=E.get(0),A=E.getArray(),O=g.d.input.val()===""?g._startOffset(g._makeDate(g.d.input.val())):g._makeDate(g.d.input.val()),M=-1,_=new g._date,D=_.getArray(),P=E.copy([0],[0,0,1]).adj(2,-1*C+(g.__("calStartDay")===0?1:0)).getDWeek(4),H=0,B=false,j=false,F=32-g.theDate.copy([0],[0,0,32,13]).getDate(),I=32-g.theDate.copy([0,-1],[0,0,32,13]).getDate(),q=y.afterToday||y.beforeToday||y.notToday||y.maxDays||y.minDays||y.blackDays||y.blackDates?true:false;if(typeof g.d.intHTML!=="boolean"){g.d.intHTML.remove();g.d.intHTML=null}g.d.headerText=g._grabLabel()!==false?g._grabLabel():g.__("titleDateDialogLabel");g.d.intHTML=e("<span>");e("<div class='"+w+"gridheader'><div class='"+w+"gridlabel'><h4>"+g._formatter(g.__("calHeaderFormat"),g.theDate)+"</h4></div></div>").appendTo(g.d.intHTML);e("<div class='"+w+"gridplus"+(g.__("isRTL")?"-rtl":"")+"'><a href='#'>"+g.__("nextMonth")+"</a></div>").prependTo(g.d.intHTML.find("."+w+"gridheader")).find("a").addClass("ui-btn-inline ui-link ui-btn ui-btn-"+y.themeDate+" ui-icon-"+y.calNextMonthIcon+" ui-btn-icon-notext ui-shadow ui-corner-all").on(y.clickEventAlt,function(e){e.preventDefault();if(g.calNext){if(g.theDate.getDate()>28){g.theDate.setDate(1)}g._offset("m",1)}});e("<div class='"+w+"gridminus"+(g.__("isRTL")?"-rtl":"")+"'><a href='#'>"+g.__("prevMonth")+"</a></div>").prependTo(g.d.intHTML.find("."+w+"gridheader")).find("a").addClass("ui-btn-inline ui-link ui-btn ui-btn-"+y.themeDate+" ui-icon-"+y.calPrevMonthIcon+" ui-btn-icon-notext ui-shadow ui-corner-all").on(y.clickEventAlt,function(e){e.preventDefault();if(g.calPrev){if(g.theDate.getDate()>28){g.theDate.setDate(1)}g._offset("m",-1)}});if(y.calNoHeader){if(y.calUsePickersIcons){g.d.intHTML.find("."+w+"gridlabel").hide()}else{g.d.intHTML.find("."+w+"gridheader").remove()}}g.calNext=true;g.calPrev=true;if(Math.floor(_.comp()/100)===Math.floor(E.comp()/100)){B=true}if(Math.floor(_.comp()/1e4)===Math.floor(E.comp()/1e4)){j=true}if(O.comp()===E.comp()){M=O.get(2)}if(y.afterToday&&(B||j&&D[1]>=A[1])){g.calPrev=false}if(y.beforeToday&&(B||j&&D[1]<=A[1])){g.calNext=false}if(y.minDays!==false){T.adj(2,y.minDays*-1);t=T.getArray();if(A[0]===t[0]&&A[1]<=t[1]){g.calPrev=false}}if(y.maxDays!==false){N.adj(2,y.maxDays);t=T.getArray();if(A[0]===t[0]&&A[1]>=t[1]){g.calNext=false}}if(y.calUsePickers){n=e("<div>");if(y.calNoHeader&&y.calUsePickersIcons){n.addClass("ui-datebox-pickicon")}n.i=e("<fieldset>").appendTo(n);n.a=e("<select>").appendTo(n.i);n.b=e("<select>").appendTo(n.i);for(h=0;h<=11;h++){n.a.append(e("<option value='"+h+"'"+(k===h?" selected='selected'":"")+">"+g.__("monthsOfYear")[h]+"</option>"))}if(y.calYearPickMin<1){p=L+y.calYearPickMin}else if(y.calYearPickMin<1800){p=L-y.calYearPickMin}else if(y.calYearPickMin==="NOW"){p=D[0]}else{p=y.calYearPickMin}if(y.calYearPickMax<1800){d=L+y.calYearPickMax}else if(y.calYearPickMax==="NOW"){d=D[0]}else{d=y.calYearPickMax}for(h=p;h<=d;h++){n.b.append(e("<option value='"+h+"'"+(L===h?" selected='selected'":"")+">"+h+"</option>"))}n.a.on("change",function(){g.theDate.setD(1,e(this).val());if(g.theDate.get(1)!==parseInt(e(this).val(),10)){g.theDate.setD(2,0)}g.refresh()});n.b.on("change",function(){g.theDate.setD(0,e(this).val());if(g.theDate.get(1)!==parseInt(n.a.val(),10)){g.theDate.setD(2,0)}g.refresh()});n.i.controlgroup({mini:true,type:"horizontal"});n.i.find("select").selectmenu({nativeMenu:true});n.i.find(".ui-controlgroup-controls").css({marginRight:"auto",marginLeft:"auto",width:"100%",display:"table"});n.i.find(".ui-select").first().css({width:"60%"}).end().last().css({width:"40%"});if(y.calNoHeader&&y.calUsePickersIcons){n.i.css({padding:"0 10px 5px 10px"})}n.appendTo(g.d.intHTML)}r=e("<div class='"+w+"grid'>").appendTo(g.d.intHTML);if(y.calShowDays){g._cal_days=g.__("daysOfWeekShort").concat(g.__("daysOfWeekShort"));s=e("<div>",{"class":w+"gridrow"}).appendTo(r);if(y.calControlGroup){s.addClass(w+"gridrow-last")}if(g.__("isRTL")===true){s.css("direction","rtl")}if(y.calShowWeek){e("<div>").addClass(w+"griddate "+w+"griddate-label").appendTo(s)}for(h=0;h<=6;h++){e("<div>").text(g._cal_days[(h+g.__("calStartDay"))%7]).addClass(w+"griddate "+w+"griddate-label").appendTo(s)}}x={i:T,x:N,t:_,p:M};i=g._cal_gen(C,I,F,!y.calOnlyMonth,E.get(1));if(!e.isFunction(y.calFormatter)&&y.calFormatter!==false&&e.isFunction(window[y.calFormatter])){y.calFormatter=window[y.calFormatter]}for(u=0,f=i.length;u<f;u++){c=e("<div>",{"class":w+"gridrow"});if(g.__("isRTL")){c.css("direction","rtl")}if(y.calShowWeek){e("<div>",{"class":w+"griddate "+w+"griddate-empty"}).text("W"+P).css(y.calControlGroup?{"float":"left"}:{}).appendTo(c);P++;if(P>52&&typeof i[u+1]!=="undefined"){P=(new g._date(A[0],A[1],g.__("calStartDay")===0?i[u+1][1][0]:i[u+1][0][0],0,0,0,0)).getDWeek(4)}}for(a=0,l=i[u].length;a<l;a++){if(y.calWeekMode){H=i[u][y.calWeekModeDay][0]}if(typeof i[u][a]==="boolean"){e("<div>",{"class":w+"griddate "+w+"griddate-empty"}).appendTo(c)}else{S=g._cal_check(q,A[0],i[u][a][1],i[u][a][0],x);if(i[u][a][0]){if(!e.isFunction(y.calFormatter)){v={text:i[u][a][0],"class":""}}else{m={Year:i[u][a][1]>11?L+1:i[u][a][1]<0?L-1:L,Month:i[u][a][1]===12?0:i[u][a][1]===-1?11:i[u][a][1],Date:i[u][a][0]};m.ISO=m.Year+"-"+g._zPad(m.Month+1)+"-"+g._zPad(m.Date);m.Comp=parseInt(m.ISO.replace(/-/g,""),10);t=y.calFormatter(m);if(typeof t!=="object"){v={text:t,"class":""}}else{v={text:t.text,"class":t.class}}}e("<div>").html(v.text).addClass(w+"griddate ui-corner-all ui-btn").addClass(k===i[u][a][1]?"ui-btn-"+S.theme+(S.ok?"":" ui-state-disabled"):w+"griddate-empty").addClass(v.class).css(k!==i[u][a][1]&&!y.calOnlyMonth?{cursor:"pointer"}:{}).data("date",y.calWeekMode?H:i[u][a][0]).data("enabled",S.ok).data("month",i[u][y.calWeekMode?y.calWeekModeDay:a][1]).appendTo(c)}}}if(y.calControlGroup){c.controlgroup({type:"horizontal"})}if(u===f-1){c.addClass(w+"gridrow-last")}c.appendTo(r)}if(y.calShowWeek){r.find("."+w+"griddate").addClass(w+"griddate-week")}if(y.calShowDateList&&b!==false){o=e("<div>");o.a=e("<select name='pickdate'></select>").appendTo(o);o.a.append("<option value='false' selected='selected'>"+g.__("calDateListLabel")+"</option>");for(h=0;h<b.length;h++){o.a.append(e("<option value='"+b[h][0]+"'>"+b[h][1]+"</option>"))}o.a.on("change",function(){t=e(this).val().split("-");g.theDate=new g._date(t[0],t[1]-1,t[2],0,0,0,0);g._t({method:"doset"})});o.find("select").selectmenu({mini:true,nativeMenu:true});o.appendTo(r)}if(y.useTodayButton||y.useTomorrowButton||y.useClearButton){c=e("<div>",{"class":w+"controls"});if(y.useTodayButton){e("<a href='#' role='button'>"+g.__("calTodayButtonLabel")+"</a>").appendTo(c).addClass("ui-btn ui-btn-"+y.theme+" ui-icon-navigation ui-btn-icon-left ui-shadow ui-corner-all").on(y.clickEvent,function(e){e.preventDefault();g.theDate=g._pa([0,0,0],new g._date);g._t({method:"doset"})})}if(y.useTomorrowButton){e("<a href='#' role='button'>"+g.__("calTomorrowButtonLabel")+"</a>").appendTo(c).addClass("ui-btn ui-btn-"+y.theme+" ui-icon-navigation ui-btn-icon-left ui-shadow ui-corner-all").on(y.clickEvent,function(e){e.preventDefault();g.theDate=g._pa([0,0,0],new g._date).adj(2,1);g._t({method:"doset"})})}if(y.useClearButton){c.append(g._stdBtn.clear.apply(g))}if(y.useCollapsedBut){c.controlgroup({type:"horizontal"});c.addClass("ui-datebox-collapse")}else{c.controlgroup()}c.appendTo(r)}g.d.intHTML.on(y.clickEventAlt,"div."+w+"griddate",function(t){t.preventDefault();if(e(this).data("enabled")){g.theDate.setD(2,1).setD(1,e(this).jqmData("month")).setD(2,e(this).data("date"));g._t({method:"set",value:g._formatter(g.__fmt(),g.theDate),date:g.theDate});g._t({method:"close"})}});g.d.intHTML.on("swipeleft",function(){if(g.calNext){g._offset("m",1)}}).on("swiperight",function(){if(g.calPrev){g._offset("m",-1)}});if(g.wheelExists){g.d.intHTML.on("mousewheel",function(e,t){e.preventDefault();if(t>0&&g.calNext){g.theDate.setD(2,1);g._offset("m",1)}if(t<0&&g.calPrev){g.theDate.setD(2,1);g._offset("m",-1)}})}}})})(jQuery);(function(e){e.extend(e.mobile.datebox.prototype.options,{themeButton:"a",themeInput:"a",useSetButton:true,validHours:false,repButton:true,durationStep:1,durationSteppers:{d:1,h:1,i:1,s:1}});e.extend(e.mobile.datebox.prototype,{_dbox_run:function(){var e=this,t=this.drag,n=150;if(t.cnt>10){n=100}if(t.cnt>30){n=50}if(t.cnt>60){n=20}if(t.cnt>120){n=10}if(t.cnt>240){n=3}t.didRun=true;t.cnt++;e._offset(t.target[0],t.target[1],false);e._dbox_run_update();e.runButton=setTimeout(function(){e._dbox_run()},n)},_dbox_fixstep:function(t){var n=this.options.durationSteppers,r=this.options.durationStep;if(e.inArray("s",t)>-1){n.i=1;n.s=r}if(e.inArray("i",t)>-1){n.h=1;n.s=r}if(e.inArray("h",t)>-1){n.d=1;n.s=r}},_dbox_run_update:function(t){var n=this,r=this.options,i=n.theDate.getTime()-n.initDate.getTime(),s=r.mode==="durationbox"?true:false,o=n._dur(i<0?0:i);if(i<0){n.lastDuration=0;if(s){n.theDate.setTime(n.initDate.getTime())}}if(t!==true&&s!==true){n._check();if(r.mode==="datebox"){n.d.intHTML.find(".ui-datebox-header").find("h4").text(n._formatter(n.__("headerFormat"),n.theDate))}if(r.useSetButton){if(n.dateOK===false){n.setBut.addClass("ui-state-disabled")}else{n.setBut.removeClass("ui-state-disabled")}}}n.d.divIn.find("input").each(function(){switch(e(this).data("field")){case"y":e(this).val(n.theDate.get(0));break;case"m":e(this).val(n.theDate.get(1)+1);break;case"d":e(this).val(s?o[0]:n.theDate.get(2));break;case"h":if(s){e(this).val(o[1])}else{if(n.__("timeFormat")===12){e(this).val(n.theDate.get12hr())}else{e(this).val(n.theDate.get(3))}}break;case"i":if(s){e(this).val(o[2])}else{e(this).val(n._zPad(n.theDate.get(4)))}break;case"M":e(this).val(n.__("monthsOfYearShort")[n.theDate.get(1)]);break;case"a":e(this).val(n.__("meridiem")[n.theDate.get(3)>11?1:0]);break;case"s":e(this).val(o[3]);break}});if(n.__("useArabicIndic")===true){n._doIndic()}},_dbox_vhour:function(t){var n=this,r=this.options,i,s=[25,0],o=[25,0];if(r.validHours===false){return true}if(e.inArray(n.theDate.getHours(),r.validHours)>-1){return true}i=n.theDate.getHours();e.each(r.validHours,function(){if((i<this?1:-1)===t){if(s[0]>Math.abs(this-i)){s=[Math.abs(this-i),parseInt(this,10)]}}else{if(o[0]>Math.abs(this-i)){o=[Math.abs(this-i),parseInt(this,10)]}}});if(s[1]!==0){n.theDate.setHours(s[1])}else{n.theDate.setHours(o[1])}},_dbox_enter:function(t){var n,r=this,i=0;if(t.data("field")==="M"){n=e.inArray(t.val(),r.__("monthsOfYearShort"));if(n>-1){r.theDate.setMonth(n)}}if(t.val()!==""&&t.val().toString().search(/^[0-9]+$/)===0){switch(t.data("field")){case"y":r.theDate.setD(0,parseInt(t.val(),10));break;case"m":r.theDate.setD(1,parseInt(t.val(),10)-1);break;case"d":r.theDate.setD(2,parseInt(t.val(),10));i+=60*60*24*parseInt(t.val(),10);break;case"h":r.theDate.setD(3,parseInt(t.val(),10));i+=60*60*parseInt(t.val(),10);break;case"i":r.theDate.setD(4,parseInt(t.val(),10));i+=60*parseInt(t.val(),10);break;case"s":i+=parseInt(t.val(),10);break}}if(this.options.mode==="durationbox"){r.theDate.setTime(r.initDate.getTime()+i*1e3)}r.refresh()}});e.extend(e.mobile.datebox.prototype._build,{timebox:function(){this._build.datebox.apply(this,[])},durationbox:function(){this._build.datebox.apply(this,[])},datebox:function(){var t,n,r,i,s=this,o=this.drag,u=this.options,a=u.mode==="durationbox"?true:false,f=-2,l=["d","h","i","s"],c="ui-datebox-",h=e("<div>"),p=e("<fieldset>"),d=h.clone(),v=p.clone(),m=h.clone(),g=e("<div><input type='text'></div>").addClass("ui-input-text ui-body-"+u.themeInput+" ui-corner-all ui-mini ui-shadow-inset"),y=e("<div></div>"),b="ui-btn-inline ui-link ui-btn ui-btn-"+u.themeButton+" ui-btn-icon-notext ui-shadow ui-corner-all";if(typeof s.d.intHTML!=="boolean"){s.d.intHTML.empty().remove()}s.d.headerText=s._grabLabel()!==false?s._grabLabel():u.mode==="datebox"?s.__("titleDateDialogLabel"):s.__("titleTimeDialogLabel");s.d.intHTML=e("<span>");s.fldOrder=u.mode==="datebox"?s.__("dateFieldOrder"):a?s.__("durationOrder"):s.__("timeFieldOrder");if(!a){s._check();s._minStepFix();s._dbox_vhour(typeof s._dbox_delta!=="undefined"?s._dbox_delta:1)}else{s.dateOK=true;s._dbox_fixstep(s.fldOrder)}if(u.mode==="datebox"){e("<div class='"+c+"header'><h4>"+s._formatter(s.__("headerFormat"),s.theDate)+"</h4></div>").appendTo(s.d.intHTML)}for(n=0;n<s.fldOrder.length;n++){i=s._gridblk.b[n];if(a){t=u.durationSteppers[s.fldOrder[n]]}else{if(s.fldOrder[n]==="i"){t=u.minuteStep}else{t=1}}if(s.fldOrder[n]!=="a"||s.__("timeFormat")===12){e("<div>").append(a?"<label>"+s.__("durationLabel")[e.inArray(s.fldOrder[n],l)]+"</label>":"").addClass("ui-block-"+i).appendTo(m);e("<div>").append(s._makeEl(g,{attr:{field:s.fldOrder[n],amount:t}})).addClass("ui-block-"+i).appendTo(d).find("input").data({field:s.fldOrder[n],amount:t});s._makeEl(y,{attr:{field:s.fldOrder[n],amount:t}}).addClass(c+"cbut ui-block-"+i+" ui-icon-plus "+b).appendTo(p).prepend(a?"<label>"+s.__("durationLabel")[n]+"</label>":"");s._makeEl(y,{attr:{field:s.fldOrder[n],amount:t*-1}}).addClass(c+"cbut ui-block-"+i+" ui-icon-minus "+b).appendTo(v);f++}}if(a){m.addClass("ui-datebox-dboxlab ui-grid-"+s._gridblk.b[f]).appendTo(s.d.intHTML)}p.addClass("ui-grid-"+s._gridblk.b[f]).appendTo(s.d.intHTML);d.addClass("ui-datebox-dboxin ui-grid-"+s._gridblk.b[f]).appendTo(s.d.intHTML);v.addClass("ui-grid-"+s._gridblk.b[f]).appendTo(s.d.intHTML);s.d.divIn=d;s._dbox_run_update(true);if(s.dateOK!==true){d.find("input").addClass("ui-state-disable")}else{d.find(".ui-state-disable").removeClass("ui-state-disable")}if(u.useSetButton||u.useClearButton){r=e("<div>",{"class":c+"controls"});if(u.useSetButton){s.setBut=s._stdBtn.close.apply(s,[u.mode==="datebox"?s.__("setDateButtonLabel"):a?s.__("setDurationButtonLabel"):s.__("setTimeButtonLabel")]);s.setBut.appendTo(r)}if(u.useClearButton){r.append(s._stdBtn.clear.apply(s))}if(u.useCollapsedBut){r.controlgroup({type:"horizontal"});r.addClass("ui-datebox-collapse")}else{r.controlgroup()}r.appendTo(s.d.intHTML)}if(!u.repButton){s.d.intHTML.on(u.clickEvent,"."+c+"cbut",function(t){d.find(":focus").blur();t.preventDefault();s._dbox_delta=e(this).data("amount")>1?1:-1;s._offset(e(this).data("field"),e(this).data("amount"))})}d.on("change","input",function(){s._dbox_enter(e(this))});if(s.wheelExists){d.on("mousewheel","input",function(t,n){t.preventDefault();s._dbox_delta=n<0?-1:1;s._offset(e(this).data("field"),(n<0?-1:1)*e(this).data("amount"))})}if(u.repButton){s.d.intHTML.on(o.eStart,"."+c+"cbut",function(){d.find(":focus").blur();i=[e(this).data("field"),e(this).data("amount")];o.move=true;o.cnt=0;s._dbox_delta=e(this).data("amount")>1?1:-1;s._offset(i[0],i[1],false);s._dbox_run_update();if(!s.runButton){o.target=i;s.runButton=setTimeout(function(){s._dbox_run()},500)}});s.d.intHTML.on(o.eEndA,"."+c+"cbut",function(e){if(o.move){e.preventDefault();clearTimeout(s.runButton);s.runButton=false;o.move=false}})}}})})(jQuery);(function(e){e.extend(e.mobile.datebox.prototype.options,{themeDatePick:"b",themeDate:"a",useSetButton:true,validHours:false,flen:{y:15,m:12,d:20,h:12,i:15},durationStep:1,durationSteppers:{d:1,h:1,i:1,s:1}});e.extend(e.mobile.datebox.prototype,{_fbox_pos:function(){var t,n,r,i,s=this,o=this.d.intHTML.find(".ui-datebox-flipcontent").innerHeight();s.d.intHTML.find(".ui-datebox-flipcenter").each(function(){n=e(this);r=n.innerHeight();n.css("top",(o/2-r/2-3)*-1)});s.d.intHTML.find("ul").each(function(){n=e(this);o=n.parent().innerHeight();r=n.find("li").first();i=n.find("li").last().offset().top-n.find("li").first().offset().top;t=((i-o)/2+r.outerHeight())*-1;r.css("marginTop",t)})},_fbox_fixstep:function(t){var n=this.options.durationSteppers,r=this.options.durationStep;if(e.inArray("h",t)>-1){n.d=1;n.h=r}if(e.inArray("i",t)>-1){n.h=1;n.i=r}if(e.inArray("s",t)>-1){n.i=1;n.s=r}},_fbox_series:function(e,t,n,r){var i,s,o=this.options,u=n==="h"?24:60,a=[[e.toString(),e]];for(var f=1;f<=t;f++){i=e+f*o.durationSteppers[n];s=e-f*o.durationSteppers[n];a.unshift([i.toString(),i]);if(s>-1){a.push([s.toString(),s])}else{if(r){a.push([(u+s).toString(),s])}else{a.push(["",-1])}}}return a},_fbox_mktxt:{y:function(e){return this.theDate.get(0)+e},m:function(e){var t=this.theDate.copy([0],[0,0,1]).adj(1,e);return this.__("monthsOfYearShort")[t.get(1)]},d:function(e){return this.theDate.copy([0,0,e]).get(2)},h:function(e){var t=this.theDate.copy([0,0,0,e]);return this.__("timeFormat")===12?t.get12hr():t.get(3)},i:function(e){return this._zPad(this.theDate.copy([0,0,0,0,e]).get(4))}}});e.extend(e.mobile.datebox.prototype._build,{timeflipbox:function(){this._build.flipbox.apply(this)},durationflipbox:function(){this._build.flipbox.apply(this)},flipbox:function(){var t,n,r,i,s,o,u=this,a=this.options,f=this.drag,l={},c=["d","h","i","s"],h=a.mode==="durationflipbox"?true:false,p="ui-datebox-",d=e("<div class='ui-overlay-shadow'><ul></ul></div>"),v=e("<div>",{"class":p+"flipcontent"}),m=u.theDate.getTime()-u.initDate.getTime(),g=u._dur(m<0?0:m),y,b;if(m<0){u.lastDuration=0;if(h){u.theDate.setTime(u.initDate.getTime())}}if(typeof u.d.intHTML!=="boolean"){u.d.intHTML.empty().remove()}else{u.d.input.on("datebox",function(e,t){if(t.method==="postrefresh"){u._fbox_pos()}})}u.d.headerText=u._grabLabel()!==false?u._grabLabel():a.mode==="flipbox"?u.__("titleDateDialogLabel"):u.__("titleTimeDialogLabel");u.d.intHTML=e("<span>");e(document).one("popupafteropen",function(){u._fbox_pos()});u.fldOrder=a.mode==="flipbox"?u.__("dateFieldOrder"):h?u.__("durationOrder"):u.__("timeFieldOrder");if(!h){u._check();u._minStepFix()}if(a.mode==="flipbox"){e("<div class='"+p+"header'><h4>"+u._formatter(u.__("headerFormat"),u.theDate)+"</h4></div>").appendTo(u.d.intHTML)}if(h){u._fbox_fixstep(u.fldOrder);i=e("<div class='"+p+"header ui-grid-"+u._gridblk.g[u.fldOrder.length]+"'></div>");for(n=0;n<u.fldOrder.length;n++){e("<div class='"+p+"fliplab ui-block-"+u._gridblk.b[n]+"'>"+u.__("durationLabel")[e.inArray(u.fldOrder[n],c)]+"</div>").appendTo(i)}i.appendTo(u.d.intHTML);u.dateOK=true;l.d=u._fbox_series(g[0],16,"d",false);l.h=u._fbox_series(g[1],16,"h",g[0]>0);l.i=u._fbox_series(g[2],20,"i",g[0]>0||g[1]>0);l.s=u._fbox_series(g[3],20,"s",g[0]>0||g[1]>0||g[2]>0);v.addClass(p+"flipcontentd");for(n=0;n<u.fldOrder.length;n++){o=u.fldOrder[n];y=g[e.inArray(o,c)];r=u._makeEl(d,{attr:{field:o,amount:a.durationSteppers[o]}});s=r.find("ul");for(t in l[o]){e("<li><span>"+l[o][t][0]+"</span></li>").addClass("ui-body-"+(l[o][t][1]!==y?a.themeDate:a.themeDatePick)).appendTo(s)}r.appendTo(v)}}for(n=0;n<u.fldOrder.length&&!h;n++){y=u.fldOrder[n];r=u._makeEl(d,{attr:{field:y,amount:1}});s=r.find("ul");if(typeof u._fbox_mktxt[y]==="function"){for(t=-1*a.flen[y];t<a.flen[y]+1;t++){e("<li class='ui-body-"+(t!==0?a.themeDate:a.themeDatePick)+"'><span>"+u._fbox_mktxt[y].apply(u,[t])+"</span></li>").appendTo(s)}r.appendTo(v)}if(y==="a"&&u.__("timeFormat")===12){b=e("<li class='ui-body-"+a.themeDate+"'><span></span></li>");i=u.theDate.get(3)>11?[a.themeDate,a.themeDatePick,2,5]:[a.themeDatePick,a.themeDate,2,3];for(t=-1*i[2];t<i[3];t++){if(t<0||t>1){b.clone().appendTo(s)}else{e("<li>",{"class":"ui-body-"+i[t]}).html("<span>"+u.__("meridiem")[t]+"</span>").appendTo(s)}}r.appendTo(v)}}u.d.intHTML.append(v);e("<div>",{"class":p+"flipcenter ui-overlay-shadow"}).css("pointerEvents","none").appendTo(u.d.intHTML);if(a.useSetButton||a.useClearButton){n=e("<div>",{"class":p+"controls"});if(a.useSetButton){n.append(u._stdBtn.close.apply(u,[a.mode==="flipbox"?u.__("setDateButtonLabel"):h?u.__("setDurationButtonLabel"):u.__("setTimeButtonLabel")]))}if(a.useClearButton){n.append(u._stdBtn.clear.apply(u))}if(a.useCollapsedBut){n.controlgroup({type:"horizontal"});n.addClass("ui-datebox-collapse")}else{n.controlgroup()}n.appendTo(u.d.intHTML)}if(u.wheelExists){u.d.intHTML.on("mousewheel",".ui-overlay-shadow",function(t,n){t.preventDefault();u._offset(e(this).data("field"),(n<0?-1:1)*e(this).data("amount"))})}u.d.intHTML.on(f.eStart,"ul",function(t,n){if(!f.move){if(typeof n!=="undefined"){t=n}f.move=true;f.target=e(this).find("li").first();f.pos=parseInt(f.target.css("marginTop").replace(/px/i,""),10);f.start=u.touch?t.originalEvent.changedTouches[0].pageY:t.pageY;f.end=false;f.direc=h?-1:1;t.stopPropagation();t.preventDefault()}})}});e.extend(e.mobile.datebox.prototype._drag,{timeflipbox:function(){this._drag.flipbox.apply(this)},durationflipbox:function(){this._drag.flipbox.apply(this)},flipbox:function(){var t=this,n=this.options,r=this.drag;e(document).on(r.eMove,function(e){if(r.move&&n.mode.slice(-7)==="flipbox"){r.end=t.touch?e.originalEvent.changedTouches[0].pageY:e.pageY;r.target.css("marginTop",r.pos+r.end-r.start+"px");e.preventDefault();e.stopPropagation();return false}});e(document).on(r.eEnd,function(e){if(r.move&&n.mode.slice(-7)==="flipbox"){r.move=false;if(r.end!==false){e.preventDefault();e.stopPropagation();r.tmp=r.target.parent().parent();t._offset(r.tmp.data("field"),parseInt((r.start-r.end)/(r.target.outerHeight()-2),10)*r.tmp.data("amount")*r.direc)}r.start=false;r.end=false}})}})})(jQuery);(function(e){e.extend(e.mobile.datebox.prototype.options,{themeDatePick:"b",themeDate:"a",useSetButton:true,validHours:false,slen:{y:9,m:14,d:16,h:16,i:30}});e.extend(e.mobile.datebox.prototype,{_sbox_pos:function(){var t,n,r,i,s,o=this;o.d.intHTML.find("div.ui-datebox-sliderow-int").each(function(){n=e(this);i=n.parent().outerWidth();t=n.outerWidth();if(o.__("isRTL")){r=n.find("div").last()}else{r=n.find("div").first()}s=n.find("div").size()*r.outerWidth();if(t>0){s=t}r.css("marginLeft",(s-i)/2*-1)})},_sbox_mktxt:{y:function(e){return["slideyear",this.theDate.get(0)+e]},m:function(e){var t=this.theDate.copy([0],[0,0,1]).adj(1,e);return["slidemonth",this.__("monthsOfYearShort")[t.get(1)]]},d:function(e){var t=this.theDate.copy([0,0,e]);return["slideday",t.get(2)+"<br /><span class='ui-datebox-slidewday'>"+this.__("daysOfWeekShort")[t.getDay()]+"</span>"]},h:function(e){var t=this.theDate.copy([0,0,0,e]);return["slidehour",this.__("timeFormat")===12?this._formatter("%-I<span class='ui-datebox-slidewday'>%p</span>",t):t.get(3)]},i:function(e){return["slidemins",this._zPad(this.theDate.copy([0,0,0,0,e]).get(4))]}}});e.extend(e.mobile.datebox.prototype._build,{slidebox:function(){var t,n,r,i,s,o,u=this,a=this.options,f=this.drag,l="ui-datebox-",c=e("<div class='"+l+"sliderow-int'></div>"),h=e("<div>"),p=e("<div>",{"class":l+"slide"});if(typeof u.d.intHTML!=="boolean"){u.d.intHTML.remove().empty()}else{u.d.input.on("datebox",function(e,t){if(t.method==="postrefresh"){u._sbox_pos()}})}u.d.headerText=u._grabLabel()!==false?u._grabLabel():u.__("titleDateDialogLabel");u.d.intHTML=e("<span class='"+l+"nopad'>");u.fldOrder=u.__("slideFieldOrder");u._check();u._minStepFix();e("<div class='"+l+"header'><h4>"+u._formatter(u.__("headerFormat"),u.theDate)+"</h4></div>").appendTo(u.d.intHTML);u.d.intHTML.append(p);for(n=0;n<u.fldOrder.length;n++){s=u.fldOrder[n];i=h.clone().addClass(l+"sliderow").data("rowtype",s);r=c.clone().data("rowtype",s).appendTo(i);if(u.__("isRTL")===true){r.css("direction","rtl")}if(typeof u._sbox_mktxt[s]==="function"){for(t=a.slen[s]*-1;t<a.slen[s]+1;t++){o=u._sbox_mktxt[s].apply(u,[t]);e("<div>",{"class":l+"slidebox "+l+o[0]+" ui-btn ui-btn-"+(t===0?a.themeDatePick:a.themeDate)}).html(o[1]).data("offset",t).appendTo(r)}i.appendTo(p)}}if(a.useSetButton||a.useClearButton){n=e("<div>",{"class":l+"controls "+l+"repad"});if(a.useSetButton){n.append(u._stdBtn.close.apply(u,[u.__("setDateButtonLabel")]))}if(a.useClearButton){n.append(u._stdBtn.clear.apply(u))}if(a.useCollapsedBut){n.controlgroup({type:"horizontal"});n.addClass("ui-datebox-collapse")}else{n.controlgroup()}n.appendTo(u.d.intHTML)}if(u.wheelExists){u.d.intHTML.on("mousewheel",".ui-datebox-sliderow-int",function(t,n){t.preventDefault();u._offset(e(this).data("rowtype"),(n<0?-1:1)*(e(this).data("rowtype")==="i"?a.minuteStep:1))})}u.d.intHTML.on(a.clickEvent,".ui-datebox-sliderow-int>div",function(t){t.preventDefault();u._offset(e(this).parent().data("rowtype"),parseInt(e(this).data("offset"),10))});u.d.intHTML.on(f.eStart,".ui-datebox-sliderow-int",function(t){if(!f.move){f.move=true;f.target=e(this);f.pos=parseInt(f.target.css("marginLeft").replace(/px/i,""),10);f.start=u.touch?t.originalEvent.changedTouches[0].pageX:t.pageX;f.end=false;t.stopPropagation();t.preventDefault()}})}});e.extend(e.mobile.datebox.prototype._drag,{slidebox:function(){var t=this,n=this.options,r=this.drag;e(document).on(r.eMove,function(e){if(r.move&&n.mode==="slidebox"){r.end=t.touch?e.originalEvent.changedTouches[0].pageX:e.pageX;r.target.css("marginLeft",r.pos+r.end-r.start+"px");e.preventDefault();e.stopPropagation();return false}});e(document).on(r.eEnd,function(e){if(r.move&&n.mode==="slidebox"){r.move=false;if(r.end!==false){e.preventDefault();e.stopPropagation();r.tmp=r.target.find("div").first();t._offset(r.target.data("rowtype"),(t.__("isRTL")?-1:1)*parseInt((r.start-r.end)/r.tmp.innerWidth(),10)*(r.target.data("rowtype")==="i"?n.minuteStep:1))}r.start=false;r.end=false}})}})})(jQuery);(function(e){e.extend(e.mobile.datebox.prototype.options,{themeOptPick:"b",themeOpt:"a",useSetButton:true,customData:[],customDefault:[0,0,0],customDataLen:25,customFormat:false,customHead:false,customfliplang:{customSet:"Looks Good"}});e.extend(e.mobile.datebox.prototype,{_customflipDoSet:function(){var e=this,t=this.options;if(typeof e.customCurrent==="undefined"){e.customCurrent=this._makeDate(this.d.input.val())}e._t({method:"set",value:e._formatter(t.customFormat,e.customCurrent),custom:e.customCurrent})},_cubox_offset:function(e,t){var n=this,r,i=this.options;r=(n.customCurrent[e]+t)%i.customData[e].data.length;if(r<0){r=i.customData[e].data.length+r}n.customCurrent[e]=r;if(i.useImmediate){n._t({method:"set",value:n._formatter(i.customFormat,n.customCurrent),custom:n.customCurrent})}n.refresh()},_cubox_arr:function(t,n){var r=t,i,s=this.options.customDataLen,o=t.slice(0,n),u=t.slice(n+1);while(o.length<s){for(i=r.length;i>0;i--){o.unshift(r[i-1])}}while(o.length>s){o.shift()}while(u.length<s){for(i=0;i<r.length;i++){u.push(r[i])}}u.length=s;o.push(t[n]);return e.merge(e.merge([],o),u)},_cubox_range:function(e){return e?this._cubox_range(e-1).concat(e):[]},_cubox_pos:function(){var t,n,r,i,s=this,o=this.d.intHTML.find(".ui-datebox-flipcontent").innerHeight();s.d.intHTML.find(".ui-datebox-flipcenter").each(function(){n=e(this);r=n.innerHeight();n.css("top",(o/2-r/2-3)*-1)});s.d.intHTML.find("ul").each(function(){n=e(this);o=n.parent().innerHeight();r=n.find("li").first();i=n.find("li").last().offset().top-n.find("li").first().offset().top;t=((i-o)/2+r.outerHeight())*-1;r.css("marginTop",t)})}});e.extend(e.mobile.datebox.prototype._parser,{customflip:function(t){var n=this.options,r=n.customFormat,i,s,o,u,a=[0,0,0,0,0,0];if(typeof r!=="string"){r=""}r=r.replace(/%X([0-5a-f])/gi,function(e,t){switch(t){case"a":case"b":case"c":case"d":case"e":case"f":return"("+e+"|"+".+?"+")";case"0":case"1":case"2":case"3":case"4":case"5":return"("+e+"|"+"[0-9]+"+")";default:return".+?"}});r=new RegExp("^"+r+"$");i=r.exec(t);s=r.exec(n.customFormat);if(i!==null){for(var f=1;f<i.length;f++){o=s[f].charAt(2);if(isNaN(parseInt(o))){u=e.inArray(o,["a","b","c","d","e","f"]);a[u]=e.inArray(i[f],n.customData[u].data)}else{a[parseInt(o)-1]=parseInt(i[f])}}}return t.length<1||a.length<1?n.customDefault:a}});e.extend(e.mobile.datebox.prototype._customformat,{customflip:function(t,n,r){var i=parseInt(t),s;if(typeof i==="number"&&!isNaN(i)){return n[t-1]}else{s=e.inArray(t,["a","b","c","d","e","f"]);return r.customData[s].data[n[s]]}}});e.extend(e.mobile.datebox.prototype._build,{customflip:function(){var t,n,r,i,s,o,u=this,a=this.options,f="ui-datebox-",l=this._makeDate(this.d.input.val()),c=e("<div class='ui-overlay-shadow'><ul></ul></div>"),h=e("<div>",{"class":f+"flipcontent"});if(typeof u.customCurrent==="undefined"){u.customCurrent=l}if(typeof a.customData==="string"&&typeof window[a.customData]!=="undefined"){a.customData=window[a.customData]}if(a.customFormat===false){s=[];for(t=0;t<a.customData.length;t++){s.push("%X"+(t+1))}a.customFormat=s.join(",")}if(typeof u.d.intHTML!=="boolean"){u.d.intHTML.empty().remove()}else{u.d.input.on("datebox",function(e,t){if(t.method==="postrefresh"){u._cubox_pos()}})}u.d.headerText=a.customHead!==false?a.customHead:u._grabLabel()!==false?u._grabLabel():"";u.d.intHTML=e("<span>");e(document).one("popupafteropen",function(){u._fbox_pos()});u.fldOrder=u._cubox_range(a.customData.length);s=e("<div class='"+f+"header'>");if(a.customData.length>1){s.addClass("ui-grid-"+[0,0,"a","b","c"][a.customData.length])}for(n=0;n<a.customData.length;n++){e("<div>").addClass(a.customData.length>1?"ui-block-"+["a","b","c","d"][n]:"").text(a.customData[n].name).css("textAlign","center").appendTo(s)}s.appendTo(u.d.intHTML);u.d.intHTML.append(h);for(n=0;n<a.customData.length;n++){o=u._cubox_arr(a.customData[n].data,u.customCurrent[n]);r=u._makeEl(c,{attr:{field:n,amount:1}});i=r.find("ul");if(a.customData.length===1){r.css("width","90%")}for(t=0;t<o.length;t++){s=t!==a.customDataLen?a.themeOpt:a.themeOptPick;console.log(t+" "+a.customDataLen);console.log(typeof t+" "+typeof a.customDataLen);e("<li>",{"class":"ui-body-"+s}).html("<span>"+o[t]+"</span>").appendTo(i)}r.appendTo(h)}e("<div>",{"class":f+"flipcenter ui-overlay-shadow"}).css("pointerEvents","none").appendTo(u.d.intHTML);if(a.useSetButton){n=e("<div>",{"class":f+"controls"});if(a.useSetButton){e("<a href='#' role='button'>").appendTo(n).text(u.__("customSet")).addClass("ui-btn ui-btn-"+a.theme+" ui-icon-check ui-btn-icon-left ui-shadow ui-corner-all").on(a.clickEventAlt,function(e){e.preventDefault();u._t({method:"set",value:u._formatter(a.customFormat,u.customCurrent),custom:u.customCurrent});u._t({method:"close"})})}n.appendTo(u.d.intHTML)}if(u.wheelExists){u.d.intHTML.on("mousewheel",".ui-overlay-shadow",function(t,n){t.preventDefault();u._cubox_offset(e(this).data("field"),(n<0?1:-1)*e(this).data("amount"))})}u.d.intHTML.on(u.drag.eStart,"ul",function(t,n){if(!u.drag.move){if(typeof n!=="undefined"){t=n}u.drag.move=true;u.drag.target=e(this).find("li").first();u.drag.pos=parseInt(u.drag.target.css("marginTop").replace(/px/i,""),10);u.drag.start=u.touch?t.originalEvent.changedTouches[0].pageY:t.pageY;u.drag.end=false;t.stopPropagation();t.preventDefault()}})}});e.extend(e.mobile.datebox.prototype._drag,{customflip:function(){var t=this,n=this.options,r=this.drag;e(document).on(r.eMove,function(e){if(r.move&&n.mode==="customflip"){r.end=t.touch?e.originalEvent.changedTouches[0].pageY:e.pageY;r.target.css("marginTop",r.pos+r.end-r.start+"px");e.preventDefault();e.stopPropagation();return false}});e(document).on(r.eEnd,function(e){if(r.move&&n.mode==="customflip"){r.move=false;if(r.end!==false){e.preventDefault();e.stopPropagation();r.tmp=r.target.parent().parent();t._cubox_offset(r.tmp.data("field"),parseInt((r.start-r.end)/r.target.innerHeight(),10)*r.tmp.data("amount"))}r.start=false;r.end=false}})}})})(jQuery);jQuery.extend(jQuery.mobile.datebox.prototype.options.lang,{fr:{setDateButtonLabel:"Date Fixée",setTimeButtonLabel:"Régler l'heure",setDurationButtonLabel:"Régler la durée",calTodayButtonLabel:"Aller à aujourd'hui",titleDateDialogLabel:"Choisir la Date",titleTimeDialogLabel:"Choisir le temps",daysOfWeek:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],daysOfWeekShort:["D","L","M","M","J","V","S"],monthsOfYear:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsOfYearShort:["Janv","Févr","Mars","Avr","Mai","Juin","Juil","Août","Sept","Oct","Nov","Déc"],durationLabel:["Jours","Heures","Minutes","Secondes"],durationDays:["Jour","Jours"],tooltip:"Ouvrir le sélecteur de date",nextMonth:"Mois Suiv.",prevMonth:"Mois Prec.",timeFormat:24,headerFormat:"%A, %-d %B, %Y",dateFieldOrder:["d","m","y"],timeFieldOrder:["h","i","a"],slideFieldOrder:["y","m","d"],dateFormat:"%d/%m/%Y",useArabicIndic:false,isRTL:false,calStartDay:1,clearButton:"Effacer",durationOrder:["d","h","i","s"],meridiem:["AM","PM"],timeOutput:"%l:%M %p",durationFormat:"%Dd %DA, %Dl:%DM:%DS",calDateListLabel:"Autres Dates",calHeaderFormat:"%B %Y",calTomorrowButtonLabel:"Aller à demain"}});jQuery.extend(jQuery.mobile.datebox.prototype.options,{useLang:"fr"})