
function setCookie(name, value, expdays) {   // expires in expdays
  var now = new Date();
  var exp = new Date(now.getTime() + (1000*60*60*24*expdays));
  document.cookie = name + "=" + escape(value) + ";" +
                    "expires=" + exp.toGMTString() + ";" +
                    "path=/";		
}

function delCookie(name) {   // it has expired
  var now = new Date();
  var exp = new Date(now.getTime() - 1);
  document.cookie = name + "=;" +
                    "expires=" + exp.toGMTString() + ";" + 
                    "path=/";
}

function getCookie(name) {
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    var start = dc.indexOf(cname);
    if (start != -1) {
      start += cname.length;
      var stop = dc.indexOf(";", start);
      if (stop == -1) stop = dc.length;
      return unescape(dc.substring(start,stop));
    }
  }
  return null
}

function cssSetCookie(css) {
  setCookie("Layout", css, 365);   // valid 1 year
  window.location.href = document.URL;
}

function cssGetCookie() {
  return getCookie("Layout");
}

function cssDelCookie() {
  delCookie("Layout");
}
