var gCountries = new Array(
	"", "Country...",
	209, "United States",
	36, "Canada",
	"", "----------------------",
	1, "Afghanistan",
	2, "Albania",
	3, "Algeria",
	317, "American Samoa",
	4, "Andorra",
	5, "Angola",
	6, "Anguilla",
	7, "Antarctica",
	8, "Antigua and Barbuda",
	9, "Argentina",
	10, "Armenia",
	11, "Aruba",
	301, "Ascension Island",
	12, "Australia",
	13, "Austria",
	14, "Azerbaijan",
	15, "Bahamas",
	16, "Bahrain",
	17, "Bangladesh",
	18, "Barbados",
	19, "Belarus",
	20, "Belgium",
	21, "Belize",
	22, "Benin",
	23, "Bermuda",
	24, "Bhutan",
	25, "Bolivia",
	26, "Bosnia and Herzegovina",
	27, "Botswana",
	302, "Bouvet Island",
	28, "Brazil",
	303, "British Indian Ocean Territory",
	29, "Brunei Darussalam",
	30, "Bulgaria",
	31, "Burkina Faso",
	32, "Burundi",
	33, "Cambodia",
	34, "Cameroon",
	37, "Cape Verde",
	38, "Cayman Islands",
	39, "Central African Republic",
	40, "Chad",
	41, "Chile",
	158, "China, People\'s Republic of",
	42, "Christmas Island",
	304, "Cocos (Keeling) Islands",
	43, "Colombia",
	44, "Comoros",
	53, "Congo, Democratic People\'s Republic",
	45, "Congo, Republic of",
	46, "Cook Islands",
	47, "Costa Rica",
	48, "Cote d\'Ivoire",
	49, "Croatia/Hrvatska",
	50, "Cuba",
	51, "Cyprus",
	52, "Czech Republic",
	54, "Denmark",
	56, "Djibouti",
	57, "Dominica",
	58, "Dominican Republic",
	305, "East Timor",
	59, "Ecuador",
	60, "Egypt",
	61, "El Salvador",
	62, "Equatorial Guinea",
	63, "Eritrea",
	64, "Estonia",
	65, "Ethiopia",
	66, "Falkland Islands (Malvina)",
	306, "Faroe Islands",
	67, "Fiji",
	68, "Finland",
	69, "France",
	70, "French Guiana",
	71, "French Polynesia",
	307, "French Southern Territories",
	72, "Gabon",
	73, "Gambia",
	74, "Georgia",
	75, "Germany",
	76, "Ghana",
	77, "Gibraltar",
	78, "Greece",
	79, "Greenland",
	80, "Grenada",
	81, "Guadeloupe",
	82, "Guam",
	83, "Guatemala",
	308, "Guernsey",
	84, "Guinea",
	85, "Guinea-Bissau",
	86, "Guyana",
	87, "Haiti",
	309, "Heard and McDonald Islands",
	213, "Holy See (City Vatican State)",
	88, "Honduras",
	89, "Hong Kong",
	90, "Hungary",
	91, "Iceland",
	92, "India",
	93, "Indonesia",
	94, "Iran (Islamic Republic of)",
	95, "Iraq",
	96, "Ireland",
	310, "Isle of Man",
	97, "Israel",
	98, "Italy",
	99, "Jamaica",
	100, "Japan",
	311, "Jersey",
	101, "Jordan",
	102, "Kazakhstan",
	103, "Kenya",
	104, "Kiribati",
	105, "Korea, Democratic People\'s Republic",
	106, "Korea, Republic of",
	107, "Kuwait",
	108, "Kyrgyzstan",
	109, "Lao People\'s Democratic Republic",
	110, "Latvia",
	111, "Lebanon",
	112, "Lesotho",
	113, "Liberia",
	114, "Libyan Arab Jamahiriya",
	115, "Liechtenstein",
	116, "Lithuania",
	117, "Luxembourg",
	118, "Macau",
	119, "Macedonia, Former Yugoslav Republic",
	120, "Madagascar",
	121, "Malawi",
	122, "Malaysia",
	123, "Maldives",
	124, "Mali",
	125, "Malta",
	126, "Marshall Islands",
	127, "Martinique",
	128, "Mauritania",
	129, "Mauritius",
	130, "Mayotte",
	131, "Mexico",
	132, "Micronesia, Federal State of",
	133, "Moldova, Republic of",
	134, "Monaco",
	135, "Mongolia",
	136, "Montserrat",
	137, "Morocco",
	138, "Mozambique",
	139, "Myanmar",
	140, "Namibia",
	141, "Nauru",
	142, "Nepal",
	143, "Netherlands",
	144, "Netherlands Antilles",
	145, "New Caledonia",
	146, "New Zealand",
	147, "Nicaragua",
	148, "Niger",
	149, "Nigeria",
	150, "Niue",
	312, "Norfolk Island",
	313, "Northern Mariana Islands",
	151, "Norway",
	152, "Oman",
	153, "Pakistan",
	154, "Palau",
	314, "Palestinian Territories",
	155, "Panama",
	156, "Papua New Guinea",
	157, "Paraguay",
	159, "Peru",
	160, "Philippines",
	161, "Pitcairn Island",
	162, "Poland",
	163, "Portugal",
	164, "Puerto Rico",
	165, "Qatar",
	166, "Reunion Island",
	167, "Romania",
	168, "Russia",
	169, "Rwanda",
	315, "Saint Kitts and Nevis",
	171, "Saint Lucia",
	316, "Saint Vincent and the Grenadines",
	174, "San Marino",
	175, "Sao Tome and Principe",
	176, "Saudi Arabia",
	177, "Senegal",
	178, "Seychelles",
	179, "Sierra Leone",
	180, "Singapore",
	181, "Slovak Republic",
	182, "Slovenia",
	183, "Solomon Islands",
	184, "Somalia",
	185, "South Africa",
	319, "S. Georgia and the S. Sandwich Islands",
	186, "Spain",
	187, "Sri Lanka",
	320, "St. Helena",
	321, "St. Pierre and Miquelon",
	188, "Sudan",
	189, "Suriname",
	322, "Svalbard and Jan Mayen Islands",
	190, "Swaziland",
	191, "Sweden",
	192, "Switzerland",
	193, "Syrian Arab Republic",
	194, "Taiwan",
	195, "Tajikistan",
	196, "Tanzania",
	197, "Thailand",
	198, "Togo",
	323, "Tokelau",
	199, "Tonga",
	200, "Trinidad and Tobago",
	201, "Tunisia",
	202, "Turkey",
	203, "Turkmenistan",
	324, "Turks and Ciacos Islands",
	204, "Tuvalu",
	325, "US Minor Outlying Islands",
	205, "Uganda",
	206, "Ukraine",
	207, "United Arab Emirates",
	208, "United Kingdom",
	210, "Uruguay",
	211, "Uzbekistan",
	212, "Vanuatu",
	214, "Venezuela",
	215, "Vietnam",
	326, "Virgin Islands (British)",
	327, "Virgin Islands (USA)",
	328, "Wallis and Futuna Islands",
	217, "Western Sahara",
	318, "Western Samoa",
	218, "Yemen",
	219, "Yugoslavia",
	329, "Zaire",
	220, "Zambia",
	221, "Zimbabwe"
);

