$(document).ready(function() {
	if (document.forms['confirmOrderFrm']) {
		window.sizesFields = document.forms['confirmOrderFrm'].elements['sizeOptions[]'];
		window.printFields = document.forms['confirmOrderFrm'].elements['printOptions[]'];
		window.quantityFields = document.forms['confirmOrderFrm'].elements['quantityOptions[]'];
		window.cdFields = document.forms['confirmOrderFrm'].elements['cdOptions[]'];
	}

	/*$("#priceListLink").click(function() {
		$("#priceList").toggle("normal");
		$(this).text($(this).text() == "Show print sizes and prices" ? "Hide print sizes and prices" : "Show print sizes and prices");
		return false;
	});*/

	$("a.selectAll").click(function() {
		var checkboxField = document.forms['addOrderFrm'].elements['order[]'];

		for (x = 0; x < checkboxField.length; x++) {
			checkboxField[x].checked = true;
		}

		return false;
	});

	$("a.deselectAll").click(function() {
		var checkboxField = document.forms['addOrderFrm'].elements['order[]'];

		for (x = 0; x < checkboxField.length; x++) {
			checkboxField[x].checked = false;
		}

		return false;
	});
});

function setOptions(chosen, changer) {
	//var previousSelected = changer.options[changer.selectedIndex].value;
	changer.options.length = 0;

	if ((chosen == "SG") || (chosen == "M")) {
		changer.options[changer.options.length] = new Option('-','');
		changer.options[changer.options.length] = new Option('A6', 'A6');
		changer.options[changer.options.length] = new Option('A5', 'A5');
		changer.options[changer.options.length] = new Option('A4', 'A4');
		changer.options[changer.options.length] = new Option('A3', 'A3');
		changer.options[changer.options.length] = new Option('A2', 'A2');
		changer.options[changer.options.length] = new Option('P', 'P');
	}
	else {
		changer.options[changer.options.length] = new Option('-','');
		changer.options[changer.options.length] = new Option('A4', 'A4');
		changer.options[changer.options.length] = new Option('A3', 'A3');
		changer.options[changer.options.length] = new Option('A2', 'A2');
		changer.options[changer.options.length] = new Option('P', 'P');
	}

	//document.getElementById(changer).options[this.selectedIndex].value = previousSelected;
}