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