#!/usr/bin/perl
#///////////////////////////////////////////////////////////////////////////////
#                        html_maker for resrve / NP_ZEU / epsilon VER3.00
#
#                     ----- ant -----
#                                 info@ant3.jp
#                                 http://ant3.jp
#	
#///////////////////////////////////////////////////////////////////////////////
#================================ [注意事項] ===================================
# このスクリプトはシェアウエアです。このスクリプトを使用したいかなる損害に対して
# も作者は一切の責任を負いません。
#====================================使用法=====================================
# ショッピングカートと同じフォルダに入れて、次のようにして呼び出してください。
#	http://・・/html_maker.cgi
#
#===============================================================================
# ▼設定▼
#===============================================================================
#==HTML生成フォルダ==
$shop_html2 ="./shop_html2";

#======SEO対策=======
#$shop_title ='★★★タイトル★★★';			#ホームページタイトル（２１文字以内）
#$shop_keywords ='キーワード１,キーワード２,キーワード３';	#ヒットして欲しいキーワード
#															#少ない方が効果的！
#$shop_description ='簡潔にホームページをアピールします。';	#簡潔にホームページをアピール

#商品表示のデザイン(reserve、epsilonは設定管理【14】で設定)
$pic_col ='4';				#列数=4
$pic_col_width ='147';		#列幅=147

#生成されたファイルの表示数の上限
$hyouzi_su_set =50;

#==============================================================================
# ▲設定終了▲
#==============================================================================

#======パスの設定====
#html_makerへのパス
$script_maker ="./html_maker.cgi";

#jcode.plへのパス
require './jcode.pl';

#cgi-lib.plへのパス
require './cgi-lib.pl';

#===================

&ReadParse;

while (($key,$val) = each %in) {
	&jcode'convert($val, "sjis");
	$form{$key} = $val;
}

