/* 画像プレロード */
function preloadImg(imgName) {
 for (var i = 0; i < imgName.length; i++) {
  if (document.images) (new Image()).src = imgName[i];
 }
}
var mnImages = new Array(
'/shop/item/scshop/design/img01/bg_first_on.gif',
'/shop/item/scshop/design/img01/bg_last_on.gif',
'/shop/item/scshop/design/img01/bg_next_on.gif',
'/shop/item/scshop/design/img01/bg_prev_on.gif',
'/shop/item/scshop/design/img01/shop_header_menu0.gif',
'/shop/item/scshop/design/img01/shop_header_menu1.gif',
'/shop/item/scshop/design/img01/shop_header_menu2.gif',
'/shop/item/scshop/design/img01/shop_header_menu3.gif',
'/shop/item/scshop/design/img01/shop_header_menu4.gif',
'/shop/item/scshop/design/img01/shop_header_menu5.gif',
'/shop/item/scshop/design/img01/shop_header_menu6.gif',
'/shop/item/scshop/design/img01/shop_header_menu7.gif',
'/shop/item/scshop/design/img01/shop_header_mm.gif',
'/shop/item/scshop/design/img01/shop_header_mm1-1.gif',
'/shop/item/scshop/design/img01/shop_header_mm1-2.gif',
'/shop/item/scshop/design/img01/shop_header_mm2.gif',
'/shop/item/scshop/design/img01/shop_header_mm3.gif');
preloadImg(mnImages);

/* ポップアップウィンドウ */
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

/* ポップアップ・家具のサイズ詳細 */
function kagusize(theURL) {
  window.open(theURL,'kagusize','menubar=no,scrollbars=yes,resizable=yes,width=660,height=600');
    return;
}

/*ポップアップ・コーディネート */
function w_coordinate(theURL) {
  window.open(theURL,'coordinate','menubar=no,scrollbars=yes,resizable=yes,width=500,height=800').focus();
    return;
}
// サブウィンドウから親ウィンドウのURLを変更する
function w_dtlURL(theURL) {
  window.opener.location.href=theURL;
}


/* 折りたたみ */
function expand(URI,SUB,EXP){
  if(document.getElementById) {
    if(document.getElementById(SUB).style.display) {
      if(URI != 0) {
        document.getElementById(SUB).style.display = "block";
        document.getElementById(EXP).style.display = "none";
      } else {
        document.getElementById(SUB).style.display = "none";
        document.getElementById(EXP).style.display = "block";
      }
    } else {
      location.href = URI;
      return true;
    }
  } else {
    location.href = URI;
    return true;
  }
}


/* おまかせ！ログレコメンダー */
document.write('<script type="text/javascript" src="https://log3.recommender.jp/js/logrecom.js"></script>');
/* 商品詳細ページ他：GoodsIDで取得する */
(function(initial){
	var addClick = function(){};
	if (window.addEventListener) {
		if (initial === 1) {
			window.addEventListener('load',arguments.callee,false);
			return;
		}
		addClick = function(element,func){element.addEventListener('click',func,false);};
	} else if (window.attachEvent) {
		if (initial === 1) {
			window.attachEvent('onload',arguments.callee);
			return;
		}
		addClick = function(element,func){element.attachEvent('onclick',func);};
	}

	if (/\/ShoppingCart\.html/.test(location.pathname)){
		var sub = document.getElementById('submit_0');
		var form = document.getElementById('form');
		if (sub && form && /tr/i.test(sub.parentNode.parentNode.tagName)) {
			var productimg, tmp=[], productimgs = sub.parentNode.parentNode.parentNode.getElementsByTagName('img');
			for (var i = 0, l = productimgs.length; i < l; ++i) if (/goods\/\d+_thumbnail/.test(productimgs[i].src)) tmp.push(productimgs[i].src);
			var src = tmp.pop();
			if (src && /(\d+)_thumbnail/.test(src) ) {
				var goodsid = /(\d+)_thumbnail/.exec(src)[1];
				var div,div2;
				if (!document.getElementById('logrecom_placeholder')){
					div = document.createElement('div');
					div.id = 'logrecom_placeholder';
					form.appendChild(div);
				}
				if (!document.getElementById('logrecom')){
					div2 = document.createElement('div');
					div2.id = 'logrecom';
					form.appendChild(div2);
				}
				logrecom_type_additional('studio_clip', goodsid, 2);
			}
		}
	}

	var input = document.getElementById("toCart");
	if (!input) return;
	var cartlog = function(){
		setTimeout("logrecom_cart_log('studio_clip',2,document.getElementsByName('goodsId')[0].value)",1);
		return setTimeout("canSubmit()",1);
	};
	addClick(input,cartlog);

})(1);
