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