ÿþ  / *  
   *   j Q u e r y   U I   s e l e c t m e n u  
   *  
   *   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  
   * /  
  
 v a r   n o w O p e n S i n g l e S e l e c t   =   n u l l ;  
  
 ( f u n c t i o n ( $ )   {  
  
 $ . w i d g e t ( " u i . s e l e c t m e n u " ,   {  
 	 g e t t e r :   " v a l u e " ,  
 	 v e r s i o n :   " 1 . 8 " ,  
 	 e v e n t P r e f i x :   " s e l e c t m e n u " ,  
 	 o p t i o n s :   {  
 	 	 w i d t h : 1 5 8 ,  
 	 	 h e i g h t : 1 5 0 ,  
 	 	 e l : n u l l ,  
 	 	 o n C h a n g e : n u l l  
 	 } , 	  
 	  
 	 _ c r e a t e :   f u n c t i o n ( )   {  
 / / 	 	 t h i s . e l e m e n t   =   t h i s . o p t i o n s . e l ;  
 	 	 v a r   s e l f   =   t h i s ,  
 	 	 	 o   =   t h i s . o p t i o n s ,  
 	 	 	 e l   =   t h i s . e l e m e n t ,  
 	 	 	 m y I d   =   e l . a t t r ( ' i d ' ) ;  
  
 	 	 e l . h i d e ( ) ;  
 	 	 t h i s . b u t t o n   =   e l . a f t e r ( ' < a   c l a s s = " u i - s e l e c t m e n u   u i - w i d g 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 e l e c t m e n u - d r o p d o w n   u i - s e l e c t m e n u - f o c u s "   i d = " ' + m y I d + ' - b u t t o n "   r o l e = " b u t t o n "   h r e f = " # "   a r i a - h a s p o p u p = " t r u e "   a r i a - o w n s = " ' + m y I d + ' - m e n u "   s t y l e = " w i d t h : ' + o . w i d t h + ' p x ;   "   a r i a - d i s a b l e d = " f a l s e " > < s p a n   c l a s s = " u i - s e l e c t m e n u - s t a t u s " > ' + e l . c h i l d r e n ( ' : s e l e c t e d ' ) . t e x t ( ) + ' < / s p a n > < s p a n   c l a s s = " u i - s e l e c t m e n u - i c o n   u i - i c o n   u i - i c o n - t r i a n g l e - 1 - s " > < / s p a n > < / a > ' ) . n e x t ( ) ;  
 	 	 t h i s . b u t t o n . h o v e r ( f u n c t i o n ( ) {  
 	 	 	 $ ( t h i s ) . t o g g l e C l a s s ( ' u i - s t a t e - h o v e r ' ) ;  
 	 	 } ) ;  
 	 	  
 	 	     t h i s . b u t t o n . b i n d ( ' c l i c k ' ,   f u n c t i o n ( e ) { s e l f . o p e n ( ( e ) ) ;   i f ( n o w O p e n S i n g l e S e l e c t   ! = =   n u l l )   n o w O p e n S i n g l e S e l e c t . c l o s e ( ) ;   n o w O p e n S i n g l e S e l e c t   =   s e l f ;   r e t u r n   f a l s e ; } ) ;  
 	 	  
 	 	 m e n u H T M L   =   ' ' ;  
 	 	 v a r   o p t s   =   e l . c h i l d r e n ( ' o p t i o n ' ) ;  
 	 	 f o r ( v a r   i   =   0 ;   i   <   o p t s . l e n g t h ;   i + + )  
 	 	 	 m e n u H T M L   + =   ' < l i   i n d = " ' + i + ' " > < a   h r e f = " ' + $ ( o p t s [ i ] ) . a t t r ( ' v a l u e ' ) + ' " > ' + $ ( o p t s [ i ] ) . t e x t ( ) + ' < / a > < / l i > ' ;  
 / / 	 	 < l i   r o l e = " p r e s e n t a t i o n "   c l a s s = " u i - s e l e c t m e n u - i t e m - f o c u s   u i - s t a t e - h o v e r " > < a   h r e f = " # "   t a b i n d e x = " - 1 "   r o l e = " o p t i o n "   a r i a - s e l e c t e d = " f a l s e " > . < / a > < / l i >  
  
 	 	 t h i s . m e n u   =   t h i s . b u t t o n . a f t e r ( ' < d i v   c l a s s = " 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 - b o t t o m "   s t y l e = " l e f t : '   +   t h i s . b u t t o n . p o s i t i o n ( ) . l e f t   +   ' p x ;   h e i g h t : '   +   o . h e i g h t   +   ' p x ;   p o s i t i o n : a b s o l u t e ;   z - i n d e x : 9 9 9 ;   o v e r f l o w : a u t o ;   d i s p l a y : n o n e ;   w i d t h : '   +   o . w i d t h   +   ' p x ; " > < u l   c l a s s = " u i - s e l e c t m e n u - m e n u   u i - s e l e c t m e n u - m e n u - d r o p d o w n   u i - s e l e c t m e n u - o p e n "   a r i a - h i d d e n = " f a l s e "   r o l e = " l i s t b o x "   a r i a - l a b e l l e d b y = " u i - r s f - c o u n t r y I n p u t - b u t t o n "   i d = " u i - r s f - c o u n t r y I n p u t - m e n u "   s t y l e = " "   a r i a - a c t i v e d e s c e n d a n t = " u i - s e l e c t m e n u - i t e m - 5 5 " > '   +   m e n u H T M L   +   ' < / u l > < / d i v > ' ) . n e x t ( ) ;  
 	 	  
 	 	 t h i s . o p t s   =   t h i s . m e n u . c h i l d r e n ( ' u l ' ) . c h i l d r e n ( ' l i ' ) ;  
 	 	 t h i s . o p t s . h o v e r ( f u n c t i o n ( ) {  
 	 	 	 $ ( t h i s ) . t o g g l e C l a s s ( ' u i - s t a t e - h o v e r ' ) ;  
 	 	 } ) ;  
 	 	 f o r ( v a r   i   =   0 ;   i   <   t h i s . o p t s . l e n g t h ;   i + + )  
 / / 	 	 t h i s . o p t s . b i n d ( ' c l i c k ' ,   f u n c t i o n ( e ) {  
 	 	 	 $ ( t h i s . o p t s [ i ] ) . b i n d ( ' c l i c k ' ,   f u n c t i o n ( e ) {  
 	 	 	 	 v a r   t   =   t h i s ;  
 	 	 	 	 v a r   s   =   s e l f ;  
 	 	 	 	 s e t T i m e o u t ( f u n c t i o n ( ) {  
 	 	 	 	 	 s . b u t t o n . c h i l d r e n ( ' s p a n : f i r s t ' ) . t e x t ( $ ( t ) . c h i l d r e n ( ' a ' ) . t e x t ( ) ) ;  
 	 	 	 	 	 s . e l e m e n t . c h i l d r e n ( ' o p t i o n : s e l e c t e d ' ) . r e m o v e A t t r ( ' s e l e c t e d ' ) ;  
 	 	 	 	 	 s . e l e m e n t . c h i l d r e n ( ' o p t i o n : e q ( ' + $ ( t ) . a t t r ( ' i n d ' ) + ' ) ' ) . a t t r ( ' s e l e c t e d ' ,   ' s e l e c t e d ' ) ;  
 	 	 	 	 	 s . c l o s e ( e ) ;  
 	 	 	 	 	 i f ( s . o p t i o n s . o n C h a n g e   ! = =   n u l l ) {  
 	 	 	 	 	 	 s . o p t i o n s . o n C h a n g e ( e ) ;  
 	 	 	 	 	 }  
 	 	 	 	 } ,   0 ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } ) ;  
 / / 	 	 } ) ;  
 	 	  
 	 	 / / d o c u m e n t   c l i c k   c l o s e s   m e n u  
 / / 	 	 $ ( d o c u m e n t ) . m o u s e d o w n ( f u n c t i o n ( e v e n t ) {  
 / / 	 	 	 s e l f . c l o s e ( e v e n t ) ;  
 / / 	 	 } ) ; 	  
 	 } ,  
 	 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 ' )  
 	 	 	 . u n b i n d ( " c l i c k " ) ;  
 	  
 	 	 / / u n b i n d   c l i c k   o n   l a b e l ,   r e s e t   i t s   f o r   a t t r  
 	 	 $ ( ' l a b e l [ f o r = ' + t h i s . n e w e l e m e n t . a t t r ( ' i d ' ) + ' ] ' )  
 	 	 	 . a t t r ( ' f o r ' , t h i s . e l e m e n t . a t t r ( ' i d ' ) )  
 	 	 	 . u n b i n d ( ' c l i c k ' ) ;  
 	 	 t h i s . n e w e l e m e n t . r e m o v e ( ) ;  
 	 	 t h i s . l i s t . r e m o v e ( ) ;  
 	 	 t h i s . e l e m e n t . s h o w ( ) ; 	  
 	 	  
 	 	 / /   c a l l   w i d g e t   d e s t r o y   f u n c t i o n  
 	 	 $ . W i d g e t . p r o t o t y p e . d e s t r o y . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
 	 	 * /  
 / / 	 	 t h i s . b u t t o n . u n b i n d ( ' h o v e r ' ) ;  
 / / 	 	 t h i s . o p t s . u n b i n d ( ' h o v e r ' ) ;  
 / / 	 	 t h i s . o p t s . u n b i n d ( ' c l i c k ' ) ;  
 	 	 t h i s . b u t t o n . r e m o v e ( ) ;  
 	 	 t h i s . m e n u . r e m o v e ( ) ;  
 	 	 t h i s . e l e m e n t . s h o w ( ) ;  
 	 	 $ . W i d g e t . p r o t o t y p e . d e s t r o y . a p p l y ( t h i s ,   a r g u m e n t s ) ;  
 	 } ,  
 o p e n :   f u n c t i o n   ( e v e n t )   {  
         v a r   s e l f   =   t h i s ;  
         s e l f . b u t t o n . a d d C l a s s ( ' u i - s t a t e - a c t i v e ' ) ;  
         s e l f . m e n u . c s s ( ' l e f t ' ,   s e l f . b u t t o n . p o s i t i o n ( ) . l e f t ) . s h o w ( ) ;  
         s e l f . b u t t o n . u n b i n d ( ' c l i c k ' ) ;  
         $ ( d o c u m e n t ) . b i n d ( ' c l i c k ' ,   f u n c t i o n   ( e )   {   s e l f . c l o s e ( e ) ;   } ) ;  
 } ,  
 	 c l o s e :   f u n c t i o n ( e v e n t ,   r e t a i n F o c u s ) {  
 	 	 v a r   s e l f   =   t h i s ;  
 	 	 t h i s . b u t t o n . r e m o v e C l a s s ( ' u i - s t a t e - a c t i v e ' ) ;  
 	 	 t h i s . m e n u . h i d e ( ) ;  
 	 	 $ ( d o c u m e n t ) . u n b i n d ( ' c l i c k ' ) ;  
 	 	     t h i s . b u t t o n . b i n d ( ' c l i c k ' ,   f u n c t i o n ( e ) { s e l f . o p e n ( ( e ) ) ;   i f ( n o w O p e n S i n g l e S e l e c t   ! = =   n u l l )   n o w O p e n S i n g l e S e l e c t . c l o s e ( ) ;   n o w O p e n S i n g l e S e l e c t   =   s e l f ;   r e t u r n   f a l s e ; } ) ;  
 	 } ,  
 	 v a l u e :   f u n c t i o n ( n e w V a l u e )   {  
 	 	 i f   ( a r g u m e n t s . l e n g t h )   {  
 	 	 	 t h i s . e l e m e n t [ 0 ] . s e l e c t e d I n d e x   =   n e w V a l u e ;  
 	 	 	 t h i s . _ r e f r e s h V a l u e ( ) ;  
 	 	 	 t h i s . _ r e f r e s h P o s i t i o n ( ) ;  
 	 	 }  
 	 	 r e t u r n   t h i s . e l e m e n t [ 0 ] . s e l e c t e d I n d e x ;  
 	 } ,  
 	 e n a b l e : f u n c t i o n ( ) {  
 	 } ,  
 	 d i s a b l e : f u n c t i o n ( ) {  
 	 }  
 } ) ;  
 } ) ( j Q u e r y ) ;  
  
 S c r i p t L o a d e d   =   " j q u e r y . u i . s e l e c t m e n u . j s " ; 
