// ||||||||||||||||||||||||||||||||||||||||||||||||||
// Instructions for Configuration
// ||||||||||||||||||||||||||||||||||||||||||||||||||

/*
All elements are assumed required and will only be validated for an
empty value or defaultValue unless specified by the following properties.

isEmail = true;          // valid email address
isAlpha = true;          // A-Z a-z characters only
isNumeric = true;        // 0-9 characters only
isAlphaNumeric = true;   // A-Z a-z 0-9 characters only
isLength = number;       // must be exact length
isLengthBetween = array; // [lowNumber, highNumber] must be between lowNumber and highNumber
isPhoneNumber = true;    // valid US phone number. See "isPhoneNumber()" comments for the formatting rules
isDate = true;           // valid date. See "isDate()" comments for the formatting rules
isMatch = string;        // must match string
optional = true;         // element will not be validated
*/

// ||||||||||||||||||||||||||||||||||||||||||||||||||
// --------------------------------------------------
// ||||||||||||||||||||||||||||||||||||||||||||||||||

// configures form[0] or the first form in the document
function configureValidation1(){
    f = null;
	f = document.forms[0]; //the form must be set here
	f.cli_den.optional = true;
	f.cli_nom.isLengthBetween = [2,30];
	f.cli_cogn.isLengthBetween = [2,30];
	//f.cli_ind.isLengthBetween = [5,40];
	//f.cli_ind2.optional = true;
	f.cli_cap.isLength = [5];
	//f.cli_cit.isLengthBetween = [2,30];
	//f.cli_pro.isLength = [2];
	//f.cli_codnaz.optional = true;	
	//f.cli_piv.optional = true;
	f.cli_tel.isNumeric = true;
	f.cli_fax.optional = true;
	//f.cli_codsel.optional = true;
	f.cli_ema.isEmail = true;
	f.cli_uid.isMatch = f.cli_ema.value;

	//f.cli_uid = f.cli_ema.value;
	//f.cli_pwd.isLengthBetween = [8,20];
	//f.cli_pwd2.isMatch = f.cli_pwd.value;
	//f.cli_pwd.isLengthBetween = [6,20];

	//f.supporto.isLengthBetween = [2,30];
	f.durata.isNumeric = true;
	//f.formato.optional = true;
	//f.revisione.isLength = [5];
	f.datadisponibilita_Year_ID.optional = true;	
	//f.dataconsegna.isDate = true;
	//f.dataconsegna.optional = true;	
	//f.dataconsegna_Day_ID.optional = true;
	//f.dataconsegna_Day_IDm.optional = true;
	f.dataconsegna_Year_ID.optional = true;
	//f.dataconsegna_Previous_ID.optional = true;
	//f.dataconsegna_Current_ID.optional = true;
	//f.dataconsegna_Next_ID.optional = true;
	//f.dataconsegna_DayTable_ID.optional = true;

	//f.note.optional = true;
	f.note.isLengthBetween = [2,250];
	//f.oggetto.isLengthBetween = [4,256];
	//f.note.isLengthBetween = [4,300];

	//deal with radio and check buttons must be set according to page specifics
	var preCheck = true;
	//precheck = true //no radio or checkbox in form

	if(!f.checkbox0.checked){
	document.getElementById('checkbox0Lm').style.display = 'block';
	document.getElementById('checkbox0L').className = 'errorLabel';
	document.getElementById('checkbox0Lm').innerHTML = 'E\' necessario dare il consenso al trattamento dei dati';
	preCheck = false;
	}else{
	document.getElementById('checkbox0Lm').style.display = 'none';
	document.getElementById('checkbox0L').className = 'fixedLabel';
	document.getElementById('checkbox0Lm').innerHTML = '';
	};

	return validateForm(f,preCheck,'configureValidation1');
}
