ÿþf u n c t i o n   s h o w A l e r t ( )   {  
   a l e r t ( ' H e l l o   W o r l d   -   t h i s   i s   a n   a l e r t   m e s s a g e ! ' ) ;  
 }  
 f u n c t i o n   o p e n M e n u ( i )   {  
         c l o s e A l l M e n u ( ) ;  
         s c _ t o g g l e _ h i d e _ s h o w ( ' h a '   +   i ) ;  
         s c _ t o g g l e _ h i d e _ s h o w ( ' n a h h a '   +   i   +   i ) ;  
         s c _ t o g g l e _ h i d e _ s h o w ( ' n a h h a '   +   i   +   i   +   ' _ t ' ) ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h a '   +   i   +   ' _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 1 ' ;  
 }  
  
 f u n c t i o n   c l o s e M e n u ( i )   {  
         s c _ t o g g l e _ h i d e _ s h o w ( ' h a '   +   i ) ;  
         s c _ t o g g l e _ h i d e _ s h o w ( ' n a h h a '   +   i   +   i ) ;  
         s c _ t o g g l e _ h i d e _ s h o w ( ' n a h h a '   +   i   +   i   +   ' _ t ' ) ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h a '   +   i   +   ' _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 }  
  
 f u n c t i o n   c l o s e A l l M e n u ( )   {          
         v a r   i ;  
         f o r   ( i = 1 ; i < = 9 ; 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 ( ' h a '   +   i   +   ' _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   = =   ' 1 ' )  
                 {                  
                         c l o s e M e n u ( i ) ;        
                 }  
         }  
 }  
 f u n c t i o n   i n i t F l a g s ( )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 1 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 2 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 3 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 4 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 5 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 6 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 7 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 8 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' h a 9 _ m e n u _ c h e c k e d _ f l a g ' ) . v a l u e   =   ' 0 ' ;  
 }  
  
 f u n c t i o n   c l e a r A l l B o r d e r C o l o r O f I m a g e s ( )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 0 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 1 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 2 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 3 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 4 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 5 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 6 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 7 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 8 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 9 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 1 0 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 1 1 " ) . s t y l e . b o r d e r C o l o r   =   " " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 1 2 " ) . s t y l e . b o r d e r C o l o r   =   " " ;      
         d o c u m e n t . g e t E l e m e n t B y I d ( " i m g 1 3 " ) . s t y l e . b o r d e r C o l o r   =   " " ;      
 }  
  
 f u n c t i o n   c l e a r A l l B o r d e r C o l o r O f I m a g e s ( t o t a l )   {  
         v a r   i ;  
         f o r ( i   =   0 ;   i   <   t o t a l ;   i + + ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " i m g " + i ) . s t y l e . b o r d e r C o l o r   =   " " ;      
         }  
 }  
  
 f u n c t i o n   s e t B o r d e r C o l o r O f I m a g e I s R e d ( i d )   {  
         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 t y l e . b o r d e r C o l o r   =   " r e d " ;  
 }  
  
 f u n c t i o n   g e t P V o t e I t e m 1 ( v o t e )   {  
         v a r   i ;  
         v a r   s t a r   =   " * " ;  
         f o r ( i   =   0 ;   i   <   v o t e ;   i + + ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o V o t e 1 ' ) . i n n e r T e x t   + =   s t a r ;  
         }  
 }  
 f u n c t i o n   g e t S V o t e I t e m 1 ( v o t e )   {  
         v a r   i ;  
         v a r   s t a r   =   " * " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' s u p p l i e r V o t e 1 ' ) . i n n e r T e x t   =   " " ;  
         f o r ( i   =   0 ;   i   <   v o t e ;   i + + ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s u p p l i e r V o t e 1 ' ) . i n n e r T e x t   + =   s t a r ;  
         }  
 }  
 f u n c t i o n   g e t A m o u n t I t e m 1 ( a m o u n t )   {  
         i f ( a m o u n t   >   0 )  
         {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s t o r e S t a t u s 1 ' ) . i n n e r T e x t   =   "   C ó   s µn " ;                          
         } 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 t o r e S t a t u s 1 ' ) . i n n e r T e x t   =   "   H ¿t   h à n g " ;  
         }          
 }  
  
 f u n c t i o n   g e t P V o t e I t e m ( v o t e )   {  
         v a r   i ;  
         v a r   s t a r   =   " * " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o V o t e ' ) . i n n e r T e x t   =   " " ;  
         f o r ( i   =   0 ;   i   <   v o t e ;   i + + ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o V o t e ' ) . i n n e r T e x t   + =   s t a r ;  
         }  
 }  
 f u n c t i o n   g e t S V o t e I t e m ( v o t e )   {  
         v a r   i ;  
         v a r   s t a r   =   " * " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' s u p p l i e r V o t e ' ) . i n n e r T e x t   =   " " ;  
         f o r ( i   =   0 ;   i   <   v o t e ;   i + + ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s u p p l i e r V o t e ' ) . i n n e r T e x t   + =   s t a r ;  
         }  
 }  
 f u n c t i o n   g e t A m o u n t I t e m ( a m o u n t )   {  
         i f ( a m o u n t   >   0 )  
         {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' s t o r e S t a t u s ' ) . i n n e r T e x t   =   "   C ó   s µn " ;                          
         } 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 t o r e S t a t u s ' ) . i n n e r T e x t   =   "   H ¿t   h à n g " ;  
         }          
 }  
  
 f u n c t i o n   s h o w C o n t e n t ( n e w D i s p l a y I d ,   f l a g I d )   {  
         v a r   o l d D i s p l a 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 ( f l a g I d ) . v a l u e ;  
         i f   ( ! o l d D i s p l a y I d )  
         {  
                 o l d D i s p l a y I d   =   " d e f a u l t C o n t e n t " ;  
         }  
         d o c u m e n t . g e t E l e m e n t B y I d ( n e w D i s p l a y I d ) . s t y l e . d i s p l a y   =   " b l o c k " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( o l d D i s p l a y I d ) . s t y l e . d i s p l a y   =   " n o n e " ;  
         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 g I d ) . v a l u e   =   n e w D i s p l a y I d ;  
 }  
  
 f u n c t i o n   g e t I n f o r ( d a t a )   {                  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t I n f o r ' ) . v a l u e   =   d a t a ;  
 }  
  
 f u n c t i o n   g e t I m a g e ( p i c )  
 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' i m g ' ) . s r c   =   p i c ;  
 }  
  
 f u n c t i o n   g e t C o l o r L a b e l 1 ( )  
 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 1 ' ) . s t y l e . c o l o r   =   " # b 1 2 e 2 a " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 2 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 3 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
 }  
 f u n c t i o n   g e t C o l o r L a b e l 2 ( )  
 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 1 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 2 ' ) . s t y l e . c o l o r   =   " # b 1 2 e 2 a " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 3 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
 }  
 f u n c t i o n   g e t C o l o r L a b e l 3 ( )  
 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 1 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 2 ' ) . s t y l e . c o l o r   =   " b l a c k " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P i c 3 ' ) . s t y l e . c o l o r   =   " # b 1 2 e 2 a " ;  
 }  
  
 f u n c t i o n   C a l c u l a t e M o n e y ( )  
 {  
         v a r   p r i c e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P r i c e ' ) . i n n e r T e x t ;  
         v a r   q u a n t i t y   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t Q u a n t i t y ' ) . v a l u e ;  
         v a r   p r o m o t i o n   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d P r o m o t i o n ' ) . v a l u e ;  
          
         v a r   s u m   =   p r i c e   *   q u a n t i t y ;  
         v a r   c a l P r o   =   s u m   *   p r o m o t i o n   /   1 0 0 ;  
          
         d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l S u m ' ) . i n n e r T e x t   =   s u m   +   "   V N D " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l S u m A l l ' ) . i n n e r T e x t   =   ( s u m   -   c a l P r o )   +   "   V N D " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l P r o m o t i o n ' ) . i n n e r T e x t   =   c a l P r o   +   "   V N D " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' l b l V n d ' ) . i n n e r T e x t   =   " " ;  
 } 
