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