/ /   J a v a S c r i p t   D o c u m e n t  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 f u n c t i o n   M M _ g o T o U R L ( )   {   / / v 3 . 0  
     v a r   i ,   a r g s = M M _ g o T o U R L . a r g u m e n t s ;   d o c u m e n t . M M _ r e t u r n V a l u e   =   f a l s e ;  
     f o r   ( i = 0 ;   i < ( a r g s . l e n g t h - 1 ) ;   i + = 2 )   e v a l ( a r g s [ i ] + " . l o c a t i o n = ' " + a r g s [ i + 1 ] + " ' " ) ;  
 }  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / S a v e   C o o k i e   v a r i a b l e   w i t h   n a m e   a n d   v a l u e  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   s a v e C o o k i e ( n a m e , v a l u e , d a y s )    
 {  
 	 i f   ( d a y s )    
 	 {  
 	 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 	 d a t e . s e t T i m e ( d a t e . g e t T i m e ( ) + ( d a y s * 2 4 * 6 0 * 6 0 * 1 0 0 0 ) )  
 	 	 v a r   e x p i r e s   =   " ;   e x p i r e s = "   +   d a t e . t o G M T S t r i n g ( )  
 	 }  
 	 e l s e   e x p i r e s   =   " "  
 	 d o c u m e n t . c o o k i e   =   n a m e   +   " = "   +   v a l u e   +   e x p i r e s   +   " ; p a t h = / "  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / R e a d   C o o k i e   v a r i a b l e   f r o m   N a m e  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   r e a d C o o k i e ( n a m e )    
 {  
 	 v a r   n a m e E Q   =   n a m e   +   " = "  
 	 v a r   c a   =   d o c u m e n t . c o o k i e . s p l i t ( ' ; ' )  
 	 f o r ( v a r   i = 0 ; i < c a . l e n g t h ; i + + )    
 	 {  
 	 	 v a r   c   =   c a [ i ] ;  
 	 	 w h i l e   ( c . c h a r A t ( 0 ) = = '   ' )   c   =   c . s u b s t r i n g ( 1 , c . l e n g t h )  
 	 	 i f   ( c . i n d e x O f ( n a m e E Q )   = =   0 )    
 	 	 {  
 	 	 	 r e t u r n   c . s u b s t r i n g ( n a m e E Q . l e n g t h , c . l e n g t h )  
 	 	 }  
 	 }  
 	 r e t u r n   n u l l  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / D e l e t e   C o o k i e   v a r i a b l e   f r o m   N a m e  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   d e l e t e C o o k i e ( n a m e )    
 {  
 	 s a v e C o o k i e ( n a m e , ' ' , - 1 )  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / C h e c k   s t r   e m p t y   o r   n o t  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   i s e m p t y ( s t r )    
 {  
 	 a t m p   =   s t r . s p l i t ( S t r i n g . f r o m C h a r C o d e ( 3 2 ) ) ;  
 	 f o r   ( i i = 0 ;   i i <   a t m p . l e n g t h ; i i + +   )    
 	 {  
 	 	 i f   ( a t m p [ i i ]   ! =   " " )    
 	 	 r e t u r n   f a l s e ;  
 	 } 	  
 	 r e t u r n   t r u e ;  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / S u b m i t   f o r m   b y   J a v a s c r i p t  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   s e l f s u b m i t ( s t r a c t i o n )   {  
 	 w i n d o w . d o c u m e n t . f o r m s [ 0 ] . t a r g e t   =   " _ s e l f " ;  
 	 w i n d o w . d o c u m e n t . f o r m s [ 0 ] . a c t i o n   =   s t r a c t i o n ;  
 	 w i n d o w . d o c u m e n t . f o r m s [ 0 ] . s u b m i t ( ) ;  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / C h e c k   v a l u e   f o r   C h e c k B o x  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   s e t c h e c k e d ( v a l , c t r C h k N a m e )   {  
     w i t h   ( d o c u m e n t . f o r m s [ 0 ] )   {  
 	   l e n   =   e l e m e n t s . l e n g t h ;  
           f o r ( v a r   i i = 0 ;   i i < l e n ;   i i + + )   {  
 	 	 i f   ( e l e m e n t s [ i i ] . n a m e   = =   c t r C h k N a m e )   {  
 	 	 	 e l e m e n t s [ i i ] . c h e c k e d   =   v a l ;  
 	 	 }  
 	 }  
     }  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / / C h e c k   v a l u e   f o r   C h e c k B o x  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   c h k r e m o v e ( c t r C h k N a m e )   {  
     f g   =   f a l s e ;  
     w i t h   ( d o c u m e n t . f o r m s [ 0 ] )   {  
 	   l e n   =   e l e m e n t s . l e n g t h ;  
           f o r ( v a r   i i = 0 ;   i i < l e n ;   i i + + )   {  
 	 	 i f   ( ( e l e m e n t s [ i i ] . n a m e   = =   c t r C h k N a m e )   & &   ( e l e m e n t s [ i i ] . c h e c k e d ) )   {  
 	 	 	 f g   =   t r u e ;  
 	 	 	 b r e a k ;  
 	 	 }  
 	 }  
     }  
     r e t u r n ( f g )  
 }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   E m p t y T e x t b o x :   K i e m   t r a   t e x t b o x   c o   r o n g   h a y   k h o n g  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   E m p t y T e x t b o x ( F o r m N a m e , T e x t b o x N a m e )  
 {  
 	 x = d o c u m e n t   +   " . "   +   F o r m N a m e   +   " . "   +   T e x t b o x N a m e ;  
 	 i f   ( x . v a l u e . l e n g t h = = 0 )  
 	 {  
 	 	 r e t u r n   t r u e ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 }  
  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   F o c u s F i e l d ( f i e l d n a m e )  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   F o c u s F i e l d ( F i e l d N a m e )  
 {  
 	 w i n d o w . d o c u m e n t . f o r m [ 0 ] . F i e l d N a m e . f o c u s ( ) ;  
 	 / / x . f o c u s ( ) ;  
 }  
  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   e M a i l C h e c k ( s t r ) :   K i e m   t r a   d i a   c h i   e m a i l  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   e M a i l C h e c k ( s t r )   {  
  
 	 	 v a r   a t = " @ "  
 	 	 v a r   d o t = " . "  
 	 	 v a r   l a t = s t r . i n d e x O f ( a t )  
 	 	 v a r   l s t r = s t r . l e n g t h  
 	 	 v a r   l d o t = s t r . i n d e x O f ( d o t )  
 	 	 i f   ( s t r . i n d e x O f ( a t ) = = - 1 ) {  
 	 	       a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	       r e t u r n   f a l s e  
 	 	 }  
  
 	 	 i f   ( s t r . i n d e x O f ( a t ) = = - 1   | |   s t r . i n d e x O f ( a t ) = = 0   | |   s t r . i n d e x O f ( a t ) = = l s t r ) {  
 	 	       a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	       r e t u r n   f a l s e  
 	 	 }  
  
 	 	 i f   ( s t r . i n d e x O f ( d o t ) = = - 1   | |   s t r . i n d e x O f ( d o t ) = = 0   | |   s t r . i n d e x O f ( d o t ) = = l s t r ) {  
 	 	         a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	         r e t u r n   f a l s e  
 	 	 }  
  
 	 	   i f   ( s t r . i n d e x O f ( a t , ( l a t + 1 ) ) ! = - 1 ) {  
 	 	         a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	         r e t u r n   f a l s e  
 	 	   }  
  
 	 	   i f   ( s t r . s u b s t r i n g ( l a t - 1 , l a t ) = = d o t   | |   s t r . s u b s t r i n g ( l a t + 1 , l a t + 2 ) = = d o t ) {  
 	 	         a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	         r e t u r n   f a l s e  
 	 	   }  
  
 	 	   i f   ( s t r . i n d e x O f ( d o t , ( l a t + 2 ) ) = = - 1 ) {  
 	 	         a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	         r e t u r n   f a l s e  
 	 	   }  
 	 	  
 	 	   i f   ( s t r . i n d e x O f ( "   " ) ! = - 1 ) {  
 	 	         a l e r t ( " I n v a l i d   E - m a i l   I D " )  
 	 	         r e t u r n   f a l s e  
 	 	   }  
  
   	 	   r e t u r n   t r u e 	 	 	 	 	  
 	 }  
  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   I s N u m e r i c :   K i e m   t r a   d u   l i e u   c o   p h a i   S o  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 f u n c t i o n   I s N u m e r i c ( s T e x t )  
 {  
       v a r   V a l i d C h a r s   =   " 0 1 2 3 4 5 6 7 8 9 . " ;  
       v a r   I s N u m b e r = t r u e ;  
       v a r   C h a r ;  
  
    
       f o r   ( i   =   0 ;   i   <   s T e x t . l e n g t h   & &   I s N u m b e r   = =   t r u e ;   i + + )    
             {    
             C h a r   =   s T e x t . c h a r A t ( i ) ;    
             i f   ( V a l i d C h a r s . i n d e x O f ( C h a r )   = =   - 1 )    
                   {  
                   I s N u m b e r   =   f a l s e ;  
                   }  
             }  
       r e t u r n   I s N u m b e r ;  
        
       }  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 / /   G e t D a t e T i m e :   L a y   n g a y   g i o   h e   t h o n g :  
 / /   s t r C o u n t r y :   V I E   o r   E N G  
 / / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
  
 f u n c t i o n   G e t D a t e T i m e ( s t r C o u n t r y )  
 {  
 	 v a r   d = n e w   D a t e ( )  
 	 v a r   m o n t h n a m e = n e w   A r r a y ( " J a n " , " F e b " , " M a r " , " A p r " , " M a y " , " J u n " , " J u l " , " A u g " , " S e p " , " O c t " , " N o v " , " D e c " )  
 	  
 	 i f ( s t r C o u n t r y . t o U p p e r C a s e ( )   = =   " E N G " )  
 	 	 v a r   w e e k d a y = n e w   A r r a y ( " S u n d a y " , " M o n d a y " , " T u e s d a y " , " W e d n e s d a y " , " T h u r s d a y " , " F r i d a y " , " S a t u r d a y " )  
 	 i f ( s t r C o u n t r y . t o U p p e r C a s e ( )   = =   " V I E " )  
 	 	 v a r   w e e k d a y = n e w   A r r a y ( " C h ç  N h ­t " , " T h é  H a i " , " T h é  B a " , " T h é  T °" , " T h é  N m " , " T h é  S á u " , " T h é  B £y " )  
  
 	 d o c u m e n t . w r i t e ( w e e k d a y [ d . g e t D a y ( ) ]   +   " ,   " )  
 	 d o c u m e n t . w r i t e ( d . g e t D a t e ( )   +   " - " )  
 	 / / d o c u m e n t . w r i t e ( m o n t h n a m e [ d . g e t M o n t h ( ) ]   +   "   " )  
 	 d o c u m e n t . w r i t e ( d . g e t M o n t h ( )   +   1   +   " - " )  
 	 d o c u m e n t . w r i t e ( d . g e t F u l l Y e a r ( ) )  
 	 d o c u m e n t . w r i t e ( " ,   "   +   d . g e t H o u r s ( )   +   " : "   +   d . g e t M i n u t e s ( )   +   " : "   +   d . g e t S e c o n d s ( ) )  
 } 