#! /usr/bin/env perl
#use strict;
#use warnings;
use Image::Magick;
use List::Util;
use utf8;
use Pg;
use CGI;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST);
use JSON qw/encode_json decode_json/;
use Encode;
use JSON;
use URI::Escape;

my $q = new CGI;

#param
my $sword =$q->param('sword');
my $tate =$q->param('tate');
my $yoko =$q->param('yoko');
my $mode =$q->param('mode');
my $flg =$q->param('flg');


print "Content-Type: text/html; charset=UTF-8\n\n";

print <<"END_OF_HTML";


<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
</head>
<body>

<form action="http://gms.gdl.jp/~naoto/cgi-bin/unit_menu.pl" method="post" style="margin-top:0em;margin-bottom:0em">
	縦
	<input type="text" class="text" name="tate" size="2" alt="SEARCH WORD" value="$tate" />
	横
	<input type="text" class="text" name="yoko" size="2" alt="SEARCH WORD" value="$yoko" />
	検索ワード
	<input type="text" class="text" name="sword" size="10" alt="SEARCH WORD" value="$sword" />
	<select name="flg" class="dropdown">
END_OF_HTML
            print "<option value=\"tag\"" . $selected2 . ">tag</option>\n";
			print "<option value=\"user\"" . $selected3 . ">user</option>\n";
print <<"END_OF_HTML";
	</select>
	<input type="submit" name="search" class="submit" value="Go!!" />
	<input type="hidden" name="mode" value="search" />
</form>
END_OF_HTML
print "outFilePath";
if ($mode){
	print "<img src=\"http://gms.gdl.jp/~naoto/cgi-bin/unit.pl?mode=$mode&flg=$flg&sword=$sword\">";
}
print <<"END_OF_HTML";
</body>
</html>
END_OF_HTML

exit 0;