
//////////////////////////////////////////
//クッキー
//////////////////////////////////////////
var fontCookie = 'm';
var regionCookie = '03';
var saveTime = 10*24*60*60*1000;
var regionImg = new Array;
regionImg['01'] = "/common/images/region_navi_01.gif";
regionImg['02'] = "/common/images/region_navi_02.gif";
regionImg['03'] = "/common/images/region_navi_03.gif";
regionImg['04'] = "/common/images/region_navi_04.gif";
regionImg['05'] = "/common/images/region_navi_05.gif";
regionImg['06'] = "/common/images/region_navi_06.gif";
regionImg['07'] = "/common/images/region_navi_07.gif";
regionImg['08'] = "/common/images/region_navi_08.gif";
regionImg['09'] = "/common/images/region_navi_09.gif";

var nowCookie = getcookie ();
if(nowCookie != "0"){
	fontCookie = nowCookie.substring(0,1);
	regionCookie = nowCookie.substring(2,4);
}

//初期スタイル設定
if(fontCookie == "l"){
	document.write ('<style type="text/css">body{font-size:95%;line-height:130%;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex dt{width:204px;}</style>');
	document.write ('<style type="text/css">body.company div#CONTENTS_MAIN dl.dataListIndex dd{width:458px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex dd{width:458px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN div#INDEX_MAIN_RIGHT dl.dataListIndex dd{width:309px;}</style>');
	document.write ('<style type="text/css">div#COMPANY_MAIN div#COMPANY_MAIN_RIGHT dl.dataListIndex dd{width:297px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex.short dt{width:75px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex.short dd{width:587px;}</style>');
}
if(fontCookie == "s"){
	document.write ('<style type="text/css">body{font-size:65%;line-height:110%;}p{line-height:120%;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex dt{width:160px;}</style>');
	document.write ('<style type="text/css">body.company div#CONTENTS_MAIN dl.dataListIndex dd{width:502px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex dd{width:502px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN div#INDEX_MAIN_RIGHT dl.dataListIndex dd{width:353px;}</style>');
	document.write ('<style type="text/css">div#COMPANY_MAIN div#COMPANY_MAIN_RIGHT dl.dataListIndex dd{width:341px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex.short dt{width:50px;}</style>');
	document.write ('<style type="text/css">div#CONTENTS_MAIN dl.dataListIndex.short dd{width:602px;}</style>');
}
document.write ('<style type="text/css">p#REGIONSELECT a{background:url('+regionImg[regionCookie]+') left -42px no-repeat;}</style>');
document.write ('<style type="text/css">#REGIONINFO03{display:none;}</style>');
document.write ('<style type="text/css">#REGIONINFO'+regionCookie+'{display:block;}</style>');
document.write ('<style type="text/css">dl#REGIONSELECTMENU dd.region03 a{background-position:left top;}</style>');
document.write ('<style type="text/css">dl#REGIONSELECTMENU dd.region'+regionCookie+' a{background-position:left -42px !important;}</style>');
document.write ('<style type="text/css">dl#REGIONSELECTMENU.select dd a{background-position:left top !important;}</style>');
document.write ('<style type="text/css">dl#REGIONSELECTMENU.select dd a:hover{background-position:left -21px !important;}</style>');
document.write ('<style type="text/css">dl#REGIONSELECTMENU.select dd.hover a{background-position:left -42px !important;}</style>');

//文字サイズエリア
function fontmenu() {
	document.write ('<dl>');
	document.write ('<dt title="文字サイズ">文字サイズ</dt>');
	if(fontCookie == 's'){
		document.write ('<dd class="s"><a href="javascript:location.reload();" class="hover">小</a></dd>');
	}else{
		document.write ('<dd class="s"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'s\',regionCookie)" title="小">小</a></dd>');
	}
	if(fontCookie != 'l' && fontCookie != 's'){
		document.write ('<dd class="m"><a href="javascript:location.reload();" class="hover">中</a></dd>');
	}else{
		document.write ('<dd class="m"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'m\',regionCookie)" title="中">中</a></dd>');
	}
	if(fontCookie == 'l'){
		document.write ('<dd class="l"><a href="javascript:location.reload();" class="hover">大</a></dd>');
	}else{
		document.write ('<dd class="l"><a href="javascript:location.reload();" onclick="javascript:setcookie (\'l\',regionCookie)" title="大">大</a></dd>');
	}
	document.write ('</dl>');
}

