function cookieVal(cookieName, cookieString) 
{
    var startLoc = cookieString.indexOf(cookieName);

    // No such cookie
    if (startLoc == -1) { return(""); }

    var sepLoc = cookieString.indexOf("=", startLoc);
    var endLoc = cookieString.indexOf(";", startLoc);
    // Last one has no ";"
    if (endLoc == -1) { endLoc = cookieString.length; }

return(cookieString.substring(sepLoc+1, endLoc)); }

function setSprog(landekode)
{
    document.cookie = "sprog=" + landekode + "; path=/" ;
    if (cookieVal("sprog",document.cookie) == "")
         window.location.replace("/Forside/index/sprog/"+landekode);
    else window.location.reload(true);
}

// document.cookie = "name1=val1";
// document.cookie = "name2=val2; expires=" + someDate;
// document.cookie = "name3=val3; path=/" ;
// alert (document.cookie) ;
