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