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