/* =================================================================
 rlink.js ランダムリンク処理
                                 Written By C.Tomimura 2002.9.10
================================================================== */
url_rlink = new Array();  
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//  プログラム設置前にここでお好みの設定情報をセットしてください  
url_rlink[0] = "http://tmchihaya.s4.xrea.com/pzworks/";	// pzworks
url_rlink[1] = "http://tmchihaya.s12.xrea.com/";	// 虫食い日記
url_rlink[2] = "http://tmchihaya.s4.xrea.com/pzunits/";	// pzunits
url_rlink[3] = "http://tmchihaya.s12.xrea.com/";	// 虫食い日記
url_rlink[4] = "http://tmchihaya.s4.xrea.com/";		// pzsystem
url_rlink[5] = "http://tmchihaya.s12.xrea.com/";	// 虫食い日記
url_rlink[6] = "http://tmchihaya.s4.xrea.com/pzunits/";	// pzunits
url_rlink[7] = "http://tmchihaya.s4.xrea.com/";		// pzsystem
url_rlink[8] = "http://tmchihaya.s4.xrea.com/pzworks/";	// pzworks
url_rlink[9] = "http://tmchihaya.s4.xrea.com/pzunits/";	// pzunits

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

//-------------------------------------------------------------------
// グローバル変数
//-------------------------------------------------------------------
var brwsName_rlink;	// ブラウザ種類
 
//-------------------------------------------------------------------
// ブラウザチェッカ  browserChecker_RLINK()
// 引数：なし
// 戻り値：なし
//-------------------------------------------------------------------
function browserChecker_RLINK()
{
  brwsName_rlink = ""; // ブラウザ名

  if ( document.all){
       brwsName_rlink = "IE";	// IE4/5/6
       return;
  }
  if (document.layers){
       brwsName_rlink = "Netscape"; // ネスケ4
       return;
  }
  if (document.getElementById){
       brwsName_rlink = "Mozilla"; // ネスケ6
       return;
  }
}

//-------------------------------------------------------------------
// HTMLからじかに呼ばれる関数 kickProc_RLINK()
// 引数：なし
// 戻り値：なし
//-------------------------------------------------------------------
function kickProc_RLINK()
{

  //===== ブラウザチェッカ
  browserChecker_RLINK();	
  if ( brwsName_rlink == "" ){
       return;	// ブラウザがネスケでもIEでもない
  }

  //=====  乱数発生、10倍して四捨五入
  var rIndex = 0;
  var trytime = 0;
  while(1){
	rIndex = Math.round(Math.random()*10);
	if ( rIndex < url_rlink.length && rIndex >= 0 ){
	     if ( url_rlink[rIndex] != location.href ){
	     	break;
	     }
	}
	if ( trytime > 100 ){	// 100回Tryして駄目ならあきらめる
	     rIndex = 0;
	     url_rlink[rIndex] = location.href;
	     break;
	}
	trytime++;
  }

  //=====  URLを特定、ジャンプ
  //alert(location.href);
  location.href = url_rlink[rIndex];

  return;
}

