function countryEntry(code, name){
  this.code = code;
  this.name = name;
};
var countryTable = new Array(
	new countryEntry( "AF", "Afghanistan"),
	new countryEntry( "AL", "Albania"),
	new countryEntry( "DZ", "Algeria"),
	new countryEntry( "AS", "American Samoa"),
	new countryEntry( "AD", "Andorra"),
	new countryEntry( "AO", "Angola"),
	new countryEntry( "AI", "Anguilla"),
	new countryEntry( "AQ", "Antarctica"),
	new countryEntry( "AG", "Antigua and Barbuda"),
	new countryEntry( "AR", "Argentina"),
	new countryEntry( "AM", "Armenia"),
	new countryEntry( "AW", "Aruba"),
	new countryEntry( "AU", "Australia"),
	new countryEntry( "AT", "Austria"),
	new countryEntry( "AZ", "Azerbaijan"),
	new countryEntry( "BS", "Bahamas"),
	new countryEntry( "BH", "Bahrain"),
	new countryEntry( "BD", "Bangladesh"),
	new countryEntry( "BB", "Barbados"),
	new countryEntry( "BY", "Belarus"),
	new countryEntry( "BE", "Belgium"),
	new countryEntry( "BZ", "Belize"),
	new countryEntry( "BJ", "Benin"),
	new countryEntry( "BM", "Bermuda"),
	new countryEntry( "BT", "Bhutan"),
	new countryEntry( "BO", "Bolivia"),
	new countryEntry( "BA", "Bosnia and Herzegovina"),
	new countryEntry( "BW", "Botswana"),
	new countryEntry( "BV", "Bouvet Island"),
	new countryEntry( "BR", "Brazil"),
	new countryEntry( "IO", "British Indian Ocean Territory"),
	new countryEntry( "VG", "British Virgin Islands"),
	new countryEntry( "BN", "Brunei"),
	new countryEntry( "BG", "Bulgaria"),
	new countryEntry( "BF", "Burkina Faso"),
	new countryEntry( "BI", "Burundi"),
	new countryEntry( "KH", "Cambodia"),
	new countryEntry( "CM", "Cameroon"),
	new countryEntry( "CA", "Canada"),
	new countryEntry( "CV", "Cape Verde"),
	new countryEntry( "KY", "Cayman Islands"),
	new countryEntry( "CF", "Central African Republic"),
	new countryEntry( "TD", "Chad"),
	new countryEntry( "CL", "Chile"),
	new countryEntry( "CN", "China"),
	new countryEntry( "CX", "Christmas Island"),
	new countryEntry( "CC", "Cocos Islands"),
	new countryEntry( "CO", "Colombia"),
	new countryEntry( "KM", "Comoros"),
	new countryEntry( "CD", "Congo, Democratic Republic of"),
	new countryEntry( "CG", "Congo, People's Republic of"),
	new countryEntry( "CK", "Cook Islands"),
	new countryEntry( "CR", "Costa Rica"),
	new countryEntry( "HR", "Croatia"),
	new countryEntry( "CY", "Cyprus"),
	new countryEntry( "CZ", "Czech Republic"),
	new countryEntry( "DK", "Denmark"),
	new countryEntry( "DJ", "Djibouti"),
	new countryEntry( "DM", "Dominica"),
	new countryEntry( "DO", "Dominican Republic"),
	new countryEntry( "TL", "East Timor"),
	new countryEntry( "EC", "Ecuador"),
	new countryEntry( "EG", "Egypt"),
	new countryEntry( "SV", "El Salvador"),
	new countryEntry( "GQ", "Equatorial Guinea"),
	new countryEntry( "ER", "Eritrea"),
	new countryEntry( "EE", "Estonia"),
	new countryEntry( "ET", "Ethiopia"),
	new countryEntry( "FO", "Faeroe Islands"),
	new countryEntry( "FK", "Falkland Islands (Malvinas)"),
	new countryEntry( "FJ", "Fiji"),
	new countryEntry( "FI", "Finland"),
	new countryEntry( "FR", "France"),
	new countryEntry( "GF", "French Guiana"),
	new countryEntry( "PF", "French Polynesia"),
	new countryEntry( "TF", "French Southern Territories"),
	new countryEntry( "GA", "Gabon"),
	new countryEntry( "GM", "Gambia"),
	new countryEntry( "GE", "Georgia"),
	new countryEntry( "DE", "Germany"),
	new countryEntry( "GH", "Ghana"),
	new countryEntry( "GI", "Gibraltar"),
	new countryEntry( "GR", "Greece"),
	new countryEntry( "GL", "Greenland"),
	new countryEntry( "GD", "Grenada"),
	new countryEntry( "GP", "Guadaloupe"),
	new countryEntry( "GU", "Guam"),
	new countryEntry( "GT", "Guatemala"),
	new countryEntry( "GN", "Guinea"),
	new countryEntry( "GW", "Guinea-Bissau"),
	new countryEntry( "GY", "Guyana, Republic of"),
	new countryEntry( "HT", "Haiti"),
	new countryEntry( "HM", "Heard and McDonald Islands"),
	new countryEntry( "HN", "Honduras"),
	new countryEntry( "HU", "Hungary"),
	new countryEntry( "IS", "Iceland"),
	new countryEntry( "IN", "India"),
	new countryEntry( "ID", "Indonesia"),
	new countryEntry( "IE", "Ireland"),
	new countryEntry( "IL", "Israel"),
	new countryEntry( "IT", "Italy"),
	new countryEntry( "CI", "Ivory Coast"),
	new countryEntry( "JM", "Jamaica"),
	new countryEntry( "JP", "Japan"),
	new countryEntry( "JO", "Jordan"),
	new countryEntry( "KZ", "Kazakhstan"),
	new countryEntry( "KE", "Kenya"),
	new countryEntry( "KI", "Kiribati"),
	new countryEntry( "KR", "Korea"),
	new countryEntry( "KW", "Kuwait"),
	new countryEntry( "KG", "Kyrgyz Republic"),
	new countryEntry( "LA", "Lao People's Democratic Republic"),
	new countryEntry( "LV", "Latvia"),
	new countryEntry( "LB", "Lebanon"),
	new countryEntry( "LS", "Lesotho"),
	new countryEntry( "LR", "Liberia"),
	new countryEntry( "LI", "Liechtenstein"),
	new countryEntry( "LT", "Lithuania"),
	new countryEntry( "LU", "Luxembourg"),
	new countryEntry( "MK", "Macedonia"),
	new countryEntry( "MG", "Madagascar"),
	new countryEntry( "MW", "Malawi"),
	new countryEntry( "MY", "Malaysia"),
	new countryEntry( "MV", "Maldives"),
	new countryEntry( "ML", "Mali"),
	new countryEntry( "MT", "Malta"),
	new countryEntry( "MH", "Marshall Islands"),
	new countryEntry( "MQ", "Martinique"),
	new countryEntry( "MR", "Mauritania"),
	new countryEntry( "MU", "Mauritius"),
	new countryEntry( "YT", "Mayotte"),
	new countryEntry( "MX", "Mexico"),
	new countryEntry( "FM", "Micronesia"),
	new countryEntry( "MD", "Moldova"),
	new countryEntry( "MC", "Monaco"),
	new countryEntry( "MN", "Mongolia"),
	new countryEntry( "MS", "Montserrat"),
	new countryEntry( "MA", "Morocco"),
	new countryEntry( "MZ", "Mozambique"),
	new countryEntry( "MM", "Myanmar"),
	new countryEntry( "NA", "Namibia"),
	new countryEntry( "NR", "Nauru"),
	new countryEntry( "NP", "Nepal"),
	new countryEntry( "NL", "Netherlands"),
	new countryEntry( "AN", "Netherlands Antilles"),
	new countryEntry( "NC", "New Caledonia"),
	new countryEntry( "NZ", "New Zealand"),
	new countryEntry( "NI", "Nicaragua"),
	new countryEntry( "NE", "Niger"),
	new countryEntry( "NG", "Nigeria"),
	new countryEntry( "NU", "Niue"),
	new countryEntry( "NF", "Norfolk Island"),
	new countryEntry( "MP", "Northern Mariana Islands"),
	new countryEntry( "NO", "Norway"),
	new countryEntry( "OM", "Oman"),
	new countryEntry( "PK", "Pakistan"),
	new countryEntry( "PW", "Palau"),
	new countryEntry( "PS", "Palestinian Territory"),
	new countryEntry( "PA", "Panama"),
	new countryEntry( "PG", "Papua New Guinea"),
	new countryEntry( "PY", "Paraguay"),
	new countryEntry( "PE", "Peru"),
	new countryEntry( "PH", "Philippines"),
	new countryEntry( "PN", "Pitcairn Island"),
	new countryEntry( "PL", "Poland"),
	new countryEntry( "PT", "Portugal"),
	new countryEntry( "PR", "Puerto Rico"),
	new countryEntry( "QA", "Qatar"),
	new countryEntry( "RE", "Reunion"),
	new countryEntry( "RO", "Romania"),
	new countryEntry( "RU", "Russian Federation"),
	new countryEntry( "RW", "Rwanda"),
	new countryEntry( "WS", "Samoa"),
	new countryEntry( "SM", "San Marino"),
	new countryEntry( "ST", "Sao Tome and Principe"),
	new countryEntry( "SA", "Saudi Arabia"),
	new countryEntry( "SN", "Senegal"),
	new countryEntry( "CS", "Serbia and Montenegro"),
	new countryEntry( "SC", "Seychelles"),
	new countryEntry( "SL", "Sierra Leone"),
	new countryEntry( "SG", "Singapore"),
	new countryEntry( "SK", "Slovakia (Slovak Republic)"),
	new countryEntry( "SI", "Slovenia"),
	new countryEntry( "SB", "Solomon Islands"),
	new countryEntry( "SO", "Somalia"),
	new countryEntry( "ZA", "South Africa"),
	new countryEntry( "GS", "South Georgia and the South Sandwich Islands"),
	new countryEntry( "ES", "Spain"),
	new countryEntry( "LK", "Sri Lanka"),
	new countryEntry( "SH", "St. Helena"),
	new countryEntry( "KN", "St. Kitts and Nevis"),
	new countryEntry( "LC", "St. Lucia"),
	new countryEntry( "PM", "St. Pierre and Miquelon"),
	new countryEntry( "VC", "St. Vincent and the Grenadines"),
	new countryEntry( "SR", "Suriname"),
	new countryEntry( "SJ", "Svalbard and Jan Mayen Islands"),
	new countryEntry( "SZ", "Swaziland"),
	new countryEntry( "SE", "Sweden"),
	new countryEntry( "CH", "Switzerland"),
	new countryEntry( "TW", "Taiwan"),
	new countryEntry( "TJ", "Tajikistan"),
	new countryEntry( "TZ", "Tanzania"),
	new countryEntry( "TH", "Thailand"),
	new countryEntry( "TG", "Togo"),
	new countryEntry( "TK", "Tokelau"),
	new countryEntry( "TO", "Tonga"),
	new countryEntry( "TT", "Trinidad and Tobago"),
	new countryEntry( "TN", "Tunisia"),
	new countryEntry( "TR", "Turkey"),
	new countryEntry( "TM", "Turkmenistan"),
	new countryEntry( "TC", "Turks and Caicos Islands"),
	new countryEntry( "TV", "Tuvalu"),
	new countryEntry( "UG", "Uganda"),
	new countryEntry( "UA", "Ukraine"),
	new countryEntry( "AE", "United Arab Emirates"),
	new countryEntry( "GB", "United Kingdom"),
	new countryEntry( "UM", "United States Minor Outlying Islands"),
	new countryEntry( "US", "United States of America"),
	new countryEntry( "UY", "Uruguay"),
	new countryEntry( "VI", "US Virgin Islands"),
	new countryEntry( "UZ", "Uzbekistan"),
	new countryEntry( "VU", "Vanuatu"),
	new countryEntry( "VA", "Vatican City"),
	new countryEntry( "VE", "Venezuela"),
	new countryEntry( "VN", "Vietnam"),
	new countryEntry( "WF", "Wallis and Futuna Islands"),
	new countryEntry( "EH", "Western Sahara"),
	new countryEntry( "YE", "Yemen"),
	new countryEntry( "ZM", "Zambia"),
	new countryEntry( "ZW", "Zimbabwe")
);

function makeCountryOptions(oSelect, selectedCode){
	for(i=0; i < countryTable.length;i++) {
		var oOption = document.createElement("OPTION");
		oSelect.options.add(oOption);
		oText = document.createTextNode(countryTable[i].name);
		oOption.appendChild(oText);		
		oOption.value = countryTable[i].code;
		if( countryTable[i].code == selectedCode) oOption.selected = true;
	}
}
function getCountryText(code){
	for(var i=0;i < countryTable.length;i++) {
		if( code == countryTable[i].code)	return countryTable[i].name;
	}
	return "";
}
