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