	function toggleCopy() {
		var cbx = document.getElementById('cbx_copyinfo');
		var theform = document.getElementById('fotcaform');
		var chkd = theform.copychecked;
		
		if (chkd.value == 1) {
			chkd.value = 0;
			cbx.focus();
			return true;
		}
		else {
			theform.contact_title.value = theform.cc_title.value;
			theform.contact_name_REQUIRED.value = theform.cc_name_REQUIRED.value;
			theform.contact_address_REQUIRED.value = theform.cc_address_REQUIRED.value;
			theform.contact_address2.value = theform.cc_address2.value;
			theform.contact_city_REQUIRED.value = theform.cc_city_REQUIRED.value;
			theform.contact_state_REQUIRED.value = theform.cc_state_REQUIRED.value;
			theform.contact_zipcode_REQUIRED.value = theform.cc_zipcode_REQUIRED.value;
			theform.contact_phone.value = theform.cc_phone.value;
			theform.contact_email_REQUIRED.value = theform.cc_email_REQUIRED.value;			
			chkd.value = 1;
			cbx.checked = true;

			return true;
		}
	}
	
	function validateTextField (thefield) {
		var theform = document.getElementById('fotcaform');
		var fieldname = "cc_" + thefield;
		var formfield = theform[fieldname];

		if (formfield.value == "") {
			alert(formfield.name + " is required");
			formfield.focus();
			return false;
		}
	}
	
	function validateForm(formid) {

		var theform = document.getElementById(formid);
		var numfields = theform.elements.length;
		var idx = 0;
		var errors = "";
		var retval = true;
		
		for (idx=0; idx < numfields; idx++) {
			var ndx = 0;
			var required = false;
			var field = "";
			for (ndx = 0; ndx < theform.elements[idx].attributes.length; ndx++) {
				field = theform.elements[idx].attributes[ndx];
				if ((field.name == 'b2f_req') && (field.value == 'true')) required = true;
			}
			if (! required) continue;
			switch (theform.elements[idx].type) {
				case "textarea":
					if (tinyMCE.activeEditor.getContent() == "") {
						errors = errors + "\n" + " "  + theform.elements[idx].name + " is required";
						if (errorfield && errorfield == '') errorfield = theform.elements[idx].name;
						retval = false;
					}
					break;
				case "text":
					if (theform.elements[idx].value == "") {
						errors = errors + "\n" + " "  + theform.elements[idx].name + " is required";
						if (errorfield && errorfield == '') errorfield = theform.elements[idx].name;
						retval = false;
					}
					break;
				case "select-one":
					if (theform.elements[idx].selectedIndex ==  0) {
						errors = errors + "\n" + " " + theform.elements[idx].name + " is required";
						if (errorfield && errorfield == '') errorfield = theform.elements[idx].name;
						retval = false;
					}
					break;
				default:
					break;
			}
		}

		if (retval) {
			theform.submit();
			return retval;
		}
		else {
			alert ("Errors are present on the form.\n" + errors);
			return retval;
		}
	}

