

function xmlUnescape(sxml){
	sxml = sxml.replace(/\&lt\;/g, "<");
	sxml = sxml.replace(/\&gt\;/g, ">");
	sxml = sxml.replace(/\&quot\;/g, "\"");
	sxml = sxml.replace(/\&apos\;/g, "'");
	sxml = sxml.replace(/\&amp\;/g, "&");
	return sxml;
}
	
function setSPC(area,location){

	//first must nullify all but 1st blank option
	//then will add each new option to be selected from
	var optionCounter; 
	for (optionCounter = 0; optionCounter < document.pageform.spc.length; optionCounter=0) { 
		document.pageform.spc.options[optionCounter] = null;
	}


	if(area == "usa" || area == ""){		
		//set new options for usa states
		document.pageform.spc.options[0] = new Option("(Choose State)","");
		document.pageform.spc.options[1] = new Option("Alabama","Alabama");
        document.pageform.spc.options[2] = new Option("Alaska","Alaska");
        document.pageform.spc.options[3] = new Option("Arizona","Arizona");
        document.pageform.spc.options[4] = new Option("Arkansas","Arkansas");
        document.pageform.spc.options[5] = new Option("California","California");
        document.pageform.spc.options[6] = new Option("Colorado","Colorado");
        document.pageform.spc.options[7] = new Option("Connecticut","Connecticut");
        document.pageform.spc.options[8] = new Option("Delaware","Delaware");
        document.pageform.spc.options[9] = new Option("District of Columbia","District of Columbia");
        document.pageform.spc.options[10] = new Option("Federated States of Micronesia","Federated States of Micronesia");
        document.pageform.spc.options[11] = new Option("Florida","Florida");
        document.pageform.spc.options[12] = new Option("Georgia","Georgia");
        document.pageform.spc.options[13] = new Option("Guam","Guam");
        document.pageform.spc.options[14] = new Option("Hawaii","Hawaii");
        document.pageform.spc.options[15] = new Option("Idaho","Idaho");
        document.pageform.spc.options[16] = new Option("Illinois","Illinois");
        document.pageform.spc.options[17] = new Option("Indiana","Indiana");
        document.pageform.spc.options[18] = new Option("Iowa","Iowa");
        document.pageform.spc.options[19] = new Option("Kansas","Kansas");
        document.pageform.spc.options[20] = new Option("Kentucky","Kentucky");
        document.pageform.spc.options[21] = new Option("Louisiana","Louisiana");
        document.pageform.spc.options[22] = new Option("Maine","Maine");
        document.pageform.spc.options[23] = new Option("Mariana Islands","Mariana Islands");
        document.pageform.spc.options[24] = new Option("Marshall Islands","Marshall Islands");
        document.pageform.spc.options[25] = new Option("Maryland","Maryland");
        document.pageform.spc.options[26] = new Option("Massachusetts","Massachusetts");
        document.pageform.spc.options[27] = new Option("Michigan","Michigan");
        document.pageform.spc.options[28] = new Option("Minnesota","Minnesota");
        document.pageform.spc.options[29] = new Option("Mississippi","Mississippi");
        document.pageform.spc.options[30] = new Option("Missouri","Missouri");
        document.pageform.spc.options[31] = new Option("Montana","Montana");
        document.pageform.spc.options[32] = new Option("Nebraska","Nebraska");
        document.pageform.spc.options[33] = new Option("Nevada","Nevada");
        document.pageform.spc.options[34] = new Option("New Hampshire","New Hampshire");
        document.pageform.spc.options[35] = new Option("New Jersey","New Jersey");
        document.pageform.spc.options[36] = new Option("New Mexico","New Mexico");
        document.pageform.spc.options[37] = new Option("New York","New York");
        document.pageform.spc.options[38] = new Option("North Carolina","North Carolina");
        document.pageform.spc.options[39] = new Option("North Dakota","North Dakota");
        document.pageform.spc.options[40] = new Option("Northern Mariana Islands","Northern Mariana Islands");
        document.pageform.spc.options[41] = new Option("Ohio","Ohio");
        document.pageform.spc.options[42] = new Option("Oklahoma","Oklahoma");
        document.pageform.spc.options[43] = new Option("Oregon","Oregon");
        document.pageform.spc.options[44] = new Option("Pennsylvania","Pennsylvania");
        document.pageform.spc.options[45] = new Option("Puerto Rico","Puerto Rico");
        document.pageform.spc.options[46] = new Option("Rhode Island","Rhode Island");
        document.pageform.spc.options[47] = new Option("South Carolina","South Carolina");
        document.pageform.spc.options[48] = new Option("South Dakota","South Dakota");
        document.pageform.spc.options[49] = new Option("Swan Islands","Swan Islands");
        document.pageform.spc.options[50] = new Option("Tennessee","Tennessee");
        document.pageform.spc.options[51] = new Option("Texas","Texas");
        document.pageform.spc.options[52] = new Option("Trust Territory of Palau","Trust Territory of Palau");
        document.pageform.spc.options[53] = new Option("Trust Territory of the Pacific Islands","Trust Territory of the Pacific Islands");
        document.pageform.spc.options[54] = new Option("US Miscellaneous Pacific Islands","US Miscellaneous Pacific Islands");
        document.pageform.spc.options[55] = new Option("Utah","Utah");
        document.pageform.spc.options[56] = new Option("Vermont","Vermont");
        document.pageform.spc.options[57] = new Option("Virgin Islands","Virgin Islands");
        document.pageform.spc.options[58] = new Option("Virginia","Virginia");
        document.pageform.spc.options[59] = new Option("Washington","Washington");
        document.pageform.spc.options[60] = new Option("West Virginia","West Virginia");
        document.pageform.spc.options[61] = new Option("Wisconsin","Wisconsin");
        document.pageform.spc.options[62] = new Option("Wyoming","Wyoming");
        document.pageform.spc.options[63] = new Option("Armed Forces Americas","Armed Forces Americas");
        document.pageform.spc.options[64] = new Option("Armed Forces Europe","Armed Forces Europe");
        document.pageform.spc.options[65] = new Option("Armed Forces Pacific","Armed Forces Pacific");
	}
	else if(area == "canada"){
		//set new options for canada provinces
		document.pageform.spc.options[0] = new Option("(Choose Province)","");
		document.pageform.spc.options[1] = new Option("Alberta","Alberta");
		document.pageform.spc.options[2] = new Option("British Columbia","British Columbia");
		document.pageform.spc.options[3] = new Option("Manitoba","Manitoba");
		document.pageform.spc.options[4] = new Option("New Brunswick","New Brunswick");
		document.pageform.spc.options[5] = new Option("Newfoundland","Newfoundland");
		document.pageform.spc.options[6] = new Option("Northwest Territories","Northwest Territories");
		document.pageform.spc.options[7] = new Option("Nova Scotia","Nova Scotia");
		document.pageform.spc.options[8] = new Option("Ontario","Ontario");
		document.pageform.spc.options[9] = new Option("Prince Edward Island","Prince Edward Island");
		document.pageform.spc.options[10] = new Option("Quebec","Quebec");
		document.pageform.spc.options[11] = new Option("Saskatchewan","Saskatchewan");
		document.pageform.spc.options[12] = new Option("Yukon","Yukon");
	}
	else if(area == "other"){
		//must be other
		//set new options for other
		document.pageform.spc.options[0] = new Option("(Choose Country)","");
		document.pageform.spc.options[1] = new Option("Andorra","Andorra");
		document.pageform.spc.options[2] = new Option("Afghanistan","Afghanistan");
		document.pageform.spc.options[3] = new Option("Antigua and Barbuda","Antigua and Barbuda");
		document.pageform.spc.options[4] = new Option("Anguilla","Anguilla");
		document.pageform.spc.options[5] = new Option("Albania","Albania");
		document.pageform.spc.options[6] = new Option("Algeria","Algeria");
		document.pageform.spc.options[7] = new Option("American Samoa","American Samoa");
		document.pageform.spc.options[8] = new Option("Netherland Antilles","Netherland Antilles");
		document.pageform.spc.options[9] = new Option("Angola","Angola");
		document.pageform.spc.options[10] = new Option("Antarctica","Antarctica");
		document.pageform.spc.options[11] = new Option("Argentina","Argentina");
		document.pageform.spc.options[12] = new Option("Armenia","Armenia");
		document.pageform.spc.options[13] = new Option("Austria","Austria");
		document.pageform.spc.options[14] = new Option("Australia","Australia");
		document.pageform.spc.options[15] = new Option("Aruba","Aruba");
		document.pageform.spc.options[16] = new Option("Azerbaidjan","Azerbaidjan");
		document.pageform.spc.options[17] = new Option("Bosnia and Herzegovina","Bosnia and Herzegovina");
		document.pageform.spc.options[18] = new Option("Barbados","Barbados");
		document.pageform.spc.options[19] = new Option("Banglades","Banglades");
		document.pageform.spc.options[20] = new Option("Belgium","Belgium");
		document.pageform.spc.options[21] = new Option("Burkina Faso","Burkina Faso");
		document.pageform.spc.options[22] = new Option("Bulgaria","Bulgaria");
		document.pageform.spc.options[23] = new Option("Bahrain","Bahrain");
		document.pageform.spc.options[24] = new Option("Burundi","Burundi");
		document.pageform.spc.options[25] = new Option("Benin","Benin");
		document.pageform.spc.options[26] = new Option("Bermuda","Bermuda");
		document.pageform.spc.options[27] = new Option("Brunei Darussalam","Brunei Darussalam");
		document.pageform.spc.options[28] = new Option("Bolivia","Bolivia");
		document.pageform.spc.options[29] = new Option("Brazil","Brazil");
		document.pageform.spc.options[30] = new Option("Bahamas","Bahamas");
		document.pageform.spc.options[31] = new Option("Buthan","Buthan");
		document.pageform.spc.options[32] = new Option("Bouvet Island","Bouvet Island");
		document.pageform.spc.options[33] = new Option("Botswana","Botswana");
		document.pageform.spc.options[34] = new Option("Belarus","Belarus");
		document.pageform.spc.options[35] = new Option("Belize","Belize");
		document.pageform.spc.options[36] = new Option("Cambodia","Cambodia");
		document.pageform.spc.options[37] = new Option("Cayman Islands","Cayman Islands");
		document.pageform.spc.options[38] = new Option("Cocos Islands","Cocos Islands");
		document.pageform.spc.options[39] = new Option("Central African Republic","Central African Republic");
		document.pageform.spc.options[40] = new Option("Chad","Chad");
		document.pageform.spc.options[41] = new Option("Comoros","Comoros");
		document.pageform.spc.options[42] = new Option("Congo","Congo");
		document.pageform.spc.options[43] = new Option("Cook Islands","Cook Islands");
		document.pageform.spc.options[44] = new Option("Chile","Chile");
		document.pageform.spc.options[45] = new Option("Cameroon","Cameroon");
		document.pageform.spc.options[46] = new Option("China","China");
		document.pageform.spc.options[47] = new Option("Colombia","Colombia");
		document.pageform.spc.options[48] = new Option("Costa Rica","Costa Rica");
		document.pageform.spc.options[49] = new Option("Croatia","Croatia");
		document.pageform.spc.options[50] = new Option("Czechoslovakia","Czechoslovakia");
		document.pageform.spc.options[51] = new Option("Cuba","Cuba");
		document.pageform.spc.options[52] = new Option("Cape Verde","Cape Verde");
		document.pageform.spc.options[53] = new Option("Christmas Island","Christmas Island");
		document.pageform.spc.options[54] = new Option("Cyprus","Cyprus");
		document.pageform.spc.options[55] = new Option("Czech Republic","Czech Republic");
		document.pageform.spc.options[56] = new Option("Djibouti","Djibouti");
		document.pageform.spc.options[57] = new Option("Denmark","Denmark");
		document.pageform.spc.options[58] = new Option("Dominica","Dominica");
		document.pageform.spc.options[59] = new Option("Dominican Republic","Dominican Republic");
		document.pageform.spc.options[60] = new Option("Ecuador","Ecuador");
		document.pageform.spc.options[61] = new Option("Estonia","Estonia");
		document.pageform.spc.options[62] = new Option("Egypt","Egypt");
		document.pageform.spc.options[63] = new Option("Western Sahara","Western Sahara");
		document.pageform.spc.options[64] = new Option("Spain","Spain");
		document.pageform.spc.options[65] = new Option("East Timor","East Timor");
		document.pageform.spc.options[66] = new Option("Ethiopia","Ethiopia");
		document.pageform.spc.options[67] = new Option("Finland","Finland");
		document.pageform.spc.options[68] = new Option("Fiji","Fiji");
		document.pageform.spc.options[69] = new Option("Falkland Islands (Malvinas)","Falkland Islands (Malvinas)");
		document.pageform.spc.options[70] = new Option("Faroe Islands","Faroe Islands");
		document.pageform.spc.options[71] = new Option("France","France");
		document.pageform.spc.options[72] = new Option("France (European Territory)","France (European Territory)");
		document.pageform.spc.options[73] = new Option("Gabon","Gabon");
		document.pageform.spc.options[74] = new Option("Germany","Germany");
		document.pageform.spc.options[75] = new Option("Great Britain","Great Britain");
		document.pageform.spc.options[76] = new Option("Grenada","Grenada");
		document.pageform.spc.options[77] = new Option("Georgia","Georgia");
		document.pageform.spc.options[78] = new Option("Ghana","Ghana");
		document.pageform.spc.options[79] = new Option("Gibraltar","Gibraltar");
		document.pageform.spc.options[80] = new Option("Greenland","Greenland");
		document.pageform.spc.options[81] = new Option("Guadeloupe (French)","Guadeloupe (French)");
		document.pageform.spc.options[82] = new Option("Equatorial Guinea","Equatorial Guinea");
		document.pageform.spc.options[83] = new Option("Guyana (French)","Guyana (French)");
		document.pageform.spc.options[84] = new Option("Gambia","Gambia");
		document.pageform.spc.options[85] = new Option("Guinea","Guinea");
		document.pageform.spc.options[86] = new Option("Greece","Greece");
		document.pageform.spc.options[87] = new Option("Guatemala","Guatemala");
		document.pageform.spc.options[88] = new Option("Guinea Bissau","Guinea Bissau");
		document.pageform.spc.options[89] = new Option("Guyana","Guyana");
		document.pageform.spc.options[90] = new Option("Hong Kong","Hong Kong");
		document.pageform.spc.options[91] = new Option("Heard and McDonald Islands","Heard and McDonald Islands");
		document.pageform.spc.options[92] = new Option("Honduras","Honduras");
		document.pageform.spc.options[93] = new Option("Haiti","Haiti");
		document.pageform.spc.options[94] = new Option("Hungary","Hungary");
		document.pageform.spc.options[95] = new Option("British Indian Ocean Territory","British Indian Ocean Territory");
		document.pageform.spc.options[96] = new Option("Iceland","Iceland");
		document.pageform.spc.options[97] = new Option("India","India");
		document.pageform.spc.options[98] = new Option("Indonesia","Indonesia");
		document.pageform.spc.options[99] = new Option("Iran","Iran");
		document.pageform.spc.options[100] = new Option("Iraq","Iraq");
		document.pageform.spc.options[101] = new Option("Ireland","Ireland");
		document.pageform.spc.options[102] = new Option("Israel","Israel");
		document.pageform.spc.options[103] = new Option("Italy","Italy");
		document.pageform.spc.options[104] = new Option("Ivory Coast","Ivory Coast");
		document.pageform.spc.options[105] = new Option("Jamaica","Jamaica");
		document.pageform.spc.options[106] = new Option("Jordan","Jordan");
		document.pageform.spc.options[107] = new Option("Japan","Japan");
		document.pageform.spc.options[108] = new Option("Kenya","Kenya");
		document.pageform.spc.options[109] = new Option("Kirgistan","Kirgistan");
		document.pageform.spc.options[110] = new Option("Kiribati","Kiribati");
		document.pageform.spc.options[111] = new Option("Saint Kitts Nevis Anguilla","Saint Kitts Nevis Anguilla");
		document.pageform.spc.options[112] = new Option("North Korea","North Korea");
		document.pageform.spc.options[113] = new Option("South Korea","South Korea");
		document.pageform.spc.options[114] = new Option("Kuwait","Kuwait");
		document.pageform.spc.options[115] = new Option("Kazachstan","Kazachstan");
		document.pageform.spc.options[116] = new Option("Laos","Laos");
		document.pageform.spc.options[117] = new Option("Lebanon","Lebanon");
		document.pageform.spc.options[118] = new Option("Liechtenstein","Liechtenstein");
		document.pageform.spc.options[119] = new Option("Liberia","Liberia");
		document.pageform.spc.options[120] = new Option("Lesotho","Lesotho");
		document.pageform.spc.options[121] = new Option("Lithuania","Lithuania");
		document.pageform.spc.options[122] = new Option("Luxembourg","Luxembourg");
		document.pageform.spc.options[123] = new Option("Latvia","Latvia");
		document.pageform.spc.options[124] = new Option("Libya","Libya");
		document.pageform.spc.options[125] = new Option("Macau","Macau");
		document.pageform.spc.options[126] = new Option("Madagascar","Madagascar");
		document.pageform.spc.options[127] = new Option("Malawi","Malawi");
		document.pageform.spc.options[128] = new Option("Malaysia","Malaysia");
		document.pageform.spc.options[129] = new Option("Maldives","Maldives");
		document.pageform.spc.options[130] = new Option("Mali","Mali");
		document.pageform.spc.options[131] = new Option("Malta","Malta");
		document.pageform.spc.options[132] = new Option("Mauritania","Mauritania");
		document.pageform.spc.options[133] = new Option("Mauritius","Mauritius");
		document.pageform.spc.options[134] = new Option("Northern Mariana Islands","Northern Mariana Islands");
		document.pageform.spc.options[135] = new Option("Marshall Islands","Marshall Islands");
		document.pageform.spc.options[136] = new Option("Martinique (French)","Martinique (French)");
		document.pageform.spc.options[137] = new Option("Mexico","Mexico");
		document.pageform.spc.options[138] = new Option("Micronesia","Micronesia");
		document.pageform.spc.options[139] = new Option("Moldavia","Moldavia");
		document.pageform.spc.options[140] = new Option("Monaco","Monaco");
		document.pageform.spc.options[141] = new Option("Morocco","Morocco");
		document.pageform.spc.options[142] = new Option("Mongolia","Mongolia");
		document.pageform.spc.options[143] = new Option("Montserrat","Montserrat");
		document.pageform.spc.options[144] = new Option("Mozambique","Mozambique");
		document.pageform.spc.options[145] = new Option("Myanmar","Myanmar");
		document.pageform.spc.options[146] = new Option("Namibia","Namibia");
		document.pageform.spc.options[147] = new Option("Nauru","Nauru");
		document.pageform.spc.options[148] = new Option("Nepal","Nepal");
		document.pageform.spc.options[149] = new Option("Netherlands","Netherlands");
		document.pageform.spc.options[150] = new Option("Netherland Antilles","Netherland Antilles");
		document.pageform.spc.options[151] = new Option("Neutral Zone","Neutral Zone");
		document.pageform.spc.options[152] = new Option("New Caledonia (French)","New Caledonia (French)");
		document.pageform.spc.options[153] = new Option("New Zealand","New Zealand");
		document.pageform.spc.options[154] = new Option("Nicaragua","Nicaragua");
		document.pageform.spc.options[155] = new Option("Niger","Niger");
		document.pageform.spc.options[156] = new Option("Nigeria","Nigeria");
		document.pageform.spc.options[157] = new Option("Niue","Niue");
		document.pageform.spc.options[158] = new Option("Norfolk Island","Norfolk Island");
		document.pageform.spc.options[159] = new Option("Norway","Norway");
		document.pageform.spc.options[160] = new Option("Oman","Oman");
		document.pageform.spc.options[161] = new Option("Pakistan","Pakistan");
		document.pageform.spc.options[162] = new Option("Palau","Palau");
		document.pageform.spc.options[163] = new Option("Palestine","Palestine");
		document.pageform.spc.options[164] = new Option("Panama","Panama");
		document.pageform.spc.options[165] = new Option("Papua New","Papua New");
		document.pageform.spc.options[166] = new Option("Paraguay","Paraguay");
		document.pageform.spc.options[167] = new Option("Peru","Peru");
		document.pageform.spc.options[168] = new Option("Polynesia (French)","Polynesia (French)");
		document.pageform.spc.options[169] = new Option("Philippines","Philippines");
		document.pageform.spc.options[170] = new Option("Poland","Poland");
		document.pageform.spc.options[171] = new Option("Pitcairn","Pitcairn");
		document.pageform.spc.options[172] = new Option("Portugal","Portugal");
		document.pageform.spc.options[173] = new Option("Qatar","Qatar");
		document.pageform.spc.options[174] = new Option("Reunion (French)","Reunion (French)");
		document.pageform.spc.options[175] = new Option("Romania","Romania");
		document.pageform.spc.options[176] = new Option("Russian Federation","Russian Federation");
		document.pageform.spc.options[177] = new Option("Rwanda","Rwanda");
		document.pageform.spc.options[178] = new Option("Saint Helena","Saint Helena");
		document.pageform.spc.options[179] = new Option("Saint Lucia","Saint Lucia");
		document.pageform.spc.options[180] = new Option("Saint Pierre and Miquelon","Saint Pierre and Miquelon");
		document.pageform.spc.options[181] = new Option("Saint Tome and Principe","Saint Tome and Principe");
		document.pageform.spc.options[182] = new Option("Samoa","Samoa");
		document.pageform.spc.options[183] = new Option("San Marino","San Marino");
		document.pageform.spc.options[184] = new Option("Saudi Arabia","Saudi Arabia");
		document.pageform.spc.options[185] = new Option("Senegal","Senegal");
		document.pageform.spc.options[186] = new Option("Serbia and Montenegro","Serbia and Montenegro");
		document.pageform.spc.options[187] = new Option("Seychelles","Seychelles");
		document.pageform.spc.options[188] = new Option("Sierra Leone","Sierra Leone");
		document.pageform.spc.options[189] = new Option("Singapore","Singapore");
		document.pageform.spc.options[190] = new Option("Slovak Republic","Slovak Republic");
		document.pageform.spc.options[191] = new Option("Slovenia","Slovenia");
		document.pageform.spc.options[192] = new Option("Solomon Islands","Solomon Islands");
		document.pageform.spc.options[193] = new Option("Somalia","Somalia");
		document.pageform.spc.options[194] = new Option("South Africa","South Africa");
		document.pageform.spc.options[195] = new Option("Soviet Union (Former)","Former Soviet Union");
		document.pageform.spc.options[196] = new Option("Sri Lanka","Sri Lanka");
		document.pageform.spc.options[197] = new Option("Sudan","Sudan");
		document.pageform.spc.options[198] = new Option("Suriname","Suriname");
		document.pageform.spc.options[199] = new Option("Svalbard and Jan Mayen Islands","Svalbard and Jan Mayen Islands");
		document.pageform.spc.options[200] = new Option("Sweden","Sweden");
		document.pageform.spc.options[201] = new Option("El Salvador","El Salvador");
		document.pageform.spc.options[202] = new Option("Syria","Syria");
		document.pageform.spc.options[203] = new Option("Swaziland","Swaziland");
		document.pageform.spc.options[204] = new Option("Switzerland","Switzerland");
		document.pageform.spc.options[205] = new Option("Tadjikistan","Tadjikistan");
		document.pageform.spc.options[206] = new Option("Taiwan","Taiwan");
		document.pageform.spc.options[207] = new Option("Tanzania","Tanzania");
		document.pageform.spc.options[208] = new Option("Thailand","Thailand");
		document.pageform.spc.options[209] = new Option("East Timor","East Timor");
		document.pageform.spc.options[210] = new Option("Togo","Togo");
		document.pageform.spc.options[211] = new Option("Tokelau","Tokelau");
		document.pageform.spc.options[212] = new Option("Tonga","Tonga");
		document.pageform.spc.options[213] = new Option("Trinidad and Tobago","Trinidad and Tobago");
		document.pageform.spc.options[214] = new Option("Tunisia","Tunisia");
		document.pageform.spc.options[215] = new Option("Turkmenistan","Turkmenistan");
		document.pageform.spc.options[216] = new Option("Turks and Caicos Islands","Turks and Caicos Islands");
		document.pageform.spc.options[217] = new Option("Turkey","Turkey");
		document.pageform.spc.options[218] = new Option("Tuvalu","Tuvalu");
		document.pageform.spc.options[219] = new Option("Ukraine","Ukraine");
		document.pageform.spc.options[220] = new Option("Uganda","Uganda");
		document.pageform.spc.options[221] = new Option("United Arab Emirates","United Arab Emirates");
		document.pageform.spc.options[222] = new Option("Uruguay","Uruguay");
		document.pageform.spc.options[223] = new Option("Uzbekistan","Uzbekistan");
		document.pageform.spc.options[224] = new Option("Vatican City State","Vatican City State");
		document.pageform.spc.options[225] = new Option("Saint Vincent and Grenadines","Saint Vincent and Grenadines");
		document.pageform.spc.options[226] = new Option("Venezuela","Venezuela");
		document.pageform.spc.options[227] = new Option("Virgin Islands (British)","Virgin Islands (British)");
		document.pageform.spc.options[228] = new Option("Vietnam","Vietnam");
		document.pageform.spc.options[229] = new Option("Vanuatu","Vanuatu");
		document.pageform.spc.options[230] = new Option("Wallis and Futuna Islands","Wallis and Futuna Islands");
		document.pageform.spc.options[231] = new Option("Yemen","Yemen");
		document.pageform.spc.options[232] = new Option("Zambia","Zambia");
		document.pageform.spc.options[233] = new Option("Zaire","Zaire");
		document.pageform.spc.options[234] = new Option("Zimbabwe","Zimbabwe");
	}
	
	//set selected index if location is defined
    for (optionCounter = 0; optionCounter < document.pageform.spc.length; optionCounter++) { 
		if (location == document.pageform.spc.options[optionCounter].value){
			//this is selected index
			document.pageform.spc.selectedIndex = optionCounter;
			break;			
		}		
	}

}
	
