ÿþ/ *  
   *   j Q u e r y   U I   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I  
   * /  
 j Q u e r y . u i | | ( f u n c t i o n ( c ) { v a r   i = c . f n . r e m o v e , d = c . b r o w s e r . m o z i l l a & & ( p a r s e F l o a t ( c . b r o w s e r . v e r s i o n ) < 1 . 9 ) ; c . u i = { v e r s i o n : " 1 . 7 . 2 " , p l u g i n : { a d d : f u n c t i o n ( k , l , n ) { v a r   m = c . u i [ k ] . p r o t o t y p e ; f o r ( v a r   j   i n   n ) { m . p l u g i n s [ j ] = m . p l u g i n s [ j ] | | [ ] ; m . p l u g i n s [ j ] . p u s h ( [ l , n [ j ] ] ) } } , c a l l : f u n c t i o n ( j , l , k ) { v a r   n = j . p l u g i n s [ l ] ; i f ( ! n | | ! j . e l e m e n t [ 0 ] . p a r e n t N o d e ) { r e t u r n } f o r ( v a r   m = 0 ; m < n . l e n g t h ; m + + ) { i f ( j . o p t i o n s [ n [ m ] [ 0 ] ] ) { n [ m ] [ 1 ] . a p p l y ( j . e l e m e n t , k ) } } } } , c o n t a i n s : f u n c t i o n ( k , j ) { r e t u r n   d o c u m e n t . c o m p a r e D o c u m e n t P o s i t i o n ? k . c o m p a r e D o c u m e n t P o s i t i o n ( j ) & 1 6 : k ! = = j & & k . c o n t a i n s ( j ) } , h a s S c r o l l : f u n c t i o n ( m , k ) { i f ( c ( m ) . c s s ( " o v e r f l o w " ) = = " h i d d e n " ) { r e t u r n   f a l s e } v a r   j = ( k & & k = = " l e f t " ) ? " s c r o l l L e f t " : " s c r o l l T o p " , l = f a l s e ; i f ( m [ j ] > 0 ) { r e t u r n   t r u e } m [ j ] = 1 ; l = ( m [ j ] > 0 ) ; m [ j ] = 0 ; r e t u r n   l } , i s O v e r A x i s : f u n c t i o n ( k , j , l ) { r e t u r n ( k > j ) & & ( k < ( j + l ) ) } , i s O v e r : f u n c t i o n ( o , k , n , m , j , l ) { r e t u r n   c . u i . i s O v e r A x i s ( o , n , j ) & & c . u i . i s O v e r A x i s ( k , m , l ) } , k e y C o d e : { B A C K S P A C E : 8 , C A P S _ L O C K : 2 0 , C O M M A : 1 8 8 , C O N T R O L : 1 7 , D E L E T E : 4 6 , D O W N : 4 0 , E N D : 3 5 , E N T E R : 1 3 , E S C A P E : 2 7 , H O M E : 3 6 , I N S E R T : 4 5 , L E F T : 3 7 , N U M P A D _ A D D : 1 0 7 , N U M P A D _ D E C I M A L : 1 1 0 , N U M P A D _ D I V I D E : 1 1 1 , N U M P A D _ E N T E R : 1 0 8 , N U M P A D _ M U L T I P L Y : 1 0 6 , N U M P A D _ S U B T R A C T : 1 0 9 , P A G E _ D O W N : 3 4 , P A G E _ U P : 3 3 , P E R I O D : 1 9 0 , R I G H T : 3 9 , S H I F T : 1 6 , S P A C E : 3 2 , T A B : 9 , U P : 3 8 } } ; i f ( d ) { v a r   f = c . a t t r , e = c . f n . r e m o v e A t t r , h = " h t t p : / / w w w . w 3 . o r g / 2 0 0 5 / 0 7 / a a a " , a = / ^ a r i a - / , b = / ^ w a i r o l e : / ; c . a t t r = f u n c t i o n ( k , j , l ) { v a r   m = l ! = = u n d e f i n e d ; r e t u r n ( j = = " r o l e " ? ( m ? f . c a l l ( t h i s , k , j , " w a i r o l e : " + l ) : ( f . a p p l y ( t h i s , a r g u m e n t s ) | | " " ) . r e p l a c e ( b , " " ) ) : ( a . t e s t ( j ) ? ( m ? k . s e t A t t r i b u t e N S ( h , j . r e p l a c e ( a , " a a a : " ) , l ) : f . c a l l ( t h i s , k , j . r e p l a c e ( a , " a a a : " ) ) ) : f . a p p l y ( t h i s , a r g u m e n t s ) ) ) } ; c . f n . r e m o v e A t t r = f u n c t i o n ( j ) { r e t u r n ( a . t e s t ( j ) ? t h i s . e a c h ( f u n c t i o n ( ) { t h i s . r e m o v e A t t r i b u t e N S ( h , j . r e p l a c e ( a , " " ) ) } ) : e . c a l l ( t h i s , j ) ) } } c . f n . e x t e n d ( { r e m o v e : f u n c t i o n ( ) { c ( " * " , t h i s ) . a d d ( t h i s ) . e a c h ( f u n c t i o n ( ) { c ( t h i s ) . t r i g g e r H a n d l e r ( " r e m o v e " ) } ) ; r e t u r n   i . a p p l y ( t h i s , a r g u m e n t s ) } , e n a b l e S e l e c t i o n : f u n c t i o n ( ) { r e t u r n   t h i s . a t t r ( " u n s e l e c t a b l e " , " o f f " ) . c s s ( " M o z U s e r S e l e c t " , " " ) . u n b i n d ( " s e l e c t s t a r t . u i " ) } , d i s a b l e S e l e c t i o n : f u n c t i o n ( ) { r e t u r n   t h i s . a t t r ( " u n s e l e c t a b l e " , " o n " ) . c s s ( " M o z U s e r S e l e c t " , " n o n e " ) . b i n d ( " s e l e c t s t a r t . u i " , f u n c t i o n ( ) { r e t u r n   f a l s e } ) } , s c r o l l P a r e n t : f u n c t i o n ( ) { v a r   j ; i f ( ( c . b r o w s e r . m s i e & & ( / ( s t a t i c | r e l a t i v e ) / ) . t e s t ( t h i s . c s s ( " p o s i t i o n " ) ) ) | | ( / a b s o l u t e / ) . t e s t ( t h i s . c s s ( " p o s i t i o n " ) ) ) { j = t h i s . p a r e n t s ( ) . f i l t e r ( f u n c t i o n ( ) { r e t u r n ( / ( r e l a t i v e | a b s o l u t e | f i x e d ) / ) . t e s t ( c . c u r C S S ( t h i s , " p o s i t i o n " , 1 ) ) & & ( / ( a u t o | s c r o l l ) / ) . t e s t ( c . c u r C S S ( t h i s , " o v e r f l o w " , 1 ) + c . c u r C S S ( t h i s , " o v e r f l o w - y " , 1 ) + c . c u r C S S ( t h i s , " o v e r f l o w - x " , 1 ) ) } ) . e q ( 0 ) } e l s e { j = t h i s . p a r e n t s ( ) . f i l t e r ( f u n c t i o n ( ) { r e t u r n ( / ( a u t o | s c r o l l ) / ) . t e s t ( c . c u r C S S ( t h i s , " o v e r f l o w " , 1 ) + c . c u r C S S ( t h i s , " o v e r f l o w - y " , 1 ) + c . c u r C S S ( t h i s , " o v e r f l o w - x " , 1 ) ) } ) . e q ( 0 ) } r e t u r n ( / f i x e d / ) . t e s t ( t h i s . c s s ( " p o s i t i o n " ) ) | | ! j . l e n g t h ? c ( d o c u m e n t ) : j } } ) ; c . e x t e n d ( c . e x p r [ " : " ] , { d a t a : f u n c t i o n ( l , k , j ) { r e t u r n   ! ! c . d a t a ( l , j [ 3 ] ) } , f o c u s a b l e : f u n c t i o n ( k ) { v a r   l = k . n o d e N a m e . t o L o w e r C a s e ( ) , j = c . a t t r ( k , " t a b i n d e x " ) ; r e t u r n ( / i n p u t | s e l e c t | t e x t a r e a | b u t t o n | o b j e c t / . t e s t ( l ) ? ! k . d i s a b l e d : " a " = = l | | " a r e a " = = l ? k . h r e f | | ! i s N a N ( j ) : ! i s N a N ( j ) ) & & ! c ( k ) [ " a r e a " = = l ? " p a r e n t s " : " c l o s e s t " ] ( " : h i d d e n " ) . l e n g t h } , t a b b a b l e : f u n c t i o n ( k ) { v a r   j = c . a t t r ( k , " t a b i n d e x " ) ; r e t u r n ( i s N a N ( j ) | | j > = 0 ) & & c ( k ) . i s ( " : f o c u s a b l e " ) } } ) ; f u n c t i o n   g ( m , n , o , l ) { f u n c t i o n   k ( q ) { v a r   p = c [ m ] [ n ] [ q ] | | [ ] ; r e t u r n ( t y p e o f   p = = " s t r i n g " ? p . s p l i t ( / , ? \ s + / ) : p ) } v a r   j = k ( " g e t t e r " ) ; i f ( l . l e n g t h = = 1 & & t y p e o f   l [ 0 ] = = " s t r i n g " ) { j = j . c o n c a t ( k ( " g e t t e r S e t t e r " ) ) } r e t u r n ( c . i n A r r a y ( o , j ) ! = - 1 ) } c . w i d g e t = f u n c t i o n ( k , j ) { v a r   l = k . s p l i t ( " . " ) [ 0 ] ; k = k . s p l i t ( " . " ) [ 1 ] ; c . f n [ k ] = f u n c t i o n ( p ) { v a r   n = ( t y p e o f   p = = " s t r i n g " ) , o = A r r a y . p r o t o t y p e . s l i c e . c a l l ( a r g u m e n t s , 1 ) ; i f ( n & & p . s u b s t r i n g ( 0 , 1 ) = = " _ " ) { r e t u r n   t h i s } i f ( n & & g ( l , k , p , o ) ) { v a r   m = c . d a t a ( t h i s [ 0 ] , k ) ; r e t u r n ( m ? m [ p ] . a p p l y ( m , o ) : u n d e f i n e d ) } r e t u r n   t h i s . e a c h ( f u n c t i o n ( ) { v a r   q = c . d a t a ( t h i s , k ) ; ( ! q & & ! n & & c . d a t a ( t h i s , k , n e w   c [ l ] [ k ] ( t h i s , p ) ) . _ i n i t ( ) ) ; ( q & & n & & c . i s F u n c t i o n ( q [ p ] ) & & q [ p ] . a p p l y ( q , o ) ) } ) } ; c [ l ] = c [ l ] | | { } ; c [ l ] [ k ] = f u n c t i o n ( o , n ) { v a r   m = t h i s ; t h i s . n a m e s p a c e = l ; t h i s . w i d g e t N a m e = k ; t h i s . w i d g e t E v e n t P r e f i x = c [ l ] [ k ] . e v e n t P r e f i x | | k ; t h i s . w i d g e t B a s e C l a s s = l + " - " + k ; t h i s . o p t i o n s = c . e x t e n d ( { } , c . w i d g e t . d e f a u l t s , c [ l ] [ k ] . d e f a u l t s , c . m e t a d a t a & & c . m e t a d a t a . g e t ( o ) [ k ] , n ) ; t h i s . e l e m e n t = c ( o ) . b i n d ( " s e t D a t a . " + k , f u n c t i o n ( q , p , r ) { i f ( q . t a r g e t = = o ) { r e t u r n   m . _ s e t D a t a ( p , r ) } } ) . b i n d ( " g e t D a t a . " + k , f u n c t i o n ( q , p ) { i f ( q . t a r g e t = = o ) { r e t u r n   m . _ g e t D a t a ( p ) } } ) . b i n d ( " r e m o v e " , f u n c t i o n ( ) { r e t u r n   m . d e s t r o y ( ) } ) } ; c [ l ] [ k ] . p r o t o t y p e = c . e x t e n d ( { } , c . w i d g e t . p r o t o t y p e , j ) ; c [ l ] [ k ] . g e t t e r S e t t e r = " o p t i o n " } ; c . w i d g e t . p r o t o t y p e = { _ i n i t : f u n c t i o n ( ) { } , d e s t r o y : f u n c t i o n ( ) { t h i s . e l e m e n t . r e m o v e D a t a ( t h i s . w i d g e t N a m e ) . r e m o v e C l a s s ( t h i s . w i d g e t B a s e C l a s s + " - d i s a b l e d   " + t h i s . n a m e s p a c e + " - s t a t e - d i s a b l e d " ) . r e m o v e A t t r ( " a r i a - d i s a b l e d " ) } , o p t i o n : f u n c t i o n ( l , m ) { v a r   k = l , j = t h i s ; i f ( t y p e o f   l = = " s t r i n g " ) { i f ( m = = = u n d e f i n e d ) { r e t u r n   t h i s . _ g e t D a t a ( l ) } k = { } ; k [ l ] = m } c . e a c h ( k , f u n c t i o n ( n , o ) { j . _ s e t D a t a ( n , o ) } ) } , _ g e t D a t a : f u n c t i o n ( j ) { r e t u r n   t h i s . o p t i o n s [ j ] } , _ s e t D a t a : f u n c t i o n ( j , k ) { t h i s . o p t i o n s [ j ] = k ; i f ( j = = " d i s a b l e d " ) { t h i s . e l e m e n t [ k ? " a d d C l a s s " : " r e m o v e C l a s s " ] ( t h i s . w i d g e t B a s e C l a s s + " - d i s a b l e d   " + t h i s . n a m e s p a c e + " - s t a t e - d i s a b l e d " ) . a t t r ( " a r i a - d i s a b l e d " , k ) } } , e n a b l e : f u n c t i o n ( ) { t h i s . _ s e t D a t a ( " d i s a b l e d " , f a l s e ) } , d i s a b l e : f u n c t i o n ( ) { t h i s . _ s e t D a t a ( " d i s a b l e d " , t r u e ) } , _ t r i g g e r : f u n c t i o n ( l , m , n ) { v a r   p = t h i s . o p t i o n s [ l ] , j = ( l = = t h i s . w i d g e t E v e n t P r e f i x ? l : t h i s . w i d g e t E v e n t P r e f i x + l ) ; m = c . E v e n t ( m ) ; m . t y p e = j ; i f ( m . o r i g i n a l E v e n t ) { f o r ( v a r   k = c . e v e n t . p r o p s . l e n g t h , o ; k ; ) { o = c . e v e n t . p r o p s [ - - k ] ; m [ o ] = m . o r i g i n a l E v e n t [ o ] } } t h i s . e l e m e n t . t r i g g e r ( m , n ) ; r e t u r n   ! ( c . i s F u n c t i o n ( p ) & & p . c a l l ( t h i s . e l e m e n t [ 0 ] , m , n ) = = = f a l s e | | m . i s D e f a u l t P r e v e n t e d ( ) ) } } ; c . w i d g e t . d e f a u l t s = { d i s a b l e d : f a l s e } ; c . u i . m o u s e = { _ m o u s e I n i t : f u n c t i o n ( ) { v a r   j = t h i s ; t h i s . e l e m e n t . b i n d ( " m o u s e d o w n . " + t h i s . w i d g e t N a m e , f u n c t i o n ( k ) { r e t u r n   j . _ m o u s e D o w n ( k ) } ) . b i n d ( " c l i c k . " + t h i s . w i d g e t N a m e , f u n c t i o n ( k ) { i f ( j . _ p r e v e n t C l i c k E v e n t ) { j . _ p r e v e n t C l i c k E v e n t = f a l s e ; k . s t o p I m m e d i a t e P r o p a g a t i o n ( ) ; r e t u r n   f a l s e } } ) ; i f ( c . b r o w s e r . m s i e ) { t h i s . _ m o u s e U n s e l e c t a b l e = t h i s . e l e m e n t . a t t r ( " u n s e l e c t a b l e " ) ; t h i s . e l e m e n t . a t t r ( " u n s e l e c t a b l e " , " o n " ) } t h i s . s t a r t e d = f a l s e } , _ m o u s e D e s t r o y : f u n c t i o n ( ) { t h i s . e l e m e n t . u n b i n d ( " . " + t h i s . w i d g e t N a m e ) ; ( c . b r o w s e r . m s i e & & t h i s . e l e m e n t . a t t r ( " u n s e l e c t a b l e " , t h i s . _ m o u s e U n s e l e c t a b l e ) ) } , _ m o u s e D o w n : f u n c t i o n ( l ) { l . o r i g i n a l E v e n t = l . o r i g i n a l E v e n t | | { } ; i f ( l . o r i g i n a l E v e n t . m o u s e H a n d l e d ) { r e t u r n } ( t h i s . _ m o u s e S t a r t e d & & t h i s . _ m o u s e U p ( l ) ) ; t h i s . _ m o u s e D o w n E v e n t = l ; v a r   k = t h i s , m = ( l . w h i c h = = 1 ) , j = ( t y p e o f   t h i s . o p t i o n s . c a n c e l = = " s t r i n g " ? c ( l . t a r g e t ) . p a r e n t s ( ) . a d d ( l . t a r g e t ) . f i l t e r ( t h i s . o p t i o n s . c a n c e l ) . l e n g t h : f a l s e ) ; i f ( ! m | | j | | ! t h i s . _ m o u s e C a p t u r e ( l ) ) { r e t u r n   t r u e } t h i s . m o u s e D e l a y M e t = ! t h i s . o p t i o n s . d e l a y ; i f ( ! t h i s . m o u s e D e l a y M e t ) { t h i s . _ m o u s e D e l a y T i m e r = s e t T i m e o u t ( f u n c t i o n ( ) { k . m o u s e D e l a y M e t = t r u e } , t h i s . o p t i o n s . d e l a y ) } i f ( t h i s . _ m o u s e D i s t a n c e M e t ( l ) & & t h i s . _ m o u s e D e l a y M e t ( l ) ) { t h i s . _ m o u s e S t a r t e d = ( t h i s . _ m o u s e S t a r t ( l ) ! = = f a l s e ) ; i f ( ! t h i s . _ m o u s e S t a r t e d ) { l . p r e v e n t D e f a u l t ( ) ; r e t u r n   t r u e } } t h i s . _ m o u s e M o v e D e l e g a t e = f u n c t i o n ( n ) { r e t u r n   k . _ m o u s e M o v e ( n ) } ; t h i s . _ m o u s e U p D e l e g a t e = f u n c t i o n ( n ) { r e t u r n   k . _ m o u s e U p ( n ) } ; c ( d o c u m e n t ) . b i n d ( " m o u s e m o v e . " + t h i s . w i d g e t N a m e , t h i s . _ m o u s e M o v e D e l e g a t e ) . b i n d ( " m o u s e u p . " + t h i s . w i d g e t N a m e , t h i s . _ m o u s e U p D e l e g a t e ) ; ( c . b r o w s e r . s a f a r i | | l . p r e v e n t D e f a u l t ( ) ) ; l . o r i g i n a l E v e n t . m o u s e H a n d l e d = t r u e ; r e t u r n   t r u e } , _ m o u s e M o v e : f u n c t i o n ( j ) { i f ( c . b r o w s e r . m s i e & & ! j . b u t t o n ) { r e t u r n   t h i s . _ m o u s e U p ( j ) } i f ( t h i s . _ m o u s e S t a r t e d ) { t h i s . _ m o u s e D r a g ( j ) ; r e t u r n   j . p r e v e n t D e f a u l t ( ) } i f ( t h i s . _ m o u s e D i s t a n c e M e t ( j ) & & t h i s . _ m o u s e D e l a y M e t ( j ) ) { t h i s . _ m o u s e S t a r t e d = ( t h i s . _ m o u s e S t a r t ( t h i s . _ m o u s e D o w n E v e n t , j ) ! = = f a l s e ) ; ( t h i s . _ m o u s e S t a r t e d ? t h i s . _ m o u s e D r a g ( j ) : t h i s . _ m o u s e U p ( j ) ) } r e t u r n   ! t h i s . _ m o u s e S t a r t e d } , _ m o u s e U p : f u n c t i o n ( j ) { c ( d o c u m e n t ) . u n b i n d ( " m o u s e m o v e . " + t h i s . w i d g e t N a m e , t h i s . _ m o u s e M o v e D e l e g a t e ) . u n b i n d ( " m o u s e u p . " + t h i s . w i d g e t N a m e , t h i s . _ m o u s e U p D e l e g a t e ) ; i f ( t h i s . _ m o u s e S t a r t e d ) { t h i s . _ m o u s e S t a r t e d = f a l s e ; t h i s . _ p r e v e n t C l i c k E v e n t = ( j . t a r g e t = = t h i s . _ m o u s e D o w n E v e n t . t a r g e t ) ; t h i s . _ m o u s e S t o p ( j ) } r e t u r n   f a l s e } , _ m o u s e D i s t a n c e M e t : f u n c t i o n ( j ) { r e t u r n ( M a t h . m a x ( M a t h . a b s ( t h i s . _ m o u s e D o w n E v e n t . p a g e X - j . p a g e X ) , M a t h . a b s ( t h i s . _ m o u s e D o w n E v e n t . p a g e Y - j . p a g e Y ) ) > = t h i s . o p t i o n s . d i s t a n c e ) } , _ m o u s e D e l a y M e t : f u n c t i o n ( j ) { r e t u r n   t h i s . m o u s e D e l a y M e t } , _ m o u s e S t a r t : f u n c t i o n ( j ) { } , _ m o u s e D r a g : f u n c t i o n ( j ) { } , _ m o u s e S t o p : f u n c t i o n ( j ) { } , _ m o u s e C a p t u r e : f u n c t i o n ( j ) { r e t u r n   t r u e } } ; c . u i . m o u s e . d e f a u l t s = { c a n c e l : n u l l , d i s t a n c e : 1 , d e l a y : 0 } } ) ( j Q u e r y ) ; ; / *  
   *   j Q u e r y   U I   D r a g g a b l e   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / D r a g g a b l e s  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * /  
 ( f u n c t i o n ( a ) { a . w i d g e t ( " u i . d r a g g a b l e " , a . e x t e n d ( { } , a . u i . m o u s e , { _ i n i t : f u n c t i o n ( ) { i f ( t h i s . o p t i o n s . h e l p e r = = " o r i g i n a l " & & ! ( / ^ ( ? : r | a | f ) / ) . t e s t ( t h i s . e l e m e n t . c s s ( " p o s i t i o n " ) ) ) { t h i s . e l e m e n t [ 0 ] . s t y l e . p o s i t i o n = " r e l a t i v e " } ( t h i s . o p t i o n s . a d d C l a s s e s & & t h i s . e l e m e n t . a d d C l a s s ( " u i - d r a g g a b l e " ) ) ; ( t h i s . o p t i o n s . d i s a b l e d & & t h i s . e l e m e n t . a d d C l a s s ( " u i - d r a g g a b l e - d i s a b l e d " ) ) ; t h i s . _ m o u s e I n i t ( ) } , d e s t r o y : f u n c t i o n ( ) { i f ( ! t h i s . e l e m e n t . d a t a ( " d r a g g a b l e " ) ) { r e t u r n } t h i s . e l e m e n t . r e m o v e D a t a ( " d r a g g a b l e " ) . u n b i n d ( " . d r a g g a b l e " ) . r e m o v e C l a s s ( " u i - d r a g g a b l e   u i - d r a g g a b l e - d r a g g i n g   u i - d r a g g a b l e - d i s a b l e d " ) ; t h i s . _ m o u s e D e s t r o y ( ) } , _ m o u s e C a p t u r e : f u n c t i o n ( b ) { v a r   c = t h i s . o p t i o n s ; i f ( t h i s . h e l p e r | | c . d i s a b l e d | | a ( b . t a r g e t ) . i s ( " . u i - r e s i z a b l e - h a n d l e " ) ) { r e t u r n   f a l s e } t h i s . h a n d l e = t h i s . _ g e t H a n d l e ( b ) ; i f ( ! t h i s . h a n d l e ) { r e t u r n   f a l s e } r e t u r n   t r u e } , _ m o u s e S t a r t : f u n c t i o n ( b ) { v a r   c = t h i s . o p t i o n s ; t h i s . h e l p e r = t h i s . _ c r e a t e H e l p e r ( b ) ; t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ; i f ( a . u i . d d m a n a g e r ) { a . u i . d d m a n a g e r . c u r r e n t = t h i s } t h i s . _ c a c h e M a r g i n s ( ) ; t h i s . c s s P o s i t i o n = t h i s . h e l p e r . c s s ( " p o s i t i o n " ) ; t h i s . s c r o l l P a r e n t = t h i s . h e l p e r . s c r o l l P a r e n t ( ) ; t h i s . o f f s e t = t h i s . e l e m e n t . o f f s e t ( ) ; t h i s . o f f s e t = { t o p : t h i s . o f f s e t . t o p - t h i s . m a r g i n s . t o p , l e f t : t h i s . o f f s e t . l e f t - t h i s . m a r g i n s . l e f t } ; a . e x t e n d ( t h i s . o f f s e t , { c l i c k : { l e f t : b . p a g e X - t h i s . o f f s e t . l e f t , t o p : b . p a g e Y - t h i s . o f f s e t . t o p } , p a r e n t : t h i s . _ g e t P a r e n t O f f s e t ( ) , r e l a t i v e : t h i s . _ g e t R e l a t i v e O f f s e t ( ) } ) ; t h i s . o r i g i n a l P o s i t i o n = t h i s . _ g e n e r a t e P o s i t i o n ( b ) ; t h i s . o r i g i n a l P a g e X = b . p a g e X ; t h i s . o r i g i n a l P a g e Y = b . p a g e Y ; i f ( c . c u r s o r A t ) { t h i s . _ a d j u s t O f f s e t F r o m H e l p e r ( c . c u r s o r A t ) } i f ( c . c o n t a i n m e n t ) { t h i s . _ s e t C o n t a i n m e n t ( ) } t h i s . _ t r i g g e r ( " s t a r t " , b ) ; t h i s . _ c a c h e H e l p e r P r o p o r t i o n s ( ) ; i f ( a . u i . d d m a n a g e r & & ! c . d r o p B e h a v i o u r ) { a . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( t h i s , b ) } t h i s . h e l p e r . a d d C l a s s ( " u i - d r a g g a b l e - d r a g g i n g " ) ; t h i s . _ m o u s e D r a g ( b , t r u e ) ; r e t u r n   t r u e } , _ m o u s e D r a g : f u n c t i o n ( b , d ) { t h i s . p o s i t i o n = t h i s . _ g e n e r a t e P o s i t i o n ( b ) ; t h i s . p o s i t i o n A b s = t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) ; i f ( ! d ) { v a r   c = t h i s . _ u i H a s h ( ) ; t h i s . _ t r i g g e r ( " d r a g " , b , c ) ; t h i s . p o s i t i o n = c . p o s i t i o n } i f ( ! t h i s . o p t i o n s . a x i s | | t h i s . o p t i o n s . a x i s ! = " y " ) { t h i s . h e l p e r [ 0 ] . s t y l e . l e f t = t h i s . p o s i t i o n . l e f t + " p x " } i f ( ! t h i s . o p t i o n s . a x i s | | t h i s . o p t i o n s . a x i s ! = " x " ) { t h i s . h e l p e r [ 0 ] . s t y l e . t o p = t h i s . p o s i t i o n . t o p + " p x " } i f ( a . u i . d d m a n a g e r ) { a . u i . d d m a n a g e r . d r a g ( t h i s , b ) } r e t u r n   f a l s e } , _ m o u s e S t o p : f u n c t i o n ( c ) { v a r   d = f a l s e ; i f ( a . u i . d d m a n a g e r & & ! t h i s . o p t i o n s . d r o p B e h a v i o u r ) { d = a . u i . d d m a n a g e r . d r o p ( t h i s , c ) } i f ( t h i s . d r o p p e d ) { d = t h i s . d r o p p e d ; t h i s . d r o p p e d = f a l s e } i f ( ( t h i s . o p t i o n s . r e v e r t = = " i n v a l i d " & & ! d ) | | ( t h i s . o p t i o n s . r e v e r t = = " v a l i d " & & d ) | | t h i s . o p t i o n s . r e v e r t = = = t r u e | | ( a . i s F u n c t i o n ( t h i s . o p t i o n s . r e v e r t ) & & t h i s . o p t i o n s . r e v e r t . c a l l ( t h i s . e l e m e n t , d ) ) ) { v a r   b = t h i s ; a ( t h i s . h e l p e r ) . a n i m a t e ( t h i s . o r i g i n a l P o s i t i o n , p a r s e I n t ( t h i s . o p t i o n s . r e v e r t D u r a t i o n , 1 0 ) , f u n c t i o n ( ) { b . _ t r i g g e r ( " s t o p " , c ) ; b . _ c l e a r ( ) } ) } e l s e { t h i s . _ t r i g g e r ( " s t o p " , c ) ; t h i s . _ c l e a r ( ) } r e t u r n   f a l s e } , _ g e t H a n d l e : f u n c t i o n ( b ) { v a r   c = ! t h i s . o p t i o n s . h a n d l e | | ! a ( t h i s . o p t i o n s . h a n d l e , t h i s . e l e m e n t ) . l e n g t h ? t r u e : f a l s e ; a ( t h i s . o p t i o n s . h a n d l e , t h i s . e l e m e n t ) . f i n d ( " * " ) . a n d S e l f ( ) . e a c h ( f u n c t i o n ( ) { i f ( t h i s = = b . t a r g e t ) { c = t r u e } } ) ; r e t u r n   c } , _ c r e a t e H e l p e r : f u n c t i o n ( c ) { v a r   d = t h i s . o p t i o n s ; v a r   b = a . i s F u n c t i o n ( d . h e l p e r ) ? a ( d . h e l p e r . a p p l y ( t h i s . e l e m e n t [ 0 ] , [ c ] ) ) : ( d . h e l p e r = = " c l o n e " ? t h i s . e l e m e n t . c l o n e ( ) : t h i s . e l e m e n t ) ; i f ( ! b . p a r e n t s ( " b o d y " ) . l e n g t h ) { b . a p p e n d T o ( ( d . a p p e n d T o = = " p a r e n t " ? t h i s . e l e m e n t [ 0 ] . p a r e n t N o d e : d . a p p e n d T o ) ) } i f ( b [ 0 ] ! = t h i s . e l e m e n t [ 0 ] & & ! ( / ( f i x e d | a b s o l u t e ) / ) . t e s t ( b . c s s ( " p o s i t i o n " ) ) ) { b . c s s ( " p o s i t i o n " , " a b s o l u t e " ) } r e t u r n   b } , _ a d j u s t O f f s e t F r o m H e l p e r : f u n c t i o n ( b ) { i f ( b . l e f t ! = u n d e f i n e d ) { t h i s . o f f s e t . c l i c k . l e f t = b . l e f t + t h i s . m a r g i n s . l e f t } i f ( b . r i g h t ! = u n d e f i n e d ) { t h i s . o f f s e t . c l i c k . l e f t = t h i s . h e l p e r P r o p o r t i o n s . w i d t h - b . r i g h t + t h i s . m a r g i n s . l e f t } i f ( b . t o p ! = u n d e f i n e d ) { t h i s . o f f s e t . c l i c k . t o p = b . t o p + t h i s . m a r g i n s . t o p } i f ( b . b o t t o m ! = u n d e f i n e d ) { t h i s . o f f s e t . c l i c k . t o p = t h i s . h e l p e r P r o p o r t i o n s . h e i g h t - b . b o t t o m + t h i s . m a r g i n s . t o p } } , _ g e t P a r e n t O f f s e t : f u n c t i o n ( ) { t h i s . o f f s e t P a r e n t = t h i s . h e l p e r . o f f s e t P a r e n t ( ) ; v a r   b = t h i s . o f f s e t P a r e n t . o f f s e t ( ) ; i f ( t h i s . c s s P o s i t i o n = = " a b s o l u t e " & & t h i s . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & a . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] , t h i s . o f f s e t P a r e n t [ 0 ] ) ) { b . l e f t + = t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) ; b . t o p + = t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) } i f ( ( t h i s . o f f s e t P a r e n t [ 0 ] = = d o c u m e n t . b o d y ) | | ( t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e & & t h i s . o f f s e t P a r e n t [ 0 ] . t a g N a m e . t o L o w e r C a s e ( ) = = " h t m l " & & a . b r o w s e r . m s i e ) ) { b = { t o p : 0 , l e f t : 0 } } r e t u r n { t o p : b . t o p + ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r T o p W i d t h " ) , 1 0 ) | | 0 ) , l e f t : b . l e f t + ( p a r s e I n t ( t h i s . o f f s e t P a r e n t . c s s ( " b o r d e r L e f t W i d t h " ) , 1 0 ) | | 0 ) } } , _ g e t R e l a t i v e O f f s e t : f u n c t i o n ( ) { i f ( t h i s . c s s P o s i t i o n = = " r e l a t i v e " ) { v a r   b = t h i s . e l e m e n t . p o s i t i o n ( ) ; r e t u r n { t o p : b . t o p - ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " t o p " ) , 1 0 ) | | 0 ) + t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) , l e f t : b . l e f t - ( p a r s e I n t ( t h i s . h e l p e r . c s s ( " l e f t " ) , 1 0 ) | | 0 ) + t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) } } e l s e { r e t u r n { t o p : 0 , l e f t : 0 } } } , _ c a c h e M a r g i n s : f u n c t i o n ( ) { t h i s . m a r g i n s = { l e f t : ( p a r s e I n t ( t h i s . e l e m e n t . c s s ( " m a r g i n L e f t " ) , 1 0 ) | | 0 ) , t o p : ( p a r s e I n t ( t h i s . e l e m e n t . c s s ( " m a r g i n T o p " ) , 1 0 ) | | 0 ) } } , _ c a c h e H e l p e r P r o p o r t i o n s : f u n c t i o n ( ) { t h i s . h e l p e r P r o p o r t i o n s = { w i d t h : t h i s . h e l p e r . o u t e r W i d t h ( ) , h e i g h t : t h i s . h e l p e r . o u t e r H e i g h t ( ) } } , _ s e t C o n t a i n m e n t : f u n c t i o n ( ) { v a r   e = t h i s . o p t i o n s ; i f ( e . c o n t a i n m e n t = = " p a r e n t " ) { e . c o n t a i n m e n t = t h i s . h e l p e r [ 0 ] . p a r e n t N o d e } i f ( e . c o n t a i n m e n t = = " d o c u m e n t " | | e . c o n t a i n m e n t = = " w i n d o w " ) { t h i s . c o n t a i n m e n t = [ 0 - t h i s . o f f s e t . r e l a t i v e . l e f t - t h i s . o f f s e t . p a r e n t . l e f t , 0 - t h i s . o f f s e t . r e l a t i v e . t o p - t h i s . o f f s e t . p a r e n t . t o p , a ( e . c o n t a i n m e n t = = " d o c u m e n t " ? d o c u m e n t : w i n d o w ) . w i d t h ( ) - t h i s . h e l p e r P r o p o r t i o n s . w i d t h - t h i s . m a r g i n s . l e f t , ( a ( e . c o n t a i n m e n t = = " d o c u m e n t " ? d o c u m e n t : w i n d o w ) . h e i g h t ( ) | | d o c u m e n t . b o d y . p a r e n t N o d e . s c r o l l H e i g h t ) - t h i s . h e l p e r P r o p o r t i o n s . h e i g h t - t h i s . m a r g i n s . t o p ] } i f ( ! ( / ^ ( d o c u m e n t | w i n d o w | p a r e n t ) $ / ) . t e s t ( e . c o n t a i n m e n t ) & & e . c o n t a i n m e n t . c o n s t r u c t o r ! = A r r a y ) { v a r   c = a ( e . c o n t a i n m e n t ) [ 0 ] ; i f ( ! c ) { r e t u r n } v a r   d = a ( e . c o n t a i n m e n t ) . o f f s e t ( ) ; v a r   b = ( a ( c ) . c s s ( " o v e r f l o w " ) ! = " h i d d e n " ) ; t h i s . c o n t a i n m e n t = [ d . l e f t + ( p a r s e I n t ( a ( c ) . c s s ( " b o r d e r L e f t W i d t h " ) , 1 0 ) | | 0 ) + ( p a r s e I n t ( a ( c ) . c s s ( " p a d d i n g L e f t " ) , 1 0 ) | | 0 ) - t h i s . m a r g i n s . l e f t , d . t o p + ( p a r s e I n t ( a ( c ) . c s s ( " b o r d e r T o p W i d t h " ) , 1 0 ) | | 0 ) + ( p a r s e I n t ( a ( c ) . c s s ( " p a d d i n g T o p " ) , 1 0 ) | | 0 ) - t h i s . m a r g i n s . t o p , d . l e f t + ( b ? M a t h . m a x ( c . s c r o l l W i d t h , c . o f f s e t W i d t h ) : c . o f f s e t W i d t h ) - ( p a r s e I n t ( a ( c ) . c s s ( " b o r d e r L e f t W i d t h " ) , 1 0 ) | | 0 ) - ( p a r s e I n t ( a ( c ) . c s s ( " p a d d i n g R i g h t " ) , 1 0 ) | | 0 ) - t h i s . h e l p e r P r o p o r t i o n s . w i d t h - t h i s . m a r g i n s . l e f t , d . t o p + ( b ? M a t h . m a x ( c . s c r o l l H e i g h t , c . o f f s e t H e i g h t ) : c . o f f s e t H e i g h t ) - ( p a r s e I n t ( a ( c ) . c s s ( " b o r d e r T o p W i d t h " ) , 1 0 ) | | 0 ) - ( p a r s e I n t ( a ( c ) . c s s ( " p a d d i n g B o t t o m " ) , 1 0 ) | | 0 ) - t h i s . h e l p e r P r o p o r t i o n s . h e i g h t - t h i s . m a r g i n s . t o p ] } e l s e { i f ( e . c o n t a i n m e n t . c o n s t r u c t o r = = A r r a y ) { t h i s . c o n t a i n m e n t = e . c o n t a i n m e n t } } } , _ c o n v e r t P o s i t i o n T o : f u n c t i o n ( f , h ) { i f ( ! h ) { h = t h i s . p o s i t i o n } v a r   c = f = = " a b s o l u t e " ? 1 : - 1 ; v a r   e = t h i s . o p t i o n s , b = t h i s . c s s P o s i t i o n = = " a b s o l u t e " & & ! ( t h i s . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & a . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] , t h i s . o f f s e t P a r e n t [ 0 ] ) ) ? t h i s . o f f s e t P a r e n t : t h i s . s c r o l l P a r e n t , g = ( / ( h t m l | b o d y ) / i ) . t e s t ( b [ 0 ] . t a g N a m e ) ; r e t u r n { t o p : ( h . t o p + t h i s . o f f s e t . r e l a t i v e . t o p * c + t h i s . o f f s e t . p a r e n t . t o p * c - ( a . b r o w s e r . s a f a r i & & t h i s . c s s P o s i t i o n = = " f i x e d " ? 0 : ( t h i s . c s s P o s i t i o n = = " f i x e d " ? - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) : ( g ? 0 : b . s c r o l l T o p ( ) ) ) * c ) ) , l e f t : ( h . l e f t + t h i s . o f f s e t . r e l a t i v e . l e f t * c + t h i s . o f f s e t . p a r e n t . l e f t * c - ( a . b r o w s e r . s a f a r i & & t h i s . c s s P o s i t i o n = = " f i x e d " ? 0 : ( t h i s . c s s P o s i t i o n = = " f i x e d " ? - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) : g ? 0 : b . s c r o l l L e f t ( ) ) * c ) ) } } , _ g e n e r a t e P o s i t i o n : f u n c t i o n ( e ) { v a r   h = t h i s . o p t i o n s , b = t h i s . c s s P o s i t i o n = = " a b s o l u t e " & & ! ( t h i s . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & a . u i . c o n t a i n s ( t h i s . s c r o l l P a r e n t [ 0 ] , t h i s . o f f s e t P a r e n t [ 0 ] ) ) ? t h i s . o f f s e t P a r e n t : t h i s . s c r o l l P a r e n t , i = ( / ( h t m l | b o d y ) / i ) . t e s t ( b [ 0 ] . t a g N a m e ) ; i f ( t h i s . c s s P o s i t i o n = = " r e l a t i v e " & & ! ( t h i s . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & t h i s . s c r o l l P a r e n t [ 0 ] ! = t h i s . o f f s e t P a r e n t [ 0 ] ) ) { t h i s . o f f s e t . r e l a t i v e = t h i s . _ g e t R e l a t i v e O f f s e t ( ) } v a r   d = e . p a g e X ; v a r   c = e . p a g e Y ; i f ( t h i s . o r i g i n a l P o s i t i o n ) { i f ( t h i s . c o n t a i n m e n t ) { i f ( e . p a g e X - t h i s . o f f s e t . c l i c k . l e f t < t h i s . c o n t a i n m e n t [ 0 ] ) { d = t h i s . c o n t a i n m e n t [ 0 ] + t h i s . o f f s e t . c l i c k . l e f t } i f ( e . p a g e Y - t h i s . o f f s e t . c l i c k . t o p < t h i s . c o n t a i n m e n t [ 1 ] ) { c = t h i s . c o n t a i n m e n t [ 1 ] + t h i s . o f f s e t . c l i c k . t o p } i f ( e . p a g e X - t h i s . o f f s e t . c l i c k . l e f t > t h i s . c o n t a i n m e n t [ 2 ] ) { d = t h i s . c o n t a i n m e n t [ 2 ] + t h i s . o f f s e t . c l i c k . l e f t } i f ( e . p a g e Y - t h i s . o f f s e t . c l i c k . t o p > t h i s . c o n t a i n m e n t [ 3 ] ) { c = t h i s . c o n t a i n m e n t [ 3 ] + t h i s . o f f s e t . c l i c k . t o p } } i f ( h . g r i d ) { v a r   g = t h i s . o r i g i n a l P a g e Y + M a t h . r o u n d ( ( c - t h i s . o r i g i n a l P a g e Y ) / h . g r i d [ 1 ] ) * h . g r i d [ 1 ] ; c = t h i s . c o n t a i n m e n t ? ( ! ( g - t h i s . o f f s e t . c l i c k . t o p < t h i s . c o n t a i n m e n t [ 1 ] | | g - t h i s . o f f s e t . c l i c k . t o p > t h i s . c o n t a i n m e n t [ 3 ] ) ? g : ( ! ( g - t h i s . o f f s e t . c l i c k . t o p < t h i s . c o n t a i n m e n t [ 1 ] ) ? g - h . g r i d [ 1 ] : g + h . g r i d [ 1 ] ) ) : g ; v a r   f = t h i s . o r i g i n a l P a g e X + M a t h . r o u n d ( ( d - t h i s . o r i g i n a l P a g e X ) / h . g r i d [ 0 ] ) * h . g r i d [ 0 ] ; d = t h i s . c o n t a i n m e n t ? ( ! ( f - t h i s . o f f s e t . c l i c k . l e f t < t h i s . c o n t a i n m e n t [ 0 ] | | f - t h i s . o f f s e t . c l i c k . l e f t > t h i s . c o n t a i n m e n t [ 2 ] ) ? f : ( ! ( f - t h i s . o f f s e t . c l i c k . l e f t < t h i s . c o n t a i n m e n t [ 0 ] ) ? f - h . g r i d [ 0 ] : f + h . g r i d [ 0 ] ) ) : f } } r e t u r n { t o p : ( c - t h i s . o f f s e t . c l i c k . t o p - t h i s . o f f s e t . r e l a t i v e . t o p - t h i s . o f f s e t . p a r e n t . t o p + ( a . b r o w s e r . s a f a r i & & t h i s . c s s P o s i t i o n = = " f i x e d " ? 0 : ( t h i s . c s s P o s i t i o n = = " f i x e d " ? - t h i s . s c r o l l P a r e n t . s c r o l l T o p ( ) : ( i ? 0 : b . s c r o l l T o p ( ) ) ) ) ) , l e f t : ( d - t h i s . o f f s e t . c l i c k . l e f t - t h i s . o f f s e t . r e l a t i v e . l e f t - t h i s . o f f s e t . p a r e n t . l e f t + ( a . b r o w s e r . s a f a r i & & t h i s . c s s P o s i t i o n = = " f i x e d " ? 0 : ( t h i s . c s s P o s i t i o n = = " f i x e d " ? - t h i s . s c r o l l P a r e n t . s c r o l l L e f t ( ) : i ? 0 : b . s c r o l l L e f t ( ) ) ) ) } } , _ c l e a r : f u n c t i o n ( ) { t h i s . h e l p e r . r e m o v e C l a s s ( " u i - d r a g g a b l e - d r a g g i n g " ) ; i f ( t h i s . h e l p e r [ 0 ] ! = t h i s . e l e m e n t [ 0 ] & & ! t h i s . c a n c e l H e l p e r R e m o v a l ) { t h i s . h e l p e r . r e m o v e ( ) } t h i s . h e l p e r = n u l l ; t h i s . c a n c e l H e l p e r R e m o v a l = f a l s e } , _ t r i g g e r : f u n c t i o n ( b , c , d ) { d = d | | t h i s . _ u i H a s h ( ) ; a . u i . p l u g i n . c a l l ( t h i s , b , [ c , d ] ) ; i f ( b = = " d r a g " ) { t h i s . p o s i t i o n A b s = t h i s . _ c o n v e r t P o s i t i o n T o ( " a b s o l u t e " ) } r e t u r n   a . w i d g e t . p r o t o t y p e . _ t r i g g e r . c a l l ( t h i s , b , c , d ) } , p l u g i n s : { } , _ u i H a s h : f u n c t i o n ( b ) { r e t u r n { h e l p e r : t h i s . h e l p e r , p o s i t i o n : t h i s . p o s i t i o n , a b s o l u t e P o s i t i o n : t h i s . p o s i t i o n A b s , o f f s e t : t h i s . p o s i t i o n A b s } } } ) ) ; a . e x t e n d ( a . u i . d r a g g a b l e , { v e r s i o n : " 1 . 7 . 2 " , e v e n t P r e f i x : " d r a g " , d e f a u l t s : { a d d C l a s s e s : t r u e , a p p e n d T o : " p a r e n t " , a x i s : f a l s e , c a n c e l : " : i n p u t , o p t i o n " , c o n n e c t T o S o r t a b l e : f a l s e , c o n t a i n m e n t : f a l s e , c u r s o r : " a u t o " , c u r s o r A t : f a l s e , d e l a y : 0 , d i s t a n c e : 1 , g r i d : f a l s e , h a n d l e : f a l s e , h e l p e r : " o r i g i n a l " , i f r a m e F i x : f a l s e , o p a c i t y : f a l s e , r e f r e s h P o s i t i o n s : f a l s e , r e v e r t : f a l s e , r e v e r t D u r a t i o n : 5 0 0 , s c o p e : " d e f a u l t " , s c r o l l : t r u e , s c r o l l S e n s i t i v i t y : 2 0 , s c r o l l S p e e d : 2 0 , s n a p : f a l s e , s n a p M o d e : " b o t h " , s n a p T o l e r a n c e : 2 0 , s t a c k : f a l s e , z I n d e x : f a l s e } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " c o n n e c t T o S o r t a b l e " , { s t a r t : f u n c t i o n ( c , e ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , f = d . o p t i o n s , b = a . e x t e n d ( { } , e , { i t e m : d . e l e m e n t } ) ; d . s o r t a b l e s = [ ] ; a ( f . c o n n e c t T o S o r t a b l e ) . e a c h ( f u n c t i o n ( ) { v a r   g = a . d a t a ( t h i s , " s o r t a b l e " ) ; i f ( g & & ! g . o p t i o n s . d i s a b l e d ) { d . s o r t a b l e s . p u s h ( { i n s t a n c e : g , s h o u l d R e v e r t : g . o p t i o n s . r e v e r t } ) ; g . _ r e f r e s h I t e m s ( ) ; g . _ t r i g g e r ( " a c t i v a t e " , c , b ) } } ) } , s t o p : f u n c t i o n ( c , e ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , b = a . e x t e n d ( { } , e , { i t e m : d . e l e m e n t } ) ; a . e a c h ( d . s o r t a b l e s , f u n c t i o n ( ) { i f ( t h i s . i n s t a n c e . i s O v e r ) { t h i s . i n s t a n c e . i s O v e r = 0 ; d . c a n c e l H e l p e r R e m o v a l = t r u e ; t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l = f a l s e ; i f ( t h i s . s h o u l d R e v e r t ) { t h i s . i n s t a n c e . o p t i o n s . r e v e r t = t r u e } t h i s . i n s t a n c e . _ m o u s e S t o p ( c ) ; t h i s . i n s t a n c e . o p t i o n s . h e l p e r = t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r ; i f ( d . o p t i o n s . h e l p e r = = " o r i g i n a l " ) { t h i s . i n s t a n c e . c u r r e n t I t e m . c s s ( { t o p : " a u t o " , l e f t : " a u t o " } ) } } e l s e { t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l = f a l s e ; t h i s . i n s t a n c e . _ t r i g g e r ( " d e a c t i v a t e " , c , b ) } } ) } , d r a g : f u n c t i o n ( c , f ) { v a r   e = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , b = t h i s ; v a r   d = f u n c t i o n ( i ) { v a r   n = t h i s . o f f s e t . c l i c k . t o p , m = t h i s . o f f s e t . c l i c k . l e f t ; v a r   g = t h i s . p o s i t i o n A b s . t o p , k = t h i s . p o s i t i o n A b s . l e f t ; v a r   j = i . h e i g h t , l = i . w i d t h ; v a r   p = i . t o p , h = i . l e f t ; r e t u r n   a . u i . i s O v e r ( g + n , k + m , p , h , j , l ) } ; a . e a c h ( e . s o r t a b l e s , f u n c t i o n ( g ) { t h i s . i n s t a n c e . p o s i t i o n A b s = e . p o s i t i o n A b s ; t h i s . i n s t a n c e . h e l p e r P r o p o r t i o n s = e . h e l p e r P r o p o r t i o n s ; t h i s . i n s t a n c e . o f f s e t . c l i c k = e . o f f s e t . c l i c k ; i f ( t h i s . i n s t a n c e . _ i n t e r s e c t s W i t h ( t h i s . i n s t a n c e . c o n t a i n e r C a c h e ) ) { i f ( ! t h i s . i n s t a n c e . i s O v e r ) { t h i s . i n s t a n c e . i s O v e r = 1 ; t h i s . i n s t a n c e . c u r r e n t I t e m = a ( b ) . c l o n e ( ) . a p p e n d T o ( t h i s . i n s t a n c e . e l e m e n t ) . d a t a ( " s o r t a b l e - i t e m " , t r u e ) ; t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r = t h i s . i n s t a n c e . o p t i o n s . h e l p e r ; t h i s . i n s t a n c e . o p t i o n s . h e l p e r = f u n c t i o n ( ) { r e t u r n   f . h e l p e r [ 0 ] } ; c . t a r g e t = t h i s . i n s t a n c e . c u r r e n t I t e m [ 0 ] ; t h i s . i n s t a n c e . _ m o u s e C a p t u r e ( c , t r u e ) ; t h i s . i n s t a n c e . _ m o u s e S t a r t ( c , t r u e , t r u e ) ; t h i s . i n s t a n c e . o f f s e t . c l i c k . t o p = e . o f f s e t . c l i c k . t o p ; t h i s . i n s t a n c e . o f f s e t . c l i c k . l e f t = e . o f f s e t . c l i c k . l e f t ; t h i s . i n s t a n c e . o f f s e t . p a r e n t . l e f t - = e . o f f s e t . p a r e n t . l e f t - t h i s . i n s t a n c e . o f f s e t . p a r e n t . l e f t ; t h i s . i n s t a n c e . o f f s e t . p a r e n t . t o p - = e . o f f s e t . p a r e n t . t o p - t h i s . i n s t a n c e . o f f s e t . p a r e n t . t o p ; e . _ t r i g g e r ( " t o S o r t a b l e " , c ) ; e . d r o p p e d = t h i s . i n s t a n c e . e l e m e n t ; e . c u r r e n t I t e m = e . e l e m e n t ; t h i s . i n s t a n c e . f r o m O u t s i d e = e } i f ( t h i s . i n s t a n c e . c u r r e n t I t e m ) { t h i s . i n s t a n c e . _ m o u s e D r a g ( c ) } } e l s e { i f ( t h i s . i n s t a n c e . i s O v e r ) { t h i s . i n s t a n c e . i s O v e r = 0 ; t h i s . i n s t a n c e . c a n c e l H e l p e r R e m o v a l = t r u e ; t h i s . i n s t a n c e . o p t i o n s . r e v e r t = f a l s e ; t h i s . i n s t a n c e . _ t r i g g e r ( " o u t " , c , t h i s . i n s t a n c e . _ u i H a s h ( t h i s . i n s t a n c e ) ) ; t h i s . i n s t a n c e . _ m o u s e S t o p ( c , t r u e ) ; t h i s . i n s t a n c e . o p t i o n s . h e l p e r = t h i s . i n s t a n c e . o p t i o n s . _ h e l p e r ; t h i s . i n s t a n c e . c u r r e n t I t e m . r e m o v e ( ) ; i f ( t h i s . i n s t a n c e . p l a c e h o l d e r ) { t h i s . i n s t a n c e . p l a c e h o l d e r . r e m o v e ( ) } e . _ t r i g g e r ( " f r o m S o r t a b l e " , c ) ; e . d r o p p e d = f a l s e } } } ) } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " c u r s o r " , { s t a r t : f u n c t i o n ( c , d ) { v a r   b = a ( " b o d y " ) , e = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( b . c s s ( " c u r s o r " ) ) { e . _ c u r s o r = b . c s s ( " c u r s o r " ) } b . c s s ( " c u r s o r " , e . c u r s o r ) } , s t o p : f u n c t i o n ( b , c ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( d . _ c u r s o r ) { a ( " b o d y " ) . c s s ( " c u r s o r " , d . _ c u r s o r ) } } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " i f r a m e F i x " , { s t a r t : f u n c t i o n ( b , c ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; a ( d . i f r a m e F i x = = = t r u e ? " i f r a m e " : d . i f r a m e F i x ) . e a c h ( f u n c t i o n ( ) { a ( ' < d i v   c l a s s = " u i - d r a g g a b l e - i f r a m e F i x "   s t y l e = " b a c k g r o u n d :   # f f f ; " > < / d i v > ' ) . c s s ( { w i d t h : t h i s . o f f s e t W i d t h + " p x " , h e i g h t : t h i s . o f f s e t H e i g h t + " p x " , p o s i t i o n : " a b s o l u t e " , o p a c i t y : " 0 . 0 0 1 " , z I n d e x : 1 0 0 0 } ) . c s s ( a ( t h i s ) . o f f s e t ( ) ) . a p p e n d T o ( " b o d y " ) } ) } , s t o p : f u n c t i o n ( b , c ) { a ( " d i v . u i - d r a g g a b l e - i f r a m e F i x " ) . e a c h ( f u n c t i o n ( ) { t h i s . p a r e n t N o d e . r e m o v e C h i l d ( t h i s ) } ) } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " o p a c i t y " , { s t a r t : f u n c t i o n ( c , d ) { v a r   b = a ( d . h e l p e r ) , e = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( b . c s s ( " o p a c i t y " ) ) { e . _ o p a c i t y = b . c s s ( " o p a c i t y " ) } b . c s s ( " o p a c i t y " , e . o p a c i t y ) } , s t o p : f u n c t i o n ( b , c ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( d . _ o p a c i t y ) { a ( c . h e l p e r ) . c s s ( " o p a c i t y " , d . _ o p a c i t y ) } } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " s c r o l l " , { s t a r t : f u n c t i o n ( c , d ) { v a r   b = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) ; i f ( b . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & b . s c r o l l P a r e n t [ 0 ] . t a g N a m e ! = " H T M L " ) { b . o v e r f l o w O f f s e t = b . s c r o l l P a r e n t . o f f s e t ( ) } } , d r a g : f u n c t i o n ( d , e ) { v a r   c = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , f = c . o p t i o n s , b = f a l s e ; i f ( c . s c r o l l P a r e n t [ 0 ] ! = d o c u m e n t & & c . s c r o l l P a r e n t [ 0 ] . t a g N a m e ! = " H T M L " ) { i f ( ! f . a x i s | | f . a x i s ! = " x " ) { i f ( ( c . o v e r f l o w O f f s e t . t o p + c . s c r o l l P a r e n t [ 0 ] . o f f s e t H e i g h t ) - d . p a g e Y < f . s c r o l l S e n s i t i v i t y ) { c . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p = b = c . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p + f . s c r o l l S p e e d } e l s e { i f ( d . p a g e Y - c . o v e r f l o w O f f s e t . t o p < f . s c r o l l S e n s i t i v i t y ) { c . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p = b = c . s c r o l l P a r e n t [ 0 ] . s c r o l l T o p - f . s c r o l l S p e e d } } } i f ( ! f . a x i s | | f . a x i s ! = " y " ) { i f ( ( c . o v e r f l o w O f f s e t . l e f t + c . s c r o l l P a r e n t [ 0 ] . o f f s e t W i d t h ) - d . p a g e X < f . s c r o l l S e n s i t i v i t y ) { c . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t = b = c . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t + f . s c r o l l S p e e d } e l s e { i f ( d . p a g e X - c . o v e r f l o w O f f s e t . l e f t < f . s c r o l l S e n s i t i v i t y ) { c . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t = b = c . s c r o l l P a r e n t [ 0 ] . s c r o l l L e f t - f . s c r o l l S p e e d } } } } e l s e { i f ( ! f . a x i s | | f . a x i s ! = " x " ) { i f ( d . p a g e Y - a ( d o c u m e n t ) . s c r o l l T o p ( ) < f . s c r o l l S e n s i t i v i t y ) { b = a ( d o c u m e n t ) . s c r o l l T o p ( a ( d o c u m e n t ) . s c r o l l T o p ( ) - f . s c r o l l S p e e d ) } e l s e { i f ( a ( w i n d o w ) . h e i g h t ( ) - ( d . p a g e Y - a ( d o c u m e n t ) . s c r o l l T o p ( ) ) < f . s c r o l l S e n s i t i v i t y ) { b = a ( d o c u m e n t ) . s c r o l l T o p ( a ( d o c u m e n t ) . s c r o l l T o p ( ) + f . s c r o l l S p e e d ) } } } i f ( ! f . a x i s | | f . a x i s ! = " y " ) { i f ( d . p a g e X - a ( d o c u m e n t ) . s c r o l l L e f t ( ) < f . s c r o l l S e n s i t i v i t y ) { b = a ( d o c u m e n t ) . s c r o l l L e f t ( a ( d o c u m e n t ) . s c r o l l L e f t ( ) - f . s c r o l l S p e e d ) } e l s e { i f ( a ( w i n d o w ) . w i d t h ( ) - ( d . p a g e X - a ( d o c u m e n t ) . s c r o l l L e f t ( ) ) < f . s c r o l l S e n s i t i v i t y ) { b = a ( d o c u m e n t ) . s c r o l l L e f t ( a ( d o c u m e n t ) . s c r o l l L e f t ( ) + f . s c r o l l S p e e d ) } } } } i f ( b ! = = f a l s e & & a . u i . d d m a n a g e r & & ! f . d r o p B e h a v i o u r ) { a . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( c , d ) } } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " s n a p " , { s t a r t : f u n c t i o n ( c , d ) { v a r   b = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , e = b . o p t i o n s ; b . s n a p E l e m e n t s = [ ] ; a ( e . s n a p . c o n s t r u c t o r ! = S t r i n g ? ( e . s n a p . i t e m s | | " : d a t a ( d r a g g a b l e ) " ) : e . s n a p ) . e a c h ( f u n c t i o n ( ) { v a r   g = a ( t h i s ) ; v a r   f = g . o f f s e t ( ) ; i f ( t h i s ! = b . e l e m e n t [ 0 ] ) { b . s n a p E l e m e n t s . p u s h ( { i t e m : t h i s , w i d t h : g . o u t e r W i d t h ( ) , h e i g h t : g . o u t e r H e i g h t ( ) , t o p : f . t o p , l e f t : f . l e f t } ) } } ) } , d r a g : f u n c t i o n ( u , p ) { v a r   g = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) , q = g . o p t i o n s ; v a r   y = q . s n a p T o l e r a n c e ; v a r   x = p . o f f s e t . l e f t , w = x + g . h e l p e r P r o p o r t i o n s . w i d t h , f = p . o f f s e t . t o p , e = f + g . h e l p e r P r o p o r t i o n s . h e i g h t ; f o r ( v a r   v = g . s n a p E l e m e n t s . l e n g t h - 1 ; v > = 0 ; v - - ) { v a r   s = g . s n a p E l e m e n t s [ v ] . l e f t , n = s + g . s n a p E l e m e n t s [ v ] . w i d t h , m = g . s n a p E l e m e n t s [ v ] . t o p , A = m + g . s n a p E l e m e n t s [ v ] . h e i g h t ; i f ( ! ( ( s - y < x & & x < n + y & & m - y < f & & f < A + y ) | | ( s - y < x & & x < n + y & & m - y < e & & e < A + y ) | | ( s - y < w & & w < n + y & & m - y < f & & f < A + y ) | | ( s - y < w & & w < n + y & & m - y < e & & e < A + y ) ) ) { i f ( g . s n a p E l e m e n t s [ v ] . s n a p p i n g ) { ( g . o p t i o n s . s n a p . r e l e a s e & & g . o p t i o n s . s n a p . r e l e a s e . c a l l ( g . e l e m e n t , u , a . e x t e n d ( g . _ u i H a s h ( ) , { s n a p I t e m : g . s n a p E l e m e n t s [ v ] . i t e m } ) ) ) } g . s n a p E l e m e n t s [ v ] . s n a p p i n g = f a l s e ; c o n t i n u e } i f ( q . s n a p M o d e ! = " i n n e r " ) { v a r   c = M a t h . a b s ( m - e ) < = y ; v a r   z = M a t h . a b s ( A - f ) < = y ; v a r   j = M a t h . a b s ( s - w ) < = y ; v a r   k = M a t h . a b s ( n - x ) < = y ; i f ( c ) { p . p o s i t i o n . t o p = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : m - g . h e l p e r P r o p o r t i o n s . h e i g h t , l e f t : 0 } ) . t o p - g . m a r g i n s . t o p } i f ( z ) { p . p o s i t i o n . t o p = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : A , l e f t : 0 } ) . t o p - g . m a r g i n s . t o p } i f ( j ) { p . p o s i t i o n . l e f t = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : 0 , l e f t : s - g . h e l p e r P r o p o r t i o n s . w i d t h } ) . l e f t - g . m a r g i n s . l e f t } i f ( k ) { p . p o s i t i o n . l e f t = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : 0 , l e f t : n } ) . l e f t - g . m a r g i n s . l e f t } } v a r   h = ( c | | z | | j | | k ) ; i f ( q . s n a p M o d e ! = " o u t e r " ) { v a r   c = M a t h . a b s ( m - f ) < = y ; v a r   z = M a t h . a b s ( A - e ) < = y ; v a r   j = M a t h . a b s ( s - x ) < = y ; v a r   k = M a t h . a b s ( n - w ) < = y ; i f ( c ) { p . p o s i t i o n . t o p = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : m , l e f t : 0 } ) . t o p - g . m a r g i n s . t o p } i f ( z ) { p . p o s i t i o n . t o p = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : A - g . h e l p e r P r o p o r t i o n s . h e i g h t , l e f t : 0 } ) . t o p - g . m a r g i n s . t o p } i f ( j ) { p . p o s i t i o n . l e f t = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : 0 , l e f t : s } ) . l e f t - g . m a r g i n s . l e f t } i f ( k ) { p . p o s i t i o n . l e f t = g . _ c o n v e r t P o s i t i o n T o ( " r e l a t i v e " , { t o p : 0 , l e f t : n - g . h e l p e r P r o p o r t i o n s . w i d t h } ) . l e f t - g . m a r g i n s . l e f t } } i f ( ! g . s n a p E l e m e n t s [ v ] . s n a p p i n g & & ( c | | z | | j | | k | | h ) ) { ( g . o p t i o n s . s n a p . s n a p & & g . o p t i o n s . s n a p . s n a p . c a l l ( g . e l e m e n t , u , a . e x t e n d ( g . _ u i H a s h ( ) , { s n a p I t e m : g . s n a p E l e m e n t s [ v ] . i t e m } ) ) ) } g . s n a p E l e m e n t s [ v ] . s n a p p i n g = ( c | | z | | j | | k | | h ) } } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " s t a c k " , { s t a r t : f u n c t i o n ( b , c ) { v a r   e = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; v a r   d = a . m a k e A r r a y ( a ( e . s t a c k . g r o u p ) ) . s o r t ( f u n c t i o n ( g , f ) { r e t u r n ( p a r s e I n t ( a ( g ) . c s s ( " z I n d e x " ) , 1 0 ) | | e . s t a c k . m i n ) - ( p a r s e I n t ( a ( f ) . c s s ( " z I n d e x " ) , 1 0 ) | | e . s t a c k . m i n ) } ) ; a ( d ) . e a c h ( f u n c t i o n ( f ) { t h i s . s t y l e . z I n d e x = e . s t a c k . m i n + f } ) ; t h i s [ 0 ] . s t y l e . z I n d e x = e . s t a c k . m i n + d . l e n g t h } } ) ; a . u i . p l u g i n . a d d ( " d r a g g a b l e " , " z I n d e x " , { s t a r t : f u n c t i o n ( c , d ) { v a r   b = a ( d . h e l p e r ) , e = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( b . c s s ( " z I n d e x " ) ) { e . _ z I n d e x = b . c s s ( " z I n d e x " ) } b . c s s ( " z I n d e x " , e . z I n d e x ) } , s t o p : f u n c t i o n ( b , c ) { v a r   d = a ( t h i s ) . d a t a ( " d r a g g a b l e " ) . o p t i o n s ; i f ( d . _ z I n d e x ) { a ( c . h e l p e r ) . c s s ( " z I n d e x " , d . _ z I n d e x ) } } } ) } ) ( j Q u e r y ) ; ; / *  
   *   j Q u e r y   U I   D r o p p a b l e   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / D r o p p a b l e s  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * 	 u i . d r a g g a b l e . j s  
   * /  
 ( f u n c t i o n ( a ) { a . w i d g e t ( " u i . d r o p p a b l e " , { _ i n i t : f u n c t i o n ( ) { v a r   c = t h i s . o p t i o n s , b = c . a c c e p t ; t h i s . i s o v e r = 0 ; t h i s . i s o u t = 1 ; t h i s . o p t i o n s . a c c e p t = t h i s . o p t i o n s . a c c e p t & & a . i s F u n c t i o n ( t h i s . o p t i o n s . a c c e p t ) ? t h i s . o p t i o n s . a c c e p t : f u n c t i o n ( e ) { r e t u r n   e . i s ( b ) } ; t h i s . p r o p o r t i o n s = { w i d t h : t h i s . e l e m e n t [ 0 ] . o f f s e t W i d t h , h e i g h t : t h i s . e l e m e n t [ 0 ] . o f f s e t H e i g h t } ; a . u i . d d m a n a g e r . d r o p p a b l e s [ t h i s . o p t i o n s . s c o p e ] = a . u i . d d m a n a g e r . d r o p p a b l e s [ t h i s . o p t i o n s . s c o p e ] | | [ ] ; a . u i . d d m a n a g e r . d r o p p a b l e s [ t h i s . o p t i o n s . s c o p e ] . p u s h ( t h i s ) ; ( t h i s . o p t i o n s . a d d C l a s s e s & & t h i s . e l e m e n t . a d d C l a s s ( " u i - d r o p p a b l e " ) ) } , d e s t r o y : f u n c t i o n ( ) { v a r   b = a . u i . d d m a n a g e r . d r o p p a b l e s [ t h i s . o p t i o n s . s c o p e ] ; f o r ( v a r   c = 0 ; c < b . l e n g t h ; c + + ) { i f ( b [ c ] = = t h i s ) { b . s p l i c e ( c , 1 ) } } t h i s . e l e m e n t . r e m o v e C l a s s ( " u i - d r o p p a b l e   u i - d r o p p a b l e - d i s a b l e d " ) . r e m o v e D a t a ( " d r o p p a b l e " ) . u n b i n d ( " . d r o p p a b l e " ) } , _ s e t D a t a : f u n c t i o n ( b , c ) { i f ( b = = " a c c e p t " ) { t h i s . o p t i o n s . a c c e p t = c & & a . i s F u n c t i o n ( c ) ? c : f u n c t i o n ( e ) { r e t u r n   e . i s ( c ) } } e l s e { a . w i d g e t . p r o t o t y p e . _ s e t D a t a . a p p l y ( t h i s , a r g u m e n t s ) } } , _ a c t i v a t e : f u n c t i o n ( c ) { v a r   b = a . u i . d d m a n a g e r . c u r r e n t ; i f ( t h i s . o p t i o n s . a c t i v e C l a s s ) { t h i s . e l e m e n t . a d d C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) } ( b & & t h i s . _ t r i g g e r ( " a c t i v a t e " , c , t h i s . u i ( b ) ) ) } , _ d e a c t i v a t e : f u n c t i o n ( c ) { v a r   b = a . u i . d d m a n a g e r . c u r r e n t ; i f ( t h i s . o p t i o n s . a c t i v e C l a s s ) { t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) } ( b & & t h i s . _ t r i g g e r ( " d e a c t i v a t e " , c , t h i s . u i ( b ) ) ) } , _ o v e r : f u n c t i o n ( c ) { v a r   b = a . u i . d d m a n a g e r . c u r r e n t ; i f ( ! b | | ( b . c u r r e n t I t e m | | b . e l e m e n t ) [ 0 ] = = t h i s . e l e m e n t [ 0 ] ) { r e t u r n } i f ( t h i s . o p t i o n s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] , ( b . c u r r e n t I t e m | | b . e l e m e n t ) ) ) { i f ( t h i s . o p t i o n s . h o v e r C l a s s ) { t h i s . e l e m e n t . a d d C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) } t h i s . _ t r i g g e r ( " o v e r " , c , t h i s . u i ( b ) ) } } , _ o u t : f u n c t i o n ( c ) { v a r   b = a . u i . d d m a n a g e r . c u r r e n t ; i f ( ! b | | ( b . c u r r e n t I t e m | | b . e l e m e n t ) [ 0 ] = = t h i s . e l e m e n t [ 0 ] ) { r e t u r n } i f ( t h i s . o p t i o n s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] , ( b . c u r r e n t I t e m | | b . e l e m e n t ) ) ) { i f ( t h i s . o p t i o n s . h o v e r C l a s s ) { t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) } t h i s . _ t r i g g e r ( " o u t " , c , t h i s . u i ( b ) ) } } , _ d r o p : f u n c t i o n ( c , d ) { v a r   b = d | | a . u i . d d m a n a g e r . c u r r e n t ; i f ( ! b | | ( b . c u r r e n t I t e m | | b . e l e m e n t ) [ 0 ] = = t h i s . e l e m e n t [ 0 ] ) { r e t u r n   f a l s e } v a r   e = f a l s e ; t h i s . e l e m e n t . f i n d ( " : d a t a ( d r o p p a b l e ) " ) . n o t ( " . u i - d r a g g a b l e - d r a g g i n g " ) . e a c h ( f u n c t i o n ( ) { v a r   f = a . d a t a ( t h i s , " d r o p p a b l e " ) ; i f ( f . o p t i o n s . g r e e d y & & a . u i . i n t e r s e c t ( b , a . e x t e n d ( f , { o f f s e t : f . e l e m e n t . o f f s e t ( ) } ) , f . o p t i o n s . t o l e r a n c e ) ) { e = t r u e ; r e t u r n   f a l s e } } ) ; i f ( e ) { r e t u r n   f a l s e } i f ( t h i s . o p t i o n s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] , ( b . c u r r e n t I t e m | | b . e l e m e n t ) ) ) { i f ( t h i s . o p t i o n s . a c t i v e C l a s s ) { t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . a c t i v e C l a s s ) } i f ( t h i s . o p t i o n s . h o v e r C l a s s ) { t h i s . e l e m e n t . r e m o v e C l a s s ( t h i s . o p t i o n s . h o v e r C l a s s ) } t h i s . _ t r i g g e r ( " d r o p " , c , t h i s . u i ( b ) ) ; r e t u r n   t h i s . e l e m e n t } r e t u r n   f a l s e } , u i : f u n c t i o n ( b ) { r e t u r n { d r a g g a b l e : ( b . c u r r e n t I t e m | | b . e l e m e n t ) , h e l p e r : b . h e l p e r , p o s i t i o n : b . p o s i t i o n , a b s o l u t e P o s i t i o n : b . p o s i t i o n A b s , o f f s e t : b . p o s i t i o n A b s } } } ) ; a . e x t e n d ( a . u i . d r o p p a b l e , { v e r s i o n : " 1 . 7 . 2 " , e v e n t P r e f i x : " d r o p " , d e f a u l t s : { a c c e p t : " * " , a c t i v e C l a s s : f a l s e , a d d C l a s s e s : t r u e , g r e e d y : f a l s e , h o v e r C l a s s : f a l s e , s c o p e : " d e f a u l t " , t o l e r a n c e : " i n t e r s e c t " } } ) ; a . u i . i n t e r s e c t = f u n c t i o n ( q , j , o ) { i f ( ! j . o f f s e t ) { r e t u r n   f a l s e } v a r   e = ( q . p o s i t i o n A b s | | q . p o s i t i o n . a b s o l u t e ) . l e f t , d = e + q . h e l p e r P r o p o r t i o n s . w i d t h , n = ( q . p o s i t i o n A b s | | q . p o s i t i o n . a b s o l u t e ) . t o p , m = n + q . h e l p e r P r o p o r t i o n s . h e i g h t ; v a r   g = j . o f f s e t . l e f t , c = g + j . p r o p o r t i o n s . w i d t h , p = j . o f f s e t . t o p , k = p + j . p r o p o r t i o n s . h e i g h t ; s w i t c h ( o ) { c a s e " f i t " : r e t u r n ( g < e & & d < c & & p < n & & m < k ) ; b r e a k ; c a s e " i n t e r s e c t " : r e t u r n ( g < e + ( q . h e l p e r P r o p o r t i o n s . w i d t h / 2 ) & & d - ( q . h e l p e r P r o p o r t i o n s . w i d t h / 2 ) < c & & p < n + ( q . h e l p e r P r o p o r t i o n s . h e i g h t / 2 ) & & m - ( q . h e l p e r P r o p o r t i o n s . h e i g h t / 2 ) < k ) ; b r e a k ; c a s e " p o i n t e r " : v a r   h = ( ( q . p o s i t i o n A b s | | q . p o s i t i o n . a b s o l u t e ) . l e f t + ( q . c l i c k O f f s e t | | q . o f f s e t . c l i c k ) . l e f t ) , i = ( ( q . p o s i t i o n A b s | | q . p o s i t i o n . a b s o l u t e ) . t o p + ( q . c l i c k O f f s e t | | q . o f f s e t . c l i c k ) . t o p ) , f = a . u i . i s O v e r ( i , h , p , g , j . p r o p o r t i o n s . h e i g h t , j . p r o p o r t i o n s . w i d t h ) ; r e t u r n   f ; b r e a k ; c a s e " t o u c h " : r e t u r n ( ( n > = p & & n < = k ) | | ( m > = p & & m < = k ) | | ( n < p & & m > k ) ) & & ( ( e > = g & & e < = c ) | | ( d > = g & & d < = c ) | | ( e < g & & d > c ) ) ; b r e a k ; d e f a u l t : r e t u r n   f a l s e ; b r e a k } } ; a . u i . d d m a n a g e r = { c u r r e n t : n u l l , d r o p p a b l e s : { " d e f a u l t " : [ ] } , p r e p a r e O f f s e t s : f u n c t i o n ( e , g ) { v a r   b = a . u i . d d m a n a g e r . d r o p p a b l e s [ e . o p t i o n s . s c o p e ] ; v a r   f = g ? g . t y p e : n u l l ; v a r   h = ( e . c u r r e n t I t e m | | e . e l e m e n t ) . f i n d ( " : d a t a ( d r o p p a b l e ) " ) . a n d S e l f ( ) ; d r o p p a b l e s L o o p : f o r ( v a r   d = 0 ; d < b . l e n g t h ; d + + ) { i f ( b [ d ] . o p t i o n s . d i s a b l e d | | ( e & & ! b [ d ] . o p t i o n s . a c c e p t . c a l l ( b [ d ] . e l e m e n t [ 0 ] , ( e . c u r r e n t I t e m | | e . e l e m e n t ) ) ) ) { c o n t i n u e } f o r ( v a r   c = 0 ; c < h . l e n g t h ; c + + ) { i f ( h [ c ] = = b [ d ] . e l e m e n t [ 0 ] ) { b [ d ] . p r o p o r t i o n s . h e i g h t = 0 ; c o n t i n u e   d r o p p a b l e s L o o p } } b [ d ] . v i s i b l e = b [ d ] . e l e m e n t . c s s ( " d i s p l a y " ) ! = " n o n e " ; i f ( ! b [ d ] . v i s i b l e ) { c o n t i n u e } b [ d ] . o f f s e t = b [ d ] . e l e m e n t . o f f s e t ( ) ; b [ d ] . p r o p o r t i o n s = { w i d t h : b [ d ] . e l e m e n t [ 0 ] . o f f s e t W i d t h , h e i g h t : b [ d ] . e l e m e n t [ 0 ] . o f f s e t H e i g h t } ; i f ( f = = " m o u s e d o w n " ) { b [ d ] . _ a c t i v a t e . c a l l ( b [ d ] , g ) } } } , d r o p : f u n c t i o n ( b , c ) { v a r   d = f a l s e ; a . e a c h ( a . u i . d d m a n a g e r . d r o p p a b l e s [ b . o p t i o n s . s c o p e ] , f u n c t i o n ( ) { i f ( ! t h i s . o p t i o n s ) { r e t u r n } i f ( ! t h i s . o p t i o n s . d i s a b l e d & & t h i s . v i s i b l e & & a . u i . i n t e r s e c t ( b , t h i s , t h i s . o p t i o n s . t o l e r a n c e ) ) { d = t h i s . _ d r o p . c a l l ( t h i s , c ) } i f ( ! t h i s . o p t i o n s . d i s a b l e d & & t h i s . v i s i b l e & & t h i s . o p t i o n s . a c c e p t . c a l l ( t h i s . e l e m e n t [ 0 ] , ( b . c u r r e n t I t e m | | b . e l e m e n t ) ) ) { t h i s . i s o u t = 1 ; t h i s . i s o v e r = 0 ; t h i s . _ d e a c t i v a t e . c a l l ( t h i s , c ) } } ) ; r e t u r n   d } , d r a g : f u n c t i o n ( b , c ) { i f ( b . o p t i o n s . r e f r e s h P o s i t i o n s ) { a . u i . d d m a n a g e r . p r e p a r e O f f s e t s ( b , c ) } a . e a c h ( a . u i . d d m a n a g e r . d r o p p a b l e s [ b . o p t i o n s . s c o p e ] , f u n c t i o n ( ) { i f ( t h i s . o p t i o n s . d i s a b l e d | | t h i s . g r e e d y C h i l d | | ! t h i s . v i s i b l e ) { r e t u r n } v a r   e = a . u i . i n t e r s e c t ( b , t h i s , t h i s . o p t i o n s . t o l e r a n c e ) ; v a r   g = ! e & & t h i s . i s o v e r = = 1 ? " i s o u t " : ( e & & t h i s . i s o v e r = = 0 ? " i s o v e r " : n u l l ) ; i f ( ! g ) { r e t u r n } v a r   f ; i f ( t h i s . o p t i o n s . g r e e d y ) { v a r   d = t h i s . e l e m e n t . p a r e n t s ( " : d a t a ( d r o p p a b l e ) : e q ( 0 ) " ) ; i f ( d . l e n g t h ) { f = a . d a t a ( d [ 0 ] , " d r o p p a b l e " ) ; f . g r e e d y C h i l d = ( g = = " i s o v e r " ? 1 : 0 ) } } i f ( f & & g = = " i s o v e r " ) { f . i s o v e r = 0 ; f . i s o u t = 1 ; f . _ o u t . c a l l ( f , c ) } t h i s [ g ] = 1 ; t h i s [ g = = " i s o u t " ? " i s o v e r " : " i s o u t " ] = 0 ; t h i s [ g = = " i s o v e r " ? " _ o v e r " : " _ o u t " ] . c a l l ( t h i s , c ) ; i f ( f & & g = = " i s o u t " ) { f . i s o u t = 0 ; f . i s o v e r = 1 ; f . _ o v e r . c a l l ( f , c ) } } ) } } } ) ( j Q u e r y ) ; ; / *  
   *   j Q u e r y   U I   A c c o r d i o n   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / A c c o r d i o n  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * /  
 ( f u n c t i o n ( a ) { a . w i d g e t ( " u i . a c c o r d i o n " , { _ i n i t : f u n c t i o n ( ) { v a r   d = t h i s . o p t i o n s , b = t h i s ; t h i s . r u n n i n g = 0 ; i f ( d . c o l l a p s i b l e = = a . u i . a c c o r d i o n . d e f a u l t s . c o l l a p s i b l e & & d . a l w a y s O p e n ! = a . u i . a c c o r d i o n . d e f a u l t s . a l w a y s O p e n ) { d . c o l l a p s i b l e = ! d . a l w a y s O p e n } i f ( d . n a v i g a t i o n ) { v a r   c = t h i s . e l e m e n t . f i n d ( " a " ) . f i l t e r ( d . n a v i g a t i o n F i l t e r ) ; i f ( c . l e n g t h ) { i f ( c . f i l t e r ( d . h e a d e r ) . l e n g t h ) { t h i s . a c t i v e = c } e l s e { t h i s . a c t i v e = c . p a r e n t ( ) . p a r e n t ( ) . p r e v ( ) ; c . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) } } } t h i s . e l e m e n t . a d d C l a s s ( " u i - a c c o r d i o n   u i - w i d g e t   u i - h e l p e r - r e s e t " ) ; i f ( t h i s . e l e m e n t [ 0 ] . n o d e N a m e = = " U L " ) { t h i s . e l e m e n t . c h i l d r e n ( " l i " ) . a d d C l a s s ( " u i - a c c o r d i o n - l i - f i x " ) } t h i s . h e a d e r s = t h i s . e l e m e n t . f i n d ( d . h e a d e r ) . a d d C l a s s ( " u i - a c c o r d i o n - h e a d e r   u i - h e l p e r - r e s e t   u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . b i n d ( " m o u s e e n t e r . a c c o r d i o n " , f u n c t i o n ( ) { a ( t h i s ) . a d d C l a s s ( " u i - s t a t e - h o v e r " ) } ) . b i n d ( " m o u s e l e a v e . a c c o r d i o n " , f u n c t i o n ( ) { a ( t h i s ) . r e m o v e C l a s s ( " u i - s t a t e - h o v e r " ) } ) . b i n d ( " f o c u s . a c c o r d i o n " , f u n c t i o n ( ) { a ( t h i s ) . a d d C l a s s ( " u i - s t a t e - f o c u s " ) } ) . b i n d ( " b l u r . a c c o r d i o n " , f u n c t i o n ( ) { a ( t h i s ) . r e m o v e C l a s s ( " u i - s t a t e - f o c u s " ) } ) ; t h i s . h e a d e r s . n e x t ( ) . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t   u i - h e l p e r - r e s e t   u i - w i d g e t - c o n t e n t   u i - c o r n e r - b o t t o m " ) ; t h i s . a c t i v e = t h i s . _ f i n d A c t i v e ( t h i s . a c t i v e | | d . a c t i v e ) . t o g g l e C l a s s ( " u i - s t a t e - d e f a u l t " ) . t o g g l e C l a s s ( " u i - s t a t e - a c t i v e " ) . t o g g l e C l a s s ( " u i - c o r n e r - a l l " ) . t o g g l e C l a s s ( " u i - c o r n e r - t o p " ) ; t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ; a ( " < s p a n / > " ) . a d d C l a s s ( " u i - i c o n   " + d . i c o n s . h e a d e r ) . p r e p e n d T o ( t h i s . h e a d e r s ) ; t h i s . a c t i v e . f i n d ( " . u i - i c o n " ) . t o g g l e C l a s s ( d . i c o n s . h e a d e r ) . t o g g l e C l a s s ( d . i c o n s . h e a d e r S e l e c t e d ) ; i f ( a . b r o w s e r . m s i e ) { t h i s . e l e m e n t . f i n d ( " a " ) . c s s ( " z o o m " , " 1 " ) } t h i s . r e s i z e ( ) ; t h i s . e l e m e n t . a t t r ( " r o l e " , " t a b l i s t " ) ; t h i s . h e a d e r s . a t t r ( " r o l e " , " t a b " ) . b i n d ( " k e y d o w n " , f u n c t i o n ( e ) { r e t u r n   b . _ k e y d o w n ( e ) } ) . n e x t ( ) . a t t r ( " r o l e " , " t a b p a n e l " ) ; t h i s . h e a d e r s . n o t ( t h i s . a c t i v e | | " " ) . a t t r ( " a r i a - e x p a n d e d " , " f a l s e " ) . a t t r ( " t a b I n d e x " , " - 1 " ) . n e x t ( ) . h i d e ( ) ; i f ( ! t h i s . a c t i v e . l e n g t h ) { t h i s . h e a d e r s . e q ( 0 ) . a t t r ( " t a b I n d e x " , " 0 " ) } e l s e { t h i s . a c t i v e . a t t r ( " a r i a - e x p a n d e d " , " t r u e " ) . a t t r ( " t a b I n d e x " , " 0 " ) } i f ( ! a . b r o w s e r . s a f a r i ) { t h i s . h e a d e r s . f i n d ( " a " ) . a t t r ( " t a b I n d e x " , " - 1 " ) } i f ( d . e v e n t ) { t h i s . h e a d e r s . b i n d ( ( d . e v e n t ) + " . a c c o r d i o n " , f u n c t i o n ( e ) { r e t u r n   b . _ c l i c k H a n d l e r . c a l l ( b , e , t h i s ) } ) } } , d e s t r o y : f u n c t i o n ( ) { v a r   c = t h i s . o p t i o n s ; t h i s . e l e m e n t . r e m o v e C l a s s ( " u i - a c c o r d i o n   u i - w i d g e t   u i - h e l p e r - r e s e t " ) . r e m o v e A t t r ( " r o l e " ) . u n b i n d ( " . a c c o r d i o n " ) . r e m o v e D a t a ( " a c c o r d i o n " ) ; t h i s . h e a d e r s . u n b i n d ( " . a c c o r d i o n " ) . r e m o v e C l a s s ( " u i - a c c o r d i o n - h e a d e r   u i - h e l p e r - r e s e t   u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l   u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . r e m o v e A t t r ( " r o l e " ) . r e m o v e A t t r ( " a r i a - e x p a n d e d " ) . r e m o v e A t t r ( " t a b i n d e x " ) ; t h i s . h e a d e r s . f i n d ( " a " ) . r e m o v e A t t r ( " t a b i n d e x " ) ; t h i s . h e a d e r s . c h i l d r e n ( " . u i - i c o n " ) . r e m o v e ( ) ; v a r   b = t h i s . h e a d e r s . n e x t ( ) . c s s ( " d i s p l a y " , " " ) . r e m o v e A t t r ( " r o l e " ) . r e m o v e C l a s s ( " u i - h e l p e r - r e s e t   u i - w i d g e t - c o n t e n t   u i - c o r n e r - b o t t o m   u i - a c c o r d i o n - c o n t e n t   u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ; i f ( c . a u t o H e i g h t | | c . f i l l H e i g h t ) { b . c s s ( " h e i g h t " , " " ) } } , _ s e t D a t a : f u n c t i o n ( b , c ) { i f ( b = = " a l w a y s O p e n " ) { b = " c o l l a p s i b l e " ; c = ! c } a . w i d g e t . p r o t o t y p e . _ s e t D a t a . a p p l y ( t h i s , a r g u m e n t s ) } , _ k e y d o w n : f u n c t i o n ( e ) { v a r   g = t h i s . o p t i o n s , f = a . u i . k e y C o d e ; i f ( g . d i s a b l e d | | e . a l t K e y | | e . c t r l K e y ) { r e t u r n } v a r   d = t h i s . h e a d e r s . l e n g t h ; v a r   b = t h i s . h e a d e r s . i n d e x ( e . t a r g e t ) ; v a r   c = f a l s e ; s w i t c h ( e . k e y C o d e ) { c a s e   f . R I G H T : c a s e   f . D O W N : c = t h i s . h e a d e r s [ ( b + 1 ) % d ] ; b r e a k ; c a s e   f . L E F T : c a s e   f . U P : c = t h i s . h e a d e r s [ ( b - 1 + d ) % d ] ; b r e a k ; c a s e   f . S P A C E : c a s e   f . E N T E R : r e t u r n   t h i s . _ c l i c k H a n d l e r ( { t a r g e t : e . t a r g e t } , e . t a r g e t ) } i f ( c ) { a ( e . t a r g e t ) . a t t r ( " t a b I n d e x " , " - 1 " ) ; a ( c ) . a t t r ( " t a b I n d e x " , " 0 " ) ; c . f o c u s ( ) ; r e t u r n   f a l s e } r e t u r n   t r u e } , r e s i z e : f u n c t i o n ( ) { v a r   e = t h i s . o p t i o n s , d ; i f ( e . f i l l S p a c e ) { i f ( a . b r o w s e r . m s i e ) { v a r   b = t h i s . e l e m e n t . p a r e n t ( ) . c s s ( " o v e r f l o w " ) ; t h i s . e l e m e n t . p a r e n t ( ) . c s s ( " o v e r f l o w " , " h i d d e n " ) } d = t h i s . e l e m e n t . p a r e n t ( ) . h e i g h t ( ) ; i f ( a . b r o w s e r . m s i e ) { t h i s . e l e m e n t . p a r e n t ( ) . c s s ( " o v e r f l o w " , b ) } t h i s . h e a d e r s . e a c h ( f u n c t i o n ( ) { d - = a ( t h i s ) . o u t e r H e i g h t ( ) } ) ; v a r   c = 0 ; t h i s . h e a d e r s . n e x t ( ) . e a c h ( f u n c t i o n ( ) { c = M a t h . m a x ( c , a ( t h i s ) . i n n e r H e i g h t ( ) - a ( t h i s ) . h e i g h t ( ) ) } ) . h e i g h t ( M a t h . m a x ( 0 , d - c ) ) . c s s ( " o v e r f l o w " , " a u t o " ) } e l s e { i f ( e . a u t o H e i g h t ) { d = 0 ; t h i s . h e a d e r s . n e x t ( ) . e a c h ( f u n c t i o n ( ) { d = M a t h . m a x ( d , a ( t h i s ) . o u t e r H e i g h t ( ) ) } ) . h e i g h t ( d ) } } } , a c t i v a t e : f u n c t i o n ( b ) { v a r   c = t h i s . _ f i n d A c t i v e ( b ) [ 0 ] ; t h i s . _ c l i c k H a n d l e r ( { t a r g e t : c } , c ) } , _ f i n d A c t i v e : f u n c t i o n ( b ) { r e t u r n   b ? t y p e o f   b = = " n u m b e r " ? t h i s . h e a d e r s . f i l t e r ( " : e q ( " + b + " ) " ) : t h i s . h e a d e r s . n o t ( t h i s . h e a d e r s . n o t ( b ) ) : b = = = f a l s e ? a ( [ ] ) : t h i s . h e a d e r s . f i l t e r ( " : e q ( 0 ) " ) } , _ c l i c k H a n d l e r : f u n c t i o n ( b , f ) { v a r   d = t h i s . o p t i o n s ; i f ( d . d i s a b l e d ) { r e t u r n   f a l s e } i f ( ! b . t a r g e t & & d . c o l l a p s i b l e ) { t h i s . a c t i v e . r e m o v e C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . a d d C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( d . i c o n s . h e a d e r S e l e c t e d ) . a d d C l a s s ( d . i c o n s . h e a d e r ) ; t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ; v a r   h = t h i s . a c t i v e . n e x t ( ) , e = { o p t i o n s : d , n e w H e a d e r : a ( [ ] ) , o l d H e a d e r : d . a c t i v e , n e w C o n t e n t : a ( [ ] ) , o l d C o n t e n t : h } , c = ( t h i s . a c t i v e = a ( [ ] ) ) ; t h i s . _ t o g g l e ( c , h , e ) ; r e t u r n   f a l s e } v a r   g = a ( b . c u r r e n t T a r g e t | | f ) ; v a r   i = g [ 0 ] = = t h i s . a c t i v e [ 0 ] ; i f ( t h i s . r u n n i n g | | ( ! d . c o l l a p s i b l e & & i ) ) { r e t u r n   f a l s e } t h i s . a c t i v e . r e m o v e C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . a d d C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( d . i c o n s . h e a d e r S e l e c t e d ) . a d d C l a s s ( d . i c o n s . h e a d e r ) ; t h i s . a c t i v e . n e x t ( ) . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) ; i f ( ! i ) { g . r e m o v e C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . a d d C l a s s ( " u i - s t a t e - a c t i v e   u i - c o r n e r - t o p " ) . f i n d ( " . u i - i c o n " ) . r e m o v e C l a s s ( d . i c o n s . h e a d e r ) . a d d C l a s s ( d . i c o n s . h e a d e r S e l e c t e d ) ; g . n e x t ( ) . a d d C l a s s ( " u i - a c c o r d i o n - c o n t e n t - a c t i v e " ) } v a r   c = g . n e x t ( ) , h = t h i s . a c t i v e . n e x t ( ) , e = { o p t i o n s : d , n e w H e a d e r : i & & d . c o l l a p s i b l e ? a ( [ ] ) : g , o l d H e a d e r : t h i s . a c t i v e , n e w C o n t e n t : i & & d . c o l l a p s i b l e ? a ( [ ] ) : c . f i n d ( " >   * " ) , o l d C o n t e n t : h . f i n d ( " >   * " ) } , j = t h i s . h e a d e r s . i n d e x ( t h i s . a c t i v e [ 0 ] ) > t h i s . h e a d e r s . i n d e x ( g [ 0 ] ) ; t h i s . a c t i v e = i ? a ( [ ] ) : g ; t h i s . _ t o g g l e ( c , h , e , i , j ) ; r e t u r n   f a l s e } , _ t o g g l e : f u n c t i o n ( b , i , g , j , k ) { v a r   d = t h i s . o p t i o n s , m = t h i s ; t h i s . t o S h o w = b ; t h i s . t o H i d e = i ; t h i s . d a t a = g ; v a r   c = f u n c t i o n ( ) { i f ( ! m ) { r e t u r n } r e t u r n   m . _ c o m p l e t e d . a p p l y ( m , a r g u m e n t s ) } ; t h i s . _ t r i g g e r ( " c h a n g e s t a r t " , n u l l , t h i s . d a t a ) ; t h i s . r u n n i n g = i . s i z e ( ) = = = 0 ? b . s i z e ( ) : i . s i z e ( ) ; i f ( d . a n i m a t e d ) { v a r   f = { } ; i f ( d . c o l l a p s i b l e & & j ) { f = { t o S h o w : a ( [ ] ) , t o H i d e : i , c o m p l e t e : c , d o w n : k , a u t o H e i g h t : d . a u t o H e i g h t | | d . f i l l S p a c e } } e l s e { f = { t o S h o w : b , t o H i d e : i , c o m p l e t e : c , d o w n : k , a u t o H e i g h t : d . a u t o H e i g h t | | d . f i l l S p a c e } } i f ( ! d . p r o x i e d ) { d . p r o x i e d = d . a n i m a t e d } i f ( ! d . p r o x i e d D u r a t i o n ) { d . p r o x i e d D u r a t i o n = d . d u r a t i o n } d . a n i m a t e d = a . i s F u n c t i o n ( d . p r o x i e d ) ? d . p r o x i e d ( f ) : d . p r o x i e d ; d . d u r a t i o n = a . i s F u n c t i o n ( d . p r o x i e d D u r a t i o n ) ? d . p r o x i e d D u r a t i o n ( f ) : d . p r o x i e d D u r a t i o n ; v a r   l = a . u i . a c c o r d i o n . a n i m a t i o n s , e = d . d u r a t i o n , h = d . a n i m a t e d ; i f ( ! l [ h ] ) { l [ h ] = f u n c t i o n ( n ) { t h i s . s l i d e ( n , { e a s i n g : h , d u r a t i o n : e | | 7 0 0 } ) } } l [ h ] ( f ) } e l s e { i f ( d . c o l l a p s i b l e & & j ) { b . t o g g l e ( ) } e l s e { i . h i d e ( ) ; b . s h o w ( ) } c ( t r u e ) } i . p r e v ( ) . a t t r ( " a r i a - e x p a n d e d " , " f a l s e " ) . a t t r ( " t a b I n d e x " , " - 1 " ) . b l u r ( ) ; b . p r e v ( ) . a t t r ( " a r i a - e x p a n d e d " , " t r u e " ) . a t t r ( " t a b I n d e x " , " 0 " ) . f o c u s ( ) } , _ c o m p l e t e d : f u n c t i o n ( b ) { v a r   c = t h i s . o p t i o n s ; t h i s . r u n n i n g = b ? 0 : - - t h i s . r u n n i n g ; i f ( t h i s . r u n n i n g ) { r e t u r n } i f ( c . c l e a r S t y l e ) { t h i s . t o S h o w . a d d ( t h i s . t o H i d e ) . c s s ( { h e i g h t : " " , o v e r f l o w : " " } ) } t h i s . _ t r i g g e r ( " c h a n g e " , n u l l , t h i s . d a t a ) } } ) ; a . e x t e n d ( a . u i . a c c o r d i o n , { v e r s i o n : " 1 . 7 . 2 " , d e f a u l t s : { a c t i v e : n u l l , a l w a y s O p e n : t r u e , a n i m a t e d : " s l i d e " , a u t o H e i g h t : t r u e , c l e a r S t y l e : f a l s e , c o l l a p s i b l e : f a l s e , e v e n t : " c l i c k " , f i l l S p a c e : f a l s e , h e a d e r : " >   l i   >   : f i r s t - c h i l d , >   : n o t ( l i ) : e v e n " , i c o n s : { h e a d e r : " u i - i c o n - t r i a n g l e - 1 - e " , h e a d e r S e l e c t e d : " u i - i c o n - t r i a n g l e - 1 - s " } , n a v i g a t i o n : f a l s e , n a v i g a t i o n F i l t e r : f u n c t i o n ( ) { r e t u r n   t h i s . h r e f . t o L o w e r C a s e ( ) = = l o c a t i o n . h r e f . t o L o w e r C a s e ( ) } } , a n i m a t i o n s : { s l i d e : f u n c t i o n ( j , h ) { j = a . e x t e n d ( { e a s i n g : " s w i n g " , d u r a t i o n : 3 0 0 } , j , h ) ; i f ( ! j . t o H i d e . s i z e ( ) ) { j . t o S h o w . a n i m a t e ( { h e i g h t : " s h o w " } , j ) ; r e t u r n } i f ( ! j . t o S h o w . s i z e ( ) ) { j . t o H i d e . a n i m a t e ( { h e i g h t : " h i d e " } , j ) ; r e t u r n } v a r   c = j . t o S h o w . c s s ( " o v e r f l o w " ) , g , d = { } , f = { } , e = [ " h e i g h t " , " p a d d i n g T o p " , " p a d d i n g B o t t o m " ] , b ; v a r   i = j . t o S h o w ; b = i [ 0 ] . s t y l e . w i d t h ; i . w i d t h ( p a r s e I n t ( i . p a r e n t ( ) . w i d t h ( ) , 1 0 ) - p a r s e I n t ( i . c s s ( " p a d d i n g L e f t " ) , 1 0 ) - p a r s e I n t ( i . c s s ( " p a d d i n g R i g h t " ) , 1 0 ) - ( p a r s e I n t ( i . c s s ( " b o r d e r L e f t W i d t h " ) , 1 0 ) | | 0 ) - ( p a r s e I n t ( i . c s s ( " b o r d e r R i g h t W i d t h " ) , 1 0 ) | | 0 ) ) ; a . e a c h ( e , f u n c t i o n ( k , m ) { f [ m ] = " h i d e " ; v a r   l = ( " " + a . c s s ( j . t o S h o w [ 0 ] , m ) ) . m a t c h ( / ^ ( [ \ d + - . ] + ) ( . * ) $ / ) ; d [ m ] = { v a l u e : l [ 1 ] , u n i t : l [ 2 ] | | " p x " } } ) ; j . t o S h o w . c s s ( { h e i g h t : 0 , o v e r f l o w : " h i d d e n " } ) . s h o w ( ) ; j . t o H i d e . f i l t e r ( " : h i d d e n " ) . e a c h ( j . c o m p l e t e ) . e n d ( ) . f i l t e r ( " : v i s i b l e " ) . a n i m a t e ( f , { s t e p : f u n c t i o n ( k , l ) { i f ( l . p r o p = = " h e i g h t " ) { g = ( l . n o w - l . s t a r t ) / ( l . e n d - l . s t a r t ) } j . t o S h o w [ 0 ] . s t y l e [ l . p r o p ] = ( g * d [ l . p r o p ] . v a l u e ) + d [ l . p r o p ] . u n i t } , d u r a t i o n : j . d u r a t i o n , e a s i n g : j . e a s i n g , c o m p l e t e : f u n c t i o n ( ) { i f ( ! j . a u t o H e i g h t ) { j . t o S h o w . c s s ( " h e i g h t " , " " ) } j . t o S h o w . c s s ( " w i d t h " , b ) ; j . t o S h o w . c s s ( { o v e r f l o w : c } ) ; j . c o m p l e t e ( ) } } ) } , b o u n c e s l i d e : f u n c t i o n ( b ) { t h i s . s l i d e ( b , { e a s i n g : b . d o w n ? " e a s e O u t B o u n c e " : " s w i n g " , d u r a t i o n : b . d o w n ? 1 0 0 0 : 2 0 0 } ) } , e a s e s l i d e : f u n c t i o n ( b ) { t h i s . s l i d e ( b , { e a s i n g : " e a s e i n o u t " , d u r a t i o n : 7 0 0 } ) } } } ) } ) ( j Q u e r y ) ; ; / *  
   *   j Q u e r y   U I   D i a l o g   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / D i a l o g  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * 	 u i . d r a g g a b l e . j s  
   * 	 u i . r e s i z a b l e . j s  
   * /  
 ( f u n c t i o n ( c ) { v a r   b = { d r a g S t a r t : " s t a r t . d r a g g a b l e " , d r a g : " d r a g . d r a g g a b l e " , d r a g S t o p : " s t o p . d r a g g a b l e " , m a x H e i g h t : " m a x H e i g h t . r e s i z a b l e " , m i n H e i g h t : " m i n H e i g h t . r e s i z a b l e " , m a x W i d t h : " m a x W i d t h . r e s i z a b l e " , m i n W i d t h : " m i n W i d t h . r e s i z a b l e " , r e s i z e S t a r t : " s t a r t . r e s i z a b l e " , r e s i z e : " d r a g . r e s i z a b l e " , r e s i z e S t o p : " s t o p . r e s i z a b l e " } , a = " u i - d i a l o g   u i - w i d g e t   u i - w i d g e t - c o n t e n t   u i - c o r n e r - a l l   " ; c . w i d g e t ( " u i . d i a l o g " , { _ i n i t : f u n c t i o n ( ) { t h i s . o r i g i n a l T i t l e = t h i s . e l e m e n t . a t t r ( " t i t l e " ) ; v a r   l = t h i s , m = t h i s . o p t i o n s , j = m . t i t l e | | t h i s . o r i g i n a l T i t l e | | " & n b s p ; " , e = c . u i . d i a l o g . g e t T i t l e I d ( t h i s . e l e m e n t ) , k = ( t h i s . u i D i a l o g = c ( " < d i v / > " ) ) . a p p e n d T o ( d o c u m e n t . b o d y ) . h i d e ( ) . a d d C l a s s ( a + m . d i a l o g C l a s s ) . c s s ( { p o s i t i o n : " a b s o l u t e " , o v e r f l o w : " h i d d e n " , z I n d e x : m . z I n d e x } ) . a t t r ( " t a b I n d e x " , - 1 ) . c s s ( " o u t l i n e " , 0 ) . k e y d o w n ( f u n c t i o n ( n ) { ( m . c l o s e O n E s c a p e & & n . k e y C o d e & & n . k e y C o d e = = c . u i . k e y C o d e . E S C A P E & & l . c l o s e ( n ) ) } ) . a t t r ( { r o l e : " d i a l o g " , " a r i a - l a b e l l e d b y " : e } ) . m o u s e d o w n ( f u n c t i o n ( n ) { l . m o v e T o T o p ( f a l s e , n ) } ) , g = t h i s . e l e m e n t . s h o w ( ) . r e m o v e A t t r ( " t i t l e " ) . a d d C l a s s ( " u i - d i a l o g - c o n t e n t   u i - w i d g e t - c o n t e n t " ) . a p p e n d T o ( k ) , f = ( t h i s . u i D i a l o g T i t l e b a r = c ( " < d i v > < / d i v > " ) ) . a d d C l a s s ( " u i - d i a l o g - t i t l e b a r   u i - w i d g e t - h e a d e r   u i - c o r n e r - a l l   u i - h e l p e r - c l e a r f i x " ) . p r e p e n d T o ( k ) , i = c ( ' < a   h r e f = " # " / > ' ) . a d d C l a s s ( " u i - d i a l o g - t i t l e b a r - c l o s e   u i - c o r n e r - a l l " ) . a t t r ( " r o l e " , " b u t t o n " ) . h o v e r ( f u n c t i o n ( ) { i . a d d C l a s s ( " u i - s t a t e - h o v e r " ) } , f u n c t i o n ( ) { i . r e m o v e C l a s s ( " u i - s t a t e - h o v e r " ) } ) . f o c u s ( f u n c t i o n ( ) { i . a d d C l a s s ( " u i - s t a t e - f o c u s " ) } ) . b l u r ( f u n c t i o n ( ) { i . r e m o v e C l a s s ( " u i - s t a t e - f o c u s " ) } ) . m o u s e d o w n ( f u n c t i o n ( n ) { n . s t o p P r o p a g a t i o n ( ) } ) . c l i c k ( f u n c t i o n ( n ) { l . c l o s e ( n ) ; r e t u r n   f a l s e } ) . a p p e n d T o ( f ) , h = ( t h i s . u i D i a l o g T i t l e b a r C l o s e T e x t = c ( " < s p a n / > " ) ) . a d d C l a s s ( " u i - i c o n   u i - i c o n - c l o s e t h i c k " ) . t e x t ( m . c l o s e T e x t ) . a p p e n d T o ( i ) , d = c ( " < s p a n / > " ) . a d d C l a s s ( " u i - d i a l o g - t i t l e " ) . a t t r ( " i d " , e ) . h t m l ( j ) . p r e p e n d T o ( f ) ; f . f i n d ( " * " ) . a d d ( f ) . d i s a b l e S e l e c t i o n ( ) ; ( m . d r a g g a b l e & & c . f n . d r a g g a b l e & & t h i s . _ m a k e D r a g g a b l e ( ) ) ; ( m . r e s i z a b l e & & c . f n . r e s i z a b l e & & t h i s . _ m a k e R e s i z a b l e ( ) ) ; t h i s . _ c r e a t e B u t t o n s ( m . b u t t o n s ) ; t h i s . _ i s O p e n = f a l s e ; ( m . b g i f r a m e & & c . f n . b g i f r a m e & & k . b g i f r a m e ( ) ) ; ( m . a u t o O p e n & & t h i s . o p e n ( ) ) } , d e s t r o y : f u n c t i o n ( ) { ( t h i s . o v e r l a y & & t h i s . o v e r l a y . d e s t r o y ( ) ) ; t h i s . u i D i a l o g . h i d e ( ) ; t h i s . e l e m e n t . u n b i n d ( " . d i a l o g " ) . r e m o v e D a t a ( " d i a l o g " ) . r e m o v e C l a s s ( " u i - d i a l o g - c o n t e n t   u i - w i d g e t - c o n t e n t " ) . h i d e ( ) . a p p e n d T o ( " b o d y " ) ; t h i s . u i D i a l o g . r e m o v e ( ) ; ( t h i s . o r i g i n a l T i t l e & & t h i s . e l e m e n t . a t t r ( " t i t l e " , t h i s . o r i g i n a l T i t l e ) ) } , c l o s e : f u n c t i o n ( f ) { v a r   d = t h i s ; i f ( f a l s e = = = d . _ t r i g g e r ( " b e f o r e c l o s e " , f ) ) { r e t u r n } ( d . o v e r l a y & & d . o v e r l a y . d e s t r o y ( ) ) ; d . u i D i a l o g . u n b i n d ( " k e y p r e s s . u i - d i a l o g " ) ; ( d . o p t i o n s . h i d e ? d . u i D i a l o g . h i d e ( d . o p t i o n s . h i d e , f u n c t i o n ( ) { d . _ t r i g g e r ( " c l o s e " , f ) } ) : d . u i D i a l o g . h i d e ( ) & & d . _ t r i g g e r ( " c l o s e " , f ) ) ; c . u i . d i a l o g . o v e r l a y . r e s i z e ( ) ; d . _ i s O p e n = f a l s e ; i f ( d . o p t i o n s . m o d a l ) { v a r   e = 0 ; c ( " . u i - d i a l o g " ) . e a c h ( f u n c t i o n ( ) { i f ( t h i s ! = d . u i D i a l o g [ 0 ] ) { e = M a t h . m a x ( e , c ( t h i s ) . c s s ( " z - i n d e x " ) ) } } ) ; c . u i . d i a l o g . m a x Z = e } } , i s O p e n : f u n c t i o n ( ) { r e t u r n   t h i s . _ i s O p e n } , m o v e T o T o p : f u n c t i o n ( f , e ) { i f ( ( t h i s . o p t i o n s . m o d a l & & ! f ) | | ( ! t h i s . o p t i o n s . s t a c k & & ! t h i s . o p t i o n s . m o d a l ) ) { r e t u r n   t h i s . _ t r i g g e r ( " f o c u s " , e ) } i f ( t h i s . o p t i o n s . z I n d e x > c . u i . d i a l o g . m a x Z ) { c . u i . d i a l o g . m a x Z = t h i s . o p t i o n s . z I n d e x } ( t h i s . o v e r l a y & & t h i s . o v e r l a y . $ e l . c s s ( " z - i n d e x " , c . u i . d i a l o g . o v e r l a y . m a x Z = + + c . u i . d i a l o g . m a x Z ) ) ; v a r   d = { s c r o l l T o p : t h i s . e l e m e n t . a t t r ( " s c r o l l T o p " ) , s c r o l l L e f t : t h i s . e l e m e n t . a t t r ( " s c r o l l L e f t " ) } ; t h i s . u i D i a l o g . c s s ( " z - i n d e x " , + + c . u i . d i a l o g . m a x Z ) ; t h i s . e l e m e n t . a t t r ( d ) ; t h i s . _ t r i g g e r ( " f o c u s " , e ) } , o p e n : f u n c t i o n ( ) { i f ( t h i s . _ i s O p e n ) { r e t u r n } v a r   e = t h i s . o p t i o n s , d = t h i s . u i D i a l o g ; t h i s . o v e r l a y = e . m o d a l ? n e w   c . u i . d i a l o g . o v e r l a y ( t h i s ) : n u l l ; ( d . n e x t ( ) . l e n g t h & & d . a p p e n d T o ( " b o d y " ) ) ; t h i s . _ s i z e ( ) ; t h i s . _ p o s i t i o n ( e . p o s i t i o n ) ; d . s h o w ( e . s h o w ) ; t h i s . m o v e T o T o p ( t r u e ) ; ( e . m o d a l & & d . b i n d ( " k e y p r e s s . u i - d i a l o g " , f u n c t i o n ( h ) { i f ( h . k e y C o d e ! = c . u i . k e y C o d e . T A B ) { r e t u r n } v a r   g = c ( " : t a b b a b l e " , t h i s ) , i = g . f i l t e r ( " : f i r s t " ) [ 0 ] , f = g . f i l t e r ( " : l a s t " ) [ 0 ] ; i f ( h . t a r g e t = = f & & ! h . s h i f t K e y ) { s e t T i m e o u t ( f u n c t i o n ( ) { i . f o c u s ( ) } , 1 ) } e l s e { i f ( h . t a r g e t = = i & & h . s h i f t K e y ) { s e t T i m e o u t ( f u n c t i o n ( ) { f . f o c u s ( ) } , 1 ) } } } ) ) ; c ( [ ] ) . a d d ( d . f i n d ( " . u i - d i a l o g - c o n t e n t   : t a b b a b l e : f i r s t " ) ) . a d d ( d . f i n d ( " . u i - d i a l o g - b u t t o n p a n e   : t a b b a b l e : f i r s t " ) ) . a d d ( d ) . f i l t e r ( " : f i r s t " ) . f o c u s ( ) ; t h i s . _ t r i g g e r ( " o p e n " ) ; t h i s . _ i s O p e n = t r u e } , _ c r e a t e B u t t o n s : f u n c t i o n ( g ) { v a r   f = t h i s , d = f a l s e , e = c ( " < d i v > < / d i v > " ) . a d d C l a s s ( " u i - d i a l o g - b u t t o n p a n e   u i - w i d g e t - c o n t e n t   u i - h e l p e r - c l e a r f i x " ) ; t h i s . u i D i a l o g . f i n d ( " . u i - d i a l o g - b u t t o n p a n e " ) . r e m o v e ( ) ; ( t y p e o f   g = = " o b j e c t " & & g ! = = n u l l & & c . e a c h ( g , f u n c t i o n ( ) { r e t u r n   ! ( d = t r u e ) } ) ) ; i f ( d ) { c . e a c h ( g , f u n c t i o n ( h , i ) { c ( ' < b u t t o n   t y p e = " b u t t o n " > < / b u t t o n > ' ) . a d d C l a s s ( " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ) . t e x t ( h ) . c l i c k ( f u n c t i o n ( ) { i . a p p l y ( f . e l e m e n t [ 0 ] , a r g u m e n t s ) } ) . h o v e r ( f u n c t i o n ( ) { c ( t h i s ) . a d d C l a s s ( " u i - s t a t e - h o v e r " ) } , f u n c t i o n ( ) { c ( t h i s ) . r e m o v e C l a s s ( " u i - s t a t e - h o v e r " ) } ) . f o c u s ( f u n c t i o n ( ) { c ( t h i s ) . a d d C l a s s ( " u i - s t a t e - f o c u s " ) } ) . b l u r ( f u n c t i o n ( ) { c ( t h i s ) . r e m o v e C l a s s ( " u i - s t a t e - f o c u s " ) } ) . a p p e n d T o ( e ) } ) ; e . a p p e n d T o ( t h i s . u i D i a l o g ) } } , _ m a k e D r a g g a b l e : f u n c t i o n ( ) { v a r   d = t h i s , f = t h i s . o p t i o n s , e ; t h i s . u i D i a l o g . d r a g g a b l e ( { c a n c e l : " . u i - d i a l o g - c o n t e n t " , h a n d l e : " . u i - d i a l o g - t i t l e b a r " , c o n t a i n m e n t : " d o c u m e n t " , s t a r t : f u n c t i o n ( ) { e = f . h e i g h t ; c ( t h i s ) . h e i g h t ( c ( t h i s ) . h e i g h t ( ) ) . a d d C l a s s ( " u i - d i a l o g - d r a g g i n g " ) ; ( f . d r a g S t a r t & & f . d r a g S t a r t . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) } , d r a g : f u n c t i o n ( ) { ( f . d r a g & & f . d r a g . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) } , s t o p : f u n c t i o n ( ) { c ( t h i s ) . r e m o v e C l a s s ( " u i - d i a l o g - d r a g g i n g " ) . h e i g h t ( e ) ; ( f . d r a g S t o p & & f . d r a g S t o p . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) ; c . u i . d i a l o g . o v e r l a y . r e s i z e ( ) } } ) } , _ m a k e R e s i z a b l e : f u n c t i o n ( g ) { g = ( g = = = u n d e f i n e d ? t h i s . o p t i o n s . r e s i z a b l e : g ) ; v a r   d = t h i s , f = t h i s . o p t i o n s , e = t y p e o f   g = = " s t r i n g " ? g : " n , e , s , w , s e , s w , n e , n w " ; t h i s . u i D i a l o g . r e s i z a b l e ( { c a n c e l : " . u i - d i a l o g - c o n t e n t " , a l s o R e s i z e : t h i s . e l e m e n t , m a x W i d t h : f . m a x W i d t h , m a x H e i g h t : f . m a x H e i g h t , m i n W i d t h : f . m i n W i d t h , m i n H e i g h t : f . m i n H e i g h t , s t a r t : f u n c t i o n ( ) { c ( t h i s ) . a d d C l a s s ( " u i - d i a l o g - r e s i z i n g " ) ; ( f . r e s i z e S t a r t & & f . r e s i z e S t a r t . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) } , r e s i z e : f u n c t i o n ( ) { ( f . r e s i z e & & f . r e s i z e . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) } , h a n d l e s : e , s t o p : f u n c t i o n ( ) { c ( t h i s ) . r e m o v e C l a s s ( " u i - d i a l o g - r e s i z i n g " ) ; f . h e i g h t = c ( t h i s ) . h e i g h t ( ) ; f . w i d t h = c ( t h i s ) . w i d t h ( ) ; ( f . r e s i z e S t o p & & f . r e s i z e S t o p . a p p l y ( d . e l e m e n t [ 0 ] , a r g u m e n t s ) ) ; c . u i . d i a l o g . o v e r l a y . r e s i z e ( ) } } ) . f i n d ( " . u i - r e s i z a b l e - s e " ) . a d d C l a s s ( " u i - i c o n   u i - i c o n - g r i p - d i a g o n a l - s e " ) } , _ p o s i t i o n : f u n c t i o n ( i ) { v a r   e = c ( w i n d o w ) , f = c ( d o c u m e n t ) , g = f . s c r o l l T o p ( ) , d = f . s c r o l l L e f t ( ) , h = g ; i f ( c . i n A r r a y ( i , [ " c e n t e r " , " t o p " , " r i g h t " , " b o t t o m " , " l e f t " ] ) > = 0 ) { i = [ i = = " r i g h t " | | i = = " l e f t " ? i : " c e n t e r " , i = = " t o p " | | i = = " b o t t o m " ? i : " m i d d l e " ] } i f ( i . c o n s t r u c t o r ! = A r r a y ) { i = [ " c e n t e r " , " m i d d l e " ] } i f ( i [ 0 ] . c o n s t r u c t o r = = N u m b e r ) { d + = i [ 0 ] } e l s e { s w i t c h ( i [ 0 ] ) { c a s e " l e f t " : d + = 0 ; b r e a k ; c a s e " r i g h t " : d + = e . w i d t h ( ) - t h i s . u i D i a l o g . o u t e r W i d t h ( ) ; b r e a k ; d e f a u l t : c a s e " c e n t e r " : d + = ( e . w i d t h ( ) - t h i s . u i D i a l o g . o u t e r W i d t h ( ) ) / 2 } } i f ( i [ 1 ] . c o n s t r u c t o r = = N u m b e r ) { g + = i [ 1 ] } e l s e { s w i t c h ( i [ 1 ] ) { c a s e " t o p " : g + = 0 ; b r e a k ; c a s e " b o t t o m " : g + = e . h e i g h t ( ) - t h i s . u i D i a l o g . o u t e r H e i g h t ( ) ; b r e a k ; d e f a u l t : c a s e " m i d d l e " : g + = ( e . h e i g h t ( ) - t h i s . u i D i a l o g . o u t e r H e i g h t ( ) ) / 2 } } g = M a t h . m a x ( g , h ) ; t h i s . u i D i a l o g . c s s ( { t o p : g , l e f t : d } ) } , _ s e t D a t a : f u n c t i o n ( e , f ) { ( b [ e ] & & t h i s . u i D i a l o g . d a t a ( b [ e ] , f ) ) ; s w i t c h ( e ) { c a s e " b u t t o n s " : t h i s . _ c r e a t e B u t t o n s ( f ) ; b r e a k ; c a s e " c l o s e T e x t " : t h i s . u i D i a l o g T i t l e b a r C l o s e T e x t . t e x t ( f ) ; b r e a k ; c a s e " d i a l o g C l a s s " : t h i s . u i D i a l o g . r e m o v e C l a s s ( t h i s . o p t i o n s . d i a l o g C l a s s ) . a d d C l a s s ( a + f ) ; b r e a k ; c a s e " d r a g g a b l e " : ( f ? t h i s . _ m a k e D r a g g a b l e ( ) : t h i s . u i D i a l o g . d r a g g a b l e ( " d e s t r o y " ) ) ; b r e a k ; c a s e " h e i g h t " : t h i s . u i D i a l o g . h e i g h t ( f ) ; b r e a k ; c a s e " p o s i t i o n " : t h i s . _ p o s i t i o n ( f ) ; b r e a k ; c a s e " r e s i z a b l e " : v a r   d = t h i s . u i D i a l o g , g = t h i s . u i D i a l o g . i s ( " : d a t a ( r e s i z a b l e ) " ) ; ( g & & ! f & & d . r e s i z a b l e ( " d e s t r o y " ) ) ; ( g & & t y p e o f   f = = " s t r i n g " & & d . r e s i z a b l e ( " o p t i o n " , " h a n d l e s " , f ) ) ; ( g | | t h i s . _ m a k e R e s i z a b l e ( f ) ) ; b r e a k ; c a s e " t i t l e " : c ( " . u i - d i a l o g - t i t l e " , t h i s . u i D i a l o g T i t l e b a r ) . h t m l ( f | | " & n b s p ; " ) ; b r e a k ; c a s e " w i d t h " : t h i s . u i D i a l o g . w i d t h ( f ) ; b r e a k } c . w i d g e t . p r o t o t y p e . _ s e t D a t a . a p p l y ( t h i s , a r g u m e n t s ) } , _ s i z e : f u n c t i o n ( ) { v a r   e = t h i s . o p t i o n s ; t h i s . e l e m e n t . c s s ( { h e i g h t : 0 , m i n H e i g h t : 0 , w i d t h : " a u t o " } ) ; v a r   d = t h i s . u i D i a l o g . c s s ( { h e i g h t : " a u t o " , w i d t h : e . w i d t h } ) . h e i g h t ( ) ; t h i s . e l e m e n t . c s s ( { m i n H e i g h t : M a t h . m a x ( e . m i n H e i g h t - d , 0 ) , h e i g h t : e . h e i g h t = = " a u t o " ? " a u t o " : M a t h . m a x ( e . h e i g h t - d , 0 ) } ) } } ) ; c . e x t e n d ( c . u i . d i a l o g , { v e r s i o n : " 1 . 7 . 2 " , d e f a u l t s : { a u t o O p e n : t r u e , b g i f r a m e : f a l s e , b u t t o n s : { } , c l o s e O n E s c a p e : t r u e , c l o s e T e x t : " c l o s e " , d i a l o g C l a s s : " " , d r a g g a b l e : t r u e , h i d e : n u l l , h e i g h t : " a u t o " , m a x H e i g h t : f a l s e , m a x W i d t h : f a l s e , m i n H e i g h t : 1 5 0 , m i n W i d t h : 1 5 0 , m o d a l : f a l s e , p o s i t i o n : " c e n t e r " , r e s i z a b l e : t r u e , s h o w : n u l l , s t a c k : t r u e , t i t l e : " " , w i d t h : 3 0 0 , z I n d e x : 1 0 0 0 } , g e t t e r : " i s O p e n " , u u i d : 0 , m a x Z : 0 , g e t T i t l e I d : f u n c t i o n ( d ) { r e t u r n " u i - d i a l o g - t i t l e - " + ( d . a t t r ( " i d " ) | | + + t h i s . u u i d ) } , o v e r l a y : f u n c t i o n ( d ) { t h i s . $ e l = c . u i . d i a l o g . o v e r l a y . c r e a t e ( d ) } } ) ; c . e x t e n d ( c . u i . d i a l o g . o v e r l a y , { i n s t a n c e s : [ ] , m a x Z : 0 , e v e n t s : c . m a p ( " f o c u s , m o u s e d o w n , m o u s e u p , k e y d o w n , k e y p r e s s , c l i c k " . s p l i t ( " , " ) , f u n c t i o n ( d ) { r e t u r n   d + " . d i a l o g - o v e r l a y " } ) . j o i n ( "   " ) , c r e a t e : f u n c t i o n ( e ) { i f ( t h i s . i n s t a n c e s . l e n g t h = = = 0 ) { s e t T i m e o u t ( f u n c t i o n ( ) { i f ( c . u i . d i a l o g . o v e r l a y . i n s t a n c e s . l e n g t h ) { c ( d o c u m e n t ) . b i n d ( c . u i . d i a l o g . o v e r l a y . e v e n t s , f u n c t i o n ( f ) { v a r   g = c ( f . t a r g e t ) . p a r e n t s ( " . u i - d i a l o g " ) . c s s ( " z I n d e x " ) | | 0 ; r e t u r n ( g > c . u i . d i a l o g . o v e r l a y . m a x Z ) } ) } } , 1 ) ; c ( d o c u m e n t ) . b i n d ( " k e y d o w n . d i a l o g - o v e r l a y " , f u n c t i o n ( f ) { ( e . o p t i o n s . c l o s e O n E s c a p e & & f . k e y C o d e & & f . k e y C o d e = = c . u i . k e y C o d e . E S C A P E & & e . c l o s e ( f ) ) } ) ; c ( w i n d o w ) . b i n d ( " r e s i z e . d i a l o g - o v e r l a y " , c . u i . d i a l o g . o v e r l a y . r e s i z e ) } v a r   d = c ( " < d i v > < / d i v > " ) . a p p e n d T o ( d o c u m e n t . b o d y ) . a d d C l a s s ( " u i - w i d g e t - o v e r l a y " ) . c s s ( { w i d t h : t h i s . w i d t h ( ) , h e i g h t : t h i s . h e i g h t ( ) } ) ; ( e . o p t i o n s . b g i f r a m e & & c . f n . b g i f r a m e & & d . b g i f r a m e ( ) ) ; t h i s . i n s t a n c e s . p u s h ( d ) ; r e t u r n   d } , d e s t r o y : f u n c t i o n ( d ) { t h i s . i n s t a n c e s . s p l i c e ( c . i n A r r a y ( t h i s . i n s t a n c e s , d ) , 1 ) ; i f ( t h i s . i n s t a n c e s . l e n g t h = = = 0 ) { c ( [ d o c u m e n t , w i n d o w ] ) . u n b i n d ( " . d i a l o g - o v e r l a y " ) } d . r e m o v e ( ) ; v a r   e = 0 ; c . e a c h ( t h i s . i n s t a n c e s , f u n c t i o n ( ) { e = M a t h . m a x ( e , t h i s . c s s ( " z - i n d e x " ) ) } ) ; t h i s . m a x Z = e } , h e i g h t : f u n c t i o n ( ) { i f ( c . b r o w s e r . m s i e & & c . b r o w s e r . v e r s i o n < 7 ) { v a r   e = M a t h . m a x ( d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l H e i g h t , d o c u m e n t . b o d y . s c r o l l H e i g h t ) ; v a r   d = M a t h . m a x ( d o c u m e n t . d o c u m e n t E l e m e n t . o f f s e t H e i g h t , d o c u m e n t . b o d y . o f f s e t H e i g h t ) ; i f ( e < d ) { r e t u r n   c ( w i n d o w ) . h e i g h t ( ) + " p x " } e l s e { r e t u r n   e + " p x " } } e l s e { r e t u r n   c ( d o c u m e n t ) . h e i g h t ( ) + " p x " } } , w i d t h : f u n c t i o n ( ) { i f ( c . b r o w s e r . m s i e & & c . b r o w s e r . v e r s i o n < 7 ) { v a r   d = M a t h . m a x ( d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l W i d t h , d o c u m e n t . b o d y . s c r o l l W i d t h ) ; v a r   e = M a t h . m a x ( d o c u m e n t . d o c u m e n t E l e m e n t . o f f s e t W i d t h , d o c u m e n t . b o d y . o f f s e t W i d t h ) ; i f ( d < e ) { r e t u r n   c ( w i n d o w ) . w i d t h ( ) + " p x " } e l s e { r e t u r n   d + " p x " } } e l s e { r e t u r n   c ( d o c u m e n t ) . w i d t h ( ) + " p x " } } , r e s i z e : f u n c t i o n ( ) { v a r   d = c ( [ ] ) ; c . e a c h ( c . u i . d i a l o g . o v e r l a y . i n s t a n c e s , f u n c t i o n ( ) { d = d . a d d ( t h i s ) } ) ; d . c s s ( { w i d t h : 0 , h e i g h t : 0 } ) . c s s ( { w i d t h : c . u i . d i a l o g . o v e r l a y . w i d t h ( ) , h e i g h t : c . u i . d i a l o g . o v e r l a y . h e i g h t ( ) } ) } } ) ; c . e x t e n d ( c . u i . d i a l o g . o v e r l a y . p r o t o t y p e , { d e s t r o y : f u n c t i o n ( ) { c . u i . d i a l o g . o v e r l a y . d e s t r o y ( t h i s . $ e l ) } } ) } ) ( j Q u e r y ) ; ;  
  
  
 / *  
   *   j Q u e r y   U I   D a t e p i c k e r   1 . 7 . 2  
   *  
   *   C o p y r i g h t   ( c )   2 0 0 9   A U T H O R S . t x t   ( h t t p : / / j q u e r y u i . c o m / a b o u t )  
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   ( M I T - L I C E N S E . t x t )  
   *   a n d   G P L   ( G P L - L I C E N S E . t x t )   l i c e n s e s .  
   *  
   *   h t t p : / / d o c s . j q u e r y . c o m / U I / D a t e p i c k e r  
   *  
   *   D e p e n d s :  
   * 	 u i . c o r e . j s  
   * /  
  
 ( f u n c t i o n ( $ )   {   / /   h i d e   t h e   n a m e s p a c e  
  
 $ . e x t e n d ( $ . u i ,   {   d a t e p i c k e r :   {   v e r s i o n :   " 1 . 7 . 2 "   }   } ) ;  
  
 v a r   P R O P _ N A M E   =   ' d a t e p i c k e r ' ;  
  
 / *   D a t e   p i c k e r   m a n a g e r .  
       U s e   t h e   s i n g l e t o n   i n s t a n c e   o f   t h i s   c l a s s ,   $ . d a t e p i c k e r ,   t o   i n t e r a c t   w i t h   t h e   d a t e   p i c k e r .  
       S e t t i n g s   f o r   ( g r o u p s   o f )   d a t e   p i c k e r s   a r e   m a i n t a i n e d   i n   a n   i n s t a n c e   o b j e c t ,  
       a l l o w i n g   m u l t i p l e   d i f f e r e n t   s e t t i n g s   o n   t h e   s a m e   p a g e .   * /  
  
 f u n c t i o n   D a t e p i c k e r ( )   {  
 	 t h i s . d e b u g   =   f a l s e ;   / /   C h a n g e   t h i s   t o   t r u e   t o   s t a r t   d e b u g g i n g  
 	 t h i s . _ c u r I n s t   =   n u l l ;   / /   T h e   c u r r e n t   i n s t a n c e   i n   u s e  
 	 t h i s . _ k e y E v e n t   =   f a l s e ;   / /   I f   t h e   l a s t   e v e n t   w a s   a   k e y   e v e n t  
 	 t h i s . _ d i s a b l e d I n p u t s   =   [ ] ;   / /   L i s t   o f   d a t e   p i c k e r   i n p u t s   t h a t   h a v e   b e e n   d i s a b l e d  
 	 t h i s . _ d a t e p i c k e r S h o w i n g   =   f a l s e ;   / /   T r u e   i f   t h e   p o p u p   p i c k e r   i s   s h o w i n g   ,   f a l s e   i f   n o t  
 	 t h i s . _ i n D i a l o g   =   f a l s e ;   / /   T r u e   i f   s h o w i n g   w i t h i n   a   " d i a l o g " ,   f a l s e   i f   n o t  
 	 t h i s . _ m a i n D i v I d   =   ' u i - d a t e p i c k e r - d i v ' ;   / /   T h e   I D   o f   t h e   m a i n   d a t e p i c k e r   d i v i s i o n  
 	 t h i s . _ i n l i n e C l a s s   =   ' u i - d a t e p i c k e r - i n l i n e ' ;   / /   T h e   n a m e   o f   t h e   i n l i n e   m a r k e r   c l a s s  
 	 t h i s . _ a p p e n d C l a s s   =   ' u i - d a t e p i c k e r - a p p e n d ' ;   / /   T h e   n a m e   o f   t h e   a p p e n d   m a r k e r   c l a s s  
 	 t h i s . _ t r i g g e r C l a s s   =   ' u i - d a t e p i c k e r - t r i g g e r ' ;   / /   T h e   n a m e   o f   t h e   t r i g g e r   m a r k e r   c l a s s  
 	 t h i s . _ d i a l o g C l a s s   =   ' u i - d a t e p i c k e r - d i a l o g ' ;   / /   T h e   n a m e   o f   t h e   d i a l o g   m a r k e r   c l a s s  
 	 t h i s . _ d i s a b l e C l a s s   =   ' u i - d a t e p i c k e r - d i s a b l e d ' ;   / /   T h e   n a m e   o f   t h e   d i s a b l e d   c o v e r i n g   m a r k e r   c l a s s  
 	 t h i s . _ u n s e l e c t a b l e C l a s s   =   ' u i - d a t e p i c k e r - u n s e l e c t a b l e ' ;   / /   T h e   n a m e   o f   t h e   u n s e l e c t a b l e   c e l l   m a r k e r   c l a s s  
 	 t h i s . _ c u r r e n t C l a s s   =   ' u i - d a t e p i c k e r - c u r r e n t - d a y ' ;   / /   T h e   n a m e   o f   t h e   c u r r e n t   d a y   m a r k e r   c l a s s  
 	 t h i s . _ d a y O v e r C l a s s   =   ' u i - d a t e p i c k e r - d a y s - c e l l - o v e r ' ;   / /   T h e   n a m e   o f   t h e   d a y   h o v e r   m a r k e r   c l a s s  
 	 t h i s . r e g i o n a l   =   [ ] ;   / /   A v a i l a b l e   r e g i o n a l   s e t t i n g s ,   i n d e x e d   b y   l a n g u a g e   c o d e  
 	 t h i s . r e g i o n a l [ ' ' ]   =   {   / /   D e f a u l t   r e g i o n a l   s e t t i n g s  
 	 	 c l o s e T e x t :   ' D o n e ' ,   / /   D i s p l a y   t e x t   f o r   c l o s e   l i n k  
 	 	 p r e v T e x t :   ' P r e v ' ,   / /   D i s p l a y   t e x t   f o r   p r e v i o u s   m o n t h   l i n k  
 	 	 n e x t T e x t :   ' N e x t ' ,   / /   D i s p l a y   t e x t   f o r   n e x t   m o n t h   l i n k  
 	 	 c u r r e n t T e x t :   ' T o d a y ' ,   / /   D i s p l a y   t e x t   f o r   c u r r e n t   m o n t h   l i n k 	 	  
 	 	 m o n t h N a m e s : [ ' J a n u a r i ' , ' F e b r u a r i ' , ' M a r s ' , ' A p r i l ' , ' M a j ' , ' J u n i ' , ' J u l i ' , ' A u g u s t i ' , ' S e p t e m b e r ' , ' O k t o b e r ' , ' N o v e m b e r ' , ' D e c e m b e r ' ] ,   / /   N a m e s   o f   m o n t h s   f o r   d r o p - d o w n   a n d   f o r m a t t i n g  
 	 	 m o n t h N a m e s S h o r t :   [ ' J a n ' ,   ' F e b ' ,   ' M a r ' ,   ' A p r ' ,   ' M a y ' ,   ' J u n ' ,   ' J u l ' ,   ' A u g ' ,   ' S e p ' ,   ' O c t ' ,   ' N o v ' ,   ' D e c ' ] ,   / /   F o r   f o r m a t t i n g  
 	 	 d a y N a m e s :   [ ' S u n d a y ' ,   ' M o n d a y ' ,   ' T u e s d a y ' ,   ' W e d n e s d a y ' ,   ' T h u r s d a y ' ,   ' F r i d a y ' ,   ' S a t u r d a y ' ] ,   / /   F o r   f o r m a t t i n g  
 	 	 d a y N a m e s S h o r t :   [ ' S u n ' ,   ' M o n ' ,   ' T u e ' ,   ' W e d ' ,   ' T h u ' ,   ' F r i ' ,   ' S a t ' ] ,   / /   F o r   f o r m a t t i n g  
 	 	 d a y N a m e s M i n :   [ ' S ö ' , ' M 5' , ' T i ' , ' O n ' , ' T o ' , ' F r ' , ' L ö ' ] ,   / /   C o l u m n   h e a d i n g s   f o r   d a y s   s t a r t i n g   a t   S u n d a y  
 	 	 d a t e F o r m a t :   ' m m / d d / y y ' ,   / /   S e e   f o r m a t   o p t i o n s   o n   p a r s e D a t e  
 	 	 f i r s t D a y :   1 ,   / /   T h e   f i r s t   d a y   o f   t h e   w e e k ,   S u n   =   0 ,   M o n   =   1 ,   . . .  
 	 	 i s R T L :   f a l s e   / /   T r u e   i f   r i g h t - t o - l e f t   l a n g u a g e ,   f a l s e   i f   l e f t - t o - r i g h t  
 	 } ;  
 	 t h i s . _ d e f a u l t s   =   {   / /   G l o b a l   d e f a u l t s   f o r   a l l   t h e   d a t e   p i c k e r   i n s t a n c e s  
 	 	 s h o w O n :   ' f o c u s ' ,   / /   ' f o c u s '   f o r   p o p u p   o n   f o c u s ,  
 	 	 	 / /   ' b u t t o n '   f o r   t r i g g e r   b u t t o n ,   o r   ' b o t h '   f o r   e i t h e r  
 	 	 s h o w A n i m :   ' s h o w ' ,   / /   N a m e   o f   j Q u e r y   a n i m a t i o n   f o r   p o p u p  
 	 	 s h o w O p t i o n s :   { } ,   / /   O p t i o n s   f o r   e n h a n c e d   a n i m a t i o n s  
 	 	 d e f a u l t D a t e :   + 7 ,   / /   U s e d   w h e n   f i e l d   i s   b l a n k :   a c t u a l   d a t e ,  
 	 	 	 / /   + / - n u m b e r   f o r   o f f s e t   f r o m   t o d a y ,   n u l l   f o r   t o d a y  
 	 	 a p p e n d T e x t :   ' ' ,   / /   D i s p l a y   t e x t   f o l l o w i n g   t h e   i n p u t   b o x ,   e . g .   s h o w i n g   t h e   f o r m a t  
 	 	 b u t t o n T e x t :   ' . . . ' ,   / /   T e x t   f o r   t r i g g e r   b u t t o n  
 	 	 b u t t o n I m a g e :   ' ' ,   / /   U R L   f o r   t r i g g e r   b u t t o n   i m a g e  
 	 	 b u t t o n I m a g e O n l y :   f a l s e ,   / /   T r u e   i f   t h e   i m a g e   a p p e a r s   a l o n e ,   f a l s e   i f   i t   a p p e a r s   o n   a   b u t t o n  
 	 	 h i d e I f N o P r e v N e x t :   t r u e ,   / /   T r u e   t o   h i d e   n e x t / p r e v i o u s   m o n t h   l i n k s  
 	 	 	 / /   i f   n o t   a p p l i c a b l e ,   f a l s e   t o   j u s t   d i s a b l e   t h e m  
 	 	 n a v i g a t i o n A s D a t e F o r m a t :   f a l s e ,   / /   T r u e   i f   d a t e   f o r m a t t i n g   a p p l i e d   t o   p r e v / t o d a y / n e x t   l i n k s  
 	 	 g o t o C u r r e n t :   f a l s e ,   / /   T r u e   i f   t o d a y   l i n k   g o e s   b a c k   t o   c u r r e n t   s e l e c t i o n   i n s t e a d  
 	 	 c h a n g e M o n t h :   t r u e ,   / /   T r u e   i f   m o n t h   c a n   b e   s e l e c t e d   d i r e c t l y ,   f a l s e   i f   o n l y   p r e v / n e x t  
 	 	 c h a n g e Y e a r :   f a l s e ,   / /   T r u e   i f   y e a r   c a n   b e   s e l e c t e d   d i r e c t l y ,   f a l s e   i f   o n l y   p r e v / n e x t  
 	 	 s h o w M o n t h A f t e r Y e a r :   f a l s e ,   / /   T r u e   i f   t h e   y e a r   s e l e c t   p r e c e d e s   m o n t h ,   f a l s e   f o r   m o n t h   t h e n   y e a r  
 	 	 y e a r R a n g e :   ' - 2 : + 2 ' ,   / /   R a n g e   o f   y e a r s   t o   d i s p l a y   i n   d r o p - d o w n ,  
 	 	 	 / /   e i t h e r   r e l a t i v e   t o   c u r r e n t   y e a r   ( - n n : + n n )   o r   a b s o l u t e   ( n n n n : n n n n )  
 	 	 s h o w O t h e r M o n t h s :   t r u e ,   / /   T r u e   t o   s h o w   d a t e s   i n   o t h e r   m o n t h s ,   f a l s e   t o   l e a v e   b l a n k  
 	 	 c a l c u l a t e W e e k :   t h i s . i s o 8 6 0 1 W e e k ,   / /   H o w   t o   c a l c u l a t e   t h e   w e e k   o f   t h e   y e a r ,  
 	 	 	 / /   t a k e s   a   D a t e   a n d   r e t u r n s   t h e   n u m b e r   o f   t h e   w e e k   f o r   i t  
 	 	 s h o r t Y e a r C u t o f f :   ' + 1 ' ,   / /   S h o r t   y e a r   v a l u e s   <   t h i s   a r e   i n   t h e   c u r r e n t   c e n t u r y ,  
 	 	 	 / /   >   t h i s   a r e   i n   t h e   p r e v i o u s   c e n t u r y ,  
 	 	 	 / /   s t r i n g   v a l u e   s t a r t i n g   w i t h   ' + '   f o r   c u r r e n t   y e a r   +   v a l u e  
 	 	 m i n D a t e :   0 ,   / /   T h e   e a r l i e s t   s e l e c t a b l e   d a t e ,   o r   n u l l   f o r   n o   l i m i t  
 	 	 m a x D a t e :   ' + 1 8 m ' ,   / /   T h e   l a t e s t   s e l e c t a b l e   d a t e ,   o r   n u l l   f o r   n o   l i m i t  
 	 	 d u r a t i o n :   ' n o r m a l ' ,   / /   D u r a t i o n   o f   d i s p l a y / c l o s u r e  
 	 	 b e f o r e S h o w D a y :   n u l l ,   / /   F u n c t i o n   t h a t   t a k e s   a   d a t e   a n d   r e t u r n s   a n   a r r a y   w i t h  
 	 	 	 / /   [ 0 ]   =   t r u e   i f   s e l e c t a b l e ,   f a l s e   i f   n o t ,   [ 1 ]   =   c u s t o m   C S S   c l a s s   n a m e ( s )   o r   ' ' ,  
 	 	 	 / /   [ 2 ]   =   c e l l   t i t l e   ( o p t i o n a l ) ,   e . g .   $ . d a t e p i c k e r . n o W e e k e n d s  
 	 	 b e f o r e S h o w :   n u l l ,   / /   F u n c t i o n   t h a t   t a k e s   a n   i n p u t   f i e l d   a n d  
 	 	 	 / /   r e t u r n s   a   s e t   o f   c u s t o m   s e t t i n g s   f o r   t h e   d a t e   p i c k e r  
 	 	 o n S e l e c t :   n u l l ,   / /   D e f i n e   a   c a l l b a c k   f u n c t i o n   w h e n   a   d a t e   i s   s e l e c t e d  
 	 	 o n C h a n g e M o n t h Y e a r :   n u l l ,   / /   D e f i n e   a   c a l l b a c k   f u n c t i o n   w h e n   t h e   m o n t h   o r   y e a r   i s   c h a n g e d  
 	 	 o n C l o s e :   n u l l ,   / /   D e f i n e   a   c a l l b a c k   f u n c t i o n   w h e n   t h e   d a t e p i c k e r   i s   c l o s e d  
 	 	 n u m b e r O f M o n t h s :   1 ,   / /   N u m b e r   o f   m o n t h s   t o   s h o w   a t   a   t i m e  
 	 	 s h o w C u r r e n t A t P o s :   0 ,   / /   T h e   p o s i t i o n   i n   m u l t i p e   m o n t h s   a t   w h i c h   t o   s h o w   t h e   c u r r e n t   m o n t h   ( s t a r t i n g   a t   0 )  
 	 	 s t e p M o n t h s :   1 ,   / /   N u m b e r   o f   m o n t h s   t o   s t e p   b a c k / f o r w a r d  
 	 	 s t e p B i g M o n t h s :   1 2 ,   / /   N u m b e r   o f   m o n t h s   t o   s t e p   b a c k / f o r w a r d   f o r   t h e   b i g   l i n k s  
 	 	 a l t F i e l d :   ' ' ,   / /   S e l e c t o r   f o r   a n   a l t e r n a t e   f i e l d   t o   s t o r e   s e l e c t e d   d a t e s   i n t o  
 	 	 a l t F o r m a t :   ' ' ,   / /   T h e   d a t e   f o r m a t   t o   u s e   f o r   t h e   a l t e r n a t e   f i e l d  
 	 	 c o n s t r a i n I n p u t :   t r u e ,   / /   T h e   i n p u t   i s   c o n s t r a i n e d   b y   t h e   c u r r e n t   d a t e   f o r m a t  
 	 	 s h o w B u t t o n P a n e l :   f a l s e   / /   T r u e   t o   s h o w   b u t t o n   p a n e l ,   f a l s e   t o   n o t   s h o w   i t  
 	 } ;  
 	 $ . e x t e n d ( t h i s . _ d e f a u l t s ,   t h i s . r e g i o n a l [ ' ' ] ) ;  
 	 t h i s . d p D i v   =   $ ( ' < d i v   i d = " '   +   t h i s . _ m a i n D i v I d   +   ' "   c l a s s = " u i - d a t e p i c k e r   u i - w i d g e t   u i - w i d g e t - c o n t e n t   u i - h e l p e r - c l e a r f i x   u i - c o r n e r - a l l   u i - h e l p e r - h i d d e n - a c c e s s i b l e " > < / d i v > ' ) ;  
 }  
  
 $ . e x t e n d ( D a t e p i c k e r . p r o t o t y p e ,   {  
 	 / *   C l a s s   n a m e   a d d e d   t o   e l e m e n t s   t o   i n d i c a t e   a l r e a d y   c o n f i g u r e d   w i t h   a   d a t e   p i c k e r .   * /  
 	 m a r k e r C l a s s N a m e :   ' h a s D a t e p i c k e r ' ,  
  
 	 / *   D e b u g   l o g g i n g   ( i f   e n a b l e d ) .   * /  
 	 l o g :   f u n c t i o n   ( )   {  
 	 	 i f   ( t h i s . d e b u g )  
 	 	 	 c o n s o l e . l o g . a p p l y ( ' ' ,   a r g u m e n t s ) ;  
 	 } ,  
  
 	 / *   O v e r r i d e   t h e   d e f a u l t   s e t t i n g s   f o r   a l l   i n s t a n c e s   o f   t h e   d a t e   p i c k e r .  
 	       @ p a r a m     s e t t i n g s     o b j e c t   -   t h e   n e w   s e t t i n g s   t o   u s e   a s   d e f a u l t s   ( a n o n y m o u s   o b j e c t )  
 	       @ r e t u r n   t h e   m a n a g e r   o b j e c t   * /  
 	 s e t D e f a u l t s :   f u n c t i o n ( s e t t i n g s )   {  
 	 	 e x t e n d R e m o v e ( t h i s . _ d e f a u l t s ,   s e t t i n g s   | |   { } ) ;  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 / *   A t t a c h   t h e   d a t e   p i c k e r   t o   a   j Q u e r y   s e l e c t i o n .  
 	       @ p a r a m     t a r g e t         e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ p a r a m     s e t t i n g s     o b j e c t   -   t h e   n e w   s e t t i n g s   t o   u s e   f o r   t h i s   d a t e   p i c k e r   i n s t a n c e   ( a n o n y m o u s )   * /  
 	 _ a t t a c h D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   s e t t i n g s )   {  
 	 	 / /   c h e c k   f o r   s e t t i n g s   o n   t h e   c o n t r o l   i t s e l f   -   i n   n a m e s p a c e   ' d a t e : '  
 	 	 v a r   i n l i n e S e t t i n g s   =   n u l l ;  
 	 	 f o r   ( v a r   a t t r N a m e   i n   t h i s . _ d e f a u l t s )   {  
 	 	 	 v a r   a t t r V a l u e   =   t a r g e t . g e t A t t r i b u t e ( ' d a t e : '   +   a t t r N a m e ) ;  
 	 	 	 i f   ( a t t r V a l u e )   {  
 	 	 	 	 i n l i n e S e t t i n g s   =   i n l i n e S e t t i n g s   | |   { } ;  
 	 	 	 	 t r y   {  
 	 	 	 	 	 i n l i n e S e t t i n g s [ a t t r N a m e ]   =   e v a l ( a t t r V a l u e ) ;  
 	 	 	 	 }   c a t c h   ( e r r )   {  
 	 	 	 	 	 i n l i n e S e t t i n g s [ a t t r N a m e ]   =   a t t r V a l u e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 v a r   n o d e N a m e   =   t a r g e t . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 v a r   i n l i n e   =   ( n o d e N a m e   = =   ' d i v '   | |   n o d e N a m e   = =   ' s p a n ' ) ;  
 	 	 i f   ( ! t a r g e t . i d )  
 	 	 	 t a r g e t . i d   =   ' d p '   +   ( + + t h i s . u u i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ n e w I n s t ( $ ( t a r g e t ) ,   i n l i n e ) ;  
 	 	 i n s t . s e t t i n g s   =   $ . e x t e n d ( { } ,   s e t t i n g s   | |   { } ,   i n l i n e S e t t i n g s   | |   { } ) ;  
 	 	 i f   ( n o d e N a m e   = =   ' i n p u t ' )   {  
 	 	 	 t h i s . _ c o n n e c t D a t e p i c k e r ( t a r g e t ,   i n s t ) ;  
 	 	 }   e l s e   i f   ( i n l i n e )   {  
 	 	 	 t h i s . _ i n l i n e D a t e p i c k e r ( t a r g e t ,   i n s t ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   C r e a t e   a   n e w   i n s t a n c e   o b j e c t .   * /  
 	 _ n e w I n s t :   f u n c t i o n ( t a r g e t ,   i n l i n e )   {  
 	 	 v a r   i d   =   t a r g e t [ 0 ] . i d . r e p l a c e ( / ( [ : \ [ \ ] \ . ] ) / g ,   ' \ \ \ \ $ 1 ' ) ;   / /   e s c a p e   j Q u e r y   m e t a   c h a r s  
 	 	 r e t u r n   { i d :   i d ,   i n p u t :   t a r g e t ,   / /   a s s o c i a t e d   t a r g e t  
 	 	 	 s e l e c t e d D a y :   0 ,   s e l e c t e d M o n t h :   0 ,   s e l e c t e d Y e a r :   0 ,   / /   c u r r e n t   s e l e c t i o n  
 	 	 	 d r a w M o n t h :   0 ,   d r a w Y e a r :   0 ,   / /   m o n t h   b e i n g   d r a w n  
 	 	 	 i n l i n e :   i n l i n e ,   / /   i s   d a t e p i c k e r   i n l i n e   o r   n o t  
 	 	 	 d p D i v :   ( ! i n l i n e   ?   t h i s . d p D i v   :   / /   p r e s e n t a t i o n   d i v  
 	 	 	 $ ( ' < d i v   c l a s s = " '   +   t h i s . _ i n l i n e C l a s s   +   '   u i - d a t e p i c k e r   u i - w i d g e t   u i - w i d g e t - c o n t e n t   u i - h e l p e r - c l e a r f i x   u i - c o r n e r - a l l " > < / d i v > ' ) ) } ;  
 	 } ,  
  
 	 / *   A t t a c h   t h e   d a t e   p i c k e r   t o   a n   i n p u t   f i e l d .   * /  
 	 _ c o n n e c t D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   i n s t )   {  
 	 	 v a r   i n p u t   =   $ ( t a r g e t ) ;  
 	 	 i n s t . a p p e n d   =   $ ( [ ] ) ;  
 	 	 i n s t . t r i g g e r   =   $ ( [ ] ) ;  
 	 	 i f   ( i n p u t . h a s C l a s s ( t h i s . m a r k e r C l a s s N a m e ) )  
 	 	 	 r e t u r n ;  
 	 	 v a r   a p p e n d T e x t   =   t h i s . _ g e t ( i n s t ,   ' a p p e n d T e x t ' ) ;  
 	 	 v a r   i s R T L   =   t h i s . _ g e t ( i n s t ,   ' i s R T L ' ) ;  
 	 	 i f   ( a p p e n d T e x t )   {  
 	 	 	 i n s t . a p p e n d   =   $ ( ' < s p a n   c l a s s = " '   +   t h i s . _ a p p e n d C l a s s   +   ' " > '   +   a p p e n d T e x t   +   ' < / s p a n > ' ) ;  
 	 	 	 i n p u t [ i s R T L   ?   ' b e f o r e '   :   ' a f t e r ' ] ( i n s t . a p p e n d ) ;  
 	 	 }  
 	 	 v a r   s h o w O n   =   t h i s . _ g e t ( i n s t ,   ' s h o w O n ' ) ;  
 	 	 i f   ( s h o w O n   = =   ' f o c u s '   | |   s h o w O n   = =   ' b o t h ' )   / /   p o p - u p   d a t e   p i c k e r   w h e n   i n   t h e   m a r k e d   f i e l d  
 	 	 	 i n p u t . f o c u s ( t h i s . _ s h o w D a t e p i c k e r ) ;  
 	 	 i f   ( s h o w O n   = =   ' b u t t o n '   | |   s h o w O n   = =   ' b o t h ' )   {   / /   p o p - u p   d a t e   p i c k e r   w h e n   b u t t o n   c l i c k e d  
 	 	 	 v a r   b u t t o n T e x t   =   t h i s . _ g e t ( i n s t ,   ' b u t t o n T e x t ' ) ;  
 	 	 	 v a r   b u t t o n I m a g e   =   t h i s . _ g e t ( i n s t ,   ' b u t t o n I m a g e ' ) ;  
 	 	 	 i n s t . t r i g g e r   =   $ ( t h i s . _ g e t ( i n s t ,   ' b u t t o n I m a g e O n l y ' )   ?  
 	 	 	 	 $ ( ' < i m g / > ' ) . a d d C l a s s ( t h i s . _ t r i g g e r C l a s s ) .  
 	 	 	 	 	 a t t r ( {   s r c :   b u t t o n I m a g e ,   a l t :   b u t t o n T e x t ,   t i t l e :   b u t t o n T e x t   } )   :  
 	 	 	 	 $ ( ' < b u t t o n   t y p e = " b u t t o n " > < / b u t t o n > ' ) . a d d C l a s s ( t h i s . _ t r i g g e r C l a s s ) .  
 	 	 	 	 	 h t m l ( b u t t o n I m a g e   = =   ' '   ?   b u t t o n T e x t   :   $ ( ' < i m g / > ' ) . a t t r (  
 	 	 	 	 	 {   s r c : b u t t o n I m a g e ,   a l t : b u t t o n T e x t ,   t i t l e : b u t t o n T e x t   } ) ) ) ;  
 	 	 	 i n p u t [ i s R T L   ?   ' b e f o r e '   :   ' a f t e r ' ] ( i n s t . t r i g g e r ) ;  
 	 	 	 i n s t . t r i g g e r . c l i c k ( f u n c t i o n ( )   {  
 	 	 	 	 i f   ( $ . d a t e p i c k e r . _ d a t e p i c k e r S h o w i n g   & &   $ . d a t e p i c k e r . _ l a s t I n p u t   = =   t a r g e t )  
 	 	 	 	 	 $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( ) ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 $ . d a t e p i c k e r . _ s h o w D a t e p i c k e r ( t a r g e t ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } ) ;  
 	 	 }  
 	 	 i n p u t . a d d C l a s s ( t h i s . m a r k e r C l a s s N a m e ) . k e y d o w n ( t h i s . _ d o K e y D o w n ) . k e y p r e s s ( t h i s . _ d o K e y P r e s s ) .  
 	 	 	 b i n d ( " s e t D a t a . d a t e p i c k e r " ,   f u n c t i o n ( e v e n t ,   k e y ,   v a l u e )   {  
 	 	 	 	 i n s t . s e t t i n g s [ k e y ]   =   v a l u e ;  
 	 	 	 } ) . b i n d ( " g e t D a t a . d a t e p i c k e r " ,   f u n c t i o n ( e v e n t ,   k e y )   {  
 	 	 	 	 r e t u r n   t h i s . _ g e t ( i n s t ,   k e y ) ;  
 	 	 	 } ) ;  
 	 	 $ . d a t a ( t a r g e t ,   P R O P _ N A M E ,   i n s t ) ;  
 	 } ,  
  
 	 / *   A t t a c h   a n   i n l i n e   d a t e   p i c k e r   t o   a   d i v .   * /  
 	 _ i n l i n e D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   i n s t )   {  
 	 	 v a r   d i v S p a n   =   $ ( t a r g e t ) ;  
 	 	 i f   ( d i v S p a n . h a s C l a s s ( t h i s . m a r k e r C l a s s N a m e ) )  
 	 	 	 r e t u r n ;  
 	 	 d i v S p a n . a d d C l a s s ( t h i s . m a r k e r C l a s s N a m e ) . a p p e n d ( i n s t . d p D i v ) .  
 	 	 	 b i n d ( " s e t D a t a . d a t e p i c k e r " ,   f u n c t i o n ( e v e n t ,   k e y ,   v a l u e ) {  
 	 	 	 	 i n s t . s e t t i n g s [ k e y ]   =   v a l u e ;  
 	 	 	 } ) . b i n d ( " g e t D a t a . d a t e p i c k e r " ,   f u n c t i o n ( e v e n t ,   k e y ) {  
 	 	 	 	 r e t u r n   t h i s . _ g e t ( i n s t ,   k e y ) ;  
 	 	 	 } ) ;  
 	 	 $ . d a t a ( t a r g e t ,   P R O P _ N A M E ,   i n s t ) ;  
 	 	 t h i s . _ s e t D a t e ( i n s t ,   t h i s . _ g e t D e f a u l t D a t e ( i n s t ) ) ;  
 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 t h i s . _ u p d a t e A l t e r n a t e ( i n s t ) ;  
 	 } ,  
  
 	 / *   P o p - u p   t h e   d a t e   p i c k e r   i n   a   " d i a l o g "   b o x .  
 	       @ p a r a m     i n p u t           e l e m e n t   -   i g n o r e d  
 	       @ p a r a m     d a t e T e x t     s t r i n g   -   t h e   i n i t i a l   d a t e   t o   d i s p l a y   ( i n   t h e   c u r r e n t   f o r m a t )  
 	       @ p a r a m     o n S e l e c t     f u n c t i o n   -   t h e   f u n c t i o n ( d a t e T e x t )   t o   c a l l   w h e n   a   d a t e   i s   s e l e c t e d  
 	       @ p a r a m     s e t t i n g s     o b j e c t   -   u p d a t e   t h e   d i a l o g   d a t e   p i c k e r   i n s t a n c e ' s   s e t t i n g s   ( a n o n y m o u s   o b j e c t )  
 	       @ p a r a m     p o s               i n t [ 2 ]   -   c o o r d i n a t e s   f o r   t h e   d i a l o g ' s   p o s i t i o n   w i t h i n   t h e   s c r e e n   o r  
 	                                           e v e n t   -   w i t h   x / y   c o o r d i n a t e s   o r  
 	                                           l e a v e   e m p t y   f o r   d e f a u l t   ( s c r e e n   c e n t r e )  
 	       @ r e t u r n   t h e   m a n a g e r   o b j e c t   * /  
 	 _ d i a l o g D a t e p i c k e r :   f u n c t i o n ( i n p u t ,   d a t e T e x t ,   o n S e l e c t ,   s e t t i n g s ,   p o s )   {  
 	 	 v a r   i n s t   =   t h i s . _ d i a l o g I n s t ;   / /   i n t e r n a l   i n s t a n c e  
 	 	 i f   ( ! i n s t )   {  
 	 	 	 v a r   i d   =   ' d p '   +   ( + + t h i s . u u i d ) ;  
 	 	 	 t h i s . _ d i a l o g I n p u t   =   $ ( ' < i n p u t   t y p e = " t e x t "   i d = " '   +   i d   +  
 	 	 	 	 ' "   s i z e = " 1 "   s t y l e = " p o s i t i o n :   a b s o l u t e ;   t o p :   - 1 0 0 p x ; " / > ' ) ;  
 	 	 	 t h i s . _ d i a l o g I n p u t . k e y d o w n ( t h i s . _ d o K e y D o w n ) ;  
 	 	 	 $ ( ' b o d y ' ) . a p p e n d ( t h i s . _ d i a l o g I n p u t ) ;  
 	 	 	 i n s t   =   t h i s . _ d i a l o g I n s t   =   t h i s . _ n e w I n s t ( t h i s . _ d i a l o g I n p u t ,   f a l s e ) ;  
 	 	 	 i n s t . s e t t i n g s   =   { } ;  
 	 	 	 $ . d a t a ( t h i s . _ d i a l o g I n p u t [ 0 ] ,   P R O P _ N A M E ,   i n s t ) ;  
 	 	 }  
 	 	 e x t e n d R e m o v e ( i n s t . s e t t i n g s ,   s e t t i n g s   | |   { } ) ;  
 	 	 t h i s . _ d i a l o g I n p u t . v a l ( d a t e T e x t ) ;  
  
 	 	 t h i s . _ p o s   =   ( p o s   ?   ( p o s . l e n g t h   ?   p o s   :   [ p o s . p a g e X ,   p o s . p a g e Y ] )   :   n u l l ) ;  
 	 	 i f   ( ! t h i s . _ p o s )   {  
 	 	 	 v a r   b r o w s e r W i d t h   =   w i n d o w . i n n e r W i d t h   | |   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t W i d t h   | | 	 d o c u m e n t . b o d y . c l i e n t W i d t h ;  
 	 	 	 v a r   b r o w s e r H e i g h t   =   w i n d o w . i n n e r H e i g h t   | |   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t H e i g h t   | |   d o c u m e n t . b o d y . c l i e n t H e i g h t ;  
 	 	 	 v a r   s c r o l l X   =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t   | |   d o c u m e n t . b o d y . s c r o l l L e f t ;  
 	 	 	 v a r   s c r o l l Y   =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p   | |   d o c u m e n t . b o d y . s c r o l l T o p ;  
 	 	 	 t h i s . _ p o s   =   / /   s h o u l d   u s e   a c t u a l   w i d t h / h e i g h t   b e l o w  
 	 	 	 	 [ ( b r o w s e r W i d t h   /   2 )   -   1 0 0   +   s c r o l l X ,   ( b r o w s e r H e i g h t   /   2 )   -   1 5 0   +   s c r o l l Y ] ;  
 	 	 }  
  
 	 	 / /   m o v e   i n p u t   o n   s c r e e n   f o r   f o c u s ,   b u t   h i d d e n   b e h i n d   d i a l o g  
 	 	 t h i s . _ d i a l o g I n p u t . c s s ( ' l e f t ' ,   t h i s . _ p o s [ 0 ]   +   ' p x ' ) . c s s ( ' t o p ' ,   t h i s . _ p o s [ 1 ]   +   ' p x ' ) ;  
 	 	 i n s t . s e t t i n g s . o n S e l e c t   =   o n S e l e c t ;  
 	 	 t h i s . _ i n D i a l o g   =   t r u e ;  
 	 	 t h i s . d p D i v . a d d C l a s s ( t h i s . _ d i a l o g C l a s s ) ;  
 	 	 t h i s . _ s h o w D a t e p i c k e r ( t h i s . _ d i a l o g I n p u t [ 0 ] ) ;  
 	 	 i f   ( $ . b l o c k U I )  
 	 	 	 $ . b l o c k U I ( t h i s . d p D i v ) ;  
 	 	 $ . d a t a ( t h i s . _ d i a l o g I n p u t [ 0 ] ,   P R O P _ N A M E ,   i n s t ) ;  
 	 	 r e t u r n   t h i s ;  
 	 } ,  
  
 	 / *   D e t a c h   a   d a t e p i c k e r   f r o m   i t s   c o n t r o l .  
 	       @ p a r a m     t a r g e t         e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n   * /  
 	 _ d e s t r o y D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 v a r   $ t a r g e t   =   $ ( t a r g e t ) ;  
 	 	 v a r   i n s t   =   $ . d a t a ( t a r g e t ,   P R O P _ N A M E ) ;  
 	 	 i f   ( ! $ t a r g e t . h a s C l a s s ( t h i s . m a r k e r C l a s s N a m e ) )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 v a r   n o d e N a m e   =   t a r g e t . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 $ . r e m o v e D a t a ( t a r g e t ,   P R O P _ N A M E ) ;  
 	 	 i f   ( n o d e N a m e   = =   ' i n p u t ' )   {  
 	 	 	 i n s t . a p p e n d . r e m o v e ( ) ;  
 	 	 	 i n s t . t r i g g e r . r e m o v e ( ) ;  
 	 	 	 $ t a r g e t . r e m o v e C l a s s ( t h i s . m a r k e r C l a s s N a m e ) .  
 	 	 	 	 u n b i n d ( ' f o c u s ' ,   t h i s . _ s h o w D a t e p i c k e r ) .  
 	 	 	 	 u n b i n d ( ' k e y d o w n ' ,   t h i s . _ d o K e y D o w n ) .  
 	 	 	 	 u n b i n d ( ' k e y p r e s s ' ,   t h i s . _ d o K e y P r e s s ) ;  
 	 	 }   e l s e   i f   ( n o d e N a m e   = =   ' d i v '   | |   n o d e N a m e   = =   ' s p a n ' )  
 	 	 	 $ t a r g e t . r e m o v e C l a s s ( t h i s . m a r k e r C l a s s N a m e ) . e m p t y ( ) ;  
 	 } ,  
  
 	 / *   E n a b l e   t h e   d a t e   p i c k e r   t o   a   j Q u e r y   s e l e c t i o n .  
 	       @ p a r a m     t a r g e t         e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n   * /  
 	 _ e n a b l e D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 v a r   $ t a r g e t   =   $ ( t a r g e t ) ;  
 	 	 v a r   i n s t   =   $ . d a t a ( t a r g e t ,   P R O P _ N A M E ) ;  
 	 	 i f   ( ! $ t a r g e t . h a s C l a s s ( t h i s . m a r k e r C l a s s N a m e ) )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 v a r   n o d e N a m e   =   t a r g e t . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 i f   ( n o d e N a m e   = =   ' i n p u t ' )   {  
 	 	 	 t a r g e t . d i s a b l e d   =   f a l s e ;  
 	 	 	 i n s t . t r i g g e r . f i l t e r ( ' b u t t o n ' ) .  
 	 	 	 	 e a c h ( f u n c t i o n ( )   {   t h i s . d i s a b l e d   =   f a l s e ;   } ) . e n d ( ) .  
 	 	 	 	 f i l t e r ( ' i m g ' ) . c s s ( { o p a c i t y :   ' 1 . 0 ' ,   c u r s o r :   ' ' } ) ;  
 	 	 }  
 	 	 e l s e   i f   ( n o d e N a m e   = =   ' d i v '   | |   n o d e N a m e   = =   ' s p a n ' )   {  
 	 	 	 v a r   i n l i n e   =   $ t a r g e t . c h i l d r e n ( ' . '   +   t h i s . _ i n l i n e C l a s s ) ;  
 	 	 	 i n l i n e . c h i l d r e n ( ) . r e m o v e C l a s s ( ' u i - s t a t e - d i s a b l e d ' ) ;  
 	 	 }  
 	 	 t h i s . _ d i s a b l e d I n p u t s   =   $ . m a p ( t h i s . _ d i s a b l e d I n p u t s ,  
 	 	 	 f u n c t i o n ( v a l u e )   {   r e t u r n   ( v a l u e   = =   t a r g e t   ?   n u l l   :   v a l u e ) ;   } ) ;   / /   d e l e t e   e n t r y  
 	 } ,  
  
 	 / *   D i s a b l e   t h e   d a t e   p i c k e r   t o   a   j Q u e r y   s e l e c t i o n .  
 	       @ p a r a m     t a r g e t         e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n   * /  
 	 _ d i s a b l e D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 v a r   $ t a r g e t   =   $ ( t a r g e t ) ;  
 	 	 v a r   i n s t   =   $ . d a t a ( t a r g e t ,   P R O P _ N A M E ) ;  
 	 	 i f   ( ! $ t a r g e t . h a s C l a s s ( t h i s . m a r k e r C l a s s N a m e ) )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 v a r   n o d e N a m e   =   t a r g e t . n o d e N a m e . t o L o w e r C a s e ( ) ;  
 	 	 i f   ( n o d e N a m e   = =   ' i n p u t ' )   {  
 	 	 	 t a r g e t . d i s a b l e d   =   t r u e ;  
 	 	 	 i n s t . t r i g g e r . f i l t e r ( ' b u t t o n ' ) .  
 	 	 	 	 e a c h ( f u n c t i o n ( )   {   t h i s . d i s a b l e d   =   t r u e ;   } ) . e n d ( ) .  
 	 	 	 	 f i l t e r ( ' i m g ' ) . c s s ( { o p a c i t y :   ' 0 . 5 ' ,   c u r s o r :   ' d e f a u l t ' } ) ;  
 	 	 }  
 	 	 e l s e   i f   ( n o d e N a m e   = =   ' d i v '   | |   n o d e N a m e   = =   ' s p a n ' )   {  
 	 	 	 v a r   i n l i n e   =   $ t a r g e t . c h i l d r e n ( ' . '   +   t h i s . _ i n l i n e C l a s s ) ;  
 	 	 	 i n l i n e . c h i l d r e n ( ) . a d d C l a s s ( ' u i - s t a t e - d i s a b l e d ' ) ;  
 	 	 }  
 	 	 t h i s . _ d i s a b l e d I n p u t s   =   $ . m a p ( t h i s . _ d i s a b l e d I n p u t s ,  
 	 	 	 f u n c t i o n ( v a l u e )   {   r e t u r n   ( v a l u e   = =   t a r g e t   ?   n u l l   :   v a l u e ) ;   } ) ;   / /   d e l e t e   e n t r y  
 	 	 t h i s . _ d i s a b l e d I n p u t s [ t h i s . _ d i s a b l e d I n p u t s . l e n g t h ]   =   t a r g e t ;  
 	 } ,  
  
 	 / *   I s   t h e   f i r s t   f i e l d   i n   a   j Q u e r y   c o l l e c t i o n   d i s a b l e d   a s   a   d a t e p i c k e r ?  
 	       @ p a r a m     t a r g e t         e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ r e t u r n   b o o l e a n   -   t r u e   i f   d i s a b l e d ,   f a l s e   i f   e n a b l e d   * /  
 	 _ i s D i s a b l e d D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 i f   ( ! t a r g e t )   {  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 f o r   ( v a r   i   =   0 ;   i   <   t h i s . _ d i s a b l e d I n p u t s . l e n g t h ;   i + + )   {  
 	 	 	 i f   ( t h i s . _ d i s a b l e d I n p u t s [ i ]   = =   t a r g e t )  
 	 	 	 	 r e t u r n   t r u e ;  
 	 	 }  
 	 	 r e t u r n   f a l s e ;  
 	 } ,  
  
 	 / *   R e t r i e v e   t h e   i n s t a n c e   d a t a   f o r   t h e   t a r g e t   c o n t r o l .  
 	       @ p a r a m     t a r g e t     e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ r e t u r n     o b j e c t   -   t h e   a s s o c i a t e d   i n s t a n c e   d a t a  
 	       @ t h r o w s     e r r o r   i f   a   j Q u e r y   p r o b l e m   g e t t i n g   d a t a   * /  
 	 _ g e t I n s t :   f u n c t i o n ( t a r g e t )   {  
 	 	 t r y   {  
 	 	 	 r e t u r n   $ . d a t a ( t a r g e t ,   P R O P _ N A M E ) ;  
 	 	 }  
 	 	 c a t c h   ( e r r )   {  
 	 	 	 t h r o w   ' M i s s i n g   i n s t a n c e   d a t a   f o r   t h i s   d a t e p i c k e r ' ;  
 	 	 }  
 	 } ,  
  
 	 / *   U p d a t e   o r   r e t r i e v e   t h e   s e t t i n g s   f o r   a   d a t e   p i c k e r   a t t a c h e d   t o   a n   i n p u t   f i e l d   o r   d i v i s i o n .  
 	       @ p a r a m     t a r g e t     e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ p a r a m     n a m e         o b j e c t   -   t h e   n e w   s e t t i n g s   t o   u p d a t e   o r  
 	                                       s t r i n g   -   t h e   n a m e   o f   t h e   s e t t i n g   t o   c h a n g e   o r   r e t r i e v e ,  
 	                                       w h e n   r e t r i e v i n g   a l s o   ' a l l '   f o r   a l l   i n s t a n c e   s e t t i n g s   o r  
 	                                       ' d e f a u l t s '   f o r   a l l   g l o b a l   d e f a u l t s  
 	       @ p a r a m     v a l u e       a n y   -   t h e   n e w   v a l u e   f o r   t h e   s e t t i n g  
 	                                       ( o m i t   i f   a b o v e   i s   a n   o b j e c t   o r   t o   r e t r i e v e   a   v a l u e )   * /  
 	 _ o p t i o n D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   n a m e ,   v a l u e )   {  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t ) ;  
 	 	 i f   ( a r g u m e n t s . l e n g t h   = =   2   & &   t y p e o f   n a m e   = =   ' s t r i n g ' )   {  
 	 	 	 r e t u r n   ( n a m e   = =   ' d e f a u l t s '   ?   $ . e x t e n d ( { } ,   $ . d a t e p i c k e r . _ d e f a u l t s )   :  
 	 	 	 	 ( i n s t   ?   ( n a m e   = =   ' a l l '   ?   $ . e x t e n d ( { } ,   i n s t . s e t t i n g s )   :  
 	 	 	 	 t h i s . _ g e t ( i n s t ,   n a m e ) )   :   n u l l ) ) ;  
 	 	 }  
 	 	 v a r   s e t t i n g s   =   n a m e   | |   { } ;  
 	 	 i f   ( t y p e o f   n a m e   = =   ' s t r i n g ' )   {  
 	 	 	 s e t t i n g s   =   { } ;  
 	 	 	 s e t t i n g s [ n a m e ]   =   v a l u e ;  
 	 	 }  
 	 	 i f   ( i n s t )   {  
 	 	 	 i f   ( t h i s . _ c u r I n s t   = =   i n s t )   {  
 	 	 	 	 t h i s . _ h i d e D a t e p i c k e r ( n u l l ) ;  
 	 	 	 }  
 	 	 	 v a r   d a t e   =   t h i s . _ g e t D a t e D a t e p i c k e r ( t a r g e t ) ;  
 	 	 	 e x t e n d R e m o v e ( i n s t . s e t t i n g s ,   s e t t i n g s ) ;  
 	 	 	 t h i s . _ s e t D a t e D a t e p i c k e r ( t a r g e t ,   d a t e ) ;  
 	 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 }  
 	 } ,  
  
 	 / /   c h a n g e   m e t h o d   d e p r e c a t e d  
 	 _ c h a n g e D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   n a m e ,   v a l u e )   {  
 	 	 t h i s . _ o p t i o n D a t e p i c k e r ( t a r g e t ,   n a m e ,   v a l u e ) ;  
 	 } ,  
  
 	 / *   R e d r a w   t h e   d a t e   p i c k e r   a t t a c h e d   t o   a n   i n p u t   f i e l d   o r   d i v i s i o n .  
 	       @ p a r a m     t a r g e t     e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n   * /  
 	 _ r e f r e s h D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t ) ;  
 	 	 i f   ( i n s t )   {  
 	 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   S e t   t h e   d a t e s   f o r   a   j Q u e r y   s e l e c t i o n .  
 	       @ p a r a m     t a r g e t       e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ p a r a m     d a t e           D a t e   -   t h e   n e w   d a t e  
 	       @ p a r a m     e n d D a t e     D a t e   -   t h e   n e w   e n d   d a t e   f o r   a   r a n g e   ( o p t i o n a l )   * /  
 	 _ s e t D a t e D a t e p i c k e r :   f u n c t i o n ( t a r g e t ,   d a t e ,   e n d D a t e )   {  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t ) ;  
 	 	 i f   ( i n s t )   {  
 	 	 	 t h i s . _ s e t D a t e ( i n s t ,   d a t e ,   e n d D a t e ) ;  
 	 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 	 t h i s . _ u p d a t e A l t e r n a t e ( i n s t ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   G e t   t h e   d a t e ( s )   f o r   t h e   f i r s t   e n t r y   i n   a   j Q u e r y   s e l e c t i o n .  
 	       @ p a r a m     t a r g e t     e l e m e n t   -   t h e   t a r g e t   i n p u t   f i e l d   o r   d i v i s i o n   o r   s p a n  
 	       @ r e t u r n   D a t e   -   t h e   c u r r e n t   d a t e   o r  
 	                       D a t e [ 2 ]   -   t h e   c u r r e n t   d a t e s   f o r   a   r a n g e   * /  
 	 _ g e t D a t e D a t e p i c k e r :   f u n c t i o n ( t a r g e t )   {  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t ) ;  
 	 	 i f   ( i n s t   & &   ! i n s t . i n l i n e )  
 	 	 	 t h i s . _ s e t D a t e F r o m F i e l d ( i n s t ) ;  
 	 	 r e t u r n   ( i n s t   ?   t h i s . _ g e t D a t e ( i n s t )   :   n u l l ) ;  
 	 } ,  
  
 	 / *   H a n d l e   k e y s t r o k e s .   * /  
 	 _ d o K e y D o w n :   f u n c t i o n ( e v e n t )   {  
 	 	 v a r   i n s t   =   $ . d a t e p i c k e r . _ g e t I n s t ( e v e n t . t a r g e t ) ;  
 	 	 v a r   h a n d l e d   =   t r u e ;  
 	 	 v a r   i s R T L   =   i n s t . d p D i v . i s ( ' . u i - d a t e p i c k e r - r t l ' ) ;  
 	 	 i n s t . _ k e y E v e n t   =   t r u e ;  
 	 	  
 	 	 i f   ( $ . d a t e p i c k e r . _ d a t e p i c k e r S h o w i n g )  
 	 	 	  
 	 	 	 s w i t c h   ( e v e n t . k e y C o d e )   {  
 	 	 	 	 c a s e   9 :     $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( n u l l ,   ' ' ) ;  
 	 	 	 	 	 	 b r e a k ;   / /   h i d e   o n   t a b   o u t  
 	 	 	 	 c a s e   1 3 :   v a r   s e l   =   $ ( ' t d . '   +   $ . d a t e p i c k e r . _ d a y O v e r C l a s s   +  
 	 	 	 	 	 	 	 ' ,   t d . '   +   $ . d a t e p i c k e r . _ c u r r e n t C l a s s ,   i n s t . d p D i v ) ;  
 	 	 	 	 	 	 i f   ( s e l [ 0 ] )  
 	 	 	 	 	 	 	 $ . d a t e p i c k e r . _ s e l e c t D a y ( e v e n t . t a r g e t ,   i n s t . s e l e c t e d M o n t h ,   i n s t . s e l e c t e d Y e a r ,   s e l [ 0 ] ) ;  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( n u l l ,   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' d u r a t i o n ' ) ) ;  
 	 	 	 	 	 	 r e t u r n   f a l s e ;   / /   d o n ' t   s u b m i t   t h e   f o r m  
 	 	 	 	 	 	 b r e a k ;   / /   s e l e c t   t h e   v a l u e   o n   e n t e r  
 	 	 	 	 c a s e   2 7 :   $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( n u l l ,   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' d u r a t i o n ' ) ) ;  
 	 	 	 	 	 	 b r e a k ;   / /   h i d e   o n   e s c a p e  
 	 	 	 	 c a s e   3 3 :   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( e v e n t . c t r l K e y   ?  
 	 	 	 	 	 	 	 - $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p B i g M o n t h s ' )   :  
 	 	 	 	 	 	 	 - $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p M o n t h s ' ) ) ,   ' M ' ) ;  
 	 	 	 	 	 	 b r e a k ;   / /   p r e v i o u s   m o n t h / y e a r   o n   p a g e   u p / +   c t r l  
 	 	 	 	 c a s e   3 4 :   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( e v e n t . c t r l K e y   ?  
 	 	 	 	 	 	 	 + $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p B i g M o n t h s ' )   :  
 	 	 	 	 	 	 	 + $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p M o n t h s ' ) ) ,   ' M ' ) ;  
 	 	 	 	 	 	 b r e a k ;   / /   n e x t   m o n t h / y e a r   o n   p a g e   d o w n / +   c t r l  
 	 	 	 	 c a s e   3 5 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ c l e a r D a t e ( e v e n t . t a r g e t ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 b r e a k ;   / /   c l e a r   o n   c t r l   o r   c o m m a n d   + e n d  
 	 	 	 	 c a s e   3 6 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ g o t o T o d a y ( e v e n t . t a r g e t ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 b r e a k ;   / /   c u r r e n t   o n   c t r l   o r   c o m m a n d   + h o m e  
 	 	 	 	 c a s e   3 7 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( i s R T L   ?   + 1   :   - 1 ) ,   ' D ' ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 / /   - 1   d a y   o n   c t r l   o r   c o m m a n d   + l e f t  
 	 	 	 	 	 	 i f   ( e v e n t . o r i g i n a l E v e n t . a l t K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( e v e n t . c t r l K e y   ?  
 	 	 	 	 	 	 	 	 	 - $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p B i g M o n t h s ' )   :  
 	 	 	 	 	 	 	 	 	 - $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p M o n t h s ' ) ) ,   ' M ' ) ;  
 	 	 	 	 	 	 / /   n e x t   m o n t h / y e a r   o n   a l t   + l e f t   o n   M a c  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 c a s e   3 8 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   - 7 ,   ' D ' ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 b r e a k ;   / /   - 1   w e e k   o n   c t r l   o r   c o m m a n d   + u p  
 	 	 	 	 c a s e   3 9 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( i s R T L   ?   - 1   :   + 1 ) ,   ' D ' ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 / /   + 1   d a y   o n   c t r l   o r   c o m m a n d   + r i g h t  
 	 	 	 	 	 	 i f   ( e v e n t . o r i g i n a l E v e n t . a l t K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   ( e v e n t . c t r l K e y   ?  
 	 	 	 	 	 	 	 	 	 + $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p B i g M o n t h s ' )   :  
 	 	 	 	 	 	 	 	 	 + $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s t e p M o n t h s ' ) ) ,   ' M ' ) ;  
 	 	 	 	 	 	 / /   n e x t   m o n t h / y e a r   o n   a l t   + r i g h t  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 c a s e   4 0 :   i f   ( e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y )   $ . d a t e p i c k e r . _ a d j u s t D a t e ( e v e n t . t a r g e t ,   + 7 ,   ' D ' ) ;  
 	 	 	 	 	 	 h a n d l e d   =   e v e n t . c t r l K e y   | |   e v e n t . m e t a K e y ;  
 	 	 	 	 	 	 b r e a k ;   / /   + 1   w e e k   o n   c t r l   o r   c o m m a n d   + d o w n  
 	 	 	 	 d e f a u l t :   h a n d l e d   =   f a l s e ;  
 	 	 	 }  
 	 	 e l s e   i f   ( e v e n t . k e y C o d e   = =   3 6   & &   e v e n t . c t r l K e y )   / /   d i s p l a y   t h e   d a t e   p i c k e r   o n   c t r l + h o m e  
 	 	 	 $ . d a t e p i c k e r . _ s h o w D a t e p i c k e r ( t h i s ) ;  
 	 	 e l s e   {  
 	 	 	 h a n d l e d   =   f a l s e ;  
 	 	 }  
 	 	 i f   ( h a n d l e d )   {  
 	 	 	 e v e n t . p r e v e n t D e f a u l t ( ) ;  
 	 	 	 e v e n t . s t o p P r o p a g a t i o n ( ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   F i l t e r   e n t e r e d   c h a r a c t e r s   -   b a s e d   o n   d a t e   f o r m a t .   * /  
 	 _ d o K e y P r e s s :   f u n c t i o n ( e v e n t )   {  
 	 	 v a r   i n s t   =   $ . d a t e p i c k e r . _ g e t I n s t ( e v e n t . t a r g e t ) ;  
 	 	 i f   ( $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' c o n s t r a i n I n p u t ' ) )   {  
 	 	 	 v a r   c h a r s   =   $ . d a t e p i c k e r . _ p o s s i b l e C h a r s ( $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' d a t e F o r m a t ' ) ) ;  
 	 	 	 v a r   c h r   =   S t r i n g . f r o m C h a r C o d e ( e v e n t . c h a r C o d e   = =   u n d e f i n e d   ?   e v e n t . k e y C o d e   :   e v e n t . c h a r C o d e ) ;  
 	 	 	 r e t u r n   e v e n t . c t r l K e y   | |   ( c h r   <   '   '   | |   ! c h a r s   | |   c h a r s . i n d e x O f ( c h r )   >   - 1 ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   P o p - u p   t h e   d a t e   p i c k e r   f o r   a   g i v e n   i n p u t   f i e l d .  
 	       @ p a r a m     i n p u t     e l e m e n t   -   t h e   i n p u t   f i e l d   a t t a c h e d   t o   t h e   d a t e   p i c k e r   o r  
 	                                     e v e n t   -   i f   t r i g g e r e d   b y   f o c u s   * /  
 	 _ s h o w D a t e p i c k e r :   f u n c t i o n ( i n p u t )   {  
 	 	 i n p u t   =   i n p u t . t a r g e t   | |   i n p u t ;  
 	 	 i f   ( i n p u t . n o d e N a m e . t o L o w e r C a s e ( )   ! =   ' i n p u t ' )   / /   f i n d   f r o m   b u t t o n / i m a g e   t r i g g e r  
 	 	 	 i n p u t   =   $ ( ' i n p u t ' ,   i n p u t . p a r e n t N o d e ) [ 0 ] ;  
 	 	 i f   ( $ . d a t e p i c k e r . _ i s D i s a b l e d D a t e p i c k e r ( i n p u t )   | |   $ . d a t e p i c k e r . _ l a s t I n p u t   = =   i n p u t )   / /   a l r e a d y   h e r e  
 	 	 	 r e t u r n ;  
 	 	 v a r   i n s t   =   $ . d a t e p i c k e r . _ g e t I n s t ( i n p u t ) ;  
 	 	 v a r   b e f o r e S h o w   =   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' b e f o r e S h o w ' ) ;  
 	 	 e x t e n d R e m o v e ( i n s t . s e t t i n g s ,   ( b e f o r e S h o w   ?   b e f o r e S h o w . a p p l y ( i n p u t ,   [ i n p u t ,   i n s t ] )   :   { } ) ) ;  
 	 	 $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( n u l l ,   ' ' ) ;  
 	 	 $ . d a t e p i c k e r . _ l a s t I n p u t   =   i n p u t ;  
 	 	 $ . d a t e p i c k e r . _ s e t D a t e F r o m F i e l d ( i n s t ) ;  
 	 	 i f   ( $ . d a t e p i c k e r . _ i n D i a l o g )   / /   h i d e   c u r s o r  
 	 	 	 i n p u t . v a l u e   =   ' ' ;  
 	 	 i f   ( ! $ . d a t e p i c k e r . _ p o s )   {   / /   p o s i t i o n   b e l o w   i n p u t  
 	 	 	 $ . d a t e p i c k e r . _ p o s   =   $ . d a t e p i c k e r . _ f i n d P o s ( i n p u t ) ;  
 	 	 	 $ . d a t e p i c k e r . _ p o s [ 1 ]   + =   i n p u t . o f f s e t H e i g h t ;   / /   a d d   t h e   h e i g h t  
 	 	 }  
 	 	 v a r   i s F i x e d   =   f a l s e ;  
 	 	 $ ( i n p u t ) . p a r e n t s ( ) . e a c h ( f u n c t i o n ( )   {  
 	 	 	 i s F i x e d   | =   $ ( t h i s ) . c s s ( ' p o s i t i o n ' )   = =   ' f i x e d ' ;  
 	 	 	 r e t u r n   ! i s F i x e d ;  
 	 	 } ) ;  
 	 	 i f   ( i s F i x e d   & &   $ . b r o w s e r . o p e r a )   {   / /   c o r r e c t i o n   f o r   O p e r a   w h e n   f i x e d   a n d   s c r o l l e d  
 	 	 	 $ . d a t e p i c k e r . _ p o s [ 0 ]   - =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t ;  
 	 	 	 $ . d a t e p i c k e r . _ p o s [ 1 ]   - =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p ;  
 	 	 }  
 	 	 v a r   o f f s e t   =   { l e f t :   $ . d a t e p i c k e r . _ p o s [ 0 ] ,   t o p :   $ . d a t e p i c k e r . _ p o s [ 1 ] } ;  
 	 	 $ . d a t e p i c k e r . _ p o s   =   n u l l ;  
 	 	 i n s t . r a n g e S t a r t   =   n u l l ;  
 	 	 / /   d e t e r m i n e   s i z i n g   o f f s c r e e n  
 	 	 i n s t . d p D i v . c s s ( { p o s i t i o n :   ' a b s o l u t e ' ,   d i s p l a y :   ' b l o c k ' ,   t o p :   ' - 1 0 0 0 p x ' } ) ;  
 	 	 $ . d a t e p i c k e r . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 / /   f i x   w i d t h   f o r   d y n a m i c   n u m b e r   o f   d a t e   p i c k e r s  
 	 	 / /   a n d   a d j u s t   p o s i t i o n   b e f o r e   s h o w i n g  
 	 	 o f f s e t   =   $ . d a t e p i c k e r . _ c h e c k O f f s e t ( i n s t ,   o f f s e t ,   i s F i x e d ) ;  
 	 	 i n s t . d p D i v . c s s ( { p o s i t i o n :   ( $ . d a t e p i c k e r . _ i n D i a l o g   & &   $ . b l o c k U I   ?  
 	 	 	 ' s t a t i c '   :   ( i s F i x e d   ?   ' f i x e d '   :   ' a b s o l u t e ' ) ) ,   d i s p l a y :   ' n o n e ' ,  
 	 	 	 l e f t :   o f f s e t . l e f t   +   ' p x ' ,   t o p :   o f f s e t . t o p   +   ' p x ' } ) ;  
 	 	 i f   ( ! i n s t . i n l i n e )   {  
 	 	 	 v a r   s h o w A n i m   =   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s h o w A n i m ' )   | |   ' s h o w ' ;  
 	 	 	 v a r   d u r a t i o n   =   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' d u r a t i o n ' ) ;  
 	 	 	 v a r   p o s t P r o c e s s   =   f u n c t i o n ( )   {  
 	 	 	 	 $ . d a t e p i c k e r . _ d a t e p i c k e r S h o w i n g   =   t r u e ;  
 	 	 	 	 i f   ( $ . b r o w s e r . m s i e   & &   p a r s e I n t ( $ . b r o w s e r . v e r s i o n , 1 0 )   <   7 )   / /   f i x   I E   <   7   s e l e c t   p r o b l e m s  
 	 	 	 	 	 $ ( ' i f r a m e . u i - d a t e p i c k e r - c o v e r ' ) . c s s ( { w i d t h :   i n s t . d p D i v . w i d t h ( )   +   4 ,  
 	 	 	 	 	 	 h e i g h t :   i n s t . d p D i v . h e i g h t ( )   +   4 } ) ;  
 	 	 	 } ;  
 	 	 	 i f   ( $ . e f f e c t s   & &   $ . e f f e c t s [ s h o w A n i m ] )  
 	 	 	 	 i n s t . d p D i v . s h o w ( s h o w A n i m ,   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s h o w O p t i o n s ' ) ,   d u r a t i o n ,   p o s t P r o c e s s ) ;  
 	 	 	 e l s e  
 	 	 	 	 i n s t . d p D i v [ s h o w A n i m ] ( d u r a t i o n ,   p o s t P r o c e s s ) ;  
 	 	 	 i f   ( d u r a t i o n   = =   ' ' )  
 	 	 	 	 p o s t P r o c e s s ( ) ;  
 	 	 	 i f   ( i n s t . i n p u t [ 0 ] . t y p e   ! =   ' h i d d e n ' )  
 	 	 	 	 i n s t . i n p u t [ 0 ] . f o c u s ( ) ;  
 	 	 	 $ . d a t e p i c k e r . _ c u r I n s t   =   i n s t ;  
 	 	 }  
 	 } ,  
  
 	 / *   G e n e r a t e   t h e   d a t e   p i c k e r   c o n t e n t .   * /  
 	 _ u p d a t e D a t e p i c k e r :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   d i m s   =   { w i d t h :   i n s t . d p D i v . w i d t h ( )   +   4 ,  
 	 	 	 h e i g h t :   i n s t . d p D i v . h e i g h t ( )   +   4 } ;  
 	 	 v a r   s e l f   =   t h i s ;  
 	 	 i n s t . d p D i v . e m p t y ( ) . a p p e n d ( t h i s . _ g e n e r a t e H T M L ( i n s t ) )  
 	 	 	 . f i n d ( ' i f r a m e . u i - d a t e p i c k e r - c o v e r ' ) .  
 	 	 	 	 c s s ( { w i d t h :   d i m s . w i d t h ,   h e i g h t :   d i m s . h e i g h t } )  
 	 	 	 . e n d ( )  
 	 	 	 . f i n d ( ' b u t t o n ,   . u i - d a t e p i c k e r - p r e v ,   . u i - d a t e p i c k e r - n e x t ,   . u i - d a t e p i c k e r - c a l e n d a r   t d   a ' )  
 	 	 	 	 . b i n d ( ' m o u s e o u t ' ,   f u n c t i o n ( ) {  
 	 	 	 	 	 $ ( t h i s ) . r e m o v e C l a s s ( ' u i - s t a t e - h o v e r ' ) ;  
 	 	 	 	 	 i f ( t h i s . c l a s s N a m e . i n d e x O f ( ' u i - d a t e p i c k e r - p r e v ' )   ! =   - 1 )   $ ( t h i s ) . r e m o v e C l a s s ( ' u i - d a t e p i c k e r - p r e v - h o v e r ' ) ;  
 	 	 	 	 	 i f ( t h i s . c l a s s N a m e . i n d e x O f ( ' u i - d a t e p i c k e r - n e x t ' )   ! =   - 1 )   $ ( t h i s ) . r e m o v e C l a s s ( ' u i - d a t e p i c k e r - n e x t - h o v e r ' ) ;  
 	 	 	 	 } )  
 	 	 	 	 . b i n d ( ' m o u s e o v e r ' ,   f u n c t i o n ( ) {  
 	 	 	 	 	 i f   ( ! s e l f . _ i s D i s a b l e d D a t e p i c k e r (   i n s t . i n l i n e   ?   i n s t . d p D i v . p a r e n t ( ) [ 0 ]   :   i n s t . i n p u t [ 0 ] ) )   {  
 	 	 	 	 	 	 $ ( t h i s ) . p a r e n t s ( ' . u i - d a t e p i c k e r - c a l e n d a r ' ) . f i n d ( ' a ' ) . r e m o v e C l a s s ( ' u i - s t a t e - h o v e r ' ) ;  
 	 	 	 	 	 	 $ ( t h i s ) . a d d C l a s s ( ' u i - s t a t e - h o v e r ' ) ;  
 	 	 	 	 	 	 i f ( t h i s . c l a s s N a m e . i n d e x O f ( ' u i - d a t e p i c k e r - p r e v ' )   ! =   - 1 )   $ ( t h i s ) . a d d C l a s s ( ' u i - d a t e p i c k e r - p r e v - h o v e r ' ) ;  
 	 	 	 	 	 	 i f ( t h i s . c l a s s N a m e . i n d e x O f ( ' u i - d a t e p i c k e r - n e x t ' )   ! =   - 1 )   $ ( t h i s ) . a d d C l a s s ( ' u i - d a t e p i c k e r - n e x t - h o v e r ' ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } )  
 	 	 	 . e n d ( )  
 	 	 	 . f i n d ( ' . '   +   t h i s . _ d a y O v e r C l a s s   +   '   a ' )  
 	 	 	 	 . t r i g g e r ( ' m o u s e o v e r ' )  
 	 	 	 . e n d ( ) ;  
 	 	 v a r   n u m M o n t h s   =   t h i s . _ g e t N u m b e r O f M o n t h s ( i n s t ) ;  
 	 	 v a r   c o l s   =   n u m M o n t h s [ 1 ] ;  
 	 	 v a r   w i d t h   =   1 7 ;  
 	 	 i f   ( c o l s   >   1 )   {  
 	 	 	 i n s t . d p D i v . a d d C l a s s ( ' u i - d a t e p i c k e r - m u l t i - '   +   c o l s ) . c s s ( ' w i d t h ' ,   ( w i d t h   *   c o l s )   +   ' e m ' ) ;  
 	 	 }   e l s e   {  
 	 	 	 i n s t . d p D i v . r e m o v e C l a s s ( ' u i - d a t e p i c k e r - m u l t i - 2   u i - d a t e p i c k e r - m u l t i - 3   u i - d a t e p i c k e r - m u l t i - 4 ' ) . w i d t h ( ' ' ) ;  
 	 	 }  
 	 	 i n s t . d p D i v [ ( n u m M o n t h s [ 0 ]   ! =   1   | |   n u m M o n t h s [ 1 ]   ! =   1   ?   ' a d d '   :   ' r e m o v e ' )   +  
 	 	 	 ' C l a s s ' ] ( ' u i - d a t e p i c k e r - m u l t i ' ) ;  
 	 	 i n s t . d p D i v [ ( t h i s . _ g e t ( i n s t ,   ' i s R T L ' )   ?   ' a d d '   :   ' r e m o v e ' )   +  
 	 	 	 ' C l a s s ' ] ( ' u i - d a t e p i c k e r - r t l ' ) ;  
 	 	 i f   ( i n s t . i n p u t   & &   i n s t . i n p u t [ 0 ] . t y p e   ! =   ' h i d d e n '   & &   i n s t   = =   $ . d a t e p i c k e r . _ c u r I n s t )  
 	 	 	 $ ( i n s t . i n p u t [ 0 ] ) . f o c u s ( ) ;  
 	 } ,  
  
 	 / *   C h e c k   p o s i t i o n i n g   t o   r e m a i n   o n   s c r e e n .   * /  
 	 _ c h e c k O f f s e t :   f u n c t i o n ( i n s t ,   o f f s e t ,   i s F i x e d )   {  
 	 	 v a r   d p W i d t h   =   i n s t . d p D i v . o u t e r W i d t h ( ) ;  
 	 	 v a r   d p H e i g h t   =   i n s t . d p D i v . o u t e r H e i g h t ( ) ;  
 	 	 v a r   i n p u t W i d t h   =   i n s t . i n p u t   ?   i n s t . i n p u t . o u t e r W i d t h ( )   :   0 ;  
 	 	 v a r   i n p u t H e i g h t   =   i n s t . i n p u t   ?   i n s t . i n p u t . o u t e r H e i g h t ( )   :   0 ;  
 	 	 v a r   v i e w W i d t h   =   ( w i n d o w . i n n e r W i d t h   | |   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t W i d t h   | |   d o c u m e n t . b o d y . c l i e n t W i d t h )   +   $ ( d o c u m e n t ) . s c r o l l L e f t ( ) ;  
 	 	 v a r   v i e w H e i g h t   =   ( w i n d o w . i n n e r H e i g h t   | |   d o c u m e n t . d o c u m e n t E l e m e n t . c l i e n t H e i g h t   | |   d o c u m e n t . b o d y . c l i e n t H e i g h t )   +   $ ( d o c u m e n t ) . s c r o l l T o p ( ) ;  
  
 	 	 o f f s e t . l e f t   - =   ( t h i s . _ g e t ( i n s t ,   ' i s R T L ' )   ?   ( d p W i d t h   -   i n p u t W i d t h )   :   0 ) ;  
 	 	 o f f s e t . l e f t   - =   ( i s F i x e d   & &   o f f s e t . l e f t   = =   i n s t . i n p u t . o f f s e t ( ) . l e f t )   ?   $ ( d o c u m e n t ) . s c r o l l L e f t ( )   :   0 ;  
 	 	 o f f s e t . t o p   - =   ( i s F i x e d   & &   o f f s e t . t o p   = =   ( i n s t . i n p u t . o f f s e t ( ) . t o p   +   i n p u t H e i g h t ) )   ?   $ ( d o c u m e n t ) . s c r o l l T o p ( )   :   0 ;  
  
 	 	 / /   n o w   c h e c k   i f   d a t e p i c k e r   i s   s h o w i n g   o u t s i d e   w i n d o w   v i e w p o r t   -   m o v e   t o   a   b e t t e r   p l a c e   i f   s o .  
 	 	 o f f s e t . l e f t   - =   ( o f f s e t . l e f t   +   d p W i d t h   >   v i e w W i d t h   & &   v i e w W i d t h   >   d p W i d t h )   ?   M a t h . a b s ( o f f s e t . l e f t   +   d p W i d t h   -   v i e w W i d t h )   :   0 ;  
 	 	 o f f s e t . t o p   - =   ( o f f s e t . t o p   +   d p H e i g h t   >   v i e w H e i g h t   & &   v i e w H e i g h t   >   d p H e i g h t )   ?   M a t h . a b s ( o f f s e t . t o p   +   d p H e i g h t   +   i n p u t H e i g h t * 2   -   v i e w H e i g h t )   :   0 ;  
  
 	 	 r e t u r n   o f f s e t ;  
 	 } ,  
  
 	 / *   F i n d   a n   o b j e c t ' s   p o s i t i o n   o n   t h e   s c r e e n .   * /  
 	 _ f i n d P o s :   f u n c t i o n ( o b j )   {  
                 w h i l e   ( o b j   & &   ( o b j . t y p e   = =   ' h i d d e n '   | |   o b j . n o d e T y p e   ! =   1 ) )   {  
                         o b j   =   o b j . n e x t S i b l i n g ;  
                 }  
                 v a r   p o s i t i o n   =   $ ( o b j ) . o f f s e t ( ) ;  
 	         r e t u r n   [ p o s i t i o n . l e f t ,   p o s i t i o n . t o p ] ;  
 	 } ,  
  
 	 / *   H i d e   t h e   d a t e   p i c k e r   f r o m   v i e w .  
 	       @ p a r a m     i n p u t     e l e m e n t   -   t h e   i n p u t   f i e l d   a t t a c h e d   t o   t h e   d a t e   p i c k e r  
 	       @ p a r a m     d u r a t i o n     s t r i n g   -   t h e   d u r a t i o n   o v e r   w h i c h   t o   c l o s e   t h e   d a t e   p i c k e r   * /  
 	 _ h i d e D a t e p i c k e r :   f u n c t i o n ( i n p u t ,   d u r a t i o n )   {  
 	 	 v a r   i n s t   =   t h i s . _ c u r I n s t ;  
 	 	 i f   ( ! i n s t   | |   ( i n p u t   & &   i n s t   ! =   $ . d a t a ( i n p u t ,   P R O P _ N A M E ) ) )  
 	 	 	 r e t u r n ;  
 	 	 i f   ( i n s t . s t a y O p e n )  
 	 	 	 t h i s . _ s e l e c t D a t e ( ' # '   +   i n s t . i d ,   t h i s . _ f o r m a t D a t e ( i n s t ,  
 	 	 	 	 i n s t . c u r r e n t D a y ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t Y e a r ) ) ;  
 	 	 i n s t . s t a y O p e n   =   f a l s e ;  
 	 	 i f   ( t h i s . _ d a t e p i c k e r S h o w i n g )   {  
 	 	 	 d u r a t i o n   =   ( d u r a t i o n   ! =   n u l l   ?   d u r a t i o n   :   t h i s . _ g e t ( i n s t ,   ' d u r a t i o n ' ) ) ;  
 	 	 	 v a r   s h o w A n i m   =   t h i s . _ g e t ( i n s t ,   ' s h o w A n i m ' ) ;  
 	 	 	 v a r   p o s t P r o c e s s   =   f u n c t i o n ( )   {  
 	 	 	 	 $ . d a t e p i c k e r . _ t i d y D i a l o g ( i n s t ) ;  
 	 	 	 } ;  
 	 	 	 i f   ( d u r a t i o n   ! =   ' '   & &   $ . e f f e c t s   & &   $ . e f f e c t s [ s h o w A n i m ] )  
 	 	 	 	 i n s t . d p D i v . h i d e ( s h o w A n i m ,   $ . d a t e p i c k e r . _ g e t ( i n s t ,   ' s h o w O p t i o n s ' ) ,  
 	 	 	 	 	 d u r a t i o n ,   p o s t P r o c e s s ) ;  
 	 	 	 e l s e  
 	 	 	 	 i n s t . d p D i v [ ( d u r a t i o n   = =   ' '   ?   ' h i d e '   :   ( s h o w A n i m   = =   ' s l i d e D o w n '   ?   ' s l i d e U p '   :  
 	 	 	 	 	 ( s h o w A n i m   = =   ' f a d e I n '   ?   ' f a d e O u t '   :   ' h i d e ' ) ) ) ] ( d u r a t i o n ,   p o s t P r o c e s s ) ;  
 	 	 	 i f   ( d u r a t i o n   = =   ' ' )  
 	 	 	 	 t h i s . _ t i d y D i a l o g ( i n s t ) ;  
 	 	 	 v a r   o n C l o s e   =   t h i s . _ g e t ( i n s t ,   ' o n C l o s e ' ) ;  
 	 	 	 i f   ( o n C l o s e )  
 	 	 	 	 o n C l o s e . a p p l y ( ( i n s t . i n p u t   ?   i n s t . i n p u t [ 0 ]   :   n u l l ) ,  
 	 	 	 	 	 [ ( i n s t . i n p u t   ?   i n s t . i n p u t . v a l ( )   :   ' ' ) ,   i n s t ] ) ;     / /   t r i g g e r   c u s t o m   c a l l b a c k  
 	 	 	 t h i s . _ d a t e p i c k e r S h o w i n g   =   f a l s e ;  
 	 	 	 t h i s . _ l a s t I n p u t   =   n u l l ;  
 	 	 	 i f   ( t h i s . _ i n D i a l o g )   {  
 	 	 	 	 t h i s . _ d i a l o g I n p u t . c s s ( {   p o s i t i o n :   ' a b s o l u t e ' ,   l e f t :   ' 0 ' ,   t o p :   ' - 1 0 0 p x '   } ) ;  
 	 	 	 	 i f   ( $ . b l o c k U I )   {  
 	 	 	 	 	 $ . u n b l o c k U I ( ) ;  
 	 	 	 	 	 $ ( ' b o d y ' ) . a p p e n d ( t h i s . d p D i v ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 t h i s . _ i n D i a l o g   =   f a l s e ;  
 	 	 }  
 	 	 t h i s . _ c u r I n s t   =   n u l l ;  
 	 } ,  
  
 	 / *   T i d y   u p   a f t e r   a   d i a l o g   d i s p l a y .   * /  
 	 _ t i d y D i a l o g :   f u n c t i o n ( i n s t )   {  
 	 	 i n s t . d p D i v . r e m o v e C l a s s ( t h i s . _ d i a l o g C l a s s ) . u n b i n d ( ' . u i - d a t e p i c k e r - c a l e n d a r ' ) ;  
 	 } ,  
  
 	 / *   C l o s e   d a t e   p i c k e r   i f   c l i c k e d   e l s e w h e r e .   * /  
 	 _ c h e c k E x t e r n a l C l i c k :   f u n c t i o n ( e v e n t )   {  
 	 	 i f   ( ! $ . d a t e p i c k e r . _ c u r I n s t )  
 	 	 	 r e t u r n ;  
 	 	 v a r   $ t a r g e t   =   $ ( e v e n t . t a r g e t ) ;  
 	 	 i f   ( ( $ t a r g e t . p a r e n t s ( ' # '   +   $ . d a t e p i c k e r . _ m a i n D i v I d ) . l e n g t h   = =   0 )   & &  
 	 	 	 	 ! $ t a r g e t . h a s C l a s s ( $ . d a t e p i c k e r . m a r k e r C l a s s N a m e )   & &  
 	 	 	 	 ! $ t a r g e t . h a s C l a s s ( $ . d a t e p i c k e r . _ t r i g g e r C l a s s )   & &  
 	 	 	 	 $ . d a t e p i c k e r . _ d a t e p i c k e r S h o w i n g   & &   ! ( $ . d a t e p i c k e r . _ i n D i a l o g   & &   $ . b l o c k U I ) )  
 	 	 	 $ . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( n u l l ,   ' ' ) ;  
 	 } ,  
  
 	 / *   A d j u s t   o n e   o f   t h e   d a t e   s u b - f i e l d s .   * /  
 	 _ a d j u s t D a t e :   f u n c t i o n ( i d ,   o f f s e t ,   p e r i o d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i f   ( t h i s . _ i s D i s a b l e d D a t e p i c k e r ( t a r g e t [ 0 ] ) )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 t h i s . _ a d j u s t I n s t D a t e ( i n s t ,   o f f s e t   +  
 	 	 	 ( p e r i o d   = =   ' M '   ?   t h i s . _ g e t ( i n s t ,   ' s h o w C u r r e n t A t P o s ' )   :   0 ) ,   / /   u n d o   p o s i t i o n i n g  
 	 	 	 p e r i o d ) ;  
 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 } ,  
  
 	 / *   A c t i o n   f o r   c u r r e n t   l i n k .   * /  
 	 _ g o t o T o d a y :   f u n c t i o n ( i d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i f   ( t h i s . _ g e t ( i n s t ,   ' g o t o C u r r e n t ' )   & &   i n s t . c u r r e n t D a y )   {  
 	 	 	 i n s t . s e l e c t e d D a y   =   i n s t . c u r r e n t D a y ;  
 	 	 	 i n s t . d r a w M o n t h   =   i n s t . s e l e c t e d M o n t h   =   i n s t . c u r r e n t M o n t h ;  
 	 	 	 i n s t . d r a w Y e a r   =   i n s t . s e l e c t e d Y e a r   =   i n s t . c u r r e n t Y e a r ;  
 	 	 }  
 	 	 e l s e   {  
 	 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 	 i n s t . s e l e c t e d D a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 i n s t . d r a w M o n t h   =   i n s t . s e l e c t e d M o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 i n s t . d r a w Y e a r   =   i n s t . s e l e c t e d Y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 }  
 	 	 t h i s . _ n o t i f y C h a n g e ( i n s t ) ;  
 	 	 t h i s . _ a d j u s t D a t e ( t a r g e t ) ;  
 	 } ,  
  
 	 / *   A c t i o n   f o r   s e l e c t i n g   a   n e w   m o n t h / y e a r .   * /  
 	 _ s e l e c t M o n t h Y e a r :   f u n c t i o n ( i d ,   s e l e c t ,   p e r i o d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i n s t . _ s e l e c t i n g M o n t h Y e a r   =   f a l s e ;  
 	 	 i n s t [ ' s e l e c t e d '   +   ( p e r i o d   = =   ' M '   ?   ' M o n t h '   :   ' Y e a r ' ) ]   =  
 	 	 i n s t [ ' d r a w '   +   ( p e r i o d   = =   ' M '   ?   ' M o n t h '   :   ' Y e a r ' ) ]   =  
 	 	 	 p a r s e I n t ( s e l e c t . o p t i o n s [ s e l e c t . s e l e c t e d I n d e x ] . v a l u e , 1 0 ) ;  
 	 	 t h i s . _ n o t i f y C h a n g e ( i n s t ) ;  
 	 	 t h i s . _ a d j u s t D a t e ( t a r g e t ) ;  
 	 } ,  
  
 	 / *   R e s t o r e   i n p u t   f o c u s   a f t e r   n o t   c h a n g i n g   m o n t h / y e a r .   * /  
 	 _ c l i c k M o n t h Y e a r :   f u n c t i o n ( i d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i f   ( i n s t . i n p u t   & &   i n s t . _ s e l e c t i n g M o n t h Y e a r   & &   ! $ . b r o w s e r . m s i e )  
 	 	 	 i n s t . i n p u t [ 0 ] . f o c u s ( ) ;  
 	 	 i n s t . _ s e l e c t i n g M o n t h Y e a r   =   ! i n s t . _ s e l e c t i n g M o n t h Y e a r ;  
 	 } ,  
  
 	 / *   A c t i o n   f o r   s e l e c t i n g   a   d a y .   * /  
 	 _ s e l e c t D a y :   f u n c t i o n ( i d ,   m o n t h ,   y e a r ,   t d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 i f   ( $ ( t d ) . h a s C l a s s ( t h i s . _ u n s e l e c t a b l e C l a s s )   | |   t h i s . _ i s D i s a b l e d D a t e p i c k e r ( t a r g e t [ 0 ] ) )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i n s t . s e l e c t e d D a y   =   i n s t . c u r r e n t D a y   =   $ ( ' a ' ,   t d ) . h t m l ( ) ;  
 	 	 i n s t . s e l e c t e d M o n t h   =   i n s t . c u r r e n t M o n t h   =   m o n t h ;  
 	 	 i n s t . s e l e c t e d Y e a r   =   i n s t . c u r r e n t Y e a r   =   y e a r ;  
 	 	 i f   ( i n s t . s t a y O p e n )   {  
 	 	 	 i n s t . e n d D a y   =   i n s t . e n d M o n t h   =   i n s t . e n d Y e a r   =   n u l l ;  
 	 	 }  
 	 	 t h i s . _ s e l e c t D a t e ( i d ,   t h i s . _ f o r m a t D a t e ( i n s t ,  
 	 	 	 i n s t . c u r r e n t D a y ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t Y e a r ) ) ;  
 	 	 i f   ( i n s t . s t a y O p e n )   {  
 	 	 	 i n s t . r a n g e S t a r t   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t (  
 	 	 	 	 n e w   D a t e ( i n s t . c u r r e n t Y e a r ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t D a y ) ) ;  
 	 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   E r a s e   t h e   i n p u t   f i e l d   a n d   h i d e   t h e   d a t e   p i c k e r .   * /  
 	 _ c l e a r D a t e :   f u n c t i o n ( i d )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 i n s t . s t a y O p e n   =   f a l s e ;  
 	 	 i n s t . e n d D a y   =   i n s t . e n d M o n t h   =   i n s t . e n d Y e a r   =   i n s t . r a n g e S t a r t   =   n u l l ;  
 	 	 t h i s . _ s e l e c t D a t e ( t a r g e t ,   ' ' ) ;  
 	 } ,  
  
 	 / *   U p d a t e   t h e   i n p u t   f i e l d   w i t h   t h e   s e l e c t e d   d a t e .   * /  
 	 _ s e l e c t D a t e :   f u n c t i o n ( i d ,   d a t e S t r )   {  
 	 	 v a r   t a r g e t   =   $ ( i d ) ;  
 	 	 v a r   i n s t   =   t h i s . _ g e t I n s t ( t a r g e t [ 0 ] ) ;  
 	 	 d a t e S t r   =   ( d a t e S t r   ! =   n u l l   ?   d a t e S t r   :   t h i s . _ f o r m a t D a t e ( i n s t ) ) ;  
 	 	 i f   ( i n s t . i n p u t )  
 	 	 	 i n s t . i n p u t . v a l ( d a t e S t r ) ;  
 	 	 t h i s . _ u p d a t e A l t e r n a t e ( i n s t ) ;  
 	 	 v a r   o n S e l e c t   =   t h i s . _ g e t ( i n s t ,   ' o n S e l e c t ' ) ;  
 	 	 i f   ( o n S e l e c t )  
 	 	 	 o n S e l e c t . a p p l y ( ( i n s t . i n p u t   ?   i n s t . i n p u t [ 0 ]   :   n u l l ) ,   [ d a t e S t r ,   i n s t ] ) ;     / /   t r i g g e r   c u s t o m   c a l l b a c k  
 	 	 e l s e   i f   ( i n s t . i n p u t )  
 	 	 	 i n s t . i n p u t . t r i g g e r ( ' c h a n g e ' ) ;   / /   f i r e   t h e   c h a n g e   e v e n t  
 	 	 i f   ( i n s t . i n l i n e )  
 	 	 	 t h i s . _ u p d a t e D a t e p i c k e r ( i n s t ) ;  
 	 	 e l s e   i f   ( ! i n s t . s t a y O p e n )   {  
 	 	 	 t h i s . _ h i d e D a t e p i c k e r ( n u l l ,   t h i s . _ g e t ( i n s t ,   ' d u r a t i o n ' ) ) ;  
 	 	 	 t h i s . _ l a s t I n p u t   =   i n s t . i n p u t [ 0 ] ;  
 	 	 	 i f   ( t y p e o f ( i n s t . i n p u t [ 0 ] )   ! =   ' o b j e c t ' )  
 	 	 	 	 i n s t . i n p u t [ 0 ] . f o c u s ( ) ;   / /   r e s t o r e   f o c u s  
 	 	 	 t h i s . _ l a s t I n p u t   =   n u l l ;  
 	 	 }  
 	 } ,  
  
 	 / *   U p d a t e   a n y   a l t e r n a t e   f i e l d   t o   s y n c h r o n i s e   w i t h   t h e   m a i n   f i e l d .   * /  
 	 _ u p d a t e A l t e r n a t e :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   a l t F i e l d   =   t h i s . _ g e t ( i n s t ,   ' a l t F i e l d ' ) ;  
 	 	 i f   ( a l t F i e l d )   {   / /   u p d a t e   a l t e r n a t e   f i e l d   t o o  
 	 	 	 v a r   a l t F o r m a t   =   t h i s . _ g e t ( i n s t ,   ' a l t F o r m a t ' )   | |   t h i s . _ g e t ( i n s t ,   ' d a t e F o r m a t ' ) ;  
 	 	 	 v a r   d a t e   =   t h i s . _ g e t D a t e ( i n s t ) ;  
 	 	 	 d a t e S t r   =   t h i s . f o r m a t D a t e ( a l t F o r m a t ,   d a t e ,   t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ) ;  
 	 	 	 $ ( a l t F i e l d ) . e a c h ( f u n c t i o n ( )   {   $ ( t h i s ) . v a l ( d a t e S t r ) ;   } ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   S e t   a s   b e f o r e S h o w D a y   f u n c t i o n   t o   p r e v e n t   s e l e c t i o n   o f   w e e k e n d s .  
 	       @ p a r a m     d a t e     D a t e   -   t h e   d a t e   t o   c u s t o m i s e  
 	       @ r e t u r n   [ b o o l e a n ,   s t r i n g ]   -   i s   t h i s   d a t e   s e l e c t a b l e ? ,   w h a t   i s   i t s   C S S   c l a s s ?   * /  
 	 n o W e e k e n d s :   f u n c t i o n ( d a t e )   {  
 	 	 v a r   d a y   =   d a t e . g e t D a y ( ) ;  
 	 	 r e t u r n   [ ( d a y   >   0   & &   d a y   <   6 ) ,   ' ' ] ;  
 	 } ,  
  
 	 / *   S e t   a s   c a l c u l a t e W e e k   t o   d e t e r m i n e   t h e   w e e k   o f   t h e   y e a r   b a s e d   o n   t h e   I S O   8 6 0 1   d e f i n i t i o n .  
 	       @ p a r a m     d a t e     D a t e   -   t h e   d a t e   t o   g e t   t h e   w e e k   f o r  
 	       @ r e t u r n     n u m b e r   -   t h e   n u m b e r   o f   t h e   w e e k   w i t h i n   t h e   y e a r   t h a t   c o n t a i n s   t h i s   d a t e   * /  
 	 i s o 8 6 0 1 W e e k :   f u n c t i o n ( d a t e )   {  
 	 	 v a r   c h e c k D a t e   =   n e w   D a t e ( d a t e . g e t F u l l Y e a r ( ) ,   d a t e . g e t M o n t h ( ) ,   d a t e . g e t D a t e ( ) ) ;  
 	 	 v a r   f i r s t M o n   =   n e w   D a t e ( c h e c k D a t e . g e t F u l l Y e a r ( ) ,   1   -   1 ,   4 ) ;   / /   F i r s t   w e e k   a l w a y s   c o n t a i n s   4   J a n  
 	 	 v a r   f i r s t D a y   =   f i r s t M o n . g e t D a y ( )   | |   7 ;   / /   D a y   o f   w e e k :   M o n   =   1 ,   . . . ,   S u n   =   7  
 	 	 f i r s t M o n . s e t D a t e ( f i r s t M o n . g e t D a t e ( )   +   1   -   f i r s t D a y ) ;   / /   P r e c e d i n g   M o n d a y  
 	 	 i f   ( f i r s t D a y   <   4   & &   c h e c k D a t e   <   f i r s t M o n )   {   / /   A d j u s t   f i r s t   t h r e e   d a y s   i n   y e a r   i f   n e c e s s a r y  
 	 	 	 c h e c k D a t e . s e t D a t e ( c h e c k D a t e . g e t D a t e ( )   -   3 ) ;   / /   G e n e r a t e   f o r   p r e v i o u s   y e a r  
 	 	 	 r e t u r n   $ . d a t e p i c k e r . i s o 8 6 0 1 W e e k ( c h e c k D a t e ) ;  
 	 	 }   e l s e   i f   ( c h e c k D a t e   >   n e w   D a t e ( c h e c k D a t e . g e t F u l l Y e a r ( ) ,   1 2   -   1 ,   2 8 ) )   {   / /   C h e c k   l a s t   t h r e e   d a y s   i n   y e a r  
 	 	 	 f i r s t D a y   =   n e w   D a t e ( c h e c k D a t e . g e t F u l l Y e a r ( )   +   1 ,   1   -   1 ,   4 ) . g e t D a y ( )   | |   7 ;  
 	 	 	 i f   ( f i r s t D a y   >   4   & &   ( c h e c k D a t e . g e t D a y ( )   | |   7 )   <   f i r s t D a y   -   3 )   {   / /   A d j u s t   i f   n e c e s s a r y  
 	 	 	 	 r e t u r n   1 ;  
 	 	 	 }  
 	 	 }  
 	 	 r e t u r n   M a t h . f l o o r ( ( ( c h e c k D a t e   -   f i r s t M o n )   /   8 6 4 0 0 0 0 0 )   /   7 )   +   1 ;   / /   W e e k s   t o   g i v e n   d a t e  
 	 } ,  
  
 	 / *   P a r s e   a   s t r i n g   v a l u e   i n t o   a   d a t e   o b j e c t .  
 	       S e e   f o r m a t D a t e   b e l o w   f o r   t h e   p o s s i b l e   f o r m a t s .  
  
 	       @ p a r a m     f o r m a t         s t r i n g   -   t h e   e x p e c t e d   f o r m a t   o f   t h e   d a t e  
 	       @ p a r a m     v a l u e           s t r i n g   -   t h e   d a t e   i n   t h e   a b o v e   f o r m a t  
 	       @ p a r a m     s e t t i n g s     O b j e c t   -   a t t r i b u t e s   i n c l u d e :  
 	                                           s h o r t Y e a r C u t o f f     n u m b e r   -   t h e   c u t o f f   y e a r   f o r   d e t e r m i n i n g   t h e   c e n t u r y   ( o p t i o n a l )  
 	                                           d a y N a m e s S h o r t         s t r i n g [ 7 ]   -   a b b r e v i a t e d   n a m e s   o f   t h e   d a y s   f r o m   S u n d a y   ( o p t i o n a l )  
 	                                           d a y N a m e s                   s t r i n g [ 7 ]   -   n a m e s   o f   t h e   d a y s   f r o m   S u n d a y   ( o p t i o n a l )  
 	                                           m o n t h N a m e s S h o r t     s t r i n g [ 1 2 ]   -   a b b r e v i a t e d   n a m e s   o f   t h e   m o n t h s   ( o p t i o n a l )  
 	                                           m o n t h N a m e s               s t r i n g [ 1 2 ]   -   n a m e s   o f   t h e   m o n t h s   ( o p t i o n a l )  
 	       @ r e t u r n     D a t e   -   t h e   e x t r a c t e d   d a t e   v a l u e   o r   n u l l   i f   v a l u e   i s   b l a n k   * /  
 	 p a r s e D a t e :   f u n c t i o n   ( f o r m a t ,   v a l u e ,   s e t t i n g s )   {  
 	 	 i f   ( f o r m a t   = =   n u l l   | |   v a l u e   = =   n u l l )  
 	 	 	 t h r o w   ' I n v a l i d   a r g u m e n t s ' ;  
 	 	 v a l u e   =   ( t y p e o f   v a l u e   = =   ' o b j e c t '   ?   v a l u e . t o S t r i n g ( )   :   v a l u e   +   ' ' ) ;  
 	 	 i f   ( v a l u e   = =   ' ' )  
 	 	 	 r e t u r n   n u l l ;  
 	 	 v a r   s h o r t Y e a r C u t o f f   =   ( s e t t i n g s   ?   s e t t i n g s . s h o r t Y e a r C u t o f f   :   n u l l )   | |   t h i s . _ d e f a u l t s . s h o r t Y e a r C u t o f f ;  
 	 	 v a r   d a y N a m e s S h o r t   =   ( s e t t i n g s   ?   s e t t i n g s . d a y N a m e s S h o r t   :   n u l l )   | |   t h i s . _ d e f a u l t s . d a y N a m e s S h o r t ;  
 	 	 v a r   d a y N a m e s   =   ( s e t t i n g s   ?   s e t t i n g s . d a y N a m e s   :   n u l l )   | |   t h i s . _ d e f a u l t s . d a y N a m e s ;  
 	 	 v a r   m o n t h N a m e s S h o r t   =   ( s e t t i n g s   ?   s e t t i n g s . m o n t h N a m e s S h o r t   :   n u l l )   | |   t h i s . _ d e f a u l t s . m o n t h N a m e s S h o r t ;  
 	 	 v a r   m o n t h N a m e s   =   ( s e t t i n g s   ?   s e t t i n g s . m o n t h N a m e s   :   n u l l )   | |   t h i s . _ d e f a u l t s . m o n t h N a m e s ;  
 	 	 v a r   y e a r   =   - 1 ;  
 	 	 v a r   m o n t h   =   - 1 ;  
 	 	 v a r   d a y   =   - 1 ;  
 	 	 v a r   d o y   =   - 1 ;  
 	 	 v a r   l i t e r a l   =   f a l s e ;  
 	 	 / /   C h e c k   w h e t h e r   a   f o r m a t   c h a r a c t e r   i s   d o u b l e d  
 	 	 v a r   l o o k A h e a d   =   f u n c t i o n ( m a t c h )   {  
 	 	 	 v a r   m a t c h e s   =   ( i F o r m a t   +   1   <   f o r m a t . l e n g t h   & &   f o r m a t . c h a r A t ( i F o r m a t   +   1 )   = =   m a t c h ) ;  
 	 	 	 i f   ( m a t c h e s )  
 	 	 	 	 i F o r m a t + + ;  
 	 	 	 r e t u r n   m a t c h e s ;  
 	 	 } ;  
 	 	 / /   E x t r a c t   a   n u m b e r   f r o m   t h e   s t r i n g   v a l u e  
 	 	 v a r   g e t N u m b e r   =   f u n c t i o n ( m a t c h )   {  
 	 	 	 l o o k A h e a d ( m a t c h ) ;  
 	 	 	 v a r   o r i g S i z e   =   ( m a t c h   = =   ' @ '   ?   1 4   :   ( m a t c h   = =   ' y '   ?   4   :   ( m a t c h   = =   ' o '   ?   3   :   2 ) ) ) ;  
 	 	 	 v a r   s i z e   =   o r i g S i z e ;  
 	 	 	 v a r   n u m   =   0 ;  
 	 	 	 w h i l e   ( s i z e   >   0   & &   i V a l u e   <   v a l u e . l e n g t h   & &  
 	 	 	 	 	 v a l u e . c h a r A t ( i V a l u e )   > =   ' 0 '   & &   v a l u e . c h a r A t ( i V a l u e )   < =   ' 9 ' )   {  
 	 	 	 	 n u m   =   n u m   *   1 0   +   p a r s e I n t ( v a l u e . c h a r A t ( i V a l u e + + ) , 1 0 ) ;  
 	 	 	 	 s i z e - - ;  
 	 	 	 }  
 	 	 	 i f   ( s i z e   = =   o r i g S i z e )  
 	 	 	 	 t h r o w   ' M i s s i n g   n u m b e r   a t   p o s i t i o n   '   +   i V a l u e ;  
 	 	 	 r e t u r n   n u m ;  
 	 	 } ;  
 	 	 / /   E x t r a c t   a   n a m e   f r o m   t h e   s t r i n g   v a l u e   a n d   c o n v e r t   t o   a n   i n d e x  
 	 	 v a r   g e t N a m e   =   f u n c t i o n ( m a t c h ,   s h o r t N a m e s ,   l o n g N a m e s )   {  
 	 	 	 v a r   n a m e s   =   ( l o o k A h e a d ( m a t c h )   ?   l o n g N a m e s   :   s h o r t N a m e s ) ;  
 	 	 	 v a r   s i z e   =   0 ;  
 	 	 	 f o r   ( v a r   j   =   0 ;   j   <   n a m e s . l e n g t h ;   j + + )  
 	 	 	 	 s i z e   =   M a t h . m a x ( s i z e ,   n a m e s [ j ] . l e n g t h ) ;  
 	 	 	 v a r   n a m e   =   ' ' ;  
 	 	 	 v a r   i I n i t   =   i V a l u e ;  
 	 	 	 w h i l e   ( s i z e   >   0   & &   i V a l u e   <   v a l u e . l e n g t h )   {  
 	 	 	 	 n a m e   + =   v a l u e . c h a r A t ( i V a l u e + + ) ;  
 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   n a m e s . l e n g t h ;   i + + )  
 	 	 	 	 	 i f   ( n a m e   = =   n a m e s [ i ] )  
 	 	 	 	 	 	 r e t u r n   i   +   1 ;  
 	 	 	 	 s i z e - - ;  
 	 	 	 }  
 	 	 	 t h r o w   ' U n k n o w n   n a m e   a t   p o s i t i o n   '   +   i I n i t ;  
 	 	 } ;  
 	 	 / /   C o n f i r m   t h a t   a   l i t e r a l   c h a r a c t e r   m a t c h e s   t h e   s t r i n g   v a l u e  
 	 	 v a r   c h e c k L i t e r a l   =   f u n c t i o n ( )   {  
 	 	 	 i f   ( v a l u e . c h a r A t ( i V a l u e )   ! =   f o r m a t . c h a r A t ( i F o r m a t ) )  
 	 	 	 	 t h r o w   ' U n e x p e c t e d   l i t e r a l   a t   p o s i t i o n   '   +   i V a l u e ;  
 	 	 	 i V a l u e + + ;  
 	 	 } ;  
 	 	 v a r   i V a l u e   =   0 ;  
 	 	 f o r   ( v a r   i F o r m a t   =   0 ;   i F o r m a t   <   f o r m a t . l e n g t h ;   i F o r m a t + + )   {  
 	 	 	 i f   ( l i t e r a l )  
 	 	 	 	 i f   ( f o r m a t . c h a r A t ( i F o r m a t )   = =   " ' "   & &   ! l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 l i t e r a l   =   f a l s e ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 c h e c k L i t e r a l ( ) ;  
 	 	 	 e l s e  
 	 	 	 	 s w i t c h   ( f o r m a t . c h a r A t ( i F o r m a t ) )   {  
 	 	 	 	 	 c a s e   ' d ' :  
 	 	 	 	 	 	 d a y   =   g e t N u m b e r ( ' d ' ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' D ' :  
 	 	 	 	 	 	 g e t N a m e ( ' D ' ,   d a y N a m e s S h o r t ,   d a y N a m e s ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' o ' :  
 	 	 	 	 	 	 d o y   =   g e t N u m b e r ( ' o ' ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' m ' :  
 	 	 	 	 	 	 m o n t h   =   g e t N u m b e r ( ' m ' ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' M ' :  
 	 	 	 	 	 	 m o n t h   =   g e t N a m e ( ' M ' ,   m o n t h N a m e s S h o r t ,   m o n t h N a m e s ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' y ' :  
 	 	 	 	 	 	 y e a r   =   g e t N u m b e r ( ' y ' ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' @ ' :  
 	 	 	 	 	 	 v a r   d a t e   =   n e w   D a t e ( g e t N u m b e r ( ' @ ' ) ) ;  
 	 	 	 	 	 	 y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 	 	 	 	 m o n t h   =   d a t e . g e t M o n t h ( )   +   1 ;  
 	 	 	 	 	 	 d a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   " ' " :  
 	 	 	 	 	 	 i f   ( l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 	 	 c h e c k L i t e r a l ( ) ;  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 l i t e r a l   =   t r u e ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 c h e c k L i t e r a l ( ) ;  
 	 	 	 	 }  
 	 	 }  
 	 	 i f   ( y e a r   = =   - 1 )  
 	 	 	 y e a r   =   n e w   D a t e ( ) . g e t F u l l Y e a r ( ) ;  
 	 	 e l s e   i f   ( y e a r   <   1 0 0 )  
 	 	 	 y e a r   + =   n e w   D a t e ( ) . g e t F u l l Y e a r ( )   -   n e w   D a t e ( ) . g e t F u l l Y e a r ( )   %   1 0 0   +  
 	 	 	 	 ( y e a r   < =   s h o r t Y e a r C u t o f f   ?   0   :   - 1 0 0 ) ;  
 	 	 i f   ( d o y   >   - 1 )   {  
 	 	 	 m o n t h   =   1 ;  
 	 	 	 d a y   =   d o y ;  
 	 	 	 d o   {  
 	 	 	 	 v a r   d i m   =   t h i s . _ g e t D a y s I n M o n t h ( y e a r ,   m o n t h   -   1 ) ;  
 	 	 	 	 i f   ( d a y   < =   d i m )  
 	 	 	 	 	 b r e a k ;  
 	 	 	 	 m o n t h + + ;  
 	 	 	 	 d a y   - =   d i m ;  
 	 	 	 }   w h i l e   ( t r u e ) ;  
 	 	 }  
 	 	 v a r   d a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( y e a r ,   m o n t h   -   1 ,   d a y ) ) ;  
 	 	 i f   ( d a t e . g e t F u l l Y e a r ( )   ! =   y e a r   | |   d a t e . g e t M o n t h ( )   +   1   ! =   m o n t h   | |   d a t e . g e t D a t e ( )   ! =   d a y )  
 	 	 	 t h r o w   ' I n v a l i d   d a t e ' ;   / /   E . g .   3 1 / 0 2 / *  
 	 	 r e t u r n   d a t e ;  
 	 } ,  
  
 	 / *   S t a n d a r d   d a t e   f o r m a t s .   * /  
 	 A T O M :   ' y y - m m - d d ' ,   / /   R F C   3 3 3 9   ( I S O   8 6 0 1 )  
 	 C O O K I E :   ' D ,   d d   M   y y ' ,  
 	 I S O _ 8 6 0 1 :   ' y y - m m - d d ' ,  
 	 R F C _ 8 2 2 :   ' D ,   d   M   y ' ,  
 	 R F C _ 8 5 0 :   ' D D ,   d d - M - y ' ,  
 	 R F C _ 1 0 3 6 :   ' D ,   d   M   y ' ,  
 	 R F C _ 1 1 2 3 :   ' D ,   d   M   y y ' ,  
 	 R F C _ 2 8 2 2 :   ' D ,   d   M   y y ' ,  
 	 R S S :   ' D ,   d   M   y ' ,   / /   R F C   8 2 2  
 	 T I M E S T A M P :   ' @ ' ,  
 	 W 3 C :   ' y y - m m - d d ' ,   / /   I S O   8 6 0 1  
  
 	 / *   F o r m a t   a   d a t e   o b j e c t   i n t o   a   s t r i n g   v a l u e .  
 	       T h e   f o r m a t   c a n   b e   c o m b i n a t i o n s   o f   t h e   f o l l o w i n g :  
 	       d     -   d a y   o f   m o n t h   ( n o   l e a d i n g   z e r o )  
 	       d d   -   d a y   o f   m o n t h   ( t w o   d i g i t )  
 	       o     -   d a y   o f   y e a r   ( n o   l e a d i n g   z e r o s )  
 	       o o   -   d a y   o f   y e a r   ( t h r e e   d i g i t )  
 	       D     -   d a y   n a m e   s h o r t  
 	       D D   -   d a y   n a m e   l o n g  
 	       m     -   m o n t h   o f   y e a r   ( n o   l e a d i n g   z e r o )  
 	       m m   -   m o n t h   o f   y e a r   ( t w o   d i g i t )  
 	       M     -   m o n t h   n a m e   s h o r t  
 	       M M   -   m o n t h   n a m e   l o n g  
 	       y     -   y e a r   ( t w o   d i g i t )  
 	       y y   -   y e a r   ( f o u r   d i g i t )  
 	       @   -   U n i x   t i m e s t a m p   ( m s   s i n c e   0 1 / 0 1 / 1 9 7 0 )  
 	       ' . . . '   -   l i t e r a l   t e x t  
 	       ' '   -   s i n g l e   q u o t e  
  
 	       @ p a r a m     f o r m a t         s t r i n g   -   t h e   d e s i r e d   f o r m a t   o f   t h e   d a t e  
 	       @ p a r a m     d a t e             D a t e   -   t h e   d a t e   v a l u e   t o   f o r m a t  
 	       @ p a r a m     s e t t i n g s     O b j e c t   -   a t t r i b u t e s   i n c l u d e :  
 	                                           d a y N a m e s S h o r t         s t r i n g [ 7 ]   -   a b b r e v i a t e d   n a m e s   o f   t h e   d a y s   f r o m   S u n d a y   ( o p t i o n a l )  
 	                                           d a y N a m e s                   s t r i n g [ 7 ]   -   n a m e s   o f   t h e   d a y s   f r o m   S u n d a y   ( o p t i o n a l )  
 	                                           m o n t h N a m e s S h o r t     s t r i n g [ 1 2 ]   -   a b b r e v i a t e d   n a m e s   o f   t h e   m o n t h s   ( o p t i o n a l )  
 	                                           m o n t h N a m e s               s t r i n g [ 1 2 ]   -   n a m e s   o f   t h e   m o n t h s   ( o p t i o n a l )  
 	       @ r e t u r n     s t r i n g   -   t h e   d a t e   i n   t h e   a b o v e   f o r m a t   * /  
 	 f o r m a t D a t e :   f u n c t i o n   ( f o r m a t ,   d a t e ,   s e t t i n g s )   {  
 	 	 i f   ( ! d a t e )  
 	 	 	 r e t u r n   ' ' ;  
 	 	 v a r   d a y N a m e s S h o r t   =   ( s e t t i n g s   ?   s e t t i n g s . d a y N a m e s S h o r t   :   n u l l )   | |   t h i s . _ d e f a u l t s . d a y N a m e s S h o r t ;  
 	 	 v a r   d a y N a m e s   =   ( s e t t i n g s   ?   s e t t i n g s . d a y N a m e s   :   n u l l )   | |   t h i s . _ d e f a u l t s . d a y N a m e s ;  
 	 	 v a r   m o n t h N a m e s S h o r t   =   ( s e t t i n g s   ?   s e t t i n g s . m o n t h N a m e s S h o r t   :   n u l l )   | |   t h i s . _ d e f a u l t s . m o n t h N a m e s S h o r t ;  
 	 	 v a r   m o n t h N a m e s   =   ( s e t t i n g s   ?   s e t t i n g s . m o n t h N a m e s   :   n u l l )   | |   t h i s . _ d e f a u l t s . m o n t h N a m e s ;  
 	 	 / /   C h e c k   w h e t h e r   a   f o r m a t   c h a r a c t e r   i s   d o u b l e d  
 	 	 v a r   l o o k A h e a d   =   f u n c t i o n ( m a t c h )   {  
 	 	 	 v a r   m a t c h e s   =   ( i F o r m a t   +   1   <   f o r m a t . l e n g t h   & &   f o r m a t . c h a r A t ( i F o r m a t   +   1 )   = =   m a t c h ) ;  
 	 	 	 i f   ( m a t c h e s )  
 	 	 	 	 i F o r m a t + + ;  
 	 	 	 r e t u r n   m a t c h e s ;  
 	 	 } ;  
 	 	 / /   F o r m a t   a   n u m b e r ,   w i t h   l e a d i n g   z e r o   i f   n e c e s s a r y  
 	 	 v a r   f o r m a t N u m b e r   =   f u n c t i o n ( m a t c h ,   v a l u e ,   l e n )   {  
 	 	 	 v a r   n u m   =   ' '   +   v a l u e ;  
 	 	 	 i f   ( l o o k A h e a d ( m a t c h ) )  
 	 	 	 	 w h i l e   ( n u m . l e n g t h   <   l e n )  
 	 	 	 	 	 n u m   =   ' 0 '   +   n u m ;  
 	 	 	 r e t u r n   n u m ;  
 	 	 } ;  
 	 	 / /   F o r m a t   a   n a m e ,   s h o r t   o r   l o n g   a s   r e q u e s t e d  
 	 	 v a r   f o r m a t N a m e   =   f u n c t i o n ( m a t c h ,   v a l u e ,   s h o r t N a m e s ,   l o n g N a m e s )   {  
 	 	 	 r e t u r n   ( l o o k A h e a d ( m a t c h )   ?   l o n g N a m e s [ v a l u e ]   :   s h o r t N a m e s [ v a l u e ] ) ;  
 	 	 } ;  
 	 	 v a r   o u t p u t   =   ' ' ;  
 	 	 v a r   l i t e r a l   =   f a l s e ;  
 	 	 i f   ( d a t e )  
 	 	 	 f o r   ( v a r   i F o r m a t   =   0 ;   i F o r m a t   <   f o r m a t . l e n g t h ;   i F o r m a t + + )   {  
 	 	 	 	 i f   ( l i t e r a l )  
 	 	 	 	 	 i f   ( f o r m a t . c h a r A t ( i F o r m a t )   = =   " ' "   & &   ! l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 	 l i t e r a l   =   f a l s e ;  
 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 o u t p u t   + =   f o r m a t . c h a r A t ( i F o r m a t ) ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 s w i t c h   ( f o r m a t . c h a r A t ( i F o r m a t ) )   {  
 	 	 	 	 	 	 c a s e   ' d ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t N u m b e r ( ' d ' ,   d a t e . g e t D a t e ( ) ,   2 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' D ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t N a m e ( ' D ' ,   d a t e . g e t D a y ( ) ,   d a y N a m e s S h o r t ,   d a y N a m e s ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' o ' :  
 	 	 	 	 	 	 	 v a r   d o y   =   d a t e . g e t D a t e ( ) ;  
 	 	 	 	 	 	 	 f o r   ( v a r   m   =   d a t e . g e t M o n t h ( )   -   1 ;   m   > =   0 ;   m - - )  
 	 	 	 	 	 	 	 	 d o y   + =   t h i s . _ g e t D a y s I n M o n t h ( d a t e . g e t F u l l Y e a r ( ) ,   m ) ;  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t N u m b e r ( ' o ' ,   d o y ,   3 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' m ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t N u m b e r ( ' m ' ,   d a t e . g e t M o n t h ( )   +   1 ,   2 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' M ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t N a m e ( ' M ' ,   d a t e . g e t M o n t h ( ) ,   m o n t h N a m e s S h o r t ,   m o n t h N a m e s ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' y ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   ( l o o k A h e a d ( ' y ' )   ?   d a t e . g e t F u l l Y e a r ( )   :  
 	 	 	 	 	 	 	 	 ( d a t e . g e t Y e a r ( )   %   1 0 0   <   1 0   ?   ' 0 '   :   ' ' )   +   d a t e . g e t Y e a r ( )   %   1 0 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' @ ' :  
 	 	 	 	 	 	 	 o u t p u t   + =   d a t e . g e t T i m e ( ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   " ' " :  
 	 	 	 	 	 	 	 i f   ( l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 	 	 	 o u t p u t   + =   " ' " ;  
 	 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 	 l i t e r a l   =   t r u e ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 	 o u t p u t   + =   f o r m a t . c h a r A t ( i F o r m a t ) ;  
 	 	 	 	 	 }  
 	 	 	 }  
 	 	 r e t u r n   o u t p u t ;  
 	 } ,  
  
 	 / *   E x t r a c t   a l l   p o s s i b l e   c h a r a c t e r s   f r o m   t h e   d a t e   f o r m a t .   * /  
 	 _ p o s s i b l e C h a r s :   f u n c t i o n   ( f o r m a t )   {  
 	 	 v a r   c h a r s   =   ' ' ;  
 	 	 v a r   l i t e r a l   =   f a l s e ;  
 	 	 f o r   ( v a r   i F o r m a t   =   0 ;   i F o r m a t   <   f o r m a t . l e n g t h ;   i F o r m a t + + )  
 	 	 	 i f   ( l i t e r a l )  
 	 	 	 	 i f   ( f o r m a t . c h a r A t ( i F o r m a t )   = =   " ' "   & &   ! l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 l i t e r a l   =   f a l s e ;  
 	 	 	 	 e l s e  
 	 	 	 	 	 c h a r s   + =   f o r m a t . c h a r A t ( i F o r m a t ) ;  
 	 	 	 e l s e  
 	 	 	 	 s w i t c h   ( f o r m a t . c h a r A t ( i F o r m a t ) )   {  
 	 	 	 	 	 c a s e   ' d ' :   c a s e   ' m ' :   c a s e   ' y ' :   c a s e   ' @ ' :  
 	 	 	 	 	 	 c h a r s   + =   ' 0 1 2 3 4 5 6 7 8 9 ' ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' D ' :   c a s e   ' M ' :  
 	 	 	 	 	 	 r e t u r n   n u l l ;   / /   A c c e p t   a n y t h i n g  
 	 	 	 	 	 c a s e   " ' " :  
 	 	 	 	 	 	 i f   ( l o o k A h e a d ( " ' " ) )  
 	 	 	 	 	 	 	 c h a r s   + =   " ' " ;  
 	 	 	 	 	 	 e l s e  
 	 	 	 	 	 	 	 l i t e r a l   =   t r u e ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 c h a r s   + =   f o r m a t . c h a r A t ( i F o r m a t ) ;  
 	 	 	 	 }  
 	 	 r e t u r n   c h a r s ;  
 	 } ,  
  
 	 / *   G e t   a   s e t t i n g   v a l u e ,   d e f a u l t i n g   i f   n e c e s s a r y .   * /  
 	 _ g e t :   f u n c t i o n ( i n s t ,   n a m e )   {  
 	 	 r e t u r n   i n s t . s e t t i n g s [ n a m e ]   ! = =   u n d e f i n e d   ?  
 	 	 	 i n s t . s e t t i n g s [ n a m e ]   :   t h i s . _ d e f a u l t s [ n a m e ] ;  
 	 } ,  
  
 	 / *   P a r s e   e x i s t i n g   d a t e   a n d   i n i t i a l i s e   d a t e   p i c k e r .   * /  
 	 _ s e t D a t e F r o m F i e l d :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   d a t e F o r m a t   =   t h i s . _ g e t ( i n s t ,   ' d a t e F o r m a t ' ) ;  
 	 	 v a r   d a t e s   =   i n s t . i n p u t   ?   i n s t . i n p u t . v a l ( )   :   n u l l ;  
 	 	 i n s t . e n d D a y   =   i n s t . e n d M o n t h   =   i n s t . e n d Y e a r   =   n u l l ;  
 	 	 v a r   d a t e   =   d e f a u l t D a t e   =   t h i s . _ g e t D e f a u l t D a t e ( i n s t ) ;  
 	 	 v a r   s e t t i n g s   =   t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ;  
 	 	 t r y   {  
 	 	 	 d a t e   =   t h i s . p a r s e D a t e ( d a t e F o r m a t ,   d a t e s ,   s e t t i n g s )   | |   d e f a u l t D a t e ;  
 	 	 }   c a t c h   ( e v e n t )   {  
 	 	 	 t h i s . l o g ( e v e n t ) ;  
 	 	 	 d a t e   =   d e f a u l t D a t e ;  
 	 	 }  
 	 	 i n s t . s e l e c t e d D a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 i n s t . d r a w M o n t h   =   i n s t . s e l e c t e d M o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 i n s t . d r a w Y e a r   =   i n s t . s e l e c t e d Y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 i n s t . c u r r e n t D a y   =   ( d a t e s   ?   d a t e . g e t D a t e ( )   :   0 ) ;  
 	 	 i n s t . c u r r e n t M o n t h   =   ( d a t e s   ?   d a t e . g e t M o n t h ( )   :   0 ) ;  
 	 	 i n s t . c u r r e n t Y e a r   =   ( d a t e s   ?   d a t e . g e t F u l l Y e a r ( )   :   0 ) ;  
 	 	 t h i s . _ a d j u s t I n s t D a t e ( i n s t ) ;  
 	 } ,  
  
 	 / *   R e t r i e v e   t h e   d e f a u l t   d a t e   s h o w n   o n   o p e n i n g .   * /  
 	 _ g e t D e f a u l t D a t e :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   d a t e   =   t h i s . _ d e t e r m i n e D a t e ( t h i s . _ g e t ( i n s t ,   ' d e f a u l t D a t e ' ) ,   n e w   D a t e ( ) ) ;  
 	 	 v a r   m i n D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m i n ' ,   t r u e ) ;  
 	 	 v a r   m a x D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m a x ' ) ;  
 	 	 d a t e   =   ( m i n D a t e   & &   d a t e   <   m i n D a t e   ?   m i n D a t e   :   d a t e ) ;  
 	 	 d a t e   =   ( m a x D a t e   & &   d a t e   >   m a x D a t e   ?   m a x D a t e   :   d a t e ) ;  
 	 	 r e t u r n   d a t e ;  
 	 } ,  
  
 	 / *   A   d a t e   m a y   b e   s p e c i f i e d   a s   a n   e x a c t   v a l u e   o r   a   r e l a t i v e   o n e .   * /  
 	 _ d e t e r m i n e D a t e :   f u n c t i o n ( d a t e ,   d e f a u l t D a t e )   {  
 	 	 v a r   o f f s e t N u m e r i c   =   f u n c t i o n ( o f f s e t )   {  
 	 	 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 	 	 d a t e . s e t D a t e ( d a t e . g e t D a t e ( )   +   o f f s e t ) ;  
 	 	 	 r e t u r n   d a t e ;  
 	 	 } ;  
 	 	 v a r   o f f s e t S t r i n g   =   f u n c t i o n ( o f f s e t ,   g e t D a y s I n M o n t h )   {  
 	 	 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 	 	 v a r   y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 	 v a r   m o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 	 v a r   d a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 	 v a r   p a t t e r n   =   / ( [ + - ] ? [ 0 - 9 ] + ) \ s * ( d | D | w | W | m | M | y | Y ) ? / g ;  
 	 	 	 v a r   m a t c h e s   =   p a t t e r n . e x e c ( o f f s e t ) ;  
 	 	 	 w h i l e   ( m a t c h e s )   {  
 	 	 	 	 s w i t c h   ( m a t c h e s [ 2 ]   | |   ' d ' )   {  
 	 	 	 	 	 c a s e   ' d '   :   c a s e   ' D '   :  
 	 	 	 	 	 	 d a y   + =   p a r s e I n t ( m a t c h e s [ 1 ] , 1 0 ) ;   b r e a k ;  
 	 	 	 	 	 c a s e   ' w '   :   c a s e   ' W '   :  
 	 	 	 	 	 	 d a y   + =   p a r s e I n t ( m a t c h e s [ 1 ] , 1 0 )   *   7 ;   b r e a k ;  
 	 	 	 	 	 c a s e   ' m '   :   c a s e   ' M '   :  
 	 	 	 	 	 	 m o n t h   + =   p a r s e I n t ( m a t c h e s [ 1 ] , 1 0 ) ;  
 	 	 	 	 	 	 d a y   =   M a t h . m i n ( d a y ,   g e t D a y s I n M o n t h ( y e a r ,   m o n t h ) ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 c a s e   ' y ' :   c a s e   ' Y '   :  
 	 	 	 	 	 	 y e a r   + =   p a r s e I n t ( m a t c h e s [ 1 ] , 1 0 ) ;  
 	 	 	 	 	 	 d a y   =   M a t h . m i n ( d a y ,   g e t D a y s I n M o n t h ( y e a r ,   m o n t h ) ) ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 }  
 	 	 	 	 m a t c h e s   =   p a t t e r n . e x e c ( o f f s e t ) ;  
 	 	 	 }  
 	 	 	 r e t u r n   n e w   D a t e ( y e a r ,   m o n t h ,   d a y ) ;  
 	 	 } ;  
 	 	 d a t e   =   ( d a t e   = =   n u l l   ?   d e f a u l t D a t e   :  
 	 	 	 ( t y p e o f   d a t e   = =   ' s t r i n g '   ?   o f f s e t S t r i n g ( d a t e ,   t h i s . _ g e t D a y s I n M o n t h )   :  
 	 	 	 ( t y p e o f   d a t e   = =   ' n u m b e r '   ?   ( i s N a N ( d a t e )   ?   d e f a u l t D a t e   :   o f f s e t N u m e r i c ( d a t e ) )   :   d a t e ) ) ) ;  
 	 	 d a t e   =   ( d a t e   & &   d a t e . t o S t r i n g ( )   = =   ' I n v a l i d   D a t e '   ?   d e f a u l t D a t e   :   d a t e ) ;  
 	 	 i f   ( d a t e )   {  
 	 	 	 d a t e . s e t H o u r s ( 0 ) ;  
 	 	 	 d a t e . s e t M i n u t e s ( 0 ) ;  
 	 	 	 d a t e . s e t S e c o n d s ( 0 ) ;  
 	 	 	 d a t e . s e t M i l l i s e c o n d s ( 0 ) ;  
 	 	 }  
 	 	 r e t u r n   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( d a t e ) ;  
 	 } ,  
  
 	 / *   H a n d l e   s w i t c h   t o / f r o m   d a y l i g h t   s a v i n g .  
 	       H o u r s   m a y   b e   n o n - z e r o   o n   d a y l i g h t   s a v i n g   c u t - o v e r :  
 	       >   1 2   w h e n   m i d n i g h t   c h a n g e o v e r ,   b u t   t h e n   c a n n o t   g e n e r a t e  
 	       m i d n i g h t   d a t e t i m e ,   s o   j u m p   t o   1 A M ,   o t h e r w i s e   r e s e t .  
 	       @ p a r a m     d a t e     ( D a t e )   t h e   d a t e   t o   c h e c k  
 	       @ r e t u r n     ( D a t e )   t h e   c o r r e c t e d   d a t e   * /  
 	 _ d a y l i g h t S a v i n g A d j u s t :   f u n c t i o n ( d a t e )   {  
 	 	 i f   ( ! d a t e )   r e t u r n   n u l l ;  
 	 	 d a t e . s e t H o u r s ( d a t e . g e t H o u r s ( )   >   1 2   ?   d a t e . g e t H o u r s ( )   +   2   :   0 ) ;  
 	 	 r e t u r n   d a t e ;  
 	 } ,  
  
 	 / *   S e t   t h e   d a t e ( s )   d i r e c t l y .   * /  
 	 _ s e t D a t e :   f u n c t i o n ( i n s t ,   d a t e ,   e n d D a t e )   {  
 	 	 v a r   c l e a r   =   ! ( d a t e ) ;  
 	 	 v a r   o r i g M o n t h   =   i n s t . s e l e c t e d M o n t h ;  
 	 	 v a r   o r i g Y e a r   =   i n s t . s e l e c t e d Y e a r ;  
 	 	 d a t e   =   t h i s . _ d e t e r m i n e D a t e ( d a t e ,   n e w   D a t e ( ) ) ;  
 	 	 i n s t . s e l e c t e d D a y   =   i n s t . c u r r e n t D a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 i n s t . d r a w M o n t h   =   i n s t . s e l e c t e d M o n t h   =   i n s t . c u r r e n t M o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 i n s t . d r a w Y e a r   =   i n s t . s e l e c t e d Y e a r   =   i n s t . c u r r e n t Y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 i f   ( o r i g M o n t h   ! =   i n s t . s e l e c t e d M o n t h   | |   o r i g Y e a r   ! =   i n s t . s e l e c t e d Y e a r )  
 	 	 	 t h i s . _ n o t i f y C h a n g e ( i n s t ) ;  
 	 	 t h i s . _ a d j u s t I n s t D a t e ( i n s t ) ;  
 	 	 i f   ( i n s t . i n p u t )   {  
 	 	 	 i n s t . i n p u t . v a l ( c l e a r   ?   ' '   :   t h i s . _ f o r m a t D a t e ( i n s t ) ) ;  
 	 	 }  
 	 } ,  
  
 	 / *   R e t r i e v e   t h e   d a t e ( s )   d i r e c t l y .   * /  
 	 _ g e t D a t e :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   s t a r t D a t e   =   ( ! i n s t . c u r r e n t Y e a r   | |   ( i n s t . i n p u t   & &   i n s t . i n p u t . v a l ( )   = =   ' ' )   ?   n u l l   :  
 	 	 	 t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e (  
 	 	 	 i n s t . c u r r e n t Y e a r ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t D a y ) ) ) ;  
 	 	 	 r e t u r n   s t a r t D a t e ;  
 	 } ,  
  
 	 / *   G e n e r a t e   t h e   H T M L   f o r   t h e   c u r r e n t   s t a t e   o f   t h e   d a t e   p i c k e r .   * /  
 	 _ g e n e r a t e H T M L :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   t o d a y   =   n e w   D a t e ( ) ;  
 	 	 t o d a y   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t (  
 	 	 	 n e w   D a t e ( t o d a y . g e t F u l l Y e a r ( ) ,   t o d a y . g e t M o n t h ( ) ,   t o d a y . g e t D a t e ( ) ) ) ;   / /   c l e a r   t i m e  
 	 	 v a r   i s R T L   =   t h i s . _ g e t ( i n s t ,   ' i s R T L ' ) ;  
 	 	 v a r   s h o w B u t t o n P a n e l   =   t h i s . _ g e t ( i n s t ,   ' s h o w B u t t o n P a n e l ' ) ;  
 	 	 v a r   h i d e I f N o P r e v N e x t   =   t h i s . _ g e t ( i n s t ,   ' h i d e I f N o P r e v N e x t ' ) ;  
 	 	 v a r   n a v i g a t i o n A s D a t e F o r m a t   =   t h i s . _ g e t ( i n s t ,   ' n a v i g a t i o n A s D a t e F o r m a t ' ) ;  
 	 	 v a r   n u m M o n t h s   =   t h i s . _ g e t N u m b e r O f M o n t h s ( i n s t ) ;  
 	 	 v a r   s h o w C u r r e n t A t P o s   =   t h i s . _ g e t ( i n s t ,   ' s h o w C u r r e n t A t P o s ' ) ;  
 	 	 v a r   s t e p M o n t h s   =   t h i s . _ g e t ( i n s t ,   ' s t e p M o n t h s ' ) ;  
 	 	 v a r   s t e p B i g M o n t h s   =   t h i s . _ g e t ( i n s t ,   ' s t e p B i g M o n t h s ' ) ;  
 	 	 v a r   i s M u l t i M o n t h   =   ( n u m M o n t h s [ 0 ]   ! =   1   | |   n u m M o n t h s [ 1 ]   ! =   1 ) ;  
 	 	 v a r   c u r r e n t D a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( ( ! i n s t . c u r r e n t D a y   ?   n e w   D a t e ( 9 9 9 9 ,   9 ,   9 )   :  
 	 	 	 n e w   D a t e ( i n s t . c u r r e n t Y e a r ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t D a y ) ) ) ;  
 	 	 v a r   m i n D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m i n ' ,   t r u e ) ;  
 	 	 v a r   m a x D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m a x ' ) ;  
 	 	 v a r   d r a w M o n t h   =   i n s t . d r a w M o n t h   -   s h o w C u r r e n t A t P o s ;  
 	 	 v a r   d r a w Y e a r   =   i n s t . d r a w Y e a r ;  
 	 	 i f   ( d r a w M o n t h   <   0 )   {  
 	 	 	 d r a w M o n t h   + =   1 2 ;  
 	 	 	 d r a w Y e a r - - ;  
 	 	 }  
 	 	 i f   ( m a x D a t e )   {  
 	 	 	 v a r   m a x D r a w   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( m a x D a t e . g e t F u l l Y e a r ( ) ,  
 	 	 	 	 m a x D a t e . g e t M o n t h ( )   -   n u m M o n t h s [ 1 ]   +   1 ,   m a x D a t e . g e t D a t e ( ) ) ) ;  
 	 	 	 m a x D r a w   =   ( m i n D a t e   & &   m a x D r a w   <   m i n D a t e   ?   m i n D a t e   :   m a x D r a w ) ;  
 	 	 	 w h i l e   ( t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( d r a w Y e a r ,   d r a w M o n t h ,   1 ) )   >   m a x D r a w )   {  
 	 	 	 	 d r a w M o n t h - - ;  
 	 	 	 	 i f   ( d r a w M o n t h   <   0 )   {  
 	 	 	 	 	 d r a w M o n t h   =   1 1 ;  
 	 	 	 	 	 d r a w Y e a r - - ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 i n s t . d r a w M o n t h   =   d r a w M o n t h ;  
 	 	 i n s t . d r a w Y e a r   =   d r a w Y e a r ;  
 	 	 v a r   p r e v T e x t   =   t h i s . _ g e t ( i n s t ,   ' p r e v T e x t ' ) ;  
 	 	 p r e v T e x t   =   ( ! n a v i g a t i o n A s D a t e F o r m a t   ?   p r e v T e x t   :   t h i s . f o r m a t D a t e ( p r e v T e x t ,  
 	 	 	 t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( d r a w Y e a r ,   d r a w M o n t h   -   s t e p M o n t h s ,   1 ) ) ,  
 	 	 	 t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ) ) ;  
 	 	 v a r   p r e v   =   ( t h i s . _ c a n A d j u s t M o n t h ( i n s t ,   - 1 ,   d r a w Y e a r ,   d r a w M o n t h )   ?  
 	 	 	 ' < a   c l a s s = " u i - d a t e p i c k e r - p r e v   u i - c o r n e r - a l l "   o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ a d j u s t D a t e ( \ ' # '   +   i n s t . i d   +   ' \ ' ,   - '   +   s t e p M o n t h s   +   ' ,   \ ' M \ ' ) ; " '   +  
 	 	 	 '   t i t l e = " '   +   p r e v T e x t   +   ' " > < s p a n   c l a s s = " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - '   +   (   i s R T L   ?   ' e '   :   ' w ' )   +   ' " > '   +   p r e v T e x t   +   ' < / s p a n > < / a > '   :  
 	 	 	 ( h i d e I f N o P r e v N e x t   ?   ' '   :   ' < a   c l a s s = " u i - d a t e p i c k e r - p r e v   u i - c o r n e r - a l l   u i - s t a t e - d i s a b l e d "   t i t l e = " ' +   p r e v T e x t   + ' " > < s p a n   c l a s s = " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - '   +   (   i s R T L   ?   ' e '   :   ' w ' )   +   ' " > '   +   p r e v T e x t   +   ' < / s p a n > < / a > ' ) ) ;  
 	 	 v a r   n e x t T e x t   =   t h i s . _ g e t ( i n s t ,   ' n e x t T e x t ' ) ;  
 	 	 n e x t T e x t   =   ( ! n a v i g a t i o n A s D a t e F o r m a t   ?   n e x t T e x t   :   t h i s . f o r m a t D a t e ( n e x t T e x t ,  
 	 	 	 t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( d r a w Y e a r ,   d r a w M o n t h   +   s t e p M o n t h s ,   1 ) ) ,  
 	 	 	 t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ) ) ;  
 	 	 v a r   n e x t   =   ( t h i s . _ c a n A d j u s t M o n t h ( i n s t ,   + 1 ,   d r a w Y e a r ,   d r a w M o n t h )   ?  
 	 	 	 ' < a   c l a s s = " u i - d a t e p i c k e r - n e x t   u i - c o r n e r - a l l "   o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ a d j u s t D a t e ( \ ' # '   +   i n s t . i d   +   ' \ ' ,   + '   +   s t e p M o n t h s   +   ' ,   \ ' M \ ' ) ; " '   +  
 	 	 	 '   t i t l e = " '   +   n e x t T e x t   +   ' " > < s p a n   c l a s s = " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - '   +   (   i s R T L   ?   ' w '   :   ' e ' )   +   ' " > '   +   n e x t T e x t   +   ' < / s p a n > < / a > '   :  
 	 	 	 ( h i d e I f N o P r e v N e x t   ?   ' '   :   ' < a   c l a s s = " u i - d a t e p i c k e r - n e x t   u i - c o r n e r - a l l   u i - s t a t e - d i s a b l e d "   t i t l e = " ' +   n e x t T e x t   +   ' " > < s p a n   c l a s s = " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - '   +   (   i s R T L   ?   ' w '   :   ' e ' )   +   ' " > '   +   n e x t T e x t   +   ' < / s p a n > < / a > ' ) ) ;  
 	 	 v a r   c u r r e n t T e x t   =   t h i s . _ g e t ( i n s t ,   ' c u r r e n t T e x t ' ) ;  
 	 	 v a r   g o t o D a t e   =   ( t h i s . _ g e t ( i n s t ,   ' g o t o C u r r e n t ' )   & &   i n s t . c u r r e n t D a y   ?   c u r r e n t D a t e   :   t o d a y ) ;  
 	 	 c u r r e n t T e x t   =   ( ! n a v i g a t i o n A s D a t e F o r m a t   ?   c u r r e n t T e x t   :  
 	 	 	 t h i s . f o r m a t D a t e ( c u r r e n t T e x t ,   g o t o D a t e ,   t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ) ) ;  
 	 	 v a r   c o n t r o l s   =   ( ! i n s t . i n l i n e   ?   ' < b u t t o n   t y p e = " b u t t o n "   c l a s s = " u i - d a t e p i c k e r - c l o s e   u i - s t a t e - d e f a u l t   u i - p r i o r i t y - p r i m a r y   u i - c o r n e r - a l l "   o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ h i d e D a t e p i c k e r ( ) ; " > '   +   t h i s . _ g e t ( i n s t ,   ' c l o s e T e x t ' )   +   ' < / b u t t o n > '   :   ' ' ) ;  
 	 	 v a r   b u t t o n P a n e l   =   ( s h o w B u t t o n P a n e l )   ?   ' < d i v   c l a s s = " u i - d a t e p i c k e r - b u t t o n p a n e   u i - w i d g e t - c o n t e n t " > '   +   ( i s R T L   ?   c o n t r o l s   :   ' ' )   +  
 	 	 	 ( t h i s . _ i s I n R a n g e ( i n s t ,   g o t o D a t e )   ?   ' < b u t t o n   t y p e = " b u t t o n "   c l a s s = " u i - d a t e p i c k e r - c u r r e n t   u i - s t a t e - d e f a u l t   u i - p r i o r i t y - s e c o n d a r y   u i - c o r n e r - a l l "   o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ g o t o T o d a y ( \ ' # '   +   i n s t . i d   +   ' \ ' ) ; " '   +  
 	 	 	 ' > '   +   c u r r e n t T e x t   +   ' < / b u t t o n > '   :   ' ' )   +   ( i s R T L   ?   ' '   :   c o n t r o l s )   +   ' < / d i v > '   :   ' ' ;  
 	 	 v a r   f i r s t D a y   =   p a r s e I n t ( t h i s . _ g e t ( i n s t ,   ' f i r s t D a y ' ) , 1 0 ) ;  
 	 	 f i r s t D a y   =   ( i s N a N ( f i r s t D a y )   ?   0   :   f i r s t D a y ) ;  
 	 	 v a r   d a y N a m e s   =   t h i s . _ g e t ( i n s t ,   ' d a y N a m e s ' ) ;  
 	 	 v a r   d a y N a m e s S h o r t   =   t h i s . _ g e t ( i n s t ,   ' d a y N a m e s S h o r t ' ) ;  
 	 	 v a r   d a y N a m e s M i n   =   t h i s . _ g e t ( i n s t ,   ' d a y N a m e s M i n ' ) ;  
 	 	 v a r   m o n t h N a m e s   =   t h i s . _ g e t ( i n s t ,   ' m o n t h N a m e s ' ) ;  
 	 	 v a r   m o n t h N a m e s S h o r t   =   t h i s . _ g e t ( i n s t ,   ' m o n t h N a m e s S h o r t ' ) ;  
 	 	 v a r   b e f o r e S h o w D a y   =   t h i s . _ g e t ( i n s t ,   ' b e f o r e S h o w D a y ' ) ;  
 	 	 v a r   s h o w O t h e r M o n t h s   =   t h i s . _ g e t ( i n s t ,   ' s h o w O t h e r M o n t h s ' ) ;  
 	 	 v a r   c a l c u l a t e W e e k   =   t h i s . _ g e t ( i n s t ,   ' c a l c u l a t e W e e k ' )   | |   t h i s . i s o 8 6 0 1 W e e k ;  
 	 	 v a r   e n d D a t e   =   i n s t . e n d D a y   ?   t h i s . _ d a y l i g h t S a v i n g A d j u s t (  
 	 	 	 n e w   D a t e ( i n s t . e n d Y e a r ,   i n s t . e n d M o n t h ,   i n s t . e n d D a y ) )   :   c u r r e n t D a t e ;  
 	 	 v a r   d e f a u l t D a t e   =   t h i s . _ g e t D e f a u l t D a t e ( i n s t ) ;  
 	 	 v a r   h t m l   =   ' ' ;  
 	 	 f o r   ( v a r   r o w   =   0 ;   r o w   <   n u m M o n t h s [ 0 ] ;   r o w + + )   {  
 	 	 	 v a r   g r o u p   =   ' ' ;  
 	 	 	 f o r   ( v a r   c o l   =   0 ;   c o l   <   n u m M o n t h s [ 1 ] ;   c o l + + )   {  
 	 	 	 	 v a r   s e l e c t e d D a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( d r a w Y e a r ,   d r a w M o n t h ,   i n s t . s e l e c t e d D a y ) ) ;  
 	 	 	 	 v a r   c o r n e r C l a s s   =   '   u i - c o r n e r - a l l ' ;  
 	 	 	 	 v a r   c a l e n d e r   =   ' ' ;  
 	 	 	 	 i f   ( i s M u l t i M o n t h )   {  
 	 	 	 	 	 c a l e n d e r   + =   ' < d i v   c l a s s = " u i - d a t e p i c k e r - g r o u p   u i - d a t e p i c k e r - g r o u p - ' ;  
 	 	 	 	 	 s w i t c h   ( c o l )   {  
 	 	 	 	 	 	 c a s e   0 :   c a l e n d e r   + =   ' f i r s t ' ;   c o r n e r C l a s s   =   '   u i - c o r n e r - '   +   ( i s R T L   ?   ' r i g h t '   :   ' l e f t ' ) ;   b r e a k ;  
 	 	 	 	 	 	 c a s e   n u m M o n t h s [ 1 ] - 1 :   c a l e n d e r   + =   ' l a s t ' ;   c o r n e r C l a s s   =   '   u i - c o r n e r - '   +   ( i s R T L   ?   ' l e f t '   :   ' r i g h t ' ) ;   b r e a k ;  
 	 	 	 	 	 	 d e f a u l t :   c a l e n d e r   + =   ' m i d d l e ' ;   c o r n e r C l a s s   =   ' ' ;   b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 	 c a l e n d e r   + =   ' " > ' ;  
 	 	 	 	 }  
 	 	 	 	 c a l e n d e r   + =   ' < d i v   c l a s s = " u i - d a t e p i c k e r - h e a d e r   u i - w i d g e t - h e a d e r   u i - h e l p e r - c l e a r f i x '   +   c o r n e r C l a s s   +   ' " > '   +  
 	 	 	 	 	 ( / a l l | l e f t / . t e s t ( c o r n e r C l a s s )   & &   r o w   = =   0   ?   ( i s R T L   ?   n e x t   :   p r e v )   :   ' ' )   +  
 	 	 	 	 	 ( / a l l | r i g h t / . t e s t ( c o r n e r C l a s s )   & &   r o w   = =   0   ?   ( i s R T L   ?   p r e v   :   n e x t )   :   ' ' )   +  
 	 	 	 	 	 t h i s . _ g e n e r a t e M o n t h Y e a r H e a d e r ( i n s t ,   d r a w M o n t h ,   d r a w Y e a r ,   m i n D a t e ,   m a x D a t e ,  
 	 	 	 	 	 s e l e c t e d D a t e ,   r o w   >   0   | |   c o l   >   0 ,   m o n t h N a m e s ,   m o n t h N a m e s S h o r t )   +   / /   d r a w   m o n t h   h e a d e r s  
 	 	 	 	 	 ' < / d i v > < t a b l e   c l a s s = " u i - d a t e p i c k e r - c a l e n d a r " > < t h e a d > '   +  
 	 	 	 	 	 ' < t r > ' ;  
 	 	 	 	 v a r   t h e a d   =   ' ' ;  
 	 	 	 	 f o r   ( v a r   d o w   =   0 ;   d o w   <   7 ;   d o w + + )   {   / /   d a y s   o f   t h e   w e e k  
 	 	 	 	 	 v a r   d a y   =   ( d o w   +   f i r s t D a y )   %   7 ;  
 	 	 	 	 	 t h e a d   + =   ' < t h '   +   ( ( d o w   +   f i r s t D a y   +   6 )   %   7   > =   5   ?   '   c l a s s = " u i - d a t e p i c k e r - w e e k - e n d " '   :   ' ' )   +   ' > '   +  
 	 	 	 	 	 	 ' < s p a n   t i t l e = " '   +   d a y N a m e s [ d a y ]   +   ' " > '   +   d a y N a m e s M i n [ d a y ]   +   ' < / s p a n > < / t h > ' ;  
 	 	 	 	 }  
 	 	 	 	 c a l e n d e r   + =   t h e a d   +   ' < / t r > < / t h e a d > < t b o d y > ' ;  
 	 	 	 	 v a r   d a y s I n M o n t h   =   t h i s . _ g e t D a y s I n M o n t h ( d r a w Y e a r ,   d r a w M o n t h ) ;  
 	 	 	 	 i f   ( d r a w Y e a r   = =   i n s t . s e l e c t e d Y e a r   & &   d r a w M o n t h   = =   i n s t . s e l e c t e d M o n t h )  
 	 	 	 	 	 i n s t . s e l e c t e d D a y   =   M a t h . m i n ( i n s t . s e l e c t e d D a y ,   d a y s I n M o n t h ) ;  
 	 	 	 	 v a r   l e a d D a y s   =   ( t h i s . _ g e t F i r s t D a y O f M o n t h ( d r a w Y e a r ,   d r a w M o n t h )   -   f i r s t D a y   +   7 )   %   7 ;  
 	 	 	 	 v a r   n u m R o w s   =   ( i s M u l t i M o n t h   ?   6   :   M a t h . c e i l ( ( l e a d D a y s   +   d a y s I n M o n t h )   /   7 ) ) ;   / /   c a l c u l a t e   t h e   n u m b e r   o f   r o w s   t o   g e n e r a t e  
 	 	 	 	 v a r   p r i n t D a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( d r a w Y e a r ,   d r a w M o n t h ,   1   -   l e a d D a y s ) ) ;  
 	 	 	 	 f o r   ( v a r   d R o w   =   0 ;   d R o w   <   n u m R o w s ;   d R o w + + )   {   / /   c r e a t e   d a t e   p i c k e r   r o w s  
 	 	 	 	 	 c a l e n d e r   + =   ' < t r > ' ;  
 	 	 	 	 	 v a r   t b o d y   =   ' ' ;  
 	 	 	 	 	 f o r   ( v a r   d o w   =   0 ;   d o w   <   7 ;   d o w + + )   {   / /   c r e a t e   d a t e   p i c k e r   d a y s  
 	 	 	 	 	 	 v a r   d a y S e t t i n g s   =   ( b e f o r e S h o w D a y   ?  
 	 	 	 	 	 	 	 b e f o r e S h o w D a y . a p p l y ( ( i n s t . i n p u t   ?   i n s t . i n p u t [ 0 ]   :   n u l l ) ,   [ p r i n t D a t e ] )   :   [ t r u e ,   ' ' ] ) ;  
 	 	 	 	 	 	 v a r   o t h e r M o n t h   =   ( p r i n t D a t e . g e t M o n t h ( )   ! =   d r a w M o n t h ) ;  
 	 	 	 	 	 	 v a r   u n s e l e c t a b l e   =   o t h e r M o n t h   | |   ! d a y S e t t i n g s [ 0 ]   | |  
 	 	 	 	 	 	 	 ( m i n D a t e   & &   p r i n t D a t e   <   m i n D a t e )   | |   ( m a x D a t e   & &   p r i n t D a t e   >   m a x D a t e ) ;  
 	 	 	 	 	 	 t b o d y   + =   ' < t d   c l a s s = " '   +  
 	 	 	 	 	 	 	 ( ( d o w   +   f i r s t D a y   +   6 )   %   7   > =   5   ?   '   u i - d a t e p i c k e r - w e e k - e n d '   :   ' ' )   +   / /   h i g h l i g h t   w e e k e n d s  
 	 	 	 	 	 	 	 ( o t h e r M o n t h   ?   '   u i - d a t e p i c k e r - o t h e r - m o n t h '   :   ' ' )   +   / /   h i g h l i g h t   d a y s   f r o m   o t h e r   m o n t h s  
 	 	 	 	 	 	 	 ( ( p r i n t D a t e . g e t T i m e ( )   = =   s e l e c t e d D a t e . g e t T i m e ( )   & &   d r a w M o n t h   = =   i n s t . s e l e c t e d M o n t h   & &   i n s t . _ k e y E v e n t )   | |   / /   u s e r   p r e s s e d   k e y  
 	 	 	 	 	 	 	 ( d e f a u l t D a t e . g e t T i m e ( )   = =   p r i n t D a t e . g e t T i m e ( )   & &   d e f a u l t D a t e . g e t T i m e ( )   = =   s e l e c t e d D a t e . g e t T i m e ( ) )   ?  
 	 	 	 	 	 	 	 / /   o r   d e f a u l t D a t e   i s   c u r r e n t   p r i n t e d D a t e   a n d   d e f a u l t D a t e   i s   s e l e c t e d D a t e  
 	 	 	 	 	 	 	 '   '   +   t h i s . _ d a y O v e r C l a s s   :   ' ' )   +   / /   h i g h l i g h t   s e l e c t e d   d a y  
 	 	 	 	 	 	 	 ( u n s e l e c t a b l e   ?   '   '   +   t h i s . _ u n s e l e c t a b l e C l a s s   +   '   u i - s t a t e - d i s a b l e d ' :   ' ' )   +     / /   h i g h l i g h t   u n s e l e c t a b l e   d a y s  
 	 	 	 	 	 	 	 ( o t h e r M o n t h   & &   ! s h o w O t h e r M o n t h s   ?   ' '   :   '   '   +   d a y S e t t i n g s [ 1 ]   +   / /   h i g h l i g h t   c u s t o m   d a t e s  
 	 	 	 	 	 	 	 ( p r i n t D a t e . g e t T i m e ( )   > =   c u r r e n t D a t e . g e t T i m e ( )   & &   p r i n t D a t e . g e t T i m e ( )   < =   e n d D a t e . g e t T i m e ( )   ?   / /   i n   c u r r e n t   r a n g e  
 	 	 	 	 	 	 	 '   '   +   t h i s . _ c u r r e n t C l a s s   :   ' ' )   +   / /   h i g h l i g h t   s e l e c t e d   d a y  
 	 	 	 	 	 	 	 ( p r i n t D a t e . g e t T i m e ( )   = =   t o d a y . g e t T i m e ( )   ?   '   u i - d a t e p i c k e r - t o d a y '   :   ' ' ) )   +   ' " '   +   / /   h i g h l i g h t   t o d a y   ( i f   d i f f e r e n t )  
 	 	 	 	 	 	 	 ( ( ! o t h e r M o n t h   | |   s h o w O t h e r M o n t h s )   & &   d a y S e t t i n g s [ 2 ]   ?   '   t i t l e = " '   +   d a y S e t t i n g s [ 2 ]   +   ' " '   :   ' ' )   +   / /   c e l l   t i t l e  
 	 	 	 	 	 	 	 ( u n s e l e c t a b l e   ?   ' '   :   '   o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ s e l e c t D a y ( \ ' # '   +  
 	 	 	 	 	 	 	 i n s t . i d   +   ' \ ' , '   +   d r a w M o n t h   +   ' , '   +   d r a w Y e a r   +   ' ,   t h i s ) ; r e t u r n   f a l s e ; " ' )   +   ' > '   +   / /   a c t i o n s  
 	 	 	 	 	 	 	 ( o t h e r M o n t h   ?   ( s h o w O t h e r M o n t h s   ?   p r i n t D a t e . g e t D a t e ( )   :   ' & # x a 0 ; ' )   :   / /   d i s p l a y   f o r   o t h e r   m o n t h s  
 	 	 	 	 	 	 	 ( u n s e l e c t a b l e   ?   ' < s p a n   c l a s s = " u i - s t a t e - d e f a u l t " > '   +   p r i n t D a t e . g e t D a t e ( )   +   ' < / s p a n > '   :   ' < a   c l a s s = " u i - s t a t e - d e f a u l t '   +  
 	 	 	 	 	 	 	 ( p r i n t D a t e . g e t T i m e ( )   = =   t o d a y . g e t T i m e ( )   ?   '   u i - s t a t e - h i g h l i g h t '   :   ' ' )   +  
 	 	 	 	 	 	 	 ( p r i n t D a t e . g e t T i m e ( )   > =   c u r r e n t D a t e . g e t T i m e ( )   & &   p r i n t D a t e . g e t T i m e ( )   < =   e n d D a t e . g e t T i m e ( )   ?   / /   i n   c u r r e n t   r a n g e  
 	 	 	 	 	 	 	 '   u i - s t a t e - a c t i v e '   :   ' ' )   +   / /   h i g h l i g h t   s e l e c t e d   d a y  
 	 	 	 	 	 	 	 ' "   h r e f = " # " > '   +   p r i n t D a t e . g e t D a t e ( )   +   ' < / a > ' ) )   +   ' < / t d > ' ;   / /   d i s p l a y   f o r   t h i s   m o n t h  
 	 	 	 	 	 	 p r i n t D a t e . s e t D a t e ( p r i n t D a t e . g e t D a t e ( )   +   1 ) ;  
 	 	 	 	 	 	 p r i n t D a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( p r i n t D a t e ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 c a l e n d e r   + =   t b o d y   +   ' < / t r > ' ;  
 	 	 	 	 }  
 	 	 	 	 d r a w M o n t h + + ;  
 	 	 	 	 i f   ( d r a w M o n t h   >   1 1 )   {  
 	 	 	 	 	 d r a w M o n t h   =   0 ;  
 	 	 	 	 	 d r a w Y e a r + + ;  
 	 	 	 	 }  
 	 	 	 	 c a l e n d e r   + =   ' < / t b o d y > < / t a b l e > '   +   ( i s M u l t i M o n t h   ?   ' < / d i v > '   +    
 	 	 	 	 	 	 	 ( ( n u m M o n t h s [ 0 ]   >   0   & &   c o l   = =   n u m M o n t h s [ 1 ] - 1 )   ?   ' < d i v   c l a s s = " u i - d a t e p i c k e r - r o w - b r e a k " > < / d i v > '   :   ' ' )   :   ' ' ) ;  
 	 	 	 	 g r o u p   + =   c a l e n d e r ;  
 	 	 	 }  
 	 	 	 h t m l   + =   g r o u p ;  
 	 	 }  
 	 	 h t m l   + =   b u t t o n P a n e l   +   ( $ . b r o w s e r . m s i e   & &   p a r s e I n t ( $ . b r o w s e r . v e r s i o n , 1 0 )   <   7   & &   ! i n s t . i n l i n e   ?  
 	 	 	 ' < i f r a m e   s r c = " j a v a s c r i p t : f a l s e ; "   c l a s s = " u i - d a t e p i c k e r - c o v e r "   f r a m e b o r d e r = " 0 " > < / i f r a m e > '   :   ' ' ) ;  
 	 	 i n s t . _ k e y E v e n t   =   f a l s e ;  
 	 	 r e t u r n   h t m l ;  
 	 } ,  
  
 	 / *   G e n e r a t e   t h e   m o n t h   a n d   y e a r   h e a d e r .   * /  
 	 _ g e n e r a t e M o n t h Y e a r H e a d e r :   f u n c t i o n ( i n s t ,   d r a w M o n t h ,   d r a w Y e a r ,   m i n D a t e ,   m a x D a t e ,  
 	 	 	 s e l e c t e d D a t e ,   s e c o n d a r y ,   m o n t h N a m e s ,   m o n t h N a m e s S h o r t )   {  
 	 	 m i n D a t e   =   ( i n s t . r a n g e S t a r t   & &   m i n D a t e   & &   s e l e c t e d D a t e   <   m i n D a t e   ?   s e l e c t e d D a t e   :   m i n D a t e ) ;  
 	 	 v a r   c h a n g e M o n t h   =   t h i s . _ g e t ( i n s t ,   ' c h a n g e M o n t h ' ) ;  
 	 	 v a r   c h a n g e Y e a r   =   t h i s . _ g e t ( i n s t ,   ' c h a n g e Y e a r ' ) ;  
 	 	 v a r   s h o w M o n t h A f t e r Y e a r   =   t h i s . _ g e t ( i n s t ,   ' s h o w M o n t h A f t e r Y e a r ' ) ;  
 	 	 v a r   h t m l   =   ' < d i v   c l a s s = " u i - d a t e p i c k e r - t i t l e " > ' ;  
 	 	 v a r   m o n t h H t m l   =   ' ' ;  
 	 	 / /   m o n t h   s e l e c t i o n  
 	 	 i f   ( s e c o n d a r y   | |   ! c h a n g e M o n t h )  
 	 	 	 m o n t h H t m l   + =   ' < s p a n   c l a s s = " u i - d a t e p i c k e r - m o n t h " > '   +   m o n t h N a m e s [ d r a w M o n t h ]   +   ' < / s p a n >   ' ;  
 	 	 e l s e   {  
 	 	 	 v a r   i n M i n Y e a r   =   ( m i n D a t e   & &   m i n D a t e . g e t F u l l Y e a r ( )   = =   d r a w Y e a r ) ;  
 	 	 	 v a r   i n M a x Y e a r   =   ( m a x D a t e   & &   m a x D a t e . g e t F u l l Y e a r ( )   = =   d r a w Y e a r ) ;  
 	 	 	 m o n t h H t m l   + =   ' < s e l e c t   c l a s s = " u i - d a t e p i c k e r - m o n t h "   '   +  
 	 	 	 	 ' o n c h a n g e = " D P _ j Q u e r y . d a t e p i c k e r . _ s e l e c t M o n t h Y e a r ( \ ' # '   +   i n s t . i d   +   ' \ ' ,   t h i s ,   \ ' M \ ' ) ; "   '   +  
 	 	 	 	 ' o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ c l i c k M o n t h Y e a r ( \ ' # '   +   i n s t . i d   +   ' \ ' ) ; " '   +  
 	 	 	   	 ' > ' ;  
 	 	 	 f o r   ( v a r   m o n t h   =   0 ;   m o n t h   <   1 2 ;   m o n t h + + )   {  
 	 	 	 	 i f   ( ( ! i n M i n Y e a r   | |   m o n t h   > =   m i n D a t e . g e t M o n t h ( ) )   & &  
 	 	 	 	 	 	 ( ! i n M a x Y e a r   | |   m o n t h   < =   m a x D a t e . g e t M o n t h ( ) ) )  
 	 	 	 	 	 m o n t h H t m l   + =   ' < o p t i o n   v a l u e = " '   +   m o n t h   +   ' " '   +  
 	 	 	 	 	 	 ( m o n t h   = =   d r a w M o n t h   ?   '   s e l e c t e d = " s e l e c t e d " '   :   ' ' )   +  
 	 	 	 	 	 	 ' > '   +   m o n t h N a m e s S h o r t [ m o n t h ]   +   ' < / o p t i o n > ' ;  
 	 	 	 }  
 	 	 	 m o n t h H t m l   + =   ' < / s e l e c t > ' ;  
 	 	 }  
 	 	 i f   ( ! s h o w M o n t h A f t e r Y e a r )  
 	 	 	 h t m l   + =   m o n t h H t m l   +   ( ( s e c o n d a r y   | |   c h a n g e M o n t h   | |   c h a n g e Y e a r )   & &   ( ! ( c h a n g e M o n t h   & &   c h a n g e Y e a r ) )   ?   ' & # x a 0 ; '   :   ' ' ) ;  
 	 	 / /   y e a r   s e l e c t i o n  
 	 	 i f   ( s e c o n d a r y   | |   ! c h a n g e Y e a r )  
 	 	 	 h t m l   + =   ' < s p a n   c l a s s = " u i - d a t e p i c k e r - y e a r " > '   +   d r a w Y e a r   +   ' < / s p a n > ' ;  
 	 	 e l s e   {  
 	 	 	 / /   d e t e r m i n e   r a n g e   o f   y e a r s   t o   d i s p l a y  
 	 	 	 v a r   y e a r s   =   t h i s . _ g e t ( i n s t ,   ' y e a r R a n g e ' ) . s p l i t ( ' : ' ) ;  
 	 	 	 v a r   y e a r   =   0 ;  
 	 	 	 v a r   e n d Y e a r   =   0 ;  
 	 	 	 i f   ( y e a r s . l e n g t h   ! =   2 )   {  
 	 	 	 	 y e a r   =   d r a w Y e a r   -   1 0 ;  
 	 	 	 	 e n d Y e a r   =   d r a w Y e a r   +   1 0 ;  
 	 	 	 }   e l s e   i f   ( y e a r s [ 0 ] . c h a r A t ( 0 )   = =   ' + '   | |   y e a r s [ 0 ] . c h a r A t ( 0 )   = =   ' - ' )   {  
 	 	 	 	 y e a r   =   d r a w Y e a r   +   p a r s e I n t ( y e a r s [ 0 ] ,   1 0 ) ;  
 	 	 	 	 e n d Y e a r   =   d r a w Y e a r   +   p a r s e I n t ( y e a r s [ 1 ] ,   1 0 ) ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 y e a r   =   p a r s e I n t ( y e a r s [ 0 ] ,   1 0 ) ;  
 	 	 	 	 e n d Y e a r   =   p a r s e I n t ( y e a r s [ 1 ] ,   1 0 ) ;  
 	 	 	 }  
 	 	 	 y e a r   =   ( m i n D a t e   ?   M a t h . m a x ( y e a r ,   m i n D a t e . g e t F u l l Y e a r ( ) )   :   y e a r ) ;  
 	 	 	 e n d Y e a r   =   ( m a x D a t e   ?   M a t h . m i n ( e n d Y e a r ,   m a x D a t e . g e t F u l l Y e a r ( ) )   :   e n d Y e a r ) ;  
 	 	 	 h t m l   + =   ' < s e l e c t   c l a s s = " u i - d a t e p i c k e r - y e a r "   '   +  
 	 	 	 	 ' o n c h a n g e = " D P _ j Q u e r y . d a t e p i c k e r . _ s e l e c t M o n t h Y e a r ( \ ' # '   +   i n s t . i d   +   ' \ ' ,   t h i s ,   \ ' Y \ ' ) ; "   '   +  
 	 	 	 	 ' o n c l i c k = " D P _ j Q u e r y . d a t e p i c k e r . _ c l i c k M o n t h Y e a r ( \ ' # '   +   i n s t . i d   +   ' \ ' ) ; " '   +  
 	 	 	 	 ' > ' ;  
 	 	 	 f o r   ( ;   y e a r   < =   e n d Y e a r ;   y e a r + + )   {  
 	 	 	 	 h t m l   + =   ' < o p t i o n   v a l u e = " '   +   y e a r   +   ' " '   +  
 	 	 	 	 	 ( y e a r   = =   d r a w Y e a r   ?   '   s e l e c t e d = " s e l e c t e d " '   :   ' ' )   +  
 	 	 	 	 	 ' > '   +   y e a r   +   ' < / o p t i o n > ' ;  
 	 	 	 }  
 	 	 	 h t m l   + =   ' < / s e l e c t > ' ;  
 	 	 }  
 	 	 i f   ( s h o w M o n t h A f t e r Y e a r )  
 	 	 	 h t m l   + =   ( s e c o n d a r y   | |   c h a n g e M o n t h   | |   c h a n g e Y e a r   ?   ' & # x a 0 ; '   :   ' ' )   +   m o n t h H t m l ;  
 	 	 h t m l   + =   ' < / d i v > ' ;   / /   C l o s e   d a t e p i c k e r _ h e a d e r  
 	 	 r e t u r n   h t m l ;  
 	 } ,  
  
 	 / *   A d j u s t   o n e   o f   t h e   d a t e   s u b - f i e l d s .   * /  
 	 _ a d j u s t I n s t D a t e :   f u n c t i o n ( i n s t ,   o f f s e t ,   p e r i o d )   {  
 	 	 v a r   y e a r   =   i n s t . d r a w Y e a r   +   ( p e r i o d   = =   ' Y '   ?   o f f s e t   :   0 ) ;  
 	 	 v a r   m o n t h   =   i n s t . d r a w M o n t h   +   ( p e r i o d   = =   ' M '   ?   o f f s e t   :   0 ) ;  
 	 	 v a r   d a y   =   M a t h . m i n ( i n s t . s e l e c t e d D a y ,   t h i s . _ g e t D a y s I n M o n t h ( y e a r ,   m o n t h ) )   +  
 	 	 	 ( p e r i o d   = =   ' D '   ?   o f f s e t   :   0 ) ;  
 	 	 v a r   d a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( y e a r ,   m o n t h ,   d a y ) ) ;  
 	 	 / /   e n s u r e   i t   i s   w i t h i n   t h e   b o u n d s   s e t  
 	 	 v a r   m i n D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m i n ' ,   t r u e ) ;  
 	 	 v a r   m a x D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m a x ' ) ;  
 	 	 d a t e   =   ( m i n D a t e   & &   d a t e   <   m i n D a t e   ?   m i n D a t e   :   d a t e ) ;  
 	 	 d a t e   =   ( m a x D a t e   & &   d a t e   >   m a x D a t e   ?   m a x D a t e   :   d a t e ) ;  
 	 	 i n s t . s e l e c t e d D a y   =   d a t e . g e t D a t e ( ) ;  
 	 	 i n s t . d r a w M o n t h   =   i n s t . s e l e c t e d M o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 i n s t . d r a w Y e a r   =   i n s t . s e l e c t e d Y e a r   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 i f   ( p e r i o d   = =   ' M '   | |   p e r i o d   = =   ' Y ' )  
 	 	 	 t h i s . _ n o t i f y C h a n g e ( i n s t ) ;  
 	 } ,  
  
 	 / *   N o t i f y   c h a n g e   o f   m o n t h / y e a r .   * /  
 	 _ n o t i f y C h a n g e :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   o n C h a n g e   =   t h i s . _ g e t ( i n s t ,   ' o n C h a n g e M o n t h Y e a r ' ) ;  
 	 	 i f   ( o n C h a n g e )  
 	 	 	 o n C h a n g e . a p p l y ( ( i n s t . i n p u t   ?   i n s t . i n p u t [ 0 ]   :   n u l l ) ,  
 	 	 	 	 [ i n s t . s e l e c t e d Y e a r ,   i n s t . s e l e c t e d M o n t h   +   1 ,   i n s t ] ) ;  
 	 } ,  
  
 	 / *   D e t e r m i n e   t h e   n u m b e r   o f   m o n t h s   t o   s h o w .   * /  
 	 _ g e t N u m b e r O f M o n t h s :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   n u m M o n t h s   =   t h i s . _ g e t ( i n s t ,   ' n u m b e r O f M o n t h s ' ) ;  
 	 	 r e t u r n   ( n u m M o n t h s   = =   n u l l   ?   [ 1 ,   1 ]   :   ( t y p e o f   n u m M o n t h s   = =   ' n u m b e r '   ?   [ 1 ,   n u m M o n t h s ]   :   n u m M o n t h s ) ) ;  
 	 } ,  
  
 	 / *   D e t e r m i n e   t h e   c u r r e n t   m a x i m u m   d a t e   -   e n s u r e   n o   t i m e   c o m p o n e n t s   a r e   s e t   -   m a y   b e   o v e r r i d d e n   f o r   a   r a n g e .   * /  
 	 _ g e t M i n M a x D a t e :   f u n c t i o n ( i n s t ,   m i n M a x ,   c h e c k R a n g e )   {  
 	 	 v a r   d a t e   =   t h i s . _ d e t e r m i n e D a t e ( t h i s . _ g e t ( i n s t ,   m i n M a x   +   ' D a t e ' ) ,   n u l l ) ;  
 	 	 r e t u r n   ( ! c h e c k R a n g e   | |   ! i n s t . r a n g e S t a r t   ?   d a t e   :  
 	 	 	 ( ! d a t e   | |   i n s t . r a n g e S t a r t   >   d a t e   ?   i n s t . r a n g e S t a r t   :   d a t e ) ) ;  
 	 } ,  
  
 	 / *   F i n d   t h e   n u m b e r   o f   d a y s   i n   a   g i v e n   m o n t h .   * /  
 	 _ g e t D a y s I n M o n t h :   f u n c t i o n ( y e a r ,   m o n t h )   {  
 	 	 r e t u r n   3 2   -   n e w   D a t e ( y e a r ,   m o n t h ,   3 2 ) . g e t D a t e ( ) ;  
 	 } ,  
  
 	 / *   F i n d   t h e   d a y   o f   t h e   w e e k   o f   t h e   f i r s t   o f   a   m o n t h .   * /  
 	 _ g e t F i r s t D a y O f M o n t h :   f u n c t i o n ( y e a r ,   m o n t h )   {  
 	 	 r e t u r n   n e w   D a t e ( y e a r ,   m o n t h ,   1 ) . g e t D a y ( ) ;  
 	 } ,  
  
 	 / *   D e t e r m i n e s   i f   w e   s h o u l d   a l l o w   a   " n e x t / p r e v "   m o n t h   d i s p l a y   c h a n g e .   * /  
 	 _ c a n A d j u s t M o n t h :   f u n c t i o n ( i n s t ,   o f f s e t ,   c u r Y e a r ,   c u r M o n t h )   {  
 	 	 v a r   n u m M o n t h s   =   t h i s . _ g e t N u m b e r O f M o n t h s ( i n s t ) ;  
 	 	 v a r   d a t e   =   t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e (  
 	 	 	 c u r Y e a r ,   c u r M o n t h   +   ( o f f s e t   <   0   ?   o f f s e t   :   n u m M o n t h s [ 1 ] ) ,   1 ) ) ;  
 	 	 i f   ( o f f s e t   <   0 )  
 	 	 	 d a t e . s e t D a t e ( t h i s . _ g e t D a y s I n M o n t h ( d a t e . g e t F u l l Y e a r ( ) ,   d a t e . g e t M o n t h ( ) ) ) ;  
 	 	 r e t u r n   t h i s . _ i s I n R a n g e ( i n s t ,   d a t e ) ;  
 	 } ,  
  
 	 / *   I s   t h e   g i v e n   d a t e   i n   t h e   a c c e p t e d   r a n g e ?   * /  
 	 _ i s I n R a n g e :   f u n c t i o n ( i n s t ,   d a t e )   {  
 	 	 / /   d u r i n g   r a n g e   s e l e c t i o n ,   u s e   m i n i m u m   o f   s e l e c t e d   d a t e   a n d   r a n g e   s t a r t  
 	 	 v a r   n e w M i n D a t e   =   ( ! i n s t . r a n g e S t a r t   ?   n u l l   :   t h i s . _ d a y l i g h t S a v i n g A d j u s t (  
 	 	 	 n e w   D a t e ( i n s t . s e l e c t e d Y e a r ,   i n s t . s e l e c t e d M o n t h ,   i n s t . s e l e c t e d D a y ) ) ) ;  
 	 	 n e w M i n D a t e   =   ( n e w M i n D a t e   & &   i n s t . r a n g e S t a r t   <   n e w M i n D a t e   ?   i n s t . r a n g e S t a r t   :   n e w M i n D a t e ) ;  
 	 	 v a r   m i n D a t e   =   n e w M i n D a t e   | |   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m i n ' ) ;  
 	 	 v a r   m a x D a t e   =   t h i s . _ g e t M i n M a x D a t e ( i n s t ,   ' m a x ' ) ;  
 	 	 r e t u r n   ( ( ! m i n D a t e   | |   d a t e   > =   m i n D a t e )   & &   ( ! m a x D a t e   | |   d a t e   < =   m a x D a t e ) ) ;  
 	 } ,  
  
 	 / *   P r o v i d e   t h e   c o n f i g u r a t i o n   s e t t i n g s   f o r   f o r m a t t i n g / p a r s i n g .   * /  
 	 _ g e t F o r m a t C o n f i g :   f u n c t i o n ( i n s t )   {  
 	 	 v a r   s h o r t Y e a r C u t o f f   =   t h i s . _ g e t ( i n s t ,   ' s h o r t Y e a r C u t o f f ' ) ;  
 	 	 s h o r t Y e a r C u t o f f   =   ( t y p e o f   s h o r t Y e a r C u t o f f   ! =   ' s t r i n g '   ?   s h o r t Y e a r C u t o f f   :  
 	 	 	 n e w   D a t e ( ) . g e t F u l l Y e a r ( )   %   1 0 0   +   p a r s e I n t ( s h o r t Y e a r C u t o f f ,   1 0 ) ) ;  
 	 	 r e t u r n   { s h o r t Y e a r C u t o f f :   s h o r t Y e a r C u t o f f ,  
 	 	 	 d a y N a m e s S h o r t :   t h i s . _ g e t ( i n s t ,   ' d a y N a m e s S h o r t ' ) ,   d a y N a m e s :   t h i s . _ g e t ( i n s t ,   ' d a y N a m e s ' ) ,  
 	 	 	 m o n t h N a m e s S h o r t :   t h i s . _ g e t ( i n s t ,   ' m o n t h N a m e s S h o r t ' ) ,   m o n t h N a m e s :   t h i s . _ g e t ( i n s t ,   ' m o n t h N a m e s ' ) } ;  
 	 } ,  
  
 	 / *   F o r m a t   t h e   g i v e n   d a t e   f o r   d i s p l a y .   * /  
 	 _ f o r m a t D a t e :   f u n c t i o n ( i n s t ,   d a y ,   m o n t h ,   y e a r )   {  
 	 	 i f   ( ! d a y )   {  
 	 	 	 i n s t . c u r r e n t D a y   =   i n s t . s e l e c t e d D a y ;  
 	 	 	 i n s t . c u r r e n t M o n t h   =   i n s t . s e l e c t e d M o n t h ;  
 	 	 	 i n s t . c u r r e n t Y e a r   =   i n s t . s e l e c t e d Y e a r ;  
 	 	 }  
 	 	 v a r   d a t e   =   ( d a y   ?   ( t y p e o f   d a y   = =   ' o b j e c t '   ?   d a y   :  
 	 	 	 t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( y e a r ,   m o n t h ,   d a y ) ) )   :  
 	 	 	 t h i s . _ d a y l i g h t S a v i n g A d j u s t ( n e w   D a t e ( i n s t . c u r r e n t Y e a r ,   i n s t . c u r r e n t M o n t h ,   i n s t . c u r r e n t D a y ) ) ) ;  
 	 	 r e t u r n   t h i s . f o r m a t D a t e ( t h i s . _ g e t ( i n s t ,   ' d a t e F o r m a t ' ) ,   d a t e ,   t h i s . _ g e t F o r m a t C o n f i g ( i n s t ) ) ;  
 	 }  
 } ) ;  
  
 / *   j Q u e r y   e x t e n d   n o w   i g n o r e s   n u l l s !   * /  
 f u n c t i o n   e x t e n d R e m o v e ( t a r g e t ,   p r o p s )   {  
 	 $ . e x t e n d ( t a r g e t ,   p r o p s ) ;  
 	 f o r   ( v a r   n a m e   i n   p r o p s )  
 	 	 i f   ( p r o p s [ n a m e ]   = =   n u l l   | |   p r o p s [ n a m e ]   = =   u n d e f i n e d )  
 	 	 	 t a r g e t [ n a m e ]   =   p r o p s [ n a m e ] ;  
 	 r e t u r n   t a r g e t ;  
 } ;  
  
 / *   D e t e r m i n e   w h e t h e r   a n   o b j e c t   i s   a n   a r r a y .   * /  
 f u n c t i o n   i s A r r a y ( a )   {  
 	 r e t u r n   ( a   & &   ( ( $ . b r o w s e r . s a f a r i   & &   t y p e o f   a   = =   ' o b j e c t '   & &   a . l e n g t h )   | |  
 	 	 ( a . c o n s t r u c t o r   & &   a . c o n s t r u c t o r . t o S t r i n g ( ) . m a t c h ( / \ A r r a y \ ( \ ) / ) ) ) ) ;  
 } ;  
  
 / *   I n v o k e   t h e   d a t e p i c k e r   f u n c t i o n a l i t y .  
       @ p a r a m     o p t i o n s     s t r i n g   -   a   c o m m a n d ,   o p t i o n a l l y   f o l l o w e d   b y   a d d i t i o n a l   p a r a m e t e r s   o r  
                                         O b j e c t   -   s e t t i n g s   f o r   a t t a c h i n g   n e w   d a t e p i c k e r   f u n c t i o n a l i t y  
       @ r e t u r n     j Q u e r y   o b j e c t   * /  
 $ . f n . d a t e p i c k e r   =   f u n c t i o n ( o p t i o n s ) {  
  
 	 / *   I n i t i a l i s e   t h e   d a t e   p i c k e r .   * /  
 	 i f   ( ! $ . d a t e p i c k e r . i n i t i a l i z e d )   {  
 	 	 $ ( d o c u m e n t ) . m o u s e d o w n ( $ . d a t e p i c k e r . _ c h e c k E x t e r n a l C l i c k ) .  
 	 	 	 / * f i n d ( ' b o d y ' ) . a p p e n d ( $ . d a t e p i c k e r . d p D i v ) ; * /  
 	 	 	 f i n d ( ' # f o r - d a t a p i c k e r ' ) . a p p e n d ( $ . d a t e p i c k e r . d p D i v ) ;  
 	 	 $ . d a t e p i c k e r . i n i t i a l i z e d   =   t r u e ;  
 	 }  
  
 	 v a r   o t h e r A r g s   =   A r r a y . p r o t o t y p e . s l i c e . c a l l ( a r g u m e n t s ,   1 ) ;  
 	 i f   ( t y p e o f   o p t i o n s   = =   ' s t r i n g '   & &   ( o p t i o n s   = =   ' i s D i s a b l e d '   | |   o p t i o n s   = =   ' g e t D a t e ' ) )  
 	 	 r e t u r n   $ . d a t e p i c k e r [ ' _ '   +   o p t i o n s   +   ' D a t e p i c k e r ' ] .  
 	 	 	 a p p l y ( $ . d a t e p i c k e r ,   [ t h i s [ 0 ] ] . c o n c a t ( o t h e r A r g s ) ) ;  
 	 i f   ( o p t i o n s   = =   ' o p t i o n '   & &   a r g u m e n t s . l e n g t h   = =   2   & &   t y p e o f   a r g u m e n t s [ 1 ]   = =   ' s t r i n g ' )  
 	 	 r e t u r n   $ . d a t e p i c k e r [ ' _ '   +   o p t i o n s   +   ' D a t e p i c k e r ' ] .  
 	 	 	 a p p l y ( $ . d a t e p i c k e r ,   [ t h i s [ 0 ] ] . c o n c a t ( o t h e r A r g s ) ) ;  
 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 t y p e o f   o p t i o n s   = =   ' s t r i n g '   ?  
 	 	 	 $ . d a t e p i c k e r [ ' _ '   +   o p t i o n s   +   ' D a t e p i c k e r ' ] .  
 	 	 	 	 a p p l y ( $ . d a t e p i c k e r ,   [ t h i s ] . c o n c a t ( o t h e r A r g s ) )   :  
 	 	 	 $ . d a t e p i c k e r . _ a t t a c h D a t e p i c k e r ( t h i s ,   o p t i o n s ) ;  
 	 } ) ;  
 } ;  
  
 $ . d a t e p i c k e r   =   n e w   D a t e p i c k e r ( ) ;   / /   s i n g l e t o n   i n s t a n c e  
 $ . d a t e p i c k e r . i n i t i a l i z e d   =   f a l s e ;  
 $ . d a t e p i c k e r . u u i d   =   n e w   D a t e ( ) . g e t T i m e ( ) ;  
 $ . d a t e p i c k e r . v e r s i o n   =   " 1 . 7 . 2 " ;  
  
 / /   W o r k a r o u n d   f o r   # 4 0 5 5  
 / /   A d d   a n o t h e r   g l o b a l   t o   a v o i d   n o C o n f l i c t   i s s u e s   w i t h   i n l i n e   e v e n t   h a n d l e r s  
 w i n d o w . D P _ j Q u e r y   =   $ ;  
  
 } ) ( j Q u e r y ) ; 
