þÿ / /   S c r i p t s   f o r   t h e   P o r t a l   h o m e   p a g e  
 / /   S l i d e s h o w   a n d   C a r o u s e l  
 / /   S t a t e   o f   C a l i f o r n i a  
 / /   5 / 1 9 / 2 0 1 0  
 v a r   C a r o u s e l   =   {  
         w i d t h O f E a c h I m g : 5 0 ,   / /   w i d t h   o f   e a c h   i m a g e ,   i n c l u d i n g   p a d d i n g  
         t o t a l N u m b e r O f I m g s : 1 2 ,  
         n u m b e r O f V i s i b l e I m g s : 6 ,   / /   N u m b e r   o f   i m a g e s   t o   s h o w   a t   a   t i m e  
         s p e e d : 2 0 ,   / /   n u m b e r   o f   p i x e l s   t o   m o v e   e a c h   c y c l e  
         c u r r e n t O f f s e t :   0 ,  
         s c r o l l T i m e r I D :   n u l l ,  
         d i r e c t i o n :   - 1 ,   / /   - 1   =   r i g h t   a r r o w / m o v e   l e f t ,   1   =   l e f t   a r r o w / m o v e   r i g h t  
         c o u n t e r A :   0 ,  
         f C o n t r o l : f u n c t i o n   ( p a r a m D i r e c t i o n )   {  
                 i f   ( ! C a r o u s e l . s c r o l l T i m e r I D )   {  
                         i f   ( ( ( p a r a m D i r e c t i o n   = =   1 )   & &   ( C a r o u s e l . c u r r e n t O f f s e t   <   0 ) )   | |   ( ( p a r a m D i r e c t i o n   = =   - 1 )   & &   ( C a r o u s e l . c u r r e n t O f f s e t   >   ( - 1 ) * C a r o u s e l . w i d t h O f E a c h I m g * ( C a r o u s e l . t o t a l N u m b e r O f I m g s - C a r o u s e l . n u m b e r O f V i s i b l e I m g s ) ) ) )   {  
                                 C a r o u s e l . d i r e c t i o n   =   p a r a m D i r e c t i o n ;  
                                 C a r o u s e l . c o u n t e r A   =   0 ;  
                                 C a r o u s e l . f P e r f o r m S c r o l l ( ) ;  
                         }  
                 }  
         } ,  
         f P e r f o r m S c r o l l : f u n c t i o n   ( )   {   / /   l o o p s   d u r i n g   s c r o l l  
                 C a r o u s e l . c u r r e n t O f f s e t   + =   C a r o u s e l . d i r e c t i o n   *   C a r o u s e l . s p e e d ;  
                 C a r o u s e l . c o u n t e r A   + =   C a r o u s e l . s p e e d ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " c a r o u s e l _ s l i d e r " ) . s t y l e . l e f t   =   C a r o u s e l . c u r r e n t O f f s e t   +   " p x " ;  
                 i f   ( C a r o u s e l . c o u n t e r A   <   C a r o u s e l . w i d t h O f E a c h I m g   *   C a r o u s e l . n u m b e r O f V i s i b l e I m g s )   {  
                         C a r o u s e l . s c r o l l T i m e r I D   =   s e t T i m e o u t ( C a r o u s e l . f P e r f o r m S c r o l l , 5 0 ) ;   / /   s h o r t   p a u s e ,   r e c u r s e   t o   c o n t i n u e   s c r o l l .  
                 }   e l s e   {  
                         / /   F i n i s h e d   s c r o l l  
                         C a r o u s e l . s c r o l l T i m e r I D   =   n u l l ;  
                         i f   ( C a r o u s e l . c u r r e n t O f f s e t   <   0 )   {  
                                 d o c u m e n t . g e t E l e m e n t B y I d ( " c a r o u s e l _ l e f t _ a r r o w " ) . s t y l e . b a c k g r o u n d P o s i t i o n   =   ' 0 p x   0 p x ' ;   / /   l e f t   a r r o w   e n a b l e d  
                         }   e l s e   {  
                                 d o c u m e n t . g e t E l e m e n t B y I d ( " c a r o u s e l _ l e f t _ a r r o w " ) . s t y l e . b a c k g r o u n d P o s i t i o n   =   ' - 6 0 p x   0 p x ' ;   / /   l e f t   a r r o w   d i s a b l e d  
                         }  
                         i f   ( C a r o u s e l . c u r r e n t O f f s e t   >   ( - 1 ) * C a r o u s e l . w i d t h O f E a c h I m g * ( C a r o u s e l . t o t a l N u m b e r O f I m g s - C a r o u s e l . n u m b e r O f V i s i b l e I m g s ) )   {  
                                 d o c u m e n t . g e t E l e m e n t B y I d ( " c a r o u s e l _ r i g h t _ a r r o w " ) . s t y l e . b a c k g r o u n d P o s i t i o n   =   ' - 3 0 p x   0 p x ' ;   / /   r i g h t   a r r o w   e n a b l e d  
                         }   e l s e   {  
                                 d o c u m e n t . g e t E l e m e n t B y I d ( " c a r o u s e l _ r i g h t _ a r r o w " ) . s t y l e . b a c k g r o u n d P o s i t i o n   =   ' - 9 0 p x   0 p x ' ;   / /   r i g h t   a r r o w   d i s a b l e d  
                         }  
                 }  
         }  
 }  
 v a r   S l i d e S h o w   =   {  
         d e l a y M S :   d e l a y ,   / /   D e l a y   b e f o r e   d i s p l a y i n g   n e x t   i m a g e ,   i n   m i l l i s e c o n d s  
         b P l a y i n g :   1 ,   / /   1   =   p l a y i n g ,   0   =   p a u s e d  
         a r r a y I m g s :   n u l l ,   / /   A r r a y   o f   a n c h o r s  
         c u r r e n t I n d e x :   0 ,   / /   I n d e x   o f   c u r r e n t   i m a g e  
         n e x t I n d e x :   1 ,   / /   I n d e x   o f   n e x t   i m a g e  
         m a i n T i m e r I D :   n u l l ,  
         f a d e T i m e r I D :   n u l l ,  
         c o u n t e r Z :   2 ,   / /   c o u n t e r ,   u s e d   f o r   z - i n d e x   o f   f r o n t   i m a g e  
         f M a i n L o o p :   f u n c t i o n   ( )   {   / *   m a i n   l o o p ,   r e p e a t s   e v e r y   x   s e c o n d s   * /  
                 f o r   ( c o u n t e r I   =   0 ;   c o u n t e r I   <   a r r a y I m g s . l e n g t h ;   c o u n t e r I + + )   {  
                         i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ c o n t r o l _ "   +   ( c o u n t e r I ) )   ! =   n u 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 l i d e _ s h o w _ c o n t r o l _ "   +   ( c o u n t e r I ) ) . c l a s s N a m e   =   " D o n t D i s p l a y " ;  
                                 / / d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ c o n t r o l _ "   +   ( c o u n t e r I   +   1 ) ) . s t y l e . d i s p l a y   =   " n o n e " ;  
                         }  
                 }  
  
                 i f   ( a r r a y I m g s . l e n g t h   >   1 )   {  
                         d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ c o n t r o l _ "   +   ( S l i d e S h o w . n e x t I n d e x ) ) . c l a s s N a m e   =   " s l i d e _ s h o w _ c o n t r o l _ h i g h l i g h t " ;  
                         a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] . x O p a c i t y   =   0 ;   / /   S e t   o p a c i t y   o f   n e x t   i m a g e   t o   0  
                         S l i d e S h o w . f S e t O p a c i t y ( a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] ) ;  
                         S l i d e S h o w . c o u n t e r Z + + ;  
                         a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] . s t y l e . z I n d e x   =   S l i d e S h o w . c o u n t e r Z ;   / /   P l a c e   n e x t   < a >   o n   t o p  
                         S l i d e S h o w . f C r o s s F a d e ( ) ;   / /   d o   f a d e  
                         i f   ( S l i d e S h o w . b P l a y i n g )  
                                 S l i d e S h o w . m a i n T i m e r I D   =   s e t T i m e o u t ( S l i d e S h o w . f M a i n L o o p ,   S l i d e S h o w . d e l a y M S ) ;   / /   d e l a y ,   r e c u r s e  
                 }  
                 e l s e  
                         d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ c o n t r o l _ 0 " ) . c l a s s N a m e   =   " s l i d e _ s h o w _ c o n t r o l _ h i g h l i g h t " ;  
         } ,  
         f C r o s s F a d e :   f u n c t i o n   ( )   {   / *   l o o p s   d u r i n g   f a d e   * /  
                 S l i d e S h o w . f a d e T i m e r I D   =   n u l l ;  
                 a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] . x O p a c i t y   + =   . 2 0 ;   / /   f a d e   i n  
                 a r r a y I m g s [ S l i d e S h o w . c u r r e n t I n d e x ] . x O p a c i t y   - =   . 2 0 ;   / /   f a d e   o u t  
                 S l i d e S h o w . f S e t O p a c i t y ( a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] ) ;  
                 S l i d e S h o w . f S e t O p a c i t y ( a r r a y I m g s [ S l i d e S h o w . c u r r e n t I n d e x ] ) ;  
                 i f   ( a r r a y I m g s [ S l i d e S h o w . n e x t I n d e x ] . x O p a c i t y   > =   . 9 9 )   {  
                         / /   d o n e   w i t h   f a d e  
                         S l i d e S h o w . c u r r e n t I n d e x   =   S l i d e S h o w . n e x t I n d e x ;  
                         S l i d e S h o w . n e x t I n d e x   =   ( S l i d e S h o w . c u r r e n t I n d e x   <   a r r a y I m g s . l e n g t h   -   1 )   ?   S l i d e S h o w . c u r r e n t I n d e x   +   1   :   0 ;   / /   i n d e x   o f   n e x t   i m g  
                         f o r   ( c o u n t e r J   =   0 ;   c o u n t e r J   <   a r r a y I m g s . l e n g t h ;   c o u n t e r J + + )   {  
                                 i f   ( S l i d e S h o w . c u r r e n t I n d e x   ! =   c o u n t e r J )   {  
                                         a r r a y I m g s [ c o u n t e r J ] . x O p a c i t y   =   0 ;   / *   M a k e   s u r e   a l l   o t h e r   i m a g e s   a r e   t r a n s p a r e n t .   F i x   p r o b l e m   w h e r e   u s e r   c l i c k s   a r r o w s   r a p i d l y .   * /  
                                         S l i d e S h o w . f S e t O p a c i t y ( a r r a y I m g s [ c o u n t e r J ] ) ;  
                                 }  
                         }  
                 }   e l s e   {  
                         S l i d e S h o w . f a d e T i m e r I D   =   s e t T i m e o u t ( S l i d e S h o w . f C r o s s F a d e ,   5 0 ) ;   / /   s h o r t   p a u s e ,   r e c u r s e   t o   c o n t i n u e   f a d e .  
                 }  
         } ,  
         f S e t O p a c i t y :   f u n c t i o n   ( o b j )   {  
                 i f   ( o b j . x O p a c i t y   >   . 9 9 )   {  
                         o b j . x O p a c i t y   =   . 9 9 ;  
                 }  
                 o b j . s t y l e . o p a c i t y   =   o b j . x O p a c i t y ;   / /   t h e   C S S 3   m e t h o d ,   f o r   n e w e r   M o z i l l a ,   S a f a r i ,   O p e r a  
                 o b j . s t y l e . M o z O p a c i t y   =   o b j . x O p a c i t y ;   / /   o l d e r   M o z i l l a  
                 o b j . s t y l e . f i l t e r   =   " a l p h a ( o p a c i t y = "   +   ( o b j . x O p a c i t y   *   1 0 0 )   +   " ) " ;   / /   f o r   I E  
         } ,  
         f C o n t r o l :   f u n c t i o n   ( c o n t r o l P a r a m )   {   / *   c a l l e d   w h e n   a   b u t t o n   i s   c l i c k e d   * /  
                 i f   ( ! S l i d e S h o w . f a d e T i m e r I D )   {  
                         i f   ( c o n t r o l P a r a m   = =   " p r e v " )   {  
                                 c l e a r T i m e o u t ( S l i d e S h o w . m a i n T i m e r I D ) ;  
                                 S l i d e S h o w . n e x t I n d e x   =   ( S l i d e S h o w . c u r r e n t I n d e x   >   0 )   ?   S l i d e S h o w . c u r r e n t I n d e x   -   1   :   a r r a y I m g s . l e n g t h   -   1 ;   / /   i n d e x   o f   p r e v   i m g  
                                 S l i d e S h o w . f M a i n L o o p ( ) ;  
                         }   e l s e   i f   ( c o n t r o l P a r a m   = =   " n e x t " )   {  
                                 c l e a r T i m e o u t ( S l i d e S h o w . m a i n T i m e r I D ) ;  
                                 S l i d e S h o w . f M a i n L o o p ( ) ;  
                         }   e l s e   {  
                                 i f   ( S l i d e S h o w . c u r r e n t I n d e x   ! =   c o n t r o l P a r a m   -   1 )   {  
                                         S l i d e S h o w . n e x t I n d e x   =   c o n t r o l P a r a m   -   1 ;  
                                         c l e a r T i m e o u t ( S l i d e S h o w . m a i n T i m e r I D ) ;  
                                         S l i d e S h o w . f M a i n L o o p ( ) ;  
                                 }  
                         }  
                 }  
         } ,  
         i n i t i a l i z e :   f u n c t i o n   ( )   {  
                 i f   ( 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 ( " s l i d e _ s h o w _ c o n t a i n e r " ) )   {   / /   M a k e   s u r e   b r o w s e r   s u p p o r t s   g e t E l e m e n t B y I d   a n d   d i v   " s l i d e _ s h o w _ c o n t a i n e r "   e x i s t s  
                         v a r   n e w A n c h o r ;  
                         / / d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ c o n t a i n e r " ) . c l a s s N a m e   + =   "   j a v a s c r i p t _ e n a b l e d " ;  
                         / /   c r e a t e   a r r a y   o f   a l l   i m g   n o d e s  
                         a r r a y I m g s   =   d o c u m e n t . g e t E l e m e n t B y I d ( " s l i d e _ s h o w _ i m a g e s " ) . g e t E l e m e n t s B y T a g N a m e ( " a " ) ;  
                          
  
                         / /   d i s p l a y   f i r s t   i m g  
                         a r r a y I m g s [ S l i d e S h o w . c u r r e n t I n d e x ] . s t y l e . z I n d e x   =   S l i d e S h o w . c o u n t e r Z ;   / /   P l a c e   f i r s t   < a >   o n   t o p  
                         S l i d e S h o w . m a i n T i m e r I D   =   s e t T i m e o u t ( S l i d e S h o w . f M a i n L o o p ,   0 ) ;  
                 }  
         }  
 }  
  
 f u n c t i o n   t o P e r s i a n N u m b e r ( p o s i t i v e N u m b e r )   {  
         v a r   _ a r r a y N u m b e r s   =   [ 'ð ' ,   'ñ ' ,   'ò ' ,   'ó ' ,   'ô ' ,   'õ ' ,   'ö ' ,   '÷ ' ,   'ø ' ,   'ù ' ] ;  
         i f   ( p o s i t i v e N u m b e r   > =   0   & &   p o s i t i v e N u m b e r   <   1 0 )   {  
                 r e t u r n   _ a r r a y N u m b e r s [ p o s i t i v e N u m b e r ] ;  
         }   e l s e   {   / /   f o r   n u m b e r s   l a r g e r   t h a n   9   s p l i t   c o n v e r t   o n e   b y   o n e  
                 v a r   t m p   =   p o s i t i v e N u m b e r . t o S t r i n g ( ) ;  
                 v a r   r e t u r n V a l u e   =   " " ;   ;  
                 f o r   ( v a r   i   =   0 ;   i   <   t m p . l e n g t h ;   i + + )   {  
                         r e t u r n V a l u e   + =   _ a r r a y N u m b e r s [ p a r s e I n t ( t m p [ i ] ) ] ;  
                 }  
                 r e t u r n   r e t u r n V a l u e ;  
         }  
         r e t u r n   1 ;  
 }  
  