function processAreaChange(area){
	//if area.options[area.selectedIndex].value == "other"
	//set spc's values to be countries
	//else if it == usa set spc's values to be states
	//else set spc's values to be provinces
	
	//this would be either usa, canada, other
	var area_val = area.options[area.selectedIndex].value;
	//this will be 0, 1, 2
	var area_sel_i = area.selectedIndex;
	 
	setSPC(area_val,'');
}
	
	
function doCookies(){
	// The following block of code checks for cookies, and redirects them
	// to a different page if we can't set a cookie. 
	var once = getQueryVariable("once");
	var cookies = document.cookie;
	
	if (cookies == null || cookies == "")
	{
		// no cookies are found
		if (once != "1")
		{
			// first time loading this page, let's set a cookie and redirect
			setCookie("ct", "1", "Tue, 1 January 2030 00:00:01 UTC", "/", ".iatn.net", false);
			window.location="http://www.iatn.net/join/index.aspx?target=prelimpage2&once=1";
		}
		else
		{
			// we tried to set a cookie already, but failed -- show them the 
			// warning and prevent them from joining.
			window.location="http://www.iatn.net/help/cookies/joining.asp";
		}
	}
	else{
		//there are cookies so see if one is the been here before one
		//if that exists the redirect to login page otherwise drop cookie and continue
		
		var here_before = getCookie("iatn_registration");
		
		if(here_before ==  '1'){
			//they were here so redirect to login form and update cookie so that it won't 
			//continue to send them to login
			setCookie("iatn_registration", "2", "Tue, 1 January 2030 00:00:01 UTC", "/", ".iatn.net", false);		
			window.location="http://www.iatn.net/join/index.aspx?login=1&target=page1";
			
		}
		
	
	}
	
	//document.pageform.javascript_enabled.value = "true";

}


