function setCookie(name, value){ var d=new Date, nd=new Date; nd.setHours(d.getHours()+5); var curCookie = name + "=" + escape(value)+"; expires="+nd.toGMTString()+"; path=/"; document.cookie = curCookie; } function getCookie(name){ var prefix = name + "="; var cookieStartIndex = document.cookie.indexOf(prefix); if (cookieStartIndex == -1) return ''; var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length; return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); } function setCookieAndReload(v, n, path) { setCookie(v, n); if (!path) window.location.reload(true); else window.location = path; }