//functions for use on pages with ZIP help
//need to include it in all pages that require ZIP help

	//this functions opens a window with the zip_help.asp page
	var zipField, cityField, stateField, formName;
	function openZipWin(zip, city, state, form) {
		zipField = zip;
		cityField = city;
		stateField = state;
		formName = form;
		var zipWin = window.open('zip_help.asp', 'newWin', 'width=360, height=240');
	}
	
	//this function sets the fields automatically
	function setFields(zip, city, state, stateName) {
		//alert("zip=" + zip + "city=" + city + "state=" + state);
		var zipElement, cityElement, stateElement, countryElement;
		//Use if statements to test whether all fields need to be changed
		if (zipField) {
			zipElement = eval("document." + formName + "." + zipField);
			zipElement.value = zip;
		}
		if (cityField) {
			cityElement = eval("document." + formName + "." + cityField);
			cityElement.value = city;
		}
		if (stateField) {
			stateElement = eval("document." + formName + "." + stateField);
			for (var i = 0; i < stateElement.length; i++) {      
				if (stateElement.options[i].value == state) {         
				stateElement.options[i].selected = true      
					}   
			}
		} else {
			stateElement = eval("document." + formName + "." + zipField.replace(/zip/g,"state"));
			stateElement.value = stateName;
		}
		if (zipField) {
			countryElement = eval("document." + formName + "." + zipField.replace(/zip/g,"country"));
			countryElement.value = 1;
			countryElement.selectedIndex = 1;
		}
	}
