<!-- 
function chkSearch(data){
var searchForm = eval(data);

	if (searchForm.search.value != "") {
		if(searchForm.cerca[0].checked)
		{
			searchForm.SearchKind.value = "catalogo";
		}
		else
		{
			searchForm.SearchKind.value = "sito";
		}
		searchForm.action = '/electa/wrapper.jsp';
		searchForm.submit();	
		return true;
	}
	else {
		alert('Inserire una parola chiave per la ricerca');
		return false;
	}
}



// Function checkTxtBox
//
// Arguments:
//    data = name of the form (e.g. document.modulo)
//    fieldName = name of the field (used in the function)
//    inputType = (e.g. num, alpha, email, cf, cfpi)
//    alertMsg = name of the field (displayed in the alert box)
//    required = the field must be empty (true or false)



function checkTxtBox(data, fieldName, inputType, alertMsg, required) {

 
   var thisField = eval(data + "[fieldName]");
   var fieldValue = thisField.value;

   var emailReqStr = ".@";
   var domReqStr = ".";

   var numStr = "0123456789";
   var alphaStr = " 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàèéìòùÀÈÉÌÒÙ-+*/!&()='^@.,<>";
   var cfStr = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

   if (required) {
      if (fieldValue == "") {
         alert("Per favore, completare il campo '" + alertMsg + "' .");
         thisField.focus(); return false;
      }
   }
 if      (inputType == "email") var requiredChars = emailReqStr;
   else if (inputType == "dom")   var requiredChars = domReqStr;
   else if (inputType == "num")   var allowedChars  = numStr;
   else if (inputType == "alpha") var allowedChars  = alphaStr;
   
   if (allowedChars) {
   	for (var i=0; i < fieldValue.length; i++) {
   		thisChar = fieldValue.substring(i, i+1);
   		if (allowedChars.indexOf(thisChar) == -1) {
            alert("Per favore, controllare il campo'" + alertMsg + "'.  Il formato non è corretto.");
            thisField.focus(); return false;
   		}
   	}
   
   }

   if (requiredChars && (fieldValue.length > 0)) {
   	for (var i=0; i < requiredChars.length; i++) {
   		thisChar = requiredChars.substring(i, i+1);
   		if (fieldValue.indexOf(thisChar) == -1) {
            alert("Per favore, controllare il campo '" + alertMsg + "'.  Il formato non è corretto.");
            thisField.focus(); return false;
   		}
   	}
	 if (inputType == "email"){
		var pointpos = fieldValue.indexOf(".");
		var rightofpoint = fieldValue.substring(pointpos+1,fieldValue.length);
		if (rightofpoint.length < 2) {
			alert ("Per favore, controllare il dominio nel campo '"+alertMsg+"'");
			thisField.focus(); return false;
			}
		 }
    }
   
   return true;
}


// Function checkRadio
//
// Arguments:
//    data = name of the form (e.g. document.modulo)
//    fieldName = name of the field (used in the function)
//    numFields = number of the radio selections (used in the function)
//    alertMsg = name of the field (displayed in the alert box)

function checkRadio(data, fieldName, numFields, alertMsg) {
  var radioChk = false;
  var actField = eval(data + "[fieldName]");

  for (i=0; i<numFields; i++) {
  	if (actField[i].checked) radioChk = true;
  }

  if (!radioChk) {
    alert("Attenzione: specificare un valore per '" + alertMsg + "'");
	actField[0].focus();
    return false;
  }

	return true;
}

// Function checkPrivacy
//
// Arguments:
//    data = name of the form (e.g. document.modulo)
//    fieldName = name of the field (used in the function)

function checkPrivacy(data, hash, fieldName) {
  var fieldName = eval(data + "[fieldName]");

  if (!fieldName.checked) {
    alert("Attenzione: è necessario il consenso per l'elaborazione dei dati personali");
    return false;
  }

	return true;
}

// Function checkSelectBox
//
// Arguments:
//    data = name of the form (e.g. document.modulo)
//    fieldName = name of the field (used in the function)
//    alertMsg = name of the field (displayed in the alert box)
//    required = the field must not be empty (true or false)

function checkSelectBox(data, hash, fieldName, alertMsg, required) {
   var thisField = data + "." + fieldName;
   var thisIdx = eval(thisField + ".selectedIndex");
   var fieldValue = eval(thisField + ".options[" + thisField + ".selectedIndex].value");
   if (required) {
      if (fieldValue.length == 0) {
         alert("Attenzione: il campo '" + alertMsg + "' e' obbligatorio");
         eval(thisField).focus(); return false;
      }
   }
   return true;
}


// Function checkTxtlength
//
// Arguments:
//    data = name of the form (e.g. document.modulo)
//    fieldName = name of the field (used in the function)
//    maxLength = max number of chars in the field
//    alertMsg = name of the field (displayed in the alert box)
//    required = the field must be empty (true or false)



function checkTxtlength(data, fieldName, maxLength, alertMsg, required) {

 
   var thisField = eval(data + "[fieldName]");
   var fieldValue = thisField.value;

     if (required) {
      if (fieldValue == "") {
         alert("Attenzione: inserisci '" + alertMsg + "' .");
         thisField.focus(); return false;
      }
   }
   

   		if (fieldValue.length > maxLength) {
            alert("Attenzione: nel campo '" + alertMsg + "' sono consentiti al massimo "+maxLength+" caratteri.\nCaratteri attualmente presenti nel campo: "+fieldValue.length+".");
			thisField.focus(); return false;
   		}
   

   return true;
}

// -->

