// クッキーの取得
// 設定されているクッキーを連想配列として返す
function getCookies()
{
	var cookies = new Array();
	if (document.cookie)
	{
		var list = document.cookie.split("; ");
		for (var i = 0; i < list.length; i++)
		{
			var str = list[i].split("=");
			cookies[str[0]] = unescape(str[1]);
		}
	}
	return cookies;
}

// クッキーの設定
function setCookie(
	key,	// クッキー名
	value,	// クッキーの値
	expires,// 有効期限の日数(0.5:12時間 / 0:セッション中のみ有効 / -1:削除)
	domain,	// 参照可能なドメイン(0: 発行したサーバ / 1: 発行したドメイン名が含まれるサーバ)
	path,	// 参照可能なパス(0: 発行したカレントディレクトリ / 1: 発行したページ)
	secure	// SSL(https)通信時のクッキーの暗号化を指定（0: 無効 1: 有効）
	)
{
	if (!key) return;

	var str = key + "=" + escape(value);
	if (domain)
	{
		if (domain == 1) domain = location.hostname.replace(/^[^\.]*/, "");
		str += "; domain=" + domain;
	}
	if (path)
	{
		if (path == 1) path = location.pathname;
//		str += "; path=;" + path;
//		str += "; path=/;";

	}
	if (expires)
	{
		var today = new Date().getTime();
		expires = new Date(today + (60 * 60 * 24 * 1000 * expires));
		expires = expires.toGMTString();
		str += "; expires=" + expires;
	}
	if (secure && location.protocol == "https:")
	{
//		str += "; secure";
	}
        str+= ";domain=kaijo-navi.jp;path=/"
	document.cookie = str;

}

