
         g e t S m a r t S t a t u s P i l l ( i t e m )   { 
                 c o n s t   t o d a y   =   n e w   D a t e ( ) ; 
                 c o n s t   s t a r t D a t e   =   t h i s . p a r s e D a t e ( i t e m . s t a r t _ d a t e ) ; 
                 c o n s t   e n d D a t e   =   t h i s . p a r s e D a t e ( i t e m . e n d _ d a t e ) ; 
                 c o n s t   c o m p l e t i o n   =   i t e m . c o m p l e t i o n _ p e r c e n t a g e   | |   0 ; 
                 
                 i f   ( ! s t a r t D a t e   | |   ! e n d D a t e )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - n o t - s t a r t e d \ " > DE  J-//< / s p a n > " ; 
                 } 
                 
                 i f   ( c o m p l e t i o n   > =   1 0 0 )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - c o m p l e t e d \ " > EC*ED< / s p a n > " ; 
                 } 
                 
                 i f   ( t o d a y   <   s t a r t D a t e )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - n o t - s t a r t e d \ " > DE  J(/#< / s p a n > " ; 
                 } 
                 
                 c o n s t   t o t a l D u r a t i o n   =   e n d D a t e   -   s t a r t D a t e ; 
                 c o n s t   e l a p s e d   =   t o d a y   -   s t a r t D a t e ; 
                 c o n s t   e x p e c t e d P r o g r e s s   =   M a t h . m i n ( 1 0 0 ,   ( e l a p s e d   /   t o t a l D u r a t i o n )   *   1 0 0 ) ; 
                 
                 i f   ( t o d a y   >   e n d D a t e )   { 
                         i f   ( c o m p l e t i o n   <   1 0 0 )   { 
                                 r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - d e l a y e d \ " > E*#.1< / s p a n > " ; 
                         }   e l s e   { 
                                 r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - c o m p l e t e d \ " > EC*ED< / s p a n > " ; 
                         } 
                 } 
                 
                 c o n s t   d a y s U n t i l E n d   =   M a t h . c e i l ( ( e n d D a t e   -   t o d a y )   /   ( 1 0 0 0   *   6 0   *   6 0   *   2 4 ) ) ; 
                 
                 i f   ( d a y s U n t i l E n d   < =   2   & &   c o m p l e t i o n   <   7 0 )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - c r i t i c a l \ " > -1,< / s p a n > " ; 
                 } 
                 
                 c o n s t   p r o g r e s s G a p   =   e x p e c t e d P r o g r e s s   -   c o m p l e t i o n ; 
                 i f   ( p r o g r e s s G a p   >   2 0   | |   ( d a y s U n t i l E n d   < =   3   & &   c o m p l e t i o n   <   8 0 ) )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - w a r n i n g \ " > *-0J1< / s p a n > " ; 
                 } 
                 
                 i f   ( p r o g r e s s G a p   >   3 0 )   { 
                         r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - d e l a y e d \ " > E*#.1< / s p a n > " ; 
                 } 
                 
                 r e t u r n   " < s p a n   c l a s s = \ " s t a t u s - p i l l   s t a t u s - o n - t i m e \ " > AJ  'DEH9/< / s p a n > " ; 
         } 
 
 