function preferiti() //Aggiunta ai preferiti
                 {
                 if (document.all)
                 window.external.AddFavorite("http://www.csateam.it","C.S.A. - Centro Servizi alle Aziende")
				 else alert("Funzione abilitata solo per IE4 o superiore")
                 }

function checkFormElementNotEmpty(theForm, theFieldName, valueName)
{
    var theField          = theForm.elements[theFieldName];
    var val               = theField.value;

    if (val == ''){
        //theField.select(); //Se si mette questa frase non funzionano i tipi "select"
        alert('Inserire ' + valueName + '!');
        theField.focus();
        return(false);
    }
    else{
        theField.value = val;
    }

    return true;
}

function checkFormElementIsNumber(theForm, theFieldName)
{
    var theField         = theForm.elements[theFieldName];
    var val              = parseInt(theField.value);
    
    // It's not a number
    if (isNaN(val)) {
        theField.select();
        alert('Per favore, inserire un numero!');
        theField.focus();
        return false;
    }
    // It's a valid number
    else {
        theField.value = val;
    }

    return true;
}

function checkEmail(theForm, theFieldName)
{
    var theField          = theForm.elements[theFieldName];
    var emailValue        = theField.value;
    var myRegExpr         = /^[_\.0-9a-z-]+@([0-9a-z][-0-9a-z\.]+)\.([a-z]{2,3}$)/
    
    
    if (myRegExpr.test(emailValue)){
        return true;
    }
    theField.select();
    alert('L\'email inserita non è valida!');
    theField.focus();
    return false;
}