function GetLocationString(city, state, countryIndex)
{
	var location = "";
	var country = "";

	if (GetLocationString.arguments.length >= 2 && countryIndex != 209)
		country = GetCountryName(countryIndex);

	if (city != "") {
		location += city;
		if (state != "" || country != "") {
			location += ", ";
		}
	}  

	if ((state != "") && (state != "nonUS")) {
		location += state;
		if (country != "") {
			location += ", ";
		}
	}

	if (country != "") {
		location += country;
	}

	return location;
}
	
function GetCountryName(countryIndex)
{
	var i;
	for (i = 0; i < gCountries.length; i += 2) {
		if (gCountries[i] == countryIndex)
			return gCountries[i+1]
	}

	return "";
}

function GetCountryIndex(countryName)
{
	var i;
	for (i = 0; i < gCountries.length; i += 2) {
		if (gCountries[i+1] == countryName)
			return gCountries[i]
	}

	return 0;
}

function CountryDropdown(fieldName, formName, countryIndex, actionString)
{
	var i;
	document.write('<SELECT NAME="' + fieldName + '" ' + actionString + '>');

	for (i = 0; i < gCountries.length; i +=2)
		document.write('<OPTION VALUE="' + gCountries[i] + '">' + gCountries[i+1] + '</OPTION>');

	document.write('</SELECT>');

	if (formName) {
		for (i = 0; i < document.forms[formName].elements[fieldName].options.length; i++) {
			if (document.forms[formName].elements[fieldName][i].value == countryIndex) {
				document.forms[formName].elements[fieldName][i].selected = true;
				break;
			}
		}
	}
}


