//---------------------------------------------
//	縦スクロール用関数
//---------------------------------------------
function HScroll() {
  this.name       = " HScroll";
  this.item       = new Array();
  this.itemcount  = 0;
  this.pausemouseover = false;
  this.stop       = false;
  this.stopHeight = 0;

  //---------------------------------------------
  //	行の追加
  //---------------------------------------------
  this.add = function() {
    var text = arguments[0];
    this.item[this.itemcount] = text;
    this.itemcount = this.itemcount + 1;
  };

  //---------------------------------------------
  //	表示
  //---------------------------------------------
  this.display = function() {
    var box    = document.createElement('div');
    box.id     = this.name;
    var objbox = document.getElementById("keyword");
    objbox.appendChild(box);
    box.style.height   = this.height + 'px';
    box.style.width    = this.width + 'px';
    box.style.position = 'relative';
    box.style.overflow = 'hidden';
    box.onmouseover    = function() {chumoku_keyword.onmouseover();}
    box.onmouseout     = function() {chumoku_keyword.onmouseout();}

    for (var i = 0; i < this.itemcount; i++) {
      var element = document.createElement('div');
      element.id  = this.name + 'item' + i;
      element.style.width    = this.width + 'px';
      element.style.position = 'absolute';
      element.style.top      = (this.height * i + 1) + 'px';
      element.style.left     = 0;
      element.innerHTML      = this.item[i];
      var objBody = document.getElementById(this.name);
      objBody.appendChild(element);
    }
  };

  //---------------------------------------------
  //	スクロール
  //---------------------------------------------
  this.scroll = function() {
    this.currentspeed = this.scrollspeed;
    if (!this.stop) {
      for (i = 0; i < this.itemcount; i++) {
        obj = document.getElementById(this.name + 'item' + i).style;
        var t = obj.top.replace(/p[tx]$/, '') - 1;
        obj.top = t + 'px';
        if (t <= this.height * ( - 1)) obj.top = (this.height * (this.itemcount - 1)) + 'px';
        if (t == 0 || (this.stopHeight > 0 && this.stopHeight - t == 0)) this.currentspeed = this.pausedelay;
      }
    }
    window.setTimeout(this.name + ".scroll()", this.currentspeed);
  };

  //---------------------------------------------
  //	マウスが乗った時、スクロールの停止
  //---------------------------------------------
  this.onmouseover = function() {
    if (this.pausemouseover) {
      this.stop = true;
    }
  };

  //---------------------------------------------
  //	マウスが外れた時、スクロールの再開
  //---------------------------------------------
  this.onmouseout = function() {
    if (this.pausemouseover) {
      this.stop = false;
    }
  };

}

//---------------------------------------------
//	スクロールの開始
//---------------------------------------------
function start() {
  chumoku_keyword.display();
  chumoku_keyword.currentspeed = chumoku_keyword.scrollspeed;
  setTimeout(chumoku_keyword.name + '.scroll()', chumoku_keyword.currentspeed);
};


if (window.attachEvent) {
  window.attachEvent('onload', start);
}
if (window.addEventListener) {
  window.addEventListener('load', start, false);
}

//---------------------------------------------
//	注目キーワードオブジェクトの生成と初期化
//---------------------------------------------
chumoku_keyword = new HScroll();
chumoku_keyword.name        = "chumoku_keyword";
chumoku_keyword.height      = 20;
chumoku_keyword.width       = 1000;
chumoku_keyword.scrollspeed = 60;		// スクロール速度
chumoku_keyword.pausedelay  = 6000;		// スクロール間隔
chumoku_keyword.pausemouseover = true;	// 





