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