function getCookie(sCookieName){
  var lPosStart = 0;
  var lPosEnd = 0;
  if (document.cookie.length > 0) { 
    lPosStart = document.cookie.indexOf(sCookieName+"="); 
    if (lPosStart != -1) { 
      lPosStart += sCookieName.length+1; 
      lPosEnd = document.cookie.indexOf(";", lPosStart);
      if (lPosEnd == -1) {
        lPosEnd = document.cookie.length;
      }
      return unescape(document.cookie.substring(lPosStart, lPosEnd));
    } 
  }
  return null;  
}
function setCookie(sCookieName, value, expiredays) {
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  document.cookie = sCookieName + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}
function delCookie (sCookieName) {
  if (getCookie(sCookieName)) {
   document.cookie = sCookieName + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

