/*
 * This is used on both of the frame (head-tube) configuration pages.
 * Because the values of the listed options are not unique, we need something that is.
 */

function selectOptionByName(optionName, selectId) {
	selector = selectId + ' option';
	jQuery(selector).each(function(i, selected) {
		currentOption = jQuery(selected).text();
		currentOption = trim(currentOption);
		if (currentOption == optionName) {
			selector1 = selector +':eq('+i+')';
			selector2 = selector +'_predefined';
			jQuery(selector1).attr('selected', 'selected');
			jQuery(selector2).attr('checked', true);
			return;
		} 
	});
}

function getOptionName(value) {
	var startOfOptionName = value.indexOf('(');
	var endOfOptionName = value.indexOf(')');
	return value.substring(startOfOptionName, endOfOptionName);
}
