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