try {
	var CookieManagerUtil = {
		setCookie : function(name, value, expires, path, domain, secure) {
			var expStr = '';
			if (expires) {
				var expDate = new Date();
				expDate.setTime(expDate.getTime() + expires * 1000);
				expStr = ';expires=' + expDate.toGMTString();
			}
			var pathStr = path ? ';path=' + path : '';
			var domainStr = domain ? ';path=' + domain : '';
			var secureStr = secure ? ';secure' : '';
			document.cookie = name + '=' + encodeURIComponent(value) + expStr
					+ pathStr + domainStr + secureStr;
		},
		getCookie : function(name) {
			var cookie = document.cookie;
			var start = cookie.indexOf(name + '=');
			if (start == -1)
				return null;
			var end = cookie.indexOf(';', start);
			end = end < 0 ? cookie.length : end;
			return decodeURIComponent(cookie.substring(start + name.length + 1,
					end));
		},
		deleteCookie : function(name) {
			var expDate = new Date();
			expDate.setTime(expDate.getTime() - 1);
			//alert(name+':'+this.getCookie(name));
			document.cookie = name + '=11' + ';expires=' + expDate.toGMTString();
			this.setCookie(name, '', expDate, '/');
			//alert(name+':'+this.getCookie(name));
		},
		getCookies : function() {
			var cookie = document.cookie;
			var arr = cookie ? cookie.replace(/;/g, '').split(' ') : [];
			var result = [];
			for ( var i = 0; i < arr.length; i++) {
				var str = arr[i];
				var pair = str.split('=');
				result.push( {
					name : pair[0],
					value : unescape(pair[1])
				});
			}
			return result;
		}
	};
} catch (ex) {
	alert(ex.message);
}

function InfoHistory() {
	this.cookieSp = '*';
	this.initInfoHistory.apply(this, arguments);
}

InfoHistory.prototype = {
	initInfoHistory : function(cookieName, parseHistoryItem) {
		this.cookieName = cookieName;
		this.parseHistoryItem = parseHistoryItem;
	},
	addInfoHistory : function(value) {
		var cookieName = this.cookieName;
		var expires = 60 * 60 * 12;	// 60 * 60 * 24 * 365;
		var count = 10;
		var houseHistory = CookieManagerUtil.getCookie(cookieName);
		if (houseHistory && houseHistory.indexOf(value) != -1)
			return;
		// alert(houseHistory);
	var appendValue = value;
	if (houseHistory) {
		var arr = houseHistory.split(this.cookieSp);
		if (arr.length >= count) {
			arr=arr.slice(0,(arr.length-1));
			houseHistory = arr.join(this.cookieSp);
		}
		houseHistory = appendValue + this.cookieSp + houseHistory;
	} else
		houseHistory = appendValue;
	// alert(houseHistory);
	CookieManagerUtil.setCookie(cookieName, houseHistory, expires, "/", null);
},
lisInfoHistory : function() {
	var cookieName = this.cookieName;
	var houseHistory = CookieManagerUtil.getCookie(cookieName);
	if (!houseHistory)
		return;
	return houseHistory;
},

clearInfoHistory : function() {
	var cookieName = this.cookieName;
	CookieManagerUtil.deleteCookie(cookieName);
}
};

var comment_all = new InfoHistory('commentAll');


