  function setCookie(pName,pValue,pDays)
  {
    var exp = "";
    if (pDays)
    {
      var date = new Date();
      date.setTime(date.getTime() + (pDays*24*60*60*1000));
      exp = "; expires=" + date.toGMTString();
    }
    
    document.cookie = pName + "=" + pValue + exp + "; path=/";
  }
  
  function getCookie(pName)
  {
    var n = pName + "=", ca = document.cookie.split(';'), i, c;
    for (i=0; i < ca.length; i++)
    {
      c = ca[i];
      while (c.charAt(0)==' ')
        c = c.substring(1,c.length);
      if (c.indexOf(n) == 0)
        return c.substring(n.length,c.length);
    }
    return "";
  }