// JavaScript Document

//▼▽▼980×px
function randomAdv980() {
  m = 0, x = 0, y = 0;
  ad  = new Array();
  adv = new Array();
  hit = new Array();

  // hitには相対確率を入れる
  // 完全にランダムにするなら全部"1"にする
  // advには、テキストを入れる。改行はしないようにする
  // テキストを増やしたりする場合は、"[ ]"の数字が0から順になるようにする
//  hit[0] = 1; adv[0] = '<a href="◆" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/◆" width="980" alt="◆" /></a>';
  hit[0] = 1; adv[0] = '<a href="http://www.gyonet.jp/movie/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/movie980.jpg" width="980" alt="迫力の釣り動画" /></a>';
  hit[1] = 3; adv[1] = '<a href="http://www.gyonet.jp/entry/spots-preopen/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/member-s.jpg" width="980" alt="会員募集中" /></a>';
  hit[2] = 1; adv[2] = '<a href="http://www.gyonet.jp/wiki/index.php/Category:%E9%87%A3%E3%82%8A%E3%81%AE%E3%83%9E%E3%83%8A%E3%83%BC" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/manner.gif" width="980" alt="釣りのマナー" /></a>';
  hit[3] = 3; adv[3] = '<a href="http://www.gyonet.jp/gyotacky/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/gyotaku.jpg" width="980" alt="写真から実寸の魚拓を制作" /></a>';
  hit[4] = 3; adv[4] = '<a href="http://www.gyonet.jp/gyotacky/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/gyotaku-2.jpg" width="980" alt="写真から実寸の魚拓を制作" /></a>';
  hit[5] = 3; adv[5] = '<a href="http://www.gyonet.jp/gyotacky/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/gyotaku-3.jpg" width="980" alt="写真から実寸の魚拓を制作" /></a>';
  hit[6] = 3; adv[6] = '<a href="http://www.gyonet.jp/gyotacky/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/gyotaku-4.jpg" width="980" alt="写真から実寸の魚拓を制作" /></a>';
  hit[7] = 3; adv[7] = '<a href="http://www.gyonet.jp/gyotacky/" target="_self"><img src="http://www.gyonet.jp/common_files/images/house_ads/980/gyotaku-5.jpg" width="980" alt="写真から実寸の魚拓を制作" /></a>';


  for(i=0; i<=hit.length - 1; i++) {
    m += hit[i];
  }
  n = Math.floor(Math.random() * m);
  n++;
  for(i=0; i<=hit.length - 1; i++) {
    x = y;
    y += hit[i];
    if(x<n && n<=y) ad = adv[i];
  }
  document.write(ad);
}
