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