function emailValid(emailAdd)
{
var at_symb = "&#64;"
var dot_symb = "&#46;"
var symb = "OK"
	//alert(emailAdd)
	if (emailAdd == "noemail")
	{
		return symb
	}
	
	if (emailAdd.indexOf('@')==-1)
	{
		symb = at_symb
		return symb
	}
	
	if (emailAdd.indexOf('.')==-1)
	{
		symb = dot_symb
		return symb
	}
	
	return symb
}

function validateForm3()
{
	thisForm = document.forms['form_ordering_3'];
	
	if (thisForm.cust_name.value =="")
	{
		alert('Please enter your name.')
		thisForm.cust_name.focus()
		return false
	}
	
	var payval = getCheckedValue(thisForm.elements['payments'])
	
	if (payval == 'pay_pay_pal' && thisForm.cust_email.value =="")
	{
		alert('Please enter your email address.')
		thisForm.cust_email.focus()
		return false
	}
	
	if(thisForm.cust_email.value !="")
	{
		validEmail = emailValid(thisForm.cust_email.value);

		if (validEmail != "OK")
		{
			alert('Please enter a valid email address.');
			thisForm.cust_email.focus()
			return false
		}
	}
	
	if (thisForm.cust_phone.value =="")
	{
		alert('Please enter your telephone number.')
		thisForm.cust_phone.focus()
		return false
	}
	
	
	if (thisForm.cust_address.value =="")
	{
		alert('Please enter your address.')
		thisForm.cust_address.focus()
		return false
	}
	
	
	
	if (thisForm.tandc.checked == false) 
	{
		alert('You must agree to the terms and conditions to place an order.\n Tick the box to proceed.')
		thisForm.tandc.focus();
		return false
	}
}

