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