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