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