
<!--

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=1; 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_checkinteger(object_value)
    {
    //Returns true if value is a number	or is NULL
    //otherwise	returns	false

    if (object_value.length == 0)
	return true;

    //Returns true if value is an integer defined as
    //	 having	an optional leading + or -.
    //	 otherwise containing only the characters 0-9.
	var decimal_format = ".";
	var check_char;

    //The first	character can be + -  blank or a digit.
	check_char = object_value.indexOf(decimal_format)
    //Was it a decimal?
    if (check_char < 1)
	return _CF_checknumber(object_value);
    else
	return false;
    }



function _CF_checknumber(object_value)
    {
    //Returns true if value is a number	or is NULL
    //otherwise	returns	false

    if (object_value.length == 0)
	return true;

    //Returns true if value is a number	defined	as
    //	 having	an optional leading + or -.
    //	 having	at most	1 decimal point.
    //	 otherwise containing only the characters 0-9.
	var start_format = " .+-0123456789";
	var number_format = " .0123456789";
	var check_char;
	var decimal = false;
	var trailing_blank = false;
	var digits = false;

    //The first	character can be + - .	blank or a digit.
	check_char = start_format.indexOf(object_value.charAt(0))
    //Was it a decimal?
	if (check_char == 1)
	    decimal = true;
	else if	(check_char < 1)
		return false;

	//Remaining characters can be only . or	a digit, but only one decimal.
	for (var i = 1;	i < object_value.length; i++)
	{
		check_char = number_format.indexOf(object_value.charAt(i))
		if (check_char < 0)
			return false;
		else if	(check_char == 1)
		{
			if (decimal)		// Second decimal.
				return false;
			else
				decimal	= true;
		}
		else if	(check_char == 0)
		{
			if (decimal || digits)
				trailing_blank = true;
	// ignore leading blanks

		}
		else if	(trailing_blank)
			return false;
		else
			digits = true;
	}
    //All tests	passed,	so...
    return true
    }



function _CF_checkcreditcard(object_value)
    {
	var white_space	= " -";
	var creditcard_string="";
	var check_char;


    if (object_value.length == 0)
	return true;

	// squish out the white	space
	for (var i = 0;	i < object_value.length; i++)
	{
		check_char = white_space.indexOf(object_value.charAt(i))
		if (check_char < 0)
			creditcard_string += object_value.substring(i, (i + 1));
	}

	// if all white	space return error
    if (creditcard_string.length == 0)
	return false;


	// make	sure number is a valid integer
	if (creditcard_string.charAt(0)	== "+")
	return false;

	if (!_CF_checkinteger(creditcard_string))
		return false;

    // now check mod10

	var doubledigit	= creditcard_string.length % 2 == 1 ? false : true;
	var checkdigit = 0;
	var tempdigit;

	for (var i = 0;	i < creditcard_string.length; i++)
	{
		tempdigit = eval(creditcard_string.charAt(i))

		if (doubledigit)
		{
			tempdigit *= 2;
			checkdigit += (tempdigit % 10);

			if ((tempdigit / 10) >=	1.0)
			{
				checkdigit++;
			}

			doubledigit = false;
		}
		else
		{
			checkdigit += tempdigit;
			doubledigit = true;
		}
	}
	return (checkdigit % 10) == 0 ?	true : false;

    }


function MailYN()
{
// Y = customer want to receive mail
// N = customer don't want to receive mail


    if (Document.CFForm_1.newsletter.checked) {
    	Document.CFForm_1.informations.text = 'Y';
    }
    else {
    	Document.CFForm_1.informations.text = 'N';
    }
 	alert(Document.CFForm_1.informations.text);
    //************************
}


function  reg_espr_UserPass(obj)
{
	var re = /[a-zA-Z0-9-_.]+$/;
	if (!re.test( obj.value)) {
		alert (obj.name + " has not been inserted correctly\r\nonly alphanumeric characters are allowed (0-9, az, AZ and _)");
		return true;
	}
}
function  reg_espr_Email(obj)
{
	var re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	if (!re.test( obj.value)) {
		alert (obj.name + " has not been inserted correctly");
		return true;
	}
}

	
function  _CF_checkCFUpdate(_CF_this)
{
	if	(!_CF_hasValue(_CF_this.UpdateIN, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.UpdateIN,	_CF_this.UpdateIN.value, "Please enter Update"))
			return false;

    if	(!_CF_hasValue(_CF_this.Note, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Note, _CF_this.Note.value,	"Please enter Why"))
			return false;
    
    return true;
}



function  _CF_checkCFForm(_CF_this)
{
	if	(!_CF_hasValue(_CF_this.FirstName, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.FirstName,	_CF_this.FirstName.value, "Please enter your first name"))
			return false;

    if	(!_CF_hasValue(_CF_this.LastName, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.LastName, _CF_this.LastName.value,	"Please enter your last name"))
			return false;

    if	(!_CF_hasValue(_CF_this.Address, "TEXT"	))
		if  (!_CF_onError(_CF_this, _CF_this.Address, _CF_this.Address.value, "Please enter your address"))
			return false;

	if	(!_CF_hasValue(_CF_this.City, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.City, _CF_this.City.value,	"Please enter your city"))
			return false;
   
    if	(!_CF_hasValue(_CF_this.PostalCode, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.PostalCode, _CF_this.PostalCode.value, "Please enter your postal code"))
			return false;

    if	(!_CF_hasValue(_CF_this.Country, "SELECT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Country, _CF_this.Country.value, "Please enter your country"))
			return false;

    if	(!_CF_hasValue(_CF_this.Email, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Email, _CF_this.Email.value, "Please enter your email"))
			return false;
	if(reg_espr_Email(_CF_this.Email))
			return false;
			
    return true;
}



function  _CF_checkCFForgot(_CF_this)
{
	
    if	(!_CF_hasValue(_CF_this.FirstName, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.FirstName,	_CF_this.FirstName.value, "Please enter your first name"))
			return false;
	
    if	(!_CF_hasValue(_CF_this.LastName, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.LastName, _CF_this.LastName.value,	"Please enter your last name"))
			return false;
	
	if	(!_CF_hasValue(_CF_this.Email, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Email, _CF_this.Email.value, "Please enter your email"))
			return false;
	if(reg_espr_Email(_CF_this.Email))
			return false;

    return true;
}

function  _CF_checkLogIn(_CF_this)
{
	if	(!_CF_hasValue(_CF_this.User, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.User,	_CF_this.User.value, "Please enter Username"))
			return false;
	if 	( _CF_this.User.value.length < 4) {
		alert('User min 4 chars'); 
		return false;
		}
	if(reg_espr_UserPass(_CF_this.User))
		return false;
	
	if	(!_CF_hasValue(_CF_this.Pass, "PASSWORD" ))
		if  (!_CF_onError(_CF_this, _CF_this.Pass,	_CF_this.Pass.value, "Please enter Password"))
			return false;
	if 	( _CF_this.Pass.value.length < 5) {
		alert('Password min 5 chars'); 
		return false;
		}
	if(reg_espr_UserPass(_CF_this.Pass))
		return false;
		
	 return true;
}	
//-->

