/*
$Id: func.custom.js,v 1.0 2009/09/24 19:48:00 phoenix Exp $
*/

function func_custom_swatch_onClick(classid, optionid) {

	var selector = document.getElementById('po' + classid);

	for (i = 0; i < selector.options.length; i++) {

		if (selector.options[i].value == optionid) {

			selector.options[i].selected = true;
			selector.selectedIndex = i;

		} else {

			selector.options[i].selected = false;
		}
	}

	/* Workaround for X-Cart bug */
	availObj = document.getElementById(quantity_input_box_enabled ? 'product_avail_input' : 'product_avail');

	if (!availObj) {
		
		new_elem = document.createElement("INPUT");
		new_elem.type = "HIDDEN";
		new_elem.id = quantity_input_box_enabled ? 'product_avail_input' : 'product_avail';
		$('.custom-swatch-container').append(new_elem);
	}

	check_options();
}

