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