﻿//katashiki.js  since 08.12.19 by t_m

function jump_mitsumori(vfrm)
{
     
    if ((vfrm.select1.selectedIndex > 0)&&
        (vfrm.select2.selectedIndex > 0)&&(vfrm.select2.selectedIndex < 4)&&
        (vfrm.select3.selectedIndex > 0)&&(vfrm.select3.selectedIndex < 4)&&
        (vfrm.select4.selectedIndex > 0)&&(vfrm.select4.selectedIndex < 3))
    {
        jpURL = "estimate.html?katashiki=" + vfrm.katashiki.value + "&kataoption=" + vfrm.katoption.value;
        location.href = jpURL;
    }
}

function chgKata(vfrm)
{
    var cKata="";
    l1 = new Array(" ", "P","D","W","Z","N","J","T","MZ");
    l2 = new Array("  ", "50","100","200");
    l3 = new Array(" ", "S","S","L","L","S","L","L","L","L","L");
    l4 = new Array("  ", "14","18");
    l5 = new Array(" ", "G","LG","SB","MB","P");

    var ix1 = vfrm.select1.selectedIndex;
    var ix2 = vfrm.select2.selectedIndex;
    var ix3 = vfrm.select3.selectedIndex;
    var ix4 = vfrm.select4.selectedIndex;
    var ix5 = vfrm.select5.selectedIndex;

    if (ix4 != 2)
    {
        if ((ix2 > 0)&&(ix3 > 0)) ix3 = (ix3 - 1) * 3 + ix2;
    }
    else
    {
        ix3 = 10;
    }

    if ((vfrm.select2.selectedIndex >= 4)||
        (vfrm.select3.selectedIndex >= 4)||
        (vfrm.select4.selectedIndex >= 3))
    {
        cKata = "";
        ctlKataDisp(vfrm, "hidden");
        //vfrm.mitsu_yj.style.visibility = "hidden";
        //vfrm.mitsu_btn.style.visibility = "hidden";
    }
    else
    {
        cKata = l1[ix1] + l2[ix2] + "-" + l3[ix3] + "-" + l4[ix4] + "-" + l5[ix5];

        vfrm.img01.src = (ix1 > 0 ? "img/" + l1[ix1] + ".gif" : "img/0.gif");
        vfrm.img02.src = (ix2 > 0 ? "img/" + l2[ix2] + ".gif" : "img/00.gif");
        vfrm.img03.src = (ix3 > 0 ? "img/" + l3[ix3] + ".gif" : "img/0.gif");
        vfrm.img04.src = (ix4 > 0 ? "img/" + l4[ix4] + ".gif" : "img/0.gif");
        vfrm.img05.src = (ix5 > 0 ? "img/" + l5[ix5] + ".gif" : "img/0.gif");
        ctlKataDisp(vfrm, "visible");
        //vfrm.mitsu_yj.style.visibility = vfrm.mitsu_btn.style.visibility 
        //               = (ix1 > 0)&&(ix2 > 0)&&(ix3 > 0)&&(ix4 > 0)&&(ix5 > 0) ? "visible" : "hidden";
    }
    vfrm.katashiki.value = cKata;

    if (ix1 == 1)
       vfrm.chertimg.src = "img/type_p.jpg";
    else if (ix1 == 2)
       vfrm.chertimg.src = "img/type_d.jpg";
    else if (ix1 == 3)
       vfrm.chertimg.src = "img/type_w.jpg";
    else if (ix1 == 4)
       vfrm.chertimg.src = "img/type_z.jpg";
    else if (ix1 == 5)
       vfrm.chertimg.src = "img/type_n.jpg";
    else if (ix1 == 6)
       vfrm.chertimg.src = "img/type_j.jpg";
    else if (ix1 == 7)
       vfrm.chertimg.src = "img/type_t.jpg";
    else if (ix1 == 8)
       vfrm.chertimg.src = "img/type_mz.jpg";
    else
       vfrm.chertimg.src = "img/type_00.jpg";
}

function chgOption(vfrm, selOBJ)
{
    vfrm.katoption.value = selOBJ.selectedIndex;
    vfrm.img06.src = "img/6" + selOBJ.selectedIndex + ".gif";
}

function clrKata(vfrm)
{
    vfrm.img01.src = "img/0.gif";
    vfrm.img02.src = "img/00.gif";
    vfrm.img03.src = "img/0.gif";
    vfrm.img04.src = "img/0.gif";
    vfrm.img05.src = "img/0.gif";
    vfrm.img06.src = "img/60.gif";
    vfrm.chertimg.src = "img/chert_fig_00_00.gif";
    ctlKataDisp(vfrm, "visible");
    //vfrm.mitsu_yj.style.visibility = "hidden";
    //vfrm.mitsu_btn.style.visibility = "hidden";
}

function ctlKataDisp(vfrm, sVisible)
{
    vfrm.img00.style.visibility = (sVisible == "visible" ? "hidden" : "visible");
    vfrm.img01.style.visibility = 
       vfrm.img02.style.visibility = 
       vfrm.img03.style.visibility =
       vfrm.img04.style.visibility =
       vfrm.img05.style.visibility =
       vfrm.imgh1.style.visibility =
       vfrm.imgh2.style.visibility =
       vfrm.imgh3.style.visibility = sVisible;
            
    if (sVisible == "visible")
    {
	vfrm.img00.width = 0;
        vfrm.img01.width = 
  	  vfrm.img03.width = 
          vfrm.img04.width =
          vfrm.img05.width = 32;
        vfrm.img02.width = 36;
        vfrm.imgh1.width =
          vfrm.imgh2.width =
          vfrm.imgh3.width = 16;
    }
    else
    {
        vfrm.img00.width = 213;
        vfrm.img01.width = 
  	  vfrm.img03.width = 
          vfrm.img04.width =
          vfrm.img05.width = 0;
        vfrm.img02.width = 0;
        vfrm.imgh1.width =
          vfrm.imgh2.width =
          vfrm.imgh3.width = 0;
    }
}
