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