document.write('<link rel="Shortcut Icon" href="favicon.ico">');
document.write('<link rel="Bookmark" href="favicon.ico">');

//onload Script

window.onload = function() {
	initRollovers();
	myAgent = navigator.userAgent;
	if(myAgent.indexOf("MSIE") >= 0) {
		myBrow = "MSIE";
	}else if(myAgent.indexOf("Firefox") >= 0) {
		myBrow = "Firefox";
	}else {
		myBrow = "unknown";
	}

	if(cookie == "standard") {
		document.getElementById('fontsize_change_s').setAttribute('src','/imgs/common/fontsize_change_s.gif');
		document.getElementById('fontsize_change_l').setAttribute('src','/imgs/common/fontsize_change_l.gif');
		document.getElementById('fontsize_change_m').setAttribute('src','/imgs/common/fontsize_change_m_act.gif');
	}else if(cookie == "alternate1") {
		document.getElementById('fontsize_change_m').setAttribute('src','/imgs/common/fontsize_change_m.gif');
		document.getElementById('fontsize_change_l').setAttribute('src','/imgs/common/fontsize_change_l.gif');
		document.getElementById('fontsize_change_s').setAttribute('src','/imgs/common/fontsize_change_s_act.gif');
	}else if(cookie == "alternate2") {
		document.getElementById('fontsize_change_s').setAttribute('src','/imgs/common/fontsize_change_s.gif');
		document.getElementById('fontsize_change_m').setAttribute('src','/imgs/common/fontsize_change_m.gif');
		document.getElementById('fontsize_change_l').setAttribute('src','/imgs/common/fontsize_change_l_act.gif');
	}
}

//Script For Popup New Window

var url;
function newPopupWin(url)
{
	var newPopupWin;
	newPopupWin = window.open(url,"newPopupWin","status=0,resizable=1,scrollbars=1,toolbar=0,directories=0,scrolling=1,menubar=1,location=0,width=720,height=700,");
	newPopupWin.focus();
}

function newPopupWin01(url)
{
	var newPopupWin01;
	newPopupWin01 = window.open(url,"newPopupWin01","status=0,resizable=1,scrollbars=1,toolbar=0,directories=0,scrolling=1,menubar=1,location=0,width=720,height=500,");
	newPopupWin01.focus();
}

function newPopupWin02(url)
{
	var newPopupWin02;
	newPopupWin = window.open(url,"newPopupWin02","status=0,resizable=1,scrollbars=1,toolbar=0,directories=0,scrolling=1,menubar=1,location=0,width=790,height=700,");
	newPopupWin.focus();
}

//Script For New Window : Brand page

var url;
function newWinB(url)
{
	var newWinB;
	newWinB = window.open(url,"newWinB","status=0,resizable=1,scrollbars=1,toolbar=1,directories=0,scrolling=1,menubar=1,location=1,width=1100,height=768,");
	newWinB.focus();
}

var url;
function newWinC(url)
{
	var newWinC;
	newWinC = window.open(url,"newWinC","status=1,resizable=1,scrollbars=1,toolbar=1,directories=1,scrolling=1,menubar=1,location=1,width=1100,height=768,");
	newWinC.focus();
}

var parWinUrl;
//function parWinChange(parWinUrl){
//		if ((!!window.opener) && (window.opener.closed == false)){
//			window.opener.location.href = parWinUrl;
//			blur();
//		}
//		else {
//			newWinC(parWinUrl);
//		}
//	}
function parWinChange(parWinUrl){
	window.location.href = parWinUrl;
}



//Script For Close Popup Window
function popupClose() {
	window.close();
}

