ÿþv a r   C a r o u s e l   =   n e w   C l a s s ( {  
 	 i n i t i a l i z e :   f u n c t i o n ( e l e m e n t ,   o p t i o n s )   {  
 	 	 t h i s . s e t O p t i o n s ( {  
 	 	 	 a u t o S t y l e :   f a l s e ,  
 	 	 	 i d P r e v i o u s :   n u l l ,  
 	 	 	 i d N e x t :   n u l l ,  
 	 	 	 v i s i b l e I t e m s :   5 ,  
 	 	 	 s c r o l l A m o u n t :   8 0 ,  
 	 	 	 s c r o l l I n t e r v a l :   2 0 0 ,  
 	 	 	 f x T r a n s i t i o n :   F x . T r a n s i t i o n s . q u a d O u t  
 	 	 } ,   o p t i o n s ) ;  
 	 	  
 	 	 i f ( ! e l e m e n t )   r e t u r n ;  
 	 	  
 	 	 i f ( t h i s . o p t i o n s . i d P r e v i o u s )    
 	 	 	 $ ( t h i s . o p t i o n s . i d P r e v i o u s ) . a d d E v e n t ( " c l i c k " ,   ( f u n c t i o n ( e ) {   n e w   E v e n t ( e ) . s t o p ( ) ;   t h i s . s c r o l l L e f t ( ) ;   } ) . b i n d W i t h E v e n t ( t h i s ) ) ;  
 	 	 i f ( t h i s . o p t i o n s . i d N e x t )    
 	 	 	 $ ( t h i s . o p t i o n s . i d N e x t ) . a d d E v e n t ( " c l i c k " ,   ( f u n c t i o n ( e ) {   n e w   E v e n t ( e ) . s t o p ( ) ;   t h i s . s c r o l l R i g h t ( ) ;   } ) . b i n d W i t h E v e n t ( t h i s ) ) ;  
 	 	  
 	 	 t h i s . m a i n E l e m e n t   =   $ ( e l e m e n t ) ;  
 	 	 t h i s . m a i n E l e m e n t s   =   t h i s . m a i n E l e m e n t . g e t C h i l d r e n ( ) ;  
  
 	 	 t h i s . i n d e x   =   0 ;  
 	 	 t h i s . m a x L e n g t h   =   t h i s . m a i n E l e m e n t s . l e n g t h ;  
 	 	 	 	  
 	 	 t h i s . m a x W i d t h   =   t h i s . m a x L e n g t h   *   t h i s . o p t i o n s . s c r o l l A m o u n t ;  
  
 	 	 i f ( t h i s . o p t i o n s . a u t o S t y l e )   {  
 	 	 	 t h i s . m a i n E l e m e n t . g e t P a r e n t ( ) . s e t S t y l e s ( {  
 	 	 	 	 w i d t h :   ( t h i s . o p t i o n s . s c r o l l A m o u n t   *   t h i s . o p t i o n s . v i s i b l e I t e m s ) ,  
 	 	 	 	 d i s p l a y :   " b l o c k " ,  
 	 	 	 	 o v e r f l o w :   " h i d d e n "  
 	 	 	 } ) ;  
 	 	 	 t h i s . m a i n E l e m e n t . s e t S t y l e s ( {  
 	 	 	 	 w i d t h :   t h i s . m a x W i d t h ,  
 	 	 	 	 p o s i t i o n :   " r e l a t i v e " ,  
 	 	 	 	 m a r g i n :   " 0 p x " ,  
 	 	 	 	 p a d d i n g : " 0 p x "  
 	 	 	 } ) ;  
 	 	 	 t h i s . m a i n E l e m e n t s . e a c h ( f u n c t i o n ( e l ) {  
 	 	 	 	 e l . s e t S t y l e s ( {  
 	 	 	 	 	 p o s i t i o n : " r e l a t i v e " ,  
 	 	 	 	 	 o v e r f l o w : " h i d d e n " ,  
 	 	 	 	 	 f l o a t : " l e f t "  
 	 	 	 	 } ) ;  
 	 	 	 } ) ;  
 	 	 } 	 	  
  
 	 	 t h i s . c h e c k S c r o l l e r s ( 0 ) ;  
 	 	 	  
 	 	 t h i s . e f f e c t   =   n e w   F x . S t y l e (  
 	 	 t h i s . m a i n E l e m e n t ,    
 	 	 " l e f t " ,    
 	 	 {  
 	 	 	 d u r a t i o n : t h i s . o p t i o n s . s c r o l l I n t e r v a l ,  
 	 	 	 t r a n s i t i o n : t h i s . o p t i o n s . f x T r a n s i t i o n ,  
 	 	 	 w a i t : f a l s e  
 	 	 } ) ;  
 	 	  
 	 } ,  
 	  
 	 c h e c k S c r o l l e r s :   f u n c t i o n ( i n d e x )   {  
 	 	 	 i f ( t h i s . o p t i o n s . i d P r e v i o u s   & &   t h i s . o p t i o n s . i d N e x t )   {  
 	 	 	 	 i f ( i n d e x   = =   0   | |   t h i s . o p t i o n s . v i s i b l e I t e m s   >   t h i s . m a x L e n g t h )   {  
 	 	 	 	 	 $ ( t h i s . o p t i o n s . i d P r e v i o u s ) . s e t S t y l e ( " v i s i b i l i t y " , " h i d d e n " ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 $ ( t h i s . o p t i o n s . i d P r e v i o u s ) . s e t S t y l e ( " v i s i b i l i t y " , " v i s i b l e " ) ;  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 i f ( i n d e x   = =   ( t h i s . m a x L e n g t h   -   t h i s . o p t i o n s . v i s i b l e I t e m s )   | |   t h i s . o p t i o n s . v i s i b l e I t e m s   >   t h i s . m a x L e n g t h )   {  
 	 	 	 	 	 $ ( t h i s . o p t i o n s . i d N e x t ) . s e t S t y l e ( " v i s i b i l i t y " , " h i d d e n " ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 $ ( t h i s . o p t i o n s . i d N e x t ) . s e t S t y l e ( " v i s i b i l i t y " , " v i s i b l e " ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 } ,  
 	  
 	 c a l c u l a t e I n d e x :   f u n c t i o n ( i n d e x )   {  
 	 	 t h i s . c h e c k S c r o l l e r s ( i n d e x ) ;  
 	  
 	 	 i f ( i n d e x   <   0 )   {  
 	 	 	 t h i s . i n d e x   =   0 ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 	  
 	 	 i f ( i n d e x   >   ( t h i s . m a x L e n g t h   -   t h i s . o p t i o n s . v i s i b l e I t e m s ) )   {  
 	 	 	 t h i s . i n d e x   =   t h i s . m a x L e n g t h   -   t h i s . o p t i o n s . v i s i b l e I t e m s ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	  
 	 	 r e t u r n   t r u e ;  
 	 } ,  
 	  
 	 j u m p T o :   f u n c t i o n ( i n d e x )   {  
 	 	 i f ( t h i s . c a l c u l a t e I n d e x ( i n d e x ) )   {  
 	 	 	 t h i s . i n d e x   =   i n d e x ;  
 	 	 }  
 	 	  
 	 	 i f ( t h i s . o p t i o n s . v i s i b l e I t e m s   >   t h i s . m a x L e n g t h )   {  
 	 	 	 r e t u r n ;  
 	 	 }  
 	 	 	 	 	  
 	 	 v a r   c u r r e n t _ x   =   t h i s . m a i n E l e m e n t . g e t S t y l e ( " l e f t " ) . t o I n t ( )   | |   0 ;  
 	 	 v a r   n e x t _ x   =   ( t h i s . i n d e x   *   t h i s . o p t i o n s . s c r o l l A m o u n t ) ;  
 	 	 t h i s . e f f e c t . s t a r t ( c u r r e n t _ x ,   - n e x t _ x ) ; 	  
 	 	 t h i s . c h e c k S c r o l l e r s ( t h i s . i n d e x ) ; 	  
 	 } ,  
 	  
 	 s c r o l l L e f t :   f u n c t i o n ( )   {  
 	 	 i f ( t h i s . c a l c u l a t e I n d e x ( - - t h i s . i n d e x ) )   {  
 	 	 	 v a r   c u r r e n t _ x   =   t h i s . m a i n E l e m e n t . g e t S t y l e ( " l e f t " ) . t o I n t ( )   | |   0 ;  
 	 	 	 v a r   n e x t _ x   =   ( t h i s . i n d e x   *   t h i s . o p t i o n s . s c r o l l A m o u n t ) ;  
 	 	 	 t h i s . e f f e c t . s t a r t ( c u r r e n t _ x ,   - n e x t _ x ) ;  
 	 	 }  
 	 } ,  
 	  
 	 s c r o l l R i g h t :   f u n c t i o n ( )   {  
 	 	 i f ( t h i s . c a l c u l a t e I n d e x ( + + t h i s . i n d e x ) )   {  
 	 	 	 v a r   c u r r e n t _ x   =   t h i s . m a i n E l e m e n t . g e t S t y l e ( " l e f t " ) . t o I n t ( )   | |   0 ;  
 	 	 	 v a r   n e x t _ x   =   ( t h i s . i n d e x   *   t h i s . o p t i o n s . s c r o l l A m o u n t ) ;  
 	 	 	 t h i s . e f f e c t . s t a r t ( c u r r e n t _ x ,   - n e x t _ x ) ;  
 	 	 }  
 	 }  
  
 } ) ;  
 C a r o u s e l . i m p l e m e n t ( n e w   O p t i o n s ) ; 
