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