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