ÿþ/ *  
   *   j Q u e r y   b e f o r e a f t e r   p l u g i n  
   *   @ a u t h o r   a d m i n @ c a t c h m y f a m e . c o m   -   h t t p : / / w w w . c a t c h m y f a m e . c o m  
   *   @ v e r s i o n   1 . 1  
   *   @ d a t e   J a n u a r y   1 2 ,   2 0 1 0  
   *   @ c a t e g o r y   j Q u e r y   p l u g i n  
   *   @ c o p y r i g h t   ( c )   2 0 0 9   a d m i n @ c a t c h m y f a m e . c o m   ( w w w . c a t c h m y f a m e . c o m )  
   *   @ l i c e n s e   C C   A t t r i b u t i o n - N o   D e r i v a t i v e   W o r k s   3 . 0   -   h t t p : / / c r e a t i v e c o m m o n s . o r g / l i c e n s e s / b y - n d / 3 . 0 /  
   * /  
 / /   b e f o r e   i m a g e   :   $ ( ' d i v : e q ( 2 ) ' ,   o b j )  
 / /   a f t e r   i m a g e     :   $ ( ' d i v : e q ( 3 ) ' ,   o b j )  
 ( f u n c t i o n ( $ ) {  
 	 $ . f n . e x t e n d ( {    
 	 	 b e f o r e A f t e r :   f u n c t i o n ( o p t i o n s )  
 	 	 {  
 	 	 	 v a r   d e f a u l t s   =    
 	 	 	 {  
 	 	 	 	 a n i m a t e I n t r o   :   f a l s e ,  
 	 	 	 	 i n t r o D e l a y   :   1 0 0 0 ,  
 	 	 	 	 i n t r o D u r a t i o n   :   1 0 0 0 ,  
 	 	 	 	 s h o w F u l l L i n k s   :   t r u e ,  
 	 	 	 	 i m a g e P a t h   :   ' / j s / b e f o r e A f t e r / '  
 	 	 	 } ;  
 	 	 v a r   o p t i o n s   =   $ . e x t e n d ( d e f a u l t s ,   o p t i o n s ) ;  
  
 	 	 v a r   r a n d I D   =     M a t h . r o u n d ( M a t h . r a n d o m ( ) * 1 0 0 0 0 0 0 0 0 ) ;  
 	  
         	 	 r e t u r n   t h i s . e a c h ( f u n c t i o n ( )   {  
 	 	 	 v a r   o = o p t i o n s ;  
 	 	 	 v a r   o b j   =   $ ( t h i s ) ;  
  
 	 	 	 v a r   i m g W i d t h   =   $ ( ' i m g : f i r s t ' ,   o b j ) . w i d t h ( ) ;  
 	 	 	 v a r   i m g H e i g h t   =   $ ( ' i m g : f i r s t ' ,   o b j ) . h e i g h t ( ) ;  
 	 	 	  
 	 	 	 $ ( o b j )  
 	 	 	 . w i d t h ( i m g W i d t h )  
 	 	 	 . h e i g h t ( i m g H e i g h t )  
 	 	 	 . c s s ( { ' o v e r f l o w ' : ' h i d d e n ' , ' p o s i t i o n ' : ' r e l a t i v e ' , ' p a d d i n g ' : ' 0 ' } ) ;  
 	 	 	  
 	 	 	 / /   P r e l o a d   i m a g e s   a n d   a s s i g n   t h e m   I D s  
 	 	 	 v a r   i m a g e 1   =   $ ( ' < i m g   / > ' ) . a t t r ( ' s r c ' ,   $ ( ' i m g : f i r s t ' ,   o b j ) . a t t r ( ' s r c ' ) ) ;  
 	 	 	 v a r   i m a g e 2   =   $ ( ' < i m g   / > ' ) . a t t r ( ' s r c ' ,   $ ( ' i m g : l a s t ' ,   o b j ) . a t t r ( ' s r c ' ) ) ;  
 	 	 	 $ ( ' i m g : f i r s t ' ,   o b j ) . a t t r ( ' i d ' , ' b e f o r e i m a g e ' + r a n d I D ) ;  
 	 	 	 $ ( ' i m g : l a s t ' ,   o b j ) . a t t r ( ' i d ' , ' a f t e r i m a g e ' + r a n d I D ) ;  
 	 	 	  
 	 	 	 $ ( ' d i v ' ,   o b j ) . c s s ( ' f l o a t ' , ' l e f t ' ) ;   / /   F l o a t   a l l   d i v s   w i t h i n   t h e   c o n t a i n e r   l e f t  
 	 	 	  
 	 	 	 / /   C r e a t e   a n   i n n e r   d i v   w r a p p e r   ( d r a g w r a p p e r )   t o   h o l d   t h e   i m a g e s .  
 	 	 	 $ ( o b j ) . p r e p e n d ( ' < d i v   i d = " d r a g w r a p p e r ' + r a n d I D + ' " > < d i v   i d = " d r a g ' + r a n d I D + ' " > < i m g   w i d t h = " 8 "   h e i g h t = " 5 6 "   a l t = " h a n d l e "   s r c = " ' + o . i m a g e P a t h + ' h a n d l e . g i f "   t i t l e = " U c h y t n t e   m y aí   p r o   p Ye k r y t í   f o t o g r a f i e "   i d = " h a n d l e ' + r a n d I D + ' "   / > < / d i v > < / d i v > ' ) ;   / /   C r e a t e   d r a g   h a n d l e  
 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' p a d d i n g ' : ' 0 ' , ' l e f t ' : ( i m g W i d t h / 2 ) - ( $ ( ' # h a n d l e ' + r a n d I D ) . w i d t h ( ) / 2 ) + ' p x ' , ' z - i n d e x ' : ' 2 0 ' } ) . w i d t h ( $ ( ' # h a n d l e ' + r a n d I D ) . w i d t h ( ) ) . h e i g h t ( i m g H e i g h t ) ;  
 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( { ' o p a c i t y ' : . 2 5 } ) ;   / /   S e t s   t h e   d r a g w r a p p e r   a n d   c o n t e n t s   t o   . 2 5   o p a c i t y  
 	 	 	 	  
 	 	 	 $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . h e i g h t ( i m g H e i g h t ) . w i d t h ( i m g W i d t h / 2 ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' o v e r f l o w ' : ' h i d d e n ' , ' l e f t ' : ' 0 p x ' , ' z - i n d e x ' : ' 1 0 ' } ) ;   / /   S e t   C S S   p r o p e r t i e s   o f   t h e   b e f o r e   i m a g e   d i v  
 	 	 	 $ ( ' d i v : e q ( 3 ) ' ,   o b j ) . h e i g h t ( i m g H e i g h t ) . w i d t h ( i m g W i d t h ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' o v e r f l o w ' : ' h i d d e n ' , ' r i g h t ' : ' 0 p x ' } ) ; 	 / /   S e t   C S S   p r o p e r t i e s   o f   t h e   a f t e r   i m a g e   d i v  
 	 	 	 $ ( ' # d r a g ' + r a n d I D ) . w i d t h ( 2 ) . h e i g h t ( i m g H e i g h t ) . c s s ( { ' b a c k g r o u n d ' : ' # 8 8 8 ' , ' p o s i t i o n ' : ' a b s o l u t e ' , ' l e f t ' : ' 3 p x ' } ) ; 	 / /   S e t   d r a g   h a n d l e   C S S   p r o p e r t i e s  
 	 	 	 $ ( ' # b e f o r e i m a g e ' + r a n d I D ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' t o p ' : ' 0 p x ' , ' l e f t ' : ' 0 p x ' } ) ;  
 	 	 	 $ ( ' # a f t e r i m a g e ' + r a n d I D ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' t o p ' : ' 0 p x ' , ' r i g h t ' : ' 0 p x ' } ) ;  
 	 	 	 $ ( ' # h a n d l e ' + r a n d I D ) . c s s ( { ' p o s i t i o n ' : ' r e l a t i v e ' , ' c u r s o r ' : ' p o i n t e r ' , ' t o p ' : ( i m g H e i g h t / 2 ) - ( $ ( ' # h a n d l e ' + r a n d I D ) . h e i g h t ( ) / 2 ) + ' p x ' , ' l e f t ' : ' - 3 p x ' } )  
 	 	 	  
 	 	 	 $ ( o b j ) . a p p e n d ( ' < i m g   s r c = " ' + o . i m a g e P a t h + ' l t - s m a l l . p n g "   w i d t h = " 7 "   h e i g h t = " 1 5 "   i d = " l t - a r r o w ' + r a n d I D + ' " > < i m g   s r c = " ' + o . i m a g e P a t h + ' r t - s m a l l . p n g "   w i d t h = " 7 "   h e i g h t = " 1 5 "   i d = " r t - a r r o w ' + r a n d I D + ' " > ' ) ;  
  
 	 	 	 v a r   b a r O f f s e t   =   $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . o f f s e t ( ) ;   / /   T h e   c o o r d i n a t e s   o f   t h e   d r a g w r a p p e r   d i v  
 	 	 	 v a r   s t a r t B a r O f f s e t   =   b a r O f f s e t . l e f t ;   / /   T h e   l e f t   c o o r d i n a t e   o f   t h e   d r a g w r a p p e r   d i v  
 	 	 	 v a r   o r i g i n a l L e f t W i d t h   =   $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . w i d t h ( ) ;  
 	 	 	 v a r   o r i g i n a l R i g h t W i d t h   =   $ ( ' d i v : e q ( 3 ) ' ,   o b j ) . w i d t h ( ) ;  
  
 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . d r a g g a b l e ( { h a n d l e : $ ( ' # h a n d l e ' + r a n d I D ) , c o n t a i n m e n t : o b j , a x i s : ' x ' , d r a g :   f u n c t i o n ( e ,   u i ) {  
 	 	 	 	 v a r   o f f s e t   =   $ ( t h i s ) . o f f s e t ( ) ;  
 	 	 	 	 v a r   b a r P o s i t i o n   =   o f f s e t . l e f t   -   s t a r t B a r O f f s e t ;  
 	 	 	 	 $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . w i d t h ( o r i g i n a l L e f t W i d t h   +   b a r P o s i t i o n ) ;  
 	 	 	 	 $ ( ' # l t - a r r o w ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { o p a c i t y : 0 } , 5 0 ) ;  
 	 	 	 	 $ ( ' # r t - a r r o w ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { o p a c i t y : 0 } , 5 0 ) ;  
 	 	 	 	 }  
 	 	 	 } ) ;  
  
 	 	 	 i f ( o . a n i m a t e I n t r o )  
 	 	 	 {  
 	 	 	 	 $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . w i d t h ( i m g W i d t h ) ;  
 	 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( ' l e f t ' , i m g W i d t h - ( $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . w i d t h ( ) / 2 ) + ' p x ' ) ;  
 	 	 	 	 s e t T i m e o u t ( f u n c t i o n ( ) {  
 	 	 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( { ' o p a c i t y ' : 1 } ) . a n i m a t e ( { ' l e f t ' : ( i m g W i d t h / 2 ) - ( $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . w i d t h ( ) / 2 ) + ' p x ' } , o . i n t r o D u r a t i o n , f u n c t i o n ( ) { $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . a n i m a t e ( { ' o p a c i t y ' : . 2 5 } , 1 0 0 0 ) } ) ;  
 	 	 	 	 	 / /   T h e   c a l l b a c k   f u n c t i o n   a t   t h e   e n d   o f   t h e   l a s t   l i n e   i s   t h e r e   b e c a u s e   C h r o m e   s e e m s   t o   f o r g e t   t h a t   t h e   d i v s   h a v e   o v e r l a y     h i d d e n   a p p l i e d   e a r l i e r  
 	 	 	 	 	 $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . w i d t h ( i m g W i d t h ) . a n i m a t e ( { ' w i d t h ' : i m g W i d t h / 2 + ' p x ' } , o . i n t r o D u r a t i o n , f u n c t i o n ( ) { $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . c s s ( ' o v e r f l o w ' , ' h i d d e n ' ) ; c l i c k i t ( ) ; } ) ;  
 	 	 	 	 } , o . i n t r o D e l a y ) ;  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 {  
 	 	 	 	 c l i c k i t ( ) ;  
 	 	 	 }  
  
 	 	 	 f u n c t i o n   c l i c k i t ( )  
 	 	 	 {  
 	 	 	 	 $ ( o b j ) . h o v e r ( f u n c t i o n ( ) {  
 	 	 	 	 	 	 $ ( ' # l t - a r r o w ' + r a n d I D ) . s t o p ( ) . c s s ( { ' z - i n d e x ' : ' 2 0 ' , ' p o s i t i o n ' : ' a b s o l u t e ' , ' t o p ' : i m g H e i g h t / 2 - $ ( ' # l t - a r r o w ' + r a n d I D ) . h e i g h t ( ) / 2 + ' p x ' , ' l e f t ' : p a r s e I n t ( $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( ' l e f t ' ) ) - 1 0 + ' p x ' } ) . a n i m a t e ( { o p a c i t y : 1 , l e f t : p a r s e I n t ( $ ( ' # l t - a r r o w ' + r a n d I D ) . c s s ( ' l e f t ' ) ) - 6 + ' p x ' } , 5 0 0 ) ;  
 	 	 	 	 	 	 $ ( ' # r t - a r r o w ' + r a n d I D ) . s t o p ( ) . c s s ( { ' p o s i t i o n ' : ' a b s o l u t e ' , ' t o p ' : i m g H e i g h t / 2 - $ ( ' # l t - a r r o w ' + r a n d I D ) . h e i g h t ( ) / 2 + ' p x ' , ' l e f t ' : p a r s e I n t ( $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . c s s ( ' l e f t ' ) ) + 1 0 + ' p x ' } ) . a n i m a t e ( { o p a c i t y : 1 , l e f t : p a r s e I n t ( $ ( ' # r t - a r r o w ' + r a n d I D ) . c s s ( ' l e f t ' ) ) + 6 + ' p x ' } , 5 0 0 ) ;  
 	 	 	 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . a n i m a t e ( { ' o p a c i t y ' : 1 } , 5 0 0 ) ;  
 	 	 	 	 	 } , f u n c t i o n ( ) {  
 	 	 	 	 	 	 $ ( ' # l t - a r r o w ' + r a n d I D ) . a n i m a t e ( { o p a c i t y : 0 , l e f t : p a r s e I n t ( $ ( ' # l t - a r r o w ' + r a n d I D ) . c s s ( ' l e f t ' ) ) - 6 + ' p x ' } , 5 0 0 ) ;  
 	 	 	 	 	 	 $ ( ' # r t - a r r o w ' + r a n d I D ) . a n i m a t e ( { o p a c i t y : 0 , l e f t : p a r s e I n t ( $ ( ' # r t - a r r o w ' + r a n d I D ) . c s s ( ' l e f t ' ) ) + 6 + ' p x ' } , 5 0 0 ) ;  
 	 	 	 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . a n i m a t e ( { ' o p a c i t y ' : . 2 5 } , 5 0 0 ) ;  
 	 	 	 	 	 }  
 	 	 	 	 ) ;  
  
 	 	 	 	 / /   W h e n   c l i c k i n g   i n   t h e   c o n t a i n e r ,   m o v e   t h e   b a r   a n d   i m a g e h o l d e r   d i v s  
 	 	 	 	 $ ( o b j ) . c l i c k ( f u n c t i o n ( e ) {  
 	 	 	 	 	  
 	 	 	 	 	 v a r   c l i c k X   =   e . p a g e X   -   t h i s . o f f s e t L e f t ;  
 	 	 	 	 	 v a r   i m g 2 W i d t h   =   i m g W i d t h - c l i c k X ;  
 	 	 	 	 	 $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { ' l e f t ' : c l i c k X - ( $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . w i d t h ( ) / 2 ) + ' p x ' } , 6 0 0 ) ;  
 	 	 	 	 	 $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . s t o p ( ) . a n i m a t e ( { ' w i d t h ' : c l i c k X + ' p x ' } , 6 0 0 , f u n c t i o n ( ) { $ ( ' d i v : e q ( 2 ) ' ,   o b j ) . c s s ( ' o v e r f l o w ' , ' h i d d e n ' ) ; } ) ;   / /   w e b k i t   f i x   f o r   f o r g o t t e n   o v e r f l o w  
 	 	 	 	 	 $ ( ' # l t - a r r o w ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { o p a c i t y : 0 } , 5 0 ) ;  
 	 	 	 	 	 $ ( ' # r t - a r r o w ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { o p a c i t y : 0 } , 5 0 ) ;  
 	 	 	 	 } ) ;  
 	 	 	 	 $ ( o b j ) . o n e ( ' m o u s e m o v e ' ,   f u n c t i o n ( ) { $ ( ' # d r a g w r a p p e r ' + r a n d I D ) . s t o p ( ) . a n i m a t e ( { ' o p a c i t y ' : 1 } , 5 0 0 ) ; } ) ;   / /   I f   t h e   m o u s e   i s   o v e r   t h e   c o n t a i n e r   a n d   w e   a n i m a t e   t h e   i n t r o ,   w e   r u n   t h i s   t o   c h a n g e   t h e   o p a c i t y   s i n c e   t h e   h o v e r   e v e n t   d o e s n t   g e t   t r i g g e r e d   y e t  
 	 	 	 }  
     	 	 } ) ;  
         	 }  
 	 } ) ;  
 } ) ( j Q u e r y ) ; 
