﻿function PreImg() {
	var d=document;
	if(d.images){
		if(!d.CCEp){
			d.CCEp=new Array();
		}
	}
	var i,j=d.CCEp.length;
	var a=PreImg.arguments;
	for(i=0; i<a.length; i++){
		if (a[i].indexOf("#")!=0){
			d.CCEp[j]=new Image;
			d.CCEp[j++].src=a[i];
		}
	}
}

function Obj(n, d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=Obj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function SwapImg() {
	var i,j=0,x;
	var a=SwapImg.arguments;
	document.CCEsr=new Array;
	for(i=0;i<(a.length-1);i+=2){
		if ((x=Obj(a[i]))!=null){
			document.CCEsr[j++]=x;
			if(!x.oSrc) x.oSrc=x.src;
			x.src=a[i+1];
		}
	}
}

function Restore() {
	var i,x,a=document.CCEsr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){
		x.src=x.oSrc;
	}
}

function chkPayment(){
	var chk = document.orderform.paymentck.checked;
	if(chk == true){
		for(i=0;i<3;i++){
			document.orderform.payment[i].disabled = true;
		}
	} else {
		for(i=0;i<3;i++){
			document.orderform.payment[i].disabled = false;
		}
	}
}

function openAns(Num) {
 var ansName = "ans" + Num;
 subCategory = document.getElementById(ansName).style;
 if(subCategory.display == 'none') subCategory.display = "block"
 else subCategory.display = "none"
 
 var catName = "guidecat0" + Num;
 catActive = document.getElementById(catName).style;
 if(catActive.display == 'none') catActive.display = "block"
 else catActive.display = "none"
}

function openAns1(Num) {
 var ansName = "ans" + Num;
 subCategory = document.getElementById(ansName).style;
 if(subCategory.display == 'none') subCategory.display = "block"
 else subCategory.display = "none"
 
 var catName = "fcat0" + Num;
 catActive = document.getElementById(catName).style;
 if(catActive.display == 'none') catActive.display = "block"
 else catActive.display = "none"
}

function aOver(Num) {
	var catOver = "catover0" + Num;
 document.getElementById(catOver).style.visibility = 'visible';
}
function aOut(Num) {
	var catOver = "catover0" + Num;
 document.getElementById(catOver).style.visibility = 'hidden';
}

function openWin(Num) {
	if(Num=="430")
	{
		URL = "http://web-cache.stream.ne.jp/web/selector/suntory_viewer/smart.html?health/gomapepucha/matsudasan";
		movie = window.open(URL,"movie","resizable=yes,width=570,height=610");
	}
	else if(Num=="72000")
	{
		URL = "http://web-cache.stream.ne.jp/web/selector/suntory_viewer/smart.html?health/diets/announcer";
		movie = window.open(URL,"movie","resizable=yes,width=570,height=610");
	}
}

function openPop1(URL) {
	popup = window.open(URL,"popup","resizable=yes,width=430,height=420");
}
function openPop2(URL) {
	mail = window.open(URL,'mail','scrollbars=yes, width=500, height=600');
}
function openPop3(URL) {
	mail = window.open(URL,'mail','scrollbars=yes, width=600, height=520');
}
function openPop4(){
	popup = window.open("http://www.suntory.co.jp/enjoy/movie/viewer/player.html?pver=normal&pid=conoha_30s&band=medium","","resizable=yes,scrollbars=yes,toolbar=no,menubar=no,directories=no,status=yes,location=no");
	if (!popup.opener) popup.opener=self;
	if (window.focus) popup.focus();
}
function openPop5(URL) {
	popup = window.open(URL,"popup","resizable=yes,width=440,height=420");
}

function openWindow(URL,wname,w,h){
	var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
 if (w) {
  if (window.screen.width > w)
   features+=", left="+(window.screen.width-w)/2;
  else w=window.screen.width;
  features+=", width="+w;
 }
 if (h) {
  if (window.screen.height > h)
   features+=", top="+(window.screen.height-h)/2;
  else h=window.screen.height;
  features+=", height="+h;
 }
 window.open(URL,wname,features);
}


function openPopup(URL){
	w = window.open(URL,"wNew",'status=yes, scrollbars=yes, location=yes, directories=yes, menubar=yes, resizable=yes, toolbar=yes');
}
function openPopup2(URL){
	w = window.open(URL,"wNew",'status=yes, scrollbars=yes, location=no, directories=no, menubar=no, resizable=yes, toolbar=no');
}

