/**
 * csettings.js
 *
 * Photo-Online's csettings scripts
 *
 * @copyright iLibris
 * @author    Alan Schatteman
 * @license   license
 * @version   1.0
 * @package   photo-online
 */

/**
 * FUNCTIONS
 ***********/

/**
 * checkForm
 */
function checkForm()
{
    var eForm = document.getElementById("loginForm");
    if (!eForm) {
        return false;
    }

    var eMail = document.getElementById("logon_email");
    if (!eMail) {
        return false;
    }

    if (bMail && eMail.value == sMail) {
        eMail.select();
        return false;
    }

    /*if (!checkMail(eMail.value)) {
        setText('errorBox', webtext['invalid_email_address']);
        setVisibility('errorBox', true);
        setVisibility('errorInputEmail', true);
        return false;
    }
    else {*/

        // check pp
        var eInp = document.getElementById("inpPickupPoint");
        if (eInp) {
            if (!eInp.value) {
                setText('errorBox', 'Please select a pickup point.');
                setVisibility('errorBox', true);
                return false;
            }
        }

        setVisibility('errorBox', false);
        setVisibility('errorInputEmail', false);
        eForm.submit();
    /*}*/
}

/**
 * onLogin
 */
function onLogin()
{
    return checkForm(this);
}

/**
 * onRegister
 */
function onRegister()
{
    location.href = "?module=consumer_register&action=register";
}

/**
 * onForgotPin
 */
function onForgotPin()
{
    location.href = "?module=consumer_register&action=forgot_pin";
}
