        function changeCity (cIn) {
                for(var i=0; i < document.theForm.M3.length; i++) {
                  if(document.theForm.M3.options[i].value == cIn) {
                        document.theForm.M3.selectedIndex = i;
                        return;
                  }
                }  
        }

        function changeState (sIn) {
                for(var i=0; i < document.theForm.M2.length; i++) {
                  if(document.theForm.M2.options[i].value == sIn) {
                        document.theForm.M2.selectedIndex = i;
                        return;
                  }
                }  
        }

  	function changeCountry (cIn) {
		for(var i=0; i < document.theForm.M1.length; i++) {
		  if(document.theForm.M1.options[i].value == cIn) {
			document.theForm.M1.selectedIndex = i;
			return;
		  }
		}
	}


  function countryChange(countryCode) {
	if(countryCode != null) {
		countryCode = countryCode;
	}
	else {
		countryCode = document.theForm.M1.options[document.theForm.M1.selectedIndex].value;
	}

	 document.theForm.M2.selectedIndex = 0;
	if(countryCode == 4) {
		document.theForm.M2.length = 2;
		document.theForm.M2.options[0].text = "Choose a City/Area";
		document.theForm.M2.options[0].value = "-1";
		document.theForm.M2.options[1].text = "__________________";
		document.theForm.M2.options[1].value = "";
		document.theForm.M3.length = 0 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
		document.theForm.M3.options[1].text = "Choose a City/Area";
		document.theForm.M3.options[1].value = "545";
		document.theForm.M3.options[2].text = "__________________";
		document.theForm.M3.options[2].value = "";
		document.theForm.M3.selectedIndex = 0;
	}
	if(countryCode == 3) {
		document.theForm.M2.length = 2;
		document.theForm.M2.options[0].text = "Select a City";
		document.theForm.M2.options[0].value = "";
		document.theForm.M2.options[1].text = "__________________";
		document.theForm.M2.options[1].value = "";
		document.theForm.M3.length = 7 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
		document.theForm.M3.options[1].text = "Calgary";
		document.theForm.M3.options[1].value = "180";
		document.theForm.M3.options[2].text = "Montreal";
		document.theForm.M3.options[2].value = "80";
		document.theForm.M3.options[3].text = "Ottawa";
		document.theForm.M3.options[3].value = "399";
		document.theForm.M3.options[4].text = "Regina";
		document.theForm.M3.options[4].value = "373";
		document.theForm.M3.options[5].text = "Sudbury";
		document.theForm.M3.options[5].value = "560";
		document.theForm.M3.options[6].text = "Toronto";
		document.theForm.M3.options[6].value = "79";
		document.theForm.M3.options[7].text = "Vancouver";
		document.theForm.M3.options[7].value = "77";
		document.theForm.M3.options[8].text = "Winnipeg";
		document.theForm.M3.options[8].value = "78";
		document.theForm.M3.options[9].text = "__________________";
		document.theForm.M3.options[9].value = "";
		document.theForm.M3.selectedIndex = 0;
	}
	if(countryCode == 1) {
		document.theForm.M2.options[0].text = "Select a State";
		document.theForm.M2.options[0].value = "";
		document.theForm.M2.length = 50 + 2;
		document.theForm.M2.options[1].text = "Alabama";
		document.theForm.M2.options[1].value = "44";
		document.theForm.M2.options[2].text = "Alaska";
		document.theForm.M2.options[2].value = "43";
		document.theForm.M2.options[3].text = "Arizona";
		document.theForm.M2.options[3].value = "19";
		document.theForm.M2.options[4].text = "Arkansas";
		document.theForm.M2.options[4].value = "45";
		document.theForm.M2.options[5].text = "California";
		document.theForm.M2.options[5].value = "16";
		document.theForm.M2.options[6].text = "Colorado";
		document.theForm.M2.options[6].value = "14";
		document.theForm.M2.options[7].text = "Connecticut";
		document.theForm.M2.options[7].value = "3";
		document.theForm.M2.options[8].text = "Delaware";
		document.theForm.M2.options[8].value = "60";
		document.theForm.M2.options[9].text = "Florida";
		document.theForm.M2.options[9].value = "24";
		document.theForm.M2.options[10].text = "Georgia";
		document.theForm.M2.options[10].value = "17";
		document.theForm.M2.options[11].text = "Hawaii";
		document.theForm.M2.options[11].value = "65";
		document.theForm.M2.options[12].text = "Idaho";
		document.theForm.M2.options[12].value = "56";
		document.theForm.M2.options[13].text = "Illinois";
		document.theForm.M2.options[13].value = "25";
		document.theForm.M2.options[14].text = "Indiana";
		document.theForm.M2.options[14].value = "67";
		document.theForm.M2.options[15].text = "Iowa";
		document.theForm.M2.options[15].value = "55";
		document.theForm.M2.options[16].text = "Kansas";
		document.theForm.M2.options[16].value = "63";
		document.theForm.M2.options[17].text = "Kentucky";
		document.theForm.M2.options[17].value = "57";
		document.theForm.M2.options[18].text = "Louisiana";
		document.theForm.M2.options[18].value = "58";
		document.theForm.M2.options[19].text = "Maine";
		document.theForm.M2.options[19].value = "8";
		document.theForm.M2.options[20].text = "Maryland";
		document.theForm.M2.options[20].value = "5";
		document.theForm.M2.options[21].text = "Massachusetts";
		document.theForm.M2.options[21].value = "12";
		document.theForm.M2.options[22].text = "Michigan";
		document.theForm.M2.options[22].value = "18";
		document.theForm.M2.options[23].text = "Minnesota";
		document.theForm.M2.options[23].value = "66";
		document.theForm.M2.options[24].text = "Mississippi";
		document.theForm.M2.options[24].value = "59";
		document.theForm.M2.options[25].text = "Missouri";
		document.theForm.M2.options[25].value = "22";
		document.theForm.M2.options[26].text = "Montana";
		document.theForm.M2.options[26].value = "49";
		document.theForm.M2.options[27].text = "Nebraska";
		document.theForm.M2.options[27].value = "42";
		document.theForm.M2.options[28].text = "Nevada";
		document.theForm.M2.options[28].value = "46";
		document.theForm.M2.options[29].text = "New Hampshire";
		document.theForm.M2.options[29].value = "7";
		document.theForm.M2.options[30].text = "New Jersey";
		document.theForm.M2.options[30].value = "13";
		document.theForm.M2.options[31].text = "New Mexico";
		document.theForm.M2.options[31].value = "62";
		document.theForm.M2.options[32].text = "New York";
		document.theForm.M2.options[32].value = "20";
		document.theForm.M2.options[33].text = "North Carolina";
		document.theForm.M2.options[33].value = "51";
		document.theForm.M2.options[34].text = "North Dakota";
		document.theForm.M2.options[34].value = "53";
		document.theForm.M2.options[35].text = "Ohio";
		document.theForm.M2.options[35].value = "26";
		document.theForm.M2.options[36].text = "Oklahoma";
		document.theForm.M2.options[36].value = "61";
		document.theForm.M2.options[37].text = "Oregon";
		document.theForm.M2.options[37].value = "27";
		document.theForm.M2.options[38].text = "Pennsylvania";
		document.theForm.M2.options[38].value = "28";
		document.theForm.M2.options[39].text = "Rhode Island";
		document.theForm.M2.options[39].value = "6";
		document.theForm.M2.options[40].text = "South Carolina";
		document.theForm.M2.options[40].value = "52";
		document.theForm.M2.options[41].text = "South Dakota";
		document.theForm.M2.options[41].value = "54";
		document.theForm.M2.options[42].text = "Tennessee";
		document.theForm.M2.options[42].value = "29";
		document.theForm.M2.options[43].text = "Texas";
		document.theForm.M2.options[43].value = "15";
		document.theForm.M2.options[44].text = "Utah";
		document.theForm.M2.options[44].value = "40";
		document.theForm.M2.options[45].text = "Vermont";
		document.theForm.M2.options[45].value = "9";
		document.theForm.M2.options[46].text = "Virginia";
		document.theForm.M2.options[46].value = "30";
		document.theForm.M2.options[47].text = "Washington";
		document.theForm.M2.options[47].value = "21";
		document.theForm.M2.options[48].text = "Washington, D.C.";
		document.theForm.M2.options[48].value = "23";
		document.theForm.M2.options[49].text = "West Virginia";
		document.theForm.M2.options[49].value = "50";
		document.theForm.M2.options[50].text = "Wisconsin";
		document.theForm.M2.options[50].value = "47";
		document.theForm.M2.options[51].text = "Wyoming";
		document.theForm.M2.options[51].value = "48";
		document.theForm.M2.length = 52 + 1;
		document.theForm.M2.options[document.theForm.M2.length - 1].text = "__________________";
		document.theForm.M2.options[document.theForm.M2.length - 1].value = "";
	}
	if(countryCode == "1") {stateChange(document.theForm.M2.options[document.theForm.M2.selectedIndex].value);}}



  function stateChange (stateCode){
	if(stateCode == 44) {     //Alabama
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 43) {     //Alaska
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 19) {     //Arizona
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 45) {     //Arkansas
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 16) {     //California
		document.theForm.M3.length = 2 + 4;
		document.theForm.M3.options[0].text = "Choose a City/Area";
		document.theForm.M3.options[0].value = "-1";
		document.theForm.M3.options[1].text = "Bay Area + Central CA";
		document.theForm.M3.options[1].value = "48";
		document.theForm.M3.options[2].text = "Northern CA";
		document.theForm.M3.options[2].value = "86";
		document.theForm.M3.options[3].text = "Southern CA";
		document.theForm.M3.options[3].value = "31";
		document.theForm.M3.options[4].text = "All other";
		document.theForm.M3.options[4].value = "-1";
	}
	if(stateCode == 14) {     //Colorado
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 3) {     //Connecticut
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 60) {     //Delaware
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 24) {     //Florida
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 17) {     //Georgia
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 65) {     //Hawaii
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 56) {     //Idaho
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 25) {     //Illinois
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 67) {     //Indiana
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 55) {     //Iowa
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 63) {     //Kansas
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 57) {     //Kentucky
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 58) {     //Louisiana
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 8) {     //Maine
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 5) {     //Maryland
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 12) {     //Massachusetts
		document.theForm.M3.length = 1 + 4;
		document.theForm.M3.options[0].text = "Choose a City/Area";
		document.theForm.M3.options[0].value = "-1";
		document.theForm.M3.options[1].text = "Boston Area + Eastern MA";
		document.theForm.M3.options[1].value = "475";
		document.theForm.M3.options[2].text = "Central + Western MA";
		document.theForm.M3.options[2].value = "476";
		document.theForm.M3.options[3].text = "All other";
		document.theForm.M3.options[3].value = "-1";
	}
	if(stateCode == 18) {     //Michigan
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 66) {     //Minnesota
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 59) {     //Mississippi
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 22) {     //Missouri
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 49) {     //Montana
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 42) {     //Nebraska
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 46) {     //Nevada
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 7) {     //New Hampshire
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 13) {     //New Jersey
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 62) {     //New Mexico
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 20) {     //New York
		document.theForm.M3.length = 2 + 4;
		document.theForm.M3.options[0].text = "Choose a City/Area";
		document.theForm.M3.options[0].value = "-1";
		document.theForm.M3.options[1].text = "Long Island/Queens";
		document.theForm.M3.options[1].value = "91";
		document.theForm.M3.options[2].text = "New York City";
		document.theForm.M3.options[2].value = "39";
		document.theForm.M3.options[3].text = "All other";
		document.theForm.M3.options[3].value = "-1";
	}
	if(stateCode == 51) {     //North Carolina
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 53) {     //North Dakota
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 26) {     //Ohio
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 61) {     //Oklahoma
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 27) {     //Oregon
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 28) {     //Pennsylvania
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 6) {     //Rhode Island
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 52) {     //South Carolina
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 54) {     //South Dakota
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 29) {     //Tennessee
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 15) {     //Texas
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 40) {     //Utah
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 9) {     //Vermont
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 30) {     //Virginia
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 21) {     //Washington
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 23) {     //Washington, D.C.
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 50) {     //West Virginia
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 47) {     //Wisconsin
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}
	if(stateCode == 48) {     //Wyoming
		document.theForm.M3.length = -1 + 3;
		document.theForm.M3.options[0].text = "ANY";
		document.theForm.M3.options[0].value = "-1";
	}


	if(stateCode == '') {
		 if(document.theForm.M1.options[document.theForm.M1.selectedIndex].value != "1") {countryChange();}
	}

	document.theForm.M3.options[document.theForm.M3.length - 1].text = "";
	document.theForm.M3.options[document.theForm.M3.length - 1].value = "-1";
}



  function fillCountry (){
	    document.theForm.M1.length=2+0;
		document.theForm.M1.options[0].text = "United States";
		document.theForm.M1.options[0].value = "1";
		document.theForm.M1.options[1].text = "Canada";
		document.theForm.M1.options[1].value = "3";
}



