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