﻿function authorizeUser(object, signInUrl, accountActivationRequired) {
    
    var colorboxUrl = signInUrl; // considering user has not logged in

    if (loggedIn.toLowerCase() == 'true') {
        if (!accountActivationRequired) {
            // User logged in, account activation check is not required
            return true;
        } else {
            // Account activation required
            if (hasActivatedAccount.toLowerCase() == 'true') return true;
            else colorboxUrl = resendActivationEmailUrl;
        }
    } else {
        // user has not logged in
        colorboxUrl = signInUrl;
    }

    jQuery(object).colorbox({
        width: "800px",
        height: "500px",
        iframe: true,
        scrolling: false,
        overlayClose: false,
        href: colorboxUrl,
        open: true
    });

    return false;
}
