/home/mjc1/public_html/adm/vender/itemform.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
<?php
$sub_menu 
'200100';
include_once(
'./_common.php');
include_once(
G5_EDITOR_LIB);
include_once(
G5_LIB_PATH.'/iteminfo.lib.php');

auth_check($auth[$sub_menu], "w");

vender_auth_check("itemform");

$html_title "상품 ";

if (
$w == "")
{
    
$html_title .= "입력";

    
// 옵션은 쿠키에 저장된 값을 보여줌. 다음 입력을 위한것임
    //$it[ca_id] = _COOKIE[ck_ca_id];
    
$it['ca_id'] = get_cookie("ck_ca_id");
    
$it['ca_id2'] = get_cookie("ck_ca_id2");
    
$it['ca_id3'] = get_cookie("ck_ca_id3");
    if (!
$it['ca_id'])
    {
        
$sql " select ca_id from {$g5['g5_shop_category_table']} order by ca_order, ca_id limit 1 ";
        
$row sql_fetch($sql);
        if (!
$row['ca_id'])
            
alert("등록된 분류가 없습니다. 우선 분류를 등록하여 주십시오."'./categorylist.php');
        
$it['ca_id'] = $row['ca_id'];
    }
    
//$it[it_maker]  = stripslashes($_COOKIE[ck_maker]);
    //$it[it_origin] = stripslashes($_COOKIE[ck_origin]);
    
$it['it_maker']  = stripslashes(get_cookie("ck_maker"));
    
$it['it_origin'] = stripslashes(get_cookie("ck_origin"));
    
$it['it_1'] = 1;
}
else if (
$w == "u")
{
    
$html_title .= "수정";

    if (
$is_admin != 'super')
    {
        
$sql " select it_id from {$g5['g5_shop_item_table']} a, {$g5['g5_shop_category_table']} b
                  where a.it_id = '
$it_id'
                    and a.ca_id = b.ca_id
                    and b.ca_mb_id = '
{$member['mb_id']}' ";
        
$row sql_fetch($sql);
        if (!
$row['it_id'])
            
alert("\'{$member['mb_id']}\' 님께서 수정 할 권한이 없는 상품입니다.");
    }

    
$sql " select * from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
    
$it sql_fetch($sql);

    if(!
$it)
        
alert('상품정보가 존재하지 않습니다.');

    if (!
$ca_id)
        
$ca_id $it['ca_id'];

    
$sql " select * from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
    
$ca sql_fetch($sql);
}
else
{
    
alert();
}

$qstr  $qstr.'&amp;sca='.$sca.'&amp;page='.$page;

$g5['title'] = $html_title;
include_once (
G5_ADMIN_PATH.'/admin.head.php');

// 분류리스트
$category_select '';
$script '';
$sql " select * from {$g5['g5_shop_category_table']} ";
if (
$is_admin != 'super')
    
$sql .= " where ca_mb_id = '{$member['mb_id']}' ";
$sql .= " order by ca_order, ca_id ";
$result sql_query($sql);
for (
$i=0$row=sql_fetch_array($result); $i++)
{
    
$len strlen($row['ca_id']) / 1;

    
$nbsp "";
    for (
$i=0$i<$len$i++)
        
$nbsp .= "&nbsp;&nbsp;&nbsp;";

    
$category_select .= "<option value=\"{$row['ca_id']}\">$nbsp{$row['ca_name']}</option>\n";

    
$script .= "ca_use['{$row['ca_id']}'] = {$row['ca_use']};\n";
    
$script .= "ca_stock_qty['{$row['ca_id']}'] = {$row['ca_stock_qty']};\n";
    
//$script .= "ca_explan_html['$row[ca_id]'] = $row[ca_explan_html];\n";
    
$script .= "ca_sell_email['{$row['ca_id']}'] = '{$row['ca_sell_email']}';\n";
}

// 재입고알림 설정 필드 추가
if(!sql_query(" select it_stock_sms from {$g5['g5_shop_item_table']} limit 1 "false)) {
    
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
                    ADD `it_stock_sms` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_stock_qty` "
true);
}

// 추가옵션 포인트 설정 필드 추가
if(!sql_query(" select it_supply_point from {$g5['g5_shop_item_table']} limit 1 "false)) {
    
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
                    ADD `it_supply_point` int(11) NOT NULL DEFAULT '0' AFTER `it_point_type` "
true);
}

// 상품메모 필드 추가
if(!sql_query(" select it_shop_memo from {$g5['g5_shop_item_table']} limit 1 "false)) {
    
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
                    ADD `it_shop_memo` text NOT NULL AFTER `it_use_avg` "
true);
}

$pg_anchor ='<ul class="anchor">
<li><a href="#anc_sitfrm_cate">상품분류</a></li>
<li><a href="#anc_sitfrm_skin">스킨설정</a></li>
<li><a href="#anc_sitfrm_ini">기본정보</a></li>
<li><a href="#anc_sitfrm_compact">요약정보</a></li>
<li><a href="#anc_sitfrm_cost">가격 및 재고</a></li>
<li><a href="#anc_sitfrm_sendcost">배송비</a></li>
<li><a href="#anc_sitfrm_img">상품이미지</a></li>
<li><a href="#anc_sitfrm_relation">관련상품</a></li>
<li><a href="#anc_sitfrm_event">관련이벤트</a></li>
<li><a href="#anc_sitfrm_optional">상세설명설정</a></li>
<li><a href="#anc_sitfrm_extra">여분필드</a></li>
</ul>
'
;

$frm_submit '<div class="btn_confirm01 btn_confirm">
    <input type="submit" value="확인" class="btn_submit" accesskey="s">
    <a href="./itemlist.php?'
.$qstr.'">목록</a>';
if(
$it_id)
    
$frm_submit .= PHP_EOL.'<a href="'.G5_SHOP_URL.'/item.php?it_id='.$it_id.'" class="btn_frmline">상품보기</a>';
$frm_submit .= '</div>';

// 쿠폰적용안함 설정 필드 추가
if(!sql_query(" select it_nocoupon from {$g5['g5_shop_item_table']} limit 1"false)) {
    
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
                    ADD `it_nocoupon` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_use` "
true);
}

