ÿþ/ * *  
   *  
   *   D a t e   p i c k e r  
   *   A u t h o r :   S t e f a n   P e t r e   w w w . e y e c o n . r o  
   *    
   * /  
 ( f u n c t i o n   ( $ )   {  
 	 v a r   D a t e P i c k e r   =   f u n c t i o n   ( )   {  
 	 	 v a r 	 i d s   =   { } ,  
 	 	 	 t p l   =   {  
 	 	 	 	 w r a p p e r :   ' < d i v   c l a s s = " d a t e p i c k e r " > < d i v   c l a s s = " d a t e p i c k e r B o r d e r T "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r B "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r L "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r R "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r T L "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r T R "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r B L "   / > < d i v   c l a s s = " d a t e p i c k e r B o r d e r B R "   / > < d i v   c l a s s = " d a t e p i c k e r C o n t a i n e r " > < t a b l e   c e l l s p a c i n g = " 0 "   c e l l p a d d i n g = " 0 " > < t b o d y > < t r > < / t r > < / t b o d y > < / t a b l e > < / d i v > < / d i v > ' ,  
 	 	 	 	 h e a d :   [  
 	 	 	 	 	 ' < t d > ' ,  
 	 	 	 	 	 ' < t a b l e   c e l l s p a c i n g = " 0 "   c e l l p a d d i n g = " 0 " > ' ,  
 	 	 	 	 	 	 ' < t h e a d > ' ,  
 	 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r G o P r e v " > < a   h r e f = " # " > < s p a n > < % = p r e v % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h   c o l s p a n = " 6 "   c l a s s = " d a t e p i c k e r M o n t h " > < a   h r e f = " # " > < s p a n > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r G o N e x t " > < a   h r e f = " # " > < s p a n > < % = n e x t % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 	 ' < t r   c l a s s = " d a t e p i c k e r D o W " > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = w e e k % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 1 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 2 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 3 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 4 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 5 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 6 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 	 ' < t h > < s p a n > < % = d a y 7 % > < / s p a n > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < / t h e a d > ' ,  
 	 	 	 	 	 ' < / t a b l e > < / t d > '  
 	 	 	 	 ] ,  
 	 	 	 	 s p a c e   :   ' < t d   c l a s s = " d a t e p i c k e r S p a c e " > < d i v > < / d i v > < / t d > ' ,  
 	 	 	 	 d a y s :   [  
 	 	 	 	 	 ' < t b o d y   c l a s s = " d a t e p i c k e r D a y s " > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 0 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 0 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 1 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 1 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 2 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 2 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 3 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 3 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 4 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 4 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t h   c l a s s = " d a t e p i c k e r W e e k " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . w e e k % > < / s p a n > < / a > < / t h > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 0 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 0 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 1 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 1 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 2 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 2 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 3 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 3 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 4 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 4 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 5 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 5 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c l a s s = " < % = w e e k s [ 5 ] . d a y s [ 6 ] . c l a s s n a m e % > " > < a   h r e f = " # " > < s p a n > < % = w e e k s [ 5 ] . d a y s [ 6 ] . t e x t % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 ' < / t b o d y > '  
 	 	 	 	 ] ,  
 	 	 	 	 m o n t h s :   [  
 	 	 	 	 	 ' < t b o d y   c l a s s = " < % = c l a s s N a m e % > " > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 0 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 1 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 2 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 3 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 4 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 5 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 6 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 7 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 	 ' < t r > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 8 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 9 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 1 0 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 	 ' < t d   c o l s p a n = " 2 " > < a   h r e f = " # " > < s p a n > < % = d a t a [ 1 1 ] % > < / s p a n > < / a > < / t d > ' ,  
 	 	 	 	 	 	 ' < / t r > ' ,  
 	 	 	 	 	 ' < / t b o d y > '  
 	 	 	 	 ]  
 	 	 	 } ,  
 	 	 	 d e f a u l t s   =   {  
 	 	 	 	 f l a t :   f a l s e ,  
 	 	 	 	 s t a r t s :   1 ,  
 	 	 	 	 p r e v :   ' & # 9 6 6 4 ; ' ,  
 	 	 	 	 n e x t :   ' & # 9 6 5 4 ; ' ,  
 	 	 	 	 l a s t S e l :   f a l s e ,  
 	 	 	 	 m o d e :   ' s i n g l e ' ,  
 	 	 	 	 c a l e n d a r s :   1 ,  
 	 	 	 	 f o r m a t :   ' d - m - Y ' ,  
 	 	 	 	 p o s i t i o n :   ' b o t t o m ' ,  
 	 	 	 	 e v e n t N a m e :   ' c l i c k ' ,  
 	 	 	 	 o n R e n d e r :   f u n c t i o n ( ) { r e t u r n   { } ; } ,  
 	 	 	 	 o n C h a n g e :   f u n c t i o n ( ) { r e t u r n   t r u e ; } ,  
 	 	 	 	 o n S h o w :   f u n c t i o n ( ) { r e t u r n   t r u e ; } ,  
 	 	 	 	 o n B e f o r e S h o w :   f u n c t i o n ( ) { r e t u r n   t r u e ; } ,  
 	 	 	 	 o n H i d e :   f u n c t i o n ( ) { r e t u r n   t r u e ; } ,  
 	 	 	 	 l o c a l e :   {  
 	 	 	 	 	 d a y s :   [ " C h ç  n h ­t " ,   " T h é  2 " ,   " T h é  3 " ,   " T h é  4 " ,   " T h é  5 " ,   " T h é  6 " ,   " T h é  7 " ,   " C h ç  n h ­t " ] ,  
 	 	 	 	 	 d a y s S h o r t :   [ " C N " ,   " T 2 " ,   " T 3 " ,   " T 4 " ,   " T 5 " ,   " T 6 " ,   " T 7 " ,   " C N " ] ,  
 	 	 	 	 	 d a y s M i n :   [ " C N " ,   " T 2 " ,   " T 3 " ,   " T 4 " ,   " T 5 " ,   " T 6 " ,   " T 7 " ,   " C N " ] ,  
 	 	 	 	 	 m o n t h s :   [ " T h á n g   1 " ,   " T h á n g   2 " ,   " T h á n g   3 " ,   " T h á n g   4 " ,   " T h á n g   5 " ,   " T h á n g   6 " ,   " T h á n g   7 " ,   " T h á n g   8 " ,   " T h á n g   9 " ,   " T h á n g   1 0 " ,   " T h á n g   1 1 " ,   " T h á n g   1 2 " ] ,  
 	 	 	 	 	 m o n t h s S h o r t :   [ " T h 1 " ,   " T h 2 " ,   " T h 3 " ,   " T h 4 " ,   " T h 5 " ,   " T h 6 " ,   " T h 7 " ,   " T h 8 " ,   " T h 9 " ,   " T h 1 0 " ,   " T h 1 1 " ,   " T h 1 2 " ] ,  
 	 	 	 	 	 w e e k M i n :   ' w k '  
 	 	 	 	 }  
 	 	 	 } ,  
 	 	 	 f i l l   =   f u n c t i o n ( e l )   {  
 	 	 	 	 v a r   o p t i o n s   =   $ ( e l ) . d a t a ( ' d a t e p i c k e r ' ) ;  
 	 	 	 	 v a r   c a l   =   $ ( e l ) ;  
 	 	 	 	 v a r   c u r r e n t C a l   =   M a t h . f l o o r ( o p t i o n s . c a l e n d a r s / 2 ) ,   d a t e ,   d a t a ,   d o w ,   m o n t h ,   c n t   =   0 ,   w e e k ,   d a y s ,   i n d i c ,   i n d i c 2 ,   h t m l ,   t b l C a l ;  
 	 	 	 	 c a l . f i n d ( ' t d > t a b l e   t b o d y ' ) . r e m o v e ( ) ;  
 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   o p t i o n s . c a l e n d a r s ;   i + + )   {  
 	 	 	 	 	 d a t e   =   n e w   D a t e ( o p t i o n s . c u r r e n t ) ;  
 	 	 	 	 	 d a t e . a d d M o n t h s ( - c u r r e n t C a l   +   i ) ;  
 	 	 	 	 	 t b l C a l   =   c a l . f i n d ( ' t a b l e ' ) . e q ( i + 1 ) ;  
 	 	 	 	 	 s w i t c h   ( t b l C a l [ 0 ] . c l a s s N a m e )   {  
 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w D a y s ' :  
 	 	 	 	 	 	 	 d o w   =   f o r m a t D a t e ( d a t e ,   ' B ,   Y ' ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w M o n t h s ' :  
 	 	 	 	 	 	 	 d o w   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w Y e a r s ' :  
 	 	 	 	 	 	 	 d o w   =   ( d a t e . g e t F u l l Y e a r ( ) - 6 )   +   '   -   '   +   ( d a t e . g e t F u l l Y e a r ( ) + 5 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }    
 	 	 	 	 	 t b l C a l . f i n d ( ' t h e a d   t r : f i r s t   t h : e q ( 1 )   s p a n ' ) . t e x t ( d o w ) ;  
 	 	 	 	 	 d o w   =   d a t e . g e t F u l l Y e a r ( ) - 6 ;  
 	 	 	 	 	 d a t a   =   {  
 	 	 	 	 	 	 d a t a :   [ ] ,  
 	 	 	 	 	 	 c l a s s N a m e :   ' d a t e p i c k e r Y e a r s '  
 	 	 	 	 	 }  
 	 	 	 	 	 f o r   (   v a r   j   =   0 ;   j   <   1 2 ;   j + + )   {  
 	 	 	 	 	 	 d a t a . d a t a . p u s h ( d o w   +   j ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 h t m l   =   t m p l ( t p l . m o n t h s . j o i n ( ' ' ) ,   d a t a ) ;  
 	 	 	 	 	 d a t e . s e t D a t e ( 1 ) ;  
 	 	 	 	 	 d a t a   =   { w e e k s : [ ] ,   t e s t :   1 0 } ;  
 	 	 	 	 	 m o n t h   =   d a t e . g e t M o n t h ( ) ;  
 	 	 	 	 	 v a r   d o w   =   ( d a t e . g e t D a y ( )   -   o p t i o n s . s t a r t s )   %   7 ;  
 	 	 	 	 	 d a t e . a d d D a y s ( - ( d o w   +   ( d o w   <   0   ?   7   :   0 ) ) ) ;  
 	 	 	 	 	 w e e k   =   - 1 ;  
 	 	 	 	 	 c n t   =   0 ;  
 	 	 	 	 	 w h i l e   ( c n t   <   4 2 )   {  
 	 	 	 	 	 	 i n d i c   =   p a r s e I n t ( c n t / 7 , 1 0 ) ;  
 	 	 	 	 	 	 i n d i c 2   =   c n t % 7 ;  
 	 	 	 	 	 	 i f   ( ! d a t a . w e e k s [ i n d i c ] )   {  
 	 	 	 	 	 	 	 w e e k   =   d a t e . g e t W e e k N u m b e r ( ) ;  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ]   =   {  
 	 	 	 	 	 	 	 	 w e e k :   w e e k ,  
 	 	 	 	 	 	 	 	 d a y s :   [ ]  
 	 	 	 	 	 	 	 } ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ]   =   {  
 	 	 	 	 	 	 	 t e x t :   d a t e . g e t D a t e ( ) ,  
 	 	 	 	 	 	 	 c l a s s n a m e :   [ ]  
 	 	 	 	 	 	 } ;  
 	 	 	 	 	 	 i f   ( m o n t h   ! =   d a t e . g e t M o n t h ( ) )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( ' d a t e p i c k e r N o t I n M o n t h ' ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( d a t e . g e t D a y ( )   = =   0 )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( ' d a t e p i c k e r S u n d a y ' ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( d a t e . g e t D a y ( )   = =   6 )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( ' d a t e p i c k e r S a t u r d a y ' ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 v a r   f r o m U s e r   =   o p t i o n s . o n R e n d e r ( d a t e ) ;  
 	 	 	 	 	 	 v a r   v a l   =   d a t e . v a l u e O f ( ) ;  
 	 	 	 	 	 	 i f   ( f r o m U s e r . s e l e c t e d   | |   o p t i o n s . d a t e   = =   v a l   | |   $ . i n A r r a y ( v a l ,   o p t i o n s . d a t e )   >   - 1   | |   ( o p t i o n s . m o d e   = =   ' r a n g e '   & &   v a l   > =   o p t i o n s . d a t e [ 0 ]   & &   v a l   < =   o p t i o n s . d a t e [ 1 ] ) )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( ' d a t e p i c k e r S e l e c t e d ' ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( f r o m U s e r . d i s a b l e d )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( ' d a t e p i c k e r D i s a b l e d ' ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( f r o m U s e r . c l a s s N a m e )   {  
 	 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . p u s h ( f r o m U s e r . c l a s s N a m e ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e   =   d a t a . w e e k s [ i n d i c ] . d a y s [ i n d i c 2 ] . c l a s s n a m e . j o i n ( '   ' ) ;  
 	 	 	 	 	 	 c n t + + ;  
 	 	 	 	 	 	 d a t e . a d d D a y s ( 1 ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 h t m l   =   t m p l ( t p l . d a y s . j o i n ( ' ' ) ,   d a t a )   +   h t m l ;  
 	 	 	 	 	 d a t a   =   {  
 	 	 	 	 	 	 d a t a :   o p t i o n s . l o c a l e . m o n t h s S h o r t ,  
 	 	 	 	 	 	 c l a s s N a m e :   ' d a t e p i c k e r M o n t h s '  
 	 	 	 	 	 } ;  
 	 	 	 	 	 h t m l   =   t m p l ( t p l . m o n t h s . j o i n ( ' ' ) ,   d a t a )   +   h t m l ;  
 	 	 	 	 	 t b l C a l . a p p e n d ( h t m l ) ;  
 	 	 	 	 }  
 	 	 	 } ,  
 	 	 	 p a r s e D a t e   =   f u n c t i o n   ( d a t e ,   f o r m a t )   {  
 	 	 	 	 i f   ( d a t e . c o n s t r u c t o r   = =   D a t e )   {  
 	 	 	 	 	 r e t u r n   n e w   D a t e ( d a t e ) ;  
 	 	 	 	 }  
 	 	 	 	 v a r   p a r t s   =   d a t e . s p l i t ( / \ W + / ) ;  
 	 	 	 	 v a r   a g a i n s t   =   f o r m a t . s p l i t ( / \ W + / ) ,   d ,   m ,   y ,   h ,   m i n ,   n o w   =   n e w   D a t e ( ) ;  
 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   p a r t s . l e n g t h ;   i + + )   {  
 	 	 	 	 	 s w i t c h   ( a g a i n s t [ i ] )   {  
 	 	 	 	 	 	 c a s e   ' d ' :  
 	 	 	 	 	 	 c a s e   ' e ' :  
 	 	 	 	 	 	 	 d   =   p a r s e I n t ( p a r t s [ i ] , 1 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' m ' :  
 	 	 	 	 	 	 	 m   =   p a r s e I n t ( p a r t s [ i ] ,   1 0 )   -   1 ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' Y ' :  
 	 	 	 	 	 	 c a s e   ' y ' :  
 	 	 	 	 	 	 	 y   =   p a r s e I n t ( p a r t s [ i ] ,   1 0 ) ;  
 	 	 	 	 	 	 	 y   + =   y   >   1 0 0   ?   0   :   ( y   <   2 9   ?   2 0 0 0   :   1 9 0 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' H ' :  
 	 	 	 	 	 	 c a s e   ' I ' :  
 	 	 	 	 	 	 c a s e   ' k ' :  
 	 	 	 	 	 	 c a s e   ' l ' :  
 	 	 	 	 	 	 	 h   =   p a r s e I n t ( p a r t s [ i ] ,   1 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' P ' :  
 	 	 	 	 	 	 c a s e   ' p ' :  
 	 	 	 	 	 	 	 i f   ( / p m / i . t e s t ( p a r t s [ i ] )   & &   h   <   1 2 )   {  
 	 	 	 	 	 	 	 	 h   + =   1 2 ;  
 	 	 	 	 	 	 	 }   e l s e   i f   ( / a m / i . t e s t ( p a r t s [ i ] )   & &   h   > =   1 2 )   {  
 	 	 	 	 	 	 	 	 h   - =   1 2 ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' M ' :  
 	 	 	 	 	 	 	 m i n   =   p a r s e I n t ( p a r t s [ i ] ,   1 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   n e w   D a t e (  
 	 	 	 	 	 y | | n o w . g e t F u l l Y e a r ( ) ,  
 	 	 	 	 	 m | | n o w . g e t M o n t h ( ) ,  
 	 	 	 	 	 d | | n o w . g e t D a t e ( ) ,  
 	 	 	 	 	 h | | n o w . g e t H o u r s ( ) ,  
 	 	 	 	 	 m i n | | n o w . g e t M i n u t e s ( ) ,  
 	 	 	 	 	 0  
 	 	 	 	 ) ;  
 	 	 	 } ,  
 	 	 	 f o r m a t D a t e   =   f u n c t i o n ( d a t e ,   f o r m a t )   {  
 	 	 	 	 v a r   m   =   d a t e . g e t M o n t h ( ) ;  
 	 	 	 	 v a r   d   =   d a t e . g e t D a t e ( ) ;  
 	 	 	 	 v a r   y   =   d a t e . g e t F u l l Y e a r ( ) ;  
 	 	 	 	 v a r   w n   =   d a t e . g e t W e e k N u m b e r ( ) ;  
 	 	 	 	 v a r   w   =   d a t e . g e t D a y ( ) ;  
 	 	 	 	 v a r   s   =   { } ;  
 	 	 	 	 v a r   h r   =   d a t e . g e t H o u r s ( ) ;  
 	 	 	 	 v a r   p m   =   ( h r   > =   1 2 ) ;  
 	 	 	 	 v a r   i r   =   ( p m )   ?   ( h r   -   1 2 )   :   h r ;  
 	 	 	 	 v a r   d y   =   d a t e . g e t D a y O f Y e a r ( ) ;  
 	 	 	 	 i f   ( i r   = =   0 )   {  
 	 	 	 	 	 i r   =   1 2 ;  
 	 	 	 	 }  
 	 	 	 	 v a r   m i n   =   d a t e . g e t M i n u t e s ( ) ;  
 	 	 	 	 v a r   s e c   =   d a t e . g e t S e c o n d s ( ) ;  
 	 	 	 	 v a r   p a r t s   =   f o r m a t . s p l i t ( ' ' ) ,   p a r t ;  
 	 	 	 	 f o r   (   v a r   i   =   0 ;   i   <   p a r t s . l e n g t h ;   i + +   )   {  
 	 	 	 	 	 p a r t   =   p a r t s [ i ] ;  
 	 	 	 	 	 s w i t c h   ( p a r t s [ i ] )   {  
 	 	 	 	 	 	 c a s e   ' a ' :  
 	 	 	 	 	 	 	 p a r t   =   d a t e . g e t D a y N a m e ( ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' A ' :  
 	 	 	 	 	 	 	 p a r t   =   d a t e . g e t D a y N a m e ( t r u e ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' b ' :  
 	 	 	 	 	 	 	 p a r t   =   d a t e . g e t M o n t h N a m e ( ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' B ' :  
 	 	 	 	 	 	 	 p a r t   =   d a t e . g e t M o n t h N a m e ( t r u e ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' C ' :  
 	 	 	 	 	 	 	 p a r t   =   1   +   M a t h . f l o o r ( y   /   1 0 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' d ' :  
 	 	 	 	 	 	 	 p a r t   =   ( d   <   1 0 )   ?   ( " 0 "   +   d )   :   d ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' e ' :  
 	 	 	 	 	 	 	 p a r t   =   d ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' H ' :  
 	 	 	 	 	 	 	 p a r t   =   ( h r   <   1 0 )   ?   ( " 0 "   +   h r )   :   h r ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' I ' :  
 	 	 	 	 	 	 	 p a r t   =   ( i r   <   1 0 )   ?   ( " 0 "   +   i r )   :   i r ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' j ' :  
 	 	 	 	 	 	 	 p a r t   =   ( d y   <   1 0 0 )   ?   ( ( d y   <   1 0 )   ?   ( " 0 0 "   +   d y )   :   ( " 0 "   +   d y ) )   :   d y ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' k ' :  
 	 	 	 	 	 	 	 p a r t   =   h r ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' l ' :  
 	 	 	 	 	 	 	 p a r t   =   i r ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' m ' :  
 	 	 	 	 	 	 	 p a r t   =   ( m   <   9 )   ?   ( " 0 "   +   ( 1 + m ) )   :   ( 1 + m ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' M ' :  
 	 	 	 	 	 	 	 p a r t   =   ( m i n   <   1 0 )   ?   ( " 0 "   +   m i n )   :   m i n ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' p ' :  
 	 	 	 	 	 	 c a s e   ' P ' :  
 	 	 	 	 	 	 	 p a r t   =   p m   ?   " P M "   :   " A M " ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' s ' :  
 	 	 	 	 	 	 	 p a r t   =   M a t h . f l o o r ( d a t e . g e t T i m e ( )   /   1 0 0 0 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' S ' :  
 	 	 	 	 	 	 	 p a r t   =   ( s e c   <   1 0 )   ?   ( " 0 "   +   s e c )   :   s e c ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' u ' :  
 	 	 	 	 	 	 	 p a r t   =   w   +   1 ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' w ' :  
 	 	 	 	 	 	 	 p a r t   =   w ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' y ' :  
 	 	 	 	 	 	 	 p a r t   =   ( ' '   +   y ) . s u b s t r ( 2 ,   2 ) ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' Y ' :  
 	 	 	 	 	 	 	 p a r t   =   y ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 	 p a r t s [ i ]   =   p a r t ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   p a r t s . j o i n ( ' ' ) ;  
 	 	 	 } ,  
 	 	 	 e x t e n d D a t e   =   f u n c t i o n ( o p t i o n s )   {  
 	 	 	 	 i f   ( D a t e . p r o t o t y p e . t e m p D a t e )   {  
 	 	 	 	 	 r e t u r n ;  
 	 	 	 	 }  
 	 	 	 	 D a t e . p r o t o t y p e . t e m p D a t e   =   n u l l ;  
 	 	 	 	 D a t e . p r o t o t y p e . m o n t h s   =   o p t i o n s . m o n t h s ;  
 	 	 	 	 D a t e . p r o t o t y p e . m o n t h s S h o r t   =   o p t i o n s . m o n t h s S h o r t ;  
 	 	 	 	 D a t e . p r o t o t y p e . d a y s   =   o p t i o n s . d a y s ;  
 	 	 	 	 D a t e . p r o t o t y p e . d a y s S h o r t   =   o p t i o n s . d a y s S h o r t ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t M o n t h N a m e   =   f u n c t i o n ( f u l l N a m e )   {  
 	 	 	 	 	 r e t u r n   t h i s [ f u l l N a m e   ?   ' m o n t h s '   :   ' m o n t h s S h o r t ' ] [ t h i s . g e t M o n t h ( ) ] ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t D a y N a m e   =   f u n c t i o n ( f u l l N a m e )   {  
 	 	 	 	 	 r e t u r n   t h i s [ f u l l N a m e   ?   ' d a y s '   :   ' d a y s S h o r t ' ] [ t h i s . g e t D a y ( ) ] ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . a d d D a y s   =   f u n c t i o n   ( n )   {  
 	 	 	 	 	 t h i s . s e t D a t e ( t h i s . g e t D a t e ( )   +   n ) ;  
 	 	 	 	 	 t h i s . t e m p D a t e   =   t h i s . g e t D a t e ( ) ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . a d d M o n t h s   =   f u n c t i o n   ( n )   {  
 	 	 	 	 	 i f   ( t h i s . t e m p D a t e   = =   n u l l )   {  
 	 	 	 	 	 	 t h i s . t e m p D a t e   =   t h i s . g e t D a t e ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 t h i s . s e t D a t e ( 1 ) ;  
 	 	 	 	 	 t h i s . s e t M o n t h ( t h i s . g e t M o n t h ( )   +   n ) ;  
 	 	 	 	 	 t h i s . s e t D a t e ( M a t h . m i n ( t h i s . t e m p D a t e ,   t h i s . g e t M a x D a y s ( ) ) ) ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . a d d Y e a r s   =   f u n c t i o n   ( n )   {  
 	 	 	 	 	 i f   ( t h i s . t e m p D a t e   = =   n u l l )   {  
 	 	 	 	 	 	 t h i s . t e m p D a t e   =   t h i s . g e t D a t e ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 t h i s . s e t D a t e ( 1 ) ;  
 	 	 	 	 	 t h i s . s e t F u l l Y e a r ( t h i s . g e t F u l l Y e a r ( )   +   n ) ;  
 	 	 	 	 	 t h i s . s e t D a t e ( M a t h . m i n ( t h i s . t e m p D a t e ,   t h i s . g e t M a x D a y s ( ) ) ) ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t M a x D a y s   =   f u n c t i o n ( )   {  
 	 	 	 	 	 v a r   t m p D a t e   =   n e w   D a t e ( D a t e . p a r s e ( t h i s ) ) ,  
 	 	 	 	 	 	 d   =   2 8 ,   m ;  
 	 	 	 	 	 m   =   t m p D a t e . g e t M o n t h ( ) ;  
 	 	 	 	 	 d   =   2 8 ;  
 	 	 	 	 	 w h i l e   ( t m p D a t e . g e t M o n t h ( )   = =   m )   {  
 	 	 	 	 	 	 d   + + ;  
 	 	 	 	 	 	 t m p D a t e . s e t D a t e ( d ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 r e t u r n   d   -   1 ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t F i r s t D a y   =   f u n c t i o n ( )   {  
 	 	 	 	 	 v a r   t m p D a t e   =   n e w   D a t e ( D a t e . p a r s e ( t h i s ) ) ;  
 	 	 	 	 	 t m p D a t e . s e t D a t e ( 1 ) ;  
 	 	 	 	 	 r e t u r n   t m p D a t e . g e t D a y ( ) ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t W e e k N u m b e r   =   f u n c t i o n ( )   {  
 	 	 	 	 	 v a r   t e m p D a t e   =   n e w   D a t e ( t h i s ) ;  
 	 	 	 	 	 t e m p D a t e . s e t D a t e ( t e m p D a t e . g e t D a t e ( )   -   ( t e m p D a t e . g e t D a y ( )   +   6 )   %   7   +   3 ) ;  
 	 	 	 	 	 v a r   d m s   =   t e m p D a t e . v a l u e O f ( ) ;  
 	 	 	 	 	 t e m p D a t e . s e t M o n t h ( 0 ) ;  
 	 	 	 	 	 t e m p D a t e . s e t D a t e ( 4 ) ;  
 	 	 	 	 	 r e t u r n   M a t h . r o u n d ( ( d m s   -   t e m p D a t e . v a l u e O f ( ) )   /   ( 6 0 4 8 0 0 0 0 0 ) )   +   1 ;  
 	 	 	 	 } ;  
 	 	 	 	 D a t e . p r o t o t y p e . g e t D a y O f Y e a r   =   f u n c t i o n ( )   {  
 	 	 	 	 	 v a r   n o w   =   n e w   D a t e ( t h i s . g e t F u l l Y e a r ( ) ,   t h i s . g e t M o n t h ( ) ,   t h i s . g e t D a t e ( ) ,   0 ,   0 ,   0 ) ;  
 	 	 	 	 	 v a r   t h e n   =   n e w   D a t e ( t h i s . g e t F u l l Y e a r ( ) ,   0 ,   0 ,   0 ,   0 ,   0 ) ;  
 	 	 	 	 	 v a r   t i m e   =   n o w   -   t h e n ;  
 	 	 	 	 	 r e t u r n   M a t h . f l o o r ( t i m e   /   2 4 * 6 0 * 6 0 * 1 0 0 0 ) ;  
 	 	 	 	 } ;  
 	 	 	 } ,  
 	 	 	 l a y o u t   =   f u n c t i o n   ( e l )   {  
 	 	 	 	 v a r   o p t i o n s   =   $ ( e l ) . d a t a ( ' d a t e p i c k e r ' ) ;  
 	 	 	 	 v a r   c a l   =   $ ( ' # '   +   o p t i o n s . i d ) ;  
 	 	 	 	 i f   ( ! o p t i o n s . e x t r a H e i g h t )   {  
 	 	 	 	 	 v a r   d i v s   =   $ ( e l ) . f i n d ( ' d i v ' ) ;  
 	 	 	 	 	 o p t i o n s . e x t r a H e i g h t   =   d i v s . g e t ( 0 ) . o f f s e t H e i g h t   +   d i v s . g e t ( 1 ) . o f f s e t H e i g h t ;  
 	 	 	 	 	 o p t i o n s . e x t r a W i d t h   =   d i v s . g e t ( 2 ) . o f f s e t W i d t h   +   d i v s . g e t ( 3 ) . o f f s e t W i d t h ;  
 	 	 	 	 }  
 	 	 	 	 v a r   t b l   =   c a l . f i n d ( ' t a b l e : f i r s t ' ) . g e t ( 0 ) ;  
 	 	 	 	 v a r   w i d t h   =   t b l . o f f s e t W i d t h ;  
 	 	 	 	 v a r   h e i g h t   =   t b l . o f f s e t H e i g h t ;  
 	 	 	 	 c a l . c s s ( {  
 	 	 	 	 	 w i d t h :   w i d t h   +   o p t i o n s . e x t r a W i d t h   +   ' p x ' ,  
 	 	 	 	 	 h e i g h t :   h e i g h t   +   o p t i o n s . e x t r a H e i g h t   +   ' p x '  
 	 	 	 	 } ) . f i n d ( ' d i v . d a t e p i c k e r C o n t a i n e r ' ) . c s s ( {  
 	 	 	 	 	 w i d t h :   w i d t h   +   ' p x ' ,  
 	 	 	 	 	 h e i g h t :   h e i g h t   +   ' p x '  
 	 	 	 	 } ) ;  
 	 	 	 } ,  
 	 	 	 c l i c k   =   f u n c t i o n ( e v )   {  
 	 	 	 	 i f   ( $ ( e v . t a r g e t ) . i s ( ' s p a n ' ) )   {  
 	 	 	 	 	 e v . t a r g e t   =   e v . t a r g e t . p a r e n t N o d e ;  
 	 	 	 	 }  
 	 	 	 	 v a r   e l   =   $ ( e v . t a r g e t ) ;  
 	 	 	 	 i f   ( e l . i s ( ' a ' ) )   {  
 	 	 	 	 	 e v . t a r g e t . b l u r ( ) ;  
 	 	 	 	 	 i f   ( e l . h a s C l a s s ( ' d a t e p i c k e r D i s a b l e d ' ) )   {  
 	 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 	 }  
 	 	 	 	 	 v a r   o p t i o n s   =   $ ( t h i s ) . d a t a ( ' d a t e p i c k e r ' ) ;  
 	 	 	 	 	 v a r   p a r e n t E l   =   e l . p a r e n t ( ) ;  
 	 	 	 	 	 v a r   t b l E l   =   p a r e n t E l . p a r e n t ( ) . p a r e n t ( ) . p a r e n t ( ) ;  
 	 	 	 	 	 v a r   t b l I n d e x   =   $ ( ' t a b l e ' ,   t h i s ) . i n d e x ( t b l E l . g e t ( 0 ) )   -   1 ;  
 	 	 	 	 	 v a r   t m p   =   n e w   D a t e ( o p t i o n s . c u r r e n t ) ;  
 	 	 	 	 	 v a r   c h a n g e d   =   f a l s e ;  
 	 	 	 	 	 v a r   f i l l I t   =   f a l s e ;  
 	 	 	 	 	 i f   ( p a r e n t E l . i s ( ' t h ' ) )   {  
 	 	 	 	 	 	 i f   ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r W e e k ' )   & &   o p t i o n s . m o d e   = =   ' r a n g e '   & &   ! p a r e n t E l . n e x t ( ) . h a s C l a s s ( ' d a t e p i c k e r D i s a b l e d ' ) )   {  
 	 	 	 	 	 	 	 v a r   v a l   =   p a r s e I n t ( p a r e n t E l . n e x t ( ) . t e x t ( ) ,   1 0 ) ;  
 	 	 	 	 	 	 	 t m p . a d d M o n t h s ( t b l I n d e x   -   M a t h . f l o o r ( o p t i o n s . c a l e n d a r s / 2 ) ) ;  
 	 	 	 	 	 	 	 i f   ( p a r e n t E l . n e x t ( ) . h a s C l a s s ( ' d a t e p i c k e r N o t I n M o n t h ' ) )   {  
 	 	 	 	 	 	 	 	 t m p . a d d M o n t h s ( v a l   >   1 5   ?   - 1   :   1 ) ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 t m p . s e t D a t e ( v a l ) ;  
 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 0 ]   =   ( t m p . s e t H o u r s ( 0 , 0 , 0 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 t m p . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ;  
 	 	 	 	 	 	 	 t m p . a d d D a y s ( 6 ) ;  
 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 1 ]   =   t m p . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 f i l l I t   =   t r u e ;  
 	 	 	 	 	 	 	 c h a n g e d   =   t r u e ;  
 	 	 	 	 	 	 	 o p t i o n s . l a s t S e l   =   f a l s e ;  
 	 	 	 	 	 	 }   e l s e   i f   ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r M o n t h ' ) )   {  
 	 	 	 	 	 	 	 t m p . a d d M o n t h s ( t b l I n d e x   -   M a t h . f l o o r ( o p t i o n s . c a l e n d a r s / 2 ) ) ;  
 	 	 	 	 	 	 	 s w i t c h   ( t b l E l . g e t ( 0 ) . c l a s s N a m e )   {  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w D a y s ' :  
 	 	 	 	 	 	 	 	 	 t b l E l . g e t ( 0 ) . c l a s s N a m e   =   ' d a t e p i c k e r V i e w M o n t h s ' ;  
 	 	 	 	 	 	 	 	 	 e l . f i n d ( ' s p a n ' ) . t e x t ( t m p . g e t F u l l Y e a r ( ) ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w M o n t h s ' :  
 	 	 	 	 	 	 	 	 	 t b l E l . g e t ( 0 ) . c l a s s N a m e   =   ' d a t e p i c k e r V i e w Y e a r s ' ;  
 	 	 	 	 	 	 	 	 	 e l . f i n d ( ' s p a n ' ) . t e x t ( ( t m p . g e t F u l l Y e a r ( ) - 6 )   +   '   -   '   +   ( t m p . g e t F u l l Y e a r ( ) + 5 ) ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w Y e a r s ' :  
 	 	 	 	 	 	 	 	 	 t b l E l . g e t ( 0 ) . c l a s s N a m e   =   ' d a t e p i c k e r V i e w D a y s ' ;  
 	 	 	 	 	 	 	 	 	 e l . f i n d ( ' s p a n ' ) . t e x t ( f o r m a t D a t e ( t m p ,   ' B ,   Y ' ) ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }   e l s e   i f   ( p a r e n t E l . p a r e n t ( ) . p a r e n t ( ) . i s ( ' t h e a d ' ) )   {  
 	 	 	 	 	 	 	 s w i t c h   ( t b l E l . g e t ( 0 ) . c l a s s N a m e )   {  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w D a y s ' :  
 	 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . a d d M o n t h s ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r G o P r e v ' )   ?   - 1   :   1 ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w M o n t h s ' :  
 	 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . a d d Y e a r s ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r G o P r e v ' )   ?   - 1   :   1 ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w Y e a r s ' :  
 	 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . a d d Y e a r s ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r G o P r e v ' )   ?   - 1 2   :   1 2 ) ;  
 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 f i l l I t   =   t r u e ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }   e l s e   i f   ( p a r e n t E l . i s ( ' t d ' )   & &   ! p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r D i s a b l e d ' ) )   {  
 	 	 	 	 	 	 s w i t c h   ( t b l E l . g e t ( 0 ) . c l a s s N a m e )   {  
 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w M o n t h s ' :  
 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . s e t M o n t h ( t b l E l . f i n d ( ' t b o d y . d a t e p i c k e r M o n t h s   t d ' ) . i n d e x ( p a r e n t E l ) ) ;  
 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . s e t F u l l Y e a r ( p a r s e I n t ( t b l E l . f i n d ( ' t h e a d   t h . d a t e p i c k e r M o n t h   s p a n ' ) . t e x t ( ) ,   1 0 ) ) ;  
 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . a d d M o n t h s ( M a t h . f l o o r ( o p t i o n s . c a l e n d a r s / 2 )   -   t b l I n d e x ) ;  
 	 	 	 	 	 	 	 	 t b l E l . g e t ( 0 ) . c l a s s N a m e   =   ' d a t e p i c k e r V i e w D a y s ' ;  
 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 c a s e   ' d a t e p i c k e r V i e w Y e a r s ' :  
 	 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t . s e t F u l l Y e a r ( p a r s e I n t ( e l . t e x t ( ) ,   1 0 ) ) ;  
 	 	 	 	 	 	 	 	 t b l E l . g e t ( 0 ) . c l a s s N a m e   =   ' d a t e p i c k e r V i e w M o n t h s ' ;  
 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 	 	 v a r   v a l   =   p a r s e I n t ( e l . t e x t ( ) ,   1 0 ) ;  
 	 	 	 	 	 	 	 	 t m p . a d d M o n t h s ( t b l I n d e x   -   M a t h . f l o o r ( o p t i o n s . c a l e n d a r s / 2 ) ) ;  
 	 	 	 	 	 	 	 	 i f   ( p a r e n t E l . h a s C l a s s ( ' d a t e p i c k e r N o t I n M o n t h ' ) )   {  
 	 	 	 	 	 	 	 	 	 t m p . a d d M o n t h s ( v a l   >   1 5   ?   - 1   :   1 ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 t m p . s e t D a t e ( v a l ) ;  
 	 	 	 	 	 	 	 	 s w i t c h   ( o p t i o n s . m o d e )   {  
 	 	 	 	 	 	 	 	 	 c a s e   ' m u l t i p l e ' :  
 	 	 	 	 	 	 	 	 	 	 v a l   =   ( t m p . s e t H o u r s ( 0 , 0 , 0 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 	 	 i f   ( $ . i n A r r a y ( v a l ,   o p t i o n s . d a t e )   >   - 1 )   {  
 	 	 	 	 	 	 	 	 	 	 	 $ . e a c h ( o p t i o n s . d a t e ,   f u n c t i o n ( n r ,   d a t ) {  
 	 	 	 	 	 	 	 	 	 	 	 	 i f   ( d a t   = =   v a l )   {  
 	 	 	 	 	 	 	 	 	 	 	 	 	 d e l e t e   o p t i o n s . d a t e [ n r ] ;  
 	 	 	 	 	 	 	 	 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 	 	 	 } ) ;  
 	 	 	 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e . p u s h ( v a l ) ;  
 	 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 	 c a s e   ' r a n g e ' :  
 	 	 	 	 	 	 	 	 	 	 i f   ( ! o p t i o n s . l a s t S e l )   {  
 	 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 0 ]   =   ( t m p . s e t H o u r s ( 0 , 0 , 0 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 	 	 v a l   =   ( t m p . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 	 	 i f   ( v a l   <   o p t i o n s . d a t e [ 0 ] )   {  
 	 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 1 ]   =   o p t i o n s . d a t e [ 0 ]   +   8 6 3 9 9 0 0 0 ;  
 	 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 0 ]   =   v a l   -   8 6 3 9 9 0 0 0 ;  
 	 	 	 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 1 ]   =   v a l ;  
 	 	 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 	 	 o p t i o n s . l a s t S e l   =   ! o p t i o n s . l a s t S e l ;  
 	 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 	 d e f a u l t :  
 	 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   t m p . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 f i l l I t   =   t r u e ;  
 	 	 	 	 	 	 c h a n g e d   =   t r u e ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( f i l l I t )   {  
 	 	 	 	 	 	 f i l l ( t h i s ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( c h a n g e d )   {  
 	 	 	 	 	 	 o p t i o n s . o n C h a n g e . a p p l y ( t h i s ,   p r e p a r e D a t e ( o p t i o n s ) ) ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } ,  
 	 	 	 p r e p a r e D a t e   =   f u n c t i o n   ( o p t i o n s )   {  
 	 	 	 	 v a r   t m p ;  
 	 	 	 	 i f   ( o p t i o n s . m o d e   = =   ' s i n g l e ' )   {  
 	 	 	 	 	 t m p   =   n e w   D a t e ( o p t i o n s . d a t e ) ;  
 	 	 	 	 	 r e t u r n   [ f o r m a t D a t e ( t m p ,   o p t i o n s . f o r m a t ) ,   t m p ] ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 t m p   =   [ [ ] , [ ] ] ;  
 	 	 	 	 	 $ . e a c h ( o p t i o n s . d a t e ,   f u n c t i o n ( n r ,   v a l ) {  
 	 	 	 	 	 	 v a r   d a t e   =   n e w   D a t e ( v a l ) ;  
 	 	 	 	 	 	 t m p [ 0 ] . p u s h ( f o r m a t D a t e ( d a t e ,   o p t i o n s . f o r m a t ) ) ;  
 	 	 	 	 	 	 t m p [ 1 ] . p u s h ( d a t e ) ;  
 	 	 	 	 	 } ) ;  
 	 	 	 	 	 r e t u r n   t m p ;  
 	 	 	 	 }  
 	 	 	 } ,  
 	 	 	 g e t V i e w p o r t   =   f u n c t i o n   ( )   {  
 	 	 	 	 v a r   m   =   d o c u m e n t . c o m p a t M o d e   = =   ' C S S 1 C o m p a t ' ;  
 	 	 	 	 r e t u r n   {  
 	 	 	 	 	 l   :   w i n d o w . p a g e X O f f s e t   | |   ( m   ?   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 ) ,  
 	 	 	 	 	 t   :   w i n d o w . p a g e Y O f f s e t   | |   ( m   ?   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 ) ,  
 	 	 	 	 	 w   :   w i n d o w . i n n e r W i d t h   | |   ( m   ?   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 ) ,  
 	 	 	 	 	 h   :   w i n d o w . i n n e r H e i g h t   | |   ( m   ?   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 )  
 	 	 	 	 } ;  
 	 	 	 } ,  
 	 	 	 i s C h i l d O f   =   f u n c t i o n ( p a r e n t E l ,   e l ,   c o n t a i n e r )   {  
 	 	 	 	 i f   ( p a r e n t E l   = =   e l )   {  
 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 }  
 	 	 	 	 i f   ( p a r e n t E l . c o n t a i n s )   {  
 	 	 	 	 	 r e t u r n   p a r e n t E l . c o n t a i n s ( e l ) ;  
 	 	 	 	 }  
 	 	 	 	 i f   (   p a r e n t E l . c o m p a r e D o c u m e n t P o s i t i o n   )   {  
 	 	 	 	 	 r e t u r n   ! ! ( p a r e n t E l . c o m p a r e D o c u m e n t P o s i t i o n ( e l )   &   1 6 ) ;  
 	 	 	 	 }  
 	 	 	 	 v a r   p r E l   =   e l . p a r e n t N o d e ;  
 	 	 	 	 w h i l e ( p r E l   & &   p r E l   ! =   c o n t a i n e r )   {  
 	 	 	 	 	 i f   ( p r E l   = =   p a r e n t E l )  
 	 	 	 	 	 	 r e t u r n   t r u e ;  
 	 	 	 	 	 p r E l   =   p r E l . p a r e n t N o d e ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } ,  
 	 	 	 s h o w   =   f u n c t i o n   ( e v )   {  
 	 	 	 	 v a r   c a l   =   $ ( ' # '   +   $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) ) ;  
 	 	 	 	 i f   ( ! c a l . i s ( ' : v i s i b l e ' ) )   {  
 	 	 	 	 	 v a r   c a l E l   =   c a l . g e t ( 0 ) ;  
 	 	 	 	 	 v a r   o p t i o n s   =   c a l . d a t a ( ' d a t e p i c k e r ' ) ;  
 	 	 	 	 	 o p t i o n s . o n B e f o r e S h o w . a p p l y ( t h i s ,   [ c a l . g e t ( 0 ) ] ) ;  
 	 	 	 	 	 v a r   p o s   =   $ ( t h i s ) . o f f s e t ( ) ;  
 	 	 	 	 	 v a r   v i e w P o r t   =   g e t V i e w p o r t ( ) ;  
 	 	 	 	 	 v a r   t o p   =   p o s . t o p ;  
 	 	 	 	 	 v a r   l e f t   =   p o s . l e f t ;  
 	 	 	 	 	 v a r   o l d D i s p l a y   =   $ . c u r C S S ( c a l E l ,   ' d i s p l a y ' ) ;  
 	 	 	 	 	 c a l . c s s ( {  
 	 	 	 	 	 	 v i s i b i l i t y :   ' h i d d e n ' ,  
 	 	 	 	 	 	 d i s p l a y :   ' b l o c k '  
 	 	 	 	 	 } ) ;  
 	 	 	 	 	 l a y o u t ( c a l E l ) ;  
 	 	 	 	 	 s w i t c h   ( o p t i o n s . p o s i t i o n ) {  
 	 	 	 	 	 	 c a s e   ' t o p ' :  
 	 	 	 	 	 	 	 t o p   - =   c a l E l . o f f s e t H e i g h t ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' l e f t ' :  
 	 	 	 	 	 	 	 l e f t   - =   c a l E l . o f f s e t W i d t h ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' r i g h t ' :  
 	 	 	 	 	 	 	 l e f t   + =   t h i s . o f f s e t W i d t h ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 	 c a s e   ' b o t t o m ' :  
 	 	 	 	 	 	 	 t o p   + =   t h i s . o f f s e t H e i g h t ;  
 	 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( t o p   +   c a l E l . o f f s e t H e i g h t   >   v i e w P o r t . t   +   v i e w P o r t . h )   {  
 	 	 	 	 	 	 t o p   =   p o s . t o p     -   c a l E l . o f f s e t H e i g h t ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( t o p   <   v i e w P o r t . t )   {  
 	 	 	 	 	 	 t o p   =   p o s . t o p   +   t h i s . o f f s e t H e i g h t   +   c a l E l . o f f s e t H e i g h t ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( l e f t   +   c a l E l . o f f s e t W i d t h   >   v i e w P o r t . l   +   v i e w P o r t . w )   {  
 	 	 	 	 	 	 l e f t   =   p o s . l e f t   -   c a l E l . o f f s e t W i d t h ;  
 	 	 	 	 	 }  
 	 	 	 	 	 i f   ( l e f t   <   v i e w P o r t . l )   {  
 	 	 	 	 	 	 l e f t   =   p o s . l e f t   +   t h i s . o f f s e t W i d t h  
 	 	 	 	 	 }  
 	 	 	 	 	 c a l . c s s ( {  
 	 	 	 	 	 	 v i s i b i l i t y :   ' v i s i b l e ' ,  
 	 	 	 	 	 	 d i s p l a y :   ' b l o c k ' ,  
 	 	 	 	 	 	 t o p :   t o p   +   ' p x ' ,  
 	 	 	 	 	 	 l e f t :   l e f t   +   ' p x '  
 	 	 	 	 	 } ) ;  
 	 	 	 	 	 i f   ( o p t i o n s . o n S h o w . a p p l y ( t h i s ,   [ c a l . g e t ( 0 ) ] )   ! =   f a l s e )   {  
 	 	 	 	 	 	 c a l . s h o w ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 $ ( d o c u m e n t ) . b i n d ( ' m o u s e d o w n ' ,   { c a l :   c a l ,   t r i g g e r :   t h i s } ,   h i d e ) ;  
 	 	 	 	 }  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } ,  
 	 	 	 h i d e   =   f u n c t i o n   ( e v )   {  
 	 	 	 	 i f   ( e v . t a r g e t   ! =   e v . d a t a . t r i g g e r   & &   ! i s C h i l d O f ( e v . d a t a . c a l . g e t ( 0 ) ,   e v . t a r g e t ,   e v . d a t a . c a l . g e t ( 0 ) ) )   {  
 	 	 	 	 	 i f   ( e v . d a t a . c a l . d a t a ( ' d a t e p i c k e r ' ) . o n H i d e . a p p l y ( t h i s ,   [ e v . d a t a . c a l . g e t ( 0 ) ] )   ! =   f a l s e )   {  
 	 	 	 	 	 	 e v . d a t a . c a l . h i d e ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 $ ( d o c u m e n t ) . u n b i n d ( ' m o u s e d o w n ' ,   h i d e ) ;  
 	 	 	 	 }  
 	 	 	 } ;  
 	 	 r e t u r n   {  
 	 	 	 i n i t :   f u n c t i o n ( o p t i o n s ) {  
 	 	 	 	 o p t i o n s   =   $ . e x t e n d ( { } ,   d e f a u l t s ,   o p t i o n s | | { } ) ;  
 	 	 	 	 e x t e n d D a t e ( o p t i o n s . l o c a l e ) ;  
 	 	 	 	 o p t i o n s . c a l e n d a r s   =   M a t h . m a x ( 1 ,   p a r s e I n t ( o p t i o n s . c a l e n d a r s , 1 0 ) | | 1 ) ;  
 	 	 	 	 o p t i o n s . m o d e   =   / s i n g l e | m u l t i p l e | r a n g e / . t e s t ( o p t i o n s . m o d e )   ?   o p t i o n s . m o d e   :   ' s i n g l e ' ;  
 	 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( ) {  
 	 	 	 	 	 i f   ( ! $ ( t h i s ) . d a t a ( ' d a t e p i c k e r ' ) )   {  
 	 	 	 	 	 	 i f   ( o p t i o n s . d a t e . c o n s t r u c t o r   = =   S t r i n g )   {  
 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   p a r s e D a t e ( o p t i o n s . d a t e ,   o p t i o n s . f o r m a t ) ;  
 	 	 	 	 	 	 	 o p t i o n s . d a t e . s e t H o u r s ( 0 , 0 , 0 , 0 ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   ! =   ' s i n g l e ' )   {  
 	 	 	 	 	 	 	 i f   ( o p t i o n s . d a t e . c o n s t r u c t o r   ! =   A r r a y )   {  
 	 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   [ o p t i o n s . d a t e . v a l u e O f ( ) ] ;  
 	 	 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   = =   ' r a n g e ' )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e . p u s h ( ( ( n e w   D a t e ( o p t i o n s . d a t e [ 0 ] ) ) . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ) . v a l u e O f ( ) ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   o p t i o n s . d a t e . l e n g t h ;   i + + )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ i ]   =   ( p a r s e D a t e ( o p t i o n s . d a t e [ i ] ,   o p t i o n s . f o r m a t ) . s e t H o u r s ( 0 , 0 , 0 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   = =   ' r a n g e ' )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 1 ]   =   ( ( n e w   D a t e ( o p t i o n s . d a t e [ 1 ] ) ) . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   o p t i o n s . d a t e . v a l u e O f ( ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( ! o p t i o n s . c u r r e n t )   {  
 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t   =   n e w   D a t e ( ) ;  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t   =   p a r s e D a t e ( o p t i o n s . c u r r e n t ,   o p t i o n s . f o r m a t ) ;  
 	 	 	 	 	 	 }    
 	 	 	 	 	 	 o p t i o n s . c u r r e n t . s e t D a t e ( 1 ) ;  
 	 	 	 	 	 	 o p t i o n s . c u r r e n t . s e t H o u r s ( 0 , 0 , 0 , 0 ) ;  
 	 	 	 	 	 	 v a r   i d   =   ' d a t e p i c k e r _ '   +   p a r s e I n t ( M a t h . r a n d o m ( )   *   1 0 0 0 ) ,   c n t ;  
 	 	 	 	 	 	 o p t i o n s . i d   =   i d ;  
 	 	 	 	 	 	 $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ,   o p t i o n s . i d ) ;  
 	 	 	 	 	 	 v a r   c a l   =   $ ( t p l . w r a p p e r ) . a t t r ( ' i d ' ,   i d ) . b i n d ( ' c l i c k ' ,   c l i c k ) . d a t a ( ' d a t e p i c k e r ' ,   o p t i o n s ) ;  
 	 	 	 	 	 	 i f   ( o p t i o n s . c l a s s N a m e )   {  
 	 	 	 	 	 	 	 c a l . a d d C l a s s ( o p t i o n s . c l a s s N a m e ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   o p t i o n s . c a l e n d a r s ;   i + + )   {  
 	 	 	 	 	 	 	 c n t   =   o p t i o n s . s t a r t s ;  
 	 	 	 	 	 	 	 c a l . f i n d ( ' t r : f i r s t ' ) . a p p e n d (  
 	 	 	 	 	 	 	 	 i   >   0   ?     t p l . s p a c e :   ' ' ,  
 	 	 	 	 	 	 	 	 t m p l ( t p l . h e a d . j o i n ( ' ' ) ,   {  
 	 	 	 	 	 	 	 	 	 w e e k :   o p t i o n s . l o c a l e . w e e k M i n ,  
 	 	 	 	 	 	 	 	 	 p r e v :   o p t i o n s . p r e v ,  
 	 	 	 	 	 	 	 	 	 n e x t :   o p t i o n s . n e x t ,  
 	 	 	 	 	 	 	 	 	 d a y 1 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 2 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 3 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 4 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 5 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 6 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ] ,  
 	 	 	 	 	 	 	 	 	 d a y 7 :   o p t i o n s . l o c a l e . d a y s M i n [ ( c n t + + ) % 7 ]  
 	 	 	 	 	 	 	 	 } )  
 	 	 	 	 	 	 	 ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 c a l . f i n d ( ' t r : f i r s t   t a b l e ' ) . a d d C l a s s ( ' d a t e p i c k e r V i e w D a y s ' ) ;  
 	 	 	 	 	 	 f i l l ( c a l . g e t ( 0 ) ) ;  
 	 	 	 	 	 	 i f   ( o p t i o n s . f l a t )   {  
 	 	 	 	 	 	 	 c a l . a p p e n d T o ( t h i s ) . s h o w ( ) . c s s ( ' p o s i t i o n ' ,   ' r e l a t i v e ' ) ;  
 	 	 	 	 	 	 	 l a y o u t ( c a l . g e t ( 0 ) ) ;  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 c a l . a p p e n d T o ( d o c u m e n t . b o d y ) ;  
 	 	 	 	 	 	 	 $ ( t h i s ) . b i n d ( o p t i o n s . e v e n t N a m e ,   s h o w ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
 	 	 	 } ,  
 	 	 	 s h o w P i c k e r :   f u n c t i o n ( )   {  
 	 	 	 	 r e t u r n   t h i s . e a c h (   f u n c t i o n   ( )   {  
 	 	 	 	 	 i f   ( $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) )   {  
 	 	 	 	 	 	 s h o w . a p p l y ( t h i s ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
 	 	 	 } ,  
 	 	 	 h i d e P i c k e r :   f u n c t i o n ( )   {  
 	 	 	 	 r e t u r n   t h i s . e a c h (   f u n c t i o n   ( )   {  
 	 	 	 	 	 i f   ( $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) )   {  
 	 	 	 	 	 	 $ ( ' # '   +   $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) ) . h i d e ( ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
 	 	 	 } ,  
 	 	 	 s e t D a t e :   f u n c t i o n ( d a t e ,   s h i f t T o ) {  
 	 	 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( ) {  
 	 	 	 	 	 i f   ( $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) )   {  
 	 	 	 	 	 	 v a r   c a l   =   $ ( ' # '   +   $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) ) ;  
 	 	 	 	 	 	 v a r   o p t i o n s   =   c a l . d a t a ( ' d a t e p i c k e r ' ) ;  
 	 	 	 	 	 	 o p t i o n s . d a t e   =   d a t e ;  
 	 	 	 	 	 	 i f   ( o p t i o n s . d a t e . c o n s t r u c t o r   = =   S t r i n g )   {  
 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   p a r s e D a t e ( o p t i o n s . d a t e ,   o p t i o n s . f o r m a t ) ;  
 	 	 	 	 	 	 	 o p t i o n s . d a t e . s e t H o u r s ( 0 , 0 , 0 , 0 ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   ! =   ' s i n g l e ' )   {  
 	 	 	 	 	 	 	 i f   ( o p t i o n s . d a t e . c o n s t r u c t o r   ! =   A r r a y )   {  
 	 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   [ o p t i o n s . d a t e . v a l u e O f ( ) ] ;  
 	 	 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   = =   ' r a n g e ' )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e . p u s h ( ( ( n e w   D a t e ( o p t i o n s . d a t e [ 0 ] ) ) . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ) . v a l u e O f ( ) ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   o p t i o n s . d a t e . l e n g t h ;   i + + )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ i ]   =   ( p a r s e D a t e ( o p t i o n s . d a t e [ i ] ,   o p t i o n s . f o r m a t ) . s e t H o u r s ( 0 , 0 , 0 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 	 i f   ( o p t i o n s . m o d e   = =   ' r a n g e ' )   {  
 	 	 	 	 	 	 	 	 	 o p t i o n s . d a t e [ 1 ]   =   ( ( n e w   D a t e ( o p t i o n s . d a t e [ 1 ] ) ) . s e t H o u r s ( 2 3 , 5 9 , 5 9 , 0 ) ) . v a l u e O f ( ) ;  
 	 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 	 }  
 	 	 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 	 	 o p t i o n s . d a t e   =   o p t i o n s . d a t e . v a l u e O f ( ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 i f   ( s h i f t T o )   {  
 	 	 	 	 	 	 	 o p t i o n s . c u r r e n t   =   n e w   D a t e   ( o p t i o n s . m o d e   ! =   ' s i n g l e '   ?   o p t i o n s . d a t e [ 0 ]   :   o p t i o n s . d a t e ) ;  
 	 	 	 	 	 	 }  
 	 	 	 	 	 	 f i l l ( c a l . g e t ( 0 ) ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ) ;  
 	 	 	 } ,  
 	 	 	 g e t D a t e :   f u n c t i o n ( f o r m a t e d )   {  
 	 	 	 	 i f   ( t h i s . s i z e ( )   >   0 )   {  
 	 	 	 	 	 r e t u r n   p r e p a r e D a t e ( $ ( ' # '   +   $ ( t h i s ) . d a t a ( ' d a t e p i c k e r I d ' ) ) . d a t a ( ' d a t e p i c k e r ' ) ) [ f o r m a t e d   ?   0   :   1 ] ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 } ;  
 	 } ( ) ;  
 	 $ . f n . e x t e n d ( {  
 	 	 D a t e P i c k e r :   D a t e P i c k e r . i n i 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 . h i d 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 . s h o w ,  
 	 	 D a t e P i c k e r S e t D a t e :   D a t e P i c k e r . s e t D a t e ,  
 	 	 D a t e P i c k e r G e t D a t e :   D a t e P i c k e r . g e t D a t e  
 	 } ) ;  
 } ) ( j Q u e r y ) ;  
  
 ( f u n c t i o n ( ) {  
     v a r   c a c h e   =   { } ;  
    
     t h i s . t m p l   =   f u n c t i o n   t m p l ( s t r ,   d a t a ) {  
         / /   F i g u r e   o u t   i f   w e ' r e   g e t t i n g   a   t e m p l a t e ,   o r   i f   w e   n e e d   t o  
         / /   l o a d   t h e   t e m p l a t e   -   a n d   b e   s u r e   t o   c a c h e   t h e   r e s u l t .  
         v a r   f n   =   ! / \ W / . t e s t ( s t r )   ?  
             c a c h e [ s t r ]   =   c a c h e [ s t r ]   | |  
                 t m p l ( d o c u m e n t . g e t E l e m e n t B y I d ( s t r ) . i n n e r H T M L )   :  
            
             / /   G e n e r a t e   a   r e u s a b l e   f u n c t i o n   t h a t   w i l l   s e r v e   a s   a   t e m p l a t e  
             / /   g e n e r a t o r   ( a n d   w h i c h   w i l l   b e   c a c h e d ) .  
             n e w   F u n c t i o n ( " o b j " ,  
                 " v a r   p = [ ] , p r i n t = f u n c t i o n ( ) { p . p u s h . a p p l y ( p , a r g u m e n t s ) ; } ; "   +  
                
                 / /   I n t r o d u c e   t h e   d a t a   a s   l o c a l   v a r i a b l e s   u s i n g   w i t h ( ) { }  
                 " w i t h ( o b j ) { p . p u s h ( ' "   +  
                
                 / /   C o n v e r t   t h e   t e m p l a t e   i n t o   p u r e   J a v a S c r i p t  
                 s t r  
                     . r e p l a c e ( / [ \ r \ t \ n ] / g ,   "   " )  
                     . s p l i t ( " < % " ) . j o i n ( " \ t " )  
                     . r e p l a c e ( / ( ( ^ | % > ) [ ^ \ t ] * ) ' / g ,   " $ 1 \ r " )  
                     . r e p l a c e ( / \ t = ( . * ? ) % > / g ,   " ' , $ 1 , ' " )  
                     . s p l i t ( " \ t " ) . j o i n ( " ' ) ; " )  
                     . s p l i t ( " % > " ) . j o i n ( " p . p u s h ( ' " )  
                     . s p l i t ( " \ r " ) . j o i n ( " \ \ ' " )  
             +   " ' ) ; } r e t u r n   p . j o i n ( ' ' ) ; " ) ;  
        
         / /   P r o v i d e   s o m e   b a s i c   c u r r y i n g   t o   t h e   u s e r  
         r e t u r n   d a t a   ?   f n (   d a t a   )   :   f n ;  
     } ;  
 } ) ( ) ; 