//Script For Change Image
function initRollovers() {
	if (!document.getElementById) return
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	var iImages = document.getElementsByTagName('input');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className.indexOf('imgover') != -1) {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}				

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}

	for (var i = 0; i < iImages.length; i++) {	
		if (iImages[i].className.indexOf('imgover') != -1) {
			var src = iImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			iImages[i].setAttribute('hsrc', hsrc);	
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;		

			iImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	

			iImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}


//文字サイズ切替
var act;
var def1;
var def2;
function activeImg(act,def1,def2){
	document.getElementById(act).setAttribute('src','/imgs/common/' + act + '_act.gif');
	document.getElementById(def1).setAttribute('src','/imgs/common/' + def1 + '.gif');
	document.getElementById(def2).setAttribute('src','/imgs/common/' + def2 + '.gif');
}
var over;
function overImg(over){
	var srcPass = document.getElementById(over).src;
	if(srcPass.indexOf("_act") !== -1){
	}else{
		document.getElementById(over).setAttribute('src','/imgs/common/' + over + '_on.gif');
	}
}
var out;
function outImg(out){
	var srcPass = document.getElementById(out).src;
	if(srcPass.indexOf("_act") !== -1){
	}else{
		document.getElementById(out).setAttribute('src','/imgs/common/' + out + '.gif');
	}
}


//サイトトップ　What's Newタブ切替
var show01;
var hide01;
function changeNewsTab(show01,hide01){
		document.getElementById(show01 + "Box").style.display = "block";
		document.getElementById(hide01 + "Box").style.display = "none";
		document.getElementById(show01 + "_tab").setAttribute('src','/imgs/top/' + show01 + '_tab_on.gif');		
		document.getElementById(hide01 + "_tab").setAttribute('src','/imgs/top/' + hide01 + '_tab.gif');
}

//What's New　タブ切替
var act01;
var def01;
var def02;
function changeNewsTab02(act01,def01,def02){
		document.getElementById("tab_news_" + act01).setAttribute('src','/imgs/common/tab_news_' + act01 + '_on.gif');		
		document.getElementById("tab_news_" + def01).setAttribute('src','/imgs/common/tab_news_' + def01 + '.gif');
		document.getElementById("tab_news_" + def02).setAttribute('src','/imgs/common/tab_news_' + def02 + '.gif');
}


//商品詳細サムネイル写真のマウスオーバー

//function hoverThumb(imgId){
//	document.getElementById(imgId).style.borderColor = "#cc0000";
//}
//function outThumb(imgId){
//	document.getElementById(imgId).style.borderColor = "#eeeeee";
//}

//商品詳細写真の切り替え
var imgId;
var imgSrc;
function changePic(imgId){
	var countThumb = document.getElementsByName("picThumb").length;
	thumbArray = new Array();
	for(i=1;i<=countThumb;i++){
		thumbArray[i] = "thumb" + i;
	}
	for(i=1;i<=countThumb;i++){
		if(thumbArray[i] == imgId){
			document.getElementById(thumbArray[i]).style.borderColor = "#cc0000";
		}else{
			document.getElementById(thumbArray[i]).style.borderColor = "#eeeeee";
		}
	}
	var imgSrc = document.getElementById(imgId).src;
	var sendImgSrc = imgSrc.replace(/s.jpg/,"l.jpg");
	var itemPicSrc = document.getElementById("itemPic").src;
	document.getElementById("itemPic").setAttribute('src',sendImgSrc);
}


//商品詳細　栄養価の切り替え
options = new Array;
function patternChange(sel) {
	for (i=1;i<=sel.options.length;i++){
		document.getElementById("pattern" + i).style.display = "none";
	}
	if(sel.options[sel.selectedIndex].value) {
		document.getElementById("pattern" + sel.options[sel.selectedIndex].value).style.display = "block";
	}
}


//レシピ　条件検索タブ切替
var show;
var hide;
function changeTab(show,hide){
		document.getElementById(show).style.display = "block";
		document.getElementById(hide).style.display = "none";
		document.getElementById(show + "_tab").setAttribute('src','/imgs/recipe/common/tab_search_' + show + '_on.gif');		
		document.getElementById(hide + "_tab").setAttribute('src','/imgs/recipe/common/tab_search_' + hide + '.gif');
}

//レシピ　詳細写真の切り替え
var imgId;
var imgSrc;
function changePic2(imgId){
	var countThumb = document.getElementsByName("picThumb").length;
	thumbArray = new Array();
	for(i=1;i<=countThumb;i++){
		thumbArray[i] = "thumb" + i;
	}
	for(i=1;i<=countThumb;i++){
		if(thumbArray[i] == imgId){
			document.getElementById(thumbArray[i] +"_list").style.backgroundImage = "url(/imgs/recipe/detail/bg_thumb_frame_act.gif)";
		}else{
			var test = document.getElementById(thumbArray[i] +"_list").style.backgroundImage = "url(/imgs/recipe/detail/bg_thumb_frame_def.gif)";
		}
	}
	var imgSrc = document.getElementById(imgId).src;
	var sendImgSrc = imgSrc.replace(/s.jpg/,"l.jpg");
	var itemPicSrc = document.getElementById("itemPic").src;
	document.getElementById("itemPic").setAttribute('src',sendImgSrc);
}


//CM紹介　各カテゴリーへの移動
options = new Array;
function cmChange(sel) {
	if(sel.options[sel.selectedIndex].value) {
		location.href = sel.options[sel.selectedIndex].value;
	}
}

//販売終了商品　年代切り替え
options = new Array;
function fdChange(sel) {
	for(i=0;i<sel.options.length;i++){
		document.getElementById("year" + sel.options[i].value).style.display = "none";
		document.getElementById("fd" + sel.options[i].value).style.display = "none";
	}
	if(sel.options[sel.selectedIndex].value) {
		document.getElementById("year" + sel.options[sel.selectedIndex].value).style.display = "block";
		document.getElementById("fd" + sel.options[sel.selectedIndex].value).style.display = "block";
	}
}

//ファンボイス　バックナンバープルダウン
function overBKList(){
	document.getElementById('bkList').style.display = "block";
}

function outBKList(){
	document.getElementById('bkList').style.display = "none";
}
