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