//クッキー取得
function getcookie(){
	var ReturnsNum = Num = NumbarNum = 0;
	var cookieNameEx = "FamilyMartCookie" + "=";
	var stTemp = "";
	while (Num < document.cookie.length){
		NumbarNum = Num + cookieNameEx.length;
		if (document.cookie.substring(Num, NumbarNum) == cookieNameEx){
			stTemp = document.cookie.indexOf(";", NumbarNum);
			if (stTemp == -1){
				ReturnsNum = document.cookie.substring(NumbarNum, document.cookie.length);
			}else{
				ReturnsNum = document.cookie.substring(NumbarNum, stTemp);
			}
			break;
		}
		Num = document.cookie.indexOf(" ", Num) + 1;
		if (Num == 0){break;}
	}
	return ReturnsNum;
}

//クッキー保存
function setcookie(fontValue,regionValue){
	var dateEx = new Date();
	dateEx.setTime(dateEx.getTime() + saveTime);
	document.cookie = "FamilyMartCookie" + "=" + fontValue + "_" + regionValue + "; expires=" + dateEx.toGMTString() + ";path=/";
}

//今週の新商品一覧URL
var goodsIndex = new Array;
goodsIndex['07'] = "/goods/thisweek/chugoku_01.html";goodsIndex['04'] = "/goods/thisweek/chubu_01.html";goodsIndex['08'] = "/goods/thisweek/kyushu_01.html";goodsIndex['01'] = "/goods/thisweek/hokkaido_01.html";goodsIndex['05'] = "/goods/thisweek/hokuriku_01.html";goodsIndex['02'] = "/goods/thisweek/tohoku_01.html";goodsIndex['09'] = "/goods/thisweek/okinawa_01.html";goodsIndex['03'] = "/goods/thisweek/kanto_01.html";goodsIndex['06'] = "/goods/thisweek/kansai_01.html";
function goodsLink(){
	location.href=goodsIndex[regionCookie];
}


//先週の新商品一覧URL
var goodsIndex2 = new Array;
goodsIndex2['07'] = "/goods/thisweek/chugoku_02.html";goodsIndex2['04'] = "/goods/thisweek/chubu_02.html";goodsIndex2['08'] = "/goods/thisweek/kyushu_02.html";goodsIndex2['01'] = "/goods/thisweek/hokkaido_02.html";goodsIndex2['05'] = "/goods/thisweek/hokuriku_02.html";goodsIndex2['02'] = "/goods/thisweek/tohoku_02.html";goodsIndex2['09'] = "/goods/thisweek/okinawa_02.html";goodsIndex2['03'] = "/goods/thisweek/kanto_02.html";goodsIndex2['06'] = "/goods/thisweek/kansai_02.html";
function goodsLink2(){
	location.href=goodsIndex2[regionCookie];
}


//先々週の新商品一覧URL
var goodsIndex3 = new Array;
goodsIndex3['07'] = "/goods/thisweek/chugoku_03.html";goodsIndex3['04'] = "/goods/thisweek/chubu_03.html";goodsIndex3['08'] = "/goods/thisweek/kyushu_03.html";goodsIndex3['01'] = "/goods/thisweek/hokkaido_03.html";goodsIndex3['05'] = "/goods/thisweek/hokuriku_03.html";goodsIndex3['02'] = "/goods/thisweek/tohoku_03.html";goodsIndex3['09'] = "/goods/thisweek/okinawa_03.html";goodsIndex3['03'] = "/goods/thisweek/kanto_03.html";goodsIndex3['06'] = "/goods/thisweek/kansai_03.html";
function goodsLink3(){
	location.href=goodsIndex3[regionCookie];
}



//キャンペーントップURL
var campaignIndex = new Array;
campaignIndex['07'] = "/campaign/chugoku.html";campaignIndex['04'] = "/campaign/chubu.html";campaignIndex['08'] = "/campaign/kyusyu.html";campaignIndex['01'] = "/campaign/hokkaido.html";campaignIndex['05'] = "/campaign/hokuriku.html";campaignIndex['02'] = "/campaign/touhoku.html";campaignIndex['09'] = "/campaign/okinawa.html";campaignIndex['03'] = "/campaign/kantou.html";campaignIndex['06'] = "/campaign/kansai.html";
function campaignLink(){
	location.href=campaignIndex[regionCookie];
}

