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