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