function _is_required(obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
	 Ensures that incoming value is not blank
	*/
	if(obj.length == 0)
	{
		return false;
	}
	return true;
}

function _is_numeric(obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
		Ensures that incoming value is numeric
	*/
	if(isNaN(obj) || obj.length == 0)
	{
		return false;
	}
	return true;
}

function _is_range(low, high, obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
	 Ensures that incoming value is with in specific range
	*/
	if(obj < low || obj > high)
	{
		return false;
	}
	return true;
}

function _is_email(obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
	 	Ensures that incoming value is consistant with "user@domain.com"
	*/
	return /[A-Za-z0-9][A-Za-z0-9\-\.\_]*\@[A-Za-z0-9][A-Za-z0-9\-\.]*\.[A-Za-z]{2,3}$/.test(obj)
}

function _is_phone(obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
		Ensures that incoming value is consistant with "555-555-1234"
	*/
	return /[0-9]{3}\-[0-9]{3}-[0-9]{4}$/.test(obj)
}

function _is_multi_phone(obj1, obj2, obj3)
{
	/*
	Parameters:
		String, String, String
	Returns:
		boolean
	Purpose:
		takes the values of 3 text boxes and ensures that 
		they are consistant with a phone number.
		obj1 = area code
		obj2 = prefix
		obj3 = last 4 digits
	*/
	if(!_is_numeric(obj1))
	{
		return false;
	}
	
	if(!_is_numeric(obj2))
	{
		return false;
	}
	
	if(!_is_numeric(obj3))
	{
		return false;
	}
	
	if(!_is_range(111,999,obj1))
	{
		return false;
	}
	
	if(!_is_range(111,999,obj2))
	{
		return false;
	}
	
	if(!_is_range(0,9999,obj3))
	{
		return false;
	}
	
	return _is_phone(obj1 + "-" + obj2 + "-" + obj3);
}

function _is_ssn(obj)
{
	return /[0-9]{3}\-[0-9]{2}-[0-9]{4}$/.test(obj)
}

function _alpha_only(obj)
{
	/*
	Parameters:
		String
	Returns:
		boolean
	Purpose:
	 	Ensures that incoming value is alpha characters only
	*/
	return /[A-Za-z][A-Za-z]*$/.test(obj)
}

function _is_day(in_year, in_month, in_day)
{
	/* Ripped From Macromedia's Cold Fusion (CFFORM) */
	/*
	Parameters:
		int, int, int
	Returns:
		boolean
	Purpose:
	 	validates that number of days in month match the maximum 
		amount of days in that month
	*/
	maxDay = 31;

	if (in_month == 4 || in_month == 6 || in_month == 9 || in_month == 11)
	{
		maxDay = 30;
	}
	else
	{
		if (in_month == 2)
		{
			if(in_year % 4 > 0)
			{
				maxDay =28;
			}
			else
			{
				if(in_year % 100 == 0 && in_year % 400 > 0)
				{
					maxDay = 28;
				}
				else
				{
					maxDay = 29;
				}
			}
		}
	}
	return _is_range(1, maxDay, in_day);
}

function _is_date_multi(y, m, d)
{
	/*
	Parameters:
		string
	Returns:
		boolean
	Purpose:
	 	validates date from three inputs
	*/
	return _is_date(m + '/' + d + '/' + y);
}

function _is_date(obj)
{
	/* Ripped From Macromedia's Cold Fusion (CFFORM) */
	/*
	Parameters:
		string
	Returns:
		boolean
	Purpose:
	 	ensures value is a valid date:
			mm/dd/yyyy
			 mm/d/yyyy
			 m/dd/yyyy
			  m/d/yyyy
			  mm/dd/yy
			   mm/d/yy
			   m/dd/yy
			    m/d/yy
		  				
	*/
	dSplit = obj.indexOf('/');
	if(dSplit == -1 || dSplit == obj.length)
	{
		return false
	}

	dMonth = obj.substring(0, dSplit);
	if(dMonth == 0)
	{
		return false;
	}

	dSplit = obj.indexOf('/', (dSplit + 1));
	if(dSplit == -1 || (dSplit  + 1) == obj.length){
		return false;
	}
	
	dDay = obj.substring((dMonth.length + 1), dSplit);
	if(dDay.length == 0)
	{
		return false;
	}
	
	dYear = obj.substring(dSplit + 1);
	
	if(!_is_numeric(dMonth))
	{
		return false;
	}
	else
	{
		if(!_is_range(1, 12, dMonth))
		{
			return false;
		}
		else
		{
			if(!_is_numeric(dYear))
			{
				return false;
			}
			else
			{
				if(!_is_range(0, 9999, dYear))
				{
					return false;
				}
				else
				{
					if(!_is_numeric(dDay))
					{
						return false;
					}
					else
					{
						if(!_is_day(dYear, dMonth, dDay))
						{
							return false;
						}
						else
						{
							return true;
						}
					}
				}
			}
		}
	}
}