
<!--

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 ("E-mail has not been inserted correctly");
		return true;
	}
}



function  _it_form(_CF_this)
{	
    if	(!_CF_hasValue(_CF_this.Nome, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Nome,	_CF_this.Nome.value, "Per favore inserisci il tuo nome"))
			return false;

    if	(!_CF_hasValue(_CF_this.Cognome, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Cognome, _CF_this.Cognome.value,	"Per favore inserisci il tuo cognome"))
			return false;
	
    if	(!_CF_hasValue(_CF_this.Indirizzo, "TEXT"	))
		if  (!_CF_onError(_CF_this, _CF_this.Indirizzo, _CF_this.Indirizzo.value, "Per favore inserisci il tuo indirizzo"))
			return false;
	
	if	(!_CF_hasValue(_CF_this.CAP, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.CAP, _CF_this.CAP.value, "Per favore inserisci il tuo C.A.P."))
			return false;
			

    if	(!_CF_hasValue(_CF_this.Paese, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Paese, _CF_this.Paese.value, "Per favore inserisci il tuo paese"))
			return false;
			
	if	(!_CF_hasValue(_CF_this.Telefono, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Telefono, _CF_this.Telefono.value, "Per favore inserisci il tuo numero di telefono"))
			return false;
				
    if	(!_CF_hasValue(_CF_this.EMail, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.EMail, _CF_this.EMail.value, "Per favore inserisci la tua E-mail"))
			return false;
	if(reg_espr_Email(_CF_this.EMail))
			return false;
	
	if	(!_CF_hasValue(_CF_this.Interesse, "TEXT" ))
			if  (!_CF_onError(_CF_this, _CF_this.Interesse, _CF_this.Interesse.value, "Per favore inserisci il tuo Interesse"))
				return false;		
    return true;
}

function  OLD_en_form(_CF_this)
{	
    if	(!_CF_hasValue(_CF_this.First_Name, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.First_Name,	_CF_this.First_Name.value, "Please enter your first name"))
			return false;

    if	(!_CF_hasValue(_CF_this.Last_Name, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Last_Name, _CF_this.Last_Name.value,	"Please enter your last name"))
			return false;
	
    if	(!_CF_hasValue(_CF_this.How_many_persons, "TEXT"	))
		if  (!_CF_onError(_CF_this, _CF_this.How_many_persons, _CF_this.How_many_persons.value, "Please enter how many persons"))
			return false;
	
	if	(!_CF_hasValue(_CF_this.Arrival_Date, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Arrival_Date, _CF_this.Arrival_Date.value, "Please enter Arrival Date"))
			return false;
			
	if	(!_CF_hasValue(_CF_this.Departure_Date, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Departure_Date, _CF_this.Departure_Date.value,	"Please enter Departure Date"))
			return false;   

    if	(!_CF_hasValue(_CF_this.EMail, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.EMail, _CF_this.EMail.value, "Please enter your E-mail"))
			return false;
	if(reg_espr_Email(_CF_this.EMail))
			return false;
		
    return true;
}

function  _en_form(_CF_this)
{	
    if	(!_CF_hasValue(_CF_this.Name, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Name,	_CF_this.Name.value, "Please enter your first name"))
			return false;

    if	(!_CF_hasValue(_CF_this.Surname, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Surname, _CF_this.Surname.value,	"Please enter your last name"))
			return false;
	
    if	(!_CF_hasValue(_CF_this.How_many_people, "TEXT"	))
		if  (!_CF_onError(_CF_this, _CF_this.How_many_people, _CF_this.How_many_people.value, "Please enter how many people"))
			return false;
	
	if	(!_CF_hasValue(_CF_this.Check_in, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Check_in, _CF_this.Check_in.value, "Please enter Check in"))
			return false;
			
	if	(!_CF_hasValue(_CF_this.Check_out, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.Check_out, _CF_this.Check_out.value,	"Please enter Check out"))
			return false;   

    if	(!_CF_hasValue(_CF_this.EMail, "TEXT" ))
		if  (!_CF_onError(_CF_this, _CF_this.EMail, _CF_this.EMail.value, "Please enter your E-mail"))
			return false;
	if(reg_espr_Email(_CF_this.EMail))
			return false;
		
    return true;
}
//-->


