@@ -0,0 +1,438 @@
// CalendarDateSelect version 1.10.11 - a prototype based date picker
// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
if ( typeof Prototype == 'undefined' ) alert ( "CalendarDateSelect ошибка: Класс-прототип не найден. Пожалуйста убедитесь, что ваше приложение подключает prototype.js (.g. <%= javascript_include_tag :defaults %>) *перед* подключен calendar_date_select.js (.g. <%= calendar_date_select_includes %>)." ) ;
if ( Prototype . Version < "1.6" ) alert ( "Требуется класс-прототип 1.6.0. Если используются ранние версии класса- прототипа, используйте calendar_date_select версии 1.8.3" ) ;
Element . addMethods ( {
purgeChildren : function ( element ) { $A ( element . childNodes ) . each ( function ( e ) { $ ( e ) . remove ( ) ; } ) ; } ,
build : function ( element , type , options , style ) {
var newElement = Element . buildAndAppend ( type , options , style ) ;
element . appendChild ( newElement ) ;
return newElement ;
}
} ) ;
Element . buildAndAppend = function ( type , options , style )
{
var e = $ ( document . createElement ( type ) ) ;
$H ( options ) . each ( function ( pair ) { eval ( "e." + pair . key + " = pair.value" ) ; } ) ;
if ( style )
$H ( style ) . each ( function ( pair ) { eval ( "e.style." + pair . key + " = pair.value" ) ; } ) ;
return e ;
} ;
nil = null ;
Date . one _day = 24 * 60 * 60 * 1000 ;
Date . weekdays = $w ( "П В С Ч П С В " ) ;
Date . first _day _of _week = 1 ;
Date . months = $w ( "Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь" ) ;
Date . padded2 = function ( hour ) { var padded2 = parseInt ( hour , 10 ) ; if ( hour < 10 ) padded2 = "0" + padded2 ; return padded2 ; }
Date . prototype . getPaddedMinutes = function ( ) { return Date . padded2 ( this . getMinutes ( ) ) ; }
Date . prototype . getAMPMHour = function ( ) { var hour = this . getHours ( ) ; return ( hour == 0 ) ? 12 : ( hour > 12 ? hour - 12 : hour ) }
Date . prototype . getAMPM = function ( ) { return ( this . getHours ( ) < 12 ) ? "AM" : "PM" ; }
Date . prototype . stripTime = function ( ) { return new Date ( this . getFullYear ( ) , this . getMonth ( ) , this . getDate ( ) ) ; } ;
Date . prototype . daysDistance = function ( compare _date ) { return Math . round ( ( compare _date - this ) / Date . one _day ) ; } ;
/*Date.prototype.toFormattedString = function(include_time){
var hour, str;
str = Date.months[this.getMonth()] + " " + this.getDate() + ", " + this.getFullYear();
if (include_time) { hour = this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
return str;
}*/
Date . prototype . toFormattedString = function ( include _time )
{
str = Date . padded2 ( this . getDate ( ) ) + "." + Date . padded2 ( this . getMonth ( ) + 1 ) + "." + this . getFullYear ( ) ;
if ( include _time ) { str += " " + this . getHours ( ) + ":" + this . getPaddedMinutes ( ) }
return str ;
}
Date . parseFormattedString = function ( string ) { return new Date ( string ) ; }
Math . floor _to _interval = function ( n , i ) { return Math . floor ( n / i ) * i ; }
window . f _height = function ( ) { return ( [ window . innerHeight ? window . innerHeight : null , document . documentElement ? document . documentElement . clientHeight : null , document . body ? document . body . clientHeight : null ] . select ( function ( x ) { return x > 0 } ) . first ( ) || 0 ) ; }
window . f _scrollTop = function ( ) { return ( [ window . pageYOffset ? window . pageYOffset : null , document . documentElement ? document . documentElement . scrollTop : null , document . body ? document . body . scrollTop : null ] . select ( function ( x ) { return x > 0 } ) . first ( ) || 0 ) ; }
_translations = {
"OK" : "OK" ,
"Now" : "Сейчас" ,
"Today" : "Сегодня"
}
SelectBox = Class . create ( ) ;
SelectBox . prototype = {
initialize : function ( parent _element , values , html _options , style _options ) {
this . element = $ ( parent _element ) . build ( "select" , html _options , style _options ) ;
this . populate ( values ) ;
} ,
populate : function ( values ) {
this . element . purgeChildren ( ) ;
var that = this ; $A ( values ) . each ( function ( pair ) { if ( typeof ( pair ) != "object" ) { pair = [ pair , pair ] } ; that . element . build ( "option" , { value : pair [ 1 ] , innerHTML : pair [ 0 ] } ) } ) ;
} ,
setValue : function ( value ) {
var e = this . element ;
var matched = false ;
$R ( 0 , e . options . length - 1 ) . each ( function ( i ) { if ( e . options [ i ] . value == value . toString ( ) ) { e . selectedIndex = i ; matched = true ; } ; } ) ;
return matched ;
} ,
getValue : function ( ) { return $F ( this . element ) }
}
CalendarDateSelect = Class . create ( ) ;
CalendarDateSelect . prototype = {
initialize : function ( target _element , options ) {
this . target _element = $ ( target _element ) ; // make sure it's an element, not a string
if ( ! this . target _element ) { alert ( "Выбранный элемент " + target _element + " не найден!" ) ; return false ; }
if ( this . target _element . tagName != "INPUT" ) this . target _element = this . target _element . down ( "INPUT" )
this . target _element . calendar _date _select = this ;
this . last _click _at = 0 ;
// initialize the date control
this . options = $H ( {
embedded : false ,
popup : nil ,
time : false ,
buttons : true ,
year _range : 10 ,
close _on _click : nil ,
minute _interval : 5 ,
popup _by : this . target _element ,
month _year : "dropdowns" ,
onchange : this . target _element . onchange ,
valid _date _check : nil
} ) . merge ( options || { } ) ;
this . use _time = this . options . get ( "time" ) ;
this . parseDate ( ) ;
this . callback ( "before_show" )
this . initCalendarDiv ( ) ;
if ( ! this . options . get ( "embedded" ) ) {
this . positionCalendarDiv ( )
// set the click handler to check if a user has clicked away from the document
Event . observe ( document , "mousedown" , this . closeIfClickedOut _handler = this . closeIfClickedOut . bindAsEventListener ( this ) ) ;
Event . observe ( document , "keypress" , this . keyPress _handler = this . keyPress . bindAsEventListener ( this ) ) ;
}
this . callback ( "after_show" )
} ,
positionCalendarDiv : function ( ) {
var above = false ;
var c _pos = this . calendar _div . cumulativeOffset ( ) , c _left = c _pos [ 0 ] , c _top = c _pos [ 1 ] , c _dim = this . calendar _div . getDimensions ( ) , c _height = c _dim . height , c _width = c _dim . width ;
var w _top = window . f _scrollTop ( ) , w _height = window . f _height ( ) ;
var e _dim = $ ( this . options . get ( "popup_by" ) ) . cumulativeOffset ( ) , e _top = e _dim [ 1 ] , e _left = e _dim [ 0 ] , e _height = $ ( this . options . get ( "popup_by" ) ) . getDimensions ( ) . height , e _bottom = e _top + e _height ;
if ( ( ( e _bottom + c _height ) > ( w _top + w _height ) ) && ( e _bottom - c _height > w _top ) ) above = true ;
var left _px = e _left . toString ( ) + "px" , top _px = ( above ? ( e _top - c _height ) : ( e _top + e _height ) ) . toString ( ) + "px" ;
this . calendar _div . style . left = left _px ; this . calendar _div . style . top = top _px ;
this . calendar _div . setStyle ( { visibility : "" } ) ;
// draw an iframe behind the calendar -- ugly hack to make IE 6 happy
if ( navigator . appName == "Microsoft Internet Explorer" ) this . iframe = $ ( document . body ) . build ( "iframe" , { src : "javascript:false" , className : "ie6_blocker" } , { left : left _px , top : top _px , height : c _height . toString ( ) + "px" , width : c _width . toString ( ) + "px" , border : "0px" } )
} ,
initCalendarDiv : function ( ) {
if ( this . options . get ( "embedded" ) ) {
var parent = this . target _element . parentNode ;
var style = { }
} else {
var parent = document . body
var style = { position : "absolute" , visibility : "hidden" , left : 0 , top : 0 }
}
this . calendar _div = $ ( parent ) . build ( 'div' , { className : "calendar_date_select" } , style ) ;
var that = this ;
// create the divs
$w ( "top header body buttons footer bottom" ) . each ( function ( name ) {
eval ( "var " + name + "_div = that." + name + "_div = that.calendar_div.build('div', { className: 'cds_" + name + "' }, { clear: 'left'} ); " ) ;
} ) ;
this . initHeaderDiv ( ) ;
this . initButtonsDiv ( ) ;
this . initCalendarGrid ( ) ;
this . updateFooter ( " " ) ;
this . refresh ( ) ;
this . setUseTime ( this . use _time ) ;
} ,
initHeaderDiv : function ( ) {
var header _div = this . header _div ;
this . close _button = header _div . build ( "a" , { innerHTML : "x" , href : "#" , onclick : function ( ) { this . close ( ) ; return false ; } . bindAsEventListener ( this ) , className : "close" } ) ;
this . next _month _button = header _div . build ( "a" , { innerHTML : ">" , href : "#" , onclick : function ( ) { this . navMonth ( this . date . getMonth ( ) + 1 ) ; return false ; } . bindAsEventListener ( this ) , className : "next" } ) ;
this . prev _month _button = header _div . build ( "a" , { innerHTML : "<" , href : "#" , onclick : function ( ) { this . navMonth ( this . date . getMonth ( ) - 1 ) ; return false ; } . bindAsEventListener ( this ) , className : "prev" } ) ;
if ( this . options . get ( "month_year" ) == "dropdowns" ) {
this . month _select = new SelectBox ( header _div , $R ( 0 , 11 ) . map ( function ( m ) { return [ Date . months [ m ] , m ] } ) , { className : "month" , onchange : function ( ) { this . navMonth ( this . month _select . getValue ( ) ) } . bindAsEventListener ( this ) } ) ;
this . year _select = new SelectBox ( header _div , [ ] , { className : "year" , onchange : function ( ) { this . navYear ( this . year _select . getValue ( ) ) } . bindAsEventListener ( this ) } ) ;
this . populateYearRange ( ) ;
} else {
this . month _year _label = header _div . build ( "span" )
}
} ,
initCalendarGrid : function ( ) {
var body _div = this . body _div ;
this . calendar _day _grid = [ ] ;
var days _table = body _div . build ( "table" , { cellPadding : "0px" , cellSpacing : "0px" , width : "100%" } )
// make the weekdays!
var weekdays _row = days _table . build ( "thead" ) . build ( "tr" ) ;
Date . weekdays . each ( function ( weekday ) {
weekdays _row . build ( "th" , { innerHTML : weekday } ) ;
} ) ;
var days _tbody = days _table . build ( "tbody" )
// Make the days!
var row _number = 0 , weekday ;
for ( var cell _index = 0 ; cell _index < 42 ; cell _index ++ )
{
weekday = ( cell _index + Date . first _day _of _week ) % 7 ;
if ( cell _index % 7 == 0 ) days _row = days _tbody . build ( "tr" , { className : 'row_' + row _number ++ } ) ;
( this . calendar _day _grid [ cell _index ] = days _row . build ( "td" , {
calendar _date _select : this ,
onmouseover : function ( ) { this . calendar _date _select . dayHover ( this ) ; } ,
onmouseout : function ( ) { this . calendar _date _select . dayHoverOut ( this ) } ,
onclick : function ( ) { this . calendar _date _select . updateSelectedDate ( this , true ) ; } ,
className : ( weekday == 0 ) || ( weekday == 6 ) ? " weekend" : "" //clear the class
} ,
{ cursor : "pointer" }
) ) . build ( "div" ) ;
this . calendar _day _grid [ cell _index ] ;
}
} ,
initButtonsDiv : function ( )
{
var buttons _div = this . buttons _div ;
if ( this . options . get ( "time" ) )
{
var blank _time = $A ( this . options . get ( "time" ) == "mixed" ? [ [ " - " , "" ] ] : [ ] ) ;
buttons _div . build ( "span" , { innerHTML : "@" , className : "at_sign" } ) ;
var t = new Date ( ) ;
this . hour _select = new SelectBox ( buttons _div ,
blank _time . concat ( $R ( 0 , 23 ) . map ( function ( x ) { t . setHours ( x ) ; return $A ( [ t . getHours ( ) , x ] ) } ) ) ,
{
calendar _date _select : this ,
onchange : function ( ) { this . calendar _date _select . updateSelectedDate ( { hour : this . value } ) ; } ,
className : "hour"
}
) ;
buttons _div . build ( "span" , { innerHTML : ":" , className : "seperator" } ) ;
var that = this ;
this . minute _select = new SelectBox ( buttons _div ,
blank _time . concat ( $R ( 0 , 59 ) . select ( function ( x ) { return ( x % that . options . get ( 'minute_interval' ) == 0 ) } ) . map ( function ( x ) { return $A ( [ Date . padded2 ( x ) , x ] ) ; } ) ) ,
{
calendar _date _select : this ,
onchange : function ( ) { this . calendar _date _select . updateSelectedDate ( { minute : this . value } ) } ,
className : "minute"
}
) ;
} else if ( ! this . options . get ( "buttons" ) ) buttons _div . remove ( ) ;
if ( this . options . get ( "buttons" ) ) {
buttons _div . build ( "span" , { innerHTML : " " } ) ;
if ( this . options . get ( "time" ) == "mixed" || ! this . options . get ( "time" ) ) b = buttons _div . build ( "a" , {
innerHTML : _translations [ "Today" ] ,
href : "#" ,
onclick : function ( ) { this . today ( false ) ; return false ; } . bindAsEventListener ( this )
} ) ;
if ( this . options . get ( "time" ) == "mixed" ) buttons _div . build ( "span" , { innerHTML : " | " , className : "button_seperator" } )
if ( this . options . get ( "time" ) ) b = buttons _div . build ( "a" , {
innerHTML : _translations [ "Now" ] ,
href : "#" ,
onclick : function ( ) { this . today ( true ) ; return false } . bindAsEventListener ( this )
} ) ;
if ( ! this . options . get ( "embedded" ) )
{
buttons _div . build ( "span" , { innerHTML : " " } ) ;
buttons _div . build ( "a" , { innerHTML : _translations [ "OK" ] , href : "#" , onclick : function ( ) { this . close ( ) ; return false ; } . bindAsEventListener ( this ) } ) ;
}
}
} ,
refresh : function ( )
{
this . refreshMonthYear ( ) ;
this . refreshCalendarGrid ( ) ;
this . setSelectedClass ( ) ;
this . updateFooter ( ) ;
} ,
refreshCalendarGrid : function ( ) {
this . beginning _date = new Date ( this . date ) . stripTime ( ) ;
this . beginning _date . setDate ( 1 ) ;
this . beginning _date . setHours ( 12 ) ; // Prevent daylight savings time boundaries from showing a duplicate day
var pre _days = this . beginning _date . getDay ( ) // draw some days before the fact
if ( pre _days < 3 ) pre _days += 7 ;
this . beginning _date . setDate ( 1 - pre _days + Date . first _day _of _week ) ;
var iterator = new Date ( this . beginning _date ) ;
var today = new Date ( ) . stripTime ( ) ;
var this _month = this . date . getMonth ( ) ;
vdc = this . options . get ( "valid_date_check" ) ;
for ( var cell _index = 0 ; cell _index < 42 ; cell _index ++ )
{
day = iterator . getDate ( ) ; month = iterator . getMonth ( ) ;
cell = this . calendar _day _grid [ cell _index ] ;
Element . remove ( cell . childNodes [ 0 ] ) ; div = cell . build ( "div" , { innerHTML : day } ) ;
if ( month != this _month ) div . className = "other" ;
cell . day = day ; cell . month = month ; cell . year = iterator . getFullYear ( ) ;
if ( vdc ) { if ( vdc ( iterator . stripTime ( ) ) ) cell . removeClassName ( "disabled" ) ; else cell . addClassName ( "disabled" ) } ;
iterator . setDate ( day + 1 ) ;
}
if ( this . today _cell ) this . today _cell . removeClassName ( "today" ) ;
if ( $R ( 0 , 41 ) . include ( days _until = this . beginning _date . stripTime ( ) . daysDistance ( today ) ) ) {
this . today _cell = this . calendar _day _grid [ days _until ] ;
this . today _cell . addClassName ( "today" ) ;
}
} ,
refreshMonthYear : function ( ) {
var m = this . date . getMonth ( ) ;
var y = this . date . getFullYear ( ) ;
// set the month
if ( this . options . get ( "month_year" ) == "dropdowns" )
{
this . month _select . setValue ( m , false ) ;
var e = this . year _select . element ;
if ( this . flexibleYearRange ( ) && ( ! ( this . year _select . setValue ( y , false ) ) || e . selectedIndex <= 1 || e . selectedIndex >= e . options . length - 2 ) ) this . populateYearRange ( ) ;
this . year _select . setValue ( y ) ;
} else {
this . month _year _label . update ( Date . months [ m ] + " " + y . toString ( ) ) ;
}
} ,
populateYearRange : function ( ) {
this . year _select . populate ( this . yearRange ( ) . toArray ( ) ) ;
} ,
yearRange : function ( ) {
if ( ! this . flexibleYearRange ( ) )
return $R ( this . options . get ( "year_range" ) [ 0 ] , this . options . get ( "year_range" ) [ 1 ] ) ;
var y = this . date . getFullYear ( ) ;
return $R ( y - this . options . get ( "year_range" ) , y + this . options . get ( "year_range" ) ) ;
} ,
flexibleYearRange : function ( ) { return ( typeof ( this . options . get ( "year_range" ) ) == "number" ) ; } ,
validYear : function ( year ) { if ( this . flexibleYearRange ( ) ) { return true ; } else { return this . yearRange ( ) . include ( year ) ; } } ,
dayHover : function ( element ) {
var hover _date = new Date ( this . selected _date ) ;
hover _date . setYear ( element . year ) ; hover _date . setMonth ( element . month ) ; hover _date . setDate ( element . day ) ;
this . updateFooter ( hover _date . toFormattedString ( this . use _time ) ) ;
} ,
dayHoverOut : function ( element ) { this . updateFooter ( ) ; } ,
clearSelectedClass : function ( ) { if ( this . selected _cell ) this . selected _cell . removeClassName ( "selected" ) ; } ,
setSelectedClass : function ( ) {
if ( ! this . selection _made ) return ;
this . clearSelectedClass ( )
if ( $R ( 0 , 42 ) . include ( days _until = this . beginning _date . stripTime ( ) . daysDistance ( this . selected _date . stripTime ( ) ) ) ) {
this . selected _cell = this . calendar _day _grid [ days _until ] ;
this . selected _cell . addClassName ( "selected" ) ;
}
} ,
reparse : function ( ) { this . parseDate ( ) ; this . refresh ( ) ; } ,
dateString : function ( ) {
return ( this . selection _made ) ? this . selected _date . toFormattedString ( this . use _time ) : " " ;
} ,
parseDate : function ( )
{
var value = $F ( this . target _element ) . strip ( )
this . selection _made = ( value != "" ) ;
this . date = value == "" ? NaN : Date . parseFormattedString ( this . options . get ( "date" ) || value ) ;
if ( isNaN ( this . date ) ) this . date = new Date ( ) ;
if ( ! this . validYear ( this . date . getFullYear ( ) ) ) this . date . setYear ( ( this . date . getFullYear ( ) < this . yearRange ( ) . start ) ? this . yearRange ( ) . start : this . yearRange ( ) . end ) ;
this . selected _date = new Date ( this . date ) ;
this . use _time = /[0-9]:[0-9]{2}/ . exec ( value ) ? true : false ;
this . date . setDate ( 1 ) ;
} ,
updateFooter : function ( text ) { if ( ! text ) text = this . dateString ( ) ; this . footer _div . purgeChildren ( ) ; this . footer _div . build ( "span" , { innerHTML : text } ) ; } ,
updateSelectedDate : function ( partsOrElement , via _click ) {
var parts = $H ( partsOrElement ) ;
if ( ( this . target _element . disabled || this . target _element . readOnly ) && this . options . get ( "popup" ) != "force" ) return false ;
if ( parts . get ( "day" ) ) {
var t _selected _date = this . selected _date , vdc = this . options . get ( "valid_date_check" ) ;
for ( var x = 0 ; x <= 3 ; x ++ ) t _selected _date . setDate ( parts . get ( "day" ) ) ;
t _selected _date . setYear ( parts . get ( "year" ) ) ;
t _selected _date . setMonth ( parts . get ( "month" ) ) ;
if ( vdc && ! vdc ( t _selected _date . stripTime ( ) ) ) { return false ; }
this . selected _date = t _selected _date ;
this . selection _made = true ;
}
if ( ! isNaN ( parts . get ( "hour" ) ) ) this . selected _date . setHours ( parts . get ( "hour" ) ) ;
if ( ! isNaN ( parts . get ( "minute" ) ) ) this . selected _date . setMinutes ( Math . floor _to _interval ( parts . get ( "minute" ) , this . options . get ( "minute_interval" ) ) ) ;
if ( parts . get ( "hour" ) === "" || parts . get ( "minute" ) === "" )
this . setUseTime ( false ) ;
else if ( ! isNaN ( parts . get ( "hour" ) ) || ! isNaN ( parts . get ( "minute" ) ) )
this . setUseTime ( true ) ;
this . updateFooter ( ) ;
this . setSelectedClass ( ) ;
if ( this . selection _made ) this . updateValue ( ) ;
if ( this . closeOnClick ( ) ) { this . close ( ) ; }
if ( via _click && ! this . options . get ( "embedded" ) ) {
if ( ( new Date ( ) - this . last _click _at ) < 333 ) this . close ( ) ;
this . last _click _at = new Date ( ) ;
}
} ,
closeOnClick : function ( ) {
if ( this . options . get ( "embedded" ) ) return false ;
if ( this . options . get ( "close_on_click" ) === nil )
return ( this . options . get ( "time" ) ) ? false : true
else
return ( this . options . get ( "close_on_click" ) )
} ,
navMonth : function ( month ) { ( target _date = new Date ( this . date ) ) . setMonth ( month ) ; return ( this . navTo ( target _date ) ) ; } ,
navYear : function ( year ) { ( target _date = new Date ( this . date ) ) . setYear ( year ) ; return ( this . navTo ( target _date ) ) ; } ,
navTo : function ( date ) {
if ( ! this . validYear ( date . getFullYear ( ) ) ) return false ;
this . date = date ;
this . date . setDate ( 1 ) ;
this . refresh ( ) ;
this . callback ( "after_navigate" , this . date ) ;
return true ;
} ,
setUseTime : function ( turn _on ) {
this . use _time = this . options . get ( "time" ) && ( this . options . get ( "time" ) == "mixed" ? turn _on : true ) // force use_time to true if time==true && time!="mixed"
if ( this . use _time && this . selected _date ) { // only set hour/minute if a date is already selected
var minute = Math . floor _to _interval ( this . selected _date . getMinutes ( ) , this . options . get ( "minute_interval" ) ) ;
var hour = this . selected _date . getHours ( ) ;
this . hour _select . setValue ( hour ) ;
this . minute _select . setValue ( minute )
} else if ( this . options . get ( "time" ) == "mixed" ) {
this . hour _select . setValue ( "" ) ; this . minute _select . setValue ( "" ) ;
}
} ,
updateValue : function ( ) {
var last _value = this . target _element . value ;
this . target _element . value = this . dateString ( ) ;
if ( last _value != this . target _element . value ) this . callback ( "onchange" ) ;
} ,
today : function ( now ) {
var d = new Date ( ) ; this . date = new Date ( ) ;
var o = $H ( { day : d . getDate ( ) , month : d . getMonth ( ) , year : d . getFullYear ( ) , hour : d . getHours ( ) , minute : d . getMinutes ( ) } ) ;
if ( ! now ) o = o . merge ( { hour : "" , minute : "" } ) ;
this . updateSelectedDate ( o , true ) ;
this . refresh ( ) ;
} ,
close : function ( ) {
if ( this . closed ) return false ;
this . callback ( "before_close" ) ;
this . target _element . calendar _date _select = nil ;
Event . stopObserving ( document , "mousedown" , this . closeIfClickedOut _handler ) ;
Event . stopObserving ( document , "keypress" , this . keyPress _handler ) ;
this . calendar _div . remove ( ) ; this . closed = true ;
if ( this . iframe ) this . iframe . remove ( ) ;
if ( this . target _element . type != "hidden" ) this . target _element . focus ( ) ;
this . callback ( "after_close" ) ;
} ,
closeIfClickedOut : function ( e ) {
if ( ! $ ( Event . element ( e ) ) . descendantOf ( this . calendar _div ) ) this . close ( ) ;
} ,
keyPress : function ( e ) {
if ( e . keyCode == Event . KEY _ESC ) this . close ( ) ;
} ,
callback : function ( name , param ) { if ( this . options . get ( name ) ) { this . options . get ( name ) . bind ( this . target _element ) ( param ) ; } }
}