var totalPrice = 1;
function updateTotalPrice() {
	if ('undefined' == typeof productPrice) {
		var el = document.getElementById('productPrice');
		productPrice = el.innerHTML;
	}
	if ('undefined' == typeof productQuantity) productQuantity = document.getElementById('productQuantity');
	totalPrice = productQuantity.value * productPrice;
	if (isNaN(totalPrice)) totalPrice = 0;
	totalPrice = totalPrice.toFixed(2);
	var el = document.getElementById('totalPrice');
	el.innerHTML = totalPrice;
}

function checkProductSubmit() {
	if (totalPrice > 0) {
		return true;
	} else {
		alert('Please specify a valid quantity.');
		return false;
	}
}

function formSubmit() {
	if (checkProductSubmit()) {
		document.forms['productForm'].submit();
	}
}
