ÿþ/ *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 F U N C T I O N : 	 S e t E l e m V a l u e ( s D o c E l e m ,   s E l e m V a l u e )  
 I N P U T : 	 	 s D o c E l e m   -   A   s t r i n g   w i t h   t h e   D o c u m e n t   E l e m e n t   N a m e  
                         s E l e m V a l u e   -   A   s t r i n g   w i t h   t h e   v a l u e   t o   a s s i g n   t o   t h e   E l e m e n t  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /  
 f u n c t i o n   S e t E l e m V a l u e ( s D o c E l e m ,   s E l e m V a l u e )  
 {  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( s D o c E l e m ) . v a l u e   =   s E l e m V a l u e ;  
 }  
  
  
 f u n c t i o n   S h o w B e n e f ( v a l I n s u r a n c e P r i c e )  
 { 	  
 	 v a r   v a l P r i c e   =   S t r i n g ( v a l I n s u r a n c e P r i c e ) ;  
 	  
 	 i f   ( v a l P r i c e   = =   " - 1 " )  
 	 {  
 	 	 v a l P r i c e   =   " 0 " ;  
 	 }  
 	  
 	 v a l P r i c e   =   N u m b e r ( v a l P r i c e . r e p l a c e ( " , " ,   " . " ) ) ;  
  
 	 v a r   v a l T o t a l P r i c e   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ T o t a l P r i c e " ) . i n n e r H T M L . r e p l a c e ( " , " ,   " . " ) ) ;  
 	 v a l T o t a l P r i c e   - =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n s u r a n c e O l d P r i c e " ) . v a l u e )  
 	 v a l T o t a l P r i c e   + =   v a l P r i c e ;  
 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ T o t a l P r i c e " ) . i n n e r H T M L   =   S t r i n g ( v a l T o t a l P r i c e . t o F i x e d ( 2 ) ) . r e p l a c e ( " . " ,   " , " ) ;  
  
 	 i f   ( v a l I n s u r a n c e P r i c e   ! =   " - 1 " )  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n s u r a n c e O l d P r i c e " ) . v a l u e   =   v a l I n s u r a n c e P r i c e . r e p l a c e ( " , " ,   " . " ) ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ B e n e f " ) . 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 . g e t E l e m e n t B y I d ( " f l d I n s u r a n c e O l d P r i c e " ) . v a l u e   =   " 0 " ; 	  
 	         d o c u m e n t . g e t E l e m e n t B y I d ( ' d i v _ B e n e f ' ) . s t y l e . d i s p l a y   =   " n o n e " ;    
 	 }  
 }  
  
  
 f u n c t i o n   B a c k G a t h e r D a t a ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a y m e n t " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " A d i t i o n a l D a t a " ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " F o r m 1 " ) . s u b m i t ( ) ;  
 }  
  
  
 f u n c t i o n   T e s t I f R e g u l a r Y e a r ( y e a r )  
 {                        
 	 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 ) ;  
 }  
  
 f u n c t i o n   C a n c e l S w i t c h ( s t a t e ,   d a t a D I V _ I D ,   c a n c e l D I V _ I D )  
 {  
 	 i f   ( s t a t e   = =   " c a n c e l " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c a n c e l D I V _ I D ) . z I n d e x = 1 0 0 ; 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c a n c e l D I V _ I D ) . s t y l e . p o s i t i o n = ' a b s o l u t e ' ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c a n c e l D I V _ I D ) . 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 . g e t E l e m e n t B y I d ( d a t a D I V _ I D ) . s t y l e . w i d t h = 5 0 0 ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( d a t a D I V _ I D ) . s t y l e . h e i g h t = 5 0 0 ; 	 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( d a t a D I V _ I D ) . z I n d e x = 5 0 ; 	  
 	 	 * /  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c a n c e l D I V _ I D ) . s t y l e . l e f t = " 1 2 1 p x " ; 	 	  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( c a n c e l D I V _ I D ) . s t y l e . d i s p l a y = ' n o n e ' ; 	 	  
 	 	  
 	 }  
 }                                                                                                                          
  
 f u n c t i o n   G e t D a y s I n M o n t h ( m o n t h )  
 {  
  
                         v a r   m i n D a y s I n M o n t h   =   3 0 ;  
                         v a r   m a x D a y s I n M o n t h   =   3 1 ;  
  
                         i f   ( m o n t h   <   8 )  
                                       r e t u r n   ( m i n D a y s I n M o n t h   +   ( m o n t h   %   2 ) ) ;  
  
                         r e t u r n   ( m a x D a y s I n M o n t h   -   ( m o n t h   %   2 ) ) ;  
  
 }  
  
    
  
 f u n c t i o n   C h e c k D a t e A u x ( d a y ,   m o n t h ,   y e a r )   / /   d e t e r m i n a   s e   a   d a t a   é   o u   n ã o   v á l i d a  
 {  
  
                         v a r   c o n t r o l   =   ( T e s t I f R e g u l a r Y e a r ( y e a r )   ?   2 8   :   2 9 ) ;  
                                                                                                                                              
                         i f   ( m o n t h   = =   2 )  
                                                 r e t u r n   ( d a y   < =   c o n t r o l ) ;  
                         r e t u r n   ( d a y   < =   G e t D a y s I n M o n t h ( m o n t h ) ) ;  
  
 }  
  
  
 f u n c t i o n   C h e c k W e e k D a y ( d a y I n d e x )  
 {  
 	 i f   ( d a y s _ f l a g s   ! =   " " )  
 	 {  
 	 	 i f   ( d a y s _ f l a g s [ d a y I n d e x ]   = =   " N O " ) 	  
 	 	 	 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 E n d D a t e ( c l i e n t I D )  
 {  
 	 v a r   e n d D a t e _ a u x   =   S t r i n g ( d o c u m e n t . g e t E l e m e n t B y I d ( ' e n d D a t e _ A U X ' +   c l i e n t I D ) . v a l u e ) ;  
 	 	  
 	 v a r   e n d D a t e   =   e n d D a t e _ a u x . s p l i t ( ' / ' ) ;  
 	 	  
 	 v a r   e n d D a t e _ d a t e   =   n e w   D a t e ( ) ;  
 	 v a r   c h o o s e n D a t e _ d a t e   =   n e w   D a t e ( ) ;  
 	  
 	 e n d D a t e _ d a t e . s e t D a t e ( e n d D a t e [ 0 ] ) ;  
 	 e n d D a t e _ d a t e . s e t M o n t h ( e n d D a t e [ 1 ] ) ;  
 	 e n d D a t e _ d a t e . s e t F u l l Y e a r ( e n d D a t e [ 2 ] ) ;  
 	  
 	 c h o o s e n D a t e _ d a t e . s e t D a t e ( d o c u m e n t . g e t E l e m e n t B y I d ( ' d a y '   +   c l i e n t I D ) . v a l u e ) ;  
 	 c h o o s e n D a t e _ d a t e . s e t M o n t h ( d o c u m e n t . g e t E l e m e n t B y I d ( ' m o n t h ' +   c l i e n t I D ) . v a l u e ) ;  
 	 c h o o s e n D a t e _ d a t e . s e t F u l l Y e a r ( d o c u m e n t . g e t E l e m e n t B y I d ( ' y e a r ' +   c l i e n t I D ) . v a l u e ) ;  
 	 i f   ( e n d D a t e _ d a t e   > =   c h o o s e n D a t e _ d a t e )  
 	 	 r e t u r n   t r u e ;  
 	 e l s e  
 	 	 r e t u r n   f a l s e ;  
 }  
                                                                                                                          
  
 f u n c t i o n   C h e c k D a t e S h o r t V a c a t i o n ( d a y ,   m o n t h ,   y e a r ,   c l i e n t I D )  
 {  
  
 	 	 	 E n d D a t e ( c l i e n t I D ) ;  
 	 	 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 	 	 v a r   n o w   =   n e w   D a t e ( ) ;  
 	 	 	  
 	 	 	 d a t e . s e t F u l l Y e a r ( y e a r ) ;  
 	 	 	 d a t e . s e t M o n t h ( m o n t h   -   1 ) ;  
 	 	 	 d a t e . s e t D a t e ( d a y ) ;  
 	 	 	 	 	 	 	 	 	  
 	 	 	 i f   ( ! C h e c k D a t e A u x ( d a y ,   m o n t h ,   y e a r )   | |   d a t e   -   n o w   <   0 )  
                         {  
 	 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' v a l i d T o G o ' ) . v a l u e   =   " 0 " ;  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 5 ] ) ;  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( ! C h e c k E n d D a t e ( c l i e n t I D ) )  
 	 	 	 {  
 	 	 	 	     d o c u m e n t . g e t E l e m e n t B y I d ( ' v a l i d T o G o ' ) . v a l u e   =   " 0 " ;  
 	 	 	 	     a l e r t ( j a v a s c r i p t S e n t e n c e s [ 0 ] ) ;  
 	 	 	 	     r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( ! C h e c k W e e k D a y ( d a t e . g e t D a y ( ) ) )  
 	 	 	 {  
 	 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' v a l i d T o G o ' ) . v a l u e   =   " 0 " ;  
 	 	 	 	       a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 ] ) ;  
 	 	 	 	       r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' v a l i d T o G o ' ) . v a l u e   =   " 1 " ; 	 	 	 	 	 	 	  
                         r e t u r n   t r u e ;  
      
  
 }  
  
 f u n c t i o n   S h o w H i d e F F ( i d )  
 {  
  
 	 v a r   o b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( i d ) ;  
 	  
 	 i f   ( o b j . s t y l e . d i s p l a y   = =   ' n o n e ' )  
 	 	 o b j . s t y l e . d i s p l a y   =   ' '  
 	 e l s e  
 	 {  
 	 	 o b j . s t y l e . d i s p l a y   =   ' n o n e ' ;  
 	 	 v a r   i n d e x   =   i d . s p l i t ( ' _ ' ) [ 1 ] ; 	 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' m y F F N _ '   +   i n d e x ) . v a l u e   =   ' ' ;  
 	 	  
 	 }  
 }  
  
 / /   * * *   F u n c o e s   P a s s a g e i r o s   d e   R e g i s t o   * * * * * *  
 f u n c t i o n   G e t N a m e s T o P u t A u x ( n o m e ,   a p e l i d o , i n d e x , d i v , p a s s I n d e x , B D a t e )  
 {  
 	 v a r   r e s u l t   =   f a l s e ;  
 	  
 	  
 	 v a r   B I a n d P a s s P o r t   =   " " ;  
 	  
 	 i f   ( 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 l d B I ' )   ! =   n u l l   & &   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 l d B I ' ) . l e n g t h   >   0 )  
 	 {  
 	 	 B I a n d P a s s P o r t   + =   " 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 l d B I \ " ) [ " + i n d e x + " ] . v a l u e = d o c u m e n t . g e t E l e m e n t B y I d ( \ " I D N u m b e r _ P a s s " + p a s s I n d e x + " \ " ) . v a l u e ; " ;  
 	  
 	 	 B I a n d P a s s P o r t   + =   " 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 l d P a s s P o r t \ " ) [ " + i n d e x + " ] . v a l u e = d o c u m e n t . g e t E l e m e n t B y I d ( \ " P a s s p o r t _ P a s s " + p a s s I n d e x + " \ " ) . v a l u e ; " ;  
 	 }  
 	 	 	 	 	  
 	 f o r ( v a r   i   =   0 ;   i   <   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 l d N o m e ' ) . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( n o m e   = =   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 l d N o m e ' ) [ i ] . v a l u e   & &   a p e l i d o   = =   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 l d A p e l i d o ' ) [ i ] . v a l u e ) 	 	  
 	 	 	 r e s u l t   =   t r u e  
 	 }  
 	  
 	 i f   ( ! r e s u l t )  
 	 	 r e t u r n   " < a   h r e f = ' j a v a s c r i p t : v o i d ( 0 ) ; '   s t y l e = ' c u r s o r : h a n d '   o n c l i c k = ' S e t T r u e P a s s e n g e r ( " + ( i n d e x   +   1 ) + " ) ; S e t A g e ( " + i n d e x + " , \ " " + B D a t e + " \ " ) ; 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 l d N o m e \ " ) [ " + i n d e x + " ] . v a l u e = \ " " + n o m e + " \ " ; 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 l d A p e l i d o \ " ) [ " + i n d e x + " ] . v a l u e = \ " " + a p e l i d o + " \ " ; d o c u m e n t . g e t E l e m e n t B y I d ( \ " " + d i v + " \ " ) . s t y l e . d i s p l a y = \ " n o n e \ " ; " + B I a n d P a s s P o r t + " ; G e t N a m e s T o P u t ( " + i n d e x + " , \ " " + d i v + " \ " ) ; '   c l a s s = ' n o r m a l _ t e x t ' > & # 1 6 0 ; "   +   n o m e   +   "   "   +   a p e l i d o   +   " & # 1 6 0 ; < / a > < b r > " ;  
 	 e l s e  
 	 	 r e t u r n   " " ;  
 }  
  
 f u n c t i o n   S e t A g e ( i n d e x , b d a t e )  
 {  
 	 v a r   n I n d e x ;  
 	 v a r   n D a y ,   n M o n t h ,   n Y e a r ;  
 	 v a r   i n s e r t e d Y e a r   =   f a l s e ;  
 	  
 	 n I n d e x   =   N u m b e r ( i n d e x ) ;  
 	 n D a y   =   N u m b e r ( b d a t e . s p l i t ( ' / ' ) [ 0 ] ) ;  
 	 n M o n t h   =   N u m b e r ( b d a t e . s p l i t ( ' / ' ) [ 1 ] ) ;  
 	 n Y e a r   =   N u m b e r ( b d a t e . s p l i t ( ' / ' ) [ 2 ] ) ;  
 	 i f   ( 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 l d N a s c i m e n t o D i a ' ) [ i n d e x ] . o p t i o n s   ! =   n u l l )  
 	 {  
 	 	 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 l d N a s c i m e n t o D i a ' ) [ i n d e x ] . o p t i o n s . s e l e c t e d I n d e x   =   ( n D a y   -   1 ) ;  
 	 	 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 l d N a s c i m e n t o M e s ' ) [ i n d e x ] . o p t i o n s . s e l e c t e d I n d e x   =   ( n M o n t h   -   1 ) ;  
 	 	 f o r ( v a r   i   =   0 ;   i   <   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 l d N a s c i m e n t o A n o ' ) [ i n d e x ] . o p t i o n s . l e n g t h ;   i + + )  
 	 	 { 	 	  
 	 	 	 / / a l e r t ( 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 l d N a s c i m e n t o A n o ' ) [ i n d e x ] . o p t i o n s [ i ] . v a l u e ) ;  
 	 	 	 i f   ( N u m b e r ( 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 l d N a s c i m e n t o A n o ' ) [ i n d e x ] . o p t i o n s [ i ] . v a l u e )   = =   n Y e a r )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 i n s e r t e d Y e a r   =   t r u e ;  
 	 	 	 	 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 l d N a s c i m e n t o A n o ' ) [ i n d e x ] . o p t i o n s . s e l e c t e d I n d e x   =   i ; 	 	 	 	 	 	 	 	  
 	 	 	 	 b r e a k ;  
 	 	 	 } 	 	 	  
 	 	 } 	  
 	 	 i f   ( ! i n s e r t e d Y e a r   & &   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 l d T i p o ' ) [ i n d e x ] . v a l u e   = =   " C H " )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 5 0 ] ) ;  
 	 	 }  
 	 	 i f   ( ! i n s e r t e d Y e a r   & &   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 l d T i p o ' ) [ i n d e x ] . v a l u e   = =   " I N " )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 5 1 ] ) ;  
 	 	 } 	 	  
 	 	 / / 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 l d N a s c i m e n t o D i a ' ) [ i n d e x ] . o p t i o n s . s e l e c t e d I n d e x   =   ( n D a y   -   1 ) ;  
 	 }  
 	  
 }  
  
 f u n c t i o n   G e t N a m e s T o P u t ( i n d e x , d i v )  
 {  
 	 v a r   r e s u l t   = " " ;  
 	 v a r   r e s u l t A u x   = " " ;  
  
 	 v a r   n o m e 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s 1 ' ) . v a l u e ;  
 	 v a r   n o m e 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s 2 ' ) . v a l u e ;  
 	 v a r   n o m e 3   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s 3 ' ) . v a l u e ;  
 	  
 	  
 	 v a r   a p e l i d o 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' L N a m e _ P a s s 1 ' ) . v a l u e ;  
 	 v a r   a p e l i d o 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' L N a m e _ P a s s 2 ' ) . v a l u e ;  
 	 v a r   a p e l i d o 3   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' L N a m e _ P a s s 3 ' ) . v a l u e ;  
 	  
 	 v a r   B D a t e 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' B D a t e _ P a s s _ 1 ' ) . v a l u e ;  
 	 v a r   B D a t e 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' B D a t e _ P a s s _ 2 ' ) . v a l u e ;  
 	 v a r   B D a t e 3   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' B D a t e _ P a s s _ 3 ' ) . v a l u e ;  
 	  
 	 r e s u l t A u x   =   r e s u l t ;  
 	 r e s u l t   + =   G e t N a m e s T o P u t A u x ( n o m e 1 ,   a p e l i d o 1 ,   i n d e x ,   d i v , 1 ,   B D a t e 1 ) ; 	 	  
 	 i f   ( r e s u l t   = =   r e s u l t A u x )  
 	 	 S e t T r u e P a s s e n g e r ( 1 ) ;  
 	 e l s e  
 	 	 S e t F a l s e P a s s e n g e r ( 1 ) ;  
 	 	  
 	 r e s u l t A u x   =   r e s u l t ;  
 	 r e s u l t   + =   G e t N a m e s T o P u t A u x ( n o m e 2 ,   a p e l i d o 2 ,   i n d e x ,   d i v , 2 ,   B D a t e 2 ) ;  
 	 i f   ( r e s u l t   = =   r e s u l t A u x )  
 	 	 S e t T r u e P a s s e n g e r ( 2 ) ;  
 	 e l s e  
 	 	 S e t F a l s e P a s s e n g e r ( 2 ) ;  
 	 	  
 	 r e s u l t A u x   =   r e s u l t ;  
 	 r e s u l t   + =   G e t N a m e s T o P u t A u x ( n o m e 3 ,   a p e l i d o 3 ,   i n d e x ,   d i v , 3 ,   B D a t e 3 ) ;  
 	 i f   ( r e s u l t   = =   r e s u l t A u x )  
 	 	 S e t T r u e P a s s e n g e r ( 3 ) ;  
 	 e l s e  
 	 	 S e t F a l s e P a s s e n g e r ( 3 ) ;  
 	  
 	  
 	 r e t u r n   r e s u l t ;  
  
 }  
  
  
 f u n c t i o n   P a s s e n g e r I s T h e S a m e T h a t R e g i s t r y ( i n d e x )  
 {  
 	 v a r   n o m e   =   " " ;  
 	 v a r   a p e l i d o   =   " " ;  
  
 	 i f   ( i n d e x   ! =   0 )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s ' + i n d e x )   ! =   n u l l )  
 	 	 {  
 	 	 	 / / a l e r t ( d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s ' + i n d e x ) . v a l u e ) ;  
 	 	 	 n o m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' F N a m e _ P a s s ' + i n d e x ) . v a l u e ;  
 	 	 	 a p e l i d o   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' L N a m e _ P a s s ' + i n d e x ) . v a l u e  
 	 	 }  
 	 }  
 	 e l s e   / /   c a s o   e s p e c i a l   d o   p r i m e i r o   p a s s a g e i r o  
 	 {  
 	 	 n o m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' C l i e n t N a m e ' ) . v a l u e ;  
 	 	 a p e l i d o   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' C l i e n t L a s t N a m e ' ) . v a l u e ;  
 	 }  
  
 	 f o r ( v a r   i   =   0 ;   i   <   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 l d N o m e ' ) . l e n g t h ;   i + + )  
 	 {  
 	 	 / / a l e r t ( n o m e   +   " : : "   + 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 l d N o m e ' ) [ i ] . v a l u e   +   "   / /   " +   a p e l i d o   +     " : : "   +   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 l d A p e l i d o ' ) [ i ] . v a l u e   +   " | | | | | "   +   ( n o m e   = =   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 l d N o m e ' ) [ i ] . v a l u e   & &   a p e l i d o   = =   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 l d A p e l i d o ' ) [ i ] . v a l u e ) ) ;  
 	 	 i f   ( R e t i r a A c e n t o s ( n o m e )   = =   R e t i r a A c e n t o s ( 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 l d N o m e ' ) [ i ] . v a l u e )   & &   R e t i r a A c e n t o s ( a p e l i d o )   = =   R e t i r a A c e n t o s ( 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 l d A p e l i d o ' ) [ i ] . v a l u e ) ) 	 	  
 	 	 	 r e t u r n   t r u e ;  
 	 }  
 	  
 	 r e t u r n   f a l s e ;  
 	  
 }  
  
  
 / /   V e r i f i c a   s e   o   n o m e   d o   p a s s g e i r o   c o r r e s p o n d e   a i n d a   a o   r e g i s t o   n o   a c t o   d a   s u b m i s s a o   d o   f o r m  
 f u n c t i o n   C h e c k P a s s e n g e r s A n d R e g i s t r y ( )  
 {  
 	 v a r   p a s s e n g e r R e g i s t r y   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' R e g i s t r y P a s s e n g e r s ' ) . v a l u e . s p l i t ( ' , ' ) ;  
 	 v a r   r e s u l t   =   " " ;  
 	  
 	 f o r   ( i   =   0 ;   i   <   p a s s e n g e r R e g i s t r y . l e n g t h ;   i + + )  
 	 	 i f   ( p a s s e n g e r R e g i s t r y [ i ]   = =   " t r u e " )  
 	 	 {  
 	 	 	 / /   O   c l i e n t e   a l t e r o u   a   m a o .  
 	 	 	 i f ( ! P a s s e n g e r I s T h e S a m e T h a t R e g i s t r y ( i ) )  
 	 	 	 	 p a s s e n g e r R e g i s t r y [ i ]   =   " f a l s e " ;  
 	 	 }  
 	 	  
 	 f o r   ( i   =   0 ;   i   <   p a s s e n g e r R e g i s t r y . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( r e s u l t   ! =   " " )  
 	 	 	 r e s u l t   + =   " , " ;  
 	 	  
 	 	 r e s u l t   + =   p a s s e n g e r R e g i s t r y [ i ] ;  
 	 	  
 	 }  
 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' R e g i s t r y P a s s e n g e r s ' ) . v a l u e   =   r e s u l t ;  
 	  
 }  
  
 / /   t r u e   c a s o   o   p a s s a g e i r o   p e r t e n c e   a o   r e g i s t o ,   f a l s e   c a s o   c o n t r a r i o  
 f u n c t i o n   S e t T r u e P a s s e n g e r ( i n d e x )  
 {  
 	 v a r   p a s s e n g e r R e g i s t r y   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' R e g i s t r y P a s s e n g e r s ' ) . v a l u e . s p l i t ( ' , ' ) ;  
 	  
 	 S e t P a s s e n g e r R e g i s t r y ( p a s s e n g e r R e g i s t r y ,   " t r u e " ,   i n d e x ) ;  
 }  
  
  
 f u n c t i o n   S e t F a l s e P a s s e n g e r ( i n d e x )  
 {  
 	 v a r   p a s s e n g e r R e g i s t r y   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' R e g i s t r y P a s s e n g e r s ' ) . v a l u e . s p l i t ( ' , ' ) ;  
 	 	  
 	 S e t P a s s e n g e r R e g i s t r y ( p a s s e n g e r R e g i s t r y ,   " f a l s e " ,   i n d e x ) ;  
 }  
  
  
 f u n c t i o n   S e t P a s s e n g e r R e g i s t r y ( p a s s e n g e r R e g i s t r y , v a l u e ,   i n d e x )  
 {  
 	 v a r   r e s u l t   =   " " ;  
 	  
 	 p a s s e n g e r R e g i s t r y [ i n d e x ]   =   v a l u e ;  
 	  
 	 f o r   ( i   =   0 ;   i   <   p a s s e n g e r R e g i s t r y . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( r e s u l t   ! =   " " )  
 	 	 	 r e s u l t   + =   " , " ;  
 	 	  
 	 	 r e s u l t   + =   p a s s e n g e r R e g i s t r y [ i ] ;  
 	 }  
 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' R e g i s t r y P a s s e n g e r s ' ) . v a l u e   =   r e s u l t ;  
 }  
  
 f u n c t i o n   A d d P a s s T o D i v ( d i v _ i d , i n d e x )  
 {  
  
 	 v a r   o b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( d i v _ i d ) ;  
 	 v a r   n e w d i v   =   d o c u m e n t . c r e a t e E l e m e n t ( ' d i v ' ) ; 	  
 	 v a r   r e s u l t   =   G e t N a m e s T o P u t ( i n d e x ,   d i v _ i d ) ;  
 	  
  
 	 i f   ( o b j . s t y l e . d i s p l a y   = =   ' n o n e ' )  
 	 {  
 	 	 o b j . s t y l e . d i s p l a y = ' b l o c k ' ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 o b j . s t y l e . d i s p l a y = ' n o n e ' ;  
 	 }  
 	  
 	  
 	 i f   ( r e s u l t   ! =   " " )  
 	 	 n e w d i v . i n n e r H T M L   =   r e s u l t ;  
 	 e l s e  
 	 	 o b j . s t y l e . d i s p l a y = ' n o n e ' ;  
 	 n e w d i v . s e t A t t r i b u t e ( ' a l i g n ' , ' c e n t e r ' ) ;  
 	 n e w d i v . s e t A t t r i b u t e ( ' s t y l e ' , ' p a d d i n g - b o t t o m : 2 p x ; ' ) ;  
 	 o b j . i n n e r H T M L   =   ' ' ; 	 	  
 	 o b j . a p p e n d C h i l d ( n e w d i v ) ;  
 	 o b j . b a c k g r o u n d c o l o r = ' # F F F F F F ' ;  
 	 n e w d i v . i n n e r H T M L   + =   " < d i v   s t y l e = ' c u r s o r : h a n d ; b o r d e r - t o p : s o l i d   1 p x ; '   w i d t h = ' 1 0 0 % '   o n c l i c k = ' d o c u m e n t . g e t E l e m e n t B y I d ( \ " " + d i v _ i d + " \ " ) . s t y l e . d i s p l a y = \ " n o n e \ " ; ' > < f o n t   c l a s s = ' n o r m a l _ t e x t ' > " + j a v a s c r i p t S e n t e n c e s [ 4 1 ] + " < / f o n t > < / d i v > " ;  
 	  
 	  
 	  
 }  
  
  
 f u n c t i o n   C h a n g e I d T y p e ( i d T y p e ,   i n d e x ,   c l e a n )  
 {  
 	 i f   ( c l e a n )  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s N u m b e r '   +   i n d e x ) . v a l u e   =   ' ' ;  
  
 	 v a r   i d s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s e n g e r R e g i s t r y I d s '   +   i n d e x ) . v a l u e . s p l i t ( ' , ' ) ;  
 	 i f   ( i d s   ! =   " " )  
 	 { 	 	  
 	 	 i f   ( i d T y p e   = =   ' B I '   & &   i d s [ 0 ]   ! =   " " )  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s N u m b e r '   +   i n d e x ) . v a l u e   =   i d s [ 0 ] ;  
 	 	 e l s e   i f   ( i d T y p e   = =   ' P a s s p o r t '   & &   i d s [ 1 ]   ! =   " " )  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s N u m b e r '   +   i n d e x ) . v a l u e   =   i d s [ 1 ] ;  
 	 }  
 	 	  
 }  
 / /   * * *   E N D   F u n c o e s   P a s s a g e i r o s   d e   R e g i s t o   * * * * * *  
  
  
 f u n c t i o n   C h e c k U n c h e c k U s e R e g D a t a ( s I n d e x )  
 {  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d U s e R e g D a t a _ "   +   s I n d e x ) . v a l u e   = =   " 1 " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d U s e R e g D a t a _ "   +   s I n d e x ) . v a l u e   =   " 0 " ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d U s e R e g D a t a _ "   +   s I n d e x ) . v a l u e   =   " 1 " ;  
 	 }  
 	  
 	 G e t R e g i s t e r D a t a ( s I n d e x )  
 }  
  
  
 f u n c t i o n   C h e c k U n c h e c k F F ( s I n d e x )  
 {  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F F _ "   +   s I n d e x ) . v a l u e   = =   " 1 " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h e c k b o x F F _ "   +   s I n d e x ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v F F D a t a _ "   +   s I n d e x ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F F _ "   +   s I n d e x ) . v a l u e   =   " 0 " ;  
 	 }  
 	 e l s e  
 	 {  
 	         d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h e c k b o x F F _ "   +   s I n d e x ) . c h e c k e d   =   t r u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v F F D a t a _ "   +   s I n d e x ) . 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 . g e t E l e m e n t B y I d ( " f l d F F _ "   +   s I n d e x ) . v a l u e   =   " 1 " ;  
 	 } 	  
 }  
  
 f u n c t i o n   C h e c k U n c h e c k S u p l e m e n t s ( s I n d e x ,   s V a l u e )  
 {  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p l e m e n t s _ "   +   s I n d e x ) . v a l u e   = =   " " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p C h e c k b o x _ "   +   s I n d e x ) . s r c   =   " C h e c k o u t I m a g e s / c h e c k b o x _ o n . g i f " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p l e m e n t s _ "   +   s I n d e x ) . v a l u e   =   s V a l u e ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p C h e c k b o x _ "   +   s I n d e x ) . s r c   =   " C h e c k o u t I m a g e s / c h e c k b o x _ o f f . g i f " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p l e m e n t s _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 } 	  
 }  
  
 f u n c t i o n   S e l e c t I n s u r a n c e ( s V a l u e ,   s I n d e x )  
 {  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n s u r a n c e " ) . v a l u e   =   s V a l u e ;  
 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   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 l d C h k I n s u r a n c e " ) . l e n g t h   ;   i + + )  
 	 {  
 	 	 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 l d C h k I n s u r a n c e " ) [ i ] . c h e c k e d   =   f a l s e ;  
 	 }  
 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k I n s u r a n c e _ "   +   s I n d e x ) . c h e c k e d   =   t r u e ;  
 }  
  
  
 f u n c t i o n   G e t R e g i s t e r D a t a ( s I n d e x )  
 {  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d U s e R e g D a t a _ "   +   s I n d e x ) . v a l u e   = =   " 1 " )  
 	 {  
 	 	 / /   C a s o   e s p e c i a l   d o   p r i m e i r o   p a s s a g e i r o ;  
 	 	 S e t T r u e P a s s e n g e r ( 0 ) ;  
 	 	 S e t C o m b o B o x O p t i o n ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d T r e a t m e n t _ "   +   s I n d e x ) ,   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a T r e a t m e n t " ) . v a l u e ) ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ "   +   s I n d e x ) . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a F i r s t N a m e " ) . v a l u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ "   +   s I n d e x ) . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a L a s t N a m e " ) . v a l u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ "   +   s I n d e x ) . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a A g e " ) . v a l u e ;  
 	 	 S e t G e n d e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a G e n d e r " ) . v a l u e ,   " G e n d e r " ,   s I n d e x ) ;  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c T y p e _ "   +   s I n d e x )   ! =   n u l l )  
 	 	 {  
 	 	         S e t C o m b o B o x O p t i o n ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c T y p e _ "   +   s I n d e x ) ,   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a D o c T y p e " ) . v a l u e ) ;  
 	 	         d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c N u m b e r _ "   +   s I n d e x ) . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a D o c N u m b e r " ) . v a l u e ;  
 	 	         d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c E x p D a t e _ "   +   s I n d e x ) . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " C l i e n t R e g D a t a D o c E x p D a t e " ) . v a l u e ; 	 	  
                 } 	 	          
 	 	  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' c l i e n t F F N C o m p ' )   ! =   n u l l )  
 	 	 {  
 	 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C o m p a n h i a 0 ' )   ! =   n u l l )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 v a r   c o d e s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c l i e n t F F N C o m p ' ) . v a l u e . s p l i t ( ' , ' ) ; 	 	 	 	  
 	 	 	 	 v a r   h a s   =   f a l s e ;  
 	 	 	 	 v a r   m y C o d e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C o m p a n h i a 0 ' ) . v a l u e ;  
 	 	 	 	 v a r   i n d e x ;  
 	 	 	 	  
 	 	 	 	 / /   v e r   s e   a l g u m   d o s   c o d i g o s   d e   c o m p a n h i a s   d o   c l i e n t e   é   o   d a   r e s e r v a  
 	 	 	 	 f o r   ( v a r   a   =   0 ;   a   <   c o d e s . l e n g t h ;   a + + )  
 	 	 	 	 {  
 	 	 	 	 	 i f   ( m y C o d e   = =   c o d e s [ a ] )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 i n d e x   =   a ;  
 	 	 	 	 	 	 h a s   =   t r u e ;  
 	 	 	 	 	 	 b r e a k ;  
 	 	 	 	 	 }  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( h a s )  
 	 	 	 	 { 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' c h e c k F F N _ 0 ' ) . c h e c k e d   ! =   t r u e )  
 	 	 	 	 	 {  
 	 	 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' c h e c k F F N _ 0 ' ) . c h e c k e d   =   t r u e ;  
 	 	 	 	 	 	 S h o w H i d e F F ( ' F F _ 0 ' ) ;  
 	 	 	 	 	 }  
 	 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' m y F F N _ 0 ' ) . v a l u e = d o c u m e n t . g e t E l e m e n t B y I d ( ' c l i e n t F F N ' ) . v a l u e . s p l i t ( ' , ' ) [ i n d e x ] ;  
 	 	 	 	 }  
 	 	 	 } 	 	 	  
 	 	 }  
 	 }  
 	 e l s e  
 	 {  
 	 	 / /   C a s o   e s p e c i a l   d o   p r i m e i r o   p a s s a g e i r o ;  
 	 	 S e t F a l s e P a s s e n g e r ( 0 ) ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d T r e a t m e n t _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	 S e t G e n d e r ( " " ,   " G e n d e r " ,   s I n d e x ) ;  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c T y p e _ "   +   s I n d e x )   ! =   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 ( " f l d D o c T y p e _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	         d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c N u m b e r _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	         d o c u m e n t . g e t E l e m e n t B y I d ( " f l d D o c E x p D a t e _ "   +   s I n d e x ) . v a l u e   =   " " ;  
                 } 	 	          
 	 	  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F F A i r V e n d o r _ "   +   s I n d e x )   ! =   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 ( " f l d F F N u m b e r _ "   +   s I n d e x ) . v a l u e   =   " " ;  
 	 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F F _ "   +   s I n d e x ) . v a l u e   = =   " 1 " )  
 	 	 	 {  
 	 	 	 	 C h e c k U n c h e c k F F ( s I n d e x ) ;  
 	 	 	 }  
 	 	 }  
 	 }  
 }  
  
 f u n c t i o n   S e t C o m b o B o x O p t i o n ( o b j C o m b o B o x ,   s t r O p t i o n V a l u e )  
 {  
 	 f o r   ( v a r   i   =   0 ;   i   <   o b j C o m b o B o x . o p t i o n s . l e n g t h ;   i + + )  
 	 	 i f   ( o b j C o m b o B o x . o p t i o n s [ i ] . v a l u e   = =   s t r O p t i o n V a l u e )  
 	 	 	 o b j C o m b o B o x . o p t i o n s . s e l e c t e d I n d e x   =   i ;  
 }  
  
 f u n c t i o n   F i l l C o n t a c t o ( t l m )  
 {  
 	 	  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' F i l l C o n t a c t ' ) . c h e c k e d   = =   t r u e )  
 	 {  
 	 	  
 	 	 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 l d N o m e C o n t ' ) [ 0 ] . v a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' C l i e n t F i r s t N a m e ' ) . v a l u e   +   '   '   +   d o c u m e n t . g e t E l e m e n t B y I d ( ' C l i e n t L a s t N a m e ' ) . v a l u e ;  
 	 	 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 l d P h o n e C o n t a c t ' ) [ 0 ] . v a l u e   =   t l m ;  
 	 	  
 	 }  
 	 e l s e  
 	 {  
 	 	 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 l d N o m e C o n t ' ) [ 0 ] . v a l u e = ' ' ;  
 	 	 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 l d P h o n e C o n t a c t ' ) [ 0 ] . v a l u e = ' ' ;  
 	 }  
 	  
  
 }  
  
 f u n c t i o n   S e t P a s s e n g e r T y p e ( s F l d V a l u e ,   s F l d N a m e ,   s F l d C o u n t )  
 {  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d "   +   s F l d N a m e   +   " _ "   +   s F l d C o u n t ) . v a l u e   =   s F l d V a l u e ;  
 	  
 	 i f   ( s F l d V a l u e   = =   " C H " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ A D _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ C H _ "   +   s F l d C o u n t ) . c h e c k e d   =   t r u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ I N _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ; 	 	  
 	 }  
 	 e l s e   i f   ( s F l d V a l u e   = =   " I N " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ A D _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ C H _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ I N _ "   +   s F l d C o u n t ) . c h e c k e d   =   t r u e ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ A D _ "   +   s F l d C o u n t ) . c h e c k e d   =   t r u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ C H _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ I N _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 } 	  
 	  
 	 G e t A g e B o x ( s F l d V a l u e ,   s F l d C o u n t )  
 }  
  
 f u n c t i o n   G e t A g e B o x ( v a l ,   i d )  
 {  
 	 i f   ( v a l   = =   " A D " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ A g e C H _ "   +   i d ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ A g e I N _ "   +   i d ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 }  
 	 i f   ( v a l   = =   " C H " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ A g e C H _ "   +   i d ) . 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 . g e t E l e m e n t B y I d ( " d i v _ A g e I N _ "   +   i d ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 }  
 	 i f   ( v a l   = =   " I N " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ A g e C H _ "   +   i d ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ A g e I N _ "   +   i d ) . s t y l e . d i s p l a y   =   " b l o c k " ;  
 	 }  
 }  
  
 f u n c t i o n   U p d a t e P r i c e ( v a l P r i c e ,   s O p e r a t i o n )  
 {  
 	 v a r   v a l T o t a l P r i c e   =   N u m b e r ( S t r i n g ( d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ T o t a l P r i c e " ) . i n n e r H T M L ) . r e p l a c e ( " , " ,   " . " ) ) ;  
 	 	  
 	 i f   ( s O p e r a t i o n   = =   " P L U S " )  
 	 	 v a l T o t a l P r i c e   + =   v a l P r i c e ; 	  
 	 e l s e  
 	 	 v a l T o t a l P r i c e   - =   v a l P r i c e ;  
 	 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' d i v _ T o t a l P r i c e ' ) . i n n e r H T M L   =   S t r i n g ( v a l T o t a l P r i c e . t o F i x e d ( 2 ) ) . r e p l a c e ( " . " ,   " , " ) ;  
 	 U p d a t e C r e d i t V a l u e ( ) ;  
 	 	  
 	 / /   V a i   a l t e r a r   a s   t a x a s   d e   s e g u r a n c a   e   a e r o p o r t o   d i n a m i c a m e n t e  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' v a r i a b l e T a x ' )   ! =   n u l l )  
 	 {  
 	 	 v a r   a u x   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( ' v a r i a b l e T a x ' ) . i n n e r H T M L . r e p l a c e ( " , " ,   " . " ) ) ;  
 	 	  
 	 	 i f   ( s O p e r a t i o n   = =   " P L U S " )  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' v a r i a b l e T a x ' ) . i n n e r H T M L   =   ( a u x   +   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( ' r e s e r v a t i o n T a x P e r s o n ' ) . v a l u e . r e p l a c e ( " , " , " . " ) ) ) . t o F i x e d ( 2 ) ;  
 	 	 e l s e  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' v a r i a b l e T a x ' ) . i n n e r H T M L   =   ( a u x   -   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( ' r e s e r v a t i o n T a x P e r s o n ' ) . v a l u e . r e p l a c e ( " , " , " . " ) ) ) . t o F i x e d ( 2 ) ;  
 	 }  
 }  
  
 f u n c t i o n   U p d a t e C r e d i t V a l u e ( )  
 {  
         v a r   d i v C r e d i t V a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d i v _ C r e d i t V a l u e ' ) ;  
  
         i f   ( d i v C r e d i t V a l u e   ! =   n u l l )  
         {  
                 v a r   v a l C r e d i t V a l u e   =   N u m b e r ( S t r i n g ( d i v C r e d i t V a l u e . i n n e r H T M L ) . r e p l a c e ( " , " ,   " . " ) ) ;  
                 v a r   d i v T o t a l P r i c e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ T o t a l P r i c e " ) ;  
                 v a r   v a l T o t a l P r i c e   =   N u m b e r ( S t r i n g ( d i v T o t a l P r i c e . i n n e r H T M L ) . r e p l a c e ( " , " ,   " . " ) ) ;  
                 v a r   v a l C r e d i t D u r a t i o n   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " h i d C r e d i t D u r a t i o n " ) . v a l u e ) ;  
                 v a r   v a l C r e d i t I n t e r e s t R a t e   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " h i d C r e d i t I n t e r e s t R a t e " ) . v a l u e ) ;  
                  
                 v a l C r e d i t V a l u e   =   v a l T o t a l P r i c e   *   ( 1   +   ( v a l C r e d i t I n t e r e s t R a t e   /   1 0 0 ) )   /   v a l C r e d i t D u r a t i o n ;  
                 d i v C r e d i t V a l u e . i n n e r H T M L   =   S t r i n g ( v a l C r e d i t V a l u e . t o F i x e d ( 2 ) ) . r e p l a c e ( " . " ,   " , " ) ;  
         }                  
 }  
  
 f u n c t i o n   S h o w H i d e D i v S u p ( i d S u p ,   i d S u p P a s s ,   v a l S u p ,   v a l S u p P r i c e )  
 {  
 	 v a r   d i v S u p P r i c e   =   " d i v _ S u p P r i c e _ "   +   i d S u p ;  
 	 v a r   d i v S u p D a t a   =   " d i v _ S u p D a t a _ "   +   i d S u p P a s s ;  
 	 v a r   v a l S u p T o t a l   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p T o t a l " ) . v a l u e ) ;  
          
         v a l S u p P r i c e   =   N u m b e r ( S t r i n g ( v a l S u p P r i c e ) . r e p l a c e ( " , " ,   " . " ) ) ;  
         v a l S u p P r i c e   + =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " r e s e r v a t i o n T a x P e r s o n " ) . v a l u e . r e p l a c e ( " , " ,   " . " ) ) ;  
          
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( d i v S u p P r i c e ) . s t y l e . d i s p l a y   = =   " n o n e " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v S u p P r i c e ) . 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 . g e t E l e m e n t B y I d ( " f l d S u p l e m e n t s _ "   +   i d S u p ) . v a l u e   =   v a l S u p ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k S u p l e m e n t s _ "   +   i d S u p ) . c h e c k e d   =   t r u e ;  
  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( d i v S u p D a t a )   ! =   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 i v S u p D a t a ) . s t y l e . d i s p l a y   =   " b l o c k " ;  
 	         i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p F i r s t N a m e _ "   +   i d S u p P a 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 ( " f l d S u p F i r s t N a m e _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p F i r s t N a m e _ s u p " ) ;  
 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p L a s t N a m e _ "   +   i d S u p P a 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 ( " f l d S u p L a s t N a m e _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p L a s t N a m e _ s u p " ) ;  
 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p G e n d e r _ "   +   i d S u p P a 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 ( " f l d S u p G e n d e r _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p G e n d e r _ s u p " ) ;  
 	 	  
 	 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p T o t a l " ) . v a l u e   =   v a l S u p T o t a l   +   1 ;  
 	 	 U p d a t e P r i c e ( v a l S u p P r i c e ,   " P L U S " ) ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v S u p P r i c e ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p l e m e n t s _ "   +   i d S u p ) . v a l u e   =   " " ; 	 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k S u p l e m e n t s _ "   +   i d S u p ) . c h e c k e d   =   f a l s e ;  
 	 	  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( d i v S u p D a t a )   ! =   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 i v S u p D a t a ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p F i r s t N a m e _ "   +   i d S u p P a 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 ( " f l d S u p F i r s t N a m e _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p F i r s t N a m e " ) ;  
 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p L a s t N a m e _ "   +   i d S u p P a 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 ( " f l d S u p L a s t N a m e _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p L a s t N a m e " ) ;  
 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p G e n d e r _ "   +   i d S u p P a 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 ( " f l d S u p G e n d e r _ "   +   i d S u p P a s s ) . s e t A t t r i b u t e ( " n a m e " ,   " f l d S u p G e n d e r " ) ; 	 	 	  
 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p T o t a l " ) . v a l u e   =   v a l S u p T o t a l   -   1 ;  
 	 	 U p d a t e P r i c e ( v a l S u p P r i c e ,   " M I N U S " ) ;  
 	 }  
 }  
  
  
 f u n c t i o n   G e t R e s e r v a t i o n I n f o ( f i e l d _ r e s e r v a t i o n D e s c ,   t e x t _ r e s e r v a t i o n D e s c ,   f i e l d _ r e s e r v a t i o n T y p e D e s c ,   t e x t _ r e s e r v a t i o n T y p e D e s c ,   f i e l d _ r e s e r v a t i o n I c o n ,   t e x t _ r e s e r v a t i o n I c o n )  
 {  
  
 	 i f   ( f i e l d _ r e s e r v a t i o n D e s c   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d _ r e s e r v a t i o n D e s c )   ! =   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 ( f i e l d _ r e s e r v a t i o n D e s c ) . i n n e r H T M L   =    
 	 	 	 t e x t _ r e s e r v a t i o n D e s c   ;  
 	 	 }  
 	 }  
 	 i f   ( f i e l d _ r e s e r v a t i o n T y p e D e s c   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d _ r e s e r v a t i o n D e s c )   ! =   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 ( f i e l d _ r e s e r v a t i o n T y p e D e s c ) . i n n e r H T M L   =    
 	 	 	 t e x t _ r e s e r v a t i o n T y p e D e s c   ;  
 	 	 }  
 	 }  
 	  
 	 i f ( f i e l d _ r e s e r v a t i o n I c o n   ! =   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 ( f i e l d _ r e s e r v a t i o n I c o n ) . s r c   =    
 	 	 t e x t _ r e s e r v a t i o n I c o n   ;  
 	 }  
 	 	  
  
 }  
  
 f u n c t i o n   G e t C o m p o s e d R e s e r v a t i o n I n f o ( f i e l d _ r e s e r v a t i o n D e s c 2 ,   t e x t _ r e s e r v a t i o n D e s c 2 ,   f i e l d _ r e s e r v a t i o n D e s c ,   t e x t _ r e s e r v a t i o n D e s c ,   f i e l d _ r e s e r v a t i o n T y p e D e s c ,   t e x t _ r e s e r v a t i o n T y p e D e s c ,   f i e l d _ r e s e r v a t i o n I c o n ,   t e x t _ r e s e r v a t i o n I c o n ,   f i e l d _ r e s e r v a t i o n I c o n 2 ,   t e x t _ r e s e r v a t i o n I c o n 2 )  
 {  
  
 	 i f   ( f i e l d _ r e s e r v a t i o n D e s c   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d _ r e s e r v a t i o n D e s c )   ! =   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 ( f i e l d _ r e s e r v a t i o n D e s c ) . i n n e r H T M L   =    
 	 	 	 t e x t _ r e s e r v a t i o n D e s c   ;  
 	 	 }  
 	 }  
 	 i f   ( f i e l d _ r e s e r v a t i o n D e s c 2   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d _ r e s e r v a t i o n D e s c 2 )   ! =   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 ( f i e l d _ r e s e r v a t i o n D e s c 2 ) . i n n e r H T M L   =    
 	 	 	 t e x t _ r e s e r v a t i o n D e s c 2   ;  
 	 	 }  
 	 }  
 	 i f   ( f i e l d _ r e s e r v a t i o n T y p e D e s c   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d _ r e s e r v a t i o n D e s c )   ! =   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 ( f i e l d _ r e s e r v a t i o n T y p e D e s c ) . i n n e r H T M L   =    
 	 	 	 t e x t _ r e s e r v a t i o n T y p e D e s c   ;  
 	 	 }  
 	 }  
 	  
 	 i f ( f i e l d _ r e s e r v a t i o n I c o n   ! =   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 ( f i e l d _ r e s e r v a t i o n I c o n ) . s r c   =    
 	 	 t e x t _ r e s e r v a t i o n I c o n   ;  
 	 }  
 	 / *  
 	 i f ( f i e l d _ r e s e r v a t i o n I c o n 2   ! =   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 ( f i e l d _ r e s e r v a t i o n I c o n 2 ) . s r c   =    
 	 	 t e x t _ r e s e r v a t i o n I c o n 2   ;  
 	 }  
 	 	 * /  
  
 }  
  
 / *  
 f u n c t i o n   S u b m i t F o r m ( f o r m I d )  
 {  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( f o r m I d ) . s u b m i t ( ) ;  
 }  
 * /  
  
 / /   D i v  
 / *  
 f u n c t i o n   S h o w D i v ( d i v I D ,   d i v C o n t r o l )  
 {  
 	 v a r   o b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( d i v I D ) ; 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v I D ) . 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 . g e t E l e m e n t B y I d ( d i v C o n t r o l ) . v a l u e   =   " 1 " ;  
 }  
  
 f u n c t i o n   H i d e D i v ( f o r m I D ,   d i v I D ,   d i v C o n t r o l )  
 {  
 	 v a r   o b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( d i v I D ) ; 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v I D ) . s t y l e . d i s p l a y   =   " n o n e " ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( d i v C o n t r o l ) . v a l u e   =   " 0 " ;  
 }  
 * /  
  
 / /   F u n ç õ e s   A u x i l i a r e s  
 f u n c t i o n   V a l i d V a l u e ( v a l u e ) 	  
 {  
 	 / / v a r   v a l u e   =   S t r i n g ( v a l u e ) ;  
 	 r e t u r n   v a l u e   ! =   n u l l   & &   v a l u e   ! =   " "   & &   v a l u e   ! =   " u n d e f i n e d " ;  
 }  
  
 f u n c t i o n   E r r o r ( i d ,   d e s c )  
 {  
 	 t h i s . i d   =   i d ;  
 	 t h i s . d e s c   =   d e s c ;  
 	  
 	 r e t u r n   t h i s ;  
 }  
  
 f u n c t i o n   T r i m ( s t r )  
 {  
           r e t u r n   s t r . r e p l a c e ( / ^ \ s + | \ s + $ / ,   ' ' ) ;    
  
 }  
  
  
 f u n c t i o n   V a l i d a t e E m a i l ( e m a i l )  
 {  
 	 v a r   r e g   =   / ^ ( \ w + ( ? : ( \ . | \ - ) \ w + ) * ) @ ( ( ? : \ w + ( ? : ( \ . | \ - ) \ w + ) * \ . ) + ) ( [ a - z \ d ] { 2 , } ) $ / i ; 	 	 	      
 	 r e t u r n   r e g . t e s t ( e m a i l ) ;  
 }  
  
 f u n c t i o n   V a l i d a t e P a s s w o r d ( p a s s ,   m i n L e n g t h )  
 {  
 	 r e t u r n   S t r i n g ( p a s s ) . l e n g t h   > =   m i n L e n g t h ;  
 }  
  
 f u n c t i o n   V a l i d a t i o n _ L o g i n ( f l a g _ l o g i n )  
 {  
         i f   ( f l a g _ l o g i n   = =   " l o g i n " )  
         {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " L o g i n " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " L o g i n " ;                  
         }  
          
         r e t u r n   V a l i d a t i o n S i m p l e L o g i n ( ) ;  
 }  
  
 f u n c t i o n   V a l i d a t i o n S i m p l e L o g i n ( )  
 {  
 	 v a r   m i n P a s s L e n g t h   =   4 ;  
 	 v a r   o b j E m a i l   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d E m a i l " ) ;  
 	 v a r   o b j P a s s w o r d   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d P a s s w o r d " ) ;  
 	 	 	  
 	 i f   ( ! V a l i d a t e E m a i l ( o b j E m a i l . v a l u e ) )  
 	 {  
 	 	 a l e r t ( " O   E - m a i l   n ã o   c o r r e s p o n d e   a   u m   f o r m a t o   v á l i d o . " ) ;  
                 o b j E m a i l . f o c u s ( ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	  
 	 i f   ( ! V a l i d a t e P a s s w o r d ( o b j P a s s w o r d . v a l u e ,   m i n P a s s L e n g t h ) )  
 	 {  
 	 	 a l e r t ( " A   p a s s w o r d   d e v e   t e r ,   n o   m í n i m o ,   "   +   m i n P a s s L e n g t h   +   "   c a r a c t e r e s . " ) ;  
 	 	 o b j P a s s w o r d . 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   V a l i d a t i o n _ R e c o v e r P a s s w o r d ( )  
 {  
 	 v a r   o b j E m a i l   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d E m a i l " ) ;  
 	  
 	 i f   ( o b j E m a i l . v a l u e   = =   " " )  
 	 {  
 	 	 a l e r t ( " P o r   f a v o r ,   i n s i r a   o   e - m a i l " ) ;  
                 o b j E m a i l . f o c u s ( ) ; 	 	  
 	 	 r e t u r n   f a l s e ;  
 	 }  
  
 	 i f   ( ! V a l i d a t e E m a i l ( o b j E m a i l . v a l u e ) )  
 	 {  
 	 	 a l e r t ( " P o r   f a v o r ,   i n s i r a   u m   e - m a i l   v á l i d o " ) ;  
 	 	 o b j E m a i l . 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   R e t i r a A c e n t o s ( C a m p o )    
 {  
       / / C a m p o   =   e s c a p e ( C a m p o ) ;  
       / / v a r   A c e n t o s   =     " á à ã â â Á À Ã Â é ê É Ê í Í ó õ ô Ó Ô Õ ú Ú Ü a c e d i l h a s " ;  
       v a r   A c e n t o s   =   " % E 1 % E 0 % E 3 % E 2 % E 2 % C 1 % C 0 % C 3 % C 2 % E 9 % E A % C 9 % C A % E D % C D % F 3 % F 5 % F 4 % D 3 % D 4 % D 5 % F A % D A % D C % E 7 % C 7 "  
       / / v a r   T r a d u c a o   =   " A a a a a A A A A e e E E i I o o o O O O u U U " ;  
       v a r   T r a d u c a o   =   " a a a a a A A A A e e E E i I o o o O O O u U U c C " ;  
       v a r   P o s i c ,   C a r a c ;  
       v a r   T e m p L o g   =   " " ;  
       f o r   ( v a r   i = 0 ;   i   <   C a m p o . l e n g t h ;   i + + )  
       {              
 	 C a r a c   =   C a m p o . c h a r A t ( i ) ;  
 	 P o s i c     =   A c e n t o s . i n d e x O f ( e s c a p e ( C a r a c ) ) ;  
 	 i f   ( P o s i c   >   - 1   & &   e s c a p e ( C a r a c ) . l e n g t h   >   1 )  
 	 {  
 	 	 T e m p L o g   + =   T r a d u c a o . c h a r A t ( P o s i c   /   3 ) ;  
 	 	 / / a l e r t ( " s i m "   +   P o s i c ) ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 T e m p L o g   + =   C a m p o . c h a r A t ( i ) ;  
 	 	 / / a l e r t ( " n a o "   +   P o s i c ) ;  
 	 }  
       }  
             r e t u r n   ( T e m p L o g ) ;  
 }  
  
 / /   F u n ç õ e s   A u x i l i a r e s   d e   v a l i d a ç ã o   d e   P A S S A G E I R O S    
 f u n c t i o n   V e r i f y C h a r ( s t r )  
 {  
 	 s t r   =   R e t i r a A c e n t o s ( T r i m ( s t r ) ) ;  
 	  
 	 s t r   =   S t r i n g ( s t r ) ; 	  
 	 s t r   =   s t r . r e p l a c e ( "   " ,   " " ) ;  
 	 s t r   =   s t r . t o U p p e r C a s e ( ) ;    
 	 / / a l e r t ( s t r ) ;  
 	 v a r   c h ;  
 	 i f   ( s t r   = =   " " ) 	  
 	 	 r e t u r n   f a l s e ;  
 	 f o r   ( v a r   i   =   0 ;   i   <   s t r . l e n g t h ;   i + + )  
 	 {  
 	 	 c h   =   s t r . c h a r A t ( i ) ; 	 	  
 	 	 i f   ( ( c h   <   " A "   | |   " Z "   <   c h ) ) 	 	 	    
 	 	 	 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 e r i f y N u m b e r ( s t r )  
 {  
 	 v a r   c o n t r o l   =   t r u e ;  
 	 v a r   c h ;  
 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   s t r . l e n g t h ;   i + + )  
 	 {  
 	 	 c h   =   s t r . c h a r A t ( i ) ;  
 	 	 i f   ( c h   <   " 0 "   | |   " 9 "   <   c h )    
 	 	 	 c o n t r o l   =   f a l s e ;  
 	 }  
 	  
 	 r e t u r n   c o n t r o l ;  
 }  
  
 f u n c t i o n   G e t D a y s I n M o n t h ( m o n t h )  
 {  
 	 v a r   m i n D a y s I n M o n t h   =   3 0 ;  
 	 v a r   m a x D a y s I n M o n t h   =   3 1 ;  
 	 	 	 	 	 	 	 	 	 	  
 	 i f   ( m o n t h   <   8 )  
 	 	 r e t u r n   ( m i n D a y s I n M o n t h   +   ( m o n t h   %   2 ) ) ;  
 	 r e t u r n   ( m a x D a y s I n M o n t h   -   ( m o n t h   %   2 ) ) ;  
 }  
  
 f u n c t i o n   T e s t I f R e g u l a r Y e a r ( y e a r )  
 { 	  
 	 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 ) ;  
 }  
 	 	 	  
 f u n c t i o n   C h e c k D a t e A u x ( d a y ,   m o n t h ,   y e a r )   / /   d e t e r m i n a   s e   a   d a t a   é   o u   n ã o   v á l i d a  
 {  
 	 v a r   c o n t r o l   =   ( T e s t I f R e g u l a r Y e a r ( y e a r )   ?   2 8   :   2 9 ) ;  
 	  
 	 i f   ( d a y   = =   0   | |   m o n t h   = =   0   | |   y e a r   = =   0 )  
 	 	 r e t u r n   f a l s e ; 	  
 	 i f   ( m o n t h   = =   2 )  
 	 	 r e t u r n   ( d a y   < =   c o n t r o l ) ;  
 	 r e t u r n   ( d a y   < =   G e t D a y s I n M o n t h ( m o n t h ) ) ;  
 }  
  
 f u n c t i o n   V e r i f y D a t e ( y e a r ,   m o n t h ,   d a y )  
 {  
 	 i f   ( y e a r   ! =   - 1   & &   m o n t h   ! =   - 1   & &   d a y   ! =   - 1 )    
 	 	 r e t u r n   C h e c k D a t e A u x ( d a y ,   m o n t h ,   y e a r ) ;  
 	 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 P a s s e n g e r s A u x ( )  
 { 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   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 l d F i r s t N a m e " ) . l e n g t h ;   i + + )  
 	 {  
 	 	 v a r   c u r r e n t N a m e O b j   =   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 l d F i r s t N a m e " ) [ i ] ;  
 	 	 v a r   c u r r e n t S u r n a m e O b j   =   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 l d L a s t N a m e " ) [ i ] ;  
 	 	 v a r   c u r r e n t D a y O b j   =   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 l d N a s c i m e n t o D i a " ) [ i ] ;  
 	 	 v a r   c u r r e n t M o n t h O b j   =   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 l d N a s c i m e n t o M e s " ) [ i ] ;  
 	 	 v a r   c u r r e n t Y e a r O b j   =   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 l d N a s c i m e n t o A n o " ) [ i ] ;  
 	 	  
 	 	 c u r r e n t N a m e O b j . v a l u e   =   R e t i r a A c e n t o s ( c u r r e n t N a m e O b j . v a l u e ) ;  
 	 	 c u r r e n t S u r n a m e O b j . v a l u e   =   R e t i r a A c e n t o s ( c u r r e n t S u r n a m e O b j . v a l u e ) ;  
 	 	  
 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( c u r r e n t N a m e O b j . v a l u e ) ) ) )  
 	 	 { 	  
 	 	 	 c u r r e n t N a m e O b j . f o c u s ( ) ;  
 	 	 	  
 	 	 	 t h r o w   n e w   E r r o r ( " P a s s e n g e r s " ,   " P o r   f a v o r ,   p r e e n c h a   o   N O M E   d o   p a s s a g e i r o . " ) ;  
 	 	 }  
 	 	  
 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( c u r r e n t N a m e O b j . v a l u e ) ) )  
 	 	 { 	  
 	 	 	 c u r r e n t N a m e O b j . f o c u s ( ) ;  
 	 	 	 t h r o w   n e w   E r r o r ( " P a s s e n g e r s " ,   " O   N O M E   d o s   p a s s a g e i r o s   a p e n a s   a c e i t a   l e t r a s   ( e x c l u i   a c e n t u a % C 3 % A 7 % C 3 % B 5 e s ,   c e d i l h a s   e   e s p a % C 3 % A 7 o s ) . \ n \ n P o r   f a v o r   r e e s c r e v a   o   s e u   n o m e . " ) ;  
 	 	 } 	 	  
 	 	  
 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( c u r r e n t S u r n a m e O b j . v a l u e ) ) ) )  
 	 	 { 	  
 	 	 	 c u r r e n t S u r n a m e O b j . f o c u s ( ) ;  
 	 	 	 t h r o w   n e w   E r r o r ( " P a s s e n g e r s " ,   " P o r   f a v o r ,   p r e e n c h a   o   A P E L I D O   d o   p a s s a g e i r o . " ) ;  
 	 	 } 	  
 	 	 	 	  
 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( c u r r e n t S u r n a m e O b j . v a l u e ) ) )  
 	 	 { 	 	  
 	 	 	 c u r r e n t S u r n a m e O b j . f o c u s ( ) ;  
 	 	 	 t h r o w   n e w   E r r o r ( " P a s s e n g e r s " ,   " O   A P E L I D O   d o s   p a s s a g e i r o s   a p e n a s   a c e i t a   l e t r a s   ( e x c l u i   a c e n t u a % C 3 % A 7 % C 3 % B 5 e s ,   c e d i l h a s   e   e s p a % C 3 % A 7 o s ) . \ n \ n P o r   f a v o r   r e e s c r e v a   o   s e u   n o m e . " ) ;  
 	 	 }  
 	 	  
 	 	 i f   ( ! V e r i f y D a t e ( c u r r e n t Y e a r O b j . v a l u e ,   c u r r e n t M o n t h O b j . v a l u e ,   c u r r e n t D a y O b j . v a l u e ) )  
 	 	 { 	  
 	 	 	 c u r r e n t D a y O b j . f o c u s ( ) ;  
 	 	 	 t h r o w   n e w   E r r o r ( " P a s s e n g e r s " ,   " D A T A   d e   N A S C I M E N T O   i n v v % C 3 % A 1 l i d a . " ) ;  
 	 	 }  
 	 }  
 }  
  
 f u n c t i o n   C o r r e c t T r i m ( s t r _ v a r )  
 {  
 	 v a r   s t r   =   S t r i n g ( s t r _ v a r ) ;  
 	 v a r   r e s u l t   =   " " ;  
 	 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   s t r . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( s t r . c h a r A t ( i )   ! =   '   ' )  
 	 	 	 r e s u l t   + =   s t r . c h a r A t ( i ) ;  
 	 }  
 	  
 	 r e t u r n   r e s u l t ;  
  
 }  
  
 / *  
 f u n c t i o n   V a l i d a t e S p e c i a l A g r e e m e n t ( )  
 {  
 	  
 	 v a r   t o t a l   =   0 ;  
 	  
 	 v a r   f l a g   =   f a l s e ;  
 	  
 	 i f   ( 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 ( ' a d u l t s _ s e l e c t ' )   ! =   n u l l )  
 	 {  
 	 	 t o t a l   =   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 ( ' a d u l t s _ s e l e c t ' ) . l e n g t h ;  
 	 	 f o r ( i   =   0 ;   i   <   t o t a l ;   i + + )  
 	 	 {  
 	 	 	 i f   ( 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 ( ' a d u l t s _ s e l e c t ' ) [ i ] . o p t i o n s . s e l e c t e d I n d e x   ! =   0 )  
 	 	 	 	 f l a g   =   t r u e ;  
 	 	 }  
 	 	  
 	 }  
  
 	 i f   ( 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 ( ' c h i l d s _ s e l e c t ' )   ! =   n u l l )  
 	 {  
 	 	 t o t a l   =   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 ( ' c h i l d s _ s e l e c t ' ) . l e n g t h ;  
 	 	 f o r ( i   =   0 ;   i   <   t o t a l ;   i + + )  
 	 	 {  
 	 	 	 i f   ( 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 ( ' c h i l d s _ s e l e c t ' ) [ i ] . d i s p l a y   =   ' b l o c k '   & &   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 ( ' c h i l d s _ s e l e c t ' ) [ i ] . o p t i o n s . s e l e c t e d I n d e x   ! =   0 )  
 	 	 	 	 f l a g   =   t r u e ;  
 	 	 }  
 	 	  
 	 }  
  
  
 	 i f   ( 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 ( ' i n f a n t s _ s e l e c t ' )   ! =   n u l l )  
 	 {  
 	 	 t o t a l   =   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 ( ' i n f a n t s _ s e l e c t ' ) . l e n g t h ;  
 	 	 f o r ( i   =   0 ;   i   <   t o t a l ;   i + + )  
 	 	 {  
 	 	 	 i f   ( 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 ( ' i n f a n t s _ s e l e c t ' ) [ i ] . o p t i o n s . s e l e c t e d I n d e x   ! =   0 )  
 	 	 	 	 f l a g   =   t r u e ;  
 	 	 }  
 	 	  
 	 }  
  
 	 i f   ( ! f l a g )  
 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 7 ] ) ;  
 	 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 B e n e f ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " M o r e S e r v i c e s " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ B e n e f " )   ! =   n u l l )  
 	 {  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " d i v _ B e n e f " ) . s t y l e . d i s p l a y   ! =   " n o n e " )  
 	 	 {  
 	 	 	 v a r   s B e n e f N a m e   =   " " ;  
 	 	 	 v a r   o B e n e f N a m e   =   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 l d B e n e f N a m e " ) ;  
 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   o B e n e f N a m e . l e n g t h ;   i + + )  
 	 	 	 {  
 	 	 	 	 s B e n e f N a m e   =   C o r r e c t T r i m ( S t r i n g ( o B e n e f N a m e [ i ] . v a l u e ) ) ;  
 	 	 	 	 i f   ( ! V e r i f y C h a r ( s B e n e f N a m e ) )  
 	 	 	 	 { 	 	 	 	 	 	  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 5 ] ) ;  
 	 	 	 	 	 o B e n e f N a m e [ i ] . f o c u s ( )  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 }  
 	  
 	 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 o t a l S p e c i a l " )   ! =   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 o t a l S p e c i a l " ) . v a l u e   ! =   " 0 " )  
 	 {  
 	 	 r e t u r n   V a l i d a t e A l l S p e c i a l ( ) ;  
 	 }  
  
 	 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 g e s ( )  
 {  
 	 v a r   t y p e s   =   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 l d T i p o ' ) ;  
 	 v a r   d a y s   =   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 l d N a s c i m e n t o D i a ' ) ;  
 	 v a r   m o n t h s   =   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 l d N a s c i m e n t o M e s ' ) ;  
 	 v a r   y e a r s   =   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 l d N a s c i m e n t o A n o ' ) ;  
 	 v a r   d e p   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d e p a r t u r e d a t e ' ) . v a l u e ;  
 	  
 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 v a r   d a t e A u x ;  
 	 v a r   t o d a y ; 	  
 	  
 	  
 	 v a r   d e p a r t   =   n e w   D a t e ( ) ;  
 	  
 	  
 	  
 	 v a r   i s l e a p ;  
 	 v a r   f e b   ;  
  
 	  
 	 f o r   ( v a r   i = 0 ;   i   <   t y p e s . l e n g t h ;   i + + )  
 	 { 	 	  
 	 	 	  
 	 	  
 	 	 i f   ( t y p e s [ i ] . v a l u e   = =   " I N " )  
 	 	 {  
 	 	 	 i s l e a p   =   ( y e a r s [ i ] . v a l u e   %   4   = =   0   & &   ( y e a r s [ i ] . v a l u e   %   1 0 0   ! =   0   | |   y e a r s [ i ] . v a l u e   %   4 0 0   = =   0 ) ) ;  
 	 	 	 f e b   =   ( N u m b e r ( m o n t h s [ i ] . v a l u e )   = =   2   & &   ( N u m b e r ( d a y s [ i ] . v a l u e )   >   2 9   | |   ( N u m b e r ( d a y s [ i ] . v a l u e )   = =   2 9   & &   ! i s l e a p ) ) ) ;  
 	 	 	 d a t e . s e t F u l l Y e a r ( N u m b e r ( y e a r s [ i ] . v a l u e ) , N u m b e r ( m o n t h s [ i ] . v a l u e )   -   1 , N u m b e r ( d a y s [ i ] . v a l u e ) ) ; 	  
  
 	 	 	 d e p a r t . s e t F u l l Y e a r ( N u m b e r ( d e p . s p l i t ( ' / ' ) [ 0 ] ) , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 1 ] )   - 1   , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 2 ] )   ) ;  
 	 	 	  
 	 	 	 t o d a y   =   n e w   D a t e ( ) ; 	 	 	 	  
 	 	 	  
 	 	 	 	 	 	  
 	 	 	 d e p a r t . s e t Y e a r ( d e p a r t . g e t F u l l Y e a r ( )   -   3 ) ; 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 i f   (   f e b   | |   ( ( N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 4   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 6   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 9   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 1 1 )   & &   N u m b e r ( d a y s [ i ] . v a l u e ) = = 3 1 ) )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 3 ] + ( i   +   1 )   + j a v a s c r i p t S e n t e n c e s [ 4 4 ] ) ; 	 	 	 	 	 	 	 	 	  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( d a t e . g e t T i m e ( )   < =   d e p a r t . g e t T i m e ( ) )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 9 ] +   ( i   +   1 )   + j a v a s c r i p t S e n t e n c e s [ 4 7 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( d a t e . g e t T i m e ( )   >   t o d a y . g e t T i m e ( ) )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 3 ] +   ( i   +   1 )   + j a v a s c r i p t S e n t e n c e s [ 4 6 ] ) ; 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 	  
 	 	 	 	 	 	 	 	 	 	 	 	  
 	 	 	  
 	 	 }  
 	 	  
 	 	 i f   ( t y p e s [ i ] . v a l u e   = =   " C H " )  
 	 	 {  
 	 	  
 	 	 	 d a t e A u x   =   n e w   D a t e ( ) ;  
 	 	 	 i s l e a p   =   ( y e a r s [ i ] . v a l u e   %   4   = =   0   & &   ( y e a r s [ i ] . v a l u e   %   1 0 0   ! =   0   | |   y e a r s [ i ] . v a l u e   %   4 0 0   = =   0 ) ) ;  
 	 	 	 f e b   =   ( N u m b e r ( m o n t h s [ i ] . v a l u e )   = =   2   & &   ( N u m b e r ( d a y s [ i ] . v a l u e )   >   2 9   | |   ( N u m b e r ( d a y s [ i ] . v a l u e )   = =   2 9   & &   ! i s l e a p ) ) ) ;  
 	 	 	 d a t e . s e t F u l l Y e a r ( N u m b e r ( y e a r s [ i ] . v a l u e ) , N u m b e r ( m o n t h s [ i ] . v a l u e )   -   1 , N u m b e r ( d a y s [ i ] . v a l u e ) ) ; 	  
 	 	 	  
 	 	 	 d e p a r t . s e t F u l l Y e a r ( N u m b e r ( d e p . s p l i t ( ' / ' ) [ 0 ] ) , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 1 ] )   -   1 , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 2 ] )   ) ;  
 	 	 	 / / d a t e   =   n e w   D a t e ( ) ;  
 	 	 	 	 	 	 	  
 	 	 	 / / d a t e . s e t F u l l Y e a r ( N u m b e r ( y e a r s [ i ] . v a l u e ) , N u m b e r ( m o n t h s [ i ] . v a l u e )   -   1 , N u m b e r ( d a y s [ i ] . v a l u e ) ) ;  
 	 	 	 d e p a r t . s e t Y e a r ( d e p a r t . g e t F u l l Y e a r ( )   -   1 2 ) ;  
 	 	 	 / / a l e r t ( d a t e . g e t D a t e ( )   +   " / "   +   d a t e . g e t M o n t h ( )     +   " / "   +   d a t e . g e t Y e a r ( )   +   " > "   +   d e p a r t . g e t D a t e ( )   +   " / "   +   d e p a r t . g e t M o n t h ( )   +   " / "   +   d e p a r t . g e t F u l l Y e a r ( ) ) ; 	 	  
 	 	 	 / / a l e r t ( d a t e . g e t T i m e ( )   + " > " +   d e p a r t . g e t T i m e ( ) ) ;  
 	 	 	 d a t e A u x . s e t F u l l Y e a r ( N u m b e r ( d e p . s p l i t ( ' / ' ) [ 0 ] ) , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 1 ] )   - 1   , N u m b e r ( d e p . s p l i t ( ' / ' ) [ 2 ] )   ) ;  
 	 	 	 / / a l e r t ( d a t e A u x . g e t F u l l Y e a r ( ) ) ;  
 	 	 	 d a t e A u x . s e t Y e a r ( ( N u m b e r ( d a t e A u x . g e t F u l l Y e a r ( ) )   -   3 ) ) ;  
 	 	 	 / / a l e r t ( d a t e A u x . g e t F u l l Y e a r ( ) ) ; 	 	 	  
 	 	 	  
 	 	 	  
 	 	 	 	 	  
 	 	 	 i f   (   f e b   | |   ( ( N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 4   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 6   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 9   | |   N u m b e r ( m o n t h s [ i ] . v a l u e ) = = 1 1 )   & &   N u m b e r ( d a y s [ i ] . v a l u e ) = = 3 1 ) )  
 	 	 	 { 	 	 	 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 3 ] + ( i   +   1 )   + j a v a s c r i p t S e n t e n c e s [ 4 4 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( d a t e . g e t T i m e ( )   < =   d e p a r t . g e t T i m e ( ) )  
 	 	 	 {  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 9 ] +   ( i   +   1 )   +   j a v a s c r i p t S e n t e n c e s [ 4 8 ] ) ; 	 	 	 	 	 	 	  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 e l s e   i f   ( d a t e . g e t T i m e ( )   >   d a t e A u x . g e t T i m e ( ) )  
 	 	 	 { 	  
 	 	 	 	 / / a l e r t ( d a t e . g e t F u l l Y e a r ( )   + "   >   " +   d a t e A u x . g e t F u l l Y e a r ( ) ) ; 	 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 9 ] +   ( i + 1 )   + j a v a s c r i p t S e n t e n c e s [ 4 5 ] ) ;  
 	 	 	 	 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 G u e s t A u x ( )  
 { 	  
 	 v a r   o b j T r e a t m e n t ,   o b j F i r s t N a m e ,   o b j L a s t N a m e ,   o b j A g e ,   o b j G e n d e r ;  
 	 v a r   o b j D o c T y p e ,   o b j D o c N u m b e r ,   o b j D o c E x p D a t e ;  
 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   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 l d F i r s t N a m e " ) . l e n g t h ;   i + + )  
 	 {  
 	 	 i f ( ! 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 l d F i r s t N a m e " ) [ i ] . d i s a b l e d   = =   t r u e )  
 	 	 {  
 	 	 	 o b j F i r s t N a m e   =   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 l d F i r s t N a m e " ) [ i ] ;    
 	 	 	 o b j L a s t N a m e   =   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 l d L a s t N a m e " ) [ i ] ;    
 	 	 	 o b j G e n d e r   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d G e n d e r _ "   +   i ) ;    
 	 	 	 	 	  
 	 	 	 o b j F i r s t N a m e . v a l u e   =   C o r r e c t T r i m ( o b j F i r s t N a m e . v a l u e ) ;  
 	 	 	 o b j L a s t N a m e . v a l u e   =   C o r r e c t T r i m ( o b j L a s t N a m e . v a l u e ) ; 	 	  
 	 	 	  
 	 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o D i a ' )   ! =   n u l l )  
 	 	 	 {  
 	 	 	 	 i f   ( ! V a l i d a t e A g e s ( ) )  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	  
 	 	 	 i f   ( 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 l d D o c T y p e " )   ! =   n u l l )  
 	 	 	 {  
 	 	 	 	 o b j D o c T y p e   =   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 l d D o c T y p e " ) [ i ] ;  
 	 	 	 	 o b j D o c N u m b e r   =   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 l d D o c N u m b e r " ) [ i ] ;  
 	 	 	 	 o b j D o c E x p d a t e   =   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 l d D o c E x p D a t e " ) [ i ] ;  
 	 	 	 }  
 	 	  
 	 	 	 o b j F i r s t N a m e . v a l u e   =   R e t i r a A c e n t o s ( o b j F i r s t N a m e . v a l u e ) ;  
 	 	 	 o b j L a s t N a m e . v a l u e   =   R e t i r a A c e n t o s ( o b j L a s t N a m e . v a l u e ) ;  
 	 	 	  
 	 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( o b j F i r s t N a m e . v a l u e ) ) ) )  
 	 	 	 { 	  
 	 	 	 	 o b j F i r s t N a m e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 6 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
  
 	 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( o b j F i r s t N a m e . v a l u e ) ) )  
 	 	 	 { 	  
 	 	 	 	 o b j F i r s t N a m e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 7 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } 	 	  
 	 	 	  
 	 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( o b j L a s t N a m e . v a l u e ) ) ) )  
 	 	 	 { 	  
 	 	 	 	 o b j L a s t N a m e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 8 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } 	  
 	 	 	 	 	  
 	 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( o b j L a s t N a m e . v a l u e ) ) )  
 	 	 	 { 	  
 	 	 	 	 o b j L a s t N a m e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 9 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	  
 	 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( o b j G e n d e r . v a l u e ) ) ) )  
 	 	 	 { 	  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 5 3 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 } 	 	 	 	  
 	 	 }  
 	 }  
 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   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 l d S u p F i r s t N a m e " ) . l e n g t h ;   i + + )  
 	 {  
 	 	 o b j F i r s t N a m e   =   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 l d S u p F i r s t N a m e " ) [ i ] ;  
 	 	 o b j L a s t N a m e   =   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 l d S u p L a s t N a m e " ) [ i ] ;  
 	 	  
 	 	 o b j F i r s t N a m e . v a l u e   =   R e t i r a A c e n t o s ( o b j F i r s t N a m e . v a l u e ) ;  
 	 	 o b j L a s t N a m e . v a l u e   =   R e t i r a A c e n t o s ( o b j L a s t N a m e . v a l u e ) ;  
 	 	  
 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( o b j F i r s t N a m e . v a l u e ) ) ) )  
 	 	 { 	  
 	 	 	 o b j F i r s t N a m e . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 6 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	  
 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( o b j F i r s t N a m e . v a l u e ) ) )  
 	 	 { 	  
 	 	 	 o b j F i r s t N a m e . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 7 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 } 	 	  
 	 	  
 	 	 i f   ( ! V a l i d V a l u e ( T r i m ( S t r i n g ( o b j L a s t N a m e . v a l u e ) ) ) )  
 	 	 { 	  
 	 	 	 o b j L a s t N a m e . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 8 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 } 	  
 	 	 	 	  
 	 	 i f   ( ! V e r i f y C h a r ( S t r i n g ( o b j L a s t N a m e . v a l u e ) ) )  
 	 	 { 	  
 	 	 	 o b j L a s t N a m e . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 9 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 }  
 	  
 	 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 o t a l S p e c i a l ' ) ! =   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 o t a l S p e c i a l ' ) . v a l u e   ! =   " 0 " )  
 	 { 	 	  
 	 	 r e t u r n   V a l i d a t e A l l S p e c i a l ( ) ;  
 	 }  
 	  
 	 / /   C o e r e n c i a   e n t r e   n o m e s   v i n d o s   d o   r e g i s t o  
 	 C h e c k P a s s e n g e r s A n d R e g i s t r y ( ) ;  
 	  
 	 r e t u r n   t r u e ;  
 }  
  
  
 f u n c t i o n   S u p l e m e n t P e r s o n ( i )  
 {  
 	  
 	 v a r   i d ;  
 	 i d   =   S t r i n g ( 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 l d N o m e S u p " ) [ i ] . i d ) . s p l i t ( ' _ ' ) ;  
 	  
 	 v a r   d i v   =   d o c u m e n t . g e t E l e m e n t B y I d ( " s u p l _ d i v _ "   +   i d [ 1 ]   +   " _ "   +   i d [ 2 ]   +   " _ "   +   i d [ 3 ] +   " _ 1 " ) ;  
 	  
 	 r e t u r n   d i v . s t y l e . d i s p l a y   = =   ' n o n e ' ;  
 }  
  
 	  
 f u n c t i o n   V a l i d a t e P a y m e n t s A u x ( )  
 {  
 	 v a r   s t r P a y m e n t M e t h o d = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d P a y m e n t M e t h o d ' ) . v a l u e ;  
 	 v a r   s t r C C T y p e = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C T y p e ' ) . v a l u e ;  
 	 v a r   o b j C C N u m b e r = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C N u m b e r ' ) ;  
 	 v a r   o b j C C N a m e = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C N a m e ' ) ;  
 	 v a r   o b j C C E x p D a t e M o n t h = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C E x p D a t e M o n t h ' ) ;  
 	 v a r   o b j C C E x p D a t e Y e a r = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C E x p D a t e Y e a r ' ) ;  
 	 v a r   o b j C C S e c u r i t y C o d e = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d C C S e c u r i t y C o d e ' ) ;  
 	 v a r   o b j P a y m e n t A u t h o r i z a t i o n = d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d P a y m e n t A u t h o r i z a t i o n ' ) ;  
 	  
 	 i f ( s t r P a y m e n t M e t h o d = = " C C R E D " )  
 	 {  
 	 	 i f ( s t r C C T y p e = = " A M E X " )  
 	 	 {  
 	 	  
 	 	 i f ( o b j P a y m e n t A u t h o r i z a t i o n . v a l u e = = " N O " )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 4 0 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 o b j C C N a m e . v a l u e = R e t i r a A c e n t o s ( o b j C C N a m e . v a l u e ) ;  
 	 	 i f ( T r i m ( o b j C C N a m e . v a l u e ) = = " " | | ! V e r i f y C h a r ( r e m o v e S p a c e ( S t r i n g ( o b j C C N a m e . v a l u e ) ) ) )  
 	 	 {  
 	 	 	 o b j C C N a m e . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 0 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 i f ( ! i s C r e d i t C a r d V a l i d ( o b j C C N u m b e r . v a l u e , s t r C C T y p e ) )  
 	 	 {  
 	 	 	 o b j C C N u m b e r . s e l e c t ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 1 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 i f ( s t r C C T y p e ! = " A M E X " )  
 	 	 {  
 	 	 	 i f ( o b j C C S e c u r i t y C o d e . v a l u e = = ' ' | | ! V e r i f y N u m b e r ( o b j C C S e c u r i t y C o d e . v a l u e ) | | o b j C C S e c u r i t y C o d e . v a l u e . l e n g t h ! = 3 )  
 	 	 	 {  
 	 	 	 	 o b j C C S e c u r i t y C o d e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 2 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	 	 i f ( o b j C C S e c u r i t y C o d e . v a l u e ! = ' 0 0 0 ' )  
 	 	 	 {  
 	 	 	 	 o b j C C S e c u r i t y C o d e . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 2 ] + " \ n E s t e   t i p o   d e   c a r t ã o   n ã o   t e m   c ó d i g o   d e   s e g u r a n ç a " ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 }  
 	 	 i f ( ! V e r i f y D a t e ( o b j C C E x p D a t e Y e a r . v a l u e , o b j C C E x p D a t e M o n t h . v a l u e , 1 ) )  
 	 	 {  
 	 	 	 o b j C C E x p D a t e Y e a r . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 3 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 v a r   c u r r D a t e = n e w   D a t e ( ) ;  
 	 	 v a r   c u r r Y e a r = c u r r D a t e . g e t F u l l Y e a r ( ) ;  
 	 	 v a r   c u r r M o n t h = c u r r D a t e . g e t M o n t h ( ) + 1 ;  
 	 	 v a r   s t r C u r r Y e a r = S t r i n g ( c u r r Y e a r ) ;  
 	 	 v a r   s t r C u r r M o n t h = S t r i n g ( c u r r M o n t h ) ;  
 	 	 i f ( s t r C u r r M o n t h . l e n g t h = = 1 ) s t r C u r r M o n t h = " 0 " + s t r C u r r M o n t h ;  
 	 	 i f ( ( S t r i n g ( o b j C C E x p D a t e Y e a r . v a l u e ) + S t r i n g ( o b j C C E x p D a t e M o n t h . v a l u e ) ) < ( s t r C u r r Y e a r + s t r C u r r M o n t h ) )  
 	 	 {  
 	 	 	 o b j C C E x p D a t e Y e a r . f o c u s ( ) ;  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 3 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	  
 	 }  
 	 / / Z o n a   c a s o   d i f e r e n t e   d e   A M E X   N o v o    
 	 / / e 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 I n v o i c e D a t a ( )  
 { 	  
         v a r   s t r I n v o i c e D a t a   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e D a t a " ) . v a l u e ; 	  
 	  
 	 v a r   o b j 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 ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " A d d r e s s " ) ;  
 	 v a r   o b j P o s t a l C o d e 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " P o s t a l C o d e 1 " ) ;  
 	 v a r   o b j P o s t a l C o d e 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " P o s t a l C o d e 2 " ) ;  
 	 v a r   o b j P o s t a l P l a c e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " P o s t a l P l a c e " ) ;  
 	 v a r   o b j C o u n t r y   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " C o u n t r y " ) ;  
  
 	 i f   ( s t r I n v o i c e D a t a   = =   " C o m p " )  
 	 {  
 	 	 v a r   o b j C o m p a n y   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e C o m p a n y " ) ;  
 	         v a r   o b j C o m p N I F   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e C o m p N I F " ) ;  
 	          
 	         i f   ( T r i m ( o b j C o m p a n y . v a l u e )   = =   " " )  
 	         {  
 	                 o b j C o m p a n y . f o c u s ( ) ;  
 	                 a l e r t ( " O   c a m p o   d a   C o m p a n h i a   é   o b r i g a t ó r i o . " ) ;  
 	                 r e t u r n   f a l s e ;  
 	         }  
 	          
 	         i f   ( T r i m ( o b j C o m p N I F . v a l u e )   = =   " " )  
 	         {  
 	                 o b j C o m p N I F . f o c u s ( ) ;  
 	                 a l e r t ( " O   c a m p o   d o   N º   C o n t r i b u i n t e   é   o b r i g a t ó r i o . " ) ;  
 	                 r e t u r n   f a l s e ;  
 	         } 	          
 	 }  
 	 e l s e  
         {                 	  
 	         v a r   o b j F i r s t N a m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " F i r s t N a m e " ) ;  
 	         v a r   o b j L a s t N a m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d I n v o i c e "   +   s t r I n v o i c e D a t a   +   " L a s t N a m e " ) ;  
 	          
                 i f   ( T r i m ( o b j F i r s t N a m e . v a l u e )   = =   " " )  
                 {  
                         o b j F i r s t N a m e . f o c u s ( ) ;  
                         a l e r t ( " O   c a m p o   d o   N o m e   é   o b r i g a t ó r i o . " ) ;  
                         r e t u r n   f a l s e ;  
                 }  
                 	          
                 i f   ( T r i m ( o b j L a s t N a m e . v a l u e )   = =   " " )  
                 {  
                         o b j L a s t N a m e . f o c u s ( ) ;  
                         a l e r t ( " O   c a m p o   d o   A p e l i d o   é   o b r i g a t ó r i o . " ) ;  
                         r e t u r n   f a l s e ;  
                 }                  
         }  
          
         i f   ( T r i m ( o b j A d d r e s s . v a l u e )   = =   " " )  
         {  
                 o b j A d d r e s s . f o c u s ( ) ;  
                 a l e r t ( " O   c a m p o   d a   M o r a d a   é   o b r i g a t ó r i o . " ) ;  
                 r e t u r n   f a l s e ;  
         }          
          
         i f   ( T r i m ( o b j P o s t a l C o d e 1 . v a l u e )   = =   " " )  
         {  
                 o b j P o s t a l C o d e 1 . f o c u s ( ) ;  
                 a l e r t ( " O   c a m p o   d o   C ó d i g o   P o s t a l   é   o b r i g a t ó r i o . " ) ;  
                 r e t u r n   f a l s e ;  
         }          
          
         i f   ( T r i m ( o b j P o s t a l P l a c e . v a l u e )   = =   " " )  
         {  
                 o b j P o s t a l P l a c e . f o c u s ( ) ;  
                 a l e r t ( " O   c a m p o   d a   L o c a l i d a d e   é   o b r i g a t ó r i o . " ) ;  
                 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   S e t G e n d e r V a l u e ( i d F o r m ,   i d E l e m )  
 { 	  
 	 v a r   c u r r e n t V a l u e   =   " " ;  
 	 v a r   c o u n t   =   0 ;  
  
 	 f o r   ( v a r   i   =   0 ;   i   <   d o c u m e n t . 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 " ) . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( d o c u m e n t . 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 t e m ( i ) . i d   = =   i d E l e m   & &   d o c u m e n t . 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 t e m ( i ) . c h e c k e d )  
 	 	 	 c u r r e n t V a l u e   =   c u r r e n t V a l u e   +   ( ( c o u n t + +   >   0 )   ?   " , "   :   " " )   +   d o c u m e n t . 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 t e m ( i ) . v a l u e ;  
  
 	 }  
 	 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 ( i d E l e m ) [ 0 ] . v a l u e   =   c u r r e n t V a l u e ;  
 }  
  
  
  
 f u n c t i o n   S e t G e n d e r V a l u e ( i d F o r m ,   i d E l e m )  
 { 	  
 	 v a r   c u r r e n t V a l u e   =   " " ;  
 	 v a r   c o u n t   =   0 ;  
  
 	 f o r   ( v a r   i   =   0 ;   i   <   d o c u m e n t . 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 " ) . l e n g t h ;   i + + )  
 	 {  
 	 	 i f   ( d o c u m e n t . 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 t e m ( i ) . i d   = =   i d E l e m   & &   d o c u m e n t . 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 t e m ( i ) . c h e c k e d )  
 	 	 	 c u r r e n t V a l u e   =   c u r r e n t V a l u e   +   ( ( c o u n t + +   >   0 )   ?   " , "   :   " " )   +   d o c u m e n t . 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 t e m ( i ) . v a l u e ;  
  
 	 }  
 	 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 ( i d E l e m ) [ 0 ] . v a l u e   =   c u r r e n t V a l u e ;  
 }  
  
  
 f u n c t i o n   S e t G e n d e r ( s F l d V a l u e ,   s F l d N a m e ,   s F l d C o u n t )  
 {  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d "   +   s F l d N a m e   +   " _ "   +   s F l d C o u n t ) . v a l u e   =   s F l d V a l u e ;  
 	  
 	 i f   ( s F l d V a l u e   = =   " M " )  
 	 { 	  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ M _ "   +   s F l d C o u n t ) . c h e c k e d   =   t r u e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ F _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 }  
 	 e l s e   i f   ( s F l d V a l u e   = =   " F " )  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ M _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ F _ "   +   s F l d C o u n t ) . c h e c k e d   =   t r u e ; 	  
 	 }  
 	 e l s e  
 	 {  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ M _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ;  
 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k "   +   s F l d N a m e   +   " _ F _ "   +   s F l d C o u n t ) . c h e c k e d   =   f a l s e ; 	  
 	 } 	  
 }  
  
  
 f u n c t i o n   B i r t h D a t e ( t o t a l ,   t y p e )  
 {  
 	 v a r   t o d a y ;  
 	 v a r   i d ;  
 	 v a r   m i n u s ;  
 	 v a r   o b j ;  
 	 v a r   v a l u e   =   0 ;    
 	 v a r   d a y ;  
 	 v a r   m o n t h ;  
 	 v a r   y e a r ;  
 	  
 	 d a y   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d e p a r t u r e d a t e ' ) . v a l u e . s p l i t ( ' / ' ) [ 2 ] ;  
 	 m o n t h   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d e p a r t u r e d a t e ' ) . v a l u e . s p l i t ( ' / ' ) [ 1 ] ;  
 	 y e a r   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d e p a r t u r e d a t e ' ) . v a l u e . s p l i t ( ' / ' ) [ 0 ] ;  
 	  
 	  
 	 f o r ( i = 0 ;   i   <   t o t a l ;   i + + )  
 	 {  
 	 	 i f   ( t y p e   = =   " " ) 	 	  
 	 	 {  
 	 	 	  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o M e s ' ) . v a l u e   + =   " , " ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o D i a ' ) . v a l u e   + =   " , " ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o A n o ' ) . v a l u e   + =   " , " ; 	 	 	 	 	 	 	 	  
 	  
 	 	 }  
 	 	 e l s e  
 	 	 {  
 	 	  
 	 	 	 t o d a y     =   n e w   D a t e ( ) ;  
 	 	 	  
 	 	 	 t o d a y . s e t F u l l Y e a r ( y e a r , m o n t h , d a y ) ;    
 	 	 	 i d   =   " i d a d e _ " +   t y p e   +   i ;  
 	 	 	  
 	 	 	 o b j   =   d o c u m e n t . g e t E l e m e n t B y I d ( i d ) ;  
 	 	 	  
 	 	 	 m i n u s   =   o b j . o p t i o n s [ o b j . s e l e c t e d I n d e x ] . v a l u e ; 	 	  
 	 	 	  
 	 	 	 i f   ( t y p e   = =   " b e b e _ " )  
 	 	 	 { 	 	 	  
 	 	 	 	 t o d a y . s e t M o n t h ( t o d a y . g e t M o n t h ( )   -   m i n u s ) ;  
 	 	 	 }  
 	 	 	 e l s e  
 	 	 	 { 	 	  
 	 	 	 	 t o d a y . s e t F u l l Y e a r ( t o d a y . g e t F u l l Y e a r ( )   -   m i n u s ) ;  
 	 	 	 }  
 	 	 	  
 	 	 	  
 	 	 	 	 v a l u e   =   t o d a y . g e t M o n t h ( )   +   1 ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o M e s ' ) . v a l u e   + =   " , "   +   v a l u e ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o D i a ' ) . v a l u e   + =   " , "   +   t o d a y . g e t D a t e ( ) ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' f l d N a s c i m e n t o A n o ' ) . v a l u e   + =   " , "   +   t o d a y . g e t F u l l Y e a r ( ) ;  
 	 	     }  
 	 	  
 	 	 	  
 	 	  
 	 	 t o d a y   =   n u l l ; 	 	 	  
 	 }  
 	  
 	  
 }  
  
 f u n c t i o n   V a i l d a t e _ D r i v e r ( )  
 {  
           d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a s s e n g e r s " ;  
           d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
          
          
         i f ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ 0 " ) . v a l u e )   = =   " "   )  
         {  
                 a l e r t ( " T e m   d e   i n t r o d u z i r   o   n o m e   d o   c o n d u t o r " ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ 0 " ) . f o c u s ( ) ;  
                 r e t u r n   f a l s e ;  
         }  
          
         i f   ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ 0 " ) . v a l u e ) ! =   " "   & &    
 	         ! V e r i f y C h a r (   r e m o v e S p a c e ( S t r i n g ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ 0 " ) . v a l u e ) ) )   )  
         { 	 	  
 	         a l e r t ( " O   n o m e   d o   c o n d u t o r   c o n t é m   c a r a c t e r e s   i n v á l i d o s " ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d F i r s t N a m e _ 0 " ) . f o c u s ( ) ;  
                 r e t u r n   f a l s e ;  
         }          
          
         i f ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ 0 " ) . v a l u e )   = =   " "   )  
         {  
                 a l e r t ( " T e m   d e   i n t r o d u z i r   o   a p e l i d o   d o   c o n d u t o r " ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ 0 " ) . f o c u s ( ) ;  
                 r e t u r n   f a l s e ;  
         }  
          
         i f   ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ 0 " ) . v a l u e ) ! =   " "   & &    
 	         ! V e r i f y C h a r (   r e m o v e S p a c e ( S t r i n g ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ 0 " ) . v a l u e ) ) )   )  
         { 	 	  
 	         a l e r t ( " O   a p e l i d o   d o   c o n d u t o r   c o n t é m   c a r a c t e r e s   i n v á l i d o s " ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d L a s t N a m e _ 0 " ) . f o c u s ( ) ;  
                 r e t u r n   f a l s e ;  
         }    
          
         i f ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d G e n d e r _ 0 " ) . v a l u e )   = =   " "   )  
         {  
                 a l e r t ( " T e m   d e   s e l e c c i o n a r   o   s e x o   d o   c o n d u t o r " ) ;                  
                 r e t u r n   f a l s e ;  
         }  
          
         i f ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ 0 " ) . v a l u e )   = =   " "   )  
         {  
                 a l e r t ( " T e m   d e   i n t r o d u z i r   a   i d a d e   d o   c o n d u t o r " ) ;                  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ 0 " ) . f o c u s ( ) ;  
                 r e t u r n   f a l s e ;  
         }  
          
         i f ( S t r i n g ( N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ 0 " ) . v a l u e ) )   = =   " N a N "   )  
         {  
                 a l e r t ( " A   i d a d e   d o   c o n d u t o r   n ã o   é   v á l i d a " ) ;      
                 d o c u m e n t . g e t E l e m e n t B y I d ( " f l d A g e _ 0 " ) . f o c u s ( ) ;              
                 r e t u r n   f a l s e ;  
         }  
          
         i f ( ! C h e c k D a t e A u x ( d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 1 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 1 " ) . s e l e c t e d I n d e x ] . v a l u e ,  
         d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 2 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 2 " ) . s e l e c t e d I n d e x ] . v a l u e ,  
         d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 3 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 3 " ) . s e l e c t e d I n d e x ] . v a l u e ) )  
         {  
                 a l e r t ( " A   d a t a   d e   o b t e n ç ã o   d a   c a r t a   d e   c o n d u ç ã o   n ã o   é   v á l i d a " ) ;  
                 r e t u r n   f a l s e ;  
         }  
          
         v a r   t o d a y =   n e w   D a t e ( ) ;  
         t o d a y   =   n e w   D a t e ( t o d a y . g e t F u l l Y e a r ( ) , t o d a y . g e t M o n t h ( ) , t o d a y . g e t D a t e ( ) ) ;  
          
          
         v a r   i s s u e D a t e   =   n e w   D a t e ( d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 3 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 3 " ) . s e l e c t e d I n d e x ] . v a l u e , d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 2 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 2 " ) . s e l e c t e d I n d e x ] . v a l u e   -   1 , d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e I s s u e d D a t e _ 1 " ) . o p t i o n 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 i v i n g L i c e n c e I s s u e d D a t e _ 1 " ) . s e l e c t e d I n d e x ] . v a l u e ) ;  
          
         i f ( t o d a y . g e t T i m e ( )   <   i s s u e D a t e . g e t T i m e ( ) )  
         {  
                 a l e r t ( " A   d a t a   d e   o b t e n ç ã o   d a   c a r t a   d e   c o n d u ç ã o   n ã o   p o d e   s e r   s u p e r i o r   a o   d i a   a c t u a l " ) ;  
                 r e t u r n   f a l s e ;  
         }          
          
          
         i f ( ! C h e c k D a t e A u x ( d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 1 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 1 " ) . s e l e c t e d I n d e x ] . v a l u e ,  
         d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 2 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 2 " ) . s e l e c t e d I n d e x ] . v a l u e ,  
         d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 3 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 3 " ) . s e l e c t e d I n d e x ] . v a l u e ) )  
         {  
                 a l e r t ( " A   d a t a   d e   v a l i d a d e   d a   c a r t a   d e   c o n d u ç ã o   n ã o   é   v á l i d a " ) ;  
                 r e t u r n   f a l s e ;  
         }  
          
         v a r   v a l i d a t e D a t e   =   n e w   D a t e ( d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 3 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 3 " ) . s e l e c t e d I n d e x ] . v a l u e , d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 2 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 2 " ) . s e l e c t e d I n d e x ] . v a l u e   -   1 , d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e V a l i d D a t e _ 1 " ) . o p t i o n 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 i v i n g L i c e n c e V a l i d D a t e _ 1 " ) . s e l e c t e d I n d e x ] . v a l u e ) ;  
           i f ( t o d a y . g e t T i m e ( )   >   v a l i d a t e D a t e . g e t T i m e ( ) )  
         {  
                 a l e r t ( " A   d a t a   d e   v a l i d a d e   d a   c a r t a   d e   c o n d u ç ã o   n ã o   p o d e   s e r   i n f e r i o r   a o   d i a   a c t u a l " ) ;  
                 r e t u r n   f a l s e ;  
         }          
          
         i f ( T r i m ( d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e N u m b e r " ) . v a l u e )   = =   " "   )  
         {  
                 a l e r t ( " T e m   d e   i n t r o d u z i r   o   n ú m e r o   d a   c a r t a   d e   c o n d u ç ã o " ) ;                  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " D r i v i n g L i c e n c e N u m b e r " ) . 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   V a l i d a t e _ G u e s t s ( )  
 {  
 	 v a r   r e s u l t ;  
 	 v a r   n u m C h e c k e d   =   0 ;  
 	  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( " n u m C h e c k e d " )   ! =   n u l l )  
         { 	  
 	         n u m C h e c k e d   =   N u m b e r ( d o c u m e n t . g e t E l e m e n t B y I d ( " n u m C h e c k e d " ) . v a l u e ) ;  
         } 	          
 	          
 	 i f   ( 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 l d E m a i l C h e q u e ' ) . l e n g t h   = =   0 )  
 	 {  
 	 	 / /   C a s o   e s p e c i a l   d e   v a l i d a c a o   d e   d a t a s   e m   e s c a d e l a s .  
 	 	 / /   I s t o   i n p u t   e s t a   c r i a d o   n a   x s l t   s h o r t v a c a t i o n s  
 	 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( ' v a l i d T o G o ' )   ! =   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 ( ' v a l i d T o G o ' ) . v a l u e   = =   ' 0 ' )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 5 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a s s e n g e r s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
 	 	  
 	 	 f o r ( v a r   h   =   0 ;   h   <   n u m C h e c k e d     ;   h + + )  
 	 	 {  
 	 	         i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d C h k S u p l e m e n t s _ "   +   h ) . c h e c k e d )  
 	 	         {  
 	 	               i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p F i r s t N a m e _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   " "   | |   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p F i r s t N a m e _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   ' ' )  
 	 	               {  
 	 	                 a l e r t ( " N o m e   S u p l e m e n t o s   I n c o r r e c t o ! " ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	               }  
 	 	               e l s e   i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p L a s t N a m e _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   " "   | |   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p L a s t N a m e _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   ' ' )  
 	 	               {  
 	 	                 a l e r t ( " A p e l i d o   S u p l e m e n t o s   I n c o r r e c t o ! " ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	               }  
 	 	               e l s e   i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p G e n d e r _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   " "   | |   d o c u m e n t . g e t E l e m e n t B y I d ( " f l d S u p G e n d e r _ " + p a r s e I n t ( h + 1 ) + " " ) . v a l u e   = =   ' ' )  
 	 	               {  
 	 	                 a l e r t ( " S e x o   S u p l e m e n t o s   I n c o r r e c t o ! " ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	               }  
 	 	         }    
 	 	 }  
 	 	  
 	 	  
 	 	 	 	  
 	 	 v a r   p a s s   =   V a l i d a t e G u e s t A u x ( ) ;  
 	 	 	  
 	 	 i f   ( ! p a s s )  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	  
 	 	 v a r   c o n t r o l   =   t r u e ;  
 	 	 v a r   s t r ;  
 	 	  
 	 	  
 	 	  
 	 	  
 	 	  
 	 	 i f   ( 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 l d M y C o n t a c t P h o n e ' ) [ 0 ]   ! =   n u l l   & &   p a s s   = =   t r u e )  
 	 	 {  
 	 	 	 s t r   =   S t r i n g ( 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 l d M y C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) ;  
 	 	 	 	  
 	 	 	 i f ( S t r i n g ( 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 l d M y C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) . i n d e x O f ( '   ' )   ! =   - 1 )  
 	 	 	 {  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 5 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 	  
 	 	 	 i f   ( S t r i n g ( 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 l d M y C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) . i n d e x O f ( ' + ' )   ! =   - 1 )  
 	 	 	 {  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 4 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 	  
 	 	 	 i f   ( T r i m ( s t r )   = =   " "   | |   s t r . l e n g t h   <   9   | |   s t r . l e n g t h   >   1 5 )  
 	 	 	 {  
 	 	 	 	 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 l d M y C o n t a c t P h o n e ' ) [ 0 ] . f o c u s ( )  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 2 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 	 	 	  
 	 	 	 f o r   ( v a r   i   =   0 ;   i   <   s t r . l e n g t h ;   i + + )  
 	 	 	 {  
 	 	 	 	 c h   =   s t r . c h a r A t ( i ) ;  
 	 	 	 	 i f   ( c h   <   " 0 "   | |   " 9 "   <   c h )  
 	 	 	 	 {  
 	 	 	 	 	 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 l d M y C o n t a c t P h o n e ' ) [ 0 ] . f o c u s ( )  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 4 ] ) ;  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 	  
 	 	 	 	 }  
 	 	 	 }  
  
 	 	 	 i f   ( T r i m ( 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 l d C o n t a c t P h o n e ' ) [ 0 ] . v a l u e )   ! =   " " ) 	 	  
 	 	 	 {  
 	 	 	 	 s t r   =   S t r i n g ( 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 l d C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) ;  
 	 	 	 	  
 	 	 	 	 i f ( S t r i n g ( 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 l d C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) . i n d e x O f ( '   ' )   ! =   - 1 )  
 	 	 	 	 {  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 5 ] ) ;  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
 	 	 	 	  
 	 	 	 	 i f   ( S t r i n g ( 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 l d C o n t a c t P h o n e ' ) [ 0 ] . v a l u e ) . i n d e x O f ( ' + ' )   ! =   - 1 )  
 	 	 	 	 {  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 4 ] ) ;  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 i f   ( T r i m ( s t r )   = =   " "   | |   s t r . l e n g t h   <   9   | |   s t r . l e n g t h   >   1 5 )  
 	 	 	 	 {  
 	 	 	 	 	 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 l d C o n t a c t P h o n e ' ) [ 0 ] . f o c u s ( )  
 	 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 3 3 ] ) ;  
 	 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 	 }  
 	 	 	 	 	  
 	 	 	 	 N u m b e r A u x ( s t r ) ;  
 	 	 	 }  
 	 	 }  
 	 	 	  
 	 	 i f   ( 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 l d C o n t a c t N a m e ' ) . l e n g t h   >   0 )  
 	 	 {  
 	 	 	 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 l d C o n t a c t N a m e ' ) [ 0 ] . v a l u e   =   R e t i r a A c e n t o s ( 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 l d C o n t a c t N a m e ' ) [ 0 ] . v a l u e ) ;  
 	 	 	  
 	 	 	 i f   ( T r i m ( 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 l d C o n t a c t N a m e ' ) [ 0 ] . v a l u e ) ! =   " "   & &    
 	 	 	 	 ! V e r i f y C h a r (   r e m o v e S p a c e ( S t r i n g ( 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 l d N o m e C o n t ' ) [ 0 ] . v a l u e ) ) )   )  
 	 	 	 { 	 	  
 	 	 	 	 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 l d C o n t a c t N a m e ' ) [ 0 ] . f o c u s ( ) ;  
 	 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 7 ] ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 }  
 	 	 	  
 	 	 i f   ( c o n t r o l   = =   f a l s e )  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 4 ] ) ;  
 	 	  
 	 	 r e t u r n     p a s s   & &   c o n t r o l ;  
 	 } 	  
 	 e l s e  
 	 {  
 	 	 i f   ( T r i m ( 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 l d E m a i l C h e q u e ' ) [ 0 ] . v a l u e )   = =   0   | |   ! V a l i d a t e E m a i l ( T r i m ( 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 l d E m a i l C h e q u e ' ) [ 0 ] . v a l u e ) ) )  
 	 	 { 	 	 	  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 2 ] ) ; 	 	 	  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 i f   ( T r i m ( 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 l d P h o n e ' ) [ 0 ] . v a l u e )   = =   0   | |   ! N u m b e r A u x ( T r i m ( 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 l d P h o n e ' ) [ 0 ] . v a l u e ) ) )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 1 4 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 i f   ( T r i m ( 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 l d F i r s t N a m e ' ) [ 0 ] . v a l u e )   = =   0   | |   ! V e r i f y C h a r ( T r i m ( 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 l d F i r s t N a m e ' ) [ 0 ] . v a l u e ) ) )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 7 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 i f   ( T r i m ( 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 l d L a s t N a m e ' ) [ 0 ] . v a l u e )   = =   0   | |   ! V e r i f y C h a r ( T r i m ( 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 l d L a s t N a m e ' ) [ 0 ] . v a l u e ) ) )  
 	 	 {  
 	 	 	 a l e r t ( j a v a s c r i p t S e n t e n c e s [ 9 ] ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a s s e n g e r s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
 	 } 	 	 	  
 }  
  
  
 f u n c t i o n   N u m b e r A u x ( s t r )  
 {  
 	 s t r   =   S t r i n g ( s t r ) ;  
 	  
 	 f o r   ( v a r   i   =   0 ;   i   <   s t r . l e n g t h ;   i + + )  
 	 {  
 	 	 c h   =   s t r . c h a r A t ( i ) ;  
 	 	 i f   ( c h   <   " 0 "   | |   " 9 "   <   c h )  
 	 	 {  
 	 	 	 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   r e m o v e S p a c e ( s )    
 {      
      
     v a r   t e m p   =   " " ;  
      
     f o r ( v a r   i = 0 ;   i   <   s . l e n g t h   ; i + + )  
     {  
 	 i f ( s . c h a r A t ( i )   ! =   '   ' )  
 	 	 t e m p   + =   s . c h a r A t ( i ) ;  
     }  
      
     r e t u r n   t e m p  
      
      
 }  
  
  
  
 f u n c t i o n   V a l i d a t e _ V a c a t i o n s _ G u e s t s ( )  
 {  
 	 t r y  
 	 {  
 	 	 V a l i d a t e G u e s t A u x ( ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a s s e n g e r s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 }  
  
 f u n c t i o n   V a l i d a t i o n _ M o r e S e r v i c e s ( d i v I D )  
 {  
 	 t r y  
 	 {  
 	 	 V a l i d a t e M o r e S e r v i c e s A u x ( d i v I D )  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " M o r e S e r v i c e s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B o o k " ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 }  
  
 f u n c t i o n   V a l i d a t i o n _ P a y m e n t s ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a y m e n t " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " A d i t i o n a l D a t a " ;  
 	 r e t u r n   ( V a l i d a t e P a y m e n t s A u x ( )   & &   V a l i d a t e I n v o i c e D a t a ( ) ) ;  
 }  
  
 f u n c t i o n   V a l i d a t i o n _ P a y m e n t _ O k ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a y m e n t " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " A d i t i o n a l D a t a " ;  
         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 i o n _ P a y m e n t s _ O t h e r ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a y m e n t " ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " T h a n k s " ;  
 	 r e t u r n   V a l i d a t e P a y m e n t s A u x ( ) ;  
 }  
  
 f u n c t i o n   M o r e S e r v i c e s _ B a c k ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " M o r e S e r v i c e s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B a c k " ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 } 	 	  
 }  
  
 f u n c t i o n   S e t F o r m A c t i o n N o n S S L U r l ( a F o r m I d )   {  
  
 	 i f   (   t y p e o f ( a F o r m N a m e )   = =   " u n d e f i n e d "   )  
 	 	 r e t u r n ;  
 	 i f   (   t y p e o f ( N o n S S L C h e c k o u t U r l P a g e )   = =   " u n d e f i n e d "   )  
 	 	 r e t u r n ;  
 	 	  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( a F o r m I d ) . a c t i o n   =   N o n S S L C h e c k o u t U r l P a g e ;  
 	  
 }  
  
 / *  
 f u n c t i o n   M o r e S e r v i c e s _ C a n c e l ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " M o r e S e r v i c e s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " C a n c e l " ; 	  
 	 	 S e t F o r m A c t i o n N o n S S L U r l ( ' F o r m 1 ' ) ;  
 	 	 S u b m i t F o r m ( ' F o r m 1 ' ) ;  
 	 	 r e t u r n   t r u e ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 } 	  
 }  
 * /  
  
 f u n c t i o n   P a y m e n t s _ B a c k ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " M o r e S e r v i c e s " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " B a c k " ; 	  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 } 	 	  
 }  
  
 / *  
 f u n c t i o n   P a y m e n t s _ C a n c e l ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P a y m e n t " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " C a n c e l " ; 	  
 	 	 S e t F o r m A c t i o n N o n S S L U r l ( ' F o r m 1 ' ) ;  
 	 	 S u b m i t F o r m ( ' F o r m 1 ' ) ;  
 	 	 / / r e t u r n   t r u e ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 / / r e t u r n   f a l s e ;  
 	 } 	  
 }  
 * /  
  
 f u n c t i o n   V a l i d a t i o n _ C o n c l u s i o n ( )  
 {  
         d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " R e s e r v a t i o n " ;  
         r e t u r n   t r u e ;  
 }  
  
 / *  
 f u n c t i o n   R e s e r v a t i o n _ C a n c e l ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " R e s e r v a t i o n " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " E v e n t " ) . v a l u e   =   " C a n c e l " ; 	  
 	 	 S e t F o r m A c t i o n N o n S S L U r l ( ' F o r m 1 ' ) ;  
 	 	 S u b m i t F o r m ( ' F o r m 1 ' ) ;  
 	 	 / / r e t u r n   t r u e ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 / / r e t u r n   f a l s e ;  
 	 } 	  
 }  
 * /  
  
 f u n c t i o n   V a l i d a t i o n _ O K ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " P r i n t R e s e r v a t i o n " ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 }  
  
 f u n c t i o n   C o n f i r m a t i o n _ O K ( )  
 {  
 	 t r y  
 	 {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( " S t a t e " ) . v a l u e   =   " T h a n k s " ;  
 	 }  
 	 c a t c h ( e )  
 	 {  
 	 	 a l e r t ( d e c o d e U R I C o m p o n e n t ( e . d e s c ) ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 }  
  
 f u n c t i o n   o p e n P o p u p I n f o ( p o p u p T y p e )  
 {  
 	 w i n d o w . o p e n ( " / p o p u p I n f o C h e c k o u t . a s p x ? p o p u p T y p e = " + p o p u p T y p e ,   " " ,   " w i d t h = 4 0 0 p x ,   h e i g h t = 3 2 0 p x " ) ;  
 }  
  
  
 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 F U N C T I O N : 	 i s C r e d i t C a r d V a l i d ( s t r C C _ N u m b e r ,   s t r C C _ T y p e )  
 I N P U T : 	 	 s t r C C _ N u m b e r   -   A   s t r i n g   r e p r e s e n t i n g   a   c r e d i t   c a r d   n u m b e r  
 	 	 	 	 s t r C C _ T y p e   -   A   s t r i n g   r e p r e s e n t i n g   a   c r e d i t   c a r d   t y p e  
 	 	 	 	 	 	 	 	 ( V i s a ,   A m e r i c a n   E x p r e s s ,   M a s t e r   C a r d ,   . . . )  
 R E T U R N S : 	 	 t r u e ,   i f   t h e   c r e d i t   c a r d   i s   v a l i d   ( n u m b e r ,   a n d   t y p e )  
 	 	 	 	 f a l s e ,   o t h e r w i s e .  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /  
 f u n c t i o n   i s C r e d i t C a r d V a l i d ( s t r C C _ N u m b e r ,   s t r C C _ T y p e )    
 {  
 	 v a r   C C T y p e V a l i d a t i o n ;  
 	 v a r   s t r C C _ N u m b e r _ l e n   =   s t r C C _ N u m b e r . l e n g t h ;  
 	 v a r   s t r C C _ T y p e _ U p p e r   =   S t r i n g ( r e m o v e S p a c e ( s t r C C _ T y p e . t o U p p e r C a s e ( ) ) ) ;  
  
 	 / /   O   N ú m e r o   p r e c i s a   d e   t e r   p e l o   m e n o s   4   d i g i t o s   p a r a   s e   e f e c t u a r   a s   v a l i d a ç õ e s  
 	 i f   ( s t r C C _ N u m b e r _ l e n   <   4 )  
 	 	 r e t u r n   f a l s e ;  
 	 	  
 	 v a r   f i r s t D i g i t   =   p a r s e I n t ( s t r C C _ N u m b e r . s u b s t r ( 0 ,   1 ) ,   1 0 ) ;  
 	 v a r   s e c o n d D i g i t   =   p a r s e I n t ( s t r C C _ N u m b e r . s u b s t r ( 1 ,   1 ) ,   1 0 ) ;  
 	 v a r   f i r s t 4 D i g i t s   =   s t r C C _ N u m b e r . s u b s t r ( 0 ,   4 ) ;  
 	  
 	 s w i t c h   ( s t r C C _ T y p e _ U p p e r )  
 	 {  
 	 	 c a s e   " V I S A " :  
 	 	 	 / /   S a m p l e   n u m b e r :   4 1 1 1   1 1 1 1   1 1 1 1   1 1 1 1   ( 1 6   d i g i t s )  
 	 	 	 i f   ( ( ( s t r C C _ N u m b e r _ l e n   = =   1 6 )   | |   ( s t r C C _ N u m b e r _ l e n   = =   1 3 ) )    
 	 	 	 	 & &   ( f i r s t D i g i t   = =   4 ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " M A S T E R C A R D " :  
 	 	 c a s e   " E U R O C A R D " :  
 	 	 	 / /   S a m p l e   n u m b e r :   5 5 0 0   0 0 0 0   0 0 0 0   0 0 0 4   ( 1 6   d i g i t s )  
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 6 )   & &   ( f i r s t D i g i t   = =   5 )    
 	 	 	 	 & &   ( ( s e c o n d D i g i t   > =   1 )   & &   ( s e c o n d D i g i t   < =   5 ) ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " A M E X " :  
 	 	 c a s e   " A M E R I C A N E X P R E S S " :  
 	 	 	 / /   S a m p l e   n u m b e r :   3 4 0 0 0 0 0 0 0 0 0 0 0 0 9   ( 1 5   d i g i t s )  
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 5 )   & &   ( f i r s t D i g i t   = =   3 )  
 	 	 	 	 & &   ( ( s e c o n d D i g i t   = =   4 )   | |   ( s e c o n d D i g i t   = =   7 ) ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " D I N E R S C L U B " :  
 	 	 c a s e   " C A R T E B L A N C H E " :  
 	 	 c a s e   " E B L A N C H E " :  
 	 	 	 / /   S a m p l e   n u m b e r :   3 0 0 0 0 0 0 0 0 0 0 0 0 4   ( 1 4   d i g i t s )  
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 4 )   & &   ( f i r s t D i g i t   = =   3 )  
 	 	 	 	 & &   ( ( s e c o n d D i g i t   = =   0 )   | |   ( s e c o n d D i g i t   = =   6 )   | |   ( s e c o n d D i g i t   = =   8 ) ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " D I S C O V E R " :  
 	 	 	 / /   S a m p l e   n u m b e r :   6 0 1 1 0 0 0 0 0 0 0 0 0 0 0 4   ( 1 6   d i g i t s )    
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 6 )   & &   ( f i r s t 4 D i g i t s   = =   " 6 0 1 1 " ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " E N R O U T E " :  
 	 	 	 / /   S a m p l e   n u m b e r :   2 0 1 4 0 0 0 0 0 0 0 0 0 0 9   ( 1 5   d i g i t s )  
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 5 )   & &    
 	 	 	 	 ( ( f i r s t 4 D i g i t s   = =   " 2 0 1 4 " )   | |   ( f i r s t 4 D i g i t s   = =   " 2 1 4 9 " ) ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 c a s e   " J C B " :  
 	 	 	 / /   S a m p l e   n u m b e r :  
 	 	 	 i f   ( ( s t r C C _ N u m b e r _ l e n   = =   1 6 )  
 	 	 	 	 & &   ( ( f i r s t 4 D i g i t s   = =   " 3 0 8 8 " )  
 	 	 	 	 | |   ( f i r s t 4 D i g i t s   = =   " 3 0 9 6 " )  
 	 	 	 	 | |   ( f i r s t 4 D i g i t s   = =   " 3 1 1 2 " )  
 	 	 	 	 | |   ( f i r s t 4 D i g i t s   = =   " 3 1 5 8 " )  
 	 	 	 	 | |   ( f i r s t 4 D i g i t s   = =   " 3 3 3 7 " )  
 	 	 	 	 | |   ( f i r s t 4 D i g i t s   = =   " 3 5 2 8 " ) ) )  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 e l s e  
 	 	 	 	 C C T y p e V a l i d a t i o n   =   f a l s e ;  
 	 	 	 b r e a k ;  
 	 	 d e f a u l t :  
 	 	 	 C C T y p e V a l i d a t i o n   =   t r u e ;  
 	 	 	 b r e a k ;  
 	 }  
  
 	 i f   ( C C T y p e V a l i d a t i o n )  
 	 	 r e t u r n   i s C r e d i t C a r d N u m b e r V a l i d ( s t r C C _ N u m b e r ) ;  
 	 e l s e  
 	 	 r e t u r n   f a l s e ;  
 }  
  
 / *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =  
 F U N C T I O N : 	 i s C r e d i t C a r d N u m b e r V a l i d ( s t r C C _ N u m b e r )  
 I N P U T : 	 	 s t r C C _ N u m b e r   -   A   s t r i n g   r e p r e s e n t i n g   a   c r e d i t   c a r d   n u m b e r  
 R E T U R N S : 	 	 t r u e ,   i f   t h e   c r e d i t   c a r d   n u m b e r   p a s s e s   t h e   L u h n   M o d - 1 0   t e s t .    
 	 	 	 	 f a l s e ,   o t h e r w i s e .  
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /  
 f u n c t i o n   i s C r e d i t C a r d N u m b e r V a l i d ( s t r C C _ N u m b e r )    
 {  
 	 v a r   a u x D i g i t ,   i ,   t p r o d u c t ,   s u m ,   m u l ,   s t r C C _ N u m b e r _ l e n ;  
 	  
 	 s u m   =   0 ;  
 	 m u l   =   1 ;  
 	 s t r C C _ N u m b e r _ l e n   =   s t r C C _ N u m b e r . l e n g t h ;  
  
 	 / /   E n c o d i n g   o n l y   w o r k s   o n   c a r d s   w i t h   l e s s   t h a n   1 9   d i g i t s  
 	 i f   ( s t r C C _ N u m b e r _ l e n   >   1 9 )  
 	 	 r e t u r n   f a l s e ;  
  
 	 f o r   ( i   =   0 ;   i   <   s t r C C _ N u m b e r _ l e n ;   i + + )    
 	 {  
 	 	 a u x D i g i t   =   s t r C C _ N u m b e r . s u b s t r ( s t r C C _ N u m b e r _ l e n   -   i   -   1 ,   1 ) ;  
 	 	 t p r o d u c t   =   p a r s e I n t ( a u x D i g i t ,   1 0 )   *   m u l ;  
 	 	  
 	 	 i f   ( t p r o d u c t   > =   1 0 )  
 	 	 	 s u m   + =   ( t p r o d u c t   %   1 0 )   +   1 ;  
 	 	 e l s e  
 	 	 	 s u m   + =   t p r o d u c t ;  
  
 	 	 i f   ( m u l   = =   1 )  
 	 	 	 m u l + + ;  
 	 	 e l s e  
 	 	 	 m u l - - ;  
 	 }  
  
 	 i f   ( s u m   %   1 0   = =   0 )  
 	 	 r e t u r n   t r u e ;  
 	 e l s e  
 	 	 r e t u r n   f a l s e ;  
 }  
 
