function FormValidator(name)
{	
	// example properties
	this.entity = $(name);
	this.name = name;
	
	
	if ($(name))
	{
		$(name).onsubmit = function(e) {
			return checkForm(e);
		}
	}
	
	
	/* example function */
	
	function getName(){
	   return this.name;
	}
	 this.getName = getName;
	 
	function setName(name)
	{
		this.name = name
	}
	this.setName = setName;
	
	function getType()
	{
		return typeof this.entity;
	}
	this.getType = getType;
	
	
	function clearField()
	{		
		if (this.style)
		{
			if (this.value == 'This is required')
			{
				this.value = '';
				this.style.color = '#000';
			}
		}
		if (window.event.srcElement)
		{
			var thisObj = window.event.srcElement;
			if (thisObj.value == 'This is required')
			{
				thisObj.value = '';
				thisObj.style.color = '#000';	
			}
		}		
	}
	this.clearField = clearField;
			
	function checkForm(e)
	{			
		// e is the Event object in javascript
		//	initial info gathered from:
		//		http://www.quirksmode.org/js/events_properties.html
		var targetObject;
		if (!e)
		{
			var e = window.event;
		}
		if (e.target)
		{
			targetObject = e.target;
		}
		else if (e.srcElement)
		{
			targetObject = e.srcElement;
		}
		if (targetObject.nodeType == 3) // defeat Safari bug
		{
			targetObject = targetObject.parentNode;
		}			
		
		var allRequired = targetObject.getElementsByClassName('required');
		var sendForm = true;
		
		for (var i = 0; i<allRequired.length; i++)
		{
			if (((allRequired[i]).value.strip()).length == 0 )
			{
				var errorBox = $(allRequired[i].id);
				errorBox.value = "This is required";
				errorBox.style.color = "Red";
				addEvent(errorBox, 'focus', clearField);
				sendForm = false;
			}
		}
		return sendForm;
	}
	this.checkForm = checkForm;

}