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