function checkrequired(which) 
{
	if (document.ContactInfo.Name.value == '') {
		writeError(document.ContactInfo.Name,'This field is required');
		return false;
	}

	if (document.ContactInfo.Phone.value == '') {
		writeError(document.ContactInfo.Phone,'This field is required');
		return false;
	}
				
	if (document.ContactInfo.Email.value == '') {
		writeError(document.ContactInfo.Email,'This field is required');
		return false;
	}
				
	if (document.ContactInfo.coname.value == '') {
		writeError(document.ContactInfo.coname,'This field is required');
		return false;
	}
	
	if (document.ContactInfo.Email.value.indexOf('@') == -1)
	{
		writeError(document.ContactInfo.Email,'This is not a valid email address');
		return false;
	}			
	return true;
}

function writeError(obj,message) 
{
	if (obj.hasError) return;

	obj.className += ' error';
	obj.onchange = removeError;
	
	var sp = document.createElement('span');
	sp.className = 'error';
	sp.appendChild(document.createTextNode(message));
	obj.parentNode.appendChild(sp);
	obj.hasError = sp;
}

function removeError() {
	this.className = this.className.substring(0,this.className.lastIndexOf(' '));
	this.parentNode.removeChild(this.hasError);
	this.hasError = null;
	this.onchange = null;
}
