ÿþ 
 / /   D i s p l a y   i m a g e   w i t h   l i n k s   t o   d i f f e r e n t   l a n g u a g e   v e r s i o n s   o f   t h e  
 / /   c u r r e n t   p a g e :  
  
  
 / /   H a n W E B   p r e f i x  
 v a r   h a n w e b _ p r e f i x   =   " s c . i n f o . g o v . h k / g b / " ;  
  
 / /   I m a g e   l o c a t i o n s  
 v a r   i m g H o s t       =   " h t t p : "   +   " / / "   +   " w w w . u g c . e d u . h k / e n g / u g c / p u b l i c a t i o n / r e p o r t / f i g u r e 2 0 0 5 / i m a g e s / " ;  
 v a r   i m g S r c _ e n   =   " e n g l i s h . j p g " ;  
 v a r   i m g S r c _ t c   =   " t r a d . j p g " ;  
 v a r   i m g S r c _ s c   =   " s i m p . j p g " ;  
  
 f u n c t i o n   r e p l a c e C h a r a c t e r s ( c o n v e r s i o n S t r i n g , i n C h a r , o u t C h a r ) {  
     v a r   c o n v e r t e d S t r i n g   =   c o n v e r s i o n S t r i n g . s p l i t ( i n C h a r ) ;  
     c o n v e r t e d S t r i n g   =   c o n v e r t e d S t r i n g . j o i n ( o u t C h a r ) ;  
     r e t u r n   c o n v e r t e d S t r i n g ;  
 }  
  
 / /   O b j e c t   t o   s t o r e   l i n k s   t o   t h e   3   v e r s i o n s   o f   t h e   c u r r e n t   p a g e  
 f u n c t i o n   L a n g L i n k s ( e n ,   t c ,   s c )  
 {  
 	 t h i s . e n   =   e n ;   / /   E n g l i s h  
 	 t h i s . t c   =   t c ;   / /   T r a d i t i o n a l   C h i n e s e  
 	 t h i s . s c   =   s c ;   / /   S i m p l i f i e d   C h i n e s e  
 }  
  
  
 / /   S i m p l e   s t r i n g   r e p l a c e m e n t   f u n c t i o n  
 f u n c t i o n   k h _ s t r i n g _ r e p l a c e ( s t r ,   s t a r t ,   l e n g t h ,   s u b s t r )  
 {  
 	 v a r   t m p s t r   =   s t r . s u b s t r ( 0 ,   s t a r t ) ;  
 	 t m p s t r   + =   s u b s t r ;  
 	 t m p s t r   + =   s t r . s u b s t r ( s t a r t   +   l e n g t h ) ;  
 	 r e t u r n   t m p s t r ;  
 }  
  
  
 / /   T h i s   f u n c t i o n   d e t e r m i n e s   t h e   c u r r e n t   v i e w i n g   l a n g u a g e  
 / /   R e t u r n :  
 / /     0   -   v i e w i n g   E n g l i s h  
 / /     1   -   v i e w i n g   T r a d i t i o n a l   C h i n e s e  
 / /     2   -   v i e w i n g   S i m p l i f i e d   C h i n e s e  
 f u n c t i o n   k h _ g e t _ c u r r e n t _ l a n g ( )  
 {  
 	 / /   G e t   t h e   U R L   w i t h o u t   p r o t o c o l   a n d   " / / "  
 	 v a r   h r e f   =   s e l f . l o c a t i o n . h r e f . s u b s t r ( s e l f . l o c a t i o n . p r o t o c o l . l e n g t h   +     2 ) ;  
  
 	 i f   ( h r e f . i n d e x O f ( h a n w e b _ p r e f i x )   = =   0 )  
 	 	 r e t u r n   2 ;  
  
 	 i f   ( h r e f . i n d e x O f ( " / b i g 5 / " )   >   0 )  
 	 	 r e t u r n   1 ;  
  
 	 i f   ( h r e f . i n d e x O f ( " / e n g / " )   = =   0 )  
 	 	 r e t u r n   0 ;  
  
 	 r e t u r n   0 ;  
 }  
  
  
 / /   C u r r e n t   p a g e   i s   i n   E n g l i s h ;   g e t   T r a d i t i o n a l   a n d   S i m p l i f i e d   C h i n e s e   l i n k s  
 f u n c t i o n   k h _ g e t _ e n _ l i n k s 2 ( l a n g L i n k s )  
 {  
 	 / /   E x t r a c t   E n g l i s h   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p r o   =   s e l f . l o c a t i o n . p r o t o c o l ;  
 	 v a r   h r e f _ e n   =   s e l f . l o c a t i o n . h r e f ;  
 	 v a r   h r e f _ e n _ n o _ p r o   =   h r e f _ e n . s u b s t r ( p r o . l e n g t h   +   2 ) ;   / /   s k i p   p r o t o c o l   a n d   " / / "  
 	  
 	 / /   C o n s t r u c t   T r a d i t i o n a l   C h i n e s e   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p o s   =   h r e f _ e n _ n o _ p r o . i n d e x O f ( " / e n g / " ) ;  
 	 v a r   h r e f _ t c _ n o _ p r o   =   k h _ s t r i n g _ r e p l a c e ( h r e f _ e n _ n o _ p r o ,   p o s ,   5 ,   " / b i g 5 / " ) ;  
 	  
 	 l a n g L i n k s . e n   =   h r e f _ e n ;  
 	 l a n g L i n k s . t c   =   p r o   +   " / / "   +   h r e f _ t c _ n o _ p r o ;  
 	 l a n g L i n k s . s c   =   p r o   +   " / / "   +   h a n w e b _ p r e f i x   +   h r e f _ t c _ n o _ p r o ;  
 }  
  
  
 f u n c t i o n   k h _ g e t _ e n _ l i n k s ( l a n g L i n k s )  
 {  
 	 / /   E x t r a c t   E n g l i s h   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p r o   =   s e l f . l o c a t i o n . p r o t o c o l ;  
 	 v a r   h r e f _ e n   =   s e l f . l o c a t i o n . h r e f ;  
 	 v a r   h r e f _ e n _ n o _ p r o   =   h r e f _ e n . s u b s t r ( p r o . l e n g t h   +   2 ) ;   / /   s k i p   p r o t o c o l   a n d   " / / "  
 	  
 	 / /   C o n s t r u c t   T r a d i t i o n a l   C h i n e s e   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p o s   =   h r e f _ e n _ n o _ p r o . i n d e x O f ( " / e n g / " ) ;  
 	 v a r   h r e f _ t c _ n o _ p r o   =   r e p l a c e C h a r a c t e r s ( h r e f _ e n _ n o _ p r o , ' / e n g / ' , ' / b i g 5 / ' ) ;  
 	  
 	 l a n g L i n k s . e n   =   h r e f _ e n ;  
 	 l a n g L i n k s . t c   =   p r o   +   " / / "   +   h r e f _ t c _ n o _ p r o ;  
 	 l a n g L i n k s . s c   =   p r o   +   " / / "   +   h a n w e b _ p r e f i x   +   h r e f _ t c _ n o _ p r o ;  
 }  
  
 / /   C u r r e n t   p a g e   i s   i n   T r a d i t i o n a l   C h i n e s e ;   g e t   E n g l i s h   a n d   S i m p l i f i e d   C h i n e s e   l i n k s  
 f u n c t i o n   k h _ g e t _ t c _ l i n k s ( l a n g L i n k s )  
 {  
 	 / /   E x t r a c t   T r a d i t i o n a l   C h i n e s e   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p r o   =   s e l f . l o c a t i o n . p r o t o c o l ;  
 	 v a r   h r e f _ t c   =   s e l f . l o c a t i o n . h r e f ;  
 	 v a r   h r e f _ t c _ n o _ p r o   =   h r e f _ t c . s u b s t r ( p r o . l e n g t h   +   2 ) ;   / /   s k i p   p r o t o c o l   a n d   " / / "  
  
 	 / /   C o n s t r u c t   E n g l i s h   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p o s   =   h r e f _ t c _ n o _ p r o . i n d e x O f ( " / b i g 5 / " ) ;  
 	 v a r   h r e f _ e n _ n o _ p r o   =   r e p l a c e C h a r a c t e r s ( h r e f _ t c _ n o _ p r o , ' / b i g 5 / ' , ' / e n g / ' ) ;  
  
 	 l a n g L i n k s . e n   =   p r o   +   " / / "   +   h r e f _ e n _ n o _ p r o ;  
 	 l a n g L i n k s . t c   =   h r e f _ t c ;  
 	 l a n g L i n k s . s c   =   p r o   +   " / / "   +   h a n w e b _ p r e f i x   +   h r e f _ t c _ n o _ p r o ;  
 }  
  
  
 / /   C u r r e n t   p a g e   i s   i n   S i m p l i f i e d   C h i n e s e ;   g e t   E n g l i s h   a n d   T r a d i t i o n a l   C h i n e s e   l i n k s  
 f u n c t i o n   k h _ g e t _ s c _ l i n k s ( l a n g L i n k s )  
 {  
 	 / /   E x t r a c t   T r a d i t i o n a l   C h i n e s e   U R L   w i t h o u t   p r o t o c o l  
 	 v a r   p r o   =   s e l f . l o c a t i o n . p r o t o c o l ;  
 	 v a r   h r e f _ s c   =   s e l f . l o c a t i o n . h r e f ;  
 	 v a r   h r e f _ s c _ n o _ p r o   =   h r e f _ s c . s u b s t r ( p r o . l e n g t h   +   2 ) ;   / /   s k i p   p r o t o c o l   a n d   " / / " ;  
  
 	 / /   S k i p   H a n W E B   p r e f i x   t o   f i n d   T r a d i t i o n a l   C h i n e s e   U R L  
 	 v a r   p o s   =   h r e f _ s c _ n o _ p r o . i n d e x O f ( h a n w e b _ p r e f i x )   +   h a n w e b _ p r e f i x . l e n g t h ;  
 	 v a r   h r e f _ t c _ n o _ p r o   =   h r e f _ s c _ n o _ p r o . s u b s t r ( p o s ) ;  
  
 	 p o s   =   h r e f _ t c _ n o _ p r o . i n d e x O f ( " / b i g 5 / " ) ;  
 	 v a r   h r e f _ e n _ n o _ p r o   =   r e p l a c e C h a r a c t e r s ( h r e f _ t c _ n o _ p r o , ' / b i g 5 / ' , ' / e n g / ' ) ;  
  
 	 l a n g L i n k s . e n   =   p r o   +   " / / "   +   h r e f _ e n _ n o _ p r o ;  
 	 l a n g L i n k s . t c   =   p r o   +   " / / "   +   h r e f _ t c _ n o _ p r o ;  
 	 l a n g L i n k s . s c   =   h r e f _ s c ;  
 }  
  
  
 / /   T h i s   f u n c t i o n   w r i t e s   t h e   t w o   l a n g u a g e   " b u t t o n s "  
 f u n c t i o n   k h _ m a i n ( )  
 {  
 	 v a r   a l t 1     =   " " ;  
 	 v a r   a l t 2     =   " " ;  
 	 v a r   s r c 1     =   " " ;  
 	 v a r   s r c 2     =   " " ;  
 	 v a r   h r e f 1   =   " " ;  
 	 v a r   h r e f 2   =   " " ;  
 	 v a r   i c o n _ h o m e   =   " " ;  
 	 v a r   i c o n _ p r i n t   =   " " ;  
 	 v a r   i c o n _ c o n t e n t   =   " " ;  
  
 	 v a r   l a n g L i n k s   =   n e w   L a n g L i n k s ( " " ,   " " ,   " " ) ;   / /   c r e a t e   o b j e c t   t o   h o l d   l i n k s  
 	 v a r   c u r L a n g   =   k h _ g e t _ c u r r e n t _ l a n g ( ) ;   / /   g u e s s   c u r r e n t   l a n g u a g e  
  
 	 / /   G e t   l i n k s ,   i m a g e s ,   a n d   t e x t   f o r   l a n g u a g e   s e l e c t i o n  
 	 i f   ( c u r L a n g   = =   1 )  
 	 {  
 	 	 k h _ g e t _ t c _ l i n k s ( l a n g L i n k s ) ;  
 	 	 h r e f 1   =   l a n g L i n k s . e n ;  
 	 	 h r e f 2   =   l a n g L i n k s . s c ;  
 	 	 a l t 1   =   " ñ‚‡e" ;  
 	 	 a l t 2   =   " !|Ôš-N‡e" ;  
 	 	 i c o n _ h o m e   =   " ÞV–™˜" ;  
 	 	 i c o n _ p r i n t   =   " RpS" ;  
 	 	 i c o n _ c o n t e n t   =   " îv“" ;  
 	 	 s r c 1   =   i m g S r c _ e n ;  
 	 	 s r c 2   =   i m g S r c _ s c ;  
 	 }  
 	 e l s e   i f   ( c u r L a n g   = =   2 )  
 	 {  
 	 	 k h _ g e t _ s c _ l i n k s ( l a n g L i n k s ) ;  
 	 	 h r e f 1   =   l a n g L i n k s . e n ;  
 	 	 h r e f 2   =   l a n g L i n k s . t c ;  
 	 	 a l t 1   =   " ñ‚‡e" ;  
 	 	 a l t 2   =   " A~SO-N‡e" ;  
 	 	 i c o n _ h o m e   =   " ÞV–™˜" ;  
 	 	 i c o n _ p r i n t   =   " RpS" ;  
 	 	 i c o n _ c o n t e n t   =   " îv“" ;  
 	 	 s r c 1   =   i m g S r c _ e n ;  
 	 	 s r c 2   =   i m g S r c _ t c ;  
 	 }  
 	 e l s e  
 	 {  
 	 	 k h _ g e t _ e n _ l i n k s ( l a n g L i n k s ) ;  
 	 	 h r e f 1   =   l a n g L i n k s . t c ;  
 	 	 h r e f 2   =   l a n g L i n k s . s c ;  
 	 	 a l t 1   =   " T r a d i t i o n a l   C h i n e s e " ;  
 	 	 a l t 2   =   " S i m p l i f i e d   C h i n e s e " ;  
 	 	 i c o n _ h o m e   =   " B a c k   t o   U G C   H o m e " ;  
 	 	 i c o n _ p r i n t   =   " P r i n t " ;  
 	 	 i c o n _ c o n t e n t   =   " C o n t e n t s " ;  
 	 	 s r c 1   =   i m g S r c _ t c ;  
 	 	 s r c 2   =   i m g S r c _ s c ;  
 	 }  
 	 	  
 	 s t r     =   ' < t a b l e   c e l l p a d d i n g = " 0 "   c e l l s p a c i n g = " 0 "   b o r d e r = " 0 "   w i d t h = " 1 0 0 % "   c l a s s = " F a s t M e n u " > < t r > < T d   w i d t h = " 1 0 0 % " > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 1 0 " > < / t d > ' ;  
         s t r   + =   ' < t d > < a   h r e f = " h t t p : / / w w w . u g c . e d u . h k "   t a r g e t = " _ b l a n k "   > ' ;    
 	 s t r 	 + =   ' < i m g   s r c = " i m a g e s / b a c k _ u g c . j p g "   b o r d e r = " 0 "   a l t = " '   +   i c o n _ h o m e   + ' "   t i t l e = " '   +   i c o n _ h o m e   + ' "   w i d t h = " 2 6 "   h e i g h t = " 2 5 " > < / a > < / t d > ' ;  
 	 s t r   + =   ' < t d > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 1 0 " > < / t d > ' ;  
         s t r   + =   ' < t d > < a   h r e f = " c o n t e n t s . h t m "   >   < i m g   s r c = " i m a g e s / c o n t e n t 1 . j p g "   b o r d e r = " 0 "   a l t = " '   +   i c o n _ c o n t e n t   +   ' "   t i t l e = " '   +   i c o n _ c o n t e n t   +   ' "   w i d t h = " 2 6 "   h e i g h t = " 2 5 " > < / a > < / t d > ' ;  
         s t r   + =   ' < t d > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 1 0 " > < / t d > ' ;  
         s t r   + =   ' < t d > < a   h r e f = " j a v a s c r i p t : w i n d o w . p r i n t ( ) " > < i m g   s r c = " i m a g e s / p r i n t . j p g "   b o r d e r = " 0 "   a l t = " '   +   i c o n _ p r i n t   + ' "   t i t l e = " '   +   i c o n _ p r i n t   + ' "   w i d t h = " 2 6 "   h e i g h t = " 2 5 " > < / a > < / t d > ' ;  
         s t r   + =   ' < t d > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 1 0 " > < / t d > ' ;  
         s t r   + =   ' < t d > < a   h r e f = " '   +   h r e f 1   +   ' " > < i m g   s r c = " '   +   s r c 1   +   ' "   a l t = " '   +   a l t 1   +   ' "   b o r d e r = " 0 "   w i d t h = " 2 6 "   h e i g h t = " 2 5 " > < / a > < / t d > ' ;  
         s t r   + =   ' < t d > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 1 0 " > < / t d > ' ;  
         s t r   + =   ' < t d > < a   h r e f = " '   +   h r e f 2   +   ' " > < i m g   s r c = " '   +   s r c 2   +   ' "   a l t = " '   +   a l t 2   +   ' "   b o r d e r = " 0 "   w i d t h = " 2 6 "   h e i g h t = " 2 5 " > < / a > < / t d > ' ;  
 	 s t r   + =   ' < t d > < i m g   s r c = " i m a g e s / s p a c e r . g i f "   b o r d e r = " 0 "   w i d t h = " 2 0 " > < / t d > < / t r > < / t a b l e > ' ;  
  
 	 d o c u m e n t . w r i t e l n ( s t r ) ;  
 }  
  
 k h _ m a i n ( ) ;  
  
 / /   E n d   o f   f i l e  
 