function openEnq(Num){
	if(Num=="1"){
		URL="../enquete/item01.html";
		page=window.open(URL,"page1","resizable=yes,scrollbars=yes,width=570,height=190");
	}else if(Num=="2"){
		URL="../enquete/item02.html";
		page=window.open(URL,"page2","resizable=yes,scrollbars=yes,width=570,height=190");
	}else if(Num=="3"){
		URL="../enquete/item03.html";
		page=window.open(URL,"page3","resizable=yes,scrollbars=yes,width=570,height=302");
	}else if(Num=="4"){
		URL="../enquete/item04.html";
		page=window.open(URL,"page4","resizable=yes,scrollbars=yes,width=570,height=184");
	}else if(Num=="5"){
		URL="../enquete/item05.html";
		page=window.open(URL,"page5","resizable=yes,scrollbars=yes,width=570,height=196");
	}else if(Num=="6"){
		URL="../enquete/item06.html";
		page=window.open(URL,"page6","resizable=yes,scrollbars=yes,width=570,height=285");
	}else if(Num=="7"){
		URL="../enquete/item07.html";
		page=window.open(URL,"page7","resizable=yes,scrollbars=yes,width=570,height=285");
	}else if(Num=="8"){
		URL="../enquete/item08.html";
		page=window.open(URL,"page8","resizable=yes,scrollbars=yes,width=570,height=190");
	}else if(Num=="9"){
		URL="../enquete/item09.html";
		page=window.open(URL,"page9","resizable=yes,scrollbars=yes,width=570,height=190");
	}
}

function GoWin(WO){
	if(opener.closed){
		newWin=window.open("","MWindow");
		newWin.location.href=WO;
	}
	else{opener.location.href=WO}
}

// <![CDATA[

var tab = {
	init: function(){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		
		for(i=0; i<pages.length; i++) {
			if(i !== 0) pages[i].style.display = 'none';
			tabs[i].onclick = function(){ tab.showpage(this); return false; };
		}
	},
	
	showpage: function(obj){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		var num;
		
		for(num=0; num<tabs.length; num++) {
			if(tabs[num] === obj) break;
		}
		
		for(var i=0; i<pages.length; i++) {
			if(i == num) {
				pages[num].style.display = 'block';
				tabs[num].className = 'present';
			}
			else{
				pages[i].style.display = 'none';
				tabs[i].className = null;
			}
		}
	}
}

// ]]>

// added 080625
function getOSType(){
    var uAgent  = navigator.userAgent;
    if (uAgent.match(/Win(dows )?NT 6\.1/)) return "Windows7";
				if (uAgent.match(/Win(dows )?NT 6\.0/)) return "WindowsVista";
				if (uAgent.match(/Win(dows )?(NT 5\.1|XP)/)) return "WindowsXP";
				if (uAgent.match(/Win(dows)? (9x 4\.90|ME)/)) return "WindowsME";
				if (uAgent.match(/Win(dows )?(NT 5\.0|2000)/)) return "Windows2000";
				if (uAgent.match(/Win(dows )?98/)) return "Windows98";
				if (uAgent.match(/Win(dows )?NT( 4\.0)?/)) return "WindowsNT";
				if (uAgent.match(/Win(dows )?95/)) return "Windows95";
    if (uAgent.match(/Mac|PPC/)) return "MacOS";
    if (uAgent.match(/Linux/)) return "Linux";
    return "";
}
function getBrowserName(){
    var aName  = navigator.appName.toUpperCase();
    var uName = navigator.userAgent.toUpperCase();
    if (uName.indexOf("SAFARI") >= 0)  return "Safari";
    if (uName.indexOf("OPERA") >= 0)  return "Opera";
    if (uName.indexOf("FIREFOX") >= 0)  return "Firefox";
    if (aName.indexOf("NETSCAPE") >= 0)  return "Netscape";
    if (aName.indexOf("MICROSOFT") >= 0) return "Explorer";
    return "";
}
function getBrowserVersion(){
	var browser = getBrowserName();
	var version = 0;
	var s = 0;
	var e = 0;
	var appVer  = navigator.appVersion;
	var uName  = navigator.userAgent.toUpperCase();
	if (browser == "Safari")
	{
		s = uName.indexOf("SAFARI/",0);
		version = (uName.substring(s+7,s+99));
		if (version < 400) version = 1;
		if ((version >= 400) < (version <= 499)) version = 2;
		if (version >= 500) version = 3;
	}
	if (browser == "Opera")
	{
		s = uName.indexOf("OPERA",0) + 6;
		e = uName.indexOf(" ",s);
		version = parseFloat(uName.substring(s,e));
	}
	if (browser == "Firefox")
	{
		s = uName.indexOf("FIREFOX/",0);
		version = parseFloat(uName.substring(s+8,s+8+3));
	}
	if (browser == "Netscape")
	{
		s = appVer.indexOf(" ",0);
		version = eval(appVer.substring(0,s));
		if (version >= 5) version++;
	}
	if (browser == "Explorer")
	{
		appVer  = navigator.userAgent;
		s = appVer.indexOf("MSIE ",0) + 5;
		e = appVer.indexOf(";",s);
		version = eval(appVer.substring(s,e));
	}
	return version;
}

