//--------------------------------------------------------------------
function getRelatedProduct(){
var param = "";
for(var i=1;i<=100;i++){
var id="rpid_" + i;
var id2="rsid_" + i;
if(document.getElementById(id) && document.getElementById(id2) && document.getElementById(id).checked == true){
param += "&rpid[" + document.getElementById(id).value + "]=" + document.getElementById(id2).value;
}
}
return param;
}
function changeTab(type){
var elm1=document.getElementById('product_shop_lists_all');
var elm2=document.getElementById('product_shop_lists_new');
var elm3=document.getElementById('product_shop_lists_used')
var tab1=document.getElementById('product_shop_list_bar_all');
var tab2=document.getElementById('product_shop_list_bar_new');
var tab3=document.getElementById('product_shop_list_bar_used')
if(type=='1'){
elm1.style.display="block";
elm2.style.display="none";
elm3.style.display="none";
tab1.classList.add("product_shop_list_bar_on");
tab2.classList.remove("product_shop_list_bar_on");
tab3.classList.remove("product_shop_list_bar_on");
return;
}
if(type=='2'){
elm1.style.display="none";
elm2.style.display="block";
elm3.style.display="none";
tab1.classList.remove("product_shop_list_bar_on");
tab2.classList.add("product_shop_list_bar_on");
tab3.classList.remove("product_shop_list_bar_on");
return;
}
if(type=='3'){
elm1.style.display="none";
elm2.style.display="none";
elm3.style.display="block";
tab1.classList.remove("product_shop_list_bar_on");
tab2.classList.remove("product_shop_list_bar_on");
tab3.classList.add("product_shop_list_bar_on");
return;
}
}
function tglProductFavorite(pid,sid){
var id = "product_main_favorite_add";
var elm = document.getElementById(id);
setBtnLoading(elm,1);
var CB2="";
var PARAM="";
var url ="https://www.ishibashi.co.jp/ec/product/product_favorite_sv.php?pid=" + pid + "&sid=" + sid;
hsfwJs.ajaxGet(url,1,tglProductFavoriteCB,CB2,PARAM);
}
function tglProductFavoriteCB(res,ret,CB2,param){
var id = "product_main_favorite_add";
var elm = document.getElementById(id);
if(res != 1 || !hsfwJsBase.isJson(ret)){
elm.innerHTML = ret;
return;
}
var jobj=JSON.parse(ret);
if(jobj.ret_type==8){
// location.href = jobj.ret_val;
elm.innerHTML = jobj.ret_val;
return;
}
if(jobj.ret_type==9){
elm.innerHTML = jobj.ret_val;
return;
}
elm.innerHTML = jobj.ret_val;
if(CB2!=null && CB2!=""){
CB2(ret,param);
return;
}
return;
}
/*
function tglProductImgWin(src,pcd){
var url = "/ec/product/product_img_win_sv.php?pcd=" + pcd + "&src=" + src;
tglProductDialog(1,url,tglProductImgWinCB);
}
function tglProductImgWinCB(ret,param){
setProductSubwinSize(1);
}
function hoverProductSubwinArrow(dest,type){
if(dest=='1' && type=='1'){
document.getElementById('product_img_subwin_arrow_1_l').style.borderRightColor="#a9a9a9";
return;
}
if(dest=='1' && type=='0'){
document.getElementById('product_img_subwin_arrow_1_l').style.borderRightColor="#ffffff";
return;
}
if(dest=='2' && type=='1'){
document.getElementById('product_img_subwin_arrow_1_r').style.borderLeftColor="#a9a9a9";
return;
}
if(dest=='2' && type=='0'){
document.getElementById('product_img_subwin_arrow_1_r').style.borderLeftColor="#ffffff";
return;
}
}
function setProductSubwinSize(type){
if(type > 0){
var elm = document.getElementById('product_img_subwin');
var el = window.getComputedStyle(elm, null);
var h = el.height.replace("px","") - 110;
var elm = document.getElementById('product_img_subwin_main_fl');
elm.style.maxHeight = h + "px";
}else{
var elm = document.getElementById('product_img_subwin_main_center');
var el = window.getComputedStyle(elm, null);
var h = el.height.replace("px","") - 20;
var elm = document.getElementById('product_img_subwin_main_fl');
elm.style.maxHeight = h + "px";
}
}
function changeProductSubwinPic(src,type){
var elm = document.getElementById('product_img_subwin_main_fl');
if(src==""){
setProductSubwinSize(0);
var v = elm.src;
var a = v.match(/([0-9]+)_([0-9]+)_(.+)\.jpg/);
if(type==1){
var dest = a[2]*1 - 1;
}else{
var dest = a[2]*1 + 1;
}
var id = "product_img_subwin_sub_fl_" + dest;
if(document.getElementById(id)){
var src="/ec/pic/product/" + a[1] +"/" + a[1] + "_" + dest + "_l.jpg";
elm.src = src;
var id1 = "product_img_subwin_sub_fl_outer_" + a[2];
var id2 = "product_img_subwin_sub_fl_outer_" + dest;
document.getElementById(id1).style.borderColor="#cccccc";
document.getElementById(id2).style.borderColor="#000000";
}
}else{
setProductSubwinSize(0);
var a = src.match(/([0-9]+)_([0-9]+)_(.+)\.jpg/);
for(var i=1;i<=16;i++){
var id = "product_img_subwin_sub_fl_outer_" + i;
if(document.getElementById(id)){
document.getElementById(id).style.borderColor="#cccccc";
}
}
var id = "product_img_subwin_sub_fl_outer_" + a[2];
document.getElementById(id).style.borderColor="#000000";
elm.src = src;
}
}
*/
//----------------------
function tglProductImgWinSW(src,pcd){
var url = "https://www.ishibashi.co.jp/ec/product/product_img_win_sv.php?pcd=" + pcd + "&src=" + src;
tglProductDialog(1,url,tglProductImgWinSWCB);
}
//var mainPic;
//var thumPic;
mainPic="";
thumPic="";
function tglProductImgWinSWCB(ret,param){
/* thumPic = new Swiper('#product_img_swiper_thum', {
loop: false,
freeMode: false,
speed: 500,
}); */
/* add nakashima 20210427 -- */
var active = document.getElementById("product_main_fl");
var activeSlide = 0;
if(active){
var src = active.getAttribute("src");
var p = src.split("_");
var n = parseInt(p[1]);
if(n){
activeSlide = n-1;
}
}
/*--- add nakashima 20210427*/
mainPic = new Swiper('#product_img_swiper_main', {
loop: false,
initialSlide:activeSlide, //<-- add nakashima 20210427
navigation: {
nextEl: '#product_img_swiper_next',
prevEl: '#product_img_swiper_prev',
},
/* on:{
init: function () {
if(window.innerWidth <= 767){
var elm = document.getElementById('product_img_subwin');
var elm_w = document.getElementById('product_img_swiper_wrapper');
var sty = window.getComputedStyle(elm_w, null);
elm.style.width = (window.innerWidth - 60) + "px";
if(sty.height.replace("px","") > (window.innerHeight - 100)){
elm.style.height = (window.innerHeight - 60) + "px";
elm_w.style.height = (window.innerHeight - 180) + "px";
}
this.update();
}
},
slideChange: function () {
for(var i=0;i<16;i++){
var v = "product_img_swiper_thum_box_" + i;
if(document.getElementById(v)){
document.getElementById(v).style.borderColor="#cccccc";
}
}
var v = "product_img_swiper_thum_box_" + this.realIndex;
if(document.getElementById(v)){
document.getElementById(v).style.borderColor="#000000";
}
}
},
thumbs: {
swiper: thumPic
} */
});
var h = hsfwJs.getStyle(document.getElementById('product_img_swiper_main'),"height").replace("px","");
h = h/2 - 20;
document.getElementById('product_img_swiper_left').style.paddingTop= h + "px";
document.getElementById('product_img_swiper_right').style.paddingTop= h + "px";
}
//----------------------
function tglProductDialog( type, url, CB2 ) {
var elm_1 = document.getElementById("product_dialog");
var elm_2 = document.getElementById("product_dialog_box");
var elm_3 = document.getElementById("product_dialog_close");
if ( !hsfwJsBase.isset(type) || elm_1.style.top == "100%" ) {
document.body.style.position = "relative";
elm_2.innerHTML = "";
elm_1.classList.remove("ec_product_modal_act1");
return;
} else {
document.body.style.position = "fixed";
elm_1.classList.add("ec_product_modal_act1");
if ( type == 1 ) {
hsfwJs.ajaxGet( url, 1, tglProductDialogCB, CB2, "" );
} else if ( type==2 || type==3 ) {
if ( type == 2 ) {
elm_2.innerHTML = url;
} else {
elm_2.innerHTML = decodeURIComponent( escape( atob( url ) ) );
}
}
return;
}
}
function tglProductDialogCB(res,ret,CB2,param){
var elm = document.getElementById("product_dialog_box");
if(res != 1 || !hsfwJsBase.isJson(ret)){
elm.innerHTML = ret;
// tglProductDialogPosi();
return;
}
var jobj=JSON.parse(ret);
if(jobj.ret_type==8){
location.href = jobj.ret_val;
return;
}
if(jobj.ret_type==9){
elm.innerHTML = jobj.ret_val;
// tglProductDialogPosi();
return;
}
elm.innerHTML = jobj.ret_val;
tglProductDialogPosi();
if(CB2!=null && CB2!=""){
CB2(ret,param);
return;
}
return;
}
function tglProductDialogPosi(){
/*
var h = window.innerHeight;
var elm_product = document.getElementById("product_dialog");
var sty = window.getComputedStyle(elm_product, null);
sty.height.replace("px","")
var h2 = sty.height.replace("px","");
if( ( h - 10 ) < h2 ) {
elm_product.style.height=(h - 60) + "px";
elm_product.style.overflow = "scroll";
}
*/
/*
var h = window.innerHeight;
var elm_2 = document.getElementById("tmp1_dialog_box");
var elm_3 = document.getElementById("tmp1_dialog_close");
var m = h*0.2;
elm_2.style.marginTop= m + "px";
st = window.getComputedStyle(elm_2, null);
var st_h = st.height.replace("px","");
if(st_h > h*0.6){
elm_2.style.height = h*0.6 + "px";
elm_2.style.overflow = "scroll";
}
*/
}