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