function Balloon(get1, get2, get3) {

 

 month_width = 133;

 set_y_flag = 0;

 for (h = 0; h < 2; h ++) {

  y = 35;

  y2 = y;

  y_max = y;

  if (h == 0) {

   txt_kara = "4月から9月まで";

   txt_han = "<td style='width: 10%;'>&nbsp;&nbsp;4月</td><td style='width: 10%;'>&nbsp;&nbsp;5月</td><td style='width: 10%;'>&nbsp;&nbsp;6月</td><td style='width: 10%;'>&nbsp;&nbsp;7月</td><td style='width: 10%;'>&nbsp;&nbsp;8月</td><td style='width: 10%;'>&nbsp;&nbsp;9月</td>";

  } else {

   txt_kara = "<br>10月から3月まで";

   txt_han = "<td style='width: 10%;'>&nbsp;&nbsp;10月</td><td style='width: 10%;'>&nbsp;&nbsp;11月</td><td style='width: 10%;'>&nbsp;&nbsp;12月</td><td style='width: 10%;'>&nbsp;&nbsp;1月</td><td style='width: 10%;'>&nbsp;&nbsp;2月</td><td style='width: 10%;'>&nbsp;&nbsp;3月</td>";

  }



  if (get3 == 1) {

   col_han = "#6699cc";

  } else {

   col_han = "#99cc66";

  }

 

  document.write("<div style='font-weight: bold; color: #333333; margin-bottom: 5px;'>" + txt_kara + "</div>",

  "<div style='background-color: #eeeeee; position: relative; width: 798px; height: 300px;' id='han_box" + h + "-" + get3 +"'>",

  "<table style='background-color: #999999; width: 100%; height: 100%;' cellspacing='1' cellpadding='0' border='0'>",

  " <tr style='background-color: " + col_han + "; height: 20px; font-size: 80%; color: #ffffff;'>" + txt_han + "</tr>",

  " <tr style='background-color: #ffffff;'><td></td><td></td><td></td><td></td><td></td><td></td></tr>",

  "</table>");



  for (i = get1; i < get2; i++) {



   //1～3月の変数調整

   if (h == 0) {

    m_s_add[i] = m_s[i];

    m_e_add[i] = m_e[i];

    if (m_s[i] < 4) { m_s[i] += 12; }

    if (m_e[i] < 4) { m_e[i] += 12; }

   }

   //---



   //位置分類

   if (y_s[i] == 0) { m_s_2 = 0;

   } else if ((m_s[i] > 3) && (m_s[i] < 10)) {

    m_s_2 = 1;

   } else {

    m_s_2 = 2;

   }

   if (y_e[i] == 2) {

    m_e_2 = 2;

   } else if ((m_e[i] > 3) && (m_e[i] < 10)) {

    m_e_2 = 0;

   } else {

    m_e_2 = 1;

   }



   if (((h == 0) && ((m_s_2 == 0) || (m_s_2 == 1))) || ((h == 1) && ((m_e_2 == 1) || (m_e_2 == 2)))) {

 

    //横位置と幅調整

    x = (m_s[i] - 1 - 3 - h * 6) * month_width + d_s[i] * (month_width / 31);

    w = (m_e[i] - m_s[i]) * month_width + (d_e[i] - d_s[i]) * (month_width / 31) - 37;

//    if (x < 0) {

//     w += x;

//     x = 0;

//    }

    //昨年度スタート

    if (m_s_2 == 0) {

     x = 0;

     w = (m_e[i] - 4) * month_width + d_e[i] * (month_width / 31) - 37;

    }

    //9月以前スタート10月以降エンド

    if (((m_s_2 == 0) || (m_s_2 == 1)) && ((m_e_2 == 1) || (m_e_2 == 2))) {

     if (h == 0) {

      w = month_width * 6 - x;

     } else {

      x = 0;

      w = (m_e[i] - 10) * month_width + d_e[i] * (month_width / 31) - 37;

     }

    }

    //来年度エンド

    if (m_e_2 == 2) {

     w = month_width * 6 - x;

    }

    //---



    //フキダシを左にするかどうか

    if (x > 580) {

     xover = true;

    } else {

     xover = false;

    }

    //---



    //縦位置調整

    if ((h == 1) && (set_y_flag == 0)) { set_y_flag = 1; }

    if ((i != 0) && (set_y_flag != 1)) {

//     x1s = (m_s[i - 1] - 1 - 3 - h * 6) * month_width + d_s[i - 1] * (month_width / 31);

//     x1e = (m_e[i - 1] - 1 - 3 - h * 6) * month_width + d_e[i - 1] * (month_width / 31);

     x1s = x_back;

     x1e = x_back + w_back;

     x2 = (m_s[i] - 1 - 3 - h * 6) * month_width + d_s[i] * (month_width / 31);

     if ((x1e - x1s) > 180) {

      x1 = x1e

     } else {

      x1 = x1s + 180;

     }

     if (xover) {

      x1 += 195;

     }

     if (x1 > x2) {

      var element = document.getElementById("name" + h + "_" + (i - 1));

      y += element.offsetHeight;

      //y += t_y2[i];

     } else {

      y = 35;

     }

    }

    if ((h == 1) && (set_y_flag == 1)) { set_y_flag = 2; }

    //---



    if (xover) { x -= 195; }



    //フキダシ全体

    document.write("<div id='name" + h + "_" + i + "' style='position: absolute; left: " + x + "px; top: " + y + "px;'>",

    "<table><tr>");

    if (xover) {

    //予定左

     document.write("<td>",

     "<div style='background-image: url(./img/balloon" + get3 + "c_top.png); width: 195px; position: relative; top: -0px;'>",

     "<div style='margin: 0px 10px 0px 10px; font-size: 85%; line-height: 1.5; color: #333333; padding: 10px 10px 0px 0px;'>");

     if ((m_s[i] == m_e[i]) && (d_s[i] == d_e[i]) || (m_e[i] == 0)) {

      document.write(m_s_add[i] + "月" + d_s[i] + "日<br>");

     } else {

      document.write(m_s_add[i] + "月" + d_s[i] + "日～" + m_e_add[i] + "月" + d_e[i] + "日<br>");

     }

     document.write("<span style='color: #3366cc; font-weight: bold;'>" + title[i] + "</span><br>",

     "" + value[i] + "",

     "</div><div style='background-image: url(./img/balloon" + get3 + "_bottom.png); width: 180px; height: 12px; overflow:hidden; margin-left: -1px;'></div></td>");

    }

    document.write("<td style='vertical-align: top;'>");

   

    if ((m_s[i] == m_e[i]) && (d_s[i] == d_e[i]) || (m_e[i] == 0)) {

    //予定ボックス

     document.write("<img src='./img/arrow_box.png' style='margin-left: 0px;'>");

    } else {

    //予定矢印

     document.write("<table style='height: 30px; background-color: #ffffff;' cellspacing='0' cellpadding='0' border='0'><tr>");

     if (!(((h == 1) && ((m_s[i] < 10) || (m_s_2 == 0))) || ((h == 0) && (m_s_2 == 0)))) {

      document.write("<td style='background-image: url(./img/arrow_left.png); width: 18px;'></td>");

     }

     if (!((h == 1) && (y_s[i] == 1) && (m_e_add[i] == 3) && (d_s[i] > 25))) {

      document.write("<td style='background-image: url(./img/arrow_center.png); width: " + w + "px;'></td>");

      if (!(((h == 0) && ((m_e[i] > 9) || (m_e_2 == 2))) || ((h == 1) && (m_e_2 == 2)))) {

       document.write("<td style='background-image: url(./img/arrow_right.png); width: 19px; height: 30px;'></td>");

      }

     }

     document.write("</tr></table>");

    }

  

    if (!xover) {

//     if (((m_e[i] * 31 + d_e[i]) - (m_s[i] * 31 + d_s[i])) < 11) {

     if (w < 11) {

      //予定右

       document.write("</td><td>",

       "<div style='background-image: url(./img/balloon" + get3 + "b_top.png); width: 195px;'>",

       "<div style='margin: 0px 10px 0px 25px; font-size: 85%; line-height: 1.5; color: #333333; padding-top: 10px;'>");

       if ((m_s[i] == m_e[i]) && (d_s[i] == d_e[i]) || (m_e[i] == 0)) {

        document.write(m_s_add[i] + "月" + d_s[i] + "日<br>");

       } else {

        document.write(m_s_add[i] + "月" + d_s[i] + "日～" + m_e_add[i] + "月" + d_e[i] + "日<br>");

       }

       document.write("<span style='color: #3366cc; font-weight: bold;'>" + title[i] + "</span><br>",

       "" + value[i] + "",

       "</div><div style='background-image: url(./img/balloon" + get3 + "_bottom.png); width: 180px; height: 12px; overflow:hidden; margin-left: 15px;'></div>");

     } else {

     //予定下

      document.write("",

      "<div style='background-image: url(./img/balloon" + get3 + "_top.png); width: 180px; height: 26px;'></div>",

      "<div style='background-image: url(./img/balloon" + get3 + "_middle.png); width: 180px;'>",

      "<div style='margin: 0px 10px; font-size: 85%; line-height: 1.5; color: #333333;'>"

      + m_s_add[i] + "月" + d_s[i] + "日～" + m_e_add[i] + "月" + d_e[i] + "日<br>" +

      "<span style='color: #3366cc; font-weight: bold;'>" + title[i] + "</span><br>",

      "" + value[i] + "",

      "</div></div><div style='background-image: url(./img/balloon" + get3 + "_bottom.png); width: 180px; height: 12px; overflow:hidden;'></div>");

     }

    }

    document.write("</td></tr></table></div>");

    var element = document.getElementById("name" + h + "_" + i);

    y2 = y + element.offsetHeight;

    if (y_max < y2) {

     y_max = y2;

    }

   }

   x_back = x;

   w_back = w;

  }

  document.write("</div>");

  document.getElementById("han_box" + h + "-" + get3).style.height = y_max;

 }

}

