ÿþv a r   l e v e l = 1 ;  
 f u n c t i o n   l o a d m e n u ( i n d e x )  
 {  
         v a r   m y a r r m e n u i t e m   =   n e w   A r r a y ( ) ;  
         v a r   r e s I n d e x   =   g e t L i s t C a t e g o r y B y I n d e x ( i n d e x ) ;  
         i f ( r e s I n d e x . v a l u e   ! =   n u l l   & &   t y p e o f ( r e s I n d e x . v a l u e )   = =   ' o b j e c t '   & &   t y p e o f ( r e s I n d e x . v a l u e . T a b l e s )   = =   ' o b j e c t '   & &   r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s . l e n g t h   >   0 )  
         { 	  
 	         f o r ( v a r   i I t e m   =   0   ;   i I t e m   <   r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s . l e n g t h ;   i I t e m   + + )  
 	         { 	 	 	          
 	 	         v a r   l i n k U r l   =   T r i m ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e L i n k U r l ' ] . t o S t r i n g ( ) ) ;  
         	 	  
 	 	         m y a r r m e n u i t e m . p u s h ( n e w   m e n u i t e m ( p a r s e I n t ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e I D ' ] ) ,  
                                                                         r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e I s I m a g e ' ] ,  
 	 	                                                         T r i m ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e N a m e ' ] . t o S t r i n g ( ) ) ,  
 	 	                                                         T r i m ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e N a m e E n g ' ] . t o S t r i n g ( ) ) ,  
 	 	                                                         l i n k U r l ,  
 	 	                                                         p a r s e I n t ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' c a t e C h i l f d O f ' ] ) ,  
 	 	                                                         T r i m ( r e s I n d e x . v a l u e . T a b l e s [ 0 ] . R o w s [ i I t e m ] [ ' o r i e n t ' ] . t o S t r i n g ( ) ) ) ) ;  
 	         }  
         	 	 	  
 	         i f ( m y a r r m e n u i t e m   ! =   n u l l   & &   m y a r r m e n u i t e m . l e n g t h   >   0 )  
 	         { 	  
 	       	         v a r   o b j m e n u   =   n e w   m e n u ( m y a r r m e n u i t e m ) ;  
 	 	         o b j m e n u . i n i t m e n u ( ) ; 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	         }  
 	   }  
 }  
  
 f u n c t i o n   m e n u i t e m ( i d , i s i m g , n a m e v i , n a m e e n g , u r l , c h i l d O f , o r i e n t )  
 { 	  
         t h i s . i d   =   i d ;  
 	 t h i s . n a m e v i = n a m e v i ;  
 	 t h i s . n a m e e n g = n a m e e n g ;  
 	 t h i s . u r l = u r l ;  
 	 t h i s . c h i l d O f = c h i l d O f ;  
 	  
 	 s w i t c h ( o r i e n t . t o L o w e r C a s e ( ) )  
 	 {  
 	         c a s e   ' l e f t ' : { t h i s . o r i e n t = 1 ; b r e a k ; }  
 	         c a s e   ' r i g h t ' : { t h i s . o r i e n t = 2 ; b r e a k ; }  
 	         c a s e   ' t o p ' : { t h i s . o r i e n t = 3 ; b r e a k ; }  
 	         c a s e   ' b o t t o m ' : { t h i s . o r i e n t = 4 ; b r e a k ; }  
 	         d e f a u l t   : { t h i s . o r i e n t   =   2 ; }  
 	 }  
 }  
  
 f u n c t i o n   m e n u ( a r r m e n u i t e m )  
 {  
       	 t h i s . a r r m e n u i t e m = a r r m e n u i t e m ;  
 }  
  
  
 m e n u . p r o t o t y p e . g e t a r r i t e m   =   f u n c t i o n ( p a r e n t I D )  
 {  
 	 v a r   a r r i t e m s   =   n e w   A r r a y ( ) ;  
 	  
 	 f o r ( v a r   m I t e m = 0 ;   m I t e m   <   t h i s . a r r m e n u i t e m . l e n g t h   ;   m I t e m + + )  
 	 {  
 	 	 i f ( t h i s . a r r m e n u i t e m [ m I t e m ] . c h i l d O f   = =   p a r e n t I D )  
 	 	 {  
 	 	       	 a r r i t e m s . p u s h ( t h i s . a r r m e n u i t e m [ m I t e m ] ) ; 	  
 	 	 }  
 	 }  
 	 r e t u r n   a r r i t e m s ;  
 }  
  
 m e n u . p r o t o t y p e . r e c u r s i o n   =   f u n c t i o n ( a r r i t e m r o o t , i n d e x )  
 {  
         / /   d u o n g   p h a n   c a c h   n g a n g   g i u a   c a c   i t e m   c o n   c a i   n a o   k h o n g   c o   t h i   h i d e   d i   c  
         / /   n o t e   c o   t h e   c a i   n a y   c u n g   l a m   c h o   c a i   i t e m   c h a   ( p i c t u r e   b i   l e c h   b e   g i a o   d i e n )  
       / /   i f ( i n d e x > 0 )  
         / / {  
             / /     s t m _ a i ( " p 1 i 1 " , [ 6 , 1 , " # F F F F F " , " " , - 1 , - 1 , 0 ] ) ;  
       / /   }  
          
         m e n u i s i m g = a r r i t e m r o o t [ i n d e x ] . i s i m g ;  
          
         i f ( a r r i t e m r o o t [ i n d e x ] . c h i l d O f   ! =   0 )  
 	 {  
 	 / /   m e n u   c o n    
 	      
 	     i f   ( l a n g   = =   ' v i - V N ' )  
               {  
                         / / t h a y   d o i   t ë  " " , " " , - 1 , - 1 , . . . . . .  
 	                 s t m _ a i ( " p 0 i "   +   i n d e x , [ 0 , a r r i t e m r o o t [ i n d e x ] . n a m e v i , " " , " " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f b f 3 e 1 " , 0 , " # f 8 c a 9 0 " , 0 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # f f f f f f " , " # 6 6 6 6 6 6 " , " # 6 6 6 6 6 6 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
 	       }  
 	       e l s e  
 	       {          
 	         / / t h a y   d o i   " " , " " , - 1 , - 1 , . . . . . .  
 	                 s t m _ a i ( " p 0 i "   +   i n d e x , [ 0 , a r r i t e m r o o t [ i n d e x ] . n a m e e n g , " " , " " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f b f 3 e 1 " , 0 , " # f 8 c a 9 0 " , 0 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # f f f f f f " , " # 6 6 6 6 6 6 " , " # 6 6 6 6 6 6 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
 	       }  
 	 }  
 	 e l s e  
 	 { 	 	    
 	         / /   m e n u   c h a      
 	          
 	 / *     i f ( m e n u i s i m g   = =   t r u e )   / /   H i n h   A n h  
 	 	 {  
 	 	          
 	 * /         i f ( i n d e x ! = 0 )  
 	 	                 / /   d u o n g   p h a n   c a c h   d o c   g i u a   c a c   i t e m   c h a  
 	 	           s t m _ a i ( " p 0 i 0 " , [ 2 , " " , " b l a n k . g i f " , " b l a n k . g i f " , 2 , - 1 , 0 , " " , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 1 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 0 0 0 0 0 0 " , " # 0 0 0 0 0 0 " , " 8 p t   V e r d a n a " , " 8 p t   V e r d a n a " , 0 , 0 ] ) ;  
  
 	 	            
 	 	            
 	               i f   ( l a n g   = =   ' v i - V N ' )  
                       {  
                                 i f ( c u r r e n t c a t e ! = n u l l   & &   c u r r e n t c a t e = = a r r i t e m r o o t [ i n d e x ] . i d )  
                                 {  
                                         s t m _ a i ( " p 0 i "   +   i n d e x , [ 2 , " " , " i m g / l a y o u t / b u t t o n / v n / v n _ b t n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " c . g i f " , " i m g / l a y o u t / b u t t o n / v n / v n _ b t n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " b . g i f " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
                                 }  
                                 e l s e  
                                 {  
                                         s t m _ a i ( " p 0 i "   +   i n d e x , [ 2 , " " , " i m g / l a y o u t / b u t t o n / v n / v n _ b t n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " a . g i f " , " i m g / l a y o u t / b u t t o n / v n / v n _ b t n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " b . g i f " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
                                 }  
                       }  
 	               e l s e  
 	               {  
 	 	 	 	 i f ( c u r r e n t c a t e ! = n u l l   & &   c u r r e n t c a t e = = a r r i t e m r o o t [ i n d e x ] . i d )  
                                 {  
 	                         s t m _ a i ( " p 0 i "   +   i n d e x , [ 2 , " " , " i m g / l a y o u t / b u t t o n / e n / b u t t o n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " b . g i f " , " i m g / l a y o u t / b u t t o n / e n / b u t t o n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " a . g i f " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
 	 	 	 	 }  
 	 	 	 	 e l s e  
 	 	 	 	 {  
 	 	 	 	 s t m _ a i ( " p 0 i "   +   i n d e x , [ 2 , " " , " i m g / l a y o u t / b u t t o n / e n / b u t t o n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " . g i f " , " i m g / l a y o u t / b u t t o n / e n / b u t t o n _ 0 " + a r r i t e m r o o t [ i n d e x ] . i d + " a . g i f " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
 	 	 	 	 }  
 	               }  
 	                
 	 	          
 	 	 / * }  
 	 	 e l s e  
 	 	 {  
 	 	  
 	 	         i f ( i n d e x ! = 0 )  
 	 	                 / /   d u o n g   p h a n   c a c h   d o c   g i u a   c a c   i t e m   c h a  
 	 	                 s t m _ a i x ( " p 0 i 1 " , " p 1 i 1 " , [ 6 , 1 , " # 0 0 0 0 0 0 " ] ) ;  
 	 	         i f   ( l a n g   = =   ' v i - V N ' )  
                         {  
                                 / / t h a y   d o i   t ë  " " , " " , - 1 , - 1 , . . . . . .  
                                 s t m _ a i ( " p 0 i "   +   i n d e x , [ 0 , "       " + a r r i t e m r o o t [ i n d e x ] . n a m e v i + "       " , " " , " " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
                         }  
                         e l s e  
                         {  
                                 / / t h a y   d o i   " " , " " , - 1 , - 1 , . . . . . .  
                                 s t m _ a i ( " p 0 i "   +   i n d e x , [ 0 , "       " + a r r i t e m r o o t [ i n d e x ] . n a m e e n g + "       " , " " , " " , - 1 , - 1 , 0 , a r r i t e m r o o t [ i n d e x ] . u r l , " _ s e l f " , " " , " " , " " , " " , 0 , 0 , 0 , " " , " " , 0 , 0 , 0 , 0 , 1 , " # f f f f f f " , 1 , " # f f f f f f " , 1 , " " , " " , 3 , 3 , 0 , 0 , " # f f f f f 7 " , " # 0 0 0 0 0 0 " , " # 4 9 8 9 2 3 " , " # 1 8 4 0 0 2 " , " b o l d   1 2 p x   A r i a l " , " b o l d   1 2 p x   A r i a l " , 0 , 0 ] ) ;  
                                  
                         }  
  
 	 	 } * /  
 	 	  
 	 } 	  
 	  
 	 v a r   a r r i t e m   =   t h i s . g e t a r r i t e m ( a r r i t e m r o o t [ i n d e x ] . i d ) ;  
 	 i f ( a r r i t e m . l e n g t h   >   0 )  
 	 { 	 	  
 	         i f ( a r r i t e m r o o t [ i n d e x ] . i d   > =   2   & &   a r r i t e m r o o t [ i n d e x ] . i d   < =   8 )  
 	         {  
 	 	 / / t h a y   d o i   h i e u   u n g   c u a   m e n u  
 	 	         s t m _ b p ( " p 1 " , [ 1 , 3 , 2 , 0 , 0 , 5 , 0 , 0 , 1 0 0 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , 5 0 , 0 , 0 , " # 3 3 9 9 f f " , " t r a n s p a r e n t " , " " , 3 , 0 , 0 , " # f 6 7 a 0 0 " ] ) ;  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	         i f ( a r r i t e m r o o t [ i n d e x ] . i d = = 3 1 )   / /   A n   t o a n   b o t   n g o t   t h i   s h o w   d u n g   v i   t r i   c u a   M e n u  
 	 	         {  
                                 s t m _ b p ( " p 1 " , [ 1 , a r r i t e m r o o t [ i n d e x ] . o r i e n t , 2 , - 7 5 , 0 , 5 , 0 , 0 , 1 0 0 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , 5 0 , 0 , 0 , " # 3 3 9 9 f f " , " t r a n s p a r e n t " , " " , 3 , 0 , 0 , " # f 6 7 a 0 0 " ] ) ; 	 	  
                         }  
                         e l s e  
                         {  
                                 s t m _ b p ( " p 1 " , [ 1 , a r r i t e m r o o t [ i n d e x ] . o r i e n t , 2 , 0 , 0 , 5 , 0 , 0 , 1 0 0 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , " p r o g i d : D X I m a g e T r a n s f o r m . M i c r o s o f t . W i p e ( G r a d i e n t S i z e = 1 . 0 , w i p e S t y l e = 1 , m o t i o n = r e v e r s e , e n a b l e d = 0 , D u r a t i o n = 0 . 6 0 ) " , 4 , 5 0 , 0 , 0 , " # 3 3 9 9 f f " , " t r a n s p a r e n t " , " " , 3 , 0 , 0 , " # f 6 7 a 0 0 " ] ) ; 	 	  
                         }  
 	 	 }  
 	 	  
 	 	  
 	 	 f o r   ( v a r   j = 0 ;   j <   a r r i t e m . l e n g t h ;   j + + )  
 	 	 {  
 	 	 	 t h i s . r e c u r s i o n ( a r r i t e m ,   j ) ;  
 	 	 }  
 	 	 s t m _ e p ( ) ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 r e t u r n ;  
 	 }  
 } 	  
  
 m e n u . p r o t o t y p e . i n i t m e n u i t e m   =   f u n c t i o n ( a r r r o o t i t e m )  
 {  
 	 i f ( a r r r o o t i t e m . l e n g t h   >   0 )  
 	 {  
 	 	 	  
 	 	 f o r ( v a r   i = 0 ; i <   a r r r o o t i t e m . l e n g t h ; i + + )  
 	 	 {  
 	 	 	 t h i s . r e c u r s i o n ( a r r r o o t i t e m , i ) ;  
 	 	 	  
 	 	 }  
 	 }  
 }  
  
 m e n u . p r o t o t y p e . i n i t m e n u   =   f u n c t i o n ( )  
 { 	  
 	 i f ( t h i s . a r r m e n u i t e m . l e n g t h   >   0 )  
 	 {  
 	 	 v a r   a r r i t e m s R o o t   =   t h i s . g e t a r r i t e m ( 0 ) ;  
 	 	  
 	 	 i f ( a r r i t e m s R o o t . l e n g t h   >   0 )  
 	 	 { 	        
 	 	 	 / / p h a i   d o i   k h i   t a o   m e n u   m o i   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
                         s t m _ b m ( [ " m e n u 6 3 b 0 " , 4 3 0 , " " , " b l a n k . g i f " , 0 , " " , " " , 0 , 0 , 2 5 0 , 0 , 1 0 0 0 , 1 , 0 , 0 , " " , " " , 0 ] , t h i s ) ;  
                         s t m _ b p ( " p 0 " , [ 0 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , 1 0 0 , " " , - 2 , " " , - 2 , 5 0 , 0 , 0 , " # f f f f f 7 " , " t r a n s p a r e n t " , " " , 3 , 0 , 0 , " # 0 0 0 0 0 0 " ] ) ;  
                         / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 	 	 	 t h i s . i n i t m e n u i t e m ( a r r i t e m s R o o t ) ;  
 	 	 	 s t m _ e m ( ) ;  
 	 	 }  
 	 }  
 }  
  
  
  
  
  
 
