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