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