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