function validateForm()
{
	total    = 0;
	products = '';
	cbs = document.getElementsByTagName('input');
	for (i in cbs)
	{
		if (cbs[i].checked == 1 && cbs[i].getAttribute('class') == 'pp')
		{
				data = cbs[i].getAttribute('rel').split(';');
				
				// Has amount?
				switch(data[0])
				{
					case 'y':
						total += parseFloat(data[1]);
					break;
					
					case 'n':
						amount = document.getElementById(data[1]);
						if (amount.value == '')
						{
							alert('Please enter an amount first');
							return false;
						} else {
							total += parseFloat(amount.value);
						}
					break;
				}
				products += data[2] + '. ';
		}
	}
	if (!(total > 0))
	{
		alert('Please select an item first');
		return false;
	} else {
		document.getElementById('id_amount').value    = total;
		document.getElementById('id_item_name').value = products;
		return true;
	}
}
