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