You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
28 KiB
2 lines
28 KiB
Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.CalendarBehavior=function(d){var c=false,b=null,a=this;AjaxControlToolkit.CalendarBehavior.initializeBase(a,[d]);a._textbox=AjaxControlToolkit.TextBoxWrapper.get_Wrapper(d);a._format="d";a._todaysDateFormat="MMMM d, yyyy";a._daysModeTitleFormat="MMMM, yyyy";a._cssClass="ajax__calendar";a._enabled=true;a._animated=true;a._buttonID=b;a._layoutRequested=0;a._layoutSuspended=c;a._button=b;a._popupMouseDown=c;a._selectedDate=b;a._visibleDate=b;a._todaysDate=b;a._firstDayOfWeek=AjaxControlToolkit.FirstDayOfWeek.Default;a._firstPopUp=true;a._container=b;a._popupDiv=b;a._header=b;a._prevArrow=b;a._nextArrow=b;a._title=b;a._body=b;a._today=b;a._days=b;a._daysTable=b;a._daysTableHeader=b;a._daysTableHeaderRow=b;a._daysBody=b;a._months=b;a._monthsTable=b;a._monthsBody=b;a._years=b;a._yearsTable=b;a._yearsBody=b;a._popupPosition=AjaxControlToolkit.CalendarPosition.BottomLeft;a._defaultView=AjaxControlToolkit.CalendarDefaultView.Days;a._popupBehavior=b;a._modeChangeAnimation=b;a._modeChangeMoveTopOrLeftAnimation=b;a._modeChangeMoveBottomOrRightAnimation=b;a._mode="days";a._selectedDateChanging=c;a._isOpen=c;a._isAnimating=c;a._clearTime=c;a._width=170;a._height=139;a._modes={days:b,months:b,years:b};a._modeOrder={days:0,months:1,years:2};a._hourOffsetForDst=12;a._blur=new AjaxControlToolkit.DeferredOperation(1,a,a.blur);a._button$delegates={click:Function.createDelegate(a,a._button_onclick),keypress:Function.createDelegate(a,a._button_onkeypress),blur:Function.createDelegate(a,a._button_onblur)};a._element$delegates={change:Function.createDelegate(a,a._element_onchange),keypress:Function.createDelegate(a,a._element_onkeypress),click:Function.createDelegate(a,a._element_onclick),focus:Function.createDelegate(a,a._element_onfocus),blur:Function.createDelegate(a,a._element_onblur)};a._popup$delegates={mousedown:Function.createDelegate(a,a._popup_onmousedown),mouseup:Function.createDelegate(a,a._popup_onmouseup),drag:Function.createDelegate(a,a._popup_onevent),dragstart:Function.createDelegate(a,a._popup_onevent),select:Function.createDelegate(a,a._popup_onevent)};a._cell$delegates={mouseover:Function.createDelegate(a,a._cell_onmouseover),mouseout:Function.createDelegate(a,a._cell_onmouseout),click:Function.createDelegate(a,a._cell_onclick)}};AjaxControlToolkit.CalendarBehavior.prototype={get_clearTime:function(){return this._clearTime},set_clearTime:function(a){if(this._clearTime!=a){this._clearTime=a;this.raisePropertyChanged("_clearTime")}},get_animated:function(){return this._animated},set_animated:function(a){if(this._animated!=a){this._animated=a;this.raisePropertyChanged("animated")}},get_enabled:function(){return this._enabled},set_enabled:function(a){if(this._enabled!=a){this._enabled=a;this.raisePropertyChanged("enabled")}},get_button:function(){return this._button},set_button:function(b){var a=this;if(a._button!=b){a._button&&a.get_isInitialized()&&$common.removeHandlers(a._button,a._button$delegates);a._button=b;a._button&&a.get_isInitialized()&&$addHandlers(a._button,a._button$delegates);a.raisePropertyChanged("button")}},get_popupPosition:function(){return this._popupPosition},set_popupPosition:function(a){if(this._popupPosition!=a){this._popupPosition=a;this.raisePropertyChanged("popupPosition")}},get_format:function(){return this._format},set_format:function(a){if(this._format!=a){this._format=a;this.raisePropertyChanged("format")}},get_todaysDateFormat:function(){return this._todaysDateFormat},set_todaysDateFormat:function(a){if(this._todaysDateFormat!=a){this._todaysDateFormat=a;this.raisePropertyChanged("todaysDateFormat")}},get_daysModeTitleFormat:function(){return this._daysModeTitleFormat},set_daysModeTitleFormat:function(a){if(this._daysModeTitleFormat!=a){this._daysModeTitleFormat=a;this.raisePropertyChanged("daysModeTitleFormat")}},get_selectedDate:function(){var a=this;if(a._selectedDate==null){var b=a._textbox.get_Value();if(b){b=a._parseTextValue(b);if(b)a._selectedDate=b.getDateOnly()}}return a._selectedDate},set_selectedDate:function(b){var a=this;if(b&&String.isInstanceOfType(b)&&b.length!=0)b=new Date(b);if(b)b=b.getDateOnly();if(a._selectedDate!=b){a._selectedDate=b;a._selectedDateChanging=true;var d="";if(b){d=b.localeFormat(a._format);if(!a._clearTime){var c=a._textbox.get_Value();if(c)c=a._parseTextValue(c);if(c)if(b!=c.getDateOnly())d=b.add(c.getTimeOfDay()).localeFormat(a._format)}}if(d!=a._textbox.get_Value()){a._textbox.set_Value(d);a._fireChanged()}a._selectedDateChanging=false;a.invalidate();a.raisePropertyChanged("selectedDate")}},get_defaultView:function(){return this._defaultView},set_defaultView:function(a){if(this._defaultView!=a){this._defaultView=a;this.raisePropertyChanged("defaultView")}},get_visibleDate:function(){return this._visibleDate},set_visibleDate:function(a){var b=this;if(a)a=a.getDateOnly();if(b._visibleDate!=a){b._switchMonth(a,!b._isOpen);b.raisePropertyChanged("visibleDate")}},get_isOpen:function(){return this._isOpen},get_todaysDate:function(){if(this._todaysDate!=null)return this._todaysDate;return (new Date).getDateOnly()},set_todaysDate:function(a){var b=this;if(a)a=a.getDateOnly();if(b._todaysDate!=a){b._todaysDate=a;b.invalidate();b.raisePropertyChanged("todaysDate")}},get_firstDayOfWeek:function(){return this._firstDayOfWeek},set_firstDayOfWeek:function(b){var a=this;if(a._firstDayOfWeek!=b){a._firstDayOfWeek=b;a.invalidate();a.raisePropertyChanged("firstDayOfWeek")}},get_cssClass:function(){return this._cssClass},set_cssClass:function(b){var a=this;if(a._cssClass!=b){a._cssClass&&a.get_isInitialized()&&Sys.UI.DomElement.removeCssClass(a._container,a._cssClass);a._cssClass=b;a._cssClass&&a.get_isInitialized()&&Sys.UI.DomElement.addCssClass(a._container,a._cssClass);a.raisePropertyChanged("cssClass")}},get_todayButton:function(){return this._today},get_dayCell:function(b,a){if(this._daysBody)return this._daysBody.rows[b].cells[a].firstChild;return null},add_showing:function(a){this.get_events().addHandler("showing",a)},remove_showing:function(a){this.get_events().removeHandler("showing",a)},raiseShowing:function(b){var a=this.get_events().getHandler("showing");a&&a(this,b)},add_shown:function(a){this.get_events().addHandler("shown",a)},remove_shown:function(a){this.get_events().removeHandler("shown",a)},raiseShown:function(){var a=this.get_events().getHandler("shown");a&&a(this,Sys.EventArgs.Empty)},add_hiding:function(a){this.get_events().addHandler("hiding",a)},remove_hiding:function(a){this.get_events().removeHandler("hiding",a)},raiseHiding:function(b){var a=this.get_events().getHandler("hiding");a&&a(this,b)},add_hidden:function(a){this.get_events().addHandler("hidden",a)},remove_hidden:function(a){this.get_events().removeHandler("hidden",a)},raiseHidden:function(){var a=this.get_events().getHandler("hidden");a&&a(this,Sys.EventArgs.Empty)},add_dateSelectionChanged:function(a){this.get_events().addHandler("dateSelectionChanged",a)},remove_dateSelectionChanged:function(a){this.get_events().removeHandler("dateSelectionChanged",a)},raiseDateSelectionChanged:function(){var a=this.get_events().getHandler("dateSelectionChanged");a&&a(this,Sys.EventArgs.Empty)},initialize:function(){var b=null,a=this;AjaxControlToolkit.CalendarBehavior.callBaseMethod(a,"initialize");var d=a.get_element();$addHandlers(d,a._element$delegates);a._button&&$addHandlers(a._button,a._button$delegates);a._modeChangeMoveTopOrLeftAnimation=new AjaxControlToolkit.Animation.LengthAnimation(b,b,b,"style",b,0,0,"px");a._modeChangeMoveBottomOrRightAnimation=new AjaxControlToolkit.Animation.LengthAnimation(b,b,b,"style",b,0,0,"px");a._modeChangeAnimation=new AjaxControlToolkit.Animation.ParallelAnimation(b,.25,b,[a._modeChangeMoveTopOrLeftAnimation,a._modeChangeMoveBottomOrRightAnimation]);var c=a.get_selectedDate();c&&a.set_selectedDate(c)},dispose:function(){var b=null,a=this;if(a._popupBehavior){a._popupBehavior.dispose();a._popupBehavior=b}a._modes=b;a._modeOrder=b;if(a._modeChangeMoveTopOrLeftAnimation){a._modeChangeMoveTopOrLeftAnimation.dispose();a._modeChangeMoveTopOrLeftAnimation=b}if(a._modeChangeMoveBottomOrRightAnimation){a._modeChangeMoveBottomOrRightAnimation.dispose();a._modeChangeMoveBottomOrRightAnimation=b}if(a._modeChangeAnimation){a._modeChangeAnimation.dispose();a._modeChangeAnimation=b}if(a._container){a._container.parentNode&&a._container.parentNode.removeChild(a._container);a._container=b}if(a._popupDiv){$common.removeHandlers(a._popupDiv,a._popup$delegates);a._popupDiv=b}if(a._prevArrow){$common.removeHandlers(a._prevArrow,a._cell$delegates);a._prevArrow=b}if(a._nextArrow){$common.removeHandlers(a._nextArrow,a._cell$delegates);a._nextArrow=b}if(a._title){$common.removeHandlers(a._title,a._cell$delegates);a._title=b}if(a._today){$common.removeHandlers(a._today,a._cell$delegates);a._today=b}if(a._button){$common.removeHandlers(a._button,a._button$delegates);a._button=b}if(a._daysBody){for(var c=0;c<a._daysBody.rows.length;c++)for(var e=a._daysBody.rows[c],d=0;d<e.cells.length;d++)$common.removeHandlers(e.cells[d].firstChild,a._cell$delegates);a._daysBody=b}if(a._monthsBody){for(var c=0;c<a._monthsBody.rows.length;c++)for(var e=a._monthsBody.rows[c],d=0;d<e.cells.length;d++)$common.removeHandlers(e.cells[d].firstChild,a._cell$delegates);a._monthsBody=b}if(a._yearsBody){for(var c=0;c<a._yearsBody.rows.length;c++)for(var e=a._yearsBody.rows[c],d=0;d<e.cells.length;d++)$common.removeHandlers(e.cells[d].firstChild,a._cell$delegates);a._yearsBody=b}var f=a.get_element();$common.removeHandlers(f,a._element$delegates);AjaxControlToolkit.CalendarBehavior.callBaseMethod(a,"dispose")},show:function(){var b=true,a=this;a._ensureCalendar();if(!a._isOpen){var c=new Sys.CancelEventArgs;a.raiseShowing(c);if(c.get_cancel())return;a._isOpen=b;a._popupBehavior.show();if(a._firstPopUp){a._switchMonth(null,b);switch(a._defaultView){case AjaxControlToolkit.CalendarDefaultView.Months:a._switchMode("months",b);break;case AjaxControlToolkit.CalendarDefaultView.Years:a._switchMode("years",b)}a._firstPopUp=false}a.raiseShown()}},hide:function(){var a=this;if(a._isOpen){var b=new Sys.CancelEventArgs;a.raiseHiding(b);if(b.get_cancel())return;a._container&&a._popupBehavior.hide();a._isOpen=false;a.raiseHidden();a._popupMouseDown=false}},focus:function(){if(this._button)this._button.focus();else this.get_element().focus()},blur:function(b){var a=this;if(!b&&Sys.Browser.agent===Sys.Browser.Opera)a._blur.post(true);else{!a._popupMouseDown&&a.hide();a._popupMouseDown=false}},suspendLayout:function(){this._layoutSuspended++},resumeLayout:function(){var a=this;a._layoutSuspended--;if(a._layoutSuspended<=0){a._layoutSuspended=0;a._layoutRequested&&a._performLayout()}},invalidate:function(){if(this._layoutSuspended>0)this._layoutRequested=true;else this._performLayout()},_buildCalendar:function(){var a=this,c=a.get_element(),b=a.get_id();a._container=$common.createElementFromTemplate({nodeName:"div",properties:{id:b+"_container"},cssClasses:[a._cssClass],visible:false},c.parentNode);a._popupDiv=$common.createElementFromTemplate({nodeName:"div",events:a._popup$delegates,properties:{id:b+"_popupDiv"},cssClasses:["ajax__calendar_container"]},a._container)},_buildHeader:function(){var b="div",a=this,c=a.get_id();a._header=$common.createElementFromTemplate({nodeName:b,properties:{id:c+"_header"},cssClasses:["ajax__calendar_header"]},a._popupDiv);var e=$common.createElementFromTemplate({nodeName:b},a._header);a._prevArrow=$common.createElementFromTemplate({nodeName:b,properties:{id:c+"_prevArrow",mode:"prev"},events:a._cell$delegates,cssClasses:["ajax__calendar_prev"]},e);var d=$common.createElementFromTemplate({nodeName:b},a._header);a._nextArrow=$common.createElementFromTemplate({nodeName:b,properties:{id:c+"_nextArrow",mode:"next"},events:a._cell$delegates,cssClasses:["ajax__calendar_next"]},d);var f=$common.createElementFromTemplate({nodeName:b},a._header);a._title=$common.createElementFromTemplate({nodeName:b,properties:{id:c+"_title",mode:"title"},events:a._cell$delegates,cssClasses:["ajax__calendar_title"]},f)},_buildBody:function(){var a=this;a._body=$common.createElementFromTemplate({nodeName:"div",properties:{id:a.get_id()+"_body"},cssClasses:["ajax__calendar_body"]},a._popupDiv);a._buildDays();a._buildMonths();a._buildYears()},_buildFooter:function(){var a=this,b=$common.createElementFromTemplate({nodeName:"div"},a._popupDiv);a._today=$common.createElementFromTemplate({nodeName:"div",properties:{id:a.get_id()+"_today",mode:"today"},events:a._cell$delegates,cssClasses:["ajax__calendar_footer","ajax__calendar_today"]},b)},_buildDays:function(){var a=this,h=Sys.CultureInfo.CurrentCulture.dateTimeFormat,b=a.get_id();a._days=$common.createElementFromTemplate({nodeName:"div",properties:{id:b+"_days"},cssClasses:["ajax__calendar_days"]},a._body);a._modes["days"]=a._days;a._daysTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:b+"_daysTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},a._days);a._daysTableHeader=$common.createElementFromTemplate({nodeName:"thead",properties:{id:b+"_daysTableHeader"}},a._daysTable);a._daysTableHeaderRow=$common.createElementFromTemplate({nodeName:"tr",properties:{id:b+"_daysTableHeaderRow"}},a._daysTableHeader);for(var c=0;c<7;c++)var e=$common.createElementFromTemplate({nodeName:"td"},a._daysTableHeaderRow),g=$common.createElementFromTemplate({nodeName:"div",cssClasses:["ajax__calendar_dayname"]},e);a._daysBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:b+"_daysBody"}},a._daysTable);for(var c=0;c<6;c++)for(var f=$common.createElementFromTemplate({nodeName:"tr"},a._daysBody),d=0;d<7;d++)var e=$common.createElementFromTemplate({nodeName:"td"},f),g=$common.createElementFromTemplate({nodeName:"div",properties:{mode:"day",id:b+"_day_"+c+"_"+d,innerHTML:" "},events:a._cell$delegates,cssClasses:["ajax__calendar_day"]},e)},_buildMonths:function(){var a=this,g=Sys.CultureInfo.CurrentCulture.dateTimeFormat,d=a.get_id();a._months=$common.createElementFromTemplate({nodeName:"div",properties:{id:d+"_months"},cssClasses:["ajax__calendar_months"],visible:false},a._body);a._modes["months"]=a._months;a._monthsTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:d+"_monthsTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},a._months);a._monthsBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:d+"_monthsBody"}},a._monthsTable);for(var b=0;b<3;b++)for(var f=$common.createElementFromTemplate({nodeName:"tr"},a._monthsBody),c=0;c<4;c++)var e=$common.createElementFromTemplate({nodeName:"td"},f),h=$common.createElementFromTemplate({nodeName:"div",properties:{id:d+"_month_"+b+"_"+c,mode:"month",month:b*4+c,innerHTML:"<br />"+g.AbbreviatedMonthNames[b*4+c]},events:a._cell$delegates,cssClasses:["ajax__calendar_month"]},e)},_buildYears:function(){var a=this,b=a.get_id();a._years=$common.createElementFromTemplate({nodeName:"div",properties:{id:b+"_years"},cssClasses:["ajax__calendar_years"],visible:false},a._body);a._modes["years"]=a._years;a._yearsTable=$common.createElementFromTemplate({nodeName:"table",properties:{id:b+"_yearsTable",cellPadding:0,cellSpacing:0,border:0,style:{margin:"auto"}}},a._years);a._yearsBody=$common.createElementFromTemplate({nodeName:"tbody",properties:{id:b+"_yearsBody"}},a._yearsTable);for(var c=0;c<3;c++)for(var f=$common.createElementFromTemplate({nodeName:"tr"},a._yearsBody),d=0;d<4;d++)var e=$common.createElementFromTemplate({nodeName:"td"},f),g=$common.createElementFromTemplate({nodeName:"div",properties:{id:b+"_year_"+c+"_"+d,mode:"year",year:c*4+d-1},events:a._cell$delegates,cssClasses:["ajax__calendar_year"]},e)},_performLayout:function(){var l="ajax__calendar_active",k="ajax__calendar_other",a=this,t=a.get_element();if(!t)return;if(!a.get_isInitialized())return;if(!a._isOpen)return;var s=Sys.CultureInfo.CurrentCulture.dateTimeFormat,u=a.get_selectedDate(),c=a._getEffectiveVisibleDate(),p=a.get_todaysDate();switch(a._mode){case "days":var o=a._getFirstDayOfWeek(),j=c.getDay()-o;if(j<=0)j+=7;for(var q=new Date(c.getFullYear(),c.getMonth(),c.getDate()-j,a._hourOffsetForDst),f=q,e=0;e<7;e++){var d=a._daysTableHeaderRow.cells[e].firstChild;d.firstChild&&d.removeChild(d.firstChild);d.appendChild(document.createTextNode(s.ShortestDayNames[(e+o)%7]))}for(var n=0;n<6;n++)for(var r=a._daysBody.rows[n],m=0;m<7;m++){var d=r.cells[m].firstChild;d.firstChild&&d.removeChild(d.firstChild);d.appendChild(document.createTextNode(f.getDate()));d.title=f.localeFormat("D");d.date=f;$common.removeCssClasses(d.parentNode,[k,l]);Sys.UI.DomElement.addCssClass(d.parentNode,a._getCssClass(d.date,"d"));f=new Date(f.getFullYear(),f.getMonth(),f.getDate()+1,a._hourOffsetForDst)}a._prevArrow.date=new Date(c.getFullYear(),c.getMonth()-1,1,a._hourOffsetForDst);a._nextArrow.date=new Date(c.getFullYear(),c.getMonth()+1,1,a._hourOffsetForDst);a._title.firstChild&&a._title.removeChild(a._title.firstChild);a._title.appendChild(document.createTextNode(c.localeFormat(a.get_daysModeTitleFormat())));a._title.date=c;break;case "months":for(var e=0;e<a._monthsBody.rows.length;e++)for(var i=a._monthsBody.rows[e],h=0;h<i.cells.length;h++){var b=i.cells[h].firstChild;b.date=new Date(c.getFullYear(),b.month,1,a._hourOffsetForDst);b.title=b.date.localeFormat("Y");$common.removeCssClasses(b.parentNode,[k,l]);Sys.UI.DomElement.addCssClass(b.parentNode,a._getCssClass(b.date,"M"))}a._title.firstChild&&a._title.removeChild(a._title.firstChild);a._title.appendChild(document.createTextNode(c.localeFormat("yyyy")));a._title.date=c;a._prevArrow.date=new Date(c.getFullYear()-1,0,1,a._hourOffsetForDst);a._nextArrow.date=new Date(c.getFullYear()+1,0,1,a._hourOffsetForDst);break;case "years":for(var g=Math.floor(c.getFullYear()/10)*10,e=0;e<a._yearsBody.rows.length;e++)for(var i=a._yearsBody.rows[e],h=0;h<i.cells.length;h++){var b=i.cells[h].firstChild;b.date=new Date(g+b.year,0,1,a._hourOffsetForDst);if(b.firstChild)b.removeChild(b.lastChild);else b.appendChild(document.createElement("br"));b.appendChild(document.createTextNode(g+b.year));$common.removeCssClasses(b.parentNode,[k,l]);Sys.UI.DomElement.addCssClass(b.parentNode,a._getCssClass(b.date,"y"))}a._title.firstChild&&a._title.removeChild(a._title.firstChild);a._title.appendChild(document.createTextNode(g.toString()+"-"+(g+9).toString()));a._title.date=c;a._prevArrow.date=new Date(g-10,0,1,a._hourOffsetForDst);a._nextArrow.date=new Date(g+10,0,1,a._hourOffsetForDst)}a._today.firstChild&&a._today.removeChild(a._today.firstChild);a._today.appendChild(document.createTextNode(String.format(AjaxControlToolkit.Resources.Calendar_Today,p.localeFormat(a.get_todaysDateFormat()))));a._today.date=p},_ensureCalendar:function(){var a=this;if(!a._container){var b=a.get_element();a._buildCalendar();a._buildHeader();a._buildBody();a._buildFooter();a._popupBehavior=new $create(AjaxControlToolkit.PopupBehavior,{parentElement:b},{},{},a._container);if(a._popupPosition==AjaxControlToolkit.CalendarPosition.TopLeft)a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.TopLeft);else if(a._popupPosition==AjaxControlToolkit.CalendarPosition.TopRight)a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.TopRight);else if(a._popupPosition==AjaxControlToolkit.CalendarPosition.BottomRight)a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.BottomRight);else if(a._popupPosition==AjaxControlToolkit.CalendarPosition.Right)a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.Right);else if(a._popupPosition==AjaxControlToolkit.CalendarPosition.Left)a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.Left);else a._popupBehavior.set_positioningMode(AjaxControlToolkit.PositioningMode.BottomLeft)}},_fireChanged:function(){var a=this.get_element();if(document.createEventObject)a.fireEvent("onchange");else if(document.createEvent){var b=document.createEvent("HTMLEvents");b.initEvent("change",true,true);a.dispatchEvent(b)}},_switchMonth:function(e,h){var f="left",c=true,a=this;if(a._isAnimating)return;var g=a._getEffectiveVisibleDate();if(e&&e.getFullYear()==g.getFullYear()&&e.getMonth()==g.getMonth())h=c;if(a._animated&&!h){a._isAnimating=c;var d=a._modes[a._mode],b=d.cloneNode(c);a._body.appendChild(b);if(g>e){$common.setLocation(d,{x:-162,y:0});$common.setVisible(d,c);a._modeChangeMoveTopOrLeftAnimation.set_propertyKey(f);a._modeChangeMoveTopOrLeftAnimation.set_target(d);a._modeChangeMoveTopOrLeftAnimation.set_startValue(-a._width);a._modeChangeMoveTopOrLeftAnimation.set_endValue(0);$common.setLocation(b,{x:0,y:0});$common.setVisible(b,c);a._modeChangeMoveBottomOrRightAnimation.set_propertyKey(f);a._modeChangeMoveBottomOrRightAnimation.set_target(b);a._modeChangeMoveBottomOrRightAnimation.set_startValue(0);a._modeChangeMoveBottomOrRightAnimation.set_endValue(a._width)}else{$common.setLocation(b,{x:0,y:0});$common.setVisible(b,c);a._modeChangeMoveTopOrLeftAnimation.set_propertyKey(f);a._modeChangeMoveTopOrLeftAnimation.set_target(b);a._modeChangeMoveTopOrLeftAnimation.set_endValue(-a._width);a._modeChangeMoveTopOrLeftAnimation.set_startValue(0);$common.setLocation(d,{x:162,y:0});$common.setVisible(d,c);a._modeChangeMoveBottomOrRightAnimation.set_propertyKey(f);a._modeChangeMoveBottomOrRightAnimation.set_target(d);a._modeChangeMoveBottomOrRightAnimation.set_endValue(0);a._modeChangeMoveBottomOrRightAnimation.set_startValue(a._width)}a._visibleDate=e;a.invalidate();var i=Function.createDelegate(a,function(){this._body.removeChild(b);b=null;this._isAnimating=false;this._modeChangeAnimation.remove_ended(i)});a._modeChangeAnimation.add_ended(i);a._modeChangeAnimation.play()}else{a._visibleDate=e;a.invalidate()}},_switchMode:function(e,h){var f="top",d=true,a=this;if(a._isAnimating||a._mode==e)return;var i=a._modeOrder[a._mode]<a._modeOrder[e],c=a._modes[a._mode],b=a._modes[e];a._mode=e;if(a._animated&&!h){a._isAnimating=d;a.invalidate();if(i){$common.setLocation(b,{x:0,y:-a._height});$common.setVisible(b,d);a._modeChangeMoveTopOrLeftAnimation.set_propertyKey(f);a._modeChangeMoveTopOrLeftAnimation.set_target(b);a._modeChangeMoveTopOrLeftAnimation.set_startValue(-a._height);a._modeChangeMoveTopOrLeftAnimation.set_endValue(0);$common.setLocation(c,{x:0,y:0});$common.setVisible(c,d);a._modeChangeMoveBottomOrRightAnimation.set_propertyKey(f);a._modeChangeMoveBottomOrRightAnimation.set_target(c);a._modeChangeMoveBottomOrRightAnimation.set_startValue(0);a._modeChangeMoveBottomOrRightAnimation.set_endValue(a._height)}else{$common.setLocation(c,{x:0,y:0});$common.setVisible(c,d);a._modeChangeMoveTopOrLeftAnimation.set_propertyKey(f);a._modeChangeMoveTopOrLeftAnimation.set_target(c);a._modeChangeMoveTopOrLeftAnimation.set_endValue(-a._height);a._modeChangeMoveTopOrLeftAnimation.set_startValue(0);$common.setLocation(b,{x:0,y:139});$common.setVisible(b,d);a._modeChangeMoveBottomOrRightAnimation.set_propertyKey(f);a._modeChangeMoveBottomOrRightAnimation.set_target(b);a._modeChangeMoveBottomOrRightAnimation.set_endValue(0);a._modeChangeMoveBottomOrRightAnimation.set_startValue(a._height)}var g=Function.createDelegate(a,function(){this._isAnimating=false;this._modeChangeAnimation.remove_ended(g)});a._modeChangeAnimation.add_ended(g);a._modeChangeAnimation.play()}else{a._mode=e;$common.setVisible(c,false);a.invalidate();$common.setVisible(b,d);$common.setLocation(b,{x:0,y:0})}},_isSelected:function(c,d){var a=false,b=this.get_selectedDate();if(!b)return a;switch(d){case "d":if(c.getDate()!=b.getDate())return a;case "M":if(c.getMonth()!=b.getMonth())return a;case "y":if(c.getFullYear()!=b.getFullYear())return a}return true},_isOther:function(a,d){var b=this._getEffectiveVisibleDate();switch(d){case "d":return a.getFullYear()!=b.getFullYear()||a.getMonth()!=b.getMonth();case "M":return false;case "y":var c=Math.floor(b.getFullYear()/10)*10;return a.getFullYear()<c||c+10<=a.getFullYear()}return false},_getCssClass:function(a,b){if(this._isSelected(a,b))return "ajax__calendar_active";else if(this._isOther(a,b))return "ajax__calendar_other";else return ""},_getEffectiveVisibleDate:function(){var b=this,a=b.get_visibleDate();if(a==null)a=b.get_selectedDate();if(a==null)a=b.get_todaysDate();return new Date(a.getFullYear(),a.getMonth(),1,b._hourOffsetForDst)},_getFirstDayOfWeek:function(){if(this.get_firstDayOfWeek()!=AjaxControlToolkit.FirstDayOfWeek.Default)return this.get_firstDayOfWeek();return Sys.CultureInfo.CurrentCulture.dateTimeFormat.FirstDayOfWeek},_parseTextValue:function(b){var a=null;if(b)a=Date.parseLocale(b,this.get_format());if(isNaN(a))a=null;return a},_element_onfocus:function(){var a=this;if(!a._enabled)return;if(!a._button){a.show();a._popupMouseDown=false}},_element_onblur:function(){if(!this._enabled)return;!this._button&&this.blur()},_element_onchange:function(){var a=this;if(!a._selectedDateChanging){var b=a._parseTextValue(a._textbox.get_Value());if(b)b=b.getDateOnly();a._selectedDate=b;a._isOpen&&a._switchMonth(a._selectedDate,a._selectedDate==null)}},_element_onkeypress:function(a){if(!this._enabled)return;if(!this._button&&a.charCode==Sys.UI.Key.esc){a.stopPropagation();a.preventDefault();this.hide()}},_element_onclick:function(){var a=this;if(!a._enabled)return;if(!a._button){a.show();a._popupMouseDown=false}},_popup_onevent:function(a){a.stopPropagation();a.preventDefault()},_popup_onmousedown:function(){this._popupMouseDown=true},_popup_onmouseup:function(){var a=this;Sys.Browser.agent===Sys.Browser.Opera&&a._blur.get_isPending()&&a._blur.cancel();a._popupMouseDown=false;a.focus()},_cell_onmouseover:function(e){var c="ajax__calendar_hover";e.stopPropagation();if(Sys.Browser.agent===Sys.Browser.Safari)for(var a=0;a<this._daysBody.rows.length;a++)for(var d=this._daysBody.rows[a],b=0;b<d.cells.length;b++)Sys.UI.DomElement.removeCssClass(d.cells[b].firstChild.parentNode,c);var f=e.target;Sys.UI.DomElement.addCssClass(f.parentNode,c)},_cell_onmouseout:function(a){a.stopPropagation();var b=a.target;Sys.UI.DomElement.removeCssClass(b.parentNode,"ajax__calendar_hover")},_cell_onclick:function(e){var c="months",d="days",a=this;e.stopPropagation();e.preventDefault();if(!a._enabled)return;var b=e.target,f=a._getEffectiveVisibleDate();Sys.UI.DomElement.removeCssClass(b.parentNode,"ajax__calendar_hover");switch(b.mode){case "prev":case "next":a._switchMonth(b.date);break;case "title":switch(a._mode){case d:a._switchMode(c);break;case c:a._switchMode("years")}break;case "month":if(b.month==f.getMonth())a._switchMode(d);else{a._visibleDate=b.date;a._switchMode(d)}break;case "year":if(b.date.getFullYear()==f.getFullYear())a._switchMode(c);else{a._visibleDate=b.date;a._switchMode(c)}break;case "day":a.set_selectedDate(b.date);a._switchMonth(b.date);a._blur.post(true);a.raiseDateSelectionChanged();break;case "today":a.set_selectedDate(b.date);a._switchMonth(b.date);a._blur.post(true);a.raiseDateSelectionChanged()}},_button_onclick:function(b){var a=this;b.preventDefault();b.stopPropagation();if(!a._enabled)return;if(!a._isOpen)a.show();else a.hide();a.focus();a._popupMouseDown=false},_button_onblur:function(){var a=this;if(!a._enabled)return;!a._popupMouseDown&&a.hide();a._popupMouseDown=false},_button_onkeypress:function(a){if(!this._enabled)return;if(a.charCode==Sys.UI.Key.esc){a.stopPropagation();a.preventDefault();this.hide()}this._popupMouseDown=false}};AjaxControlToolkit.CalendarBehavior.registerClass("AjaxControlToolkit.CalendarBehavior",AjaxControlToolkit.BehaviorBase);AjaxControlToolkit.CalendarPosition=function(){throw Error.invalidOperation();};AjaxControlToolkit.CalendarPosition.prototype={BottomLeft:0,BottomRight:1,TopLeft:2,TopRight:3,Right:4,Left:5};AjaxControlToolkit.CalendarPosition.registerEnum("AjaxControlToolkit.CalendarPosition");AjaxControlToolkit.CalendarDefaultView=function(){throw Error.invalidOperation();};AjaxControlToolkit.CalendarDefaultView.prototype={Days:0,Months:1,Years:2};AjaxControlToolkit.CalendarDefaultView.registerEnum("AjaxControlToolkit.CalendarDefaultView");
|
|
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded(); |