ÿþ/ / f l a s h   d i s a b l i n g   /   e n a b l i n g   s c r i p t    
 / / u s e d   w i t h   s w f O b j e c t   f l a s h   e b e d d i n g   s c r i p t    
 / / a u t h o r :   S a k a r i   L a a k s o n e n ,   N a v i a t e c h   /   S a t a m a   I n t e r a c t i v e  
 / / m o d i f i e d :   J o s e p   M a r i a   R o c a ,   B r a i n   A l l i a n c e   S o l u t i o n s   O y   /   S a t a m a   I n t e r a c t i v e  
 / / R e q u i r e s   c h a n g e s   i n   t h e   i m p l e m e n t a t i o n   r o u t i n e   o f   s w f o b j e c t   s c r i p t s .  
 / / e a c h   n e w   s w b o b j e c t   m u s t   b e   c o n d i t i o n a l i s e d   a c c o r d i n g   t o   n o f l a s h O b j . n o f l a s h   a t t r i b u t e  
  
 / / O B J E C T   C O N S T R U C T O R  
  
 f u n c t i o n   f l a s h T o g g l e r O b j ( c s s )   {  
 / / p a r a m e t e r s :   d e f a u l t   v a l u e   f o r   s h o w i n g   f l a s h :   0   =   s h o w   f l a s h ,   1   =   d o n ' t   s h o w  
 / / c s s   d e f i n e s   t h e   p a t h   t o   t h e   s t y l e s h e e t   t h a t   c o n t a i n s   s t y l e s   f o r   e n a b l e / d i s a b l e   b u t t o n  
 / / i f   c s s   i s   n o t   f a l s e   |   0   |   n u l l ,   i t   w i l l   a d d   a   < l i n k >   t a g   t h a t   w i l l   i m p o r t   t h e   s t y l e s h e e t   d e f i n e d   b y   ' c s s '  
 / / s e e   s e t _ b u t t o n _ s t y l e ( )   f o r   d e t a i l s  
  
 / / a t t r i b u t e s   /   v a r s  
 t h i s . d e f a u l t V a l   =   ' 0 ' ;  
 t h i s . n o f l a s h ;  
 t h i s . c o o k i e N a m e   =   ' v i e w N o k i a F l a s h ' ;  
  
 / /   m e t h o d s   /   f u n c t i o n s  
 t h i s . S e t C o o k i e   =   c r e a t e _ c o o k i e ;    
 t h i s . R e a d C o o k i e   =   r e a d _ c o o k i e ;  
 t h i s . T o g g l e F l a s h   =   t o g g l e _ f l a s h ;  
 t h i s . S e t B u t t o n   =   s e t _ b u t t o n ;  
 t h i s . S e t B u t t o n S t y l e   =   s e t _ b u t t o n _ s t y l e ;  
  
 / / r u n   i n n e r   f u n c t i o n s  
 / / i f   c o o k i e   i s   n o t   f o u n d ,   m a k e   i t .    
 t h i s . n o f l a s h   =   t h i s . R e a d C o o k i e ( t h i s . c o o k i e N a m e ) ;  
 i f ( t h i s . n o f l a s h   = = =   n u l l )   {  
 t h i s . S e t C o o k i e ( t h i s . c o o k i e N a m e ,   t h i s . d e f a u l t V a l ) ;  
 t h i s . n o f l a s h   =   t h i s . R e a d C o o k i e ( ) ;  
 }  
 / /   i m p o r t   b u t t o n   s t y l e s   i f   c s s   p a t h   i s   g i v e n  
 i f ( c s s )   {  
 t h i s . S e t B u t t o n S t y l e ( c s s ) ;  
 }  
 / / M a k e   t h e   t o g g l e r   b u t t o n  
 t h i s . S e t B u t t o n ( ) ;  
 }  
  
 / / I N N E R   F U N C T I O N S  
  
 / / c o o k i e   f u n c t i o n s   f r o m     N o k i a   s u r v e y   s c r i p t s  
 f u n c t i o n   c r e a t e _ c o o k i e ( n a m e ,   v a l u e ,   d a y s )   {  
 i f ( d a y s )   {  
 v a r   d a t e   =   n e w   D a t e ( ) ;  
 v a r   e x p i r a t i o n T i m e   =   2 4 * 6 0 * 6 0 * 1 0 0 0 * 1 8 0 ;      
 d a t e . s e t T i m e ( d a t e . g e t T i m e ( )   +   e x p i r a t i o n T i m e )   / / ( d a y s * 6 0 * 6 0 * 1 0 0 0 ) ) ;   * 2 4 * 6 0 * 6 0 * 1 0 0 0  
 v a r   e x p i r e s   =   " ;   e x p i r e s = " + d a t e . t o G M T S t r i n g ( ) ;  
 }   e l s e   {  
 e x p i r e s   =   " " ;  
 }  
 d o c u m e n t . c o o k i e   =   n a m e + " = " + v a l u e + e x p i r e s + " ;   p a t h = / " ;  
 }  
  
 f u n c t i o n   r e a d _ c o o k i e ( n a m e )   {  
 v a r   n a m e E Q   =   n a m e   +   " = " ;  
 v a r   c a   =   d o c u m e n t . c o o k i e . s p l i t ( ' ; ' ) ;  
 f o r ( v a r   i = 0 ;   i < c a . l e n g t h ;   i + + )   {  
 v a r   c   =   c a [ i ] ;  
 w h i l e ( c . c h a r A t ( 0 ) = = '   ' )   {  
 c   =   c . s u b s t r i n g ( 1 , c . l e n g t h ) ;  
 }  
 i f ( c . i n d e x O f ( n a m e E Q )   = =   0 )   {  
 r e t u r n   c . s u b s t r i n g ( n a m e E Q . l e n g t h , c . l e n g t h ) ;  
 }  
 }  
 r e t u r n   n u l l ;  
 }  
  
 f u n c t i o n   s e t _ b u t t o n _ s t y l e ( c s s )   {  
 / / i f   c s s   p a t h   i s   s e t ,   i m p o r t   t h e   g i v e n   c s s      
 v a r   h e a d N o d e   =   d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( ' h e a d ' ) [ 0 ] ;  
 i f ( I E ( ) )   {  
 / / I E   d o e s   n o t   p r o p e r l y   s u p p o r t   c r e a t e E l e m e n t   &   s e t A t t r i b u t e   f u n c t i o n s  
 v a r   l i n k T a g   =   ' < l i n k   h r e f = " ' + c s s + ' "   r e l = " s t y l e s h e e t "   t y p e = " t e x t / c s s " / > ' ;  
 l i n k N o d e   =   d o c u m e n t . c r e a t e E l e m e n t ( l i n k T a g ) ;  
 }   e l s e   {  
 v a r   l i n k N o d e   =   d o c u m e n t . c r e a t e E l e m e n t ( ' l i n k ' ) ;  
 l i n k N o d e . s e t A t t r i b u t e ( ' h r e f ' , c s s ) ;  
 l i n k N o d e . s e t A t t r i b u t e ( ' r e l '   ,   ' s t y l e s h e e t ' ) ;  
 l i n k N o d e . s e t A t t r i b u t e ( ' t y p e ' , ' t e x t / c s s ' ) ;  
 }  
 h e a d N o d e . a p p e n d C h i l d ( l i n k N o d e ) ;  
 r e t u r n ;  
 }  
      
 f u n c t i o n   t o g g l e _ f l a s h ( )   {  
 / / i f   c o o k i e   v a l u e   =   ' 0 ' ,   s e t   i t   t o   ' 1 '   a n d   v i c e   v e r s a  
 t h i s . n o f l a s h   ! = =   ' 1 '   ?   t h i s . S e t C o o k i e ( t h i s . c o o k i e N a m e , ' 1 ' )   :   t h i s . S e t C o o k i e ( t h i s . c o o k i e N a m e , ' 0 ' ) ;  
 / / r e l o a d   t h e   p a g e          
 w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
 }  
      
 f u n c t i o n   s e t _ b u t t o n ( )   {  
 v a r   t e x t   =   ' ' ;  
 v a r   d e s c r i p t i o n   =   ' ' ;  
 / / s e t   u p   p r o p e r   t e x t   a n d   d e s c r i p t i o n  
 i f   ( t h i s . n o f l a s h   ! = =   ' 1 ' )   {  
 t e x t   =   ' V ô   h i Çu   h ó a   h o ¡t   c £n h   s á n g ' ;  
 d e s c r i p t i o n   =   ' T o   s k i p   t h e   f l a s h   a n i m a t i o n   a n d / o r   l o a d   t h i s   p a g e   f a s t e r ,   c l i c k   D i s a b l e   f l a s h   a n i m a t i o n . ' ;  
 }  
 e l s e   {  
 t e x t   =   ' C h o   p h é p   h o ¡t   c £n h   s á n g ' ;  
 d e s c r i p t i o n   =   ' T o   s w i t c h   b a c k   t o   t h e   a n i m a t e d   v e r s i o n   o f   t h i s   p a g e ,   c l i c k   E n a b l e   f l a s h   a n i m a t i o n . ' ;  
 }  
  
 / / p l a c e   t h e   b u t t o n   i n s i d e     < d i v   i d = " f l a s h b u t t o n c o n t a i n e r "   / >  
 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l a s h b u t t o n c o n t a i n e r ' ) . i n n e r H T M L   =   ' < s p a n   i d = " f l a s h b u t t o n "   t i t l e = " ' + d e s c r i p t i o n + ' "   o n c l i c k = " F l a s h T o g g l e r . T o g g l e F l a s h ( ) ; " > ' + t e x t + ' < / s p a n > ' ;  
 }  
  
 f u n c t i o n   I E ( )   {  
 v a r   b r o w s e r   =   n a v i g a t o r . a p p N a m e ;  
 / / v a r   v e r s i o n   =   n a v i g a t o r . a p p V e r s i o n ;  
 r e t u r n   b r o w s e r   = =   " M i c r o s o f t   I n t e r n e t   E x p l o r e r "   / / ?   r   =   t r u e :   r   =   f a l s e ;  
 / / r e t u r n   r ;  
 }  
  
 / /   J a v a S c r i p t   D o c u m e n t  
 
