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