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