
//　クッキーＩ／Ｏ

function SetCookie( Key, Value )
{
	var lastDay = new Date( 2119, 11, 1 );
	var stCookie = Key;
	stCookie = stCookie + "=" + Value + ";expires=" + lastDay.toGMTString() + ";";
	document.cookie = stCookie;
}
function GetCookie( Key, DefValue )
{
	Key += "=";
	var stCookie = document.cookie;
	if( stCookie.substring( 0, Key.length ) == Key ) {
		var n1 = stCookie.indexOf( "; " );
		if( n1 < 0 ) return stCookie.substring( Key.length, stCookie.length );
		else return stCookie.substring( Key.length, n1 );
	}
	else {
		Key = "; " + Key;
		var n1 = stCookie.indexOf( Key );
		if( n1 < 0 ) return DefValue;
		else {
			var st = stCookie.substring( n1 + Key.length, stCookie.length );
			var n2 = st.indexOf( "; " );
			if( n2 < 0 ) return st;
			else return st.substring( 0, n2 );
		}
	}
}