while (($key,$val) = each %in) {

	&jcode'convert(*val, "sjis");
	$val =~ s/<>//g;

	if($form{'mode'} eq 'adm4' || $form{'mode'} eq 'order_form' || $form{'mode'} eq 'order_mail'){
		$val =~ s/&quot;/\"/g;
		if ($key eq "MESS" || $key eq "setumei") {
			$val =~ s/&lt;/</g;
			$val =~ s/&gt;/>/g;
			$val =~ s/<br>/\n/g;
			$val =~ s/\.\n/\. \n/g;

		}else{
			$val =~ s/</&lt;/g;
			$val =~ s/>/&gt;/g;	

			$val =~ s/\r\n//g;
			$val =~ s/\r//g;
			$val =~ s/\n//g;
#			$val =~ s/\s//g;
		}
			
	}else{
		$val =~ s/\"/&quot;/g;
		$val =~ s/\0/ /g;
		if ($key eq "MESS" || $key eq "setumei" || $key eq "setumei2" || $key eq "setumei3") {
			$val =~ s/\r\n/<br>/g;
			$val =~ s/\r/<br>/g;
			$val =~ s/\n/<br>/g;
			if ($val =~ /<br>$/) {
				while ($val =~ /<br>$/) { $val =~ s/<br>$//g; }
			}	
#			$val =~ s/\s//g;

		} else {
			$val =~ s/</&lt;/g;
			$val =~ s/>/&gt;/g;	
			$val =~ s/\r\n//g;
			$val =~ s/\r//g;
			$val =~ s/\n//g;
#			$val =~ s/\s//g;
		}
	}

	$in{$key} = $val;

}

# 設定ファイル====================================================================

require './set.pl';
$in{'pic_only'} =1;		#画像のみ表示モード
($page,$page2) = split(/\//,$page);
if($page2){$page =$page2;}		#画像のみ表示の表示数

#==================キーワードの半角ブランクを全角に変換============================
#$in{'keyword'} =~ s/\ /\　/g;

#====================戻り先========================================================
$save_data="$script?&keyword=$in{'keyword'}&FF=$in{'FF'}&class=$in{'class'}";

#===============管理用入り口======================
if ( $in{'mode'} eq '') { &adm1; exit;}
if ( $in{'pass'} ne $adm_pass ) { print "Location: $script_maker\n\n"; exit; }
if ( $in{'mode'} eq 'make_ok' ) { &adm2; exit;}

#=====================商品データの読み込み===========================

	if (!open(IN,"$data_file")) { &error('データベース読取エラー','復旧をお待ちください.'); }
	@BASE = <IN>;
	close(IN);

if($zyunzyo == 0 or  $zyunzyo eq ''){
	@BASE = reverse @BASE;
}elsif($zyunzyo == 1){
}elsif($zyunzyo == 5){
	@BASE = sort { &suutika5((split(/\<\>/,$a))[$zyunzyo]) <=> &suutika5((split(/\<\>/,$b))[$zyunzyo]) } @BASE;
}else{
	@BASE = sort { &suutika((split(/\<\>/,$a))[$zyunzyo]) <=> &suutika((split(/\<\>/,$b))[$zyunzyo]) } @BASE;
}
if($in{'price_sort'} == 1){
	@BASE = sort { (split(/\<\>/,$a))[8] <=> (split(/\<\>/,$b))[8] } @BASE;
}elsif($in{'price_sort'} == 2){
	@BASE = sort { &suutika((split(/\<\>/,$b))[15]) <=> &suutika((split(/\<\>/,$a))[15]) } @BASE;
}elsif($in{'price_sort'} == 3){
	@BASE = sort { &suutika((split(/\<\>/,$a))[15]) <=> &suutika((split(/\<\>/,$b))[15]) } @BASE;
}

#==================消費税の扱い====================
#内税と消費税なしの場合：
if($tax_flag == 1){
	$syouhi_tax =0;
}elsif($tax_flag == 2){
	$syouhi_tax =0;
	$tax_syu = '';
}
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@alph =('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','aa','bb','cc','dd','ee','ff','gg','hh','ii','jj','kk','ll','mm','nn','oo','pp','qq','rr','ss','tt','uu','vv','ww','xx','yy','zz','aaa','bbb','ccc','ddd','eee','fff','ggg','hhh','iii','jjj','kkk','lll','mmm','nnn','ooo','ppp','qqq','rrr','sss','ttt','uuu','vvv','www','xxx','yyy','zzz');
#%%%%%%%%%%%ＴＯＰページのHTML生成
if($in{'html1'}){
	$url_home ="$class_htm_dir/home.htm";
	&top_make();

	$html_file_name ="$shop_html2".'/index.html';
	&html_write();

	push (@result_url1,$html_file_name);
}
#%%%%%%%%%%%カテゴリーによるHTML生成
$hyouzi_su =$hyouzi_su_set;

if($in{'html2'}){
	$classmei='';
	$in{'class'} ='';
	$ii =0;
	foreach (@ctgry_tb) {

		$shop_title_set ="$shop_title".'['."$_".']';
		$shop_keyword_set = "$_".','."$shop_keywords";
		$shop_description_set ="$shop_description".'['."$_のページ".']';
		$pas_word ="$_";
		$pas_word_encode =$pas_word;
		$pas_word_encode =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg;    #ここでエンコード
		
		$class_encode ='all';
		
		&html_data_make();

		$html_file_name ="$shop_html2".'/category'."$alph[$ii]"."_"."$alph[$ii]".".html";
		&html_write();
	
		if($hyouzi_su){
			push (@result_url2,$html_file_name);
			$hyouzi_su --;
		}

		$ii ++;
	}
}
#%%%%%%%%%%%小分類によるHTML生成
if($in{'html3'}){
	$pas_word ="";
	$pas_word_encode ="";
	$aa =0;
	foreach (@class_tb) {
		($class_b,$k) = split(/\//,$_);
		if($k eq ''){

			$shop_title_set ="$shop_title".'['."$class_b".']';
			$shop_keyword_set = "$class_b".','."$shop_keywords";
			$shop_description_set ="$shop_description".'['."$class_bのページ".']';

			$classmei="$aa";
			$in{'class'}="$aa";
			$class_encode =$in{'class'};
			$class_encode =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg;    #ここでエンコード
			
			$pas_word_encode ='';
			
			&html_data_make();

			$html_file_name ="$shop_html2".'/class'."$alph[$aa]"."_"."$aa".".html";
			&html_write();

			if($hyouzi_su){
				push (@result_url3,$html_file_name);
				$hyouzi_su --;
			}
		}else{
			@class_S =split(/:/,$k);
			$bb =0;
			foreach (@class_S) {

				$shop_keyword_set = "$class_b".','."$_".','."$shop_keywords";
				$shop_title_set ="$shop_title".'['."$class_b/$_".']';
				$shop_keyword_set = "$class_b".','."$_".','."$shop_keywords";
				$shop_description_set ="$shop_description".'['."$class_b/$_のページ".']';

				$classmei="$aa"."/"."$bb";
				$in{'class'}="$aa"."/"."$bb";
				$class_encode =$in{'class'};
				$class_encode =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg;    #ここでエンコード

				$pas_word_encode ='';

				&html_data_make();

				$html_file_name ="$shop_html2".'/class'."$alph[$aa]"."_"."$alph[$bb]"."_"."$aa"."_"."$bb".".html";
				&html_write();

			if($hyouzi_su){
				push (@result_url3,$html_file_name);
				$hyouzi_su --;
			}
				$bb ++;
			}
		}
		$aa ++;
	}
}

&result();
exit;
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#========================HTMLの書き込み===========================================
sub html_write{

	open(OUT,"> $html_file_name") || &error("HTMLの書き込みに失敗しました","$html_file_name");
	print OUT "$html_data\n";
	close(OUT);

}#========================ソートのための処理ルーチン================================
sub suutika{
$data_sort =$_[0];
$data_sort =~ s/\n//g;
$data_sort =~ s/[a-zA-Z]//g;		#アルファベットを除去。
$data_sort =~ s/\-/\//g;
$data_sort =~ s/\:/\//g;

$k ='/';
if(index($data_sort,$k) >= 0){

	@suuti_data =split(/\//,$data_sort);

	$output_data ='';
	foreach(@suuti_data){
		$i =$_ + 100000;
		$j =substr("$i",1,5);
		$output_data .=$j;
	}

}else{
	$output_data =$data_sort;
}

return($output_data);
}
#=================ソートのための処理ルーチン（分類）==================================
sub suutika5{

	($i,$j) =split(/\//,$_[0]);

	$i =$i + 10000;
	$i =substr("$i",1,4);

	$j =$j + 10000;
	$j =substr("$j",1,4);

	$output_data =$i.$j;

	return($output_data);
}
#================比較サブルーチン=========================================================
sub compare{
	$object =$_[0];
	$object =~ tr/A-Z/a-z/;		#小文字に変換

	$pair_or =$_[1];
	@pair_or  =split(/or/,$pair_or);
	$falg_or =0;

	foreach (@pair_or){
		$_ =~ tr/A-Z/a-z/;		#小文字に変換

		if (index($object,$_) >= 0) {
			$falg_or =1;
			last;
		}
	}
    return($falg_or);
}
#===============ＴＯＰページの作成====================================================
sub top_make{
$html_data = "<html><head><title>$shop_title</title>\n";
$html_data .= "<META content=\"text/html; charset=Shift_JIS\" http-equiv=Content-Type>\n";
$html_data .= "<META content=text/css http-equiv=Content-Style-Type>\n";
$html_data .= "<META name=\"Keywords\" content=\"$shop_keywords\">\n";
$html_data .= "<META name=\"Description\" content=\"$shop_description\">\n";
$html_data .= "$style";
$html_data .= "</head>$body$header\n";

if($inner_farme_yes){

$iframe_h =$h;
$url_home ="$class_htm_dir/home.htm";

$iframe_w =$t_width;

$html_data .=<<"EOF";
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=0 width="$iframe_w">
<TBODY><TR><TD align="center" bgcolor="" height="$iframe_h;">

<iframe src="$url_home" height="100%"  width="100%"  border="0" frameborder="0" marginheight="0" marginwidth="0" name="sign" scrolling="auto" allowtransparency=true>
この部分は iframe 対応のブラウザで見てください。
</iframe>
</TD>
</TR>
<TR><TD align="center" bgcolor=""><IMG src="$dir_p/line.gif" border="0" width="$t_width" height="1">

</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
EOF
}else{

$t_width_adj =$t_width;

$html_data .=<<"EOF";
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=1 width="$t_width_adj">
<TBODY><TR><TD align="center">

ここにトップページを作成してください。

</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
EOF
}

	$html_data .="<p>$foot</body></html>" ;	

#	print "Content-type: text/html\n\n";
#	print "$html_data\n";

}

#==========================================================================================
sub class_name_get{
	($class_B,$k) = split(/\//,$class_tb[$a]);
	@class_tb2 =split(/:/,$k);
	if($b ne ''){
		$class_S =$class_tb2[$b];
		$class_name ="$class_B/$class_S";
	}else{
		$class_name ="$class_B";
	}
}
#=======================================html_data_make=====================================

sub html_data_make {
$hit = 0;
$next_num = '';
$over_no = 0;

$ff_no =0;
$data_su= 0;
$data_ff =0;
$row_data ='';
@NEW =();
foreach $data (@BASE) {

		$data2 = $data ;
		&jcode'convert(*data,'sjis');
		($goods_no,$name,$kigou,$option,$option2,$class,$setumei,$fcolor,$price,$tani,$zaiko,$limit,$picture,$bikou,$aux1,$aux2,$aux3,$aux4,$aux5) = split(/\<\>/,$data);
	$aux2 =~ s/\r\n//g;
	$aux2 =~ s/\r//g;
	$aux2 =~ s/\n//g;
	$aux5 =~ s/\r\n//g;
	$aux5 =~ s/\r//g;
	$aux5 =~ s/\n//g;

	if($limit eq '0' && $goods_hide == 1){ next;}		#購入制限で=0のとき、商品非表示
	if($pas_word ne "") {
    
		# 入力内容を整理
		$word = $pas_word;
		$word =~ s/　/ /g;
		$word =~ s/\t/ /g;
		@pairs = split(/ /,$word);

($a,$b)  =split(/\//,$class);
&class_name_get();

	# 検索処理
			$flag_k = 0;
			foreach $pair (@pairs){
				if (compare($kigou,$pair)) {
					 next;
				}elsif (compare($name,$pair)) {
					 next;
				}elsif (compare($goods_no,$pair)) {
					 next;
				}elsif (compare($class_B,$pair)) {
					 next;
				}elsif (compare($class_S,$pair)) {
					 next;
				}elsif (compare($option,$pair)) {
					 next;
				}elsif (compare($setumei,$pair)) {
					 next;
				}elsif (compare($bikou,$pair)) {
					 next;
				}elsif (compare($price,$pair)) {
					 next;
				}elsif (compare($class,$pair)) {
					 next;
				}elsif (compare($aux1,$pair)) {
					 next;
				}elsif (compare($aux2,$pair)) {
					 next;
				}elsif (compare($aux3,$pair)) {
					 next;
				}elsif (compare($aux4,$pair)) {
					 next;
				}
				$flag_k = 1;
				last;
			}
			if ($flag_k == 1) { next; }

    }
		if ($classmei ne "all" && $classmei ne "") {
			($a1,$a2)  =split(/\//,$class);
			($b1,$b2)  =split(/\//,$classmei);
			
			if ($a1 ne $b1) { next; }
			if ($b2 ne ''){
				if($a2 ne $b2){ next;}
			}

		}

		if ($in{'id'} ne '' or $in{'mode'} eq 'p_wide') {
			if ($goods_no eq $in{'id'}) {
			 	push(@NEW,$data2);
			 	last; 
			 } else { next; }
		}

		$data_su++;

		# 検索終了処理
		if ($hit == $page) { $next_num = $data_ff; $over_no ++; $hit++; next; }
		elsif($hit < $page && $data_ff >= $ff_no){
			 push(@NEW,$data2); $hit++; 
		}elsif($hit > $page && $data_ff >= $ff_no){
			$over_no ++;
		}
		$data_ff ++;
}

if($over_no > $page){
	$over_no = $page;
}
#=========================================

$html_data = "<html><head><title>$shop_title_set</title>\n";
$html_data .= "<META content=\"text/html; charset=Shift_JIS\" http-equiv=Content-Type>\n";
$html_data .= "<META content=text/css http-equiv=Content-Style-Type>\n";
$html_data .= "<META name=\"Keywords\" content=\"$shop_keyword_set\">\n";
$html_data .= "<META name=\"Description\" content=\"$shop_description_set\">\n";
$html_data .= "$style";
$html_data .= "</head>$body$header\n";

if($pas_word ne ""){
	$condition =$pas_word;
}else{
	if($in{'class'} eq 'all' or $in{'class'} eq ''){
		$condition="$class_all";
	}else{
		($a,$b)  =split(/\//,$in{'class'});
		&class_name_get();
		$condition =$class_name;
	}
}

#=============================================================================
if($Super_Great eq 'S'){

$jump =$script.'?'."class=all&keyword=&superkey=1&FF=0&order=$order_encode&price_sort=$in{'price_sort'}&pic_only=$in{'pic_only'}";
$category .="| <A href=$jump><FONT class='menu'>$class_all</FONT></A> | ";
$ctgry_su =1;
$k =0;
$j =$orikaesi[$k];

foreach (@ctgry_tb) {
	$ct_encode =$_;
	$ct_encode  =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg;    #ここでエンコード

	$jump =$script.'?'."class=all&keyword=$ct_encode&superkey=1&FF=0&order=$order_encode&price_sort=$in{'price_sort'}&pic_only=$in{'pic_only'}";
	$category .=" <A href=$jump><FONT class='menu'>$_</FONT></A> |";
	$ctgry_su ++;
	if($ctgry_su eq $j){
			$category .="<br> |";
			$k ++;
			$j = $j + $orikaesi[$k];
	}
}

$i =0;
foreach (@class_tb) {
	($class_B,$k) = split(/\//,$_);
	$jump =$script.'?'."class=$i&keyword=&superkey=1&FF=0&order=$order_encode&price_sort=$in{'price_sort'}&pic_only=$in{'pic_only'}";
	$category .=" <A href=$jump><FONT class='menu'>$class_B</FONT></A> |";
	$i ++;
	$ctgry_su ++;
	if($ctgry_su eq $j){
			$category .="<br> |";
			$k ++;
			$j = $j + $orikaesi[$k];
	}
}

$html_data .= <<EOF;
<TABLE width="$t_width" bgcolor="$menu_color" border=0 cellpadding=0 cellspacing=0>
<TBODY>
<TR><TD align="center">
$category
<hr noshade size=1></TD></TR>
</TBODY>
</TABLE>
EOF
}
#=============================================================================
unless($kensaku_express){
$html_data .= <<"EOF";
<table border=0 cellpadding=0 cellspacing=0 width="$t_width"  bgcolor="$bg_color"><tr>
<TD align="left"  width="250">
<form method=post action="$script" style='margin: 0 0 15 0px;'>
<input type="text" size=20 name="keyword" value="$pas_word" style='width:120px;height:20px;'>
<input type="hidden" name="class" value="all">
<input TYPE=submit value="検索">
<input type="hidden" name="FF" value=0>
<input type="hidden" name="superkey" value="1">
<input type="hidden" name="order" value=$in{'order'}>
<input type="hidden" name="price_sort" value=$in{'price_sort'}>
<input type="hidden" name="pic_only" value=$in{'pic_only'}>
</form>
</TD>
<td align="right">
<form method="POST" action="$script" style='margin: 0 0 15 0px;'>
<input type="hidden" name="order" value=$in{'order'}>
<input type="hidden" name="class" value=$in{'class'}>
<input type="hidden" name="keyword" value=$in{'keyword'}>
<input type="hidden" name="superkey" value=$in{'superkey'}>
<input type="hidden" name="price_sort" value=$in{'price_sort'}>
<input type="hidden" name="pic_only" value=$in{'pic_only'}>
<input type="hidden" name="mode" value="look">

<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="$color_d" style='height:20px;padding:2 7 0 7px;'><font color="#ffffff">購入合計額： ---円</font></td><td>\　<input TYPE=submit value="カートの中"></td></tr>
</table>
</form>
</TD></TR></table>
EOF
}

($a,$b)  =split(/\//,$in{'class'});
&class_name_get();
$list_data = '';
$i =0;
foreach (@class_tb) {
	if($small_class_g == 0 || $a eq '' || $a eq 'all'){ last;}

	($class_b,$k) = split(/\//,$_);
	if($class_b ne $class_B){$i ++; next;}
	
	if($k eq ''){last;}
	$jump =$script.'?'."class=$i&keyword=&superkey=1&FF=0&order=$order_encode&price_sort=$in{'price_sort'}&pic_only=$in{'pic_only'}";
	$list_data = "<A href=$jump><FONT class='menu3'><FONT class='bunrui'>$class_b</FONT></FONT><FONT class='menu3'><FONT class='bunrui'> ＞ </FONT></FONT></A>";
	@class_S =split(/:/,$k);
	$j =0;
	$jj =4;		#折り返し
	foreach (@class_S) {
		
		$jump =$script.'?'."class=$i%2F$j&keyword=&superkey=1&FF=0&order=$order_encode&price_sort=$in{'price_sort'}&pic_only=$in{'pic_only'}";

	$list_data .= "<FONT class='menu3'><FONT class='bunrui'>|</FONT></FONT><A href=$jump><FONT class='menu3'><FONT class='bunrui'> $class_S[$j] </FONT></FONT></A>";
		if($j eq $jj){
			$list_data .="<FONT class='menu3'><FONT class='bunrui'>|</FONT></FONT><br> ";
			$jj = $jj + 5;		#折り返し
		}

		$j ++;
	}
	last;
}
if($list_data ne ''){
	$list_data ="<tr><TD colspan=2><center>"."$list_data"."<FONT class='menu3'><FONT class='bunrui'> |</FONT></FONT>"."</center></td></tr>";
}
$html_data .= "<table>"."$list_data"."</table>";

if($list_data ne ''){
	$html_data .= "<hr noshade size=1 width=$t_width>";
}

#==============分類の詳細説明==============
if($class_setumei == 1 && $a ne '' && $a ne 'all'){
	if($a < 10){
		if($b ne ''){
			$url ="$class_htm_dir/"."$a$b".".htm";
		}else{
			$url ="$class_htm_dir/"."$a".".htm";
		}
	}else{
		if($b ne ''){
			$url ="$class_htm_dir/"."$a".'_'."$b".".htm";
		}else{
			$url ="$class_htm_dir/"."$a".'_'.".htm";
		}
	}
	
@url_split  =split(/\//,$url);
$u1 =$#url_split - 1;
$u2 =$#url_split;
$url_test ="./"."$url_split[$u1]"."/"."$url_split[$u2]"; #相対アドレス。

if(-e $url_test){
$html_data .= <<"EOF";
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=0 width="$class_width">
<TBODY><TR><TD align="center" bgcolor="" height="$class_height;">

<iframe src="$url" height="100%"  width="100%"  border="0" frameborder="0" marginheight="0" marginwidth="0" name="sign" scrolling="auto" allowtransparency=true>
この部分は iframe 対応のブラウザで見てください。
</iframe>
</TD>
</TR>
<TR><TD align="center" bgcolor=""><hr noshade size=1 width=$t_width>
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
EOF
}
}
#===========================================
if($hatubaibi_sort == 1){
$hatubaibi_set ="<TD align='center' width=70><a href=$script?order=$order_encode&class=$class_encode&keyword=$pas_word_encode&FF=0&price_sort=2&pic_only=$in{'pic_only'}&superkey=1><font color='#0000ff'>▲$aux2_name順</font></a></TD>";
}elsif($hatubaibi_sort == 2){
$hatubaibi_set ="<TD align='center' width=70><a href=$script?order=$order_encode&class=$class_encode&keyword=$pas_word_encode&FF=0&price_sort=3&pic_only=$in{'pic_only'}&superkey=1><font color='#0000ff'>▲$aux2_name順</font></a></TD>";
}
if($aux5_popular){
$popular_set ="<TD align='center' width=70><a href=$script?order=$order_encode&class=$class_encode&keyword=$pas_word_encode&FF=0&price_sort=4&pic_only=$in{'pic_only'}&superkey=1><font color='#0000ff'>▲人気順</font></a></TD>";
}

if($in{'pic_only'}){
$only_set ="pic_only=0><font color='#0000ff'>▲普通表\示</font>";
}else{
$only_set ="pic_only=1><font color='#0000ff'>▲画像のみ</font>";
}

$html_data .= <<"EOF";
			<table width="$t_width" bgcolor="$bg_color"><TR><TD>検索条件[$condition] [$data_su\件]</TD>
			<td align="center" width=70>
			<a href=$script?order=$order_encode&class=$class_encode&keyword=$pas_word_encode&FF=$in{'FF'}&price_sort=$in{'price_sort'}&superkey=1&$only_set</a></td>
			<TD align="center" width=70>
			<a href=$script?order=$order_encode&class=$class_encode&keyword=$pas_word_encode&FF=0&price_sort=1&pic_only=$in{'pic_only'}&superkey=1><font color="#0000ff">▲価格順</font></a></TD>
$hatubaibi_set$popular_set
			</TR></table>
<IMG height="1" src="$dir_p/line2.gif" width="$t_width">
EOF

	if (!@NEW) {
$html_data .= <<"EOF";
	<table border=0 cellspacing=0 cellpadding=5 width="$t_width" align=center>
	<tr><td bgcolor="$color_r" align=center><b><center>★該当する商品はありません★</center></b></td></tr>
	</table>
EOF

	}else{
$html_data .= <<"EOF";
<TABLE cellpadding="0" cellspacing="0" bordercolordark="$naka_color" bordercolorlight="$naka_color" border="0" width="$t_width">
  <TBODY>
EOF
#========================================================================

		foreach ( @NEW ) {
			($goods_no,$name,$kigou,$option,$option2,$class,$setumei,$fcolor,$price,$tani,$zaiko,$limit,$picture,$bikou,$aux1,$aux2,$aux3,$aux4,$aux5) = split(/\<\>/,$_);

	$aux2 =~ s/\r\n//g;
	$aux2 =~ s/\r//g;
	$aux2 =~ s/\n//g;
	$aux5 =~ s/\r\n//g;
	$aux5 =~ s/\r//g;
	$aux5 =~ s/\n//g;

@option = split(/\:/,$option);
$i = 0;
$flag_zaiko_non=0;
$flag_non_option ='1';
$option_set = "";
$zaiko_new ='';
while($i < $option_no) {
	($op_k[$i],$op_m[$i],$op_su[$i],$op_pr[$i]) =split(/\,/,$option[$i]);
	if($op_k[$i] eq ''){ $i++; next;}
	$flag_non_option ='0';
	if($op_su[$i] eq ''){ $flag_zaiko_non=1; }
#	if($op_su[$i] eq '0'){$i++; next;}
	if($op_su[$i] > 0){$zaiko_new +=$op_su[$i];}
		$su_ex ='';
		if($op_su[$i] ne '' && $option_su_ex  == 1){ $su_ex ="/$op_su[$i]$option_su_tani";}
		$pr_ex ='';
		if($op_pr[$i] ne ''){$pr_ex ="[\\$op_pr[$i]]";}
		$option_set = $option_set."<option value='$op_k[$i]'>$op_m[$i]$pr_ex$su_ex</option>\n";
	$i++;
}
if($option_set ne ""){
    $option_set = "<select name='op1'>".$option_set."</select>";
}else{
	$option_set ="";
}

if($flag_non_option ne '1'){
	if($zaiko_new eq ''){
		$zaiko =0;
	}else{
		$zaiko =$zaiko_new;
	}
}

@option2 = split(/\:/,$option2);
$i = 0;
$option2_set = "";
while($i < $option2_no) {
	($op2_k[$i],$op2_m[$i],$op2_su[$i]) =split(/\,/,$option2[$i]);
	if($op2_k[$i] eq ""){ $i++; next;}
		$option2_set = $option2_set."<option value='$op2_k[$i]'>$op2_m[$i]</option>\n";
	$i++;
}
if($option2_set ne ""){
    $option2_set = "<br><select name='op2'>".$option2_set."</select>";
}else{
	$option2_set ="\　";
}

($price,$tax_ch)= split(/\:/,$price);
if($tax_flag eq ''){
	if($tax_ch == 1){
		$tax_set ="$tax_komi";
	}else{
		$tax_set ="$tax_betu";
	}
}elsif($tax_flag eq '0'){
	$tax_set ="$tax_betu";
}elsif($tax_flag eq '1'){
	$tax_set ="$tax_komi";
}elsif($tax_flag eq '2'){
	$tax_set ='';
}
$price_set = $price;
1 while $price_set =~ s/(.*\d)(\d\d\d)/$1,$2/g; #桁カンマを入れる処理

$price_set = "<b>$price_set</b>";

($setumei,$setumei2) =split(/\|\|/,$setumei);
$setumei =~ s/\"/\'/g;

$setumei_set ="";
	if($bikou ne ""){
		if($bikou_flag == 1){
			$bikou = "<br>※重量".$bikou.'(グラム)';
		}else{
			$bikou = "<br>※".$bikou;
		}
	}
	$setumei_set ="<FONT color=$fcolor>$setumei</font>". $bikou;

$zaiko_set ='';
if($zaiko_ex == 1){
if($zaiko eq ''){
	$zaiko_set ="";
    $zaiko = 100000;
}elsif($zaiko > 0){
	$zaiko_set ="在庫$zaiko$tani";
}elsif($zaiko <= 0){
	$zaiko =0;
	$zaiko_set ="在庫$zaiko$tani";
}

}else{
if($zaiko eq ''){
    $zaiko = 100000;
}elsif($zaiko <= 0){
	$zaiko =0;
}
}

if($flag_zaiko_non == 1){$zaiko = 100000; $zaiko_set ="";}

($limit,$limit2) = split(/\:/,$limit);
if($limit ne ""){
	$tani_set =" $limit$taniまで";
}else{
    $tani_set =$tani;
    $limit =100000;
}
$limit_su =$limit;

$get_setting0 = "<INPUT TYPE=submit value='購入'>";
if($zaiko_stop ne '' && $zaiko <= 0){
	if($limit2 eq '0' || $goods_yoyaku ne '1'){
		$get_setting0 = "$zaiko_stop";
	}else{
		$get_setting0 = "<INPUT TYPE=submit value='予\約'>";
		if($limit2 ne ""){
			$tani_set ="$limit2$taniまで";
		}else{
		    $tani_set =$tani;
		    $limit2 =100000;
		}
		$limit_su =$limit2;
	}
}

$kosuu_setting = "";
foreach ( @kosuu_set ) {
	if($_ >$limit_su){
		last;
	}else{
		$kosuu_setting .= "<option value=$_>$_</option>";
	}
}
if($kosuu_setting eq ""){
	$kosuu_setting = "<select name='amount'><option value=0>−</option></select>$tani_set";
}else{
	$kosuu_setting = "<select name='amount'>$kosuu_setting</select>$tani_set";
}

$word='タイムサービス';
$words='ﾀｲﾑｻｰﾋﾞｽ';
if (index($setumei,$word) >= 0 || index($bikou,$word) >= 0 || index($setumei,$words) >= 0 || index($bikou,$words) >= 0) {
    # タイムゾーンを日本時間に合わせる
	$ENV{'TZ'} = "JST-9";
	$times = time;
	($sec,$min,$hour,$day,$month,$year,$wday,$Days,$dmy) = localtime($times);
	$time =$hour.':'.$min;
	
	if(&suutika($time) < &suutika($service_time[0]) || &suutika($service_time[1]) < &suutika($time)){
		$get_setting0 ="[ｻｰﾋﾞｽﾀｲﾑ]".'<BR>'."$service_time[0]-$service_time[1]";
	}
}

($pic1,$pic2,$pic3,$pici,$picj) =split(/\|/,$picture);

if($pici eq ""){
	$pici =$default_g;
}else{
	$g_hull_name=0;
	$g_name='';
	$tail='';
	if ($pici =~ /http:/i) { $g_hull_name =1; }
	elsif ($pici =~ /(.*)\/(.*)\.gif/i) { $g_name =$2; $tail='.gif'; }
	elsif ($pici =~ /(.*)\/(.*)\.jpeg/i) { $g_name =$2; $tail='.jpeg'; }
	elsif ($pici =~ /(.*)\/(.*)\.jpg/i) { $g_name =$2; $tail='.jpg'; }
	elsif ($pici =~ /(.*)\/(.*)\.png/i) { $g_name =$2; $tail='.png'; }

	unless($g_hull_name){
		if($g_name){$pici ="$dir_m/"."$g_name"."$tail";}
		else{$pici ="$dir_m/"."$goods_no".".gif";}
	}
}

$w_setum =$t_width-290;

($a,$b)  =split(/\//,$class);
&class_name_get();

$modoru_goods ="$script?class=$class_encode&keyword=$pas_word_encode&FF=0&price_sort=";
$position ="no"."$goods_no";
$link_pw ="$modoru_goods&mode=p_wide&id=$goods_no&superkey=1";
$link_pop ="$modoru_goods&mode=p_wide&id=$goods_no&superkey=1&popup=yes";

$op_width = $t_width -$imagesize_w -300;

if($get_cago){
	$cago_back ='<input type="hidden" name="mode" value="look">';
}

$get_setting =<<"EOF";
	$get_setting0
	<input type='hidden' name='g_no' value="$goods_no">
	<input type="hidden" name="class" value="$in{'class'}">
	<input type="hidden" name="FF" value="$in{'FF'}">
	<input type="hidden" name="order" value="$in{'order'}">
	<input type="hidden" name="keyword" value="$in{'keyword'}">
	<input type="hidden" name="price_sort" value=$in{"price_sort"}>
	$cago_back
EOF

if($imagesize_w && $imagesize_h){
	$w_h_set ="width=\"$imagesize_w\" height=\"$imagesize_h\"";
}else{
	$w_h_set ="";
}

 $popup_set =<<EOF;
       <a href="$link_pw"><IMG src="$pici" alt="$class_name $name [$kigou] $setumei" border="0" align="middle" $w_h_set></a>
EOF

$goods_tb =$goods_table;
$goods_tb =~ s/\<br\>//g;

unless($custom_images){$custom_images ='images/';}
$goods_tb =~ s/images\//$custom_images/g;

$goods_tb =~ s/\$goods_no/$goods_no/g;
$goods_tb =~ s/\$setumei_set/$setumei_set/g;
$goods_tb =~ s/\$name/$name/g;
$goods_tb =~ s/\$kigou/$kigou/g;
$goods_tb =~ s/\$class_name/$class_name/g;
$goods_tb =~ s/\$price_set/$price_set/g;
$goods_tb =~ s/\$option_set/$option_set/g;
$goods_tb =~ s/\$option2_set/$option2_set/g;
$goods_tb =~ s/\$link_pop/$link_pop/g;
$goods_tb =~ s/\$tax_set/$tax_set/g;
$goods_tb =~ s/\$link_pw/$link_pw/g;
$goods_tb =~ s/\$get_setting/$get_setting/g;
$goods_tb =~ s/\$zaiko_set/$zaiko_set/g;
$goods_tb =~ s/\$kosuu_setting/$kosuu_setting/g;
$goods_tb =~ s/\$pici/$pici/g;
$goods_tb =~ s/\$aux1/$aux1/g;
$goods_tb =~ s/\$aux2/$aux2/g;
$goods_tb =~ s/\$aux3/$aux3/g;
$goods_tb =~ s/\$aux4/$aux4/g;
$goods_tb =~ s/\$aux5/$aux5/g;
$goods_tb =~ s/\$picture_set/$popup_set/g;

$aux1_set =$aux1;
if($aux1_name eq '会員価格'){
1 while $aux1_set =~ s/(.*\d)(\d\d\d)/$1,$2/g; #桁カンマを入れる処理
	$aux1_set = "<FONT color='#ff0000'>\\<B>$aux1_set</b></font>$tax_set";
}

$aux_sett ='';

if($regular_col >= 2){
	if($aux3 && $aux3_name){$aux_sett .="<TR><TD width=\"100%\" bgcolor=\"$naka_color\">[$aux3_name] $aux3</TD></TR>";}
	if($aux4 && $aux4_name){$aux_sett .="<TR><TD width=\"100%\" bgcolor=\"$naka_color\">[$aux4_name] $aux4_set</TD></TR>";}
	if($aux2 && $aux2_name){$aux_sett .="<TR><TD width=\"100%\" bgcolor=\"$naka_color\">[$aux2_name] $aux2</TD></TR>";}
	if($aux1 && $aux1_name){$aux_sett .="<TR><TD width=\"100%\" bgcolor=\"$naka_color\">[$aux1_name] $aux1_set</TD></TR>";}

}else{
$row_setting =5;

if($aux2 && $aux2_name){
$aux_sett =<<"EOF";
    <TR>
      <TD align="center" height="10" bgcolor="$midasi_color"width="60">分\　類</TD>
      <TD align="left" height="10" bgcolor="$naka_color" width="190">$class_name</TD>
      <TD align="center" height="10" bgcolor="$midasi_color"width="60">$aux2_name</TD>
      <TD align="left" height="10" bgcolor="$naka_color" width="90">$aux2</TD>
    </TR>
EOF

}else{
$aux_sett =<<"EOF";
    <TR>
      <TD align="center" height="10" bgcolor="$midasi_color"width="60">分\　類</TD>
      <TD colspan='3' align="left" height="10" bgcolor="$naka_color" width="340">$class_name</TD>
    </TR>
EOF

}
if($aux1 && $aux1_name){
$aux_sett .=<<"EOF";
    <TR>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">価\　格</TD>
      <TD bgcolor="$naka_color" width="190" height="10" align="left" valign="middle">\\$price_set$tax_set</TD>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">$aux1_name</TD>
      <TD bgcolor="$naka_color" width="90" height="10" align="left" valign="middle">$aux1_set</TD>
    </TR>
EOF

}else{
$aux_sett .=<<"EOF";
    <TR>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">価\　格</TD>
      <TD colspan='3' bgcolor="$naka_color" width="340" height="10" align="left" valign="middle">\\$price_set$tax_set</TD>
    </TR>
EOF
}

unless(($aux1 && $aux1_name) || ($aux2 && $aux2_name)){
$row_setting =4;
$aux_sett =<<"EOF";
    <TR>
      <TD align="center" height="10" bgcolor="$midasi_color"width="60">分\　類</TD>
      <TD align="left" height="10" bgcolor="$naka_color" width="190">$class_name</TD>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">価\　格</TD>
      <TD bgcolor="$naka_color" width="90" height="10" align="left" valign="middle">\\$price_set$tax_set</TD>
    </TR>
EOF
}

$aux3_4_set ='';
if($aux3 && $aux3_name && $aux4 && $aux4_name){
$row_setting ++;
$aux3_4_set =<<"EOF";
    <TR>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">$aux3_name</TD>
      <TD bgcolor="$naka_color" width="190" height="10" align="left" valign="middle">$aux3</TD>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">$aux4_name</TD>
      <TD bgcolor="$naka_color" width="90" height="10" align="left" valign="middle">$aux4</TD>
    </TR>
EOF

}elsif($aux3 && $aux3_name){
$row_setting ++;
$aux3_4_set =<<"EOF";
    <TR>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">$aux3_name</TD>
      <TD colspan='3' bgcolor="$naka_color" width="340" height="10" align="left" valign="middle">$aux3</TD>
    </TR>
EOF
}elsif($aux4 && $aux4_name){
$row_setting ++;
$aux3_4_set =<<"EOF";
    <TR>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">$aux4_name</TD>
      <TD colspan='3' bgcolor="$naka_color" width="340" height="10" align="left" valign="middle">$aux4</TD>
    </TR>
EOF
}
}
#=======================================複数列表示=================================
$in{'pic_only'} =1;
$Col_NO++;

if($in{'pic_only'}){
$row_data .=<<"EOF";
<td valign='bottom'>

<TABLE cellpadding="2" cellspacing="1" bordercolordark="$naka_color" bordercolorlight="$naka_color" border="0" width="$pic_col_width">
  <TBODY>
    <TR><TD vAlign=top align=center>$popup_set</td></tr>
    <TR><td align=center>$name [$kigou]</TD></tr>
    <TR><td align=center>\\<B>$price_set</B>$tax_set</td></tr>
  </TBODY>
</TABLE>

</td>
EOF
}elsif($regular_col >= 2){

$row_data .="<td valign='top'>";

if($customize eq 1){
	$row_data .="$goods_tb";
}else{
$row_data .=<<"EOF";
<TABLE cellpadding="3" cellspacing="0" bordercolordark="#ffffff" bordercolorlight="$waku_color" border="1" width="$regular_col_width">
  <TBODY>
    <TR>
      <TD width="100%" vAlign=top align=center bgcolor="$midasi_color" colSpan=2><div align="left"><B>★$name [$kigou]</B></div>
      </TD></tr>
    <TR>
      <TD vAlign=top align=center bgcolor="$naka_color" width="40%"><br>$popup_set<BR>
      </TD> 
      <TD valign="top" bgcolor="$naka_color" width="60%">
      <FORM method='post' action="$script">
      <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
        <TBODY>$aux_sett
          <TR>
            <TD width="100%" bgcolor="$naka_color">[価格] \\<B>$price_set</B>$tax_set</TD>
          </TR></TBODY>
      </TABLE>
	<input type='hidden' name='g_no' value="$goods_no">
    <input type="hidden" name="class" value="$in{'class'}">
    <input type="hidden" name="FF" value="$in{'FF'}">
    <input type="hidden" name="order" value="$in{'order'}">
    <input type="hidden" name="keyword" value="$in{'keyword'}">
    <input type="hidden" name="price_sort" value=$in{"price_sort"}>
$cago_back
         <TABLE cellSpacing=0 cellPadding=3 border=0 width="100%">
        <TBODY>
          <TR>
            <TD vAlign=top align="left" width="150">$option_set$option2_set</td></tr>
            <tr><td>$zaiko_set$kosuu_setting</td></tr><tr><td>$get_setting0</TD>
          </TR><tr><td>$setumei_set</td></tr>
        </TBODY>
      </TABLE>
      </FORM>
      </TD>
    </TR>
  </TBODY>
</TABLE>
EOF
}
	$row_data .='</td>';
	
}else{
$row_data .="<td valign='top'>";

if($customize eq 1){
	$row_data .="$goods_tb";
}else{
$row_data .=<<"EOF";
<TABLE cellpadding="3" cellspacing="0" bordercolordark="#ffffff" bordercolorlight="$waku_color" border="1" width="$t_width">
  <TBODY>
    <TR>
      <TD rowspan="$row_setting" bgcolor="$naka_color" align="center">
$popup_set
	  </TD>
      <TD bgcolor="$midasi_color" align="center" width="60">名\　称</TD>
      <TD bgcolor="$naka_color" align="left" height="10" width="190">$name</TD>
      <TD bgcolor="$midasi_color" width="60" height="10" valign="middle" align="center">記\　号</TD>
      <TD bgcolor="$naka_color" width="90" height="10" align="left" valign="middle">$kigou</TD>
    </TR>
$aux_sett
    <TR>
      <TD colspan="4" bgcolor="$naka_color" valign="top" height="40">      <table border=0 cellpadding= cellspacing=0 align="right"><tr><td valign="top"><a href="$link_pw"><font color="#0000ff">■詳細説明</font></a></td></tr></table>
      $setumei_set
      </TD>
    </TR>
    <TR>
      <TD bgcolor="$naka_color" colspan="4" align="left" valign="bottom" height="20">
      <FORM method='post' action="$script">
      <TABLE bgcolor="$naka_color">
        <TBODY>
          <TR>
            <TD valign="top" bgcolor="$naka_color" width="$op_width">
            $option_set\　 $option2_set
            </TD>
            <TD align="right" valign="bottom" width="270">
            $zaiko_set\　 $kosuu_setting\　 $get_setting0
$cago_back
	<input type='hidden' name='g_no' value="$goods_no">
    <input type="hidden" name="class" value="$in{'class'}">
    <input type="hidden" name="FF" value="$in{'FF'}">
    <input type="hidden" name="order" value="$in{'order'}">
    <input type="hidden" name="keyword" value="$in{'keyword'}">
    <input type="hidden" name="price_sort" value=$in{"price_sort"}>
            </TD>
          </TR>
        </TBODY>
      </TABLE>
      </FORM>
      </TD>
    </TR>
  </TBODY>
</TABLE>
EOF
}
	$row_data .='</td>';
}

if($in{'pic_only'}){
	if($Col_NO< $pic_col){ next;}
}else{
	if($Col_NO< $regular_col){ next;}
}

$html_data .= "<tr>$row_data</tr>";
$Col_NO=0;
$row_data ='';
}

}
if ( @NEW ) {

unless($Col_NO){$html_data .= "</TBODY></TABLE>";}

while($Col_NO){
$Col_NO++;

if($in{'pic_only'}){
$row_data .=<<"EOF";
<td valign='top'>

<TABLE cellpadding="2" cellspacing="0" bordercolordark="$naka_color" bordercolorlight="$naka_color" border="0" width="$pic_col_width">
  <TBODY>
    <TR><TD vAlign=top align=center>\　</td></tr>
  </TBODY>
</TABLE>

</td>
EOF
}else{


$row_data .=<<"EOF";
<td valign='top'>
<TABLE cellpadding="3" cellspacing="0" bordercolordark="" bordercolorlight="" border="0" width="$regular_col_width">
  <TBODY>
    <TR>
      <TD width="100%" vAlign=top align=center bgcolor="">\　<TD valign=top bgcolor=""></TD>
    </TR>
  </TBODY>
</TABLE>
</td>
EOF
}
if($in{'pic_only'}){
	if($Col_NO < $pic_col){  next;}
}else{
	if($Col_NO< $regular_col){  next;}
}
$html_data .= "<tr>$row_data</tr></TBODY></TABLE>";
$Col_NO=0;

}

}

$html_data .= <<"EOF";
<IMG height="1" src="$dir_p/line2.gif" width="$t_width" border=0>
EOF

#====================================================================================

$buf ="class=".$class_encode;
$buf2 ="order=".$in{'order'};
$buf3 ="keyword=".$pas_word_encode."&pic_only=$in{'pic_only'}";

if($data_su > $page){
$i =1;
$j =0;
	while ($j < $data_su){
		if($j ne $ff_no ){
			$jump_set .="<FONT color='#0000ff' size=-1>[</font><a href=\"$script?$buf&$buf2&$buf3&FF=$j&price_sort=$in{'price_sort'}\"><font color='#0000ff' size=-1>$i<font></a><FONT color='#0000ff' size=-1>]</font>";
		}else{
			$jump_set .="<FONT color='#0000ff' size=-1>[<b>$i</b>]</font>";
		}
		$i ++;
		$j = $j + $page; 
	}
}

        $nextlink = "";
		if ($next_num ne '') {
			$nextlink = "<a href=\"$script?$buf&$buf2&$buf3&FF=$next_num&price_sort=$in{'price_sort'}\"><font color='#0000ff'>次の$over_no件<font></a>";
		}
		
		$backlink = "";
		$back_num = $ff_no -$page;
		if($back_num >=0) {
			$backlink = "<a href=\"$script?$buf&$buf2&$buf3&FF=$back_num&price_sort=$in{'price_sort'}\"><font color='#0000ff'>前の$page件</font></a>\　\　";
		}

if($nextlink ne '' || $backlink ne ''){
if($page_view){
	   	$html_data .= "<center><table width=$o_width><tr><td align='center'>$backlink$nextlink\　\　 $jump_set</td></tr></table></center>\n";
}else{
	   	$html_data .= "<center><table width=$o_width><tr><td align='center'>$backlink$nextlink</td></tr></table></center>\n";
}
}

	$html_data .= <<"EOF";
	<center><table border="0" width="$t_width"><tr>
	<td align="left" width="$t_width">★画像をクリックすると拡大図及詳細説明を見ることができます。</TD></tr>
	</table>
	</center>
EOF

	$html_data .= "<br>$foot</body></html>" ;	
	
#	print "Content-type: text/html\n\n";
#	print "$html_data\n";
	
}

#=========================================================================================
sub adm1 {

if($adm_pass eq "1234"){
	$dis_closure = "<br>[パスワード = 1234]<br>";
}

&html_header();

print <<"EOF";
<table width=$o_width align=center cellpadding=0 border=0>
<tr><td>
<div align="right">HTML-MAKER VER2.00</div><hr width=$o_width noshade size=1>
<BR><BR></td></tr></table>
<table bgcolor=$color_adm_r width=400 align=center cellpadding=10 border=1 bordercolor=$color_adm_d>
<tr><td><center>
<form method='post' action="$script_maker">
<input type=hidden name=class value="all">
<input type=hidden name=FF value=0>
<input type=hidden name="keyword" value="">
<input type="hidden" name="superkey" value="1"><br>
◆HTMLを生成します◆<br><br>
生成フォルダ ： $shop_html2<br><br>
管理者用パスワードを入力してください。<br><br>
<input type=password name='pass'>
<input type=hidden name="mode" value="make_ok">
<input type=submit value='HTML生成'>$dis_closure<br>
</form></td></tr></table>
<br></center>
<hr width=$o_width noshade size=1>
$foot
</body></html>
EOF

}
# =======================================================================================
sub adm2 {

if($adm_pass eq "1234"){
	$dis_closure = "<br>[パスワード = 1234]<br>";
}

&html_header();

print <<"EOF";
<table width=$o_width align=center cellpadding=0 border=0>
<tr><td>
<div align="right">HTML-MAKER VER2.00</div><hr width=$o_width noshade size=1>
<BR><BR></td></tr></table>
<table bgcolor=$color_adm_r width=450 align=center cellpadding=10 border=1 bordercolor=$color_adm_d>
<tr><td><center>
<form method='post' action="$script_maker">
<input type=hidden name=class value="all">
<input type=hidden name=FF value=0>
<input type=hidden name="keyword" value="">
<input type="hidden" name="superkey" value="1"><br>
◆フォルダ $shop_html2 に HTMLを生成します◆<br><br>
<input type="checkbox" name="html1" value="on" checked>index.htmlの生成\　\　 
<input type="checkbox" name="html2" value="on">categry.htmlの生成\　\　 
<input type="checkbox" name="html3" value="on">class.htmlの生成\　\　 <br><br><br>
<input type=hidden name="pass" value="$adm_pass">
<input type=hidden name="mode" value="html_make">
<table>
  <tbody>
    <tr>
      <td height="73" width="326">
      まず、設定管理【１】でタイトル、キーワード、アピールを記述します。<br>
      ついで、設定管理で、以下のパスを<FONT color=#ff0000>フルパス（http://〜）</FONT>で設定し、ショッピングカートが正常に動作することを確認してください。なお、SSLを使用している場合、HTML生成後に、画像のパス及びp_imageのパスは相対パスに戻す必要があります。
      <br><FONT color=#ff0000>【注】生成したHTMLをshop.cgiと同じフォルダ内にＵＰする場合は下記のフルパス設定は必要ありません。</FONT>
<ol>
  <LI>shop.cgi・・・・・設定管理【２】
  <LI>shop.cgi(SSL用)・・・・・設定管理【２】
  <LI>entry.cgi・・・・・設定管理【２】
  <LI>entry.cgi(SSL用)・・・・・設定管理【２】
  <LI>m_image(読用)・・・・・設定管理【２】
  <LI>p_image(読用)・・・・・設定管理【２】
  <LI>shop_html・・・・・設定管理【６】
  <LI>リンクテーブル内のリンク・・・・・設定管理【３】
  <LI>壁紙＆デフォルト画像・・・・・設定管理【１３】
  <LI>宣伝広告用のテーブル内のリンク・・・・・設定管理【２５又は２６】
      </ol>
      </td>
    </tr>
  </tbody>
</table>

<input type=submit value=' ＯＫ '>
</form></td></tr></table>
<br></center>
<hr width=$o_width noshade size=1>
$foot
</body></html>
EOF

}

# =======================================================================================
sub result {

&html_header();

foreach(@result_url1){
	$result_link1 .="<LI><A href=\"$_\" target='_brank'><FONT color=#0000ff>$_</FONT></A>";
}
foreach(@result_url2){
	$result_link2 .="<LI><A href=\"$_\" target='_brank'><FONT color=#0000ff>$_</FONT></A>";
}
foreach(@result_url3){
	$result_link3 .="<LI><A href=\"$_\" target='_brank'><FONT color=#0000ff>$_</FONT></A>";
}

print <<"EOF";
<CENTER>
<table width=$o_width align=center cellpadding=0 border=0>
<tr><td>
<div align="right">HTML-MAKER VER2.00</div><hr width=$o_width noshade size=1>
<BR><BR></td></tr></table>
<table bgcolor=$color_adm_r width=500 align=center cellpadding=10 border=1 bordercolor=$color_adm_d>
<tr><td><CENTER><BR>
<B>◆HTMLの生成結果（表\示数の上限 $hyouzi_su_set個）◆</B><BR>
<BR>
<TABLE cellPadding=10 width=400>
<TBODY>
<TR><TD bgcolor="#cef0ff"><FONT color=#0000ff>■ＴＯＰページのHTML生成</FONT><BR>
      <UL>
$result_link1
      </UL></TD></TR>
EOF

print <<"EOF";
<TR><TD bgcolor="#cef0ff"><FONT color=#0000ff>■カテゴリーからHTMLの生成</FONT><BR>
      <UL>
$result_link2
      </UL></TD></TR>
EOF
print <<"EOF";
<TR><TD bgcolor="cef0ff"><FONT color=#0000ff>■分類からHTMLの生成</FONT><BR>
      <UL>
$result_link3
      </UL>
</TD></TR>

<TR><TD bgcolor="#cef0ff"><FONT color=#0000ff>■生成フォルダ</FONT><BR>
      <UL>
<LI><A href=\"$shop_html2/\" target='_brank'><FONT color=#0000ff>$shop_html2</FONT></A>
      </UL></TD></TR>

</TBODY>
</TABLE></CENTER><br>
</TD></TR>
</TBODY>
</TABLE>
<table width=$o_width align=center cellpadding=0 border=0>
<tr><td><br>
<div align="center"><A href="$script_maker"><FONT color=#0000ff>▲戻る</FONT></A></div>
</td></tr></table>
</CENTER><br>
<hr width=$o_width noshade size=1>
$foot
</body></html>
EOF

}

#======================================================================
# Cookieに値を書き込むためのSet-Cookie:ヘッダを生成する
#
sub setCookie{
}
sub setCookie_0{
}
#
# Cookieの値を読み出す
#
sub getCookie{
}

sub html_header{
	print "Content-type: text/html\n\n";
	print "<html><head><title>$main_title</title>\n";
	print "<META content=\"text/html; charset=Shift_JIS\" http-equiv=Content-Type>\n";
	print "<META content=text/css http-equiv=Content-Style-Type>\n";

	print "$style";
	
	print "</head>$body$header\n";

}

#===============================================================
sub error {
&html_header();
	
print <<"EOF";
<CENTER>
<TABLE cellpadding="3" width="$o_width">
	<TBODY>
	<TR>
	<TD align="right" width="$o_width"><A href="$save_data&order=$empty"><font color="#0000ff">▲商品画面</font></A></TD>
	</TR>
	</TBODY>
</TABLE>
</CENTER>
EOF

	print "<br><center>$_[0]</center>\n";
	print "<center>$_[1]</center>\n";

	print "<br><hr noshade size=1 width=$o_width><p>$foot</body></html>";
	exit;
}

