/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

	本の枝折 cookie JavaScript

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/
function Cookie(name, path, hours)
{
	this.name = name;
	this.path = path;
	this.hours = 0;
	this.crunchCookie = new Array();
	if (hours && hours != null && hours != 0) {
		if (typeof(hours) == 'string' && Date.parse(hours))	// already a Date string
			this.hours = hours;
		else if (typeof(hours) == 'number')	// calculate Date from number of hours
			this.hours = (new Date((new Date()).getTime() + hours * 3600000)).toGMTString();
	}
}
Cookie.prototype.eatCookie = function() {
	document.cookie = this.name + '=0; expires=Fri, 13-Apr-1970 00:00:00 GMT' + (this.path ? ';path=' + this.path : '') + ';';
};
Cookie.prototype.bakeCookie = function(value) {
	document.cookie = this.name + '=' + encodeURIComponent(value) + (this.hours ? ('; expires=' + this.hours) : '') + (this.path ? '; path=' + this.path : '') + ';';
};
Cookie.prototype.cutCookie = function() {
	if (document.cookie == '')
		return false;
	var	bigCookie = document.cookie;
	var	pieceCookie = new Array();
	pieceCookie = bigCookie.split(';');
	for (var i in pieceCookie) {
		this.crunchCookie = pieceCookie[i].split('=');
		if (this.crunchCookie[0] == this.name || this.crunchCookie[0] == (' ' + this.name))
			return decodeURIComponent(this.crunchCookie[1]);
	}
	return false;
};
