﻿

// use lib
function cookiesEn() {

    var cookieEnabled = (navigator.cookieEnabled) ? true : false

    //if not IE4+ nor NS6+
    if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
        document.cookie = "testcookie"
        cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false
    }

    return cookieEnabled;
}

function readCookie(name) {

    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function ValidLocaleURL(ForwardLocale, urlLocal) {
    var tolocal = ForwardLocale.toLowerCase();

    var surlLocal = urlLocal + "/";
    if (urlLocal == tolocal || surlLocal == tolocal
|| (surlLocal + "es") == tolocal || (surlLocal + "es" + "/") == tolocal)
        return false;

    return true;
}

function Redir302(redirP) {
    
    if (redirP) {
        redirP = redirP.toLowerCase();
        if (window.location && window.location.href) {
            if (window.location.href.toLowerCase() != redirP) {
               window.location.href = redirP;
            }
        }
        else if (document.location) {
            if (document.location.toLowerCase() != redirP)
                document.location = redirP;
        }
    }
}


