// restituisce true se v_string č vuoto altrimenti restituisce false
function isEmpty(v_string)
{
    return ((v_string == null) || (v_string.length == 0))
}


/* funzione che controlla la validitā  di un indirizzo e-mail in un campo input
   v_field */
function CheckMail(v_form, v_field)
{
    f_email = document.forms[v_form].elements[v_field].value;
    f_regxp = /^[^@]+@[^@]+\.[^@\d]{2,}/gi;

    if (! isEmpty(f_email))
    {
        if (f_email.search(f_regxp) == -1)
        {
            alert ("The e-mail address provided is not valid, please check field content.");
            document.forms[v_form].elements[v_field].focus();
            document.forms[v_form].elements[v_field].select();
            return false;
        }
    }
    return true;
}