function getCookie(name) {
    let lookingFor = name + "=";
    let arr = document.cookie.split(";");
    for(let str of arr)
    {
        while(str[0] == ' ') // removing potential unwanted spaces
        {
            str = str.slice(1);
        }
        if (str.slice(0,lookingFor.length)==lookingFor)
        {
            return str.slice(lookingFor.length);
        }
    }
    return null;
}