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