ÿþf u n c t i o n   S e a r c h G e n e r a l ( ) {    
           v a r   _ v a l u e = d o c u m e n t . g e t E l e m e n t B y I d ( ' S e a r c h _ T K ' ) . v a l u e ;  
           w i n d o w . l o c a t i o n = " / t a b i d / 5 0 8 / d e f a u l t . a s p x ? S e a r c h = " + _ v a l u e ;  
 }  
 f u n c t i o n   I n i t S e a r c h ( e ) {  
         v a r   _ e v t = ( e ) ? e : ( w i n d o w . e v e n t ) ? w i n d o w . e v e n t : n u l l ;  
         i f ( _ e v t ) {  
             _ k e y = ( _ e v t . c h a r C o d e ) ? _ e v t . c h a r C o d e :   ( ( _ e v t . k e y C o d e ) ? _ e v t . k e y C o d e : ( ( _ e v t . w h i c h ) ? _ e v t . w h i c h : 0 ) )  
             i f ( _ k e y = = " 1 3 " ) {                      
                   S e a r c h G e n e r a l ( ) ;  
             }  
         }          
     }  
 f u n c t i o n   C a l l L e v e l ( l v ) {  
     v a r   i ;  
     v a r   s t r = ' | ' ;  
     f o r ( i = 0 ; i < l v ; i + + ) {  
         s t r = s t r + "   -   -   - " ;  
     }  
     i f ( l v   = =   0 )  
         r e t u r n   s t r = " " ;  
     r e t u r n   s t r ;  
 }  
 f u n c t i o n   S e a r c h A d v a n c e ( ) {  
         v a r   _ I n p u t V a l u e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ I n p u t V a l u e " ) . v a l u e ;  
         v a r   _ S t a r t D a t e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ S t a r t D a t e " ) . v a l u e ;  
         v a r   _ E n d D a t e   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ E n d D a t e " ) . v a l u e ;  
         v a r   _ c h e c k 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 1 " ) . n a m e ;  
         v a r   _ c h e c k 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . n a m e ;  
         v a r   _ S u m m a r y   =   ' ' ;  
         v a r   _ c a t e g o r y   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ C a t e g o r i e s " ) . v a l u e ;  
         v a r   _ c a t e g o r y V a l u e   =   ' ' ;  
         i f ( _ c a t e g o r y   ! =   ' ' ) { _ c a t e g o r y V a l u e   =   " | " + _ c a t e g o r y + " | " }  
         i f ( _ c h e c k 2   = =   1 ) { _ S u m m a r y   =   ' t r u e ' ; }  
         i f   ( _ c h e c k 2   = =   0 )   {   _ S u m m a r y   =   ' f a l s e ' ;   }  
         w i n d o w . l o c a t i o n . s e a r c h = " ? S e a r c h = " + _ I n p u t V a l u e + " & S t a r t D a t e = " + _ S t a r t D a t e + " & E n d D a t e = " + _ E n d D a t e + " & I s S u m m a r y = " + _ S u m m a r y + " & S t r C a t s = " + _ c a t e g o r y V a l u e ;    
 }      
 f u n c t i o n   C h e c k L e a d ( ) {  
     v a r   _ c h e c k 1   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 1 " ) . c h e c k e d ;  
         i f ( _ c h e c k 1   = =   t r u e ) { d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 1 " ) . n a m e = ' 1 ' }  
         i f ( _ c h e c k 1   = =   f a l s e ) { d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 1 " ) . n a m e = ' 0 ' }  
 }  
 f u n c t i o n   C h e c k S u m m a r y ( ) {  
     v a r   _ c h e c k 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . c h e c k e d ;  
         i f ( _ c h e c k 2   = =   t r u e ) { d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . n a m e = ' 1 ' }  
         i f ( _ c h e c k 2   = =   f a l s e ) { d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . n a m e = ' 0 ' }  
 }  
  
   f u n c t i o n   g e t Q u e r y S t r i n g ( s t r Q u e r y S t r i n g ) {  
     v a r   s t r L o c a t i o n   =   w i n d o w . l o c a t i o n . s e a r c h . s u b s t r i n g ( 1 ) ;  
     v a r   q u e r y   =   s t r L o c a t i o n . s p l i t ( " & " ) ;  
     v a r   q u e r y V a l u e ;  
     f o r   ( i = 0 ; i < q u e r y . l e n g t h ; i + + )    
     {  
         f t   =   q u e r y [ i ] . s p l i t ( " = " ) ;  
         i f   ( f t [ 0 ]   = =   s t r Q u e r y S t r i n g )    
         {  
             r e t u r n   f t [ 1 ] ;  
         }  
     }  
 }        
 f u n c t i o n   d e c o d e ( s t r )   {  
         r e t u r n   u n e s c a p e ( s t r . r e p l a c e ( / \ + / g ,   "   " ) ) ;  
 }  
 f u n c t i o n   B i n d D a t a ( ) {                  
 v a r   I n p u t V a l u e   =   d e c o d e ( g e t Q u e r y S t r i n g ( " S e a r c h " ) ) ;  
         i f   ( I n p u t V a l u e   ! =   n u l l   ) {                            
                 d o c u m e n t . g e t E l e m e n t B y I d ( " _ I n p u t V a l u e " ) . v a l u e   =   I n p u t V a l u e ;                  
         }      
 v a r   S t a r t D a t e   =   d e c o d e ( g e t Q u e r y S t r i n g ( " S t a r t D a t e " ) ) ;  
         i f   ( S t a r t D a t e   ! =   n u l l   ) {                            
                 d o c u m e n t . g e t E l e m e n t B y I d ( " _ S t a r t D a t e " ) . v a l u e   =   S t a r t D a t e ;                  
         }  
 v a r   E n d D a t e   =   d e c o d e ( g e t Q u e r y S t r i n g ( " E n d D a t e " ) ) ;  
         i f   ( E n d D a t e   ! =   n u l l   ) {                            
                 d o c u m e n t . g e t E l e m e n t B y I d ( " _ E n d D a t e " ) . v a l u e   =   E n d D a t e ;                  
         }  
 v a r   S u m m a r y   =   d e c o d e ( g e t Q u e r y S t r i n g ( " I s S u m m a r y " ) ) ;  
         i f   ( S u m m a r y   = =   ' t r u e '   ) {                            
                 d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . c h e c k e d   =   t r u e ;                  
         }    
           i f   ( S u m m a r y   = =   ' f a l s e '   ) {                            
                 d o c u m e n t . g e t E l e m e n t B y I d ( " _ C h e c k 2 " ) . c h e c k e d   =   f a l s e ;                  
         }              
 v a r   s t r C a t s   =   d e c o d e ( g e t Q u e r y S t r i n g ( " S t r C a t s " ) ) ;  
 v a r   l e n g t h = s t r C a t s . l e n g t h ;  
         l e n g t h = l e n g t h - 1 ;  
         s t r C a t s = s t r C a t s . s u b s t r i n g ( 1 , l e n g t h ) ;  
         i f   ( s t r C a t s   ! =   n u l l   & &   s t r C a t s   ! = " " ) {              
                 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( " _ C a t e g o r i e s " )   ! =   n u l l ) {      
                         _ o b j = d o c u m e n t . g e t E l e m e n t B y I d ( " _ C a t e g o r i e s " ) ;  
                 v a r   o p t i o n   =   _ o b j . g e t E l e m e n t s B y T a g N a m e ( " o p t i o n " ) ;                                      
                         f o r ( v a r   j   =   0 ;   j   <   o p t i o n . l e n g t h ;   j + + ) {  
                                 i f   (   o p t i o n [ j ] . v a l u e   = =   s t r C a t s )  
                                         o p t i o n [ j ] . s e l e c t e d = t r u e ;  
                         }                      
                 }  
         }  
 }                  
 
