var cookiepath = "/";
var cookiedomain = ".e-deo.be";
var extradomain = ".e-deo.be";
/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 */

function setCookie(name, value, expires)
{
	expiredate = new Date("January 1, 3000");
   	document.cookie= name + "=" + value +
       	((!expires) ? ("; expires=" + expiredate.toGMTString()) : "") +
        	"; path=" + cookiepath +
        	"; domain=" + cookiedomain;
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}


/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */

function deleteCookie(name) {

	if (getCookie(name)) {
		
		expiredate = new Date("January 1, 1970");
	   	document.cookie= name + "=EXPIREDCOOKIE" + 
       		"; expires=" + expiredate.toGMTString() +
        		"; path=" + cookiepath +
	        	"; domain=" + cookiedomain;
	}

}
function deleteExtraCookie(name) {

	expiredate = new Date("January 1, 1970");
   	document.cookie= name + "=EXPIREDCOOKIE" + 
       		"; expires=" + expiredate.toGMTString() +
        		"; path=" + cookiepath +
	        	"; host=" + extradomain;
}
function setLanguage(lang) {
	setCookie("userLang", lang, false);
}
function setMeasurement(sys) {
	setCookie("userMeasurement", sys, false);
}
