
// 特定のCookieを取得する
function getCookie(name){
	var myCookie = document.cookie;
	if(myCookie.length==0)return null;
	var cookies=myCookie.split(";");
	var i=0;
	while(i<cookies.length){
		var tmp=cookies[i].split("=");
		cName=tmp[0].replace(/^\s/,"");
		cValue=tmp[1];
		if(cName==name){
			return unescape(cValue);
		}
		i++
	}
	return null;
}

// 日数をグリニッジ標準時形式に変換
function trsGMT(num){
	var expire = new Date();
	expire.setTime(expire.getTime()+(num*24*60*60*1000));
	var expires = expire.toGMTString();
	return expires;
}

// Cookieを焼く(有効期限を省略)
function setCookie(name,value,date,path){
	expires = trsGMT(date);
	document.cookie=name+"="+escape(value)+"; path="+path;
}

// Cookieの有無による処理
function flagJudgment( ) {
	var plmStr = getCookie("@plmStr");
	if(plmStr==null){
		document.getElementById('target1').style.display ="block";
	}else{
		document.getElementById('target2').style.display ="block";
	}
}

// 以下イベントハンドラ
window.onload = function() {
	flagJudgment( );
}
window.onunload = function() {
	setCookie("@plmStr","flag_on",1,"/");
}

