
function get_cookie(name_to_get) {

    var cookie_pair
    var cookie_name
    var cookie_value
    
    // Split all the cookies into an array
    var cookie_array = document.cookie.split("; ")
    
    // Run through the cookies
    for (counter = 0; counter < cookie_array.length; counter++) {
    
        // Split the cookie into a name/value pair
        cookie_pair = cookie_array[counter].split("=")
        cookie_name = cookie_pair[0]
        cookie_value = cookie_pair[1]
        
        // Compare the name with the name we want
        if (cookie_name == name_to_get) {
        
            // If this is the one, return the value
            return unescape(cookie_value)
        }
    }
    
    // If the cookie doesn't exist, return null
    return null
}


