//メニュー表示・非表示クッキーSAVE
function saveCookie(dValue) {
	cName = "uName=";	// ユーザー名
	cDays = 365;		// データの保存日数
	setPre = new Date();
	setPre.setTime(setPre.getTime() + (cDays*1000*24*3600));
	prd = setPre.toGMTString();
	document.cookie = cName + escape(dValue) + ";path=/;expires=" + prd;
}
//パスクッキーSAVE
function saveCookie2(dValue) {
	cName = "uPath=";	// パス
	cDays = 365;		// データの保存日数
	uPath = location.pathname;
	setPre = new Date();
	setPre.setTime(setPre.getTime() + (cDays*1000*24*3600));
	prd = setPre.toGMTString();
	document.cookie = cName + escape(uPath) + ";path=/;expires=" + prd;
}

function getCookie(item) {
	var i, index, arr;
	arr = document.cookie.split(";");
	for(i = 0; i < arr.length; i++) {
		index = arr[i].indexOf("=");
		//2番目は頭がスペースのとき
		if(arr[i].substring(0, index) == item || arr[i].substring(0, index) == " " + item){
			return arr[i].substring(index + 1);
		}
	}
	return "";
}


// クッキーの読み込み
function loadCookie() {
	n = getCookie("uName");
	n2 = getCookie("uPath");
	now_Path = location.pathname;

	arr1 = n2.split("/");
	arr2 = now_Path.split("/");

	old_path = arr1[1];
	now_path = arr2[1];

	if (( old_path == 'splist' ) && ( arr1[2] != '' ) && ( arr1[2] != 'xc' )){
		old_path = arr1[2];
	}

	if (( now_path == 'splist' ) && ( arr2[2] != '' ) && ( arr2[2] != 'xc' )){
		now_path = arr2[2];
	}
	if(old_path != now_path){				//画面偏移したら無条件でメニュー非表示
		saveCookie('HIDDEN');
		saveCookie2();
		return 'HIDDEN';
	}
	saveCookie2();
	
	return n;
}

function menucheck(){
	n = loadCookie();

	if( n == "HIDDEN" ){
		document.getElementById('sb1').style.width='24px';	
		document.getElementById('sb1').style.height='165px';	
		document.getElementById('bt1').style.display='none';	
		document.getElementById('bt2').style.display='block';	
		document.getElementById('idx').style.visibility='hidden';	
	}else{
		document.getElementById('sb1').style.width='198px';	
		document.getElementById('sb1').style.height='800px';	
		document.getElementById('bt1').style.display='block';	
		document.getElementById('bt2').style.display='none';	
		document.getElementById('idx').style.visibility='visible';	
	}
}


