#!/usr/bin/perl

print "Content-type:text/html; charset=EUC-JP\n\n";

$res1 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/99bbpb8.jpg" width="720" height="200" border="0"></a>';
$res2 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/h_720_200.jpg" width="720" height="200" border="0"></a>';
$res3 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/b_720_200.jpg" width="720" height="200" border="0"></a>';
$res4 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/a_720_200.jpg" width="720" height="200" border="0"></a>';
$res5 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/o_720_200.jpg" width="720" height="200" border="0"></a>';
$res6 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://images.xvn.jp/b_images/ja/p_720_200.jpg" width="720" height="200" border="0"></a>';
$res7 = '<a href="http://monthly.xvn.jp/ja/top/UBrocketq_001" target="_blank"><img src="http://www.eonet.ne.jp/~afasc904/boin/afiri/99-aug.jpg" border="0"></a>';

&getResult;

&dti;

exit;

## 乱数を発生させ無作為に結果を取得する ##
sub getResult {
	#乱数生成
	srand;
	$r = rand;

	# $rは 0から1までの少数値。それを100倍し、0から100までの整数に変換
	$r = int($r * 100);

	# 0 - 13
	if ($r < 14) {
		$result = $res1;
	}
	# 14 - 27
  elsif ($r < 28) {
		 $result = $res2;
	}
	# 28 - 41
	elsif ($r < 42) {
		$result = $res3;
	}
	# 42 - 55
	elsif ($r < 56) {
		$result = $res4;
	}
	
	# 56 - 69
	elsif ($r < 70) {
		$result = $res5;
	}
	
	# 70 - 83
	elsif ($r < 84) {
		$result = $res6;
	}
	
	# 84 - 100
	else {
		$result = $res7;
	}

}

## ＨＴＭＬとして出力 ##
sub dti {
print <<HTML;
<html>
	<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<head>
		<title></title>
	</head>
	
	<body leftmargin="0" topmargin="0">
	<table width="720" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
		$result
		 </div></td>
  </tr>
</table>
  	</body>
</html>
HTML

}

