
function HScroll() {

var brwsAgent = navigator.userAgent.toLowerCase();
if(brwsAgent.indexOf("msie") == -1 ){
 var sv = 'moz';
}else{
 var sv = 'ie5';
}
  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("adtxt");
    objbox.appendChild(box);
    box.style.height = this.height + 'px';
    if(sv == 'moz'){
    box.style.width = document.documentElement.clientWidth + 'px';
    }else{
    box.style.width = this.width + 'px';
    }
    box.style.position = 'relative';
    box.style.overflow = 'hidden';
    box.onmouseover = function() {adtxt_topics.onmouseover();}
    box.onmouseout = function() {adtxt_topics.onmouseout();}

    for (var i = 0; i < this.itemcount; i++) {
      var element = document.createElement('div');
      element.id = this.name + 'item' + i;

    if(sv == 'moz'){
    element.style.width = document.documentElement.clientWidth + 'px';
    }else{
    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() {
  adtxt_topics.display();
  adtxt_topics.currentspeed = adtxt_topics.scrollspeed;
  setTimeout(adtxt_topics.name + '.scroll()', adtxt_topics.currentspeed);
};

if (window.attachEvent) {
  window.attachEvent('onload', start);
}
if (window.addEventListener) {
  window.addEventListener('load', start, false);
}
//
adtxt_topics = new HScroll();
adtxt_topics.name = "adtxt_topics";
adtxt_topics.height = 24;
//adtxt_topics.width = document.documentElement.clientWidth;
adtxt_topics.width = 468;
adtxt_topics.scrollspeed = 30;
adtxt_topics.pausedelay = 3000;
adtxt_topics.pausemouseover = true;

adtxt_topics.add('PR <a href=\"http://cmking.2style.net/sponsor/?Keywords=%E3%83%95%E3%82%A1%E3%83%83%E3%82%B7%E3%83%A7%E3%83%B3\" target=\"_blank\">ファッション</a> , <a href=\"http://cmking.2style.net/sponsor/?Keywords=BL\" target=\"_blank\">ＢＬ</a> , <a href=\"http://cmking.2style.net/sponsor/?Keywords=%E8%8A%B8%E8%A1%93\" target=\"_blank\">芸術</a> , <a href=\"http://cmking.2style.net/sponsor/?Keywords=%E5%B0%8F%E8%AA%AC\" target=\"_blank\">小説</a>');
adtxt_topics.add('PR <a href=\"http://cmking.2style.net/sponsor/?Keywords=%A5%B2%A1%BC%A5%E0\" target=\"_blank\">ゲーム</a> , <a href=\"http://cmking.2style.net/sponsor/?Keywords=%E8%B3%83%E8%B2%B8\" target=\"_blank\">賃貸マンション</a> , <a href=\"http://cmking.2style.net/sponsor/?Keywords=%E3%83%8D%E3%83%83%E3%83%88%E5%B0%8F%E8%AA%AC\" target=\"_blank\">ネット小説</a>');
adtxt_topics.add('PR <a href=\"http://ex.2style.net/\" target=\"_blank\">有料プラン</a> , <a href=\"http://blogtown.mobi/" target=\"_blank\">無料携帯ブログ</a> , <a href=\"http://sns.2style.net/" target=\"_blank\">2StyleSNS</a>');

document.write('<div id=\"adtxt\" align=\"center\" style=\"text-align:center;font-size:12px;\"><a href=\"http://2style.net/kis/\" target=\"_blank\">[PR] 初期費用・更新料W(ダブル）0円</a></div>');

//document.write('<div id=\"adtxt\" valign=\"center\" style=\"text-align:center;font-size:12px;\"><iframe src=\"http://2style.in/dokoad_get.php\" width=\"300\" height=\"15\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" scrolling=\"no\" target=\"_blank\"></iframe><br /></div>');
