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