<?php include_once( "../../../spider.inc.php" ); ?>
{charset:UTF-8}
{template:admin_default.tpl}
{module:system.login.Require}
{module:shopping.category.LoadList}
{module:shopping.product.LoadList}
{module:shopping.promotion.LoadList get(pr=1000)}
{preset:page_title 'ショップ管理 > ' . SHOPPING_LABEL_PRODUCT . 'の一覧と検索'}

	<div class="panc">
	{if:is_object(shopping.product.searchDataObject)}
		<a href="../../">管理パネルトップ</a>
		&gt; <a href="../../search/data/detail.php?schdi={write:shopping.product.searchDataObject->'data_id'}">{write:shopping.product.searchDataObject->'subject'}</a>
	{else}
		<a href="../../">管理パネルトップ</a>
		&gt; <a href="../">ショップ管理</a>
	{/if}
		&gt; {write:SHOPPING_LABEL_PRODUCT}管理
	</div>

	<h1>
		ショップ管理 &gt;
		{if:is_object(shopping.product.searchDataObject)}
			{write:shopping.product.searchDataObject->'subject'}の
		{/if}
		{write:SHOPPING_LABEL_PRODUCT}一覧と検索
	</h1>
	{if:is_object(shopping.product.searchDataObject)}
	<div style="width:95%;margin:0 auto;text-align:right;">
		<a href="../../search/data/detail.php?schdi={write:shopping.product.searchDataObject->'data_id'}">{write:shopping.product.searchDataObject->'subject'}の詳細に戻る</a>
	</div>
	{/if}
