ÿþ/ *  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 - - - - - - - A r r a y   M e t h o d s - - - - - - - - - -  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 * /  
  
 A r r a y . p r o t o t y p e . c o m p a r e   =   f u n c t i o n ( t e s t A r r )   {  
         i f   ( t h i s . l e n g t h ! = t e s t A r r . l e n g t h )   r e t u r n   f a l s e ;  
         f o r   ( v a r   i   =   0 ;   i   <   t e s t A r r . l e n g t h ;   i + + )   {  
                 i f   ( t h i s [ i ] . c o m p a r e )   {    
                         i f   ( ! t h i s [ i ] . c o m p a r e ( t e s t A r r [ i ] ) )   r e t u r n   f a l s e ;  
                 }  
                 i f   ( t h i s [ i ] ! = t e s t A r r [ i ] )   r e t u r n   f a l s e ;  
         }  
         r e t u r n   t r u e ;  
 }  
  
 A r r a y . p r o t o t y p e . d i f f   =   f u n c t i o n ( t e s t A r r )   {  
         v a r   d i f f A r r   =   n e w   A r r a y ( ) ;  
         f o r   ( v a r   i   =   0 ;   i   <   t e s t A r r . l e n g t h ;   i + + )   {  
                 i f   ( t h i s [ i ] . c o m p a r e )   {    
                         i f   ( ! t h i s [ i ] . c o m p a r e ( t e s t A r r [ i ] ) )   {  
                                 d i f f A r r . p u s h ( t e s t A r r [ i ] ) ;  
                         }  
                 }  
                 i f   ( t h i s [ i ] ! = t e s t A r r [ i ] )   d i f f A r r . p u s h ( t e s t A r r [ i ] ) ;  
         }  
         r e t u r n   d i f f A r r ;  
 }  
  
 / / T O D O :   S a v e   p r e v i o u s   d i s p l a y   s t a t e   o f   t h e   e l e m e n t   b e f o r e   t o g g l i n g  
 E l e m e n t . i m p l e m e n t ( {  
         t o g g l e :   f u n c t i o n ( )  
         {  
                 t h i s . g e t S t y l e ( ' d i s p l a y ' )   = =   " n o n e "   ?   t h i s . s e t S t y l e ( ' d i s p l a y ' ,   ' ' )   :   t h i s . s e t S t y l e ( ' d i s p l a y ' ,   ' n o n e ' ) ;  
         } ,  
          
         s h o w :   f u n c t i o n ( )  
         {  
                 t h i s . s e t S t y l e ( ' d i s p l a y ' ,   ' ' ) ;  
         } ,  
          
         h i d e :   f u n c t i o n ( )  
         {  
                 t h i s . s e t S t y l e ( ' d i s p l a y ' ,   ' n o n e ' ) ;  
         } ,  
          
         i s V i s i b l e :   f u n c t i o n ( )  
         {  
                 r e t u r n   t h i s . g e t S t y l e ( ' d i s p l a y ' )   ! =   " n o n e " ;  
         }  
 } )  
  
 / *  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 - - - - - - - O b j e c t   M e t h o d s - - - - - - - - - -  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 * /  
  
 f u n c t i o n   c l o n e O b j e c t ( o b j )   {  
         e v a l ( " v a r   t m p   =   "   +   o b j . t o J S O N ( ) ) ;  
         r e t u r n   t m p ;  
 }  
  
 f u n c t i o n   c l o n e O b j e c t ( o b j )   {  
         e v a l ( " v a r   t m p   =   "   +   o b j . t o J S O N ( ) ) ;  
         r e t u r n   t m p ;  
 }  
  
  
 / *  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 - - - - - - - S t r i n g   M e t h o d s - - - - - - - - - -  
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
 * /  
  
 S t r i n g . i m p l e m e n t ( { 	  
    
 	 / *  
 	 P r o p e r t y :   u t f 8 E n c o d e  
 	 	 e n c o d e s   a n   I S O - 8 8 5 9 - 1   s t r i n g   t o   U T F - 8 .  
    
 	 C r e d i t s :  
 	 	 s l i g h t l y   b a s e d   o n   U T F - 8   d a t a   e n c o d e   /   d e c o d e   < h t t p : / / w w w . w e b t o o l k i t . i n f o / j a v a s c r i p t - u t f 8 . h t m l >  
 	 * /  
 	 u t f 8 E n c o d e :   f u n c t i o n ( ) {  
 	 	 v a r   c ;  
 	 	 v a r   e n c o d e d   =   ' ' ;  
 	 	 v a r   s   =   t h i s . r e p l a c e ( / \ r \ n / g , " \ n " ) ;  
 	 	 v a r   i   =   0 ;  
 	 	 v a r   l   =   s . l e n g t h ;  
    
 	 	 w h i l e ( i   <   l ) {  
 	 	 	 c   =   s . c h a r C o d e A t ( i ) ;  
 	 	 	 i f ( c   <   1 2 8 )   e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( c ) ;  
 	 	 	 e l s e   {  
 	 	 	 	 i f ( ( c   >   1 2 7 )   & &   ( c   <   2 0 4 8 ) ) {  
 	 	 	 	 	 e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( c   > >   6 )   |   1 9 2 ) ;  
 	 	 	 	 	 e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( c   &   6 3 )   |   1 2 8 ) ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( c   > >   1 2 )   |   2 2 4 ) ;  
 	 	 	 	 	 e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( ( c   > >   6 )   &   6 3 )   |   1 2 8 ) ;  
 	 	 	 	 	 e n c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( c   &   6 3 )   |   1 2 8 ) ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 	 i + + ;  
 	 	 }  
 	 	 r e t u r n   e n c o d e d ;  
 	 } ,  
    
 	 / *  
 	 P r o p e r t y :   u t f 8 D e c o d e  
 	 	 c o n v e r t s   a   s t r i n g   w i t h   I S O - 8 8 5 9 - 1   c h a r a c t e r s   e n c o d e d   w i t h   U T F - 8   t o   s i n g l e - b y t e   I S O - 8 8 5 9 - 1 .  
    
 	 C r e d i t s :  
 	 	 s l i g h t l y   b a s e d   o n   U T F - 8   d a t a   e n c o d e   /   d e c o d e   < h t t p : / / w w w . w e b t o o l k i t . i n f o / j a v a s c r i p t - u t f 8 . h t m l >  
 	 * /  
 	 u t f 8 D e c o d e :   f u n c t i o n ( ) {  
 	 	 v a r   d e c o d e d   =   ' ' ;  
 	 	 v a r   s   =   t h i s ;  
 	 	 v a r   l   =   s . l e n g t h ;  
 	 	 v a r   i   =   c   =   c 1   =   c 2   =   0 ;  
    
 	 	 w h i l e ( i   <   l ) {  
 	 	 	 c   =   s . c h a r C o d e A t ( i ) ;  
 	 	 	 i f ( c   <   1 2 8 ) {  
 	 	 	 	 d e c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( c ) ;  
 	 	 	 	 i + + ;  
 	 	 	 }   e l s e   {  
 	 	 	 	 i f ( ( c   >   1 9 1 )   & &   ( c   <   2 2 4 ) ) {  
 	 	 	 	 	 c 2   =   s . c h a r C o d e A t ( i + 1 ) ;  
 	 	 	 	 	 d e c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( ( c   &   3 1 )   < <   6 )   |   ( c 2   &   6 3 ) ) ;  
 	 	 	 	 	 i   + =   2 ;  
 	 	 	 	 }   e l s e   {  
 	 	 	 	 	 c 2   =   s . c h a r C o d e A t ( i + 1 ) ;  
 	 	 	 	 	 c 3   =   s . c h a r C o d e A t ( i + 2 ) ;  
 	 	 	 	 	 d e c o d e d   + =   S t r i n g . f r o m C h a r C o d e ( ( ( c   &   1 5 )   < <   1 2 )   |   ( ( c 2   &   6 3 )   < <   6 )   |   ( c 3   &   6 3 ) ) ;  
 	 	 	 	 	 i   + =   3 ;  
 	 	 	 	 }  
 	 	 	 }  
 	 	 }  
 	 	 r e t u r n   d e c o d e d ;  
 	 }  
 } ) ; 
