ÿþ/ *  
         C o p y r i g h t   ( c )   2 0 0 8 ,   S p a t i a l P o i n t ,   L L C .  
          
         A l l   r i g h t s   r e s e r v e d .  
          
         h t t p : / / w w w . s p a t i a l p o i n t . c o m  
 * /  
  
 f u n c t i o n   v a l i d a t e R o u t e A d d r e s s C o n t r o l s ( )  
 {  
  
         i f   ( I s E m p t y T e x t B o x ( ' T e x t P o s t a l C o d e ' ) )  
         {  
                 a l e r t ( ' P l e a s e   e n t e r   a t   l e a s t   a   p o s t a l   c o d e ' ) ;  
                  
                 C l e a r R e q u r i e d A d d r e s s F i e l d C o n t r o l L a b e l ( ' T e x t P o s t a l C o d e ' ) ;  
                 H i g h l i g h t R e q u r i e d A d d r e s s F i e l d C o n t r o l L a b e l ( ' T e x t P o s t a l C o d 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   v a l i d a t e A d d r e s s C o n t r o l s ( )   {  
  
         i f   ( I s E m p t y T e x t B o x ( ' T e x t A d d r e s s ' )   & &   ( d o c u m e n t . g e t E l e m e n t B y I d ( d r o p D o w n L i s t S u b d i v i s i o n I d ) = = n u l l   | |   d o c u m e n t . g e t E l e m e n t B y I d ( d r o p D o w n L i s t S u b d i v i s i o n I d ) . s e l e c t e d I n d e x   = =   0 ) )  
         {  
                 a l e r t ( u n m a t c h e d A d d r e s s ) ;  
                  
                 H i g h l i g h t R e q u r i e d A d d r e s s F i e l d C o n t r o l L a b e l ( ' T e x t A d d r e s 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   a d d r e s s C h a n g e d ( )  
 {  
         v a r   c o u n t r y L i s t C o n t r o l   =   d o c u m e n t . g e t E l e m e n t B y I d ( d r o p D o w n L i s t C i t i e s I d ) ;  
  
         i f   ( c o u n t r y L i s t C o n t r o l   ! =   n u l l )   {  
                 c o u n t r y L i s t C o n t r o l . d i s a b l e d   =   t r u e ;  
                 c o u n t r y L i s t C o n t r o l . o p t i o n s . l e n g t h   =   0 ;  
         }  
  
         v a r   s u b d i v i s i o n L i s t C o n t r o l   =   d o c u m e n t . g e t E l e m e n t B y I d ( d r o p D o w n L i s t S u b d i v i s i o n I d ) ;  
  
         i f   ( s u b d i v i s i o n L i s t C o n t r o l   ! =   n u l l )   {  
                 s u b d i v i s i o n L i s t C o n t r o l . s e l e c t e d I n d e x   =   0 ;  
         }  
 }  
  
  
 f u n c t i o n   c l e a r A d d r e s s T e x t ( )   {  
         v a r   a d d r e s s   =   d o c u m e n t . g e t E l e m e n t B y I d ( " r o u t e T o A d d r e s s " ) ;  
         i f   ( a d d r e s s   ! =   n u l l )   {  
                 i f   ( a d d r e s s . v a l u e   = =   d e f a u l t A d d r e s s T e x t )   a d d r e s s . v a l u e   =   " " ;  
         }  
 }  
  
 f u n c t i o n   i s K e y P r e s s e d ( e v t ,   c o d e )   {  
         / /   t h i s   f u n c t i o n   s u p p o r t s   I E ,   N e t s c a p e ,   a n d   F i r e F o x  
         e v t   =   ( e v t )   ?   e v t   :   ( w i n d o w . e v e n t )   ?   e v e n t   :   n u l l ;  
  
         i f   ( e v t )   {  
                 v a r   c h a r C o d e   =   ( e v t . c h a r C o d e )   ?   e v t . c h a r C o d e   :  
 	 	 	 ( ( e v t . k e y C o d e )   ?   e v t . k e y C o d e   :   ( ( e v t . w h i c h )   ?   e v t . w h i c h   :   0 ) ) ;  
  
                 r e t u r n   ( c h a r C o d e   = =   c o d e ) ;  
         }  
  
         r e t u r n   f a l s e ;  
 }  
  
  
 f u n c t i o n   o n S u b d i v i s i o n C h a n g e d ( s u b d i v i s i o n D r o p D o w n )   {  
         v a r   m y i n d e x   =   s u b d i v i s i o n D r o p D o w n . s e l e c t e d I n d e x ;  
  
         v a r   c o u n t r y L i s t C o n t r o l   =   d o c u m e n t . g e t E l e m e n t B y I d ( d r o p D o w n L i s t C i t i e s I d ) ;  
  
  
         i f   ( m y i n d e x   ! =   0 )   {  
                 v a r   s e l V a l u e   =   s u b d i v i s i o n D r o p D o w n . o p t i o n s [ m y i n d e x ] . v a l u e ;  
  
                 c o u n t r y L i s t C o n t r o l . o p t i o n s . l e n g t h   =   0 ;  
                 f o r   ( v a r   i   =   0 ;   i   <   s u b D i v i s i o n L i s t [ s e l V a l u e ] . l e n g t h ;   i + + )   {  
                         c o u n t r y L i s t C o n t r o l . o p t i o n s . a d d ( n e w   O p t i o n ( s u b D i v i s i o n L i s t [ s e l V a l u e ] [ i ] ,   s u b D i v i s i o n L i s t [ s e l V a l u e ] [ i ] ) ) ;  
                 }  
  
                 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' T e x t A d d r e s s ' )   ! =   n u l l )   {  
                         d o c u m e n t . g e t E l e m e n t B y I d ( ' T e x t A d d r e s s ' ) . v a l u e   =   ' ' ;  
                 }  
                 c o u n t r y L i s t C o n t r o l . d i s a b l e d   =   f a l s e ;  
         }  
         e l s e   {  
                 c o u n t r y L i s t C o n t r o l . d i s a b l e d   =   t r u e ;  
                 c o u n t r y L i s t C o n t r o l . o p t i o n s . l e n g t h   =   0 ;  
         }  
 }  
 
