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