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