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