//expire for languagecookie
var exp = new Date();
validdays = 7; //the cookie expires after the value of validdays
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * validdays));

// Function to create a cookie and set its value
function setCookie(name, value, expires) {
    document.cookie = escape(name) + "=" + escape(value) + "; path=/" + 
        ((expires == null) ? "" : "; expires=" + expires.toGMTString(  ));
}

// Function to retrieve a cookie's value
function getCookie(name) {
    var cookiename = name + "=";
    var dc = document.cookie;
    var begin, end;

    if (dc.length > 0) {
        begin = dc.indexOf(cookiename);
        if (begin != -1) {
            begin += cookiename.length;
            end = dc.indexOf(";", begin);
            if (end == -1) {
                end = dc.length;
            }
            return unescape(dc.substring(begin, end));
        } 
    }
    return null;
}

// Function to delete a cookie
function deleteCookie(name) {
    document.cookie = name + "=; expires=Fri, 01-Jan-00 00:00:01 GMT" +  
        "; path=/";
}

