<%

	'グローバル変数

	Dim SelShop
	SelShop = Request("SelShop") '選択ショップ

	Dim Shop
	Shop = Request("Shop") 'こっちは処理対象ショップ

	'↑全ての買い物かごを表示している状態で買い物かごを操作する場合
	'↑「選択ショップ無し」「処理対象ショップ有り」になるので区別する必要がある。


	Dim Mode
	Mode = Request("Mode")

	Dim Cat
	Cat = Request("Cat")
	Dim SubCat
	SubCat = Request("SubCat")
	Dim CatRet
	CatRet = Request("CatRet")

	Dim Area
	Area = Request("Area")
	Dim Pref
	Pref = Request("Pref")

	Dim Item
	Item = Request("Item")


	Dim TopImage
	TopImage = Request("TopImage") '商品詳細でトップ画像を表示しないフラグ


	'トップメニューレベルで必要な処理

	If Cat = "CatRet1" Then
		Cat = ""
		CatRet = "1"
	ElseIf Cat = "CatRet2" Then
		Cat = ""
		CatRet = "2"
	End If

	If CatRet = "1" Then
		'最終選択カテゴリ復元
		Query = "exec SPMビジター取得 '" & VisitorYMDGet(GB_VisitorID) & "', " & VisitorIDGet(GB_VisitorID) & " "
		Set Content = SQLQuery(Query, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
		If Not(Content.BOF Or Content.EOF) Then
			If "" & Content.Fields("最終選択カテゴリ") <> "" Then
				Cat = "" & Content.Fields("最終選択カテゴリ")
				If "" & Content.Fields("最終選択サブカテゴリ") <> "" Then
					SubCat = "" & Content.Fields("最終選択サブカテゴリ")
				End If
			End If
		End If
	ElseIf CatRet = "2" Then
		'生徒が開発した商品(ダミーカテゴリIDを設定)
		Cat = "9999999"
		SubCat = "9999999"
	Else
		If Cat <> "" Then
			'最終選択カテゴリ保存
			Query = "exec SPMビジター最終選択カテゴリ更新 '" & VisitorYMDGet(GB_VisitorID) & "', " & VisitorIDGet(GB_VisitorID) & ", " & Cat & " "
			If SubCat <> "" Then
				Query = Query & ", " & SubCat & ""
			Else
				Query = Query & ", null"
			End If
			Set Content = SQLQuery(Query, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
		End If
	End If


	'学校モール設定取得
	Dim MallGakkoCD
	MallGakkoCD = ""
	Dim MallGakko
	MallGakko = "全国の高校"
	Dim MallName
	MallName = AppTitle
	Dim MallImage
	MallImage = "images/schoolicon_image.png" 'デフォルト画像
	Dim MallLink
	MallLink = ""
	Dim MallSchool
	MallSchool = ""
	Dim MallNewTopic
	MallNewTopic = 1 '表示
	Dim MallBanner
	MallBanner = 2 '全国のショップ
	Dim MallOsusume
	MallOsusume = 2 '全国の商品
	Dim MallNewItem
	MallNewItem = 2 '全国の商品
	Dim MallItemList
	MallItemList = 2 '全国の商品
	Dim MallItemSort
	MallItemSort = 0 '更新日の新しい順
	Dim MallShopList
	MallShopList = 2 '全国のショップ
'GB_HostName = "nonosho"
'GB_HostName = "cuc"
'	If GB_HostName <> "hsns" Then
		Query = ""
		Query = Query & " SELECT * FROM TM学校 WHERE ホスト名 = '" & GB_HostName & "' "
		Set Content = SQLQuery(Query, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
		If Not(Content.BOF Or Content.EOF) Then
'			If GB_HostName <> "hsns" And "" & Content.Fields("学校CD") <> "" Then
			If "" & Content.Fields("公開") <> "1" And "" & LCase(Session("ECMallShopVisible")) <> "" & LCase(Content.Fields("学校CD")) Then
				Response.Write("メンテナンス中")
				Exit Sub
			End If
			If "" & Content.Fields("学校CD") <> "" Then
				MallGakkoCD = "" & Content.Fields("学校CD")
			End If
'			MallGakkoCD = "hsns"
			If "" & Content.Fields("名称") <> "" Then
				MallGakko = "" & Content.Fields("名称")
			End If
			If "" & Content.Fields("タイトル") <> "" Then
				MallName = "" & Content.Fields("タイトル")
			End If
			If "" & Content.Fields("画像Image") <> "" Then
				MallImage = HomeAliasSL & SchoolIconFolderSL & Content.Fields("学校CD") & "/" & Content.Fields("画像Image")
			End If
			If "" & Content.Fields("学校リンク") <> "" Then
				MallLink = "" & Content.Fields("学校リンク")
			End If
			If "" & Content.Fields("画像School") <> "" Then
				MallSchool = HomeAliasSL & SchoolIconFolderSL & Content.Fields("学校CD") & "/" & Content.Fields("画像School")
			End If
			If "" & Content.Fields("最新トピック表示") <> "" And IsNumeric(Content.Fields("最新トピック表示")) Then
				MallNewTopic = CInt(Content.Fields("最新トピック表示"))
			End If
			If "" & Content.Fields("バナー広告表示") <> "" And IsNumeric(Content.Fields("バナー広告表示")) Then
				MallBanner = CInt(Content.Fields("バナー広告表示"))
			End If
			If "" & Content.Fields("おすすめ商品表示") <> "" And IsNumeric(Content.Fields("おすすめ商品表示")) Then
				MallOsusume = CInt(Content.Fields("おすすめ商品表示"))
			End If
			If "" & Content.Fields("新着商品表示") <> "" And IsNumeric(Content.Fields("新着商品表示")) Then
				MallNewItem = CInt(Content.Fields("新着商品表示"))
			End If
			If "" & Content.Fields("商品表示") <> "" And IsNumeric(Content.Fields("商品表示")) Then
				MallItemList = CInt(Content.Fields("商品表示"))
			End If
			If "" & Content.Fields("商品初期ソート") <> "" And IsNumeric(Content.Fields("商品初期ソート")) Then
				MallItemSort = CInt(Content.Fields("商品初期ソート"))
			End If
			If "" & Content.Fields("ショップ一覧表示") <> "" And IsNumeric(Content.Fields("ショップ一覧表示")) Then
				MallShopList = CInt(Content.Fields("ショップ一覧表示"))
			End If
		End If
'	End If
	Dim TmpMallGakkoCD 'トグル用


	'ショップナビバー画像
	Dim ShopName
	Dim ShopImage
	Dim ShopBunner
	Dim IconTop
	Dim IconItem
	Dim IconTransPay
	Dim IconMailOrderLaw
	If SelShop <> "" Then
		Set Content = QueryGetShop(SelShop, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
		If Not(Content.BOF Or Content.EOF) Then
			ShopName = "" & Content.Fields("名称")
			MallName = ShopName 'タイトルをショップ名にする
			ShopImage = "" & Content.Fields("画像Image")
			ShopBunner = "" & Content.Fields("画像Bunner")
			IconTop = "" & Content.Fields("画像Top")
			IconItem = "" & Content.Fields("画像Item")
			IconTransPay = "" & Content.Fields("画像TransPay")
			IconMailOrderLaw = "" & Content.Fields("画像MailOrderLaw")
		End If
	End If
	If ShopImage <> "" Then
		ShopImage = HomeAliasSL & IconFolderSL & SelShop & "/" & ShopImage
	End If
	If ShopBunner <> "" Then
		ShopBunner = HomeAliasSL & IconFolderSL & SelShop & "/" & ShopBunner
	End If
	If IconTop <> "" Then
		IconTop = HomeAliasSL & IconFolderSL & SelShop & "/" & IconTop
	Else
		IconTop = HomeAliasSL & "images/shopicon_top.png"
	End If
	If IconItem <> "" Then
		IconItem = HomeAliasSL & IconFolderSL & SelShop & "/" & IconItem
	Else
		IconItem = HomeAliasSL & "images/shopicon_item.png"
	End If
	If IconTransPay <> "" Then
		IconTransPay = HomeAliasSL & IconFolderSL & SelShop & "/" & IconTransPay
	Else
		IconTransPay = HomeAliasSL & "images/shopicon_transpay.png"
	End If
	If IconMailOrderLaw <> "" Then
		IconMailOrderLaw = HomeAliasSL & IconFolderSL & SelShop & "/" & IconMailOrderLaw
	Else
		IconMailOrderLaw = HomeAliasSL & "images/shopicon_mailorderlaw.png"
	End If

	If LocalMode = "1" Then
		WidthAll = WidthAll - 72
	End If


	Dim PracticeName
	If GB_PracticeCD <> "" Then
		Query = ""
		Query = Query & "  "
		Query = Query & " SELECT * "
		Query = Query & " FROM TM演習 "
		Query = Query & " WHERE 演習CD = '" & GB_PracticeCD & "' "
		Query = Query & " ORDER BY 表示順 "
		Set Content = SQLQuery(Query, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
		If Not(Content.BOF Or Content.EOF) Then
			PracticeName = "" & Content.Fields("名称")
		End If
	End If

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<HTML>
<HEAD>
<% If GB_UserAgent <> "PC" Then %>
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=<% = WidthAll %>">
<% End If %>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta name="description" content="<% = MallGakko %>生が創るオンラインショッピングモールです。商品開発・マーケティング・電子商取引の実践学習や課題研究に幅広く活用されています。">
<meta name="keywords" content="オンラインショッピングモール,ショッピングモール,商品開発,マーケティング,電子商取引,スーパー電商くん,はすねす,hsns,hasunesu,EC,FES,SFC">
<link href="<% = HomeAliasSL %>include.css?<% = Uniq %>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<% = HomeAliasSL %>javascript.js?<% = Uniq %>"></script>
<TITLE><% = MallName %></TITLE>
</HEAD>

<body bgcolor="#ffffff" text="#000000" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<center>
<!-- Dummy Reload(FireFoxではSPANタグ内に改行コードを含めると実体改行されるので注意!)-->
<span style="width:0px;height:0px" id="PageTopAnchor"><IFRAME name="HtmlDummyFrame" SRC="<% = HomeAliasSL %>include_dummy.asp" WIDTH="0" HEIGHT="0" FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 NORESIZE SCROLLING=no></IFRAME></span>
<% If LocalMode = "1" And (GB_VisitorID = "" Or GB_PracticeCD = "") Then %>
<% Else %>
<!-- Top Menu Start -->
<table border="0" width="<% = WidthAll %>" cellpadding="0" cellspacing="0" bgcolor="#ffffff" class="tx1416">
	<% If SelShop = "" Then 'トップメニュー %>
	<tr>
		<td align="<% If GB_UserAgent = "PC" Then %>left<% Else %>center<% End If %>">
			<table border="0" cellpadding="0" cellspacing="0" class="tx1416">
				<tr>
					<td width="4"><% = Spacer(4, 1) %></td>
				<% If GB_UserAgent = "PC" Then %>
					<td width="60" align="left"><a href="<% = HomeAliasSL %>"><img src="<% = MallImage %>" border="0" width="240" height="60" alt="<% = MallName %>"></a></td>
				<% End If %>
				<% If 0=1 And ShopBunner <> "" Then %>
					<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>"><img src="<% = ShopBunner %>" width="468" height="60" border="0" alt="<% = ShopName %>"></a></td>
				<% ElseIf SelShop <> "" Then %>
					<td class="tx2830" style="border:1px solid #aaaaaa;" width="466" height="58" align="center" valign="middle"><% = ShopName %></td>
				<% Else %>
				<%
					'ランダムバナー
					Dim BannerCnt
					BannerCnt = 0
					Dim RndNo
					RndNo = 0
					Dim ShopCDAry
					Dim BunnerAry
					ReDim ShopCDAry(0)
					ReDim BunnerAry(0)
					TmpMallGakkoCD = ""
					If MallBanner = 1 Then
						TmpMallGakkoCD = MallGakkoCD
					End If
'response.write(TmpMallGakkoCD)
					Set Content = QueryGetShop(TmpMallGakkoCD, SQLServer, DatabaseName, DatabaseUser, DatabasePass)
					Do While Not(Content.BOF Or Content.EOF)
						If "" & Content.Fields("画像Bunner") <> "" Then
							'前回表示バナーも除外せずにカウントする
							BannerCnt = BannerCnt + 1
							'バナーが複数設定されている場合は前回表示したバナー番号を除外する
							If "" & Session("ECMallRandomBunner") <> "" & Content.Fields("ショップID") Then
								'バナー画像が存在するショップのみ配列化
								ReDim PreServe ShopCDAry(UBound(ShopCDAry) + 1) '配列+1
								ReDim PreServe BunnerAry(UBound(BunnerAry) + 1) '配列+1
								ShopCDAry(UBound(ShopCDAry)) = Content.Fields("ショップID")
								BunnerAry(UBound(BunnerAry)) = Content.Fields("画像Bunner")
							End If
						End If
						Content.MoveNext
					Loop
					If UBound(ShopCDAry) > 0 Then
						Randomize
						RndNo = Int((UBound(ShopCDAry) * Rnd) + 1) '1~最大配列数の数値を生成(Fix関数では正しく処理されない?)
				%>
					<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = ShopCDAry(RndNo) %>"><img src="<% = HomeAliasSL & IconFolderSL & ShopCDAry(RndNo) & "/" & BunnerAry(RndNo) %>" border="0" width="468" height="60" alt="<% = ShopName %>"></a></td>
				<%
						If BannerCnt > 1 Then
							'バナーが複数設定されている場合は表示したバナー番号を次回除外する
							Session("ECMallRandomBunner") = "" & ShopCDAry(RndNo)
						End If
					End If
				%>
				<% End If %>
				</tr>
			</table>
		</td>
		<% If GB_UserAgent <> "PC" Then %>
	</tr>
</table>
<table border="0" width="<% = WidthAll %>" cellpadding="0" cellspacing="0" bgcolor="#ffffff" class="tx1416">
	<tr>
		<td><% = Spacer(1, 7) %></td>
	</tr>
	<tr>
		<td><% = Spacer(5, 1) %></td>
		<td width="65" align="left"><a href="<% = HomeAliasSL %>"><img src="<% = MallImage %>" border="0" width="240" height="60" alt="<% = MallName %>"></a></td>
		<% End If %>
		<td align="right">
			<table border="0" cellpadding="0" cellspacing="0" class="tx1416">
				<tr>
<% If LocalMode <> "1" Then %>
					<td align="right">
					</td>
					<td align="right">
					</td>
					<td align="right">
						<% = ActionButton3Image("KanriBtn", "images/kanri.png", "images/kanri_o.png", 21, "images/spacer.gif", "images/spacer.gif", 40, "images/spacer.gif", "images/spacer.gif", 5, 20, "管 理", "tx1416", "center", "location.href='" & HomeAliasSL & "adminlogin.asp';") %>
					</td>
				</tr>
				<tr>
					<td><% = Spacer(1, 4) %></td>
				</tr>
				<tr>
					<td align="right">
						<% = ActionButton3Image("CartBtn", "images/cart.png", "images/cart_o.png", 24, "images/spacer.gif", "images/spacer.gif", 73, "images/spacer.gif", "images/spacer.gif", 5, 20, "買い物かご", "tx1416", "center", "location.href='" & HomeAliasSL & "cart.asp?SelShop=" & SelShop & "';") %>
					</td>
					<td><% = Spacer(7, 1) %></td>
					<td align="right">
						<% = ActionButton3Image("NewsBtn", "images/newstopics.png", "images/newstopics_over.png", 21, "images/spacer.gif", "images/spacer.gif", 87, "images/spacer.gif", "images/spacer.gif", 5, 20, "NewsTopics", "tx1416", "center", "location.href='" & HomeAliasSL & "?Mode=News';") %>
					</td>
<% Else %>
					<td align="right" colspan="3" class="tx1214">
						<% = PracticeName %>&nbsp;&nbsp;
					</td>
				<tr>
					<td><% = Spacer(1, 4) %></td>
				</tr>
					<td align="right">
						<% = ActionButton3Image("CartBtn", "images/cart.png", "images/cart_o.png", 24, "images/spacer.gif", "images/spacer.gif", 73, "images/spacer.gif", "images/spacer.gif", 5, 20, "買い物かご", "tx1416", "center", "location.href='" & HomeAliasSL & "cart.asp?SelShop=" & SelShop & "';") %>
					</td>
					<td><% = Spacer(7, 1) %></td>
					<td align="right">
						<% = ActionButton3Image("KanriBtn", "images/kanri.png", "images/kanri_o.png", 21, "images/spacer.gif", "images/spacer.gif", 40, "images/spacer.gif", "images/spacer.gif", 5, 20, "管 理", "tx1416", "center", "location.href='" & HomeAliasSL & "adminlogin.asp';") %>
					</td>
<% End If %>
				</tr>
			</table>
		</td>
	</tr>
	<% End If %>
	<% If SelShop <> "" Then 'ショップナビバー %>
<!-- Shop Menu Start -->
	<tr>
		<td colspan="2">
			<table id="ShopNaviBar" border="0" width="100%" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
				<% 'If TopImage <> "0" And Item <> "" And IsNumeric(Item) And ShopImage <> "" Then 'ショップイメージ %>
				<% 'If ShopImage <> "" And (Item <> "" Or Mode <> "" Or InStr(LCase(Request.ServerVariables("SCRIPT_NAME")), "cart.asp") > 0 Or InStr(LCase(Request.ServerVariables("SCRIPT_NAME")), "login.asp") > 0 Or InStr(LCase(Request.ServerVariables("SCRIPT_NAME")), "order.asp") > 0 Or InStr(LCase(Request.ServerVariables("SCRIPT_NAME")), "mail.asp") > 0) Then 'ショップイメージ %>
				<% If ShopImage <> "" Then 'ショップイメージ %>
				<%
					'JavaScriptでのメニュー高さ取得に失敗するのでここで画像サイズを取得し固定する
					If GB_UserAgent = "PC" Then
						Call ImageSize(ShopImage)
					Else
						'スマフォ用は横幅固定
						ImageWidth = WidthAll
					End If
				%>
				<tr>
					<td align="center"><img src="<% = ShopImage %>" width="<% = ImageWidth %>"<% If GB_UserAgent <> "PC" Then %> height="<% = ImageHeight %>"<% End If %> border="0" alt="<% = ShopName %>"></td>
				</tr>
				<% ElseIf Item <> "" Or Mode <> "" Then %>
				<tr>
					<td align="center">
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td class="tx2830" style="border:1px solid #aaaaaa;" width="466" height="58" align="center" valign="middle"><% = ShopName %></td>
							</tr>
						</table>
					</td>
				</tr>
				<% End If %>
				<tr>
					<td align="center">
						<table border="0" cellspacing="0" class="tx1416">
							<tr>
							<% If GB_UserAgent = "PC" Then %>
								<td><% = ActionButton3Image("ReturnNaviBar", "images/naviber_mallback.png", "images/naviber_mallback_over.png", 30, "images/spacer.gif", "images/spacer.gif", 62, "images/spacer.gif", "images/spacer.gif", 0, 40, "モールに<br>戻る", "tx1416", "center", "location.href='" & HomeAliasSL & "';") %></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>"><img src="<% = IconTop %>" height="40" border="0" alt="店舗TOP"></a></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Item=All"><img src="<% = IconItem %>" height="40" border="0" alt="商品一覧"></a></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Mode=transpay"><img src="<% = IconTransPay %>" height="40" border="0" alt="お支払方法・送料について"></a></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Mode=mailorderlaw"><img src="<% = IconMailOrderLaw %>" height="40" border="0" alt="特定商取引法に基づく表示"></a></td>
								<td><% = ActionButton3Image("CurtNaviBar", "images/naviber_cart.png", "images/naviber_cart_over.png", 38, "images/spacer.gif", "images/spacer.gif", 48, "images/spacer.gif", "images/spacer.gif", 0, 40, "買い物<br>かご", "tx1416", "center", "location.href='" & HomeAliasSL & "cart.asp?SelShop=" & SelShop & "';") %></td>
								<td><% = ActionButton3Image("MailNaviBar", "images/naviber_envelope.png", "images/naviber_envelope_over.png", 42, "images/spacer.gif", "images/spacer.gif", 62, "images/spacer.gif", "images/spacer.gif", 0, 40, "お問合せ", "tx1416", "center", "location.href='" & HomeAliasSL & "mail.asp?SelShop=" & SelShop & "';") %></td>
							<% Else %>
								<td><% = ActionButton3Image("ReturnNaviBar", "images/naviber_mallback.png", "images/naviber_mallback_over.png", 30, "images/spacer.gif", "images/spacer.gif", 62, "images/spacer.gif", "images/spacer.gif", 0, 40, "モールに<br>戻る", "tx1416", "center", "location.href='" & HomeAliasSL & "';") %></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>"><img src="<% = IconTop %>" height="40" border="0" alt="店舗TOP"></a></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Item=All"><img src="<% = IconItem %>" height="40" border="0" alt="商品一覧"></a></td>
								<td><% = ActionButton3Image("MailNaviBar", "images/naviber_envelope.png", "images/naviber_envelope_over.png", 42, "images/spacer.gif", "images/spacer.gif", 62, "images/spacer.gif", "images/spacer.gif", 0, 40, "お問合せ", "tx1416", "center", "location.href='" & HomeAliasSL & "mail.asp?SelShop=" & SelShop & "';") %></td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Mode=transpay"><img src="<% = IconTransPay %>" height="40" border="0" alt="お支払方法・送料について"></a></td>
								<td><a href="<% = HomeAliasSL %>shop.asp?SelShop=<% = SelShop %>&Mode=mailorderlaw"><img src="<% = IconMailOrderLaw %>" height="40" border="0" alt="特定商取引法に基づく表示"></a></td>
								<td><% = ActionButton3Image("CurtNaviBar", "images/naviber_cart.png", "images/naviber_cart_over.png", 38, "images/spacer.gif", "images/spacer.gif", 48, "images/spacer.gif", "images/spacer.gif", 0, 40, "買い物<br>かご", "tx1416", "center", "location.href='" & HomeAliasSL & "cart.asp?SelShop=" & SelShop & "';") %></td>
							<% End If %>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
<!-- Shop Menu End -->
	<% End If %>
</table>
<!-- Top Menu End -->
<% End If %>