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