function getBrowser(){
	window.resizeTo(650, 800);
	os = getOSType();
	browser = getBrowserName();
	version = getBrowserVersion();
	if(browser == "Explorer") browser = "Internet Explorer"
	document.write("ご利用のブラウザは、<br /><span class='hi-light-orange'>" + os + "&nbsp;版&nbsp;" + browser + "&nbsp;ver." + version + "</span>&nbsp;です。<br />");
	if(os == "MacOS"){
		if (browser == "Safari") {
			if(version >= 3){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else if (browser == "Opera") {
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Firefox") {
			if(version >= 3){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else if (browser == "Netscape") {
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Internet Explorer") {
			document.write("当サイト推奨環境ではありません。");
		} else {
			document.write("当サイト推奨環境ではありません。");
		}
	}
	if(os == "Windows7"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "WindowsVista"){
		if(browser == "Opera"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Firefox"){
			if(version >= 3){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else if (browser == "Netscape"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Safari"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Internet Explorer"){
			if(version >= 7){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else {
			document.write("当サイト推奨環境ではありません。");
		}
	}
	if(os == "WindowsXP"){
		if(browser == "Opera"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Firefox"){
			if(version >= 3){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else if (browser == "Netscape"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Safari"){
			document.write("当サイト推奨環境ではありません。");
		} else if (browser == "Internet Explorer"){
			if(version >= 6){
				document.write("当サイト推奨環境です。");
			} else {
				document.write("当サイト推奨環境ではありません。");
			}
		} else {
			document.write("当サイト推奨環境ではありません。");
		}
	}
	if(os == "WindowsME"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "Windows2000"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "Windows98"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "WindowsNT"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "Windows95"){
		document.write("当サイト推奨環境ではありません。");
	}
	if(os == "Linux"){
		document.write("当サイト推奨環境ではありません。");
	}
	document.write("</p>")
}


function checkCookie(){
	setCookie("Str", "test");
	dddd = getCookie( "Str" );
	if( dddd == "test" ){
		document.write("<p class='px12'>Cookieの設定に問題はございません。</p></div>");
	} else {
		document.write("<p>お買物を楽しんでいただくために、ご利用のブラウザのCookieの設定を有効にしてください。</p><h2 class='px12'>【設定方法】</h2><p>■Windows：Internet Explorer（IE）の場合</p><ol><li>ブラウザのメニューバーから、「ツール」＞「インターネットオプション」＞「セキュリティ」を開いてください。</li><li>「インターネット」＞「レベルのカスタマイズ」を開いてください。</li><li>「Cookie」＞「コンピュータに保存されているCookieの使用許可」および、「セッションごとのCookieの使用許可（保存なし）」の「有効にする」をチェックしてください。</li></ol><p class='tm15'>■MacOS：Safariの場合</p><ol><li>ブラウザのメニューバーから、「Safari」＞「環境設定」＞「セキュリティ」を開いてください。</li><li>「Cookieの受け入れ」を「常に受け入れる」にしてください。</li></ol>");
	}
}
function getCookie(key, tmp1, tmp2, xx1, xx2, xx3){
	tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}
function setCookie(key, val, tmp){
    tmp = key + "=" + escape(val) + "; ";
    tmp += "expires=Fri, 31-Dec-2030 23:59:59; ";
    document.cookie = tmp;
}
function clearCookie(key){
    document.cookie = key + "=" + "xx; expires=1-Jan-1997 00:00:00;";
}

//function getOSType(){
//	str = navigator.userAgent.toUpperCase();
//	if (str.indexOf("MAC") >= 0) return "MacOS";
//	if (str.indexOf("WIN") >= 0) return "Windows";
//	if (str.indexOf("X11") >= 0) return "UNIX";
//	return "不明";
//}

// added for menu 080728
function openFaq1() {
var faqName = "faqblock1";
 subFirst = document.getElementById(faqName).style;
 if(subFirst.display == 'none') subFirst.display = "block"
}
function openFaq2() {
var faqName = "faqblock1";
 subFirst = document.getElementById(faqName).style;
 if(subFirst.display == 'none') subFirst.display = "block"
 else subFirst.display = "none"
}

// added for mail sample 100222
function mailSample(tabnum){
	tabImage = document.getElementById('mail-image').style;
	tabText = document.getElementById('mail-text').style;
	if (tabnum == 1){
		tabImage.display = "block";
		tabText.display = "none";
	} else if (tabnum == 2){
		tabImage.display = "none";
		tabText.display = "block";
	} else {
		tabImage.display = "block";
		tabText.display = "none";
	} 
}

//var img = new Array();
//img[0]=new Image();img[0].src="../common/img/faq_qbg01_r.gif";
//img[1]=new Image();img[1].src="../common/img/faq_qbg01_n.gif";
//img[2]=new Image();img[2].src="/content/images/img/inqfaq_qbg01_r.gif";
//img[3] = new Image(); img[3].src = "/content/images/img/inqfaq_qbg01_n.gif";
//function chBkFaq(x,y){
// if(document.getElementById){
//  document.getElementById(x).style.backgroundImage='url('+img[y].src+')';
// }
// else if(document.all){
//  document.all(x).style.backgroundImage='url('+img[y].src+')';
// }
//}


function convM(Mail){
 var a="",c="";
 for(i=0; i<Mail.length; i++){
  c=Mail.charCodeAt(i);
  a +=String.fromCharCode(c+1);
 }
 return a;
}
function wMail() {
 var m=convM(String.fromCharCode(104,109,101,110,63,114,116,109,115,110,113,120) + String.fromCharCode(44,106,100,109,106,110,45,98,110,108));
 document.write('<a href="mai' + 'lto:' + m + '">' + m + '</a>');
}
function wMail2() {
 var m=convM(String.fromCharCode(104,109,101,110,63,114,116,109,115,110,113,120) + String.fromCharCode(44,106,100,109,106,110,45,98,110,108));
 document.write('<a href="mai' + 'lto:' + m + '" class="link-marker01">' + m + '</a>');
}



function teikiChk(){
	var teikidate = document.getElementById('teiki-date');
	var teiki = document.getElementById('teiki').checked;
	if(teikidate){
		if(teiki == true){
			teikidate.style.display = 'none';
		} else if(teiki == false){
			teikidate.style.display = 'block';
		}
	}
}

function passwdCh(){
	var passwdbox = document.getElementById('passwd-box');
	var passwdch = document.getElementById('ch-passwd').checked;
	if(passwdbox){
		if(passwdch == true){
			passwdbox.style.display = 'block';
		} else if(passwdch == false){
			passwdbox.style.display = 'none';
		}
	}
}

//function openHistory(num){
//	var hnum = 'hnum' + num;
//	var hbox = document.getElementById(hnum);
//	var bnum = 'bnum' + num;
//	var bimg = document.getElementById(bnum);
//	var hflag = 0;
//	if(hflag == 0){
//		document.getElementById(hnum).className == 'hbox1';
//		bimg.src = '../../common/img/btn_closedetail_n.jpg';
//		flag = 1;
//	} else if(hflag == 1){
//		document.getElementById(hnum).className == 'hbox0';
//		bimg.src = '../../common/img/btn_opendetail_n.jpg';
//		flag = 0;
//	}
//}

// for flash

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function topBtnarea(Num){
	if(Num == 0){
		document.getElementById('top_header_btnarea').style.display = 'none';
	} else if (Num == 1){
		document.getElementById('top_header_btnarea').style.display = "block";
	} else {
		document.getElementById('top_header_btnarea').style.display = "block";
	}
}

function rList(){
	var rRecomendList = document.getElementById('rRecomendList');
	var liTagNum = rRecomendList.getElementsByTagName('li').length;
	var lastNode = rRecomendList.getElementsByTagName('li').item(liTagNum - 1);
	lastNode.setAttribute('class','last-child');
}

function payterms(obj){
	var payterm = document.getElementById('payterm');
	if(payterm){
		with(obj)
		var thisoption = options[selectedIndex].value;
		if(thisoption == "7"){
			payterm.style.display = 'block';
		}else if(thisoption == "1"){
			payterm.style.display = 'block';
		}else{
			payterm.style.display = 'none';
		}
	}
}

