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