ÿþ( f u n c t i o n ( $ ) { 	  
 	 / / d e c l a r e   a n   a r r a y   t o   s t o r e   t h e   k e y s   o f   t h e   o p t i o n s   o b j e c t  
 	 $ . d s s O p t i o n s L i s t   =   [ ] ;  
 	  
 	 / / m a i n   f u n c t i o n  
 	 $ . f n . d i v S l i d e S h o w   =   f u n c t i o n ( c u s t o m O p t i o n s ) { 	  
 	 	 / / d e f a u l t   o p t i o n s  
 	 	 v a r   o p t i o n s   =    
 	 	 {    
 	 	 	 w i d t h : 2 0 0 ,    
 	 	 	 h e i g h t : 1 0 0 ,    
 	 	 	 a r r o w : " b e g i n " ,   	 	 	  
 	 	 	 d e l a y : 5 0 0 0 ,    
 	 	 	 l o o p : 1 ,  
 	 	 	 l e f t A r r o w C l a s s : " " ,  
 	 	 	 r i g h t A r r o w C l a s s : " " ,  
 	 	 	 / / l e f t A r r o w C l a s s : " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - w " ,  
 	 	 	 / / r i g h t A r r o w C l a s s : " u i - i c o n   u i - i c o n - c i r c l e - t r i a n g l e - e " ,  
 	 	 	 s l i d e C o n t a i n e r C l a s s : " " ,    
 	 	 	 c o n t r o l C l a s s : " " ,  
 	 	 	 c o n t r o l A c t i v e C l a s s : " " ,  
 	 	 	 / / c o n t r o l C l a s s : " u i - s t a t e - d e f a u l t   u i - c o r n e r - a l l " ,    
 	 	 	 / / c o n t r o l A c t i v e C l a s s : " u i - s t a t e - h o v e r " ,  
 	 	 	 c o n t r o l H o v e r C l a s s : " " ,  
 	 	 	 c o n t r o l C o n t a i n e r C l a s s : " " ,  
 	 	 	 s e p a r a t o r C l a s s : " "  
 	 	 	  
 	 	 } ;  
 	 	 / / o v e r r i d e   o p t i o n s  
 	 	 i f ( c u s t o m O p t i o n s )  
 	 	 	 $ . e x t e n d ( o p t i o n s ,   c u s t o m O p t i o n s ) ;  
 	 	 	  
 	 	 / / s t o r e   t h e   k e y s   o f   t h e   o p t i o n s   o b j e c t  
 	 	 f o r ( v a r   k e y   i n   o p t i o n s )  
 	 	 	 $ . d s s O p t i o n s L i s t . p u s h ( k e y ) ;  
 	 	  
 	 	 / / l i m i t   l o o p   a m o u n t  
 	 	 i f ( o p t i o n s . l o o p   >   3 0 )  
 	 	 	 o p t i o n s . l o o p   =   3 0 ;  
 	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( ) {  
 	 	 	 f o r ( k e y   i n   o p t i o n s )  
 	 	 	 	 $ ( t h i s ) . a t t r ( k e y ,   o p t i o n s [ k e y ] )  
 	 	 	 / / m a k e   s l i d e s h o w  
 	 	 	 $ . d i v S l i d e S h o w ( t h i s ) ;  
 	 	 } ) ;  
 	 } ;  
 	  
 	 $ . d i v 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 )  
 	 { 	 	  
 	 	 v a r   o p t i o n s   =   $ . d i v S l i d e S h o w . g e t O p t i o n s O b j e c t ( s l i d e S h o w ) 	 	  
 	 	  
 	 	 v a r   n u m S l i d e   =   $ ( s l i d e S h o w ) . c h i l d r e n ( ' . s l i d e m m ' ) . l e n g t h ; 	 	 	  
 	 	 $ ( s l i d e S h o w ) . c s s (   {   ' w i d t h ' : o p t i o n s . w i d t h   ,     ' o v e r f l o w ' : ' h i d d e n ' ,   ' d i s p l a y ' : ' b l o c k '   }   ) ; 	 	  
 	 	  
 	 	 / / w r a p   a l l   s l i d e s   w i t h   i n n e r   c o n a t i n e r  
 	 	 $ ( s l i d e S h o w ) . c h i l d r e n ( ) 	 	 	  
 	 	 	 . w r a p ( ' < d i v   c l a s s = " d s s S l i d e " > < / d i v > ' ) 	 	 	  
 	 	 $ ( s l i d e S h o w ) . c h i l d r e n ( ' . d s s S l i d e ' ) . w r a p A l l ( ' < d i v   c l a s s = " d s s S l i d e C o n t a i n e r "   p a g e = 0   m a x = ' + n u m S l i d e + ' / > ' ) ;  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e ' )  
 	 	 	 . c s s (   { ' f l o a t ' : ' l e f t ' ,   ' w i d t h ' : o p t i o n s . w i d t h ,   ' h e i g h t ' : o p t i o n s . h e i g h t ,   ' o v e r f l o w - y ' : ' a u t o '   }   ) ;  
  
 	 	 / / a d d   c o n t r o l s 	 	  
 	 	 v a r   l e f t A r r o w   =   ' < d i v   c l a s s = " d s s C o n t r o l "   d i r e c t i o n = - 1 > < s p a n   c l a s s = " ' + o p t i o n s . l e f t A r r o w C l a s s + ' " > Ä%< / s p a n > < / < d i v > ' ;  
 	 	 v a r   r i g h t A r r o w   =   ' < d i v   c l a s s = " d s s C o n t r o l "   d i r e c t i o n = 1 > < s p a n   c l a s s = " ' + o p t i o n s . r i g h t A r r o w C l a s s + ' " > º%< / s p a n > < / < d i v > ' ;  
 	 	 $ ( s l i d e S h o w ) . a p p e n d ( ' < d i v   c l a s s = " d s s S e p a r a t o r " > < / d i v > ' ) . f i n d ( ' . d s s S e p a r a t o r ' ) . a d d C l a s s ( o p t i o n s . s e p a r a t o r C l a s s ) ; 	 	  
 	 	  
 	 	 i f (   o p t i o n s . a r r o w   = =   " b e g i n "   )  
 	 	 {  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( l e f t A r r o w ) ;  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( r i g h t A r r o w ) ;  
 	 	 }  
 	 	 i f (   o p t i o n s . a r r o w   = =   " s p l i t "   )  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( l e f t A r r o w ) ;  
 	 	 	 	  
 	 	 f o r ( v a r   i   =   0 ;   i   <   n u m S l i d e ;   i + + )   / / n u m b e r   b u t t o n s  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( ' < d i v   c l a s s = " d s s C o n t r o l "   p a g e = ' + i + ' > ' + ( i + 1 ) + ' < / d i v > ' ) ;  
 	 	 	  
 	 	 i f (   o p t i o n s . a r r o w   = =   " s p l i t "   )  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( r i g h t A r r o w ) ; 	  
 	 	 i f (   o p t i o n s . a r r o w   = =   " e n d "   ) 	 	 	  
 	 	 {  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( l e f t A r r o w ) ;  
 	 	 	 $ ( s l i d e S h o w ) . a p p e n d ( r i g h t A r r o w ) ;  
 	 	 }  
 	 	  
 	 	 / / s t y l e s   f o r   i n n e r   c o n t a i n e r   a n d   c o n t r o l s  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . c s s (   { ' w i d t h ' : o p t i o n s . w i d t h   *   n u m S l i d e ,   ' h e i g h t ' : o p t i o n s . h e i g h t ,   ' o v e r f l o w ' : ' h i d d e n ' }   ) . a d d C l a s s ( o p t i o n s . s l i d e C o n t a i n e r C l a s s ) ;  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s C o n t r o l ' )  
 	 	 	 . a d d C l a s s ( o p t i o n s . c o n t r o l C l a s s )  
 	 	 	 . c s s ( ' f l o a t ' , ' l e f t ' )  
 	 	 	 . h o v e r ( f u n c t i o n ( ) {   $ ( t h i s ) . t o g g l e C l a s s ( o p t i o n s . c o n t r o l H o v e r C l a s s ) ; } )  
 	 	 	 . w r a p A l l ( ' < d i v   c l a s s = " d s s C o n t r o l C o n t a i n e r " / > ' ) ;  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s C o n t r o l C o n t a i n e r ' )  
 	 	 	 . c s s ( { ' h e i g h t ' : ' 1 0 0 % ' ,   ' o v e r f l o w ' : ' h i d d e n ' } )  
 	 	 	 . a d d C l a s s ( o p t i o n s . c o n t r o l C o n t a i n e r C l a s s ) ;  
 	 	  
 	 	 / / a u t o - s l i d e :   q u e u e   a   s e q u e n c e   o f   a n i m a t i o n   w i t h   d e l a y  
 	 	 f o r ( i   =   1 ;   i   <   M a t h . f l o o r ( n u m S l i d e * o p t i o n s . l o o p ) ;   i + + )  
 	 	 {  
 	 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . d e l a y ( o p t i o n s . d e l a y ) ; 	 	 	 	  
 	 	 	 $ . d i v S l i d e S h o w . s l i d e T o ( s l i d e S h o w ,   i   %   n u m S l i d e ,   t r u e ) ;  
 	 	 }  
 	 	 / / i n i t i a l i z e   c o n t r o l s   l o o k  
 	 	 $ . d i v S l i d e S h o w . m a n a g e C o n t r o l s ( s l i d e S h o w ,   0 ) ;  
 	 	  
 	 	 / / c o n t r o l s   c l i c k   h a n d l e r  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s C o n t r o l ' ) . c l i c k ( f u n c t i o n ( ) { 	 	 	 	  
 	 	 	 / / g e t   m a x   p a g e s  
 	 	 	 v a r   m a x   =   $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . c h i l d r e n ( ) . l e n g t h ;  
 	 	 	  
 	 	 	 / / g e t   t a r g e t   p a g e  
 	 	 	 v a r   d i r   =   p a r s e I n t ( $ ( t h i s ) . a t t r ( ' d i r e c t i o n ' ) ) ;  
 	 	 	 i f ( d i r )   / / l e f t   o r   r i g h t   a r r o w  
 	 	 	 {  
 	 	 	 	 v a r   c u r r e n t P a g e   =   p a r s e I n t ( $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . a t t r ( ' p a g e ' ) ) ;  
 	 	 	 	 v a r   g o t o P a g e   =   ( c u r r e n t P a g e   +   d i r   <   m a x   & &   c u r r e n t P a g e   +   d i r   > =   0 )   ?   c u r r e n t P a g e   +   d i r   :   c u r r e n t P a g e ; 	  
 	 	 	 } 	 	 	 	  
 	 	 	 e l s e   / / n u m b e r s  
 	 	 	 	 v a r   g o t o P a g e   =   p a r s e I n t ( $ ( t h i s ) . a t t r ( ' p a g e ' ) ) ;  
 	 	 	  
 	 	 	 / / g o ~  
 	 	 	 $ . d i v S l i d e S h o w . s l i d e T o ( s l i d e S h o w ,   g o t o P a g e ) ;  
 	 	 } ) ; 	 	  
 	 } ;  
 	  
  
 	 $ . d i v S l i d e S h o w . s l i d e T o   =   f u n c t i o n ( s l i d e S h o w ,   g o t o P a g e ,   q u e u e )  
 	 {  
 	 	 / / r e m o v e   a u t o - s l i d e  
 	 	 i f (   ! q u e u e   )  
 	 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . c l e a r Q u e u e ( ) ;  
 	 	  
 	 	 v a r   o p t i o n s   =   $ . d i v S l i d e S h o w . g e t O p t i o n s O b j e c t ( s l i d e S h o w )  
 	 	  
 	 	 / / v a l i d a t e   g o t o P a g e  
 	 	 v a r   m a x   =   $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . c h i l d r e n ( ) . l e n g t h ;  
 	 	 i f ( g o t o P a g e   > =   m a x )  
 	 	 	 g o t o P a g e   =   m a x   -   1 ;  
 	 	 i f ( g o t o P a g e   <   0 )  
 	 	 	 g o t o P a g e   =   0 ;  
 	 	  
 	 	 / / g e t   w i d t h  
 	 	 v a r   w i d t h   =   $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r   . d s s S l i d e ' ) . w i d t h ( ) ; 	 	  
 	 	  
 	 	 / / m a n a g e   c o n t r o l   l o o k   a n d   s t o r e   c u r r e n t   p a g e   a s   a t t r i b u t e ,   t o   b e   e x e c u t e d   j u s t   b e f o r e   a n i m a t i o n  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . q u e u e ( f u n c t i o n ( ) {  
 	 	 	 $ . d i v S l i d e S h o w . m a n a g e C o n t r o l s ( s l i d e S h o w ,   g o t o P a g e ) ;  
 	 	 	 $ ( t h i s ) . a t t r ( ' p a g e ' ,   g o t o P a g e ) ;  
 	 	 	 $ ( t h i s ) . d e q u e u e ( ) ;  
 	 	 } ) ;  
 	 	  
 	 	 / / a n i m a t e  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . a n i m a t e ( 	 { ' m a r g i n - l e f t ' : - g o t o P a g e * w i d t h } 	 ) ; 	 	  
 	 	  
 	 } ;  
 	  
 	 $ . d i v S l i d e S h o w . g e t O p t i o n s O b j e c t   =   f u n c t i o n ( s l i d e S h o w )  
 	 {  
 	 	 v a r   o p t i o n s   =   { } ;  
 	 	 v a r   o p t i o n s L i s t   =   $ . d s s O p t i o n s L i s t ;  
 	 	 f o r   ( v a r   i   i n   o p t i o n s L i s t )  
 	 	 {  
 	 	 	 v a r   a t t r i b u t e   =   $ ( s l i d e S h o w ) . a t t r ( o p t i o n s L i s t [ i ] ) ;  
 	 	 	 i f (   i s N a N (   p a r s e I n t ( a t t r i b u t e )   )   )  
 	 	 	 	 o p t i o n s [ o p t i o n s L i s t [ i ] ]   =   a t t r i b u t e ;  
 	 	 	 e l s e  
 	 	 	 	 o p t i o n s [ o p t i o n s L i s t [ i ] ]   =   p a r s e I n t ( a t t r i b u t e ) ; 	 	 	  
 	 	 }  
 	 	 r e t u r n   o p t i o n s ;  
 	 }  
 	 	  
  
 	 $ . d i v S l i d e S h o w . m a n a g e C o n t r o l s   =   f u n c t i o n ( s l i d e S h o w ,   p a g e )  
 	 {  
 	 	 v a r   o p t i o n s   =   $ . d i v S l i d e S h o w . g e t O p t i o n s O b j e c t ( s l i d e S h o w ) 	  
 	 	 v a r   m a x   =   $ ( s l i d e S h o w ) . f i n d ( ' . d s s S l i d e C o n t a i n e r ' ) . c h i l d r e n ( ) . l e n g t h ;  
 	 	  
 	 	 $ ( s l i d e S h o w ) . f i n d ( ' . d s s C o n t r o l ' ) . e a c h ( f u n c t i o n ( ) {  
 	 	 	 i f (   $ ( t h i s ) . a t t r ( ' d i r e c t i o n ' )   = =   ' 1 ' ) / / r i g h t   a r r o w  
 	 	 	 {  
 	 	 	 	 / * i f (   p a g e   <   m a x   -   1   )  
 	 	 	 	 	 $ ( t h i s ) . c s s ( ' v i s i b i l i t y ' , ' v i s i b l e ' ) ;  
 	 	 	 	 e l s e    
 	 	 	 	 	 $ ( t h i s ) . c s s ( ' v i s i b i l i t y ' , ' h i d d e n ' ) ; * /  
 	 	 	 }  
 	 	 	 e l s e   i f (   $ ( t h i s ) . a t t r ( ' d i r e c t i o n ' )   = =   ' - 1 ' ) / / l e f t   a r r o w  
 	 	 	 {  
 	 	 	 	 / * i f (   p a g e   >   0   )  
 	 	 	 	 	 $ ( t h i s ) . c s s ( ' v i s i b i l i t y ' , ' v i s i b l e ' ) ;  
 	 	 	 	 e l s e    
 	 	 	 	 	 $ ( t h i s ) . c s s ( ' v i s i b i l i t y ' , ' h i d d e n ' ) ; * /  
 	 	 	 }  
 	 	 	 e l s e / / n u m b e r  
 	 	 	 { 	 	 	 	  
 	 	 	 	 i f (   $ ( t h i s ) . a t t r ( ' p a g e ' )   ! =   p a g e   )  
 	 	 	 	 	 $ ( t h i s ) . t o g g l e C l a s s ( o p t i o n s . c o n t r o l A c t i v e C l a s s ,   f a l s e ) ;  
 	 	 	 	 e l s e    
 	 	 	 	 	 $ ( t h i s ) . t o g g l e C l a s s ( o p t i o n s . c o n t r o l A c t i v e C l a s s ,   t r u e ) ;    
 	 	 	 }  
 	 	 } ) ;  
 	 } ;  
  
 } ) ( j Q u e r y ) ; 