function StateDropdown(fieldName, formName, stateName, actionString)
{
	document.write('<SELECT NAME="' + fieldName + '" ' + actionString + '>');
	document.write('<OPTION VALUE="">State...</OPTION>');
	document.write('<OPTION value="AL">AL</OPTION>');
	document.write('<OPTION value="AK">AK</OPTION>');
	document.write('<OPTION value="AZ">AZ</OPTION>');
	document.write('<OPTION value="AR">AR</OPTION>');
	document.write('<OPTION value="CA">CA</OPTION>');
	document.write('<OPTION value="CO">CO</OPTION>');
	document.write('<OPTION value="CT">CT</OPTION>');
	document.write('<OPTION value="DE">DE</OPTION>');
	document.write('<OPTION value="FL">FL</OPTION>');
	document.write('<OPTION value="GA">GA</OPTION>');
	document.write('<OPTION value="HI">HI</OPTION>');
	document.write('<OPTION value="ID">ID</OPTION>');
	document.write('<OPTION value="IL">IL</OPTION>');
	document.write('<OPTION value="IN">IN</OPTION>');
	document.write('<OPTION value="IA">IA</OPTION>');
	document.write('<OPTION value="KS">KS</OPTION>');
	document.write('<OPTION value="KY">KY</OPTION>');
	document.write('<OPTION value="LA">LA</OPTION>');
	document.write('<OPTION value="ME">ME</OPTION>');
	document.write('<OPTION value="MD">MD</OPTION>');
	document.write('<OPTION value="MA">MA</OPTION>');
	document.write('<OPTION value="MI">MI</OPTION>');
	document.write('<OPTION value="MN">MN</OPTION>');
	document.write('<OPTION value="MS">MS</OPTION>');
	document.write('<OPTION value="MO">MO</OPTION>');
	document.write('<OPTION value="MT">MT</OPTION>');
	document.write('<OPTION value="NE">NE</OPTION>');
	document.write('<OPTION value="NV">NV</OPTION>');
	document.write('<OPTION value="NH">NH</OPTION>');
	document.write('<OPTION value="NJ">NJ</OPTION>');
	document.write('<OPTION value="NM">NM</OPTION>');
	document.write('<OPTION value="NY">NY</OPTION>');
	document.write('<OPTION value="NC">NC</OPTION>');
	document.write('<OPTION value="ND">ND</OPTION>');
	document.write('<OPTION value="OH">OH</OPTION>');
	document.write('<OPTION value="OK">OK</OPTION>');
	document.write('<OPTION value="OR">OR</OPTION>');
	document.write('<OPTION value="PA">PA</OPTION>');
	document.write('<OPTION value="RI">RI</OPTION>');
	document.write('<OPTION value="SC">SC</OPTION>');
	document.write('<OPTION value="SD">SD</OPTION>');
	document.write('<OPTION value="TN">TN</OPTION>');
	document.write('<OPTION value="TX">TX</OPTION>');
	document.write('<OPTION value="UT">UT</OPTION>');
	document.write('<OPTION value="VT">VT</OPTION>');
	document.write('<OPTION value="VA">VA</OPTION>');
	document.write('<OPTION value="WA">WA</OPTION>');
	document.write('<OPTION value="WV">WV</OPTION>');
	document.write('<OPTION value="WI">WI</OPTION>');
	document.write('<OPTION value="WY">WY</OPTION>');
	document.write('<OPTION value="DC">DC</OPTION>');
	document.write('<OPTION value="">----------------</OPTION>');
	document.write('<OPTION value="Alberta">Alberta</OPTION>');
	document.write('<OPTION value="British Columbia">British Columbia</OPTION>');
	document.write('<OPTION value="Manitoba">Manitoba</OPTION>');
	document.write('<OPTION value="New Brunswick">New Brunswick</OPTION>');
	document.write('<OPTION value="Newfoundland">Newfoundland</OPTION>');
	document.write('<OPTION value="NW Territory">NW Territory</OPTION>');
	document.write('<OPTION value="Nova Scotia">Nova Scotia</OPTION>');
	document.write('<OPTION value="Nuvanut">Nuvanut</OPTION>');
	document.write('<OPTION value="Ontario">Ontario</OPTION>');
	document.write('<OPTION value="P.E. Island">P.E. Island</OPTION>');
	document.write('<OPTION value="Quebec">Quebec</OPTION>');
	document.write('<OPTION value="Saskatchewan">Saskatchewan</OPTION>');
	document.write('<OPTION value="Yukon">Yukon</OPTION>');
	document.write('<OPTION value="">------------------------</OPTION>');
	document.write('<OPTION value="nonUS">Outside U.S.</OPTION>');
	document.write('</SELECT>');

	if (formName) {
		for (var i = 0; i < document.forms[formName].elements[fieldName].options.length; i++) {
			if (document.forms[formName].elements[fieldName][i].value == stateName) {
				document.forms[formName].elements[fieldName][i].selected = true;
				break;
			}
		}
	}
}

