/*jQuery(document).ready(function () {

    if (!storeClosed) {

        var cookieName = "ThirtyOneOutlet";
        var cookieValue = null;
        var logInPath = "/info/login"
        var curPath = getPathName();
        //alert("cid querystring value= " + consultantId);
        //alert("curPath= " + curPath);

        // Do nothing if already on login page
        if (curPath != logInPath) {

            // see if they already have a valid cookie
            cookieValue = getCookie(cookieName);

            // set or override cookie value IF they're coming in with a consultant id on the querystring (override cuz could be a new cid)
            var consultantId = parseInt(getParamValue("cid"));
            if (typeof consultantId !== "undefined" && consultantId != null && consultantId != "" && !isNaN(consultantId)) {
                setCookie(cookieName, consultantId, 10000);
                cookieValue = consultantId;
                //console.log('passed');
            } else {
                //console.log('failed');
            }

            // Added  || cookieValue == "null"   JJH 12/04/2012 @ 4:15PM EST
            if ((typeof cookieValue === "undefined") || cookieValue == null || cookieValue == "" || cookieValue == "null") {
                window.location.href = logInPath;
            }
            else {
                //Everything is verified & good
                if (document.getElementById("wrapper")) {
                    document.getElementById("wrapper").style.display = "block";
                }
            }
        }
        else {
            // they're on the "log in" page, display the wrapper, background, etc.
            if (document.getElementById("wrapper")) {
                document.getElementById("wrapper").style.display = "block";
            }
        }

    }

});

function getPathName() {
    var currentPath = null;
    var strHref = window.location.href;
    //alert("strHref= " + strHref);
    var mypage_array = strHref.split("/");

    if (mypage_array.length > 3) {
        currentPath = "/" + mypage_array[mypage_array.length - 2] + "/" + mypage_array[mypage_array.length - 1];
    }
    //alert("currentPath= " + currentPath);
    return currentPath;
}

function getCookie(c_name) {
    var i, x, y;
    var ARRcookies = document.cookie.split(";");
    if (ARRcookies.length > 0) {
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    }
    return null;
}

function setCookie(c_name, value, pMinutes) {
    // give it an expiration date in GMT format
    var currdate = new Date();
    var expirationdate = new Date(currdate.getTime() + (pMinutes * 60 * 1000));  // 10000 = 10 seconds  formula = pMinutes*60*1000

    //var exdate = new Date();
    //exdate.setDate(exdate.getDate() + pMinutes);
    var c_value = escape(value) + ((pMinutes == null) ? "" : "; expires=" + expirationdate.toUTCString() + "; path=/");  //exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

function getParamValue(param) {
    var loc = location.search.substring(1, location.search.length);
    var paramValue;
    var params = loc.split('&')
    for (i = 0; i < params.length; i++) {
        paramName = params[i].substring(0, params[i].indexOf('='));
        if (paramName == param) {
            paramValue = params[i].substring(params[i].indexOf('=') + 1);
        }
    }
    return paramValue;
}*/