<style type="text/css">
<!--
.status_0 { background-color: #FFdddd; }
.status_91 { background-color: #d0d0d0; }
.status_101 { };
//-->
</style>

	{if:IS_ERROR}
		<h2>エラー</h2>
		<ul class="error">
		{foreach:errors error}
			<li>{write:error}</li>
		{/foreach}
	</ul>
	{/if}

	<form name="sform" action="./index.php" method="get">
	<input type="hidden" name="pn" value="{write:shopping.product.page_number}" />
	{if:is_object(shopping.product.searchDataObject)}
	<input type="hidden" name="schdi" value="{write:shopping.product.searchDataObject->'data_id'}" />
	{/if}
	<table style="margin:0 auto;width:96%;">
	<tbody>
	<tr>
		<td style="line-height:2em;vertical-align:top;">
			カテゴリ：<select name="shpci" onchange="document.sform.submit();">
				<option value=""{if:count(shopping.product.category_id_array)=0} selected{/if}>全て</option>
			{foreach:shopping.category.data_array num categoryObject}
			{set:childCategoryArray categoryObject->'child_category_object_array'}
				<option value="{write:categoryObject->'category_id'}"
					{if:in_array(categoryObject->'category_id',shopping.product.category_id_array)} selected{/if}
					>{write:categoryObject->'category_name'}({write:categoryObject->getTotalItemCount()})</option>
				{foreach:childCategoryArray childCategoryObject}
				{set:grandChildCategoryArray childCategoryObject->'child_category_object_array'}
				<option value="{write:childCategoryObject->'category_id'}"
					{if:in_array(childCategoryObject->'category_id',shopping.product.category_id_array)} selected{/if}
					>&nbsp;{if:childCategoryArray_loop_counter==count(childCategoryArray)}┗{else}┣{/if}&nbsp;{write:childCategoryObject->'category_name'}({write:childCategoryObject->getTotalItemCount()})</option>
					{foreach:grandChildCategoryArray grandChildCategoryObject}
					<option value="{write:grandChildCategoryObject->'category_id'}"
						{if:in_array(grandChildCategoryObject->'category_id',shopping.product.category_id_array)} selected{/if}
						>&nbsp;&nbsp;{if:grandChildCategoryArray_loop_counter==count(grandChildCategoryArray)}┗{else}┣{/if}&nbsp;{write:grandChildCategoryObject->'category_name'}({write:grandChildCategoryObject->getTotalItemCount()})</option>
					{/foreach}
				{/foreach}
			{/foreach}
			</select>
			<nobr>状態：<select name="shpstf" onchange="document.sform.submit();">
				<option value=""{if:strlen(shopping.product.status_flag)=0} selected{/if}>全て</option>
				{foreach:SHOPPING_PRODUCT_STATUS_HASH key status_name}
					{if:key<=230}
					<option value="{write:key}"
						{if:key=shopping.product.status_flag and strlen(shopping.product.status_flag)>0} selected{/if}
						>{write:status_name}</option>
					{/if}
				{/foreach}
			</select></nobr>
			<span style="white-space:nowrap;">
				&nbsp;価格帯：<input type="text" name="shpll" size="6" value="{write:shopping.product.lowerLimit}" />円
				～ <input type="text" name="shpul" size="6" value="{write:shopping.product.upperLimit}" />円
			</span>
			<br />
			<nobr>検索ワード：<input type="text" name="shpq" value="{write:shopping.product.query}" /> <input type="submit" value="検索実行" /></nobr>
		</td>
		<td style="text-align:right;line-height:2em;">
			<nobr>
			<input type="button" value="{write:SHOPPING_LABEL_PRODUCT}追加" onclick="window.location.href='./form.php{if:is_object(shopping.product.searchDataObject)}?schdi={write:shopping.product.searchDataObject->'data_id'}{/if}'"
			/><input type="button" value="CSVダウンロード" onclick="window.location.href='./download/form.php';"
			/><input type="button" value="CSV登録" onclick="window.location.href='./upload/form.php';"
			/><br />
			<?php for ( $key=0;$key<=1;$key++ ) { $request_object->setAttribute('key',$key); ?>
			並べ替え項目<?php echo $key+1; ?>：<select name="shpsi[]" onchange="document.sform.submit();">
				<option value="order"{if:shopping.product.sort_item_array[key]=='order'} selected{/if}>順序</option>
				<option value="reg"{if:shopping.product.sort_item_array[key]=='reg'} selected{/if}>登録日</option>
				<option value="upd"{if:shopping.product.sort_item_array[key]=='upd'} selected{/if}>更新日</option>
				<option value="dname"{if:shopping.product.sort_item_array[key]=='dname'} selected{/if}>{write:SHOPPING_LABEL_PRODUCT}名</option>
				<option value="did"{if:shopping.product.sort_item_array[key]=='did'} selected{/if}>{write:SHOPPING_LABEL_PRODUCT}ID</option>
			</select>
			並び順 <select name="shpso[]" onchange="document.sform.submit();">
				<option value="asc"{if:shopping.product.sort_order_array[key]='ASC'} selected{/if}>昇順</option>
				<option value="desc"{if:shopping.product.sort_order_array[key]='DESC' or strlen(shopping.product.sort_item_array[key])==0} selected{/if}>降順</option>
			</select><br />
			<?php } ?>
			ページ表示数：<select name="pr" onchange="document.sform.submit();">
				<option value="1"{if:shopping.product.page_rows==1} selected{/if}>1</option>
				<option value="5"{if:shopping.product.page_rows==5} selected{/if}>5</option>
				<option value="10"{if:shopping.product.page_rows==10} selected{/if}>10</option>
				<option value="20"{if:shopping.product.page_rows==20} selected{/if}>20</option>
				<option value="50"{if:shopping.product.page_rows==50} selected{/if}>50</option>
				<option value="100"{if:shopping.product.page_rows==100} selected{/if}>100</option>
			</select>
			</nobr>
		</td>
	</tr>
	</tbody>
	</table>
	</form>
	<br />
	<div style="width:96%;margin:0 auto;">
		{if:shopping.product.total_page>1}
			{write:shopping.product.total_count}件の検索結果 {write:shopping.product.page_number}/{write:shopping.product.total_page}ページ {write:count(shopping.product.product_array)}件を表示
			&nbsp;
			{if:shopping.product.page_number-5>1}...{/if}
			<?php for( $GLOBALS['pageNavi']=($GLOBALS['shopping.product.page_number']-5 >= 1 ? $GLOBALS['shopping.product.page_number']-5 : 1);
				$GLOBALS['pageNavi']<=$GLOBALS['shopping.product.total_page']
					&& $GLOBALS['pageNavi']<=($GLOBALS['shopping.product.page_number']-5 >= 1 ? $GLOBALS['shopping.product.page_number']-5 : 1)+9;
				$GLOBALS['pageNavi']++ ) { ?>
				{if:trim(pageNavi)!=trim(shopping.product.page_number)}
					<a href="javascript:FormerCommon.jumpPage({write:pageNavi})" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">{write:pageNavi}</a>
				{else}
					{write:pageNavi}
				{/if}
			<?php } ?>
			{if:shopping.product.page_number+9 < shopping.product.total_page}...{/if}
			&nbsp;
			{if:shopping.product.page_number-5>1}<a href="javascript:FormerCommon.jumpPage(1)" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">最初</a>{/if}
			{if:shopping.product.page_number+9 < shopping.product.total_page}<a href="javascript:FormerCommon.jumpPage({write:shopping.product.total_page})" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">最後</a>{/if}
			{if:shopping.product.has_prev_page}<a href="javascript:FormerCommon.prevPage()" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">前頁</a>{/if}
			{if:shopping.product.has_next_page}<a href="javascript:FormerCommon.nextPage()" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">次頁</a>{/if}
		{else}
			{write:shopping.product.total_count}件の検索結果
		{/if}
	</div>
	<table class="list" style="margin:0 auto;width:98%;">
	<tbody>
	{foreach:shopping.product.product_array product}
	<tr class="status_{write:product->'status_flag'}">
		<th colspan="2" style="width:100%;"><div style="width:100%;">
			<div style="width:75%;float:left;">
				<a href="./detail.php?shpdn={write:product->'product_number'}"
					title="{write:product->'product_name'}の詳細を表示"
				>{write:product->'product_id'}</a>
				:
				{write:product->'product_name'}
				&nbsp;
				<span style="font-size:x-small;">
				[<a href="/shopping/detail.php?shpdi={write:product->'product_id'}" target="_blank">表示</a>]
				</span>
			</div>
			<div style="width:24%;float:right;text-align:right;white-space:nowrap;">
				<select name="status_flag_{write:product->'product_number'}"
				onchange="shoppingProductStatusChange({write:product->'product_number'},this.options[this.selectedIndex].value)">
				{foreach:SHOPPING_PRODUCT_STATUS_HASH key status_name}
					<option value="{write:key}"
						{if:key==product->'status_flag'} selected{/if}
						>{write:status_name}</option>
				{/foreach}
				</select>
				[<a href="./form.php?shpdn={write:product->'product_number'}"
					title="{write:product->'product_name'}の登録情報を編集"
					>編集</a>]
			</div>
			<div style="clear:both;text-align:right;font-size:x-small;">
				閲覧<span style="background-color:#ffffff;line-height:1.8em;vertical-align:middle;">
				{foreach:MEMBER_MEMBER_CLASS_HASH key value}
				<input type="checkbox" name="member_viewable_{write:product->'product_number'}"
				value="{write:key}"{if:in_array(key,product->'memberViewableArray')} checked{/if}
				style="vertical-align:middle;"
				onclick="shoppingProductOpenChange({write:product->'product_number'})"
				/>{write:mb_substr(value,0,1)}
				{/foreach}
				</span>
				&nbsp;{write:SHOPPING_LABEL_ORDER}<span style="background-color:#ffffff;line-height:1.8em;vertical-align:middle;">
				{foreach:MEMBER_MEMBER_CLASS_HASH key value}
				<input type="checkbox" name="member_purchasable_{write:product->'product_number'}" value="{write:key}"
				{if:in_array(key,product->'memberPurchasableArray')} checked{/if}
				style="vertical-align:middle;"
				onclick="shoppingProductOpenChange({write:product->'product_number'})"
				/>{write:mb_substr(value,0,1)}
				{/foreach}
				</span>
			</div>
			<div style="clear:both;text-align:right;font-size:x-small;">
				<?php for( $GLOBALS['num']=0; $GLOBALS['num']<12; $GLOBALS['num']++ ){ ?>
				<select name="shpci_{write:product->'product_number'}_{write:num}"
				onchange="shoppingProductCategoryChange({write:product->'product_number'},{write:num},this.options[this.selectedIndex].value)"
				style="font-size:9px;">
					<option value="" {if:count(shopping.product.category_id_array)==0} selected{/if}>-</option>
				{foreach:shopping.category.data_array categoryObject}
				{set:childCategoryArray categoryObject->'child_category_object_array'}
					<option value="{write:categoryObject->'category_id'}"
						{if:isset(product->'categoryIdArray'[num]) && product->'categoryIdArray'[num]==categoryObject->'category_id'} selected{/if}
						>{write:categoryObject->'category_name'}</option>
					{foreach:childCategoryArray childCategoryObject}
					{set:grandChildCategoryArray childCategoryObject->'child_category_object_array'}
					<option value="{write:childCategoryObject->'category_id'}"
						{if:isset(product->'categoryIdArray'[num]) && product->'categoryIdArray'[num]==childCategoryObject->'category_id'} selected{/if}
						>&nbsp;{if:childCategoryArray_loop_counter==count(childCategoryArray)}┗{else}┣{/if}&nbsp;{write:childCategoryObject->'category_name'}</option>
						{foreach:grandChildCategoryArray grandChildCategoryObject}
						<option value="{write:grandChildCategoryObject->'category_id'}"
							{if:isset(product->'categoryIdArray'[num]) && product->'categoryIdArray'[num]==grandChildCategoryObject->'category_id'} selected{/if}
							>&nbsp;&nbsp;&nbsp;{if:grandChildCategoryObject_loop_counter==count(grandChildCategoryObject)}┗{else}┣{/if}&nbsp;{write:grandChildCategoryObject->'category_name'}</option>
						{/foreach}
					{/foreach}
				{/foreach}
				</select>
				<?php } ?>
			</div>
		</div></th>
	</tr>
	<tr class="status_{write:product->'status_flag'}" style="{if:product::is_lock}background-color:{if:product::is_editable}#FFFFDD{else}#FFE0E0{/if}{/if};">
		<td class="status_{write:product->'status_flag'}" style="width:80px;vertical-align:middle;text-align:center;">
			{set:fileIdArray product::fileIdArray}
			{if:strlen(fileIdArray[0])>0}
				<img src="/file/download.php?fi={write:fileIdArray[0]}&amp;w=80&amp;h=80" />
			{else}
				画像なし
			{/if}
		</td>
		<td class="status_{write:product->'status_flag'}" style="font-size:x-small;vertical-align:top;padding:0px;">
			<table style="border-style:none;border-collapse:collapse;width:100%;margin:0px;height:100%;">
			<tbody>
			{foreach:product::unitObjectArray unitObject}
			<tr{if:unitObject->'status_flag'<100} style="background-color:#c0c0c0;"{/if}>
				<td style="border-bottom:dotted 1px #d0d0d0;white-space:nowrap;width:30%;{if:unitObject->'status_flag'<100}background-color:#c0c0c0;{/if}">
					<a href="./unit/detail.php?shpun={write:unitObject->'unit_number'}">{write:unitObject->'unit_name'}</a>
				</td>
				<td style="border-bottom:dotted 1px #d0d0d0;white-space:nowrap;text-align:right;width:20%;{if:unitObject->'status_flag'<100}background-color:#c0c0c0;{/if}">&yen;{write:number_format(unitObject->'price_sell')}-</td>
				<td style="border-bottom:dotted 1px #d0d0d0;white-space:nowrap;text-align:right;width:15%;{if:unitObject->'status_flag'<100}background-color:#c0c0c0;{/if}">
					{if:unitObject->'stock'==-1}
						無制限
					{else-if:unitObject->'stock'<-1}
						{write:unitObject->'stock_view'}{if:strlen(unitObject->'unit_string')>0}{write:unitObject->'unit_string'}{else-if:strlen(product->'unit_string')>0}{write:product->'unit_string'}{else}個{/if}
					{else}
						<input type="text" size="3" name="stock_{write:unitObject->'unit_id'}" value="{write:unitObject->'stock'}"
						style="text-align:right;"
						onfocus="shoppingProductUnitSetCurrentStock(this.value)"
						onblur="shoppingProductUnitStockChange({write:unitObject->'unit_number'},this.value)"
						/>{if:strlen(unitObject->'unit_string')>0}{write:unitObject->'unit_string'}{else-if:strlen(product->'unit_string')>0}{write:product->'unit_string'}{else}個{/if}
					{/if}
				</td>
				<td style="font-size:x-small;border-bottom:dotted 1px #d0d0d0;white-space:nowrap;text-align:right;width:15%;{if:unitObject->'status_flag'<100}background-color:#c0c0c0;{/if}">{write:number_format(unitObject->'present_point')}Pt.</td>
				<td style="border-bottom:dotted 1px #d0d0d0;white-space:nowrap;text-align:right;width:15%;{if:unitObject->'status_flag'<100}background-color:#c0c0c0;{/if}">
					<select name="status_flag_{write:product->'product_number'}_{write:unitObject->'unit_number'}"
					onchange="shoppingProductUnitStatusChange({write:unitObject->'unit_number'},this.options[this.selectedIndex].value)">
					{foreach:SHOPPING_PRODUCT_STATUS_HASH key status_name}
						<option value="{write:key}"
							{if:key==unitObject->'status_flag'} selected{/if}
							>{write:status_name}</option>
					{/foreach}
					</select>
					[<a href="./unit/form.php?shpun={write:unitObject->'unit_number'}"
						title="{write:unitObject->'unit_name'}の編集"
						>編集</a>]
					{if:unitObject->'delivery_type'>=200}
					<br />
					[<a href="../calendar/?shpdi={write:product->'product_id'}&amp;shpui={write:unitObject->'unit_id'}"
					>日別価格設定</a>]
					&nbsp;
					{/if}
				</td>
			</tr>
			{/foreach}
			</tbody>
			</table>
			<div style="text-align:right;">
				{if:product->'delivery_type'>=200}
				<a href="../calendar/?shpdi={write:product->'product_id'}"
				>個別営業日設定</a>
				&nbsp;
				{/if}
				<a href="./unit/form.php?shpdi={write:product->'product_id'}"
				title="{write:product->'product_name'}に販売単位を追加"
				>+販売単位の追加</a>
			</div>
		</td>
	</tr>
	{/foreach}
	</tbody>
	</table>
	<div style="width:96%;margin:0 auto;">
		{if:shopping.product.total_page>1}
			{write:shopping.product.total_count}件の検索結果 {write:shopping.product.page_number}/{write:shopping.product.total_page}ページ {write:count(shopping.product.product_array)}件を表示
			&nbsp;
			{if:shopping.product.page_number-5>1}...{/if}
			<?php for( $GLOBALS['pageNavi']=($GLOBALS['shopping.product.page_number']-5 >= 1 ? $GLOBALS['shopping.product.page_number']-5 : 1);
				$GLOBALS['pageNavi']<=$GLOBALS['shopping.product.total_page']
					&& $GLOBALS['pageNavi']<=($GLOBALS['shopping.product.page_number']-5 >= 1 ? $GLOBALS['shopping.product.page_number']-5 : 1)+9;
				$GLOBALS['pageNavi']++ ) { ?>
				{if:trim(pageNavi)!=trim(shopping.product.page_number)}
					<a href="javascript:FormerCommon.jumpPage({write:pageNavi})" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">{write:pageNavi}</a>
				{else}
					{write:pageNavi}
				{/if}
			<?php } ?>
			{if:shopping.product.page_number+9 < shopping.product.total_page}...{/if}
			&nbsp;
			{if:shopping.product.page_number-5>1}<a href="javascript:FormerCommon.jumpPage(1)" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">最初</a>{/if}
			{if:shopping.product.page_number+9 < shopping.product.total_page}<a href="javascript:FormerCommon.jumpPage({write:shopping.product.total_page})" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">最後</a>{/if}
			{if:shopping.product.has_prev_page}<a href="javascript:FormerCommon.prevPage()" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">前頁</a>{/if}
			{if:shopping.product.has_next_page}<a href="javascript:FormerCommon.nextPage()" onmouseover="this.style.color='#0000ff';" onmouseout="this.style.color='#808080';">次頁</a>{/if}
		{else}
			{write:shopping.product.total_count}件の検索結果
		{/if}
	</div>

	<hr style="width:95%;margin:0 auto;margin-top:1em;" />
	<div style="width:95%;margin:0 auto;text-align:right;">
		<a href="./download/form.php">&gt;&gt; CSVダウンロード</a>
		{if:is_object(shopping.product.searchDataObject)}
		&nbsp;&nbsp;
		<a href="../../search/data/detail.php?schdi={write:shopping.product.searchDataObject->'data_id'}">&gt;&gt; {write:shopping.product.searchDataObject->'subject'}の詳細に戻る</a>
		{/if}
	</div>

<script type="text/javascript"><!--
var shoppingProductStatusHttpObject;
//
// {write:SHOPPING_LABEL_PRODUCT}の状態を変更する
//
function shoppingProductStatusChange(productNumber,statusFlag) {
	var contents	= 'product_number='+productNumber
	+'&status_flag='+statusFlag;
	shoppingProductStatusHttpObject	= FormerCommon.createHttpRequest(shoppingProductStatusChangeResult);
	if( shoppingProductStatusHttpObject ) {
		FormerCommon.displayGrayOut(9999);
		shoppingProductStatusHttpObject.open("POST",'./status.php',true);
		shoppingProductStatusHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		shoppingProductStatusHttpObject.send(contents);
	} else {
		alert('サーバー通信作成に失敗しました!');
	}
}
function shoppingProductStatusChangeResult(){
	if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status == 200)){
		setTimeout(FormerCommon.displayWhiteIn, 100);
	    var lines	= shoppingProductStatusHttpObject.responseText.cr2lf().split(LF);
	    var result	= '';
	    while( result.length == 0 && lines.length > 0 ) {
	    	result	= lines.shift();
	    }
	    if( 'OK' == result ) {
	    } else {
	    	alert(shoppingProductStatusHttpObject.responseText);
	    }
	} else if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status != 200)){
		alert('状態変更中にサーバー通信に失敗しました');
	}
}
//
// 販売単位の状態を変更する
//
function shoppingProductUnitStatusChange(unitNumber,statusFlag) {
	var contents	= 'unit_number='+unitNumber
	+'&status_flag='+statusFlag;
	shoppingProductStatusHttpObject	= FormerCommon.createHttpRequest(shoppingProductUnitStatusChangeResult);
	if( shoppingProductStatusHttpObject ) {
		FormerCommon.displayGrayOut(9999);
		shoppingProductStatusHttpObject.open("POST",'./unit/status.php',true);
		shoppingProductStatusHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		shoppingProductStatusHttpObject.send(contents);
	} else {
		alert('サーバー通信作成に失敗しました!');
	}
}
function shoppingProductUnitStatusChangeResult(){
	if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status == 200)){
		setTimeout(FormerCommon.displayWhiteIn, 100);
	    var lines	= shoppingProductStatusHttpObject.responseText.cr2lf().split(LF);
	    var result	= '';
	    while( result.length == 0 && lines.length > 0 ) {
	    	result	= lines.shift();
	    }
	    if( 'OK' == result ) {
	    } else {
	    	alert(shoppingProductStatusHttpObject.responseText);
	    }
	} else if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status != 200)){
		alert('状態変更中にサーバー通信に失敗しました');
	}
}
//
// {write:SHOPPING_LABEL_PRODUCT}のカテゴリを変更する
//
function shoppingProductCategoryChange(productNumber,categoryOrder,categoryId) {
	var contents	= 'product_number='+productNumber
	+'&category_order='+categoryOrder
	+'&category_id='+categoryId;
	shoppingProductStatusHttpObject	= FormerCommon.createHttpRequest(shoppingProductCategoryChangeResult);
	if( shoppingProductStatusHttpObject ) {
		FormerCommon.displayGrayOut(9999);
		shoppingProductStatusHttpObject.open("POST",'./category.php',true);
		shoppingProductStatusHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		shoppingProductStatusHttpObject.send(contents);
	} else {
		alert('サーバー通信作成に失敗しました!');
	}
}
function shoppingProductCategoryChangeResult(){
	if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status == 200)){
		setTimeout(FormerCommon.displayWhiteIn, 100);
	    var lines	= shoppingProductStatusHttpObject.responseText.cr2lf().split(LF);
	    var result	= '';
	    while( result.length == 0 && lines.length > 0 ) {
	    	result	= lines.shift();
	    }
	    if( 'OK' == result ) {
	    } else {
	    	alert(shoppingProductStatusHttpObject.responseText);
	    }
	} else if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status != 200)){
		alert('状態変更中にサーバー通信に失敗しました');
	}
}
//
// {write:SHOPPING_LABEL_PRODUCT}の権限を変更する
//
function shoppingProductOpenChange(productNumber) {
	var contents	= 'product_number='+productNumber;
	var checkName	= 'member_viewable_'+productNumber;
	var viewCheckArray	= document.getElementsByName(checkName);
	for( var num=0; num<viewCheckArray.length; num++ ) {
		if( viewCheckArray[num] && viewCheckArray[num].checked ) {
			contents	+= '&'+encodeURIComponent('member_viewable[]')+'='+viewCheckArray[num].value;
		}
	}
	checkName	= 'member_purchasable_'+productNumber;
	var purchaseCheckArray	= document.getElementsByName(checkName);
	for( var num=0; num<purchaseCheckArray.length; num++ ) {
		if( purchaseCheckArray[num] && purchaseCheckArray[num].checked ) {
			contents	+= '&'+encodeURIComponent('member_purchasable[]')+'='+purchaseCheckArray[num].value;
		}
	}
	shoppingProductStatusHttpObject	= FormerCommon.createHttpRequest(shoppingProductOpenChangeResult);
	if( shoppingProductStatusHttpObject ) {
		FormerCommon.displayGrayOut(9999);
		shoppingProductStatusHttpObject.open("POST",'./memberclass.php',true);
		shoppingProductStatusHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		shoppingProductStatusHttpObject.send(contents);
	} else {
		alert('サーバー通信作成に失敗しました!');
	}
}
function shoppingProductOpenChangeResult(){
	if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status == 200)){
		setTimeout(FormerCommon.displayWhiteIn, 100);
	    var lines	= shoppingProductStatusHttpObject.responseText.cr2lf().split(LF);
	    var result	= '';
	    while( result.length == 0 && lines.length > 0 ) {
	    	result	= lines.shift();
	    }
	    if( 'OK' == result ) {
	    } else {
	    	alert(shoppingProductStatusHttpObject.responseText);
	    }
	} else if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status != 200)){
		alert('状態変更中にサーバー通信に失敗しました');
	}
}
//
// 販売単位の在庫数を変更する
//
var shoppingProductUnitCurrentStock;
function shoppingProductUnitSetCurrentStock(stock){
	shoppingProductUnitCurrentStock	= stock;
}
function shoppingProductUnitStockChange(unitNumber,stockCount) {
	if( stockCount == shoppingProductUnitCurrentStock ) {
		return;
	}
	var contents	= 'unit_number='+unitNumber
	+'&stock='+stockCount;
	shoppingProductStatusHttpObject	= FormerCommon.createHttpRequest(shoppingProductUnitStockChangeResult);
	if( shoppingProductStatusHttpObject ) {
		FormerCommon.displayGrayOut(9999);
		shoppingProductStatusHttpObject.open("POST",'./unit/stock.php',true);
		shoppingProductStatusHttpObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		shoppingProductStatusHttpObject.send(contents);
	} else {
		alert('サーバー通信作成に失敗しました!');
	}
}
function shoppingProductUnitStockChangeResult(){
	if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status == 200)){
		setTimeout(FormerCommon.displayWhiteIn, 100);
	    var lines	= shoppingProductStatusHttpObject.responseText.cr2lf().split(LF);
	    var result	= '';
	    while( result.length == 0 && lines.length > 0 ) {
	    	result	= lines.shift();
	    }
	    if( 'OK' == result ) {
	    } else {
	    	alert(shoppingProductStatusHttpObject.responseText);
	    }
	} else if ((shoppingProductStatusHttpObject.readyState == 4) && (shoppingProductStatusHttpObject.status != 200)){
		alert('在庫数変更中にサーバー通信に失敗しました');
	}
}
//--></script>