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