// ランダム広告
function randomAdv2() {
  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="http://www.dff.jp/" target="_blank"><span style="text-decoration: none"><font size="2"><div align="center"><B>あなたのクリックで救える命がある</B> - あなたに代わってスポンサー企業が寄付   http://www.dff.jp/</font>';
hit[1] = 1; adv[1] = '<A HREF="http://www.shaplaneer.org/sutenai/top.htm" target="_blank"><span style="text-decoration: none"><font size="2"><div align="center"><B>ステナイ生活</B> - 不要品のリサイクル&リユース協力が海外協力に   http://www.shaplaneer.org/sutenai/top.htm</font>';
hit[2] = 1; adv[2] = '<A HREF="http://www.lifeboatjapan.com/index.html" target="_blank"><span style="text-decoration: none"><font size="2"><div align="center">殺されてしまう犬猫達を救おう！ <B>ライフボート友の会</B>http://www.lifeboatjapan.com/index.html</font>';
hit[3] = 1; adv[3] = '<A HREF="http://www.savechildren.or.jp/index.html" target="_blank"><span style="text-decoration: none"><font size="2"><div align="center">すべての子供が希望と機会の持てる社会を <B>セーブ・ザ・チルドレン</B> http://www.savechildren.or.jp/index.html</font>';
hit[4] = 1; adv[4] = '<A HREF="http://www.jawfp.org/index.html" target="_blank"><span style="text-decoration: none"><font size="2"><div align="center">世界から飢餓をなくそう　 <B>国連WFP協会 </B>http://www.jawfp.org/</font>';
  
  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);
}