ÿþ 
 f u n c t i o n   S i m p l e S w a p ( e l , w h i c h )   {  
     e l . s r c = e l . g e t A t t r i b u t e ( w h i c h   | |   " o r i g s r c " ) ;  
 }  
 f u n c t i o n   S i m p l e S w a p S e t u p ( )   {  
     v a r   x   =   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 m g " ) ;  
     f o r   ( v a r   i = 0 ; i < x . l e n g t h ; i + + ) {  
         v a r   o v e r s r c   =   x [ i ] . g e t A t t r i b u t e ( " o v e r s r c " ) ;  
         i f   ( ! o v e r s r c )   c o n t i n u e ;  
              
         / /   p r e l o a d   i m a g e   -  
         / /   c o m m e n t   t h e   n e x t   t w o   l i n e s   t o   d i s a b l e   i m a g e   p r e - l o a d i n g  
         x [ i ] . o v e r s r c _ i m g   =   n e w   I m a g e ( ) ;  
         x [ i ] . o v e r s r c _ i m g . s r c = o v e r s r c ;  
  
         / /   s e t   e v e n t   h a n d l e r s  
         x [ i ] . o n m o u s e o v e r   =   n e w   F u n c t i o n ( " S i m p l e S w a p ( t h i s , ' o v e r s r c ' ) ; " ) ;  
         x [ i ] . o n m o u s e o u t   =   n e w   F u n c t i o n ( " S i m p l e S w a p ( t h i s ) ; " ) ;  
  
         / /   s a v e   o r i g i n a l   s r c  
         x [ i ] . s e t A t t r i b u t e ( " o r i g s r c " , x [ i ] . s r c ) ;  
     }  
 }  
  
  
 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 ) ; 	 	  
 } 	 
