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