// Show or hide mullion offset input box based on the value of mullion option
function updateMullion(mullion) {
	if(mullion.value == 'Offset Mullion') {
		$('mullionOffset').show();	
	} else {
		$('mullionOffset').hide();
	}
}



// Select color
function selectColor(id) {
	$('ProductColor').value = id;	
}


// Process ajax updatePrice response
function updatePrice(request) {
	
	// Get the price
	var price = request.responseText;
	// Set form input with price
	$('ProductPrice').value = price;
	// Calculate the total price
	var total = price * $('ProductQuantity').value;
	
	$('total').innerHTML = total.toFixed(2);
}

// Process ajax updateHeight response
function updateHeight(request) {
	var height = request.responseText;
	$('ProductHeight1').replace(height);
}

function checkForm() {
	
	if(!$('ProductQuantity').value) {
		alert('Please select a quantity.');
		return false;
	}
	
	if(!$('ProductColor').value) {
		alert('Please select a color.');
		return false;
	}
	
	if($('ProductMullion').value == 'Offset Mullion') {
		if(!$('ProductMullionOption1').value) {
			alert('Please enter a mullion offset.');
			return false;
		}
	}
	
	return true;
	
}
