theForm = document.getElementById('frmSell');
theForm.onsubmit = function()
{
	list = theForm.getElementsByTagName('input');
	a = '';
	
	for (i=0;i<list.length;i++)
	{
		control = list[i];
		
		if (control.value == 'required')
		{
			alert('Please fill in all required fields.');
			control.focus();
			control.select();
			control.style.color = 'red';
			return false;
		}
		
		req = control.getAttribute("required");
		if ( (req == 'yes') && (control.value == '') )
		{
			alert('Please fill in all required fields.');
			control.value = 'required';
			control.focus();
			control.select();
			return false;
		}
	}
		//////////////////////////////////////////
		// test email address format
		obj = document.getElementById('email');
		var reg = /.+@.*\..+/;  //match email address
		var bool = reg.test(obj.value);
		if (! bool)
		{
			alert('The email address is not correct');
			obj.focus();
			obj.select();
			obj.style.color = 'red';
			return false;
		}
}

