
	// the goal of this function is to not capture the event of the text
	// being typed in but to just take any input and format it correctly.
	// for example if the user pastes in their phone number not formatted
	// reformat the number correctly.

	// numbers should result xxx-xxx-xxxx
	function format_phone(element)
	{
		phone =	element.value.toString();
		phone = phone.replace(/[^0-9]/g, '');
		
		area = phone.substr(0,3);
		pre = phone.substr(3,3);
		number = phone.substr(6,4);
		
		//debug(phone + "<br>" + phone.length + "<br>" + area + "-" + pre + "-" + number);
		
		if ( phone.length > 6 )
		{
			element.value = area + "-" + pre + "-" + number;
		}		
		else if ( phone.length > 3 )
		{
			element.value = area + "-" + pre;
		}
		else
		{
			element.value = area;
		}
	
		return true;
	}


	function debug(string)
	{
		document.getElementById("debug").innerHTML = string;
	}

	function getErrorString()
	{
		var error_string = "The following problems were found on this form.\n\n";
		
		for ( i = 0; i < error_msg.length; i++ )
		{
			error_string += error_msg[i] + "\n";
		}
		
		return error_string;
	}

	function check_length(field_name, title, length)
	{
		if ( parseInt(field_name.value.length) <= length )
		{
			field_name.style.backgroundColor = " ";
			
			return true;
		}
		else
		{
			error_msg.push("The " + title + " field can only be " + length + " long.");
			
			field_name.style.backgroundColor = "red";
			
			return false;
		}
	}

	function is_nonempty (field_name, title)
	{
		if ( field_name.value != "" )
		{
			field_name.style.backgroundColor = " ";
			
			return true;
		}
		else
		{
			error_msg.push("The " + title + " field cannot be empty.");
			
			field_name.style.backgroundColor = "red";
			
			return false;
		}
	}

	function is_propername()
	{
		return true;
	}

	function is_address (text)
	{
		return true;
	}

	// should handle three varietys: standard usmail, zip+four, canada
	function is_postalcode (text)
	{
		return true;
	}
						
	// horribly bad. just having an at sign present with pass the var through.
	function is_email (text)
	{
		return true;
	}

	function is_phone()
	{
		return true;
	}
	
	function is_mmyyyy (text)
	{
		
	}

	function is_alphanumeric (text)
	{
		return true;
	}
