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