function setRegCookie(){
	//called from page2 this will set the reg cookie bc once they reach here they have
	//a pending registration
	setCookie("iatn_registration", "1", "Tue, 1 January 2030 00:00:01 UTC", "/", ".iatn.net", false);
}

/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


function toggleBoxes(field) {
	//field will either be a make or topic
	//if make then get make_topic1 value
	//and then set make_topic1-11 the opp of what just pulled for topic1
	//if topic then will asian_field value and then set each make_field
	//to opp of jsut pulled for asian_field
	//field[i].checked = true ;
	//getElementsByName
	
	var alert_text = "";
	
	var makes= new Array(5)
	makes[0]="asian";
	makes[1]="euro";
	makes[2]="chry";
	makes[3]="ford";
	makes[4]="gm";
	
	var topics= new Array(12)
	for (x=1; x<12; x++)
	{
		topics[x] = "topic" + x;
	}
	
	if(field.indexOf("topic") != -1){
		//it is a topic so loop on makes
		
		var curVal = document.getElementsByName("asian_" + field); //get whether determining box was checked or not
		curVal = curVal[0].checked;
		
		var newVal = (curVal) ? false : true;
		var obj;
		for(x=0;x<makes.length;x++){
			obj = document.getElementsByName(makes[x] + "_" + field);
			obj[0].checked = newVal;			
		}
	}
	else{
		//is a make bc topic not found so loop on topics
		var curVal = document.getElementsByName(field + "_topic1"); //get whether determining box was checked or not
		curVal = curVal[0].checked;

		var newVal = (curVal) ? false : true;
		
		//if it is false set volume to none
		//not implemented yet will do when lib is finished
		var vol_obj = document.getElementsByName(field + "_volume");
		
		var obj;
		for(x=1;x<topics.length;x++){
			obj = document.getElementsByName(field + "_" + topics[x]);
			obj[0].checked = newVal;				
		}
		
	}
	
	updateDailyEstimate();
}

