function getCookie(name) {
  var cookies = document.cookie;
  var start = cookies.indexOf(name + '=');
  if (start == -1) return null;
  var len = start + name.length + 1;
  var end = cookies.indexOf(';',len);
  if (end == -1) end = cookies.length;
  return unescape(cookies.substring(len,end));
}

function setCookie(name, value, expires, path, domain, secure) {
  value = escape(value);
  expires = '';
  path    = (path)    ? ';path='    + path                  :'';
  domain  = (domain)  ? ';domain='  + domain                :'';
  secure  = (secure)  ? ';secure'                           :'';

  document.cookie =
    name + '=' + value + expires + path + domain + secure;
}

function isCookieEnabled() {
    setCookie('temp','temp');
    var temp = getCookie('temp');
    if (!temp) {
      alert('You must set your browser to allow cookies in order to participate in Community activities and enter giveaways.');
      return false;
    }
    else return true;
}

if(!isCookieEnabled()) {
  window.location = 'error.jsp';
}