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