// Assemblerfunction Address(FullName, CompanyName, Email, Address1, Address2, City, StateName, Zip) {	this.FullName = FullName;	this.CompanyName = CompanyName;	this.Email = Email;	this.Address1 = Address1;	this.Address2 = Address2;	this.City = City;	this.StateName = StateName;	this.Zip = Zip;}// Create an array to hold all the address fieldsAddressArray = new Array();AddressArray[0] = new Address("", "", "", "", "", "", "", "");AddressArray[1] = new Address("Jason Fried", "37signals, LLC", "jason@37signals.com", "314 West Institute Place", "Top Floor", "Chicago", "IL", "60610");AddressArray[2] = new Address("Ernest Kim", "37signals, LLC", "ernest@37signals.com", "314 West Institute Place", "Top Floor", "Chicago", "IL", "60610");AddressArray[3] = new Address("Matt Linderman", "37signals, LLC", "matt@37signals.com", "314 West Institute Place", "Top Floor", "Chicago", "IL", "60610");AddressArray[4] = new Address("Scott Upton", "37signals, LLC", "scott@37signals.com", "314 West Institute Place", "Top Floor", "Chicago", "IL", "60610");AddressArray[5] = new Address("Bill Bowerman", "Nike", "bill@nike.com", "One Bowerman Drive", "", "Beaverton", "OR", "97005");AddressArray[6] = new Address("Janet Nguyen", "Peachpit Press", "Janet.Nguyen@peachpit.com", "1249 Eighth Street", "", "Berkeley", "CA", "94710");AddressArray[7] = new Address("Lauren Roberts", "HarperCollins Books", "", "10 East 53rd St", "", "New York", "NY", "10022");AddressArray[8] = new Address("Ted Smith", "Peachpit Press", "ted.smith@peachpit.com", "1249 Eighth Street", "", "Berkeley", "CA", "94710");// Function to populate the formfunction SelectThis(item) {	// populate the address text fields	document.forms["ShipForm"].FullName.value = AddressArray[item].FullName;	document.forms["ShipForm"].CompanyName.value = AddressArray[item].CompanyName;	document.forms["ShipForm"].Email.value = AddressArray[item].Email;	document.forms["ShipForm"].Address1.value = AddressArray[item].Address1;	document.forms["ShipForm"].Address2.value = AddressArray[item].Address2;	document.forms["ShipForm"].City.value = AddressArray[item].City;	document.forms["ShipForm"].StateName.value = AddressArray[item].StateName;	document.forms["ShipForm"].Zip.value = AddressArray[item].Zip;		// Loop through the state drop-down box on the form to determine	// which state should be selected.	for (i=0; i< document.forms["ShipForm"].StateName.length; i++) {		if (AddressArray[item].StateName == document.forms["ShipForm"].StateName[i].value) {			document.forms["ShipForm"].StateName[i].selected = true;			break;		}	}}// Control the select boxfunction populate(selObj){	var selPerson = selObj.options[selObj.selectedIndex].value;	SelectThis(selPerson);}function bringFocus() {	// Trick MacIE to refresh the form fields without visual glitches	document.forms["ShipForm"].FullName.focus();	document.forms["ShipForm"].CompanyName.focus();	// document.forms["ShipForm"].Email.focus();	document.forms["ShipForm"].Address1.focus();	document.forms["ShipForm"].Address2.focus();	document.forms["ShipForm"].City.focus();	document.forms["ShipForm"].StateName.focus();	document.forms["ShipForm"].Zip.focus();	document.forms["ShipForm"].Zip.blur();}function bringFocusSend() {	// Trick MacIE to refresh the form fields without visual glitches	document.forms["ShipForm"].FullNameSend.focus();	document.forms["ShipForm"].CompanyNameSend.focus();	// document.forms["ShipForm"].EmailSend.focus();	document.forms["ShipForm"].Address1Send.focus();	document.forms["ShipForm"].Address2Send.focus();	document.forms["ShipForm"].CitySend.focus();	document.forms["ShipForm"].StateNameSend.focus();	document.forms["ShipForm"].ZipSend.focus();	document.forms["ShipForm"].ZipSend.blur();}// Function to populate the formfunction SelectThisSend(item) {	// populate the address text fields	document.forms["ShipForm"].FullNameSend.value = AddressArray[item].FullName;	document.forms["ShipForm"].CompanyNameSend.value = AddressArray[item].CompanyName;	document.forms["ShipForm"].EmailSend.value = AddressArray[item].Email;	document.forms["ShipForm"].Address1Send.value = AddressArray[item].Address1;	document.forms["ShipForm"].Address2Send.value = AddressArray[item].Address2;	document.forms["ShipForm"].CitySend.value = AddressArray[item].City;	document.forms["ShipForm"].StateNameSend.value = AddressArray[item].StateName;	document.forms["ShipForm"].ZipSend.value = AddressArray[item].Zip;		// Loop through the state drop-down box on the form to determine	// which state should be selected.	for (i=0; i< document.forms["ShipForm"].StateNameSend.length; i++) {		if (AddressArray[item].StateName == document.forms["ShipForm"].StateNameSend[i].value) {			document.forms["ShipForm"].StateNameSend[i].selected = true;			break;		}	}}// Control the select boxfunction populateSend(selObj){	var selPerson = selObj.options[selObj.selectedIndex].value;	SelectThisSend(selPerson);}// Assembler for shipping infofunction Shipping(selectService, selectShipDate, selectPickDrop, weight1, value1, selectEnvelope1, weight2, value2, selectEnvelope2, weight3, value3, selectEnvelope3, selectBillTo, BillToOther) {	this.selectService = selectService;	this.selectShipDate = selectShipDate;	this.selectPickDrop = selectPickDrop;	this.weight1 = weight1;	this.value1 = value1;	this.selectEnvelope1 = selectEnvelope1;	this.weight2 = weight2;	this.value2 = value2;	this.selectEnvelope2 = selectEnvelope2;	this.weight3 = weight3;	this.value3 = value3;	this.selectEnvelope3 = selectEnvelope3;	this.selectBillTo = selectBillTo;	this.BillToOther = BillToOther;}// Create an array to hold all the address fieldsShippingArray = new Array();ShippingArray[0] = new Shipping("0", "0", "0", "", "", "0", "", "", "0", "", "", "0", "0", "");ShippingArray[5] = new Shipping("2", "1", "3", "2.0", "$150", "1", "2.0", "$150", "1", "", "", "0", "3", "555-99059-78");ShippingArray[6] = new Shipping("3", "2", "1", "3.0", "$50", "2", "", "", "0", "", "", "0", "2", "");ShippingArray[7] = new Shipping("4", "3", "2", "4.0", "$250", "3", "", "", "0", "", "", "0", "1", "");ShippingArray[8] = new Shipping("1", "1", "3", "5.0", "$70", "1", "", "", "0", "", "", "0", "3", "5555-89804-34");// Function to populate the formfunction SelectShipping(item) {	// populate the address text fields	document.forms["ShipForm"].selectService.value = ShippingArray[item].selectService;	document.forms["ShipForm"].selectShipDate.value = ShippingArray[item].selectShipDate;	document.forms["ShipForm"].selectPickDrop.value = ShippingArray[item].selectPickDrop;	document.forms["ShipForm"].weight1.value = ShippingArray[item].weight1;	document.forms["ShipForm"].value1.value = ShippingArray[item].value1;	document.forms["ShipForm"].selectEnvelope1.value = ShippingArray[item].selectEnvelope1;	document.forms["ShipForm"].weight2.value = ShippingArray[item].weight2;	document.forms["ShipForm"].value2.value = ShippingArray[item].value2;	document.forms["ShipForm"].selectEnvelope2.value = ShippingArray[item].selectEnvelope2;	document.forms["ShipForm"].weight3.value = ShippingArray[item].weight3;	document.forms["ShipForm"].value3.value = ShippingArray[item].value3;	document.forms["ShipForm"].selectEnvelope3.value = ShippingArray[item].selectEnvelope3;	document.forms["ShipForm"].selectBillTo.value = ShippingArray[item].selectBillTo;	document.forms["ShipForm"].BillToOther.value = ShippingArray[item].BillToOther;		// Loop through the service drop-down box on the form to determine	// which service should be selected.	for (i=0; i< document.forms["ShipForm"].selectService.length; i++) {		if (AddressArray[item].selectService == document.forms["ShipForm"].selectService[i].value) {			document.forms["ShipForm"].selectService[i].selected = true;			break;		}	}		// Loop through the ship date drop-down box on the form to determine	// which ship date should be selected.	for (i=0; i< document.forms["ShipForm"].selectShipDate.length; i++) {		if (AddressArray[item].selectShipDate == document.forms["ShipForm"].selectShipDate[i].value) {			document.forms["ShipForm"].selectShipDate[i].selected = true;			break;		}	}		// Loop through the pick up drop off drop-down box on the form to determine	// which pick up drop off date should be selected.	for (i=0; i< document.forms["ShipForm"].selectPickDrop.length; i++) {		if (AddressArray[item].selectPickDrop == document.forms["ShipForm"].selectPickDrop[i].value) {			document.forms["ShipForm"].selectPickDrop[i].selected = true;			break;		}	}		// Loop through the first envelope drop-down box on the form to determine	// which envelope type should be selected.	for (i=0; i< document.forms["ShipForm"].selectEnvelope1.length; i++) {		if (AddressArray[item].selectEnvelope1 == document.forms["ShipForm"].selectEnvelope1[i].value) {			document.forms["ShipForm"].selectEnvelope1[i].selected = true;			break;		}	}		// Loop through the second envelope drop-down box on the form to determine	// which envelope type should be selected.	for (i=0; i< document.forms["ShipForm"].selectEnvelope2.length; i++) {		if (AddressArray[item].selectEnvelope2 == document.forms["ShipForm"].selectEnvelope2[i].value) {			document.forms["ShipForm"].selectEnvelope2[i].selected = true;			break;		}	}		// Loop through the third envelope drop-down box on the form to determine	// which envelope type should be selected.	for (i=0; i< document.forms["ShipForm"].selectEnvelope3.length; i++) {		if (AddressArray[item].selectEnvelope3 == document.forms["ShipForm"].selectEnvelope3[i].value) {			document.forms["ShipForm"].selectEnvelope3[i].selected = true;			break;		}	}		// Loop through the bill to drop-down box on the form to determine	// which billing type should be selected.	for (i=0; i< document.forms["ShipForm"].selectBillTo.length; i++) {		if (AddressArray[item].selectBillTo == document.forms["ShipForm"].selectBillTo[i].value) {			document.forms["ShipForm"].selectBillTo[i].selected = true;			break;		}	}}// Control the select boxfunction populateShip(selObj){	var selPerson = selObj.options[selObj.selectedIndex].value;	SelectShipping(selPerson);}