/*
index.html用 map.jsに依存します。
*/

//吹き出しエレメントの情報保持用
var objHukidashi;
function init ()
{
  try {
    objHukidashi = {
      'sa1' : new hukidashi('isegen', './iframe/ifisegen.html', 'sugoroku', 420, 250),

      'sa2' : new hukidashi('omiya', './iframe/ifomiya.html', 'sugoroku', 0, 25),

      'sa3' : new hukidashi('shinoda', './iframe/ifshinoda.html', 'sugoroku', 0, 210),

      'sa4' : new hukidashi('shoeitei', './iframe/ifsyoeitei.html', 'sugoroku', 120, 80),

      'sa5' : new hukidashi('shopin', './iframe/ifsyopin.html', 'sugoroku', 100, 200),

      'sa6' : new hukidashi('take', './iframe/iftakemura.html', 'sugoroku', 410, 120),

      'sa7' : new hukidashi('botan', './iframe/ifbotan.html', 'sugoroku', 250, 220),

      'sa8' : new hukidashi('matsuya', './iframe/ifmatsuya.html', 'sugoroku', 280, 350),

      'sa9' : new hukidashi('yabusoba', './iframe/ifyabu.html', 'body', 300, 3),

      'sl10' : new hukidashi('syusse', './iframe/ifsyusse.html', 'sugoroku', 460, 380),

      'sl11' : new hukidashi('enju', './iframe/ifenju.html', 'sugoroku', 200, 350),

      'sl12' : new hukidashi('mansei', './iframe/ifmansei.html', 'sugoroku', 500, 5),

      'sa13' : new hukidashi('kotsu', './iframe/ifkotu.html', 'sugoroku', 510, 210)
    };

    //吹き出しの出現、非表示の動作をイベントに追加します。
    var elm;
    for (var i in objHukidashi)
    {
      elm = getElmById(i);
      //マウスオーバー時
      addEvent( elm, 'mouseover', function ()
        {
          var id;
          if (this.id != null) {id = this.id;}
          else {id = event.srcElement.id;}
          objHukidashi[id].view();
        }
      );
      //マウスアウト時
      addEvent( elm, 'mouseout', function ()
        {
          var id;
          if (this.id) {id = this.id;}
          else {id = event.srcElement.id;}
          objHukidashi[id].hide();
        }
      );
    }
  } catch (e) { return void(0); }
};

//エレメントの取得
function getElmById (id)
{
  var elm;
  if (document.all) { elm = document.all[id];}
  else if (document.getElementById) { elm = document.getElementById(id);}
  return elm;
}

//イベントの追加
function addEvent (elm, type, func)
{
  //以下2つのイベント追加に対応していない場合は、無視する。
  if (elm.addEventListener) { elm.addEventListener(type, func, false); }
  else if (elm.attachEvent) { elm.attachEvent('on' + type, func); }
}