#!/usr/bin/perl

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

$res1 = '<IFRAME SRC="http://www14.ocn.ne.jp/~boin2/ad/acafe/ems-120/a-mov-ems-120.html" width="735" height="280" frameborder="no" SCROLLING="no"></IFRAME>';
$res2 = '<IFRAME SRC="http://www14.ocn.ne.jp/~boin2/ad/acafe/ems-129/a-mov-ems-129.html" width="735" height="280" frameborder="no" SCROLLING="no"></IFRAME>';
$res3 = '<IFRAME SRC="http://www14.ocn.ne.jp/~boin2/ad/acafe/ems-131/a-mov-ems-131.html" width="735" height="280" frameborder="no" SCROLLING="no"></IFRAME>';
$res4 = '<IFRAME SRC="http://www14.ocn.ne.jp/~boin2/ad/acafe/ems-115/a-mov-ems-115.html" width="735" height="280" frameborder="no" SCROLLING="no"></IFRAME>';
$res5 = '<IFRAME SRC="http://www14.ocn.ne.jp/~boin2/ad/acafe/ems-117/a-mov-ems-117.html" width="735" height="280" frameborder="no" SCROLLING="no"></IFRAME>';

&getResult;

&dti;

exit;

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

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

	# 0 - 20
	if ($r < 21) {
		$result = $res1;
	}

	# 21 - 40
        elsif ($r < 41) {
		 $result = $res2;
	}	
       # 41 - 60
        elsif ($r < 61) {
		 $result = $res3;
	}

       # 61 - 80
        elsif ($r < 81) {
		 $result = $res4;
	}
	
	# 81 - 100
	else {
		$result = $res5;
	}

}

## ＨＴＭＬとして出力 ##
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">
			$result
  	</body>
</html>
HTML

}