var was_warned = false;
function updateDailyEstimate(){
	//loop through makes and foreach make loop through all topics
	//if make_topic is checked add value to tmp make count
	//once all topics exhausted for make check the make_volume value
	//if that is 100 do nothing, if 0 set tmp make count to 0, if 50 divide tmp make count by 2
	//and if it is -50 make tmp make count 1
	//then add tmp make count to total count and move on to next make.
	//once all makes exhausted set daily_estimate.innerHTML = roundedup(total_count)
	
	var obj;
	var real_total = 0;
	var tmp_total;

	var makes= new Array(5)
	makes[0]="asian";
	makes[1]="euro";
	makes[2]="chry";
	makes[3]="ford";
	makes[4]="gm";
	
	var topics= new Array(12)
	for (x=1; x<12; x++)
	{
		topics[x] = "topic" + x;
	}
	
	for(x=0;x<makes.length;x++){
		tmp_total = 0;
		for(z=1;z<topics.length;z++){
			obj = document.getElementsByName(makes[x] + "_" + topics[z]);
			
			if(obj[0].checked){
				//add value to tmp
				tmp_total = tmp_total + (obj[0].value * 1);
			}			
		}
		
		obj = document.getElementsByName(makes[x] + "_volume");	
		for(yy=0;yy<obj.length;yy++){
			if(obj[yy].checked){
				if(obj[yy].value == "50"){
					//div by 2
					tmp_total = tmp_total / 2;
					
				}
				else if(obj[yy].value == "0"){
					//set to 0
					tmp_total = 0;
					
				}
				else if(obj[yy].value == "-50"){
					//set to 1
					tmp_total = 1;
					
				}
			}
		}
		
			
		
		real_total = real_total + tmp_total;
		
	} //end loop on makes
	
	if(! was_warned && Math.round(real_total) > 50){
		was_warned = true;
		alert("WARNING!!\n\nYou are configured to receive more than 50 emails per day.");		
	}
	
	daily_estimate.innerHTML = Math.round(real_total);	

}

