function is_valid_email(email)
{

    if ((email)&&(email.match(/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_\+\!]*@[a-z0-9]+[\.a-zA-Z0-9\-]*(\.[a-zA-Z]{2,4})$/)))
        return 1;
    else
        return 0;
}

function check_register_form(f)
{

    var state   = 'ok';
    var reason  = 'Next error occures:\n';
    var email   = f.cEmail.value;

    if (!email)
    {
        state = 'err';
        reason+=' - You have specified an empty email\n';
    }
    else
    {
       if (!is_valid_email(email))
       {
           state = 'err';
           reason+=' - You have specified an incorrect email\n';
       }
    }

    if (state == 'err')
        alert(reason);
    else
        f.submit();
}

