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