function checkListTopicChange(obj){
	//called everytime a checkbox is changed
	//using obj.name we should be able to determine if box change is legal
	//by splitting the name at the _ to get the make and topic/volume out of it
	//and then evaluating the different values and constraints for the selection
	
	var name = obj.name;
	var new_value = obj.checked;
	var old_value = ! new_value
	
	alert("name: " + name + "\nnew_value: " + new_value + "\nold_value: " + old_value);


	updateDailyEstimate();
}

function verifyAgreement(which)
{
	switch(which)
	{
		case 0:
			{
				if (document.getElementById('i_agree').checked)
					document.pageform.submit();
				else
					alert('You need to read and agree to the iATN Member Agreement.');
				break;
			}
		case 1:
			{
				if (document.getElementById('i_agree').checked)
					document.pageform.submit();
				else
					alert('You need to read and agree to the iATN Network Usage Policy.');
				break;
			}
		default:
			document.pageform.submit();
	}
}

function resetForm()
{
	if (confirm('Are you sure you want to reset this form?'))
	{
		document.pageform.reset();
	}
}
	

function shouldShow(div_id, is_checked){
	//checked value of checkbox passed in
	//if checked then calls showObject on the div_id param
	//otherwise hideObject on div_id param
	
	if(is_checked){
		showObject(div_id);
	}
	else{
		hideObject(div_id);
	}	
}