// 스킨필드 추가
if(!sql_query(" select it_skin from {$g5['g5_shop_item_table']} limit 1"false)) {
    
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
                    ADD `it_skin` varchar(255) NOT NULL DEFAULT '' AFTER `ca_id3`,
                    ADD `it_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `it_skin` "
true);
}

if(
$vm_admin=='Y'){
    
$sql "select * from {$g5['vender_member']} where 1=1 and vm_id = '{$vendermember['vm_id']}' ";
} else {
    
$sql "select * from {$g5['vender_member']} where 1=1";
}
$res sql_query($sql);
while(
$info=mysql_fetch_array($res)){
    
$vm_array[] = $info;
}

// 다중단가 사용시 해당되는 다중단가 리스트 가져옴
/*if($default['de_multy_price_use']=='1'){
    $sql = "select pseq from {$g5['g5_shop_item_multy_price_table']} where it_id = '{$it_id}' and pseq > 0 group by pseq ";
    $resx = sql_query($sql);
    while($infox = mysql_fetch_array($resx)){
        $multi_price_array[] = $infox;
    }
}*/
?>

<form name="fitemform" id='fitemform' action="./itemformupdate.php" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">

<input type="hidden" name="codedup" value="<?php echo $default['de_code_dup_use']; ?>">
<input type="hidden" name="w" value="<?php echo $w?>">
<input type="hidden" name="sca" value="<?php echo $sca?>">
<input type="hidden" name="sst" value="<?php echo $sst?>">
<input type="hidden" name="sod"  value="<?php echo $sod?>">
<input type="hidden" name="sfl" value="<?php echo $sfl?>">
<input type="hidden" name="stx"  value="<?php echo $stx?>">
<input type="hidden" name="page" value="<?php echo $page?>">

<section id="anc_sitfrm_cate">
    <h2 class="h2_frm">상품분류</h2>
    <?php echo $pg_anchor?>
    <div class="local_desc02 local_desc">
        <p>기본분류는 반드시 선택하셔야 합니다. 하나의 상품에 최대 3개의 다른 분류를 지정할 수 있습니다.</p>
    </div>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>상품분류 입력</caption>
        <colgroup>
            <col class="grid_4">
            <col>
        </colgroup>
        <tbody>
        <tr>
            <th scope="row"><label for="ca_id">기본분류</label></th>
            <td>
                <?php if ($w == "") echo help("기본분류를 선택하면, 판매/재고/HTML사용/판매자 E-mail 등을, 선택한 분류의 기본값으로 설정합니다."); ?>
                <select name="ca_id" id="ca_id" onchange="categorychange(this.form)">
                    <option value="">선택하세요</option>
                    <?php echo conv_selected_option($category_select$it['ca_id']); ?>
                </select>
                <script>
                    var ca_use = new Array();
                    var ca_stock_qty = new Array();
                    //var ca_explan_html = new Array();
                    var ca_sell_email = new Array();
                    var ca_opt1_subject = new Array();
                    var ca_opt2_subject = new Array();
                    var ca_opt3_subject = new Array();
                    var ca_opt4_subject = new Array();
                    var ca_opt5_subject = new Array();
                    var ca_opt6_subject = new Array();
                    <?php echo "\n$script"?>
                </script>
            </td>
        </tr>
        <?php for ($i=2$i<=3$i++) { ?>
        <tr>
            <th scope="row"><label for="ca_id<?php echo $i?>">다중 분류 <?php echo $i?>번째</label></th>
            <td>
                <?php echo help($i.'차 분류는 기본 분류의 하위 분류 개념이 아니므로 기본 분류 선택시 해당 상품이 포함될 최하위 분류만 선택하시면 됩니다.'); ?>
                <select name="ca_id<?php echo $i?>" id="ca_id<?php echo $i?>">
                    <option value="">선택하세요</option>
                    <?php echo conv_selected_option($category_select$it['ca_id'.$i]); ?>
                </select>
            </td>
        </tr>
        <?php ?>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_skin">
    <h2 class="h2_frm">스킨설정</h2>
    <?php echo $pg_anchor?>
    <div class="local_desc02 local_desc">
        <p>상품상세보기에서 사용할 스킨을 설정합니다.</p>
    </div>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>스킨설정</caption>
        <colgroup>
            <col class="grid_4">
            <col>
        </colgroup>
        <tbody>
        <tr>
            <th scope="row"><label for="it_skin">PC용 스킨</label></th>
            <td colspan="3">
                <select name="it_skin" id="it_skin">
                <?php
                $arr 
get_skin_dir('shop');
                for (
$i=0$i<count($arr); $i++) {
                    if (
$i == 0) echo "<option value=\"\">선택</option>";
                    echo 
"<option value=\"".$arr[$i]."\"".get_selected($it['it_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
                }
                
?>
                </select>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_skin" value="1" id="chk_ca_it_skin">
                <label for="chk_ca_it_skin">분류적용</label>
                <input type="checkbox" name="chk_all_it_skin" value="1" id="chk_all_it_skin">
                <label for="chk_all_it_skin">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_mobile_skin">모바일용 스킨</label></th>
            <td colspan="3">
                <select name="it_mobile_skin" id="it_mobile_skin">
                <?php
                $arr 
get_skin_dir('shop'G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
                for (
$i=0$i<count($arr); $i++) {
                    if (
$i == 0) echo "<option value=\"\">선택</option>";
                    echo 
"<option value=\"".$arr[$i]."\"".get_selected($it['it_mobile_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
                }
                
?>
                </select>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_mobile_skin" value="1" id="chk_ca_it_mobile_skin">
                <label for="chk_ca_it_mobile_skin">분류적용</label>
                <input type="checkbox" name="chk_all_it_mobile_skin" value="1" id="chk_all_it_mobile_skin">
                <label for="chk_all_it_mobile_skin">전체적용</label>
            </td>
        </tr>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_ini">
    <h2 class="h2_frm">기본정보</h2>
    <?php echo $pg_anchor?>
    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>기본정보 입력</caption>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
<?php    if($default['de_vender_use']=='1'){ ?>
        <tr>
            <th scope="row"><label for="it_name">벤더설정</label></th>
            <td colspan="2">
                <select name='vm_id' id='vm_id'>
                    <option value='0'>본사</option>
                <?php echo help("HTML 입력이 불가합니다."); ?>
                <?php 
                    
for($ii=0;$ii<count($vm_array);$ii++){
                        
$vm_info $vm_array[$ii];
                
?>
                    <option value='<?php echo $vm_info['vm_id']?><?php if($vm_info['vm_id']==$it['vm_id']){?>selected<?php }?>><?php echo "{$vm_info['vm_company']} ({$vm_info['vm_user_id']})"?></option>
                <?php 
                    
}
                
?>
                </select>
            </td>
        </tr>
<?php ?>
        <tr>
            <th scope="row">상품코드</th>
            <td colspan="2">
                <?php if ($w == '') { // 추가 ?>
                    <!-- 최근에 입력한 코드(자동 생성시)가 목록의 상단에 출력되게 하려면 아래의 코드로 대체하십시오. -->
                    <!-- <input type=text class=required name=it_id value="<?php echo 10000000000-time()?>" size=12 maxlength=10 required> <a href='javascript:;' onclick="codedupcheck(document.all.it_id.value)"><img src='./img/btn_code.gif' border=0 align=absmiddle></a> -->
                    <?php echo help("상품의 코드는 10자리 숫자로 자동생성합니다. <b>직접 상품코드를 입력할 수도 있습니다.</b>\n상품코드는 영문자, 숫자, - 만 입력 가능합니다."); ?>
                    <input type="text" name="it_id" value="<?php echo time(); ?>" id="it_id" required class="frm_input required" size="20" maxlength="20">
                    <!-- <?php if ($default['de_code_dup_use']) { ?><button type="button" class="btn_frmline" onclick="codedupcheck(document.all.it_id.value)">중복검사</a><?php ?> -->
                <?php } else { ?>
                    <input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
                    <span class="frm_ca_id"><?php echo $it['it_id']; ?></span>
                    <a href="<?php echo G5_SHOP_URL?>/item.php?it_id=<?php echo $it_id?>" class="btn_frmline">상품확인</a>
                    <a href="<?php echo G5_ADMIN_URL?>/shop_admin/itemuselist.php?sfl=a.it_id&amp;stx=<?php echo $it_id?>" class="btn_frmline">사용후기</a>
                    <a href="<?php echo G5_ADMIN_URL?>/shop_admin/itemqalist.php?sfl=a.it_id&amp;stx=<?php echo $it_id?>" class="btn_frmline">상품문의</a>
                <?php ?>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_name">상품명</label></th>
            <td colspan="2">
                <?php echo help("HTML 입력이 불가합니다."); ?>
                <input type="text" name="it_name" value="<?php echo get_text(cut_str($it['it_name'], 250"")); ?>" id="it_name" required class="frm_input required" size="95">
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_basic">기본설명</label></th>
            <td>
                <?php echo help("상품명 하단에 상품에 대한 추가적인 설명이 필요한 경우에 입력합니다. HTML 입력도 가능합니다."); ?>
                <input type="text" name="it_basic" value="<?php echo get_text($it['it_basic']); ?>" id="it_basic" class="frm_input" size="95">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_basic" value="1" id="chk_ca_it_basic">
                <label for="chk_ca_it_basic">분류적용</label>
                <input type="checkbox" name="chk_all_it_basic" value="1" id="chk_all_it_basic">
                <label for="chk_all_it_basic">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_order">출력순서</label></th>
            <td>
                <?php echo help("숫자가 작을 수록 상위에 출력됩니다. 음수 입력도 가능하며 입력 가능 범위는 -2147483648 부터 2147483647 까지입니다.\n<b>입력하지 않으면 자동으로 출력됩니다.</b>"); ?>
                <input type="text" name="it_order" value="<?php echo $it['it_order']; ?>" id="it_order" class="frm_input" size="12">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_order" value="1" id="chk_ca_it_order">
                <label for="chk_ca_it_order">분류적용</label>
                <input type="checkbox" name="chk_all_it_order" value="1" id="chk_all_it_order">
                <label for="chk_all_it_order">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row">상품유형</th>
            <td>
                <?php echo help("메인화면에 유형별로 출력할때 사용합니다.\n이곳에 체크하게되면 상품리스트에서 유형별로 정렬할때 체크된 상품이 가장 먼저 출력됩니다."); ?>
                <input type="checkbox" name="it_type1" value="1" <?php echo ($it['it_type1'] ? "checked" ""); ?> id="it_type1">
                <label for="it_type1">히트 <img src="<?php echo G5_SHOP_URL?>/img/icon_hit.gif" alt=""></label>
                <input type="checkbox" name="it_type2" value="1" <?php echo ($it['it_type2'] ? "checked" ""); ?> id="it_type2">
                <label for="it_type2">추천 <img src="<?php echo G5_SHOP_URL?>/img/icon_rec.gif" alt=""></label>
                <input type="checkbox" name="it_type3" value="1" <?php echo ($it['it_type3'] ? "checked" ""); ?> id="it_type3">
                <label for="it_type3">신상품 <img src="<?php echo G5_SHOP_URL?>/img/icon_new.gif" alt=""></label>
                <input type="checkbox" name="it_type4" value="1" <?php echo ($it['it_type4'] ? "checked" ""); ?> id="it_type4">
                <label for="it_type4">인기 <img src="<?php echo G5_SHOP_URL?>/img/icon_best.gif" alt=""></label>
                <input type="checkbox" name="it_type5" value="1" <?php echo ($it['it_type5'] ? "checked" ""); ?> id="it_type5">
                <label for="it_type5">할인 <img src="<?php echo G5_SHOP_URL?>/img/icon_discount.gif" alt=""></label>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_type" value="1" id="chk_ca_it_type">
                <label for="chk_ca_it_type">분류적용</label>
                <input type="checkbox" name="chk_all_it_type" value="1" id="chk_all_it_type">
                <label for="chk_all_it_type">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_maker">제조사</label></th>
            <td>
                <?php echo help("입력하지 않으면 상품상세페이지에 출력하지 않습니다."); ?>
                <input type="text" name="it_maker" value="<?php echo get_text($it['it_maker']); ?>" id="it_maker" class="frm_input" size="40">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_maker" value="1" id="chk_ca_it_maker">
                <label for="chk_ca_it_maker">분류적용</label>
                <input type="checkbox" name="chk_all_it_maker" value="1" id="chk_all_it_maker">
                <label for="chk_all_it_maker">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_origin">원산지</label></th>
            <td>
                <?php echo help("입력하지 않으면 상품상세페이지에 출력하지 않습니다."); ?>
                <input type="text" name="it_origin" value="<?php echo get_text($it['it_origin']); ?>" id="it_origin" class="frm_input" size="40">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_origin" value="1" id="chk_ca_it_origin">
                <label for="chk_ca_it_origin">분류적용</label>
                <input type="checkbox" name="chk_all_it_origin" value="1" id="chk_all_it_origin">
                <label for="chk_all_it_origin">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_brand">브랜드</label></th>
            <td>
                <?php echo help("입력하지 않으면 상품상세페이지에 출력하지 않습니다."); ?>
                <input type="text" name="it_brand" value="<?php echo get_text($it['it_brand']); ?>" id="it_brand" class="frm_input" size="40">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_brand" value="1" id="chk_ca_it_brand">
                <label for="chk_ca_it_brand">분류적용</label>
                <input type="checkbox" name="chk_all_it_brand" value="1" id="chk_all_it_brand">
                <label for="chk_all_it_brand">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_model">모델</label></th>
            <td>
                <?php echo help("입력하지 않으면 상품상세페이지에 출력하지 않습니다."); ?>
                <input type="text" name="it_model" value="<?php echo get_text($it['it_model']); ?>" id="it_model" class="frm_input" size="40">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_model" value="1" id="chk_ca_it_model">
                <label for="chk_ca_it_model">분류적용</label>
                <input type="checkbox" name="chk_all_it_model" value="1" id="chk_all_it_model">
                <label for="chk_all_it_model">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_tel_inq">전화문의</label></th>
            <td>
                <?php echo help("상품 금액 대신 전화문의로 표시됩니다."); ?>
                <input type="checkbox" name="it_tel_inq" value="1" id="it_tel_inq" <?php echo ($it['it_tel_inq']) ? "checked" ""?>> 예
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_tel_inq" value="1" id="chk_ca_it_tel_inq">
                <label for="chk_ca_it_tel_inq">분류적용</label>
                <input type="checkbox" name="chk_all_it_tel_inq" value="1" id="chk_all_it_tel_inq">
                <label for="chk_all_it_tel_inq">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_use">판매가능</label></th>
            <td>
                <?php echo help("잠시 판매를 중단하거나 재고가 없을 경우에 체크를 해제해 놓으면 출력되지 않으며, 주문도 받지 않습니다."); ?>
                <input type="checkbox" name="it_use" value="1" id="it_use" <?php echo ($it['it_use']) ? "checked" ""?>> 예
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_use" value="1" id="chk_ca_it_use">
                <label for="chk_ca_it_use">분류적용</label>
                <input type="checkbox" name="chk_all_it_use" value="1" id="chk_all_it_use">
                <label for="chk_all_it_use">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_nocoupon">쿠폰적용안함</label></th>
            <td>
                <?php echo help("설정에 체크하시면 쿠폰 생성 때 상품 검색 결과에 노출되지 않습니다."); ?>
                <input type="checkbox" name="it_nocoupon" value="1" id="it_nocoupon" <?php echo ($it['it_nocoupon']) ? "checked" ""?>> 예
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_nocoupon" value="1" id="chk_ca_it_nocoupon">
                <label for="chk_ca_it_nocoupon">분류적용</label>
                <input type="checkbox" name="chk_all_it_nocoupon" value="1" id="chk_all_it_nocoupon">
                <label for="chk_all_it_nocoupon">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_nocoupon">가격비교사이트</label></th>
            <td>
                <?php echo help("설정에 체크하시면 가격비교사이트에 노출이 됩니다."); ?>
                <input type="checkbox" name="it_1" value="1" id="it_1" <?php echo ($it['it_1']) ? "checked" ""?>> 예
            </td>
             <td class="td_grpset">
                <input type="checkbox" name="chk_ca_1" value="1" id="chk_ca_1">
                <label for="chk_ca_1">분류적용</label>
                <input type="checkbox" name="chk_all_1" value="1" id="chk_all_1">
                <label for="chk_all_1">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row">상품설명</th>
            <td colspan="2"> <?php echo editor_html('it_explan'get_text($it['it_explan'], 0)); ?></td>
        </tr>
        <tr>
            <th scope="row">모바일 상품설명</th>
            <td colspan="2"> <?php echo editor_html('it_mobile_explan'get_text($it['it_mobile_explan'], 0)); ?></td>
        </tr>
        <tr>
            <th scope="row"><label for="it_sell_email">판매자 e-mail</label></th>
            <td>
                <?php echo help("운영자와 실제 판매자가 다른 경우 실제 판매자의 e-mail을 입력하면, 상품 주문 시점을 기준으로 실제 판매자에게도 주문서를 발송합니다."); ?>
                <input type="text" name="it_sell_email" value="<?php echo $it['it_sell_email']; ?>" id="it_sell_email" class="frm_input" size="40">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_sell_email" value="1" id="chk_ca_it_sell_email">
                <label for="chk_ca_it_sell_email">분류적용</label>
                <input type="checkbox" name="chk_all_it_sell_email" value="1" id="chk_all_it_sell_email">
                <label for="chk_all_it_sell_email">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_shop_memo">상점메모</label></th>
            <td><textarea name="it_shop_memo" id="it_shop_memo"><?php echo $it['it_shop_memo']; ?></textarea></td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_shop_memo" value="1" id="chk_ca_it_shop_memo">
                <label for="chk_ca_it_shop_memo">분류적용</label>
                <input type="checkbox" name="chk_all_it_shop_memo" value="1" id="chk_all_it_shop_memo">
                <label for="chk_all_it_shop_memo">전체적용</label>
            </td>
        </tr>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_compact">
    <h2 class="h2_frm">상품요약정보</h2>
    <?php echo $pg_anchor?>
    <div class="local_desc02 local_desc">
        <p><strong>전자상거래 등에서의 상품 등의 정보제공에 관한 고시</strong>에 따라 총 35개 상품군에 대해 상품 특성 등을 양식에 따라 입력할 수 있습니다.</p>
    </div>

    <div id="sit_compact">
        <?php echo help("상품군을 선택하면 자동으로 항목이 변환됩니다."); ?>
        <select id="it_info_gubun" name="it_info_gubun">
            <option value="">상품군을 선택하세요.</option>
            <?php
            
if(!$it['it_info_gubun']) $it['it_info_gubun'] = 'wear';
            foreach(
$item_info as $key=>$value) {
                
$opt_value $key;
                
$opt_text  $value['title'];
                echo 
'<option value="'.$opt_value.'" '.get_selected($opt_value$it['it_info_gubun']).'>'.$opt_text.'</option>'.PHP_EOL;
            }
            
?>
        </select>
        <input type="checkbox" name="chk_ca_it_info" value="1" id="chk_ca_it_info">
            <label for="chk_ca_it_info">분류적용</label>
            <input type="checkbox" name="chk_all_it_info" value="1" id="chk_all_it_info">
            <label for="chk_all_it_info">전체적용</label>
    </div>
    <div id="sit_compact_fields"><?php include_once(G5_ADMIN_PATH.'/shop_admin/iteminfo.php'); ?></div>
</section>

<?php echo $frm_submit?>

<script>
$(function(){
    $("#it_info_gubun").live("change", function() {
        var gubun = $(this).val();
        $.post(
            "<?php echo G5_ADMIN_URL?>/shop_admin/iteminfo.php",
            { it_id: "<?php echo $it['it_id']; ?>", gubun: gubun },
            function(data) {
                $("#sit_compact_fields").empty().html(data);
            }
        );
    });
});
</script>

<section id="anc_sitfrm_cost">
    <h2 class="h2_frm">가격 및 재고</h2>
    <?php echo $pg_anchor?>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>가격 및 재고 입력</caption>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
        <tr>
            <th scope="row"><label for="it_price">판매가격</label></th>
            <td>
                <input type="text" name="it_price" value="<?php echo $it['it_price']; ?>" id="it_price" class="frm_input" size="8"> 원
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_price" value="1" id="chk_ca_it_price">
                <label for="chk_ca_it_price">분류적용</label>
                <input type="checkbox" name="chk_all_it_price" value="1" id="chk_all_it_price">
                <label for="chk_all_it_price">전체적용</label>
            </td>
        </tr>
<?php if($default['de_multy_price_use']=='1' && 1==2){ // 상품별 다중단가를 사용할려다가 거래처별 다중단가로 변경?>
<!--        <tr>
            <th scope="row"><label for="it_9">다중단가 선택</label></th>
            <td>
                <select name='it_9'>
                    <option value='0'>--선택하세요--</option>
    <?php for($i=0;$i<count($multi_price_array);$i++){?>
                    <option value='<?php echo $multi_price_array[$i]['pseq']?><?php if($multi_price_array[$i]['pseq']==$it['it_9']){?>selected<?php }?>>다중단가 <?php echo $multi_price_array[$i]['pseq']?></option>
    <?php ?>
                </select>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_9" value="1" id="chk_ca_it_9">
                <label for="chk_ca_it_price">분류적용</label>
                <input type="checkbox" name="chk_all_it_9" value="1" id="chk_all_it_9">
                <label for="chk_all_it_price">전체적용</label>
            </td>
        </tr>-->
    <input type='hidden' name='it_9' value='<?php echo $it['it_9']?>'>
<?php } else {?>
    <input type='hidden' name='it_9' value='<?php echo $it['it_9']?>'>
<?php ?>
        <tr>
            <th scope="row"><label for="it_buyprice">구입가격</label></th>
            <td>
                <input type="text" name="it_buyprice" value="<?php echo $it['it_buyprice']; ?>" id="it_buyprice" class="frm_input" size="8"> 원
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_buyprice" value="1" id="chk_ca_it_buyprice">
                <label for="chk_ca_it_price">분류적용</label>
                <input type="checkbox" name="chk_all_it_buyprice" value="1" id="chk_all_it_buyprice">
                <label for="chk_all_it_price">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_cust_price">시중가격</label></th>
            <td>
                <?php echo help("입력하지 않으면 상품상세페이지에 출력하지 않습니다."); ?>
                <input type="text" name="it_cust_price" value="<?php echo $it['it_cust_price']; ?>" id="it_cust_price" class="frm_input" size="8"> 원
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_cust_price" value="1" id="chk_ca_it_cust_price">
                <label for="chk_ca_it_cust_price">분류적용</label>
                <input type="checkbox" name="chk_all_it_cust_price" value="1" id="chk_all_it_cust_price">
                <label for="chk_all_it_cust_price">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_point_type">포인트 유형</label></th>
            <td>
                <?php echo help("포인트 유형을 설정할 수 있습니다. 비율로 설정했을 경우 설정 기준금액의 %비율로 포인트가 지급됩니다."); ?>
                <select name="it_point_type" id="it_point_type">
                    <option value="0"<?php echo get_selected('0'$it['it_point_type']); ?>>설정금액</option>
                    <option value="1"<?php echo get_selected('1'$it['it_point_type']); ?>>판매가기준 설정비율</option>
                    <option value="2"<?php echo get_selected('2'$it['it_point_type']); ?>>옵션가기준 설정비율</option>
                </select>
                <script>
                $(function() {
                    $("#it_point_type").change(function() {
                        if(parseInt($(this).val()) > 0)
                            $("#it_point_unit").text("%");
                        else
                            $("#it_point_unit").text("점");
                    });
                });
                </script>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_point_type" value="1" id="chk_ca_it_point_type">
                <label for="chk_ca_it_point_type">분류적용</label>
                <input type="checkbox" name="chk_all_it_point_type" value="1" id="chk_all_it_point_type">
                <label for="chk_all_it_point_type">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_point">포인트</label></th>
            <td>
                <?php echo help("주문완료후 환경설정에서 설정한 주문완료 설정일 후 회원에게 부여하는 포인트입니다.\n또, 포인트부여를 '아니오'로 설정한 경우 신용카드, 계좌이체로 주문하는 회원께는 부여하지 않습니다."); ?>
                <input type="text" name="it_point" value="<?php echo $it['it_point']; ?>" id="it_point" class="frm_input" size="8"> <span id="it_point_unit"><?php if($it['it_point_type']) echo '%'; else echo '점'?></span>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_point" value="1" id="chk_ca_it_point">
                <label for="chk_ca_it_point">분류적용</label>
                <input type="checkbox" name="chk_all_it_point" value="1" id="chk_all_it_point">
                <label for="chk_all_it_point">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_supply_point">추가옵션상품 포인트</label></th>
            <td>
                <?php echo help("상품의 추가옵션상품 구매에 일괄적으로 지급하는 포인트입니다. 0으로 설정하시면 구매포인트를 지급하지 않습니다.\n주문완료후 환경설정에서 설정한 주문완료 설정일 후 회원에게 부여하는 포인트입니다.\n또, 포인트부여를 '아니오'로 설정한 경우 신용카드, 계좌이체로 주문하는 회원께는 부여하지 않습니다."); ?>
                <input type="text" name="it_supply_point" value="<?php echo $it['it_supply_point']; ?>" id="it_supply_point" class="frm_input" size="8"> 점
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_supply_point" value="1" id="chk_ca_it_supply_point">
                <label for="chk_ca_it_supply_point">분류적용</label>
                <input type="checkbox" name="chk_all_it_supply_point" value="1" id="chk_all_it_supply_point">
                <label for="chk_all_it_supply_point">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_soldout">상품품절</label></th>
            <td>
                <?php echo help("잠시 판매를 중단하거나 재고가 없을 경우에 체크해 놓으면 품절상품으로 표시됩니다."); ?>
                <input type="checkbox" name="it_soldout" value="1" id="it_soldout" <?php echo ($it['it_soldout']) ? "checked" ""?>> 예
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_soldout" value="1" id="chk_ca_it_soldout">
                <label for="chk_ca_it_soldout">분류적용</label>
                <input type="checkbox" name="chk_all_it_soldout" value="1" id="chk_all_it_soldout">
                <label for="chk_all_it_soldout">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_stock_sms">재입고SMS 알림</label></th>
            <td colspan="2">
                <?php echo help("상품이 품절인 경우에 체크해 놓으면 상품상세보기에서 고객이 재입고SMS 알림을 신청할 수 있게 됩니다."); ?>
                <input type="checkbox" name="it_stock_sms" value="1" id="it_stock_sms" <?php echo ($it['it_stock_sms']) ? "checked" ""?>> 예
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_stock_qty">재고수량</label></th>
            <td>
                <?php echo help("<b>주문관리에서 상품별 상태 변경에 따라 자동으로 재고를 가감합니다.</b> 재고는 규격/색상별이 아닌, 상품별로만 관리됩니다.<br>재고수량을 0으로 설정하시면 품절상품으로 표시됩니다.<br>천년재고는 수정 불가능하며 적용여부는 쇼핑몰설정 메뉴의 기타란에서 사용할지 말지의 여부를 결정하실수 있습니다."); ?>
                <input type="text" name="it_stock_qty" value="<?php echo $it['it_stock_qty']; ?>" id="it_stock_qty" class="frm_input" size="8"> 개
                &nbsp;&nbsp; 천년재고  : <?php echo $it['it_4']*1?> 개
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_stock_qty" value="1" id="chk_ca_it_stock_qty">
                <label for="chk_ca_it_stock_qty">분류적용</label>
                <input type="checkbox" name="chk_all_it_stock_qty" value="1" id="chk_all_it_stock_qty">
                <label for="chk_all_it_stock_qty">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_stock_qty">무한 판매 사용 여부</label></th>
            <td>
                <?php echo help("무한 판매 설정시 재고량에 상관없이 품절이 되지 않고 무조건 판매할수 있습니다."); ?>
                <input type="radio" name="it_8" value="0" id="it_8" <?php if($it['it_8']=='' || $it['it_8']=='0'){ ?>checked<?php }?>>판매에 재고수량 적용
                &nbsp;&nbsp;&nbsp;
                <input type="radio" name="it_8" value="1" id="it_8" <?php if($it['it_8']=='1'){ ?>checked<?php }?>>무한판매 사용
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_8" value="1" id="chk_ca_it_stock_qty">
                <label for="chk_ca_it_stock_qty">분류적용</label>
                <input type="checkbox" name="chk_all_it_8" value="1" id="chk_all_it_stock_qty">
                <label for="chk_all_it_stock_qty">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_noti_qty">재고 통보수량</label></th>
            <td>
                <?php echo help("상품의 재고가 통보수량보다 작을 때 쇼핑몰관리 메인화면의 재고현황에 재고부족 상품으로 표시됩니다.<br>옵션이 있는 상품은 개별 옵션의 통보수량이 적용됩니다."); ?>
                <input type="text" name="it_noti_qty" value="<?php echo $it['it_noti_qty']; ?>" id="it_noti_qty" class="frm_input" size="8"> 개
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_noti_qty" value="1" id="chk_ca_it_noti_qty">
                <label for="chk_ca_it_noti_qty">분류적용</label>
                <input type="checkbox" name="chk_all_it_noti_qty" value="1" id="chk_all_it_noti_qty">
                <label for="chk_all_it_noti_qty">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_buy_min_qty">최소구매수량</label></th>
            <td>
                <?php echo help("상품 구매시 최소 구매 수량을 설정합니다."); ?>
                <input type="text" name="it_buy_min_qty" value="<?php echo $it['it_buy_min_qty']; ?>" id="it_buy_min_qty" class="frm_input" size="8"> 개
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_buy_min_qty" value="1" id="chk_ca_it_buy_min_qty">
                <label for="chk_ca_it_buy_min_qty">분류적용</label>
                <input type="checkbox" name="chk_all_it_buy_min_qty" value="1" id="chk_all_it_buy_min_qty">
                <label for="chk_all_it_buy_min_qty">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_buy_max_qty">최대구매수량</label></th>
            <td>
                <?php echo help("상품 구매시 최대 구매 수량을 설정합니다."); ?>
                <input type="text" name="it_buy_max_qty" value="<?php echo $it['it_buy_max_qty']; ?>" id="it_buy_max_qty" class="frm_input" size="8"> 개
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_buy_max_qty" value="1" id="chk_ca_it_buy_max_qty">
                <label for="chk_ca_it_buy_max_qty">분류적용</label>
                <input type="checkbox" name="chk_all_it_buy_max_qty" value="1" id="chk_all_it_buy_max_qty">
                <label for="chk_all_it_buy_max_qty">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row"><label for="it_notax">상품과세 유형</label></th>
            <td>
                <?php echo help("상품의 과세유형(과세, 비과세)을 설정합니다."); ?>
                <select name="it_notax" id="it_notax">
                    <option value="0"<?php echo get_selected('0'$it['it_notax']); ?>>과세</option>
                    <option value="1"<?php echo get_selected('1'$it['it_notax']); ?>>비과세</option>
                </select>
            </td>
            <tr>
            <th scope="row"><label for="it_3">상품재고 유형</label></th>
            <td>
                <?php echo help("일반재고 처리방식은 기존의 상품재고 처리방식이며, 셋트재고 처리방식은 옵션재고의 비중을 두어서 옵션이 판매될때 상품재고를 옵션의 비중만큼 본재고가 차감되는 형태입니다. <br>※ 연필 1다스(12개)처리나 계란 1판(30개)등을 처리할때 사용하면 됩니다.<br>비중입력은 먼저 셋트재고 처리방식선택 저장후에 옵션 생성할때 입력하실수 있습니다."); ?>
                <select name="it_3" id="it_3">
                    <option value="1"<?php echo get_selected('1'$it['it_3']); ?>>일반재고 처리방식</option>
                    <option value="2"<?php echo get_selected('2'$it['it_3']); ?>>셋트재고 처리방식</option>
                </select>
                <br><br>
                <strong>※ 셋트재고 처리방식일 경우는 판매가와 구입가를 수정할수 없고 재고비중에 따라서 자동 세팅이 됩니다.</strong>
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_3" value="1" id="chk_ca_3">
                <label for="chk_ca_3">분류적용</label>
                <input type="checkbox" name="chk_all_3" value="1" id="chk_all_3">
                <label for="chk_all_3">전체적용</label>
            </td>
        </tr>
        <?php
        $opt_subject 
explode(','$it['it_option_subject']);
        
?>
        <tr>
            <th scope="row">상품선택옵션</th>
            <td colspan="2">
                <div class="sit_option tbl_frm01">
                    <?php echo help('옵션항목은 콤마(,) 로 구분하여 여러개를 입력할 수 있습니다. 옷을 예로 들어 [옵션1 : 사이즈 , 옵션1 항목 : XXL,XL,L,M,S] , [옵션2 : 색상 , 옵션2 항목 : 빨,파,노]<br><strong>옵션명과 옵션항목에 따옴표(\', ")는 입력할 수 없습니다.</strong><br>옵션 단위마다 중복되는값을 입력할수 없습니다. 만약 입력시에는 옵션목록생성은 되어도 저장시에 중복값을 제거하고 저장됩니다.'); ?>
                    <table>
                    <caption>상품선택옵션 입력</caption>
                    <colgroup>
                        <col class="grid_4">
                        <col>
                    </colgroup>
                    <tbody>
                    <tr>
                        <th scope="row">
                            <label for="opt1_subject">옵션1</label>
                            <input type="text" name="opt1_subject" value="<?php echo $opt_subject[0]; ?>" id="opt1_subject" class="frm_input" size="15">
                        </th>
                        <td>
                            <label for="opt1"><b>옵션1 항목</b></label>
                            <input type="text" name="opt1" value="" id="opt1" class="frm_input" size="50">
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">
                            <label for="opt2_subject">옵션2</label>
                            <input type="text" name="opt2_subject" value="<?php echo $opt_subject[1]; ?>" id="opt2_subject" class="frm_input" size="15">
                        </th>
                        <td>
                            <label for="opt2"><b>옵션2 항목</b></label>
                            <input type="text" name="opt2" value="" id="opt2" class="frm_input" size="50">
                        </td>
                    </tr>
                     <tr>
                        <th scope="row">
                            <label for="opt3_subject">옵션3</label>
                            <input type="text" name="opt3_subject" value="<?php echo $opt_subject[2]; ?>" id="opt3_subject" class="frm_input" size="15">
                        </th>
                        <td>
                            <label for="opt3"><b>옵션3 항목</b></label>
                            <input type="text" name="opt3" value="" id="opt3" class="frm_input" size="50">
                        </td>
                    </tr>
                    </tbody>
                    </table>
                    <div class="btn_confirm02 btn_confirm">
                        <button type="button" id="option_table_create" class="btn_frmline">옵션목록생성</button>
                    </div>
                </div>
                <div id="sit_option_frm"><?php include_once(G5_ADMIN_PATH.'/shop_admin/itemoption.php'); ?></div>

                <script>
                $(function() {
                    <?php if($it['it_id'] && $po_run) { ?>
                    //옵션항목설정
                    var arr_opt1 = new Array();
                    var arr_opt2 = new Array();
                    var arr_opt3 = new Array();
                    var opt1 = opt2 = opt3 = '';
                    var opt_val;

                    $(".opt-cell").each(function() {
                        opt_val = $(this).text().split(" > ");
                        opt1 = opt_val[0];
                        opt2 = opt_val[1];
                        opt3 = opt_val[2];

                        if(opt1 && $.inArray(opt1, arr_opt1) == -1)
                            arr_opt1.push(opt1);

                        if(opt2 && $.inArray(opt2, arr_opt2) == -1)
                            arr_opt2.push(opt2);

                        if(opt3 && $.inArray(opt3, arr_opt3) == -1)
                            arr_opt3.push(opt3);
                    });


                    $("input[name=opt1]").val(arr_opt1.join());
                    $("input[name=opt2]").val(arr_opt2.join());
                    $("input[name=opt3]").val(arr_opt3.join());
                    <?php ?>
                    // 옵션목록생성
                    $("#option_table_create").click(function() {
                        var it_id = $.trim($("input[name=it_id]").val());
                        var opt1_subject = $.trim($("#opt1_subject").val());
                        var opt2_subject = $.trim($("#opt2_subject").val());
                        var opt3_subject = $.trim($("#opt3_subject").val());
                        var opt1 = $.trim($("#opt1").val());
                        var opt2 = $.trim($("#opt2").val());
                        var opt3 = $.trim($("#opt3").val());
                        var $option_table = $("#sit_option_frm");

                        if(!opt1_subject || !opt1) {
                            alert("옵션명과 옵션항목을 입력해 주십시오.");
                            return false;
                        }

                        $.post(
                            "<?php echo G5_ADMIN_URL?>/shop_admin/itemoption.php",
                            { it_id: it_id, w: "<?php echo $w?>", opt1_subject: opt1_subject, opt2_subject: opt2_subject, opt3_subject: opt3_subject, opt1: opt1, opt2: opt2, opt3: opt3 },
                            function(data) {
                                $option_table.empty().html(data);
                            }
                        );
                    });

                    // 모두선택
                    $("input[name=opt_chk_all]").live("click", function() {
                        if($(this).is(":checked")) {
                            $("input[name='opt_chk[]']").attr("checked", true);
                        } else {
                            $("input[name='opt_chk[]']").attr("checked", false);
                        }
                    });

                    // 선택삭제
                    $("#sel_option_delete").live("click", function() {
                        var $el = $("input[name='opt_chk[]']:checked");
                        if($el.size() < 1) {
                            alert("삭제하려는 옵션을 하나 이상 선택해 주십시오.");
                            return false;
                        }

                        $el.closest("tr").remove();
                    });

                    // 일괄적용
                    $("#opt_value_apply").live("click", function() {
                        if($(".opt_com_chk:checked").size() < 1) {
                            alert("일괄 수정할 항목을 하나이상 체크해 주십시오.");
                            return false;
                        }

                        var opt_price = $.trim($("#opt_com_price").val());
                        var opt_buyprice = $.trim($("#opt_com_buyprice").val());
                        var opt_stock = $.trim($("#opt_com_stock").val());
                        var opt_noti = $.trim($("#opt_com_noti").val());
                        var opt_use = $("#opt_com_use").val();
                        var opt_qty_weight = $.trim($("#opt_com_qty_weight").val());
                        var $el = $("input[name='opt_chk[]']:checked");

                        // 체크된 옵션이 있으면 체크된 것만 적용
                        if($el.size() > 0) {
                            var $tr;
                            $el.each(function() {
                                $tr = $(this).closest("tr");

                                if($("#opt_com_price_chk").is(":checked"))
                                    $tr.find("input[name='opt_price[]']").val(opt_price);

                                if($("#opt_com_buyprice_chk").is(":checked"))
                                    $tr.find("input[name='opt_buyprice[]']").val(opt_buyprice);

                                if($("#opt_com_stock_chk").is(":checked"))
                                    $tr.find("input[name='opt_stock_qty[]']").val(opt_stock);

                                if($("#opt_com_noti_chk").is(":checked"))
                                    $tr.find("input[name='opt_noti_qty[]']").val(opt_noti);

                                if($("#opt_com_use_chk").is(":checked"))
                                    $tr.find("select[name='opt_use[]']").val(opt_use);

                                if($("#opt_com_qty_weight_chk").is(":checked"))
                                    $tr.find("input[name='opt_qty_weight[]']").val(opt_qty_weight);
                            });
                        } else {
                            if($("#opt_com_price_chk").is(":checked"))
                                $("input[name='opt_price[]']").val(opt_price);
                            
                            if($("#opt_com_buyprice_chk").is(":checked")){
                                $("input[name='opt_buyprice[]']").val(opt_buyprice);
                            }

                            if($("#opt_com_stock_chk").is(":checked"))
                                $("input[name='opt_stock_qty[]']").val(opt_stock);

                            if($("#opt_com_noti_chk").is(":checked"))
                                $("input[name='opt_noti_qty[]']").val(opt_noti);

                            if($("#opt_com_use_chk").is(":checked"))
                                $("select[name='opt_use[]']").val(opt_use);

                            if($("#opt_com_qty_weight_chk").is(":checked"))
                                $("input[name='opt_qty_weight[]']").val(opt_qty_weight);
                        }
                    });

                    // 셋트재고 처리방식일경우 재고비중을 이용해서 추가금액을 계산하는 방식을 처리함
                    $("input[name='opt_qty_weight[]']").blur(function(){
                        //alert($(this).attr("id"));
                        var it_price = $("#it_price").val().replace(/,/g,"");
                        var it_qty_weight = $(this).val();
                        var it_at = $(this).attr("id").split("_");
                        var position1 = it_at[3];

                        var new_price = parseInt(it_price)*(parseInt(it_qty_weight)-1);
                        $("#opt_price_"+position1).val(new_price);

                        var it_buyprice = $("#it_buyprice").val().replace(/,/g,"");
                        var new_buyprice = parseInt(it_buyprice)*(parseInt(it_qty_weight)-1);
                        $("#opt_buyprice_"+position1).val(new_buyprice);
                        
                    });
                });
                </script>
            </td>
        </tr>
        <?php
        $spl_subject 
explode(','$it['it_supply_subject']);
        
$spl_count count($spl_subject);
/* ============================ 상품추가옵션 변경으로 인한 주석 처리 ============================== */
        
if(1==2){
        
?>
        <tr>
            <th scope="row">상품추가옵션</th>
            <td colspan="2">
                <div id="sit_supply_frm" class="sit_option tbl_frm01">
                    <?php echo help('옵션항목은 콤마(,) 로 구분하여 여러개를 입력할 수 있습니다. 스마트폰을 예로 들어 [추가1 : 추가구성상품 , 추가1 항목 : 액정보호필름,케이스,충전기]<br><strong>옵션명과 옵션항목에 따옴표(\', ")는 입력할 수 없습니다.</strong><br>옵션 단위마다 중복되는값을 입력할수 없습니다. 만약 입력시에는 옵션목록생성은 되어도 저장시에 중복값을 제거하고 저장됩니다.'); ?>
                    <table>
                    <caption>상품추가옵션 입력</caption>
                    <colgroup>
                        <col class="grid_4">
                        <col>
                    </colgroup>
                    <tbody>
                    <?php
                    $i 
0;
                    do {
                        
$seq $i 1;
                    
?>
                    <tr>
                        <th scope="row">
                            <label for="spl_subject_<?php echo $seq?>">추가<?php echo $seq?></label>
                            <input type="text" name="spl_subject[]" id="spl_subject_<?php echo $seq?>" value="<?php echo $spl_subject[$i]; ?>" class="frm_input" size="15">
                        </th>
                        <td>
                            <label for="spl_item_<?php echo $seq?>"><b>추가<?php echo $seq?> 항목</b></label>
                            <input type="text" name="spl[]" id="spl_item_<?php echo $seq?>" value="" class="frm_input" size="40">
                            <?php
                            
if($i 0)
                                echo 
'<button type="button" id="del_supply_row" class="btn_frmline">삭제</button>';
                            
?>
                        </td>
                    </tr>
                    <?php
                        $i
++;
                    } while(
$i $spl_count);
                    
?>
                    </tbody>
                    </table>
                    <div id="sit_option_addfrm_btn"><button type="button" id="add_supply_row" class="btn_frmline">옵션추가</button></div>
                    <div class="btn_confirm02 btn_confirm">
                        <button type="button" id="supply_table_create">옵션목록생성</button>
                    </div>
                </div>
                <div id="sit_option_addfrm"><?php include_once(G5_ADMIN_PATH.'/shop_admin/itemsupply.php'); ?></div>

                <script>
                $(function() {
                    <?php if($it['it_id'] && $ps_run) { ?>
                    // 추가옵션의 항목 설정
                    var arr_subj = new Array();
                    var subj, spl;

                    $("input[name='spl_subject[]']").each(function() {
                        subj = $.trim($(this).val());
                        if(subj && $.inArray(subj, arr_subj) == -1)
                            arr_subj.push(subj);
                    });

                    for(i=0; i<arr_subj.length; i++) {
                        var arr_spl = new Array();
                        $(".spl-subject-cell").each(function(index) {
                            subj = $(this).text();
                            if(subj == arr_subj[i]) {
                                spl = $(".spl-cell:eq("+index+")").text();
                                arr_spl.push(spl);
                            }
                        });

                        $("input[name='spl[]']:eq("+i+")").val(arr_spl.join());
                    }
                    <?php ?>
                    // 입력필드추가
                    $("#add_supply_row").click(function() {
                        var $el = $("#sit_supply_frm tr:last");
                        var fld = "<tr>\n";
                        fld += "<th scope=\"row\">\n";
                        fld += "<label for=\"\">추가</label>\n";
                        fld += "<input type=\"text\" name=\"spl_subject[]\" value=\"\" class=\"frm_input\" size=\"15\">\n";
                        fld += "</th>\n";
                        fld += "<td>\n";
                        fld += "<label for=\"\"><b>추가 항목</b></label>\n";
                        fld += "<input type=\"text\" name=\"spl[]\" value=\"\" class=\"frm_input\" size=\"40\">\n";
                        fld += "<button type=\"button\" id=\"del_supply_row\" class=\"btn_frmline\">삭제</button>\n";
                        fld += "</td>\n";
                        fld += "</tr>";

                        $el.after(fld);

                        supply_sequence();
                    });

                    // 입력필드삭제
                    $("#del_supply_row").live("click", function() {
                        $(this).closest("tr").remove();

                        supply_sequence();
                    });

                    // 옵션목록생성
                    $("#supply_table_create").click(function() {
                        var it_id = $.trim($("input[name=it_id]").val());
                        var subject = new Array();
                        var supply = new Array();
                        var subj, spl;
                        var count = 0;
                        var $el_subj = $("input[name='spl_subject[]']");
                        var $el_spl = $("input[name='spl[]']");
                        var $supply_table = $("#sit_option_addfrm");

                        $el_subj.each(function(index) {
                            subj = $.trim($(this).val());
                            spl = $.trim($el_spl.eq(index).val());

                            if(subj && spl) {
                                subject.push(subj);
                                supply.push(spl);
                                count++;
                            }
                        });

                        if(!count) {
                            alert("추가옵션명과 추가옵션항목을 입력해 주십시오.");
                            return false;
                        }

                        $.post(
                            "<?php echo G5_ADMIN_URL?>/shop_admin/itemsupply.php",
                            { it_id: it_id, w: "<?php echo $w?>", 'subject[]': subject, 'supply[]': supply },
                            function(data) {
                                $supply_table.empty().html(data);
                            }
                        );
                    });

                    // 모두선택
                    $("input[name=spl_chk_all]").live("click", function() {
                        if($(this).is(":checked")) {
                            $("input[name='spl_chk[]']").attr("checked", true);
                        } else {
                            $("input[name='spl_chk[]']").attr("checked", false);
                        }
                    });

                    // 선택삭제
                    $("#sel_supply_delete").live("click", function() {
                        var $el = $("input[name='spl_chk[]']:checked");
                        if($el.size() < 1) {
                            alert("삭제하려는 옵션을 하나 이상 선택해 주십시오.");
                            return false;
                        }

                        $el.closest("tr").remove();
                    });

                    // 일괄적용
                    $("#spl_value_apply").live("click", function() {
                        alert('aa');

                        if($(".spl_com_chk:checked").size() < 1) {
                            alert("일괄 수정할 항목을 하나이상 체크해 주십시오.");
                            return false;
                        }

                        alert('aa');

                        var spl_price = $.trim($("#spl_com_price").val());
                        var spl_buyprice = $.trim($("#spl_com_buyprice").val());
                        var spl_stock = $.trim($("#spl_com_stock").val());
                        var spl_noti = $.trim($("#spl_com_noti").val());
                        var spl_use = $("#spl_com_use").val();
                        var $el = $("input[name='spl_chk[]']:checked");

                        // 체크된 옵션이 있으면 체크된 것만 적용
                        if($el.size() > 0) {
                            var $tr;
                            $el.each(function() {
                                $tr = $(this).closest("tr");

                                if($("#spl_com_price_chk").is(":checked"))
                                    $tr.find("input[name='spl_price[]']").val(spl_price);

                                if($("#spl_com_buyprice_chk").is(":checked"))
                                    $tr.find("input[name='spl_buyprice[]']").val(spl_buyprice);

                                if($("#spl_com_stock_chk").is(":checked"))
                                    $tr.find("input[name='spl_stock_qty[]']").val(spl_stock);

                                if($("#spl_com_noti_chk").is(":checked"))
                                    $tr.find("input[name='spl_noti_qty[]']").val(spl_noti);

                                if($("#spl_com_use_chk").is(":checked"))
                                    $tr.find("select[name='spl_use[]']").val(spl_use);
                            });
                        } else {
                            if($("#spl_com_price_chk").is(":checked"))
                                $("input[name='spl_price[]']").val(spl_price);

                            if($("#spl_com_buyprice_chk").is(":checked"))
                                $("input[name='spl_buyprice[]']").val(spl_buyprice);

                            if($("#spl_com_stock_chk").is(":checked"))
                                $("input[name='spl_stock_qty[]']").val(spl_stock);

                            if($("#spl_com_noti_chk").is(":checked"))
                                $("input[name='spl_noti_qty[]']").val(spl_noti);

                            if($("#spl_com_use_chk").is(":checked"))
                                $("select[name='spl_use[]']").val(spl_use);
                        }
                    });
                });

                function supply_sequence()
                {
                    var $tr = $("#sit_supply_frm tr");
                    var seq;
                    var th_label, td_label;

                    $tr.each(function(index) {
                        seq = index + 1;
                        $(this).find("th label").attr("for", "spl_subject_"+seq).text("추가"+seq);
                        $(this).find("th input").attr("id", "spl_subject_"+seq);
                        $(this).find("td label").attr("for", "spl_item_"+seq);
                        $(this).find("td label b").text("추가"+seq+" 항목");
                        $(this).find("td input").attr("id", "spl_item_"+seq);
                    });
                }
                </script>
            </td>
        </tr>
<?php    
        
}
/* ================================= 상품추가옵션 변경으로 인한 주석처리 끝 ====================================== */
?>
        <tr>
            <th scope="row">상품추가옵션</th>
            <td colspan="2">
                <div id="sit_supply_frm" class="sit_option tbl_frm01">
                    <?php echo help('옵션항목은 콤마(,) 로 구분하여 여러개를 입력할 수 있습니다. 스마트폰을 예로 들어 [추가1 : 추가구성상품 , 추가1 항목 : 액정보호필름,케이스,충전기]<br><strong>옵션명과 옵션항목에 따옴표(\', ")는 입력할 수 없습니다.</strong><br>옵션 단위마다 중복되는값을 입력할수 없습니다. 만약 입력시에는 옵션목록생성은 되어도 저장시에 중복값을 제거하고 저장됩니다.'); ?>
                    <table>
                    <caption>상품추가옵션 입력</caption>
                    <colgroup>
                        <col class="grid_4">
                        <col>
                    </colgroup>
                    <tbody>
                    <?php
                    $i 
0;
                    do {
                        
$seq $i 1;
                    
?>
                    <tr>
                        <th scope="row">
                            <label for="spl_subject_<?php echo $seq?>">추가<?php echo $seq?></label>
                            <input type="text" name="spl_subject[]" id="spl_subject_<?php echo $seq?>" value="<?php echo $spl_subject[$i]; ?>" class="frm_input" size="15">
                        </th>
                        <td>
                            <label for="spl_item_<?php echo $seq?>"><b>추가<?php echo $seq?> 항목</b></label>
                            <input type="text" name="spl[]" id="spl_item_<?php echo $seq?>" value="" class="frm_input" size="40" readonly>
                            <span><input type="hidden" name="spl_code[]" id="spl_item_code_<?php echo $seq?>" value="" class="frm_input" size="40" readonly></span>
                            <span2><input type="hidden" name="spl_qty[]" id="spl_item_qty_<?php echo $seq?>" value="" class="frm_input" size="40" readonly></span2>
                            <span3><input type="hidden" name="spl_prices[]" id="spl_item_price_<?php echo $seq?>" value="" class="frm_input" size="40" readonly></span3>
                            <span4><input type="hidden" name="spl_buyprices[]" id="spl_item_buyprice_<?php echo $seq?>" value="" class="frm_input" size="40" readonly></span4>
                            &nbsp;<button type="button" id="add_supply_item" class="btn_frmline" name='spl_item_val_<?php echo $seq?>'>상품추가</button>&nbsp;
                            <?php
                            
if($i 0)
                                echo 
'<button type="button" id="del_supply_row" class="btn_frmline">삭제</button>';
                            
?>
                        </td>
                    </tr>
                    <?php
                        $i
++;
                    } while(
$i $spl_count);
                    
?>
                    </tbody>
                    </table>
                    <div id="sit_option_addfrm_btn"><button type="button" id="add_supply_row" class="btn_frmline">옵션추가</button></div>
                    <div class="btn_confirm02 btn_confirm">
                        <!--<button type="button" id="supply_table_create">옵션목록생성</button>-->
                    </div>
                </div>
                <div id="sit_option_addfrm"><?php include_once(G5_ADMIN_PATH.'/shop_admin/itemsupply.php'); ?></div>
                <script>
                $(function() {
                    <?php if($it['it_id'] && $ps_run) { ?>
                    // 추가옵션의 항목 설정
                    var arr_subj = new Array();
                    var subj, spl;

                    $("input[name='spl_subject[]']").each(function() {
                        subj = $.trim($(this).val());
                        if(subj && $.inArray(subj, arr_subj) == -1)
                            arr_subj.push(subj);
                    });

                    for(i=0; i<arr_subj.length; i++) {
                        var arr_spl = new Array();
                        var arr_spl_code = new Array();
                        var arr_spl_qty = new Array();
                        var arr_spl_price = new Array();
                        var arr_spl_buyprice = new Array();
                        $(".spl-subject-cell").each(function(index) {
                            subj = $(this).text();
                            if(subj == arr_subj[i]) {
                                spl = $(".spl-cell:eq("+index+")").text();
                                arr_spl.push(spl);
                                //spl_code = $("input[name='spl_code_id[]'].eq("+index+")").val();
                                arr_spl_code.push('1');
                                arr_spl_qty.push('1');
                                arr_spl_price.push('1');
                                arr_spl_buyprice.push('1');
                            }
                        });

                        $("input[name='spl[]']:eq("+i+")").val(arr_spl.join()+",");
                        $("input[name='spl_code[]']:eq("+i+")").val(arr_spl_code.join()+",");
                        $("input[name='spl_qty[]']:eq("+i+")").val(arr_spl_qty.join()+",");
                        $("input[name='spl_prices[]']:eq("+i+")").val(arr_spl_price.join()+",");
                        $("input[name='spl_buyprices[]']:eq("+i+")").val(arr_spl_buyprice.join()+",");
                    }
                    <?php ?>
                    // 입력필드추가
                    $("#add_supply_row").click(function() {
                        var $el = $("#sit_supply_frm tr:last");
                        var fld = "<tr>\n";
                        fld += "<th scope=\"row\">\n";
                        fld += "<label for=\"\">추가</label>\n";
                        fld += "<input type=\"text\" name=\"spl_subject[]\" value=\"\" class=\"frm_input\" size=\"15\">\n";
                        fld += "</th>\n";
                        fld += "<td>\n";
                        fld += "<label for=\"\"><b>추가 항목</b></label>\n";
                        fld += "<input type=\"text\" name=\"spl[]\" value=\"\" class=\"frm_input\" size=\"40\" readonly>\n";
                        fld += "<span><input type=\"hidden\" name=\"spl_code[]\" value=\"\" class=\"frm_input\" size=\"40\"></span>\n";
                        fld += "<span2><input type=\"hidden\" name=\"spl_qty[]\" value=\"\" class=\"frm_input\" size=\"40\"></span2>\n";
                        fld += "<span3><input type=\"hidden\" name=\"spl_prices[]\" value=\"\" class=\"frm_input\" size=\"40\"></span3>\n";
                        fld += "<span4><input type=\"hidden\" name=\"spl_buyprices[]\" value=\"\" class=\"frm_input\" size=\"40\"></span4>\n";
                        fld += "&nbsp;<button type=\"button\" id=\"add_supply_item\" class=\"btn_frmline\" >상품추가</button>&nbsp;";
                        fld += "<button type=\"button\" id=\"del_supply_row\" class=\"btn_frmline\">삭제</button>\n";
                        fld += "</td>\n";
                        fld += "</tr>";

                        $el.after(fld);

                        supply_sequence();
                    });

                    // 입력필드삭제
                    $("#del_supply_row").live("click", function() {
                        $(this).closest("tr").remove();

                        supply_sequence();
                    });

                    // 모두선택
                    $("input[name=spl_chk_all]").live("click", function() {
                        if($(this).is(":checked")) {
                            $("input[name='spl_chk[]']").attr("checked", true);
                        } else {
                            $("input[name='spl_chk[]']").attr("checked", false);
                        }
                    });

                    // 선택삭제
                    $("#sel_supply_delete").live("click", function() {
                        var $el = $("input[name='spl_chk[]']:checked");
                        if($el.size() < 1) {
                            alert("삭제하려는 옵션을 하나 이상 선택해 주십시오.");
                            return false;
                        }

                        $el.closest("tr").remove();
                    });

                    function supply_sequence()
                    {
                        var $tr = $("#sit_supply_frm tr");
                        var seq;
                        var th_label, td_label;

                        $tr.each(function(index) {
                            seq = index + 1;
                            $(this).find("th label").attr("for", "spl_subject_"+seq).text("추가"+seq);
                            $(this).find("th input").attr("id", "spl_subject_"+seq);
                            $(this).find("td label").attr("for", "spl_item_"+seq);
                            $(this).find("td label b").text("추가"+seq+" 항목");
                            $(this).find("td input").attr("id", "spl_item_"+seq);
                            $(this).find("td span input").attr("id", "spl_item_code_"+seq);
                            $(this).find("td span2 input").attr("id", "spl_item_qty_"+seq);
                            $(this).find("td span3 input").attr("id", "spl_item_price_"+seq);
                            $(this).find("td span4 input").attr("id", "spl_item_buyprice_"+seq);
                            $(this).find("#add_supply_item").attr("name","spl_item_val_"+seq);
                        });
                    }

                    $("#sit_supply_frm").on("click","#add_supply_item", function(){
                        v = $(this).attr("name");
                        $("input[name=field_name]").val(v);

                        v_list = v.split("_");
                        vv = $("#spl_subject_"+v_list[3]).val();
                        if(vv==''){
                            alert('추가옵션'+v_list[3]+"의 제목 항목을 입력하세요.");
                            $("#spl_subject_"+v_list[3]).focus();
                        } else {
                            show_member();
                        }
                    });

                    // 일괄적용
                    $("#spl_value_apply").live("click", function() {

                        if($(".spl_com_chk:checked").size() < 1) {
                            alert("일괄 수정할 항목을 하나이상 체크해 주십시오.");
                            return false;
                        }

                        var spl_price = $.trim($("#spl_com_price").val());
                        var spl_buyprice = $.trim($("#spl_com_buyprice").val());
                        var spl_stock = $.trim($("#spl_com_stock").val());
                        var spl_noti = $.trim($("#spl_com_noti").val());
                        var spl_use = $("#spl_com_use").val();
                        var $el = $("input[name='spl_chk[]']:checked");

                        // 체크된 옵션이 있으면 체크된 것만 적용
                        if($el.size() > 0) {
                            var $tr;
                            $el.each(function() {
                                $tr = $(this).closest("tr");

                                if($("#spl_com_price_chk").is(":checked"))
                                    $tr.find("input[name='spl_price[]']").val(spl_price);

                                if($("#spl_com_buyprice_chk").is(":checked"))
                                    $tr.find("input[name='spl_buyprice[]']").val(spl_buyprice);

                                if($("#spl_com_stock_chk").is(":checked"))
                                    $tr.find("input[name='spl_stock_qty[]']").val(spl_stock);

                                if($("#spl_com_noti_chk").is(":checked"))
                                    $tr.find("input[name='spl_noti_qty[]']").val(spl_noti);

                                if($("#spl_com_use_chk").is(":checked"))
                                    $tr.find("select[name='spl_use[]']").val(spl_use);
                            });
                        } else {
                            if($("#spl_com_price_chk").is(":checked"))
                                $("input[name='spl_price[]']").val(spl_price);

                            if($("#spl_com_buyprice_chk").is(":checked"))
                                $("input[name='spl_buyprice[]']").val(spl_buyprice);

                            if($("#spl_com_stock_chk").is(":checked"))
                                $("input[name='spl_stock_qty[]']").val(spl_stock);

                            if($("#spl_com_noti_chk").is(":checked"))
                                $("input[name='spl_noti_qty[]']").val(spl_noti);

                            if($("#spl_com_use_chk").is(":checked"))
                                $("select[name='spl_use[]']").val(spl_use);
                        }
                    });
                }); // $(function() end
                </script>
            </td>
        </tr>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_sendcost">
    <h2 class="h2_frm">배송비</h2>
    <?php echo $pg_anchor?>
    <div class="local_desc02 local_desc">
        <p>쇼핑몰설정 &gt; 배송비유형 설정보다 <strong>개별상품 배송비설정이 우선</strong> 적용됩니다.</p>
    </div>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>배송비 입력</caption>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
            <tr>
                <th scope="row"><label for="it_sc_type">배송비 유형</label></th>
                <td>
                    <?php echo help("배송비 유형을 선택하면 자동으로 항목이 변환됩니다."); ?>
                    <select name="it_sc_type" id="it_sc_type">
                        <option value="0"<?php echo get_selected('0'$it['it_sc_type']); ?>>쇼핑몰 기본설정 사용</option>
                        <option value="1"<?php echo get_selected('1'$it['it_sc_type']); ?>>무료배송</option>
                        <option value="2"<?php echo get_selected('2'$it['it_sc_type']); ?>>조건부 무료배송</option>
                        <option value="3"<?php echo get_selected('3'$it['it_sc_type']); ?>>유료배송</option>
                        <option value="4"<?php echo get_selected('4'$it['it_sc_type']); ?>>수량별 부과</option>
                    </select>
                </td>
                <td rowspan="4" id="sc_grp" class="td_grpset">
                    <input type="checkbox" name="chk_ca_it_sendcost" value="1" id="chk_ca_it_sendcost">
                    <label for="chk_ca_it_sendcost">분류적용</label>
                    <input type="checkbox" name="chk_all_it_sendcost" value="1" id="chk_all_it_sendcost">
                    <label for="chk_all_it_sendcost">전체적용</label>
                </td>
            </tr>
            <tr id="sc_con_method">
                <th scope="row"><label for="it_sc_method">배송비 결제</label></th>
                <td>
                    <select name="it_sc_method" id="it_sc_method">
                        <option value="0"<?php echo get_selected('0'$it['it_sc_method']); ?>>선불</option>
                        <option value="1"<?php echo get_selected('1'$it['it_sc_method']); ?>>착불</option>
                        <option value="2"<?php echo get_selected('2'$it['it_sc_method']); ?>>사용자선택</option>
                    </select>
                </td>
            </tr>
            <tr id="sc_con_basic">
                <th scope="row"><label for="it_sc_price">기본배송비</label></th>
                <td>
                    <?php echo help("무료배송 이외의 설정에 적용되는 배송비 금액입니다."); ?>
                    <input type="text" name="it_sc_price" value="<?php echo $it['it_sc_price']; ?>" id="it_sc_price" class="frm_input" size="8"> 원
                </td>
            </tr>
            <tr id="sc_con_minimum">
                <th scope="row"><label for="it_sc_minimum">배송비 상세조건</label></th>
                <td>
                    주문금액 <input type="text" name="it_sc_minimum" value="<?php echo $it['it_sc_minimum']; ?>" id="it_sc_minimum" class="frm_input" size="8"> 이상 무료 배송
                </td>
            </tr>
            <tr id="sc_con_qty">
                <th scope="row"><label for="it_sc_qty">배송비 상세조건</label></th>
                <td>
                    <?php echo help("상품의 주문 수량에 따라 배송비가 부과됩니다. 예를 들어 기본배송비가 3,000원 수량을 3으로 설정했을 경우 상품의 주문수량이 5개이면 6,000원 배송비가 부과됩니다."); ?>
                    주문수량 <input type="text" name="it_sc_qty" value="<?php echo $it['it_sc_qty']; ?>" id="it_sc_qty" class="frm_input" size="8"> 마다 배송비 부과
                </td>
            </tr>
        </tbody>
        </table>
    </div>

    <script>
    $(function() {
        <?php
        
switch($it['it_sc_type']) {
            case 
1:
                echo 
'$("#sc_con_method").hide();'.PHP_EOL;
                echo 
'$("#sc_con_basic").hide();'.PHP_EOL;
                echo 
'$("#sc_con_minimum").hide();'.PHP_EOL;
                echo 
'$("#sc_con_qty").hide();'.PHP_EOL;
                echo 
'$("#sc_grp").attr("rowspan","1");'.PHP_EOL;
                break;
            case 
2:
                echo 
'$("#sc_con_method").show();'.PHP_EOL;
                echo 
'$("#sc_con_basic").show();'.PHP_EOL;
                echo 
'$("#sc_con_minimum").show();'.PHP_EOL;
                echo 
'$("#sc_con_qty").hide();'.PHP_EOL;
                echo 
'$("#sc_grp").attr("rowspan","4");'.PHP_EOL;
                break;
            case 
3:
                echo 
'$("#sc_con_method").show();'.PHP_EOL;
                echo 
'$("#sc_con_basic").show();'.PHP_EOL;
                echo 
'$("#sc_con_minimum").hide();'.PHP_EOL;
                echo 
'$("#sc_con_qty").hide();'.PHP_EOL;
                echo 
'$("#sc_grp").attr("rowspan","3");'.PHP_EOL;
                break;
            case 
4:
                echo 
'$("#sc_con_method").show();'.PHP_EOL;
                echo 
'$("#sc_con_basic").show();'.PHP_EOL;
                echo 
'$("#sc_con_minimum").hide();'.PHP_EOL;
                echo 
'$("#sc_con_qty").show();'.PHP_EOL;
                echo 
'$("#sc_grp").attr("rowspan","4");'.PHP_EOL;
                break;
            default:
                echo 
'$("#sc_con_method").hide();'.PHP_EOL;
                echo 
'$("#sc_con_basic").hide();'.PHP_EOL;
                echo 
'$("#sc_con_minimum").hide();'.PHP_EOL;
                echo 
'$("#sc_con_qty").hide();'.PHP_EOL;
                echo 
'$("#sc_grp").attr("rowspan","2");'.PHP_EOL;
                break;
        }
        
?>
        $("#it_sc_type").change(function() {
            var type = $(this).val();

            switch(type) {
                case "1":
                    $("#sc_con_method").hide();
                    $("#sc_con_basic").hide();
                    $("#sc_con_minimum").hide();
                    $("#sc_con_qty").hide();
                    $("#sc_grp").attr("rowspan","1");
                    break;
                case "2":
                    $("#sc_con_method").show();i
                    $("#sc_con_basic").show();
                    $("#sc_con_minimum").show();
                    $("#sc_con_qty").hide();
                    $("#sc_grp").attr("rowspan","4");
                    break;
                case "3":
                    $("#sc_con_method").show();
                    $("#sc_con_basic").show();
                    $("#sc_con_minimum").hide();
                    $("#sc_con_qty").hide();
                    $("#sc_grp").attr("rowspan","3");
                    break;
                case "4":
                    $("#sc_con_method").show();
                    $("#sc_con_basic").show();
                    $("#sc_con_minimum").hide();
                    $("#sc_con_qty").show();
                    $("#sc_grp").attr("rowspan","4");
                    break;
                default:
                    $("#sc_con_method").hide();
                    $("#sc_con_basic").hide();
                    $("#sc_con_minimum").hide();
                    $("#sc_con_qty").hide();
                    $("#sc_grp").attr("rowspan","1");
                    break;
            }
        });
    });
    </script>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_img">
    <h2 class="h2_frm">이미지</h2>
    <?php echo $pg_anchor?>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>이미지 업로드</caption>
        <colgroup>
            <col class="grid_4">
            <col>
        </colgroup>
        <tbody>
        <?php for($i=1$i<=10$i++) { ?>
        <tr>
            <th scope="row"><label for="it_img<?php echo $i?>">이미지 <?php echo $i?></label></th>
            <td>
                <input type="file" name="it_img<?php echo $i?>" id="it_img<?php echo $i?>">
                <?php
                $it_img 
G5_DATA_PATH.'/item/'.$it['it_img'.$i];
                if(
is_file($it_img) && $it['it_img'.$i]) {
                    
$size = @getimagesize($it_img);
                    
$thumb get_it_thumbnail($it['it_img'.$i], 2525);
                
?>
                <label for="it_img<?php echo $i?>_del"><span class="sound_only">이미지 <?php echo $i?> </span>파일삭제</label>
                <input type="checkbox" name="it_img<?php echo $i?>_del" id="it_img<?php echo $i?>_del" value="1">
                <span class="sit_wimg_limg<?php echo $i?>"><?php echo $thumb?></span>
                <div id="limg<?php echo $i?>" class="banner_or_img">
                    <img src="<?php echo G5_DATA_URL?>/item/<?php echo $it['it_img'.$i]; ?>" alt="" width="<?php echo $size[0]; ?>" height="<?php echo $size[1]; ?>">
                    <button type="button" class="sit_wimg_close">닫기</button>
                </div>
                <script>
                $('<button type="button" id="it_limg<?php echo $i?>_view" class="btn_frmline sit_wimg_view">이미지<?php echo $i?> 확인</button>').appendTo('.sit_wimg_limg<?php echo $i?>');
                </script>
                <?php ?>
            </td>
        </tr>
        <?php ?>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_relation" class="srel">
    <h2 class="h2_frm">관련상품</h2>
    <?php echo $pg_anchor?>

    <div class="local_desc02 local_desc">
        <p>
            등록된 전체상품 목록에서 상품분류를 선택하면 해당 상품 리스트가 연이어 나타납니다.<br>
            상품리스트에서 관련 상품으로 추가하시면 선택된 관련상품 목록에 <strong>함께</strong> 추가됩니다.<br>
            예를 들어, A 상품에 B 상품을 관련상품으로 등록하면 B 상품에도 A 상품이 관련상품으로 자동 추가되며, <strong>확인 버튼을 누르셔야 정상 반영됩니다.</strong>
        </p>
    </div>

    <div class="compare_wrap">
        <section class="compare_left">
            <h3>등록된 전체상품 목록</h3>
            <label for="sch_relation" class="sound_only">상품분류</label>
            <span class="srel_pad">
                <select id="sch_relation">
                    <option value=''>분류별 상품</option>
                    <?php
                        $sql 
" select * from {$g5['g5_shop_category_table']} ";
                        if (
$is_admin != 'super')
                            
$sql .= " where ca_mb_id = '{$member['mb_id']}' ";
                        
$sql .= " order by ca_order, ca_id ";
                        
$result sql_query($sql);
                        for (
$i=0$row=sql_fetch_array($result); $i++)
                        {
                            
$len strlen($row['ca_id']) / 1;

                            
$nbsp "";
                            for (
$i=0$i<$len$i++)
                                
$nbsp .= "&nbsp;&nbsp;&nbsp;";

                            echo 
"<option value=\"{$row['ca_id']}\">$nbsp{$row['ca_name']}</option>\n";
                        }
                    
?>
                </select>
                <label for="sch_name" class="sound_only">상품명</label>
                <input type="text" name="sch_name" id="sch_name" class="frm_input" size="15">
                <button type="button" id="btn_search_item" class="btn_frmline">검색</button>
            </span>
            <div id="relation" class="srel_list">
                <p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>
            </div>
            <script>
            $(function() {
                $("#btn_search_item").click(function() {
                    var ca_id = $("#sch_relation").val();
                    var it_name = $.trim($("#sch_name").val());
                    var $relation = $("#relation");

                    if(ca_id == "" && it_name == "") {
                        $relation.html("<p>상품의 분류를 선택하시거나 상품명을 입력하신 후 검색하여 주십시오.</p>");
                        return false;
                    }

                    $("#relation").load(
                        "./itemformrelation.php",
                        { it_id: "<?php echo $it_id?>", ca_id: ca_id, it_name: it_name }
                    );
                });

                $("#relation .add_item").live("click", function() {
                    // 이미 등록된 상품인지 체크
                    var $li = $(this).closest("li");
                    var it_id = $li.find("input:hidden").val();
                    var it_id2;
                    var dup = false;
                    $("#reg_relation input[name='re_it_id[]']").each(function() {
                        it_id2 = $(this).val();
                        if(it_id == it_id2) {
                            dup = true;
                            return false;
                        }
                    });

                    if(dup) {
                        alert("이미 선택된 상품입니다.");
                        return false;
                    }

                    var cont = "<li>"+$li.html().replace("add_item", "del_item").replace("추가", "삭제")+"</li>";
                    var count = $("#reg_relation li").size();

                    if(count > 0) {
                        $("#reg_relation li:last").after(cont);
                    } else {
                        $("#reg_relation").html("<ul>"+cont+"</ul>");
                    }

                    $li.remove();
                });

                $("#reg_relation .del_item").live("click", function() {
                    if(!confirm("상품을 삭제하시겠습니까?"))
                        return false;

                    $(this).closest("li").remove();

                    var count = $("#reg_relation li").size();
                    if(count < 1)
                        $("#reg_relation").html("<p>선택된 상품이 없습니다.</p>");
                });
            });
            </script>
        </section>

        <section class="compare_right">
            <h3>선택된 관련상품 목록</h3>
            <span class="srel_pad"></span>
            <div id="reg_relation" class="srel_sel">
                <?php
                $str 
= array();
                
$sql " select b.ca_id, b.it_id, b.it_name, b.it_price
                           from 
{$g5['g5_shop_item_relation_table']} a
                           left join 
{$g5['g5_shop_item_table']} b on (a.it_id2=b.it_id)
                          where a.it_id = '
$it_id'
                          order by ir_no asc "
;
                
$result sql_query($sql);
                for(
$g=0$row=sql_fetch_array($result); $g++)
                {
                    
$it_name get_it_image($row['it_id'], 5050).' '.$row['it_name'];

                    if(
$g==0)
                        echo 
'<ul>';
                
?>
                    <li>
                        <input type="hidden" name="re_it_id[]" value="<?php echo $row['it_id']; ?>">
                        <div class="list_item"><?php echo $it_name?></div>
                        <div class="list_item_btn"><button type="button" class="del_item btn_frmline">삭제</button></div>
                    </li>
                <?php
                    $str
[] = $row['it_id'];
                }
                
$str implode(","$str);

                if(
$g 0)
                    echo 
'</ul>';
                else
                    echo 
'<p>선택된 상품이 없습니다.</p>';
                
?>
            </div>
            <input type="hidden" name="it_list" value="<?php echo $str?>">
        </section>

    </div>

</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_event" class="srel">
    <h2 class="h2_frm">관련이벤트</h2>
    <?php echo $pg_anchor?>

    <div class="compare_wrap">
        <section class="compare_left">
            <h3>등록된 전체이벤트 목록</h3>
            <div id="event_list" class="srel_list srel_noneimg">
                <?php
                $sql 
" select ev_id, ev_subject from {$g5['g5_shop_event_table']} order by ev_id desc ";
                
$result sql_query($sql);
                for (
$g=0$row=sql_fetch_array($result); $g++) {
                    if(
$g == 0)
                        echo 
'<ul>';
                
?>
                    <li>
                        <input type="hidden" name="ev_id[]" value="<?php echo $row['ev_id']; ?>">
                        <div class="list_item"><?php echo get_text($row['ev_subject']); ?></div>
                        <div class="list_item_btn"><button type="button" class="add_event btn_frmline">추가</button></div>
                    </li>
                <?php
                
}

                if(
$g 0)
                    echo 
'</ul>';
                else
                    echo 
'<p>등록된 이벤트가 없습니다.</p>';
                
?>
            </div>
            <script>
            $(function() {
                $("#event_list .add_event").live("click", function() {
                    // 이미 등록된 이벤트인지 체크
                    var $li = $(this).closest("li");
                    var ev_id = $li.find("input:hidden").val();
                    var ev_id2;
                    var dup = false;
                    $("#reg_event_list input[name='ev_id[]']").each(function() {
                        ev_id2 = $(this).val();
                        if(ev_id == ev_id2) {
                            dup = true;
                            return false;
                        }
                    });

                    if(dup) {
                        alert("이미 선택된 이벤트입니다.");
                        return false;
                    }

                    var cont = "<li>"+$li.html().replace("add_event", "del_event").replace("추가", "삭제")+"</li>";
                    var count = $("#reg_event_list li").size();

                    if(count > 0) {
                        $("#reg_event_list li:last").after(cont);
                    } else {
                        $("#reg_event_list").html("<ul>"+cont+"</ul>");
                    }
                });

                $("#reg_event_list .del_event").live("click", function() {
                    if(!confirm("상품을 삭제하시겠습니까?"))
                        return false;

                    $(this).closest("li").remove();

                    var count = $("#reg_event_list li").size();
                    if(count < 1)
                        $("#reg_event_list").html("<p>선택된 이벤트가 없습니다.</p>");
                });
            });
            </script>
        </section>

        <section class="compare_right">
            <h3>선택된 관련이벤트 목록</h3>
            <div id="reg_event_list" class="srel_sel srel_noneimg">
                <?php
                $str 
"";
                
$comma "";
                
$sql " select b.ev_id, b.ev_subject
                           from 
{$g5['g5_shop_event_item_table']} a
                           left join 
{$g5['g5_shop_event_table']} b on (a.ev_id=b.ev_id)
                          where a.it_id = '
$it_id'
                          order by b.ev_id desc "
;
                
$result sql_query($sql);
                for (
$g=0$row=sql_fetch_array($result); $g++) {
                    
$str .= $comma $row['ev_id'];
                    
$comma ",";

                    if(
$g == 0)
                        echo 
'<ul>';
                
?>
                    <li>
                        <input type="hidden" name="ev_id[]" value="<?php echo $row['ev_id']; ?>">
                        <div class="list_item"><?php echo get_text($row['ev_subject']); ?></div>
                        <div class="list_item_btn"><button type="button" class="del_event btn_frmline">삭제</button></div>
                    </li>
                <?php
                
}

                if(
$g 0)
                    echo 
'</ul>';
                else
                    echo 
'<p>선택된 이벤트가 없습니다.</p>';
                
?>
            </div>
            <input type="hidden" name="ev_list" value="<?php echo $str?>">
        </section>
    </div>

</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_optional">
    <h2 class="h2_frm">상세설명설정</h2>
    <?php echo $pg_anchor?>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>상세설명설정</caption>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
        <tr>
            <th scope="row">상품상단내용</th>
            <td><?php echo help("상품상세설명 페이지 상단에 출력하는 HTML 내용입니다."); ?><?php echo editor_html('it_head_html'get_text($it['it_head_html'], 0)); ?></td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_head_html" value="1" id="chk_ca_it_head_html">
                <label for="chk_ca_it_head_html">분류적용</label>
                <input type="checkbox" name="chk_all_it_head_html" value="1" id="chk_all_it_head_html">
                <label for="chk_all_it_head_html">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row">상품하단내용</th>
            <td><?php echo help("상품상세설명 페이지 하단에 출력하는 HTML 내용입니다."); ?><?php echo editor_html('it_tail_html'get_text($it['it_tail_html'], 0)); ?></td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_tail_html" value="1" id="chk_ca_it_tail_html">
                <label for="chk_ca_it_tail_html">분류적용</label>
                <input type="checkbox" name="chk_all_it_tail_html" value="1" id="chk_all_it_tail_html">
                <label for="chk_all_it_tail_html">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row">모바일 상품상단내용</th>
            <td><?php echo help("모바일 상품상세설명 페이지 상단에 출력하는 HTML 내용입니다."); ?><?php echo editor_html('it_mobile_head_html'get_text($it['it_mobile_head_html'], 0)); ?></td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_mobile_head_html" value="1" id="chk_ca_it_mobile_head_html">
                <label for="chk_ca_it_mobile_head_html">분류적용</label>
                <input type="checkbox" name="chk_all_it_mobile_head_html" value="1" id="chk_all_it_mobile_head_html">
                <label for="chk_all_it_mobile_head_html">전체적용</label>
            </td>
        </tr>
        <tr>
            <th scope="row">모바일 상품하단내용</th>
            <td><?php echo help("모바일 상품상세설명 페이지 하단에 출력하는 HTML 내용입니다."); ?><?php echo editor_html('it_mobile_tail_html'get_text($it['it_mobile_tail_html'], 0)); ?></td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_it_mobile_tail_html" value="1" id="chk_ca_it_mobile_tail_html">
                <label for="chk_ca_it_mobile_tail_html">분류적용</label>
                <input type="checkbox" name="chk_all_it_mobile_tail_html" value="1" id="chk_all_it_mobile_tail_html">
                <label for="chk_all_it_mobile_tail_html">전체적용</label>
            </td>
        </tr>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>

<section id="anc_sitfrm_extra">
    <h2>여분필드 설정</h2>
    <?php echo $pg_anchor ?>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
        <?php for ($i=2$i<=10$i++) { 
                        if(
$i==|| $i==|| $i==9){ continue; }
        
?>
        <tr>
            <th scope="row">여분필드<?php echo $i ?></th>
            <td class="td_extra">
                <label for="it_<?php echo $i ?>_subj">여분필드 <?php echo $i ?> 제목</label>
                <input type="text" name="it_<?php echo $i ?>_subj" id="it_<?php echo $i ?>_subj" value="<?php echo get_text($it['it_'.$i.'_subj']) ?>" class="frm_input">
                <label for="it_<?php echo $i ?>">여분필드 <?php echo $i ?> 값</label>
                <input type="text" name="it_<?php echo $i ?>" value="<?php echo get_text($it['it_'.$i]) ?>" id="it_<?php echo $i ?>" class="frm_input">
            </td>
            <td class="td_grpset">
                <input type="checkbox" name="chk_ca_<?php echo $i ?>" value="1" id="chk_ca_<?php echo $i ?>">
                <label for="chk_ca_<?php echo $i ?>">분류적용</label>
                <input type="checkbox" name="chk_all_<?php echo $i ?>" value="1" id="chk_all_<?php echo $i ?>">
                <label for="chk_all_<?php echo $i ?>">전체적용</label>
            </td>
        </tr>
        <?php ?>
        <?php if ($w == "u") { ?>
        <tr>
            <th scope="row">입력일시</th>
            <td colspan="2">
                <?php echo help("상품을 처음 입력(등록)한 시간입니다."); ?>
                <?php echo $it['it_time']; ?>
            </td>
        </tr>
        <tr>
            <th scope="row">수정일시</th>
            <td colspan="2">
                <?php echo help("상품을 최종 수정한 시간입니다."); ?>
                <?php echo $it['it_update_time']; ?>
            </td>
        </tr>
        <?php ?>
        </tbody>
        </table>
    </div>
</section>

<?php echo $frm_submit?>
</form>

<!-- 추가옵션을 위한 레이어검색용 창 -->
<?php include_once(G5_ADMIN_PATH."/shop_admin/itemsupply2_div.php");?>


<script>
var f = document.fitemform;

<?php if ($w == 'u') { ?>
$(".banner_or_img").addClass("sit_wimg");
$(function() {
    $(".sit_wimg_view").bind("click", function() {
        var sit_wimg_id = $(this).attr("id").split("_");
        var $img_display = $("#"+sit_wimg_id[1]);

        $img_display.toggle();

        if($img_display.is(":visible")) {
            $(this).text($(this).text().replace("확인", "닫기"));
        } else {
            $(this).text($(this).text().replace("닫기", "확인"));
        }

        var $img = $("#"+sit_wimg_id[1]).children("img");
        var width = $img.width();
        var height = $img.height();
        if(width > 700) {
            var img_width = 700;
            var img_height = Math.round((img_width * height) / width);

            $img.width(img_width).height(img_height);
        }
    });
    $(".sit_wimg_close").bind("click", function() {
        var $img_display = $(this).parents(".banner_or_img");
        var id = $img_display.attr("id");
        $img_display.toggle();
        var $button = $("#it_"+id+"_view");
        $button.text($button.text().replace("닫기", "확인"));
    });
});
<?php ?>

function codedupcheck(id)
{
    if (!id) {
        alert('상품코드를 입력하십시오.');
        f.it_id.focus();
        return;
    }

    var it_id = id.replace(/[A-Za-z0-9\-_]/g, "");
    if(it_id.length > 0) {
        alert("상품코드는 영문자, 숫자, -, _ 만 사용할 수 있습니다.");
        return false;
    }

    $.post(
        "./codedupcheck.php",
        { it_id: id },
        function(data) {
            if(data.name) {
                alert("코드 '"+data.code+"' 는 '".data.name+"' (으)로 이미 등록되어 있으므로\n\n사용하실 수 없습니다.");
                return false;
            } else {
                alert("'"+data.code+"' 은(는) 등록된 코드가 없으므로 사용하실 수 있습니다.");
                document.fitemform.codedup.value = '';
            }
        }, "json"
    );
}

function fitemformcheck(f)
{
    if (!f.ca_id.value) {
        alert("기본분류를 선택하십시오.");
        f.ca_id.focus();
        return false;
    }

    if (f.w.value == "") {
        var error = "";
        $.ajax({
            url: "./ajax.it_id.php",
            type: "POST",
            data: {
                "it_id": f.it_id.value
            },
            dataType: "json",
            async: false,
            cache: false,
            success: function(data, textStatus) {
                error = data.error;
            }
        });

        if (error) {
            alert(error);
            return false;
        }
    }

    if(f.it_point_type.value == "1") {
        var point = parseInt(f.it_point.value);
        if(point > 99) {
            alert("포인트 비율을 0과 99 사이의 값으로 입력해 주십시오.");
            return false;
        }
    }

    if(parseInt(f.it_sc_type.value) > 1) {
        if(!f.it_sc_price.value || f.it_sc_price.value == "0") {
            alert("기본배송비를 입력해 주십시오.");
            return false;
        }

        if(f.it_sc_type.value == "2" && (!f.it_sc_minimum.value || f.it_sc_minimum.value == "0")) {
            alert("배송비 상세조건의 주문금액을 입력해 주십시오.");
            return false;
        }

        if(f.it_sc_type.value == "4" && (!f.it_sc_qty.value || f.it_sc_qty.value == "0")) {
            alert("배송비 상세조건의 주문수량을 입력해 주십시오.");
            return false;
        }
    }

    // 관련상품처리
    var item = new Array();
    var re_item = it_id = "";

    $("#reg_relation input[name='re_it_id[]']").each(function() {
        it_id = $(this).val();
        if(it_id == "")
            return true;

        item.push(it_id);
    });

    if(item.length > 0)
        re_item = item.join();

    $("input[name=it_list]").val(re_item);

    // 이벤트처리
    var evnt = new Array();
    var ev = ev_id = "";

    $("#reg_event_list input[name='ev_id[]']").each(function() {
        ev_id = $(this).val();
        if(ev_id == "")
            return true;

        evnt.push(ev_id);
    });

    if(evnt.length > 0)
        ev = evnt.join();

    $("input[name=ev_list]").val(ev);

    <?php echo get_editor_js('it_explan'); ?>
    <?php echo get_editor_js('it_mobile_explan'); ?>
    <?php echo get_editor_js('it_head_html'); ?>
    <?php echo get_editor_js('it_tail_html'); ?>
    <?php echo get_editor_js('it_mobile_head_html'); ?>
    <?php echo get_editor_js('it_mobile_tail_html'); ?>

    return true;
}

function categorychange(f)
{
    var idx = f.ca_id.value;

    if (f.w.value == "" && idx)
    {
        f.it_use.checked = ca_use[idx] ? true : false;
        f.it_stock_qty.value = ca_stock_qty[idx];
        f.it_sell_email.value = ca_sell_email[idx];
    }
}

categorychange(document.fitemform);
</script>

<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>