// Roundom Advertising
// ver. 30 Mar. 2009

function randomAdv() {
	m = 0, x = 0, y = 0;
	ad  = new Array();
	adv = new Array();
	hit = new Array();
	// hitには相対確率を入れる
	// 完全にランダムにするなら全部"1"にする
	imgSrc = '/web0904/images/banners/'
	scale = 'width="960" height="193"'
	hit[0] = 1; adv[0] = '<a href="http://www.exp-inc.jp/xth/" target="_blank"><img src="'+imgSrc+'head_AD_XTH3.jpg" '+scale+' alt="Generation Xth Code-Realize" /></a>';
	hit[1] = 1; adv[1] = '<a href="http://www.exp-inc.jp/sor/" target="_blank"><img src="'+imgSrc+'head_AD_SOR_5.jpg" '+scale+' alt="Students of Round" /></a>';
	hit[2] = 1; adv[2] = '<a href="http://www.exp-inc.jp/xth/" target="_blank"><img src="'+imgSrc+'head_AD_XTH12.jpg" '+scale+' alt="Generation Xth" /></a>';
	hit[3] = 1; adv[3] = '<a href="http://www.exp-inc.jp/xth/" target="_blank"><img src="'+imgSrc+'head_AD_XTH1plus2.jpg" '+scale+' alt="Generation Xth" /></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);
}
