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