
function f_update(qty)
{
	// VALIDATION 1 - DECIMAL POINT
	if (qty == '.')
	{
		document.getElementById("total").innerHTML = '';
		document.getElementById("total_error").innerHTML = 'You shouldn\'t need to use a decimal point. Order whole numbers only.';
	}

	// VALIDATION 1 - MINUS SIGN
	else if (qty == '-')
	{
		document.getElementById("total").innerHTML = '';
		document.getElementById("total_error").innerHTML = 'Please do not order negative quantities. That would be very silly.';
	}

	// VALIDATION 1 - qty IS NOT A NUMBER OR IS LESS THAN ZERO
	else if (isNaN(qty) || qty < 0)
	{
		document.getElementById("total").innerHTML = '';
		document.getElementById("total_error").innerHTML = "'" + qty + "' is not valid. Please enter a number between 1 and 999.";
	}

	// VALIDATION 1 - qty IS NOT A WHOLE NUMBER
	else if (qty%1 != 0)
	{
		document.getElementById("total").innerHTML = '';
		document.getElementById("total_error").innerHTML = "Don\'t be silly. Please enter a whole number between 1 and 999.";
	}

	// VALIDATION OK
	else
	{
		var total_price = qty * 2.5;
		if (total_price % 1 == 0)
		{
			total_price = '&pound;' + total_price + '.00';
		}
		else if (total_price % 1 == 0.5)
		{
			total_price = '&pound;' + total_price + '0';
		}
		document.getElementById("total").innerHTML = 'Total price: ' + total_price;
		document.getElementById("total_error").innerHTML = '';
	}
}