function shouldNotShow(div_id, is_checked){
	//checked value of checkbox passed in
	//if checked then calls hideObject on the div_id param
	//otherwise showObject on div_id param
	
	if(is_checked){
		hideObject(div_id);
	}
	else{
		showObject(div_id);
	}	
}

function tryToValidate(vc, form){
	//checks if vc is != '' and not false
	//if ok them form.submit()
	//otherwise alert and do not submit

	if(vc != '' && vc != false){
		form.submit();
	}
	else{
		alert ('You must enter the validation code in the box');
		return false;
	}
}

function starPwd(pwd){
	var star = '';
	
	for(var i=0; i < pwd.length; i++){
		star += '*';	
	}

	return star;
}

function resetRegistration(u, i){
	//this should prompt user with message asking if they are sure
	//they want to start over and warn them about the implications of this decision
	//if they confirm then they should get reset otherwise they shouldn't
	
	var agree=confirm("This will clear your current registration and allow you to start over. ALL information you have entered so far will be deleted. This is the only time you can change your username. Are you sure you want to change your username?");
	if (agree){
		//reload registration but delete this id on the way
		//alert("change it: "+ u + " <=> " + i);
		self.location = "index.aspx?target=resetr&u="+u+"&i="+i;
	}
}

function changeHeardPrompt(sval, div_id){

	if(sval == ''){
		document.getElementById(div_id).innerHTML = "<p></p>";
	}
	else if(sval == 'Existing Member Referral'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us about the member who referred you.</p>";
	}
	else if(sval == 'Previous Member'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us why you are rejoining.</p>";	
	}
	else if(sval == 'Internet Search'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us what search engine you used and what you searched for that led you to iATN.</p>";
	}
	else if(sval == 'Newspaper'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us the name of the newspaper.</p>";
	}
	else if(sval == 'Parts Store'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us the name of the parts store.</p>";
	}
	else if(sval == 'Tool Company'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us the name of the tool company.</p>";
	}
	else if(sval == 'Training Seminar'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us which training seminar (instructor's name, course title, etc.).</p>";
	}
	else if(sval == 'Trade Magazine'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us the name of the trade magazine.</p>";
	}
	else if(sval == 'Trade Association'){
		document.getElementById(div_id).innerHTML = "<p>Please tell us which trade association.</p>";
	}
	else if(sval == 'Other'){
		document.getElementById(div_id).innerHTML = "<p>Please provide us some information about how you heard about iATN. Please try and include as much detail as possible here, your feedback will help other automotive technicians trying to locate iATN.</p>";
	}

}

function checkUsername() {
	
	var params = {};
	params['username'] = document.getElementById('username').value;
	params['action'] = 'validate_username';
		
	//url, params, result id, error class, success class, is post
	DoAjax('checkUsername.aspx?', params, 'usernameResult', 'bad', 'good', false);
}