+ _getDomainFromUrl: function (url)
+ {
+ if (this.cookieDomain) return this.cookieDomain; //explicit cookie domain
+ var m = this.domainRegex.exec(url);
+ return (m && m.length > 1) ? m[1] : null;
+ },
+
+ _strEndsWith: function (str, suffix)
+ {
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
+ },
+
+ _isCrossDomain: function (domain)
+ {
+ if (this.cookieDomain) return true; //assume xdomain is cookie domain set
+ return !this._strEndsWith(domain, document.domain);
+ },
+
+ getCookie: function (sKey) {
+ return decodeURI(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"
+ + encodeURI(sKey).replace(/[\-\.\+\*]/g, "\\$&")
+ + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
+ },
+
+ setCookie: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
+ if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
+ return false;
+ }
+ var sExpires = "";
+ if (vEnd) {
+ switch (vEnd.constructor) {
+ case Number:
+ sExpires = vEnd === Infinity
+ ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT"
+ : "; max-age=" + vEnd;
+ break;
+ case String:
+ sExpires = "; expires=" + vEnd;
+ break;
+ case Date:
+ sExpires = "; expires=" + vEnd.toGMTString();
+ break;
+ }
+ }
+ document.cookie = encodeURI(sKey) + "=" + encodeURI(sValue)
+ + sExpires
+ + (sDomain ? "; domain=" + sDomain : "")
+ + (sPath ? "; path=" + sPath : "")
+ + (bSecure ? "; secure" : "");
+ return true;
+ },
+