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