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