<!-- BEGIN
//----------------------------------------------------------------------------//
function readCookie(name) {
        var the_cookie = document.cookie;
        var the_cookie = unescape(the_cookie);
        var all_cookies = the_cookie.split(";");
        for (var loop = 0; loop < all_cookies.length; loop++) {
                property_value = all_cookies[loop];
                var broken_info = property_value.split("=");
                var the_property = broken_info[0];
                var the_value = broken_info[1];

                the_property = the_property.replace( /^\s*/, "" );
                the_property = the_property.replace( /\s*$/, "" );
                if (the_property == name) {
                        return the_value;
                }
        }       
        return false;
} 
//----------------------------------------------------------------------------//
function GetCookie(Name) {
	var cookieStr = document.cookie;
	var arg = Name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (cookieStr.substring(i,j) == arg) {
			return GetCookieVal(j);
		}
		i = document.cookie.indexOf(" ",i) + 1;
		if (i == 0) break;
	}
	return null;
}
//----------------------------------------------------------------------------//
function GetCookieVal (offset) {
	var endstr = document.cookie.indexOf(";",offset);
	if (endstr == -1) { endstr = document.cookie.length; }
	return unescape(document.cookie.substring(offset, endstr));
}
//----------------------------------------------------------------------------//
function WriteCookie (cookieName, cookieValue, path, domain, expires, secure) {
	var curCookie = cookieName + "=" + escape(cookieValue) + ((expires) ? "; expires=" + expires.toGMTString() : "") +
  			((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");

	document.cookie = curCookie;
}
//----------------------------------------------------------------------------//
// END -->
