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