// JavaScript Document

function validate() {
	var form;
	form = document.getElementById('ecard_form');
	if (form.to.value == ''){
		alert('Please fill out all fields');
		form.to.focus();
		return false;
	}
	if (form.email_to.value == ''){
		alert('Please fill out all fields');
		form.email_to.focus();
		return false;
	}
	if (form.from.value == ''){
		alert('Please fill out all fields');
		form.from.focus();
		return false;
	}
	if (form.email_from.value == ''){
		alert('Please fill out all fields');
		form.email_from.focus();
		return false;
	}
	if (form.message.value == ''){
		alert('Please fill out all fields');
		form.message.focus();
		return false;
	}
	var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < form.image.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (form.image[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please select an image")
return (false);
	
}
	
	return true;
	
}