function synchCoverOptions(e, sender) {
	// Form.
	var f = e.form;
	// Form type.
	var str = e.name.substring(0, e.name.indexOf('_'));
	// Radio button group.
	eval ("var rad = f." + str + "_cover;");
	// Other controls.
	eval ("var dis = f." + str + "_discount_color;");
	eval ("var smn = f." + str + "_sunbrella_color_menu;");
	eval ("var sun = f." + str + "_sunbrella_color;");
	eval ("var rob = f." + str + "_robert_allen_color;");
	eval ("var cor = f." + str + "_add_cording;");
	// No cover.
	if (sender == 1) {
		// Clear all colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; sun.value = ''; rob.value = '';
		// Uncheck cording.
		cor.checked = false;

	// Discount cover.
	} else if (sender == 2) {
		// Clear other colors.
		smn.selectedIndex = 0; sun.value = ''; rob.value = '';
		// Synch inputs.
		dis.focus();
	    
	// Discount cover color.
	} else if (sender == 3) {
		// Clear other colors.
		smn.selectedIndex = 0; sun.value = ''; rob.value = '';
		// Synch inputs.
		rad[1].checked = true;

	// Sunbrella cover.
	} else if (sender == 4) {
		// Clear other colors.
		dis.selectedIndex = 0; sun.value = ''; rob.value = '';
		// Synch inputs.
		smn.focus();
	    
	// Sunbrella cover color menu.
	} else if (sender == 5) {
		// Clear other colors.
		dis.selectedIndex = 0; sun.value = ''; rob.value = '';
		// Synch inputs.
		rad[2].checked = true;

	// Sunbrella cover.
	} else if (sender == 6) {
		// Clear other colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; rob.value = '';
		// Synch inputs.
		sun.focus(); sun.select();

	// Sunbrella cover color.
	} else if (sender == 7) {
		// Clear other colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; rob.value = '';
		// Synch inputs.
		rad[3].checked = true;

	// Robert Allen cover.
	} else if (sender == 8) {
		// Clear other colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; sun.value = '';
		// Synch inputs.
		rob.focus(); rob.select();

	// Robert Allen cover color.
	} else if (sender == 9) {
		// Clear other colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; sun.value = '';
		// Synch inputs.
		rad[4].checked = true;

	// Customer's own cover.
	} else if (sender == 10) {
		// Clear all colors.
		dis.selectedIndex = 0; smn.selectedIndex = 0; sun.value = ''; rob.value = '';

	// Cording checked but no cover selected.
	} else if ((sender == 11) && (e.checked == true) && (rad[0].checked == true)) {
		alert ('If you want cording for this cover, you must choose a cover type.' + "\n" + '(Currently, the "no cover" option is selected.)');
		e.checked = false;
	}
	return;
}

function validateCovers(f) {
	// Error message.
	var msg = '';
	// Form controls.
	var rad = f.mattress_cover;
	var dis = f.mattress_discount_color;
	var smn = f.mattress_sunbrella_color_menu;
	var sun = f.mattress_sunbrella_color;
	var rob = f.mattress_robert_allen_color;
	// Discount color must be selected.
	if ((rad[1].checked == true) && (dis.selectedIndex < 1)) {
		msg = 'Please choose a discount fabric color from the list.';
		dis.focus();
	// Sunbrella color must be selected.
	} else if ((rad[2].checked == true) && (smn.selectedIndex < 1)) {
		msg = 'Please choose a Sunbrella fabric color from the list.';
		smn.focus();
	// Sunbrella color must be entered.
	} else if ((rad[3].checked == true) && isBlank(sun.value)) {
		msg = 'Please enter the name and number of the Sunbrella fabric you would like.';
		sun.focus(); sun.select();
	// Robert Allen color must be entered.
	} else if ((rad[4].checked == true) && isBlank(rob.value)) {
		msg = 'Please enter the pattern and color name of the Robert Allen fabric you would like.';
		rob.focus(); rob.select();
	}
	// Problem with form entries.
	if (msg.length > 0) {
		alert(msg);
		return false;
	}
    return true;
}
