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