
	function submitForm()
	{
		
		var mainform = document.forms.signatureRange;
		
		// check box size combo item selected
		if (mainform.boxSize.selectedIndex == 0) {
			alert('Please select which size chocolate box you require.'); 
			mainform.boxSize.focus();
			return false;
			}
		
		// check box radio is selected
		var boxSelected = false;
		for (var i=0; i < mainform.box.length; i++) {
			if((mainform.box[i].checked)) boxSelected = true;
		}
		if (!boxSelected) {
			alert('Select your box.'); 
			mainform.box[0].focus();
			return false;
			}
		
		// check the correct amount of chocs have been input
		var signatureChocolates = [
			'coeurFraise',
			'framboise',
			'banane',
			'abricot',
			'fruitPassion',
			'mange',
			'cerise',
			'citronVert',
			'sesame',
			'gianduja',
			'amandesCoco',
			'marzipan',
			'spekulaas',
			'gemmer',
			'rissieLemoen',
			'soutKaramel',
			'vanielje',
			'koffieKardamom',
			'laventel',
			'roos',
			'jasmyn',
			'earlGrayTea',
			'ment',
			'rooibos',
			'lemongrass'
		];
		
		var numChocolates = signatureChocolates.length;
		var totalQty = 0;
		for (var i=0; i < numChocolates; i++) {
			totalQty += parseInt(mainform[signatureChocolates[i]].value);
		}
		
		if (totalQty < parseInt(mainform.boxSize[mainform.boxSize.selectedIndex].value))
		{
			alert('Your chosen box fits ' + mainform.boxSize[mainform.boxSize.selectedIndex].value + ' but you have only added ' + totalQty + ' chocolates so far.'); 
			mainform.box[0].focus();
			return false;
		}
		else if (totalQty > parseInt(mainform.boxSize[mainform.boxSize.selectedIndex].value))
		{
			alert('Your chosen box fits ' + mainform.boxSize[mainform.boxSize.selectedIndex].value + ' but you have added ' + totalQty + ' chocolates.'); 
			mainform.box[0].focus();
			return false;
		}
		
		// all checks passed
		return true;
	}
	
