
	function QueryString(key)
	{
		var value = null;
		for (var i=0;i<QueryString.keys.length;i++)
		{
			if (QueryString.keys[i]==key)
			{
				value = QueryString.values[i];
				break;
			}
		}
		return value;
	}
	QueryString.keys = new Array();
	QueryString.values = new Array();

	function QueryString_Parse()
	{
		var query = window.location.search.substring(1);
		var pairs = query.split("&");

		for (var i=0;i<pairs.length;i++)
		{
			var pos = pairs[i].indexOf('=');
			if (pos >= 0)
			{
				var argname = pairs[i].substring(0,pos);
				var value = pairs[i].substring(pos+1);
				QueryString.keys[QueryString.keys.length] = argname;
				QueryString.values[QueryString.values.length] = value;
			}
		}
	}

	QueryString_Parse();




	// #check to see that a statistic has been chosen when a category has
	function check_stat() {

		var ws = document.gen.c.options[document.gen.c.selectedIndex].text;
		if (ws.substr(0, 6) == "Select") {
			alert (ws);  // # which will say "select Geography" or whatever?
			document.gen.c.options.focus;
			return false;
		}
	}



	// Replace the values in the stat box so they match cats.
	function update() {
		clear();

		switch (document.gen.cat.options[document.gen.cat.selectedIndex].text) {
			case "Show Country(s)":
				var ids = new Array('');
				var wss = new Array('^ ^ ^ ^ ^ ^ ^ ^');
				break;

			case "All":
				var ids = new Array(' ','all_pop','all_pop_cri','all_pop_eco','all_pop_geo','all_pop_gov','all_pop_med','all_pop_mil','all_pop_peo','all_pop_tra');
				var wss = new Array('Select All Stat','All Popular','All Popular Crime','All Popular Economics','All Popular Geography','All Popular Government','All Popular Media','All Popular Military','All Popular People','All Popular Transportation');
				break;
			case "Crime":
				var ids = new Array(' ','cri_acq','cri_acq_cap','cri_adu_pro','cri_adu_pro_cap','cri_ass','cri_ass_cap','cri_bur','cri_bur_cap','cri_car_the','cri_car_the_cap','cri_con','cri_con_cap','cri_emb','cri_emb_cap','cri_fem_pro','cri_fem_pro_cap','cri_fra','cri_fra_cap','cri_jai','cri_jai_cap','cri_jud_and_mag','cri_jud_and_mag_cap','cri_man','cri_man_cap','cri_mur','cri_mur_cap','cri_mur_wit_fir','cri_mur_wit_fir_cap','cri_pol','cri_pol_cap','cri_pri','cri_pri_cap','cri_rap','cri_rap_cap','cri_rob','cri_rob_cap','cri_sen_len','cri_tot_cri','cri_tot_cri_cap');
				var wss = new Array('Select Crime Stat','Acquitted *','Acquitted * (per capita)','Adults prosecuted *','Adults prosecuted * (per capita)','Assaults *','Assaults * (per capita)','Burglaries *','Burglaries * (per capita)','Car thefts *','Car thefts * (per capita)','Convicted *','Convicted * (per capita)','Embezzlements *','Embezzlements * (per capita)','Females prosecuted *','Females prosecuted * (per capita)','Frauds *','Frauds * (per capita)','Jails *','Jails * (per capita)','Judges and Magistrates *','Judges and Magistrates * (per capita)','Manslaughters *','Manslaughters * (per capita)','Murders *','Murders * (per capita)','Murders with firearms *','Murders with firearms * (per capita)','Police *','Police * (per capita)','Prisoners *','Prisoners * (per capita)','Rapes *','Rapes * (per capita)','Robberies *','Robberies * (per capita)','Sentence Length *','Total crimes *','Total crimes * (per capita)');
				break;
			case "Economy":
				var ids = new Array(' ','eco_agr_pro','eco_bud_exp','eco_bud_exp_cap','eco_bud_rev','eco_bud_rev_cap','eco_cor','eco_cur','eco_cur_acc_bal','eco_cur_acc_bal_cap','eco_cur_cod','eco_cur_not','eco_deb_ext','eco_deb_ext_cap','eco_dis_of_fam_inc_gin_ind','eco_eco_aid_don','eco_eco_aid_don_cap','eco_eco_aid_rec','eco_eco_aid_rec_cap','eco_eco_ove','eco_exc_rat','eco_exc_rat_not','eco_exp','eco_exp_cap','eco_exp_com','eco_exp_par','eco_exp_to_us','eco_exp_to_us_cap','eco_fis_yea','eco_gdp','eco_gdp_cap','eco_gdp_com_by_sec_agr','eco_gdp_com_by_sec_ind','eco_gdp_com_by_sec_ser','eco_gdp_rea_gro_rat','eco_hou_inc_or_con_by_per_sha_hig_10','eco_hou_inc_or_con_by_per_sha_low_10','eco_imp','eco_imp_cap','eco_imp_com','eco_imp_fro_us','eco_imp_fro_us_cap','eco_imp_par','eco_ind','eco_ind_pro_gro_rat','eco_inf_rat_con_pri','eco_lab_for','eco_lab_for_cap','eco_lab_for_by_occ','eco_lab_for_not','eco_pop_bel_pov_lin','eco_tou_arr','eco_tou_arr_cap','eco_tra_bal_wit_us','eco_tra_bal_wit_us_cap','eco_une_rat');
				var wss = new Array('Select Economy Stat','Agriculture - products','Budget (expenditures) *','Budget (expenditures) * (per capita)','Budget (revenues) *','Budget (revenues) * (per capita)','Corruption *','Currency','Current account balance *','Current account balance * (per capita)','Currency code','Currency (note)','Debt - external *','Debt - external * (per capita)','Distribution of family income - Gini index *','Economic aid - donor *','Economic aid - donor * (per capita)','Economic aid - recipient *','Economic aid - recipient * (per capita)','Economy - overview','Exchange rates','Exchange rates (note)','Exports *','Exports * (per capita)','Exports - commodities','Exports - partners','Exports to US *','Exports to US * (per capita)','Fiscal year','GDP *','GDP * (per capita)','GDP - composition by sector (agriculture) *','GDP - composition by sector (industry) *','GDP - composition by sector (services) *','GDP - real growth rate *','Household income or consumption by percentage share (highest 10%) *','Household income or consumption by percentage share (lowest 10%) *','Imports *','Imports * (per capita)','Imports - commodities','Imports from US *','Imports from US * (per capita)','Imports - partners','Industries','Industrial production growth rate *','Inflation rate (consumer prices) *','Labor force *','Labor force * (per capita)','Labor force - by occupation','Labor force (note)','Population below poverty line *','Tourist arrivals *','Tourist arrivals * (per capita)','Trade balance with US *','Trade balance with US * (per capita)','Unemployment rate *');
				break;
			case "Education":
				var ids = new Array(' ','edu_lib_boo','edu_lib_boo_cap','edu_lib_emp','edu_lib_emp_cap','edu_lib_mem','edu_lib_mem_cap','edu_lit_def','edu_lit_fem','edu_lit_mal','edu_lit_tot_pop','edu_sch_lif_exp_fem','edu_sch_lif_exp_mal','edu_sch_lif_exp_tot','edu_spe_on_edu');
				var wss = new Array('Select Education Stat','Library books *','Library books * (per capita)','Library employees *','Library employees * (per capita)','Library members *','Library members * (per capita)','Literacy (definition)','Literacy (female) *','Literacy (male) *','Literacy (total population) *','School life expectancy (female) *','School life expectancy (male) *','School life expectancy (total) *','Spending on education *');
				break;
			case "Energy":
				var ids = new Array(' ','ene_coa_con','ene_coa_con_cap','ene_ele_con','ene_ele_con_cap','ene_ele_exp','ene_ele_exp_cap','ene_ele_gen_abi','ene_ele_gen_abi_cap','ene_ele_imp','ene_ele_imp_cap','ene_ele_imp_not','ene_ele_pro','ene_ele_pro_cap','ene_ele_pro_by_sou_fos_fue','ene_ele_pro_by_sou_hyd','ene_ele_pro_by_sou_nuc','ene_ele_pro_by_sou_oth','ene_nat_gas_con','ene_nat_gas_con_cap','ene_nat_gas_pro','ene_nat_gas_pro_cap','ene_nat_gas_res','ene_nat_gas_res_cap','ene_oil_con','ene_oil_con_cap','ene_oil_exp_net','ene_oil_exp_net_cap','ene_oil_imp_net','ene_oil_imp_net_cap','ene_oil_ref_abi','ene_oil_ref_abi_cap','ene_oil_res','ene_oil_res_cap');
				var wss = new Array('Select Energy Stat','Coal consumption *','Coal consumption * (per capita)','Electricity - consumption *','Electricity - consumption * (per capita)','Electricity - exports *','Electricity - exports * (per capita)','Electric generation ability *','Electric generation ability * (per capita)','Electricity - imports *','Electricity - imports * (per capita)','Electricity - imports (note)','Electricity - production *','Electricity - production * (per capita)','Electricity - production by source (fossil fuel) *','Electricity - production by source (hydro) *','Electricity - production by source (nuclear) *','Electricity - production by source (other) *','Natural gas consumption *','Natural gas consumption * (per capita)','Natural gas production *','Natural gas production * (per capita)','Natural gas reserves *','Natural gas reserves * (per capita)','Oil consumption *','Oil consumption * (per capita)','Oil exports {net} *','Oil exports {net} * (per capita)','Oil imports {net} *','Oil imports {net} * (per capita)','Oil refining ability *','Oil refining ability * (per capita)','Oil reserves *','Oil reserves * (per capita)');
				break;
			case "Environment":
				var ids = new Array(' ','env_co2_emi','env_co2_emi_cap','env_cur_iss','env_int_agr_par_to','env_int_agr_sig_not_rat','env_pro_are','env_thr_spe','env_thr_spe_mam');
				var wss = new Array('Select Environment Stat','CO2 Emissions *','CO2 Emissions * (per capita)','current issues','int\l agreements (party to)','int\l agreements (signed not ratified)','Protected area *','Threatened species *','Threatened species {mammal} *');
				break;
			case "Geography":
				var ids = new Array(' ','geo_are_com','geo_are_lan','geo_are_lan_cap','geo_are_not','geo_are_tot','geo_are_tot_cap','geo_are_wat','geo_are_wat_cap','geo_cli','geo_coa','geo_coa_cap','geo_ele_ext_hig_poi','geo_ele_ext_low_poi','geo_for_lan','geo_geo_coo','geo_geo_not','geo_irr_lan','geo_irr_lan_cap','geo_lan_bou','geo_lan_bou_cap','geo_lan_bou_bor_cou','geo_lan_bou_tot','geo_lan_bou_tot_cap','geo_lan_use_ara_lan','geo_lan_use_oth','geo_lan_use_per_cro','geo_lar_cit','geo_lar_cit_pop','geo_lar_cit_pop_cap','geo_loc','geo_map_ref','geo_mar_cla','geo_mar_cla_con_she','geo_mar_cla_con_zon','geo_mar_cla_exc_eco_zon','geo_mar_cla_exc_fis_zon','geo_mar_cla_ter_sea','geo_nat_haz','geo_nat_res','geo_pre','geo_ter');
				var wss = new Array('Select Geography Stat','Area - comparative','Area (land) *','Area (land) * (per capita)','Area (note)','Area (total) *','Area (total) * (per capita)','Area (water) *','Area (water) * (per capita)','Climate','Coastline *','Coastline * (per capita)','Elevation extremes (highest point) *','Elevation extremes (lowest point) *','Forested Land *','Geographic coordinates','Geography - note','Irrigated land *','Irrigated land * (per capita)','Land boundaries *','Land boundaries * (per capita)','Land boundaries (border countries)','Land boundaries (total) *','Land boundaries (total) * (per capita)','Land use (arable land) *','Land use (other) *','Land use (permanent crops) *','Largest city','Largest city population *','Largest city population * (per capita)','Location','Map references','Maritime claims','Maritime claims (continental shelf) *','Maritime claims (contiguous zone) *','Maritime claims (exclusive economic zone) *','Maritime claims (exclusive fishing zone) *','Maritime claims (territorial sea) *','Natural hazards','Natural resources','Precipitation *','Terrain');
				break;
			case "Government":
				var ids = new Array(' ','gov_adm_div','gov_adm_div_cap','gov_adm_div_not','gov_cap_cit','gov_con','gov_cou_nam_abb','gov_cou_nam_con_lon_for','gov_cou_nam_con_sho_for','gov_cou_nam_for','gov_cou_nam_loc_lon_for','gov_cou_nam_loc_sho_for','gov_dep_sta','gov_exe_bra_cab','gov_exe_bra_chi_of_sta','gov_exe_bra_ele','gov_exe_bra_ele_res','gov_exe_bra_hea_of_gov','gov_exe_bra_not','gov_fla_des','gov_gov_typ','gov_ind','gov_int_org_par','gov_jud_bra','gov_leg_bra','gov_leg_bra_ele','gov_leg_bra_ele_res','gov_leg_bra_not','gov_leg_sys','gov_nat_hol','gov_par_sea_fem','gov_pol_par_and_lea','gov_pol_par_and_lea_not','gov_pol_pre_gro_and_lea','gov_suf','gov_un_mem_dat');
				var wss = new Array('Select Government Stat','Administrative divisions *','Administrative divisions * (per capita)','Administrative divisions (note)','Capital city','Constitution','Country name (abbreviation)','Country name (conventional long form)','Country name (conventional short form)','Country name (former)','Country name (local long form)','Country name (local short form)','Dependency status','Executive branch (cabinet)','Executive branch (chief of state)','Executive branch (elections)','Executive branch (election results)','Executive branch (head of government)','Executive branch (note)','Flag description','Government type','Independence','International organization participation','Judicial branch','Legislative branch','Legislative branch (elections)','Legislative branch (election results)','Legislative branch (note)','Legal system','National holiday','Parliamentary seats {female} *','Political parties and leaders','Political parties and leaders (note)','Political pressure groups and leaders','Suffrage *','UN membership date');
				break;
			case "Health":
				var ids = new Array(' ','hea_abo','hea_abo_cap','hea_chi_und_rat','hea_hiv_adu_pre_rat','hea_hiv_dea','hea_hiv_dea_cap','hea_hiv_peo_liv_wit_hiv','hea_hiv_peo_liv_wit_hiv_cap','hea_inf_mor_rat','hea_lif_exp_at_bir_fem','hea_lif_exp_at_bir_mal','hea_lif_exp_at_bir_tot_pop','hea_mea_imm');
				var wss = new Array('Select Health Stat','Abortions *','Abortions * (per capita)','Children Underweight Rate *','HIV/AIDS - adult prevalence rate *','HIV/AIDS - deaths *','HIV/AIDS - deaths * (per capita)','HIV/AIDS - people living with HIV/AIDS *','HIV/AIDS - people living with HIV/AIDS * (per capita)','Infant mortality rate *','Life expectancy at birth (female) *','Life expectancy at birth (male) *','Life expectancy at birth (total population) *','Measles immunization *');
				break;
			case "Media":
				var ids = new Array(' ','med_cin','med_cin_cap','med_cin_att','med_cin_att_cap','med_int_cou_cod','med_int_ser_pro_isp','med_int_ser_pro_isp_cap','med_int_use','med_int_use_cap','med_nat_pag','med_nat_pag_cap','med_nat_vis','med_nat_vis_cap','med_new','med_new_cap','med_new_cir','med_new_cir_cap','med_per_com','med_per_com_cap','med_rad','med_rad_cap','med_rad_bro_sta','med_tel','med_tel_cap','med_tel_bro_sta','med_tel_bro_sta_cap','med_tel_mai_lin_in_use','med_tel_mai_lin_in_use_cap','med_tel_mob_cel','med_tel_mob_cel_cap','med_tel_sys_dom','med_tel_sys_gen_ass','med_tel_sys_int','med_web_def','med_web_def_cap');
				var wss = new Array('Select Media Stat','Cinemas *','Cinemas * (per capita)','Cinema attendance *','Cinema attendance * (per capita)','Internet country code','Internet Service Providers (ISPs) *','Internet Service Providers (ISPs) * (per capita)','Internet users *','Internet users * (per capita)','NationMaster pageviews *','NationMaster pageviews * (per capita)','NationMaster visitors *','NationMaster visitors * (per capita)','Newspapers *','Newspapers * (per capita)','Newspaper circulation *','Newspaper circulation * (per capita)','Personal computers *','Personal computers * (per capita)','Radios *','Radios * (per capita)','Radio broadcast stations','Televisions *','Televisions * (per capita)','Television broadcast stations *','Television broadcast stations * (per capita)','Telephones - main lines in use *','Telephones - main lines in use * (per capita)','Telephones - mobile cellular *','Telephones - mobile cellular * (per capita)','Telephone system (domestic)','Telephone system (general assessment)','Telephone system (international)','Website defacements *','Website defacements * (per capita)');
				break;
			case "Military":
				var ids = new Array(' ','mil_air_for_per','mil_air_for_per_cap','mil_arm_per','mil_arm_per_cap','mil_exp_dol_fig','mil_exp_dol_fig_cap','mil_exp_per_of_gdp','mil_man_ava_mal_age_154','mil_man_ava_mal_age_154_cap','mil_man_fit_for_mil_ser_mal_age_154','mil_man_fit_for_mil_ser_mal_age_154_cap','mil_man_mil_age','mil_man_rea_mil_age_ann_mal','mil_man_rea_mil_age_ann_mal_cap','mil_mil_bra','mil_nav_per','mil_nav_per_cap','mil_not');
				var wss = new Array('Select Military Stat','Air force personnel *','Air force personnel * (per capita)','Army personnel *','Army personnel * (per capita)','Expenditures - dollar figure *','Expenditures - dollar figure * (per capita)','Expenditures - percent of GDP *','Manpower - availability (males age 15-49) *','Manpower - availability (males age 15-49) * (per capita)','Manpower - fit for military service (males age 15-49) *','Manpower - fit for military service (males age 15-49) * (per capita)','Manpower - military age *','Manpower - reaching military age annually (males) *','Manpower - reaching military age annually (males) * (per capita)','Military branches','Navy personnel *','Navy personnel * (per capita)','note');
				break;
			case "People":
				var ids = new Array(' ','peo_age_str_014_yea','peo_age_str_156_yea','peo_age_str_65_yea_and_ove','peo_bir_rat','peo_dea_rat','peo_div_rat','peo_dri_wat_ava','peo_eth_gro','peo_eth_gro_not','peo_lan','peo_lan_not','peo_mar_rat','peo_nat_adj','peo_nat_nou','peo_net_mig_rat','peo_net_mig_rat_not','peo_per_per_roo','peo_pop','peo_pop_gro_rat','peo_pop_not','peo_ref','peo_ref_cap','peo_sex_rat_156_yea','peo_sex_rat_65_yea_and_ove','peo_sex_rat_at_bir','peo_sex_rat_tot_pop','peo_sex_rat_und_15_yea','peo_tot_fer_rat','peo_urb');
				var wss = new Array('Select People Stat','Age structure (0-14 years) *','Age structure (15-64 years) *','Age structure (65 years and over) *','Birth rate *','Death rate *','Divorce rate *','Drinking water availability (%) *','Ethnic groups','Ethnic groups (note)','Languages','Languages (note)','Marriage rate *','Nationality (adjective)','Nationality (noun)','Net migration rate *','Net migration rate (note)','Persons per room *','Population *','Population growth rate *','Population (note)','Refugees *','Refugees * (per capita)','Sex ratio (15-64 years) *','Sex ratio (65 years and over) *','Sex ratio (at birth) *','Sex ratio (total population) *','Sex ratio (under 15 years) *','Total fertility rate *','Urbanization *');
				break;
			case "Religion":
				var ids = new Array(' ','rel_jeh_wit','rel_jeh_wit_cap','rel_jew','rel_jew_cap','rel_rel','rel_rel_not');
				var wss = new Array('Select Religion Stat','Jehovahs Witnesses *','Jehovahs Witnesses * (per capita)','Jews *','Jews * (per capita)','Religions','Religions (note)');
				break;
			case "Sports":
				var ids = new Array(' ','spo_fif_wor_ran','spo_fif_wor_ran_cap','spo_oly_med_sal_lak_cit_200','spo_oly_med_sal_lak_cit_200_cap','spo_oly_med_syd_200','spo_oly_med_syd_200_cap','spo_sum_oly_med_all_tim','spo_sum_oly_med_all_tim_cap','spo_win_oly_med_all_tim','spo_win_oly_med_all_tim_cap');
				var wss = new Array('Select Sports Stat','FIFA World Ranking *','FIFA World Ranking * (per capita)','Olympic medals {Salt Lake City 2002} *','Olympic medals {Salt Lake City 2002} * (per capita)','Olympic medals {Sydney 2000} *','Olympic medals {Sydney 2000} * (per capita)','Summer olympic medals {all time} *','Summer olympic medals {all time} * (per capita)','Winter olympic medals {all time} *','Winter olympic medals {all time} * (per capita)');
				break;
			case "Transportation":
				var ids = new Array(' ','tra_air','tra_air_cap','tra_air_wit_pav_run_tot','tra_air_wit_pav_run_tot_cap','tra_air_wit_pav_run_und_914_m','tra_air_wit_pav_run_und_914_m_cap','tra_air_wit_unp_run_tot','tra_air_wit_unp_run_tot_cap','tra_air_wit_unp_run_und_914_m','tra_air_wit_unp_run_und_914_m_cap','tra_hel','tra_hel_cap','tra_hig_not','tra_hig_pav','tra_hig_pav_cap','tra_hig_tot','tra_hig_tot_cap','tra_hig_unp','tra_hig_unp_cap','tra_iss_dis_int','tra_iss_ill_dru','tra_mer_mar','tra_mer_mar_not','tra_mer_mar_shi_by_typ','tra_mer_mar_tot','tra_mer_mar_tot_cap','tra_mot_veh','tra_pip','tra_por_and_har','tra_rai','tra_rai_cap','tra_rai_bro_gau','tra_rai_bro_gau_cap','tra_rai_nar_gau','tra_rai_nar_gau_cap','tra_rai_not','tra_rai_sta_gau','tra_rai_sta_gau_cap','tra_rai_tot','tra_rai_tot_cap','tra_wat','tra_wat_cap','tra_wat_not');
				var wss = new Array('Select Transportation Stat','Airports *','Airports * (per capita)','Airports - with paved runways (total) *','Airports - with paved runways (total) * (per capita)','Airports - with paved runways (under 914 m) *','Airports - with paved runways (under 914 m) * (per capita)','Airports - with unpaved runways (total) *','Airports - with unpaved runways (total) * (per capita)','Airports - with unpaved runways (under 914 m) *','Airports - with unpaved runways (under 914 m) * (per capita)','Heliports *','Heliports * (per capita)','Highways (note)','Highways (paved) *','Highways (paved) * (per capita)','Highways (total) *','Highways (total) * (per capita)','Highways (unpaved) *','Highways (unpaved) * (per capita)','Disputes - international','Illicit drugs','Merchant marine','Merchant marine (note)','Merchant marine (ships by type)','Merchant marine (total) *','Merchant marine (total) * (per capita)','Motor vehicles *','Pipelines','Ports and harbors','Railways *','Railways * (per capita)','Railways (broad gauge) *','Railways (broad gauge) * (per capita)','Railways (narrow gauge) *','Railways (narrow gauge) * (per capita)','Railways (note)','Railways (standard gauge) *','Railways (standard gauge) * (per capita)','Railways (total) *','Railways (total) * (per capita)','Waterways *','Waterways * (per capita)','Waterways (note)');
				break;

			}

		for (i=0; i<ids.length; i++) {
			option1 = new Option(wss[i], ids[i], false, false);
			document.gen.c.options[document.gen.c.length] = option1;
			document.gen.c.selectedIndex = 0;
		}
	}

	// # Clear out stat box
	function clear() {
		while(document.gen.c.length != 0) {
			document.gen.c.options[document.gen.c.length-1] = null;
		}
	}





	// # set the stat box to what's found in the querystring.. Just on load.
	function set_stat() {

		var url = window.location.href + "&";
		var loc_start = url.indexOf("graph-") + 8;
		var loc_stop = url.indexOf("&");

		var c = url.substr(loc_start, loc_stop - loc_start);

		for (i=0; i<document.gen.c.length; i++) {

			if (document.gen.c.options[i].value == c) {
				document.gen.c.selectedIndex = i;
			}

		}
	}

	function submit_it() {
		var ws = document.gen.c.options[document.gen.c.selectedIndex].text;
		if (ws.substr(0, 6) == "Select") {
			alert (ws);  // # which will say "select Geography" or whatever?>
			// # document.gen.c.options.focus; # this doesn't work
			return false;
		} else {

			var url;
			if (document.gen.c.options[document.gen.c.selectedIndex].value) {

				url = url_graph();
			} else {
				if (document.gen.id.options[document.gen.id.selectedIndex].value.length == 3) {
					url = url_region();
				} else {
					if (document.gen.id.options[document.gen.id.selectedIndex].value.length == 2) {
						url = url_country();
					}
				}
			}

			window.location = url;
		}
	}


	function url_country() {
		var url = '/country/' + document.gen.id.options[document.gen.id.selectedIndex].value;
		return url;
	}

	function url_region() {
		var url = '/region/' + document.gen.id.options[document.gen.id.selectedIndex].value;
		return url;
	}

	function url_graph() {

		var str_t = document.gen.t.options[document.gen.t.selectedIndex];

		var url = 'http://www.nationmaster.com/graph-'
			+ str_t.value.substr(0,1)
			+ '/'
			+ document.gen.c.options[document.gen.c.selectedIndex].value;

		// # Default value for T is 100.. And we don't include it after & ?>
		var inty = document.gen.t.options[document.gen.t.selectedIndex].value.substr(1, 3);

		if (inty != 100 ) {
			url = url + '&int=' + inty;
		}

		for (i=0; i < document.gen.id.options.length; i++) {
			var idy = document.gen.id.options[i].value;
			if (document.gen.id.options[i].selected && idy != "a") {
				url = url + "&id=" + idy;
			}
		}

		return url;
	}
