function setCookie(cname, cvalue, exdays) { if (exdays === undefined) { document.cookie = cname + "=" + cvalue + "; path=/" + "; document=" + document.domain; } else { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/" + "; document=" + document.domain; } } function setCookieSeconds(cname, cvalue, seconds) { if (seconds === undefined) { document.cookie = cname + "=" + cvalue + "; path=/" + "; document=" + document.domain; } else { var d = new Date(); d.setTime(d.getTime() + (seconds * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/" + "; document=" + document.domain; } } function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(decodeURI(arr[2])); else return null; } function SetClientTimeoffset() { var d = new Date(); var offset = d.getTimezoneOffset(); setCookie("clienttimeoffset", offset, 360); }