Subversion Repositories munaweb

Rev

Rev 6 | Rev 8 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
<!DOCTYPE html>
2
<html lang="en">
3
 
4
<head>
5
    <title>eBay Listing Search</title>
6
    <meta charset="UTF-8">
7
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
9
    <link rel="icon" href="favicon.ico" type="image/x-icon">
10
 
11
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
12
    <script src="js/datetimepicker_css.js"></script>
13
    <script src="js/moment.js"></script>
14
    <script src="js/moment-timezone.js"></script>
15
    <script src="js/jquery.js"></script>
16
    <script src="js/chart.js"></script>
17
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
18
    <link rel="stylesheet" href="css/style.css">
19
    <link rel="stylesheet" href="css/chosen.min.css">
20
    <script src="js/muna-tools.js"></script>
21
</head>
22
 
23
<body onload="readParameters()">
24
    <div class="w3-main">
25
        <div class="w3-container w3-padding w3-margin w3-card-4">
26
            <div class="w3-container w3-gray" style="height:100px">
27
                <img class="w3-image" src="images/MUNA%20-%20Logo%20100x100.png" alt="MUNA Trading Logo" style="height:100px">
28
                <p class="w3-xxlarge w3-right">eBay Listing Search</p>
29
            </div>
30
 
31
            <form id="searchForm" class="w3-container w3-light-grey w3-padding w3-small" onsubmit="return eBaySearch(1);">
32
 
7 - 33
                <div class="w3-cell-row">
34
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 35
                        <h4>Keyword <a href="javascript:void(0)" class="w3-ripple" style="text-decoration:none;" onclick="showKeywordHelp()">&#128712;</a></h4>
36
 
37
                        <input id="keyword" name="keyword" class="w3-input w3-border-0" style="height:3em" type="text" autofocus="autofocus">
6 - 38
                        <div class="w3-bar">
39
                            <a href="javascript:void(0)" id="keywordRecommendations" class="w3-btn w3-black w3-margin w3-round-large w3-ripplet" onclick="getKeywordRecommendations()">Keyword Check</a>
40
                            <a href="javascript:void(0)" id="checkUPC" class="w3-btn w3-black w3-margin w3-round-large w3-ripple" onclick="checkUPC()">UPC Check</a>
41
                        </div>
7 - 42
                        <p id="recommendation" class="w3-padding"></p>
2 - 43
                    </div>
7 - 44
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 45
                        <h4>Category</h4>
46
                        <select id="category" name="category" data-placeholder="Choose up to 3 Categories..." class="chosen-select-3 chosen-select-label chosen-search-contains" multiple="multiple">
47
                            <option value="0">All</option>
48
                            <option value="20081">Antiques</option>
49
                            <option value="550">Art</option>
50
                            <option value="2984">Baby</option>
51
                            <option value="267">Books</option>
52
                            <option value="12576">Business Industrial</option>
53
                            <option value="625">Cameras Photo</option>
54
                            <option value="15032">Cell Phones Accessories</option>
55
                            <option value="11450">Clothing, Shoes Accessories</option>
56
                            <option value="11116">Coins Paper Money</option>
57
                            <option value="1">Collectibles</option>
58
                            <option value="58058">Computers/Tablets Networking</option>
59
                            <option value="293">Consumer Electronics</option>
60
                            <option value="14339">Crafts</option>
61
                            <option value="237">Dolls Bears</option>
62
                            <option value="11232">DVDs Movies</option>
63
                            <option value="45100">Entertainment Memorabilia</option>
64
                            <option value="172008">Gift Cards Coupons</option>
65
                            <option value="26395">Health Beauty</option>
66
                            <option value="11700">Home Garden</option>
67
                            <option value="281">Jewelry Watches</option>
68
                            <option value="11233">Music</option>
69
                            <option value="619">Musical Instruments Gear</option>
70
                            <option value="1281">Pet Supplies</option>
71
                            <option value="870">Pottery Glass</option>
72
                            <option value="10542">Real Estate</option>
73
                            <option value="316">Specialty Services</option>
74
                            <option value="888">Sporting Goods</option>
75
                            <option value="64482">Sports Mem, Cards Fan Shop</option>
76
                            <option value="260">Stamps</option>
77
                            <option value="1305">Tickets Experiences</option>
78
                            <option value="220">Toys Hobbies</option>
79
                            <option value="3252">Travel</option>
80
                            <option value="1249">Video Games Consoles</option>
81
                            <option value="99">Everything Else</option>
82
                            <optgroup label="Antiques">
83
                                <option value="37903">Antiquities</option>
84
                                <option value="4707">Architectural Garden</option>
85
                                <option value="20082">Asian Antiques</option>
86
                                <option value="20086">Decorative Arts</option>
87
                                <option value="2207">Ethnographic</option>
88
                                <option value="20091">Furniture</option>
89
                                <option value="163008">Home Hearth</option>
90
                                <option value="22422">Incunabula</option>
91
                                <option value="181677">Linens Textiles (Pre-1930)</option>
92
                                <option value="23048">Manuscripts</option>
93
                                <option value="37958">Maps, Atlases Globes</option>
94
                                <option value="37965">Maritime</option>
95
                                <option value="163091">Mercantile, Trades Factories</option>
96
                                <option value="181726">Musical Instruments (Pre-1930)</option>
97
                                <option value="100927">Periods Styles</option>
98
                                <option value="1217">Primitives</option>
99
                                <option value="163101">Restoration Care</option>
100
                                <option value="37978">Rugs Carpets</option>
101
                                <option value="20094">Science Medicine (Pre-1930)</option>
102
                                <option value="156323">Sewing (Pre-1930)</option>
103
                                <option value="20096">Silver</option>
104
                                <option value="22608">Reproduction Antiques</option>
105
                                <option value="12">Other Antiques</option>
106
                            </optgroup>
107
                            <optgroup label="Art">
108
                                <option value="28009">Art Posters</option>
109
                                <option value="552">Art Drawings</option>
110
                                <option value="2211">Art Photographs</option>
111
                                <option value="360">Art Prints</option>
112
                                <option value="553">Art Sculptures</option>
113
                                <option value="357">Folk Art Indigenous Art</option>
114
                                <option value="554">Mixed Media Art Collage Art</option>
115
                                <option value="551">Paintings</option>
116
                                <option value="156196">Textile Art Fiber Art</option>
117
                                <option value="20158">Other Art</option>
118
                            </optgroup>
119
                            <optgroup label="Baby">
120
                                <option value="100223">Baby Gear</option>
121
                                <option value="20433">Baby Safety Health</option>
122
                                <option value="20394">Bathing Grooming</option>
123
                                <option value="66692">Car Safety Seats</option>
124
                                <option value="100982">Carriers, Slings Backpacks</option>
125
                                <option value="45455">Diapering</option>
126
                                <option value="20400">Feeding</option>
127
                                <option value="117388">Keepsakes Baby Announcements</option>
128
                                <option value="20416">Nursery Bedding</option>
129
                                <option value="66697">Nursery Decor</option>
130
                                <option value="20422">Nursery Furniture</option>
131
                                <option value="37631">Potty Training</option>
132
                                <option value="66698">Strollers Accessories</option>
133
                                <option value="19068">Toys for Baby</option>
134
                                <option value="1261">Other Baby</option>
135
                                <option value="48757">Wholesale Lots</option>
136
                            </optgroup>
137
                            <optgroup label="Books">
138
                                <option value="45110">Accessories</option>
139
                                <option value="29223">Antiquarian Collectible</option>
140
                                <option value="29792">Audiobooks</option>
141
                                <option value="118254">Catalogs</option>
142
                                <option value="182882">Children Young Adults</option>
143
                                <option value="11104">Cookbooks</option>
144
                                <option value="171228">Fiction Literature</option>
145
                                <option value="280">Magazine Back Issues</option>
146
                                <option value="171243">Nonfiction</option>
147
                                <option value="2228">Textbooks, Education</option>
148
                                <option value="29399">Wholesale Bulk Lots</option>
149
                                <option value="268">Other Books</option>
150
                            </optgroup>
151
                            <optgroup label="Business Industrial">
152
                                <option value="109471">Adhesives, Sealants Tapes</option>
153
                                <option value="11748">Agriculture Forestry</option>
154
                                <option value="42892">Automation, Motors Drives</option>
155
                                <option value="46534">Cleaning Janitorial Supplies</option>
156
                                <option value="11765">Construction</option>
157
                                <option value="92074">Electrical Test Equipment</option>
158
                                <option value="11897">Facility Maintenance Safety</option>
159
                                <option value="183900">Fasteners Hardware</option>
160
                                <option value="159693">Fuel Energy</option>
161
                                <option value="11815">Healthcare, Lab Life Science</option>
162
                                <option value="177641">Heavy Equipment</option>
163
                                <option value="177647">Heavy Equipment Attachments</option>
164
                                <option value="41489">Heavy Equipment Parts Accs</option>
165
                                <option value="42909">HVAC</option>
166
                                <option value="183978">Hydraulics, Pneumatics Pumps</option>
167
                                <option value="61573">Light Equipment Tools</option>
168
                                <option value="11804">Manufacturing Metalworking</option>
169
                                <option value="26221">Material Handling</option>
170
                                <option value="25298">Office</option>
171
                                <option value="26238">Printing Graphic Arts</option>
172
                                <option value="11874">Restaurant Catering</option>
173
                                <option value="11890">Retail Services</option>
174
                                <option value="11759">Websites Businesses for Sale</option>
175
                                <option value="26261">Other Business Industrial</option>
176
                            </optgroup>
177
                            <optgroup label="Cameras Photo">
178
                                <option value="28179">Binoculars Telescopes</option>
179
                                <option value="11724">Camcorders</option>
180
                                <option value="15200">Camera Photo Accessories</option>
181
                                <option value="179697">Camera Drones</option>
182
                                <option value="182969">Camera Drone Parts Accs</option>
183
                                <option value="4684">Camera Manuals Guides</option>
184
                                <option value="31388">Digital Cameras</option>
185
                                <option value="150044">Digital Photo Frames</option>
186
                                <option value="69323">Film Photography</option>
187
                                <option value="64353">Flashes Flash Accessories</option>
188
                                <option value="78997">Lenses Filters</option>
189
                                <option value="30078">Lighting Studio</option>
190
                                <option value="182074">Replacement Parts Tools</option>
191
                                <option value="30090">Tripods Supports</option>
192
                                <option value="21162">Video Production Editing</option>
193
                                <option value="3326">Vintage Movie Photography</option>
194
                                <option value="45086">Wholesale Lots</option>
195
                                <option value="27432">Other Cameras Photo</option>
196
                            </optgroup>
197
                            <optgroup label="Cell Phones Accessories">
198
                                <option value="9355">Cell Phones Smartphones</option>
199
                                <option value="178893">Smart Watches</option>
200
                                <option value="182064">Smart Watch Accessories</option>
201
                                <option value="9394">Cell Phone Accessories</option>
202
                                <option value="136699">Display Phones</option>
203
                                <option value="146492">Phone Cards SIM Cards</option>
204
                                <option value="m43304">Cell Phone Smartphone Parts</option>
205
                                <option value="182073">Vintage Cell Phones</option>
206
                                <option value="45065">Wholesale Lots</option>
207
                                <option value="42428">Other Cell Phones Accs</option>
208
                            </optgroup>
209
                            <optgroup label="Clothing, Shoes Accessories">
210
                                <option value="3082">Baby Toddler Clothing</option>
211
                                <option value="171146">Kids' Clothing, Shoes Accs</option>
212
                                <option value="163147">Costumes, Reenactment, Theater</option>
213
                                <option value="155240">Cultural Ethnic Clothing</option>
214
                                <option value="112425">Dancewear</option>
215
                                <option value="4250">Men's Accessories</option>
216
                                <option value="1059">Men's Clothing</option>
217
                                <option value="93427">Men's Shoes</option>
218
                                <option value="28015">Uniforms Work Clothing</option>
219
                                <option value="155184">Unisex Clothing, Shoes Accs</option>
220
                                <option value="3259">Wedding Formal Occasion</option>
221
                                <option value="4251">Women's Accessories</option>
222
                                <option value="15724">Women's Clothing</option>
223
                                <option value="169291">Women's Handbags Bags</option>
224
                                <option value="3034">Women's Shoes</option>
225
                                <option value="175759">Vintage</option>
226
                                <option value="41964">Wholesale, Large Small Lots</option>
227
                            </optgroup>
228
                            <optgroup label="Coins Paper Money">
229
                                <option value="39482">Bullion</option>
230
                                <option value="253">Coins: US</option>
231
                                <option value="3377">Coins: Canada</option>
232
                                <option value="4733">Coins: Ancient</option>
233
                                <option value="18466">Coins: Medieval</option>
234
                                <option value="256">Coins: World</option>
235
                                <option value="3452">Exonumia</option>
236
                                <option value="3412">Paper Money: US</option>
237
                                <option value="3411">Paper Money: World</option>
238
                                <option value="83274">Publications Supplies</option>
239
                                <option value="3444">Stocks Bonds, Scripophily</option>
240
                                <option value="179197">Virtual Currency</option>
241
                                <option value="169305">Other Coins Paper Money</option>
242
                            </optgroup>
243
                            <optgroup label="Collectibles">
244
                                <option value="34">Advertising</option>
245
                                <option value="1335">Animals</option>
246
                                <option value="13658">Animation Art Characters</option>
247
                                <option value="66502">Arcade, Jukeboxes Pinball</option>
248
                                <option value="14429">Autographs</option>
249
                                <option value="66503">Banks, Registers Vending</option>
250
                                <option value="3265">Barware</option>
251
                                <option value="156277">Beads</option>
252
                                <option value="29797">Bottles Insulators</option>
253
                                <option value="562">Breweriana, Beer</option>
254
                                <option value="898">Casino</option>
255
                                <option value="397">Clocks</option>
256
                                <option value="63">Comics</option>
257
                                <option value="1462">Credit, Charge Cards</option>
258
                                <option value="3913">Cultures Ethnicities</option>
259
                                <option value="13777">Decorative Collectibles</option>
260
                                <option value="137">Disneyana</option>
261
                                <option value="m10860">Fantasy, Mythical Magic</option>
262
                                <option value="13877">Historical Memorabilia</option>
263
                                <option value="907">Holiday Seasonal</option>
264
                                <option value="13905">Kitchen Home</option>
265
                                <option value="1401">Knives, Swords Blades</option>
266
                                <option value="1404">Lamps, Lighting</option>
267
                                <option value="940">Linens Textiles (1930-Now)</option>
268
                                <option value="1430">Metalware</option>
269
                                <option value="13956">Militaria</option>
270
                                <option value="182982">Non-Sport Trading Cards</option>
271
                                <option value="124">Paper</option>
272
                                <option value="966">Pens Writing Instruments</option>
273
                                <option value="14005">Pez, Keychains, Promo Glasses</option>
274
                                <option value="1463">Phone Cards</option>
275
                                <option value="14277">Photographic Images</option>
276
                                <option value="39507">Pinbacks, Bobbles, Lunchboxes</option>
277
                                <option value="914">Postcards</option>
278
                                <option value="29832">Radio, Phonograph, TV, Phone</option>
279
                                <option value="1446">Religion Spirituality</option>
280
                                <option value="3213">Rocks, Fossils Minerals</option>
281
                                <option value="152">Science Fiction Horror</option>
282
                                <option value="412">Science Medicine (1930-Now)</option>
283
                                <option value="113">Sewing (1930-Now)</option>
284
                                <option value="165800">Souvenirs Travel Memorabilia</option>
285
                                <option value="593">Tobacciana</option>
286
                                <option value="13849">Tools, Hardware Locks</option>
287
                                <option value="417">Transportation</option>
288
                                <option value="597">Vanity, Perfume Shaving</option>
289
                                <option value="69851">Vintage, Retro, Mid-Century</option>
290
                                <option value="45058">Wholesale Lots</option>
291
                            </optgroup>
292
                            <optgroup label="Computers/Tablets Networking">
293
                                <option value="183062">3D Printers Supplies</option>
294
                                <option value="171485">Tablets eBook Readers</option>
295
                                <option value="176970">Tablet eBook Reader Accs</option>
296
                                <option value="180235">Tablet eBook Reader Parts</option>
297
                                <option value="175672">Laptops Netbooks</option>
298
                                <option value="171957">Desktops All-In-Ones</option>
299
                                <option value="31530">Laptop Desktop Accessories</option>
300
                                <option value="182094">Computer Cables Connectors</option>
301
                                <option value="175673">Computer Components Parts</option>
302
                                <option value="165">Drives, Storage Blank Media</option>
303
                                <option value="175698">Enterprise Networking, Servers</option>
304
                                <option value="11176">Home Networking Connectivity</option>
305
                                <option value="3676">Keyboards, Mice Pointers</option>
306
                                <option value="162497">Monitors, Projectors Accs</option>
307
                                <option value="86722">Power Protection, Distribution</option>
308
                                <option value="171961">Printers, Scanners Supplies</option>
309
                                <option value="18793">Software</option>
310
                                <option value="3516">Manuals Resources</option>
311
                                <option value="11189">Vintage Computing</option>
312
                                <option value="159260">Wholesale Lots</option>
313
                                <option value="162">Other Computers Networking</option>
314
                            </optgroup>
315
                            <optgroup label="Consumer Electronics">
316
                                <option value="184435">Voice-Enabled Smart Assistants</option>
317
                                <option value="183067">Virtual Reality</option>
318
                                <option value="15052">Portable Audio Headphones</option>
319
                                <option value="32852">TV, Video Home Audio</option>
320
                                <option value="3270">Vehicle Electronics GPS</option>
321
                                <option value="50582">Home Automation</option>
322
                                <option value="48633">Home Surveillance</option>
323
                                <option value="3286">Home Telephones Accessories</option>
324
                                <option value="48446">Multipurpose Batteries Power</option>
325
                                <option value="1500">Radio Communication</option>
326
                                <option value="14948">Gadgets Other Electronics</option>
327
                                <option value="183077">Vintage Electronics</option>
328
                                <option value="61494">Wholesale Lots</option>
329
                            </optgroup>
330
                            <optgroup label="Crafts">
331
                                <option value="11783">Art Supplies</option>
332
                                <option value="31723">Beads Jewelry Making</option>
333
                                <option value="28162">Fabric</option>
334
                                <option value="183118">Fabric Painting Decorating</option>
335
                                <option value="163778">Glass Mosaics</option>
336
                                <option value="71183">Handcrafted Finished Pieces</option>
337
                                <option value="160667">Home Arts Crafts</option>
338
                                <option value="116652">Kids' Crafts</option>
339
                                <option value="28131">Leathercrafts</option>
340
                                <option value="28102">Multi-Purpose Craft Supplies</option>
341
                                <option value="160706">Needlecrafts Yarn</option>
342
                                <option value="11788">Scrapbooking Paper Crafts</option>
343
                                <option value="160737">Sewing</option>
344
                                <option value="183302">Sculpting, Molding Ceramics</option>
345
                                <option value="3122">Stamping Embossing</option>
346
                                <option value="75576">Other Crafts</option>
347
                                <option value="45074">Wholesale Lots</option>
348
                            </optgroup>
349
                            <optgroup label="Dolls Bears">
350
                                <option value="50253">Bear Making Supplies</option>
351
                                <option value="386">Bears</option>
352
                                <option value="238">Dolls</option>
353
                                <option value="1202">Dollhouse Miniatures</option>
354
                                <option value="2440">Paper Dolls</option>
355
                                <option value="52546">Wholesale Lots</option>
356
                            </optgroup>
357
                            <optgroup label="DVDs Movies">
358
                                <option value="617">DVDs Blu-ray Discs</option>
359
                                <option value="63821">Film Stock</option>
360
                                <option value="381">Laserdiscs</option>
361
                                <option value="132975">UMDs</option>
362
                                <option value="309">VHS Tapes</option>
363
                                <option value="41676">Other Formats</option>
364
                                <option value="52554">Storage Media Accessories</option>
365
                                <option value="31606">Wholesale Lots</option>
366
                            </optgroup>
367
                            <optgroup label="Entertainment Memorabilia">
368
                                <option value="57">Autographs-Original</option>
369
                                <option value="104412">Autographs-Reprints</option>
370
                                <option value="196">Movie Memorabilia</option>
371
                                <option value="2329">Music Memorabilia</option>
372
                                <option value="1424">Television Memorabilia</option>
373
                                <option value="2362">Theater Memorabilia</option>
374
                                <option value="45101">Video Game Memorabilia</option>
375
                                <option value="2312">Other Entertainment Mem</option>
376
                            </optgroup>
377
                            <optgroup label="Gift Cards Coupons">
378
                                <option value="172009">Gift Cards</option>
379
                                <option value="172036">eBay Gift Cards</option>
380
                                <option value="31411">Gift Certificates</option>
381
                                <option value="172010">Coupons</option>
382
                                <option value="176950">Digital Gifts</option>
383
                            </optgroup>
384
                            <optgroup label="Health Beauty">
385
                                <option value="11838">Bath Body</option>
386
                                <option value="180345">Fragrances</option>
387
                                <option value="11854">Hair Care Styling</option>
388
                                <option value="67588">Health Care</option>
389
                                <option value="31786">Makeup</option>
390
                                <option value="36447">Massage</option>
391
                                <option value="11778">Medical, Mobility Disability</option>
392
                                <option value="47945">Nail Care, Manicure Pedicure</option>
393
                                <option value="67659">Natural Alternative Remedies</option>
394
                                <option value="31769">Oral Care</option>
395
                                <option value="177731">Salon Spa Equipment</option>
396
                                <option value="31762">Shaving Hair Removal</option>
397
                                <option value="11863">Skin Care</option>
398
                                <option value="31772">Sun Protection Tanning</option>
399
                                <option value="33914">Tattoos Body Art</option>
400
                                <option value="31414">Vision Care</option>
401
                                <option value="180959">Vitamins Dietary Supplements</option>
402
                                <option value="40965">Wholesale Lots</option>
403
                                <option value="1277">Other Health Beauty</option>
404
                            </optgroup>
405
                            <optgroup label="Home Garden">
406
                                <option value="26677">Bath</option>
407
                                <option value="20444">Bedding</option>
408
                                <option value="14308">Food Beverages</option>
409
                                <option value="178069">Fresh Cut Flowers Supplies</option>
410
                                <option value="3197">Furniture</option>
411
                                <option value="16086">Greeting Cards Party Supply</option>
412
                                <option value="38227">Holiday Seasonal Decor</option>
413
                                <option value="10033">Home Decor</option>
414
                                <option value="159907">Home Improvement</option>
415
                                <option value="299">Household Supplies Cleaning</option>
416
                                <option value="176988">Kids Teens at Home</option>
417
                                <option value="20625">Kitchen, Dining Bar</option>
418
                                <option value="20697">Lamps, Lighting Ceiling Fans</option>
419
                                <option value="20710">Major Appliances</option>
420
                                <option value="20571">Rugs Carpets</option>
421
                                <option value="631">Tools</option>
422
                                <option value="11827">Wedding Supplies</option>
423
                                <option value="63514">Window Treatments Hardware</option>
424
                                <option value="159912">Yard, Garden Outdoor Living</option>
425
                                <option value="31605">Wholesale Lots</option>
426
                                <option value="181076">Other Home Garden</option>
427
                            </optgroup>
428
                            <optgroup label="Jewelry Watches">
429
                                <option value="84605">Children's Jewelry</option>
430
                                <option value="91427">Engagement Wedding</option>
431
                                <option value="11312">Ethnic, Regional Tribal</option>
432
                                <option value="10968">Fashion Jewelry</option>
433
                                <option value="4196">Fine Jewelry</option>
434
                                <option value="110633">Handcrafted, Artisan Jewelry</option>
435
                                <option value="10321">Jewelry Boxes Organizers</option>
436
                                <option value="164352">Jewelry Design Repair</option>
437
                                <option value="179264">Loose Beads</option>
438
                                <option value="491">Loose Diamonds Gemstones</option>
439
                                <option value="10290">Men's Jewelry</option>
440
                                <option value="48579">Vintage Antique Jewelry</option>
441
                                <option value="14324">Watches, Parts Accessories</option>
442
                                <option value="98863">Other Jewelry Watches</option>
443
                                <option value="40131">Wholesale Lots</option>
444
                            </optgroup>
445
                            <optgroup label="Music">
446
                                <option value="176983">Cassettes</option>
447
                                <option value="176984">CDs</option>
448
                                <option value="176985">Records</option>
449
                                <option value="618">Other Formats</option>
450
                                <option value="52473">Storage Media Accessories</option>
451
                                <option value="31608">Wholesale Lots</option>
452
                            </optgroup>
453
                            <optgroup label="Musical Instruments Gear">
454
                                <option value="16212">Brass</option>
455
                                <option value="48458">DJ Equipment</option>
456
                                <option value="3858">Guitars Basses</option>
457
                                <option value="182150">Instruction Books, CDs Video</option>
458
                                <option value="175696">Karaoke Entertainment</option>
459
                                <option value="180012">Percussion</option>
460
                                <option value="180010">Pianos, Keyboards Organs</option>
461
                                <option value="180014">Pro Audio Equipment</option>
462
                                <option value="180015">Sheet Music Song Books</option>
463
                                <option value="12922">Stage Lighting Effects</option>
464
                                <option value="180016">String</option>
465
                                <option value="10181">Wind Woodwind</option>
466
                                <option value="180008">Equipment</option>
467
                                <option value="181162">Vintage Musical Instruments</option>
468
                                <option value="52555">Wholesale Lots</option>
469
                                <option value="308">Other Musical Instruments</option>
470
                            </optgroup>
471
                            <optgroup label="Pet Supplies">
472
                                <option value="177801">Backyard Poultry Supplies</option>
473
                                <option value="20734">Bird Supplies</option>
474
                                <option value="20737">Cat Supplies</option>
475
                                <option value="20742">Dog Supplies</option>
476
                                <option value="20754">Fish Aquariums</option>
477
                                <option value="1285">Reptile Supplies</option>
478
                                <option value="26696">Small Animal Supplies</option>
479
                                <option value="116391">Pet Memorials Urns</option>
480
                                <option value="48760">Wholesale Lots</option>
481
                                <option value="301">Other Pet Supplies</option>
482
                            </optgroup>
483
                            <optgroup label="Pottery Glass">
484
                                <option value="50693">Glass</option>
485
                                <option value="18875">Pottery China</option>
486
                            </optgroup>
487
                            <optgroup label="Real Estate">
488
                                <option value="15825">Commercial</option>
489
                                <option value="15841">Land</option>
490
                                <option value="94825">Manufactured Homes</option>
491
                                <option value="12605">Residential</option>
492
                                <option value="15897">Timeshares for Sale</option>
493
                                <option value="1607">Other Real Estate</option>
494
                            </optgroup>
495
                            <optgroup label="Specialty Services">
496
                                <option value="47126">Artistic Services</option>
497
                                <option value="50343">Custom Clothing Jewelry</option>
498
                                <option value="50349">eBay Auction Services</option>
499
                                <option value="47131">Graphic Logo Design</option>
500
                                <option value="170048">Home Improvement Services</option>
501
                                <option value="175814">Item Based Services</option>
502
                                <option value="50355">Media Editing Duplication</option>
503
                                <option value="20943">Printing Personalization</option>
504
                                <option value="47119">Restoration Repair</option>
505
                                <option value="47104">Web Computer Services</option>
506
                                <option value="317">Other Specialty Services</option>
507
                            </optgroup>
508
                            <optgroup label="Sporting Goods">
509
                                <option value="179767">Boxing, Martial Arts MMA</option>
510
                                <option value="7294">Cycling</option>
511
                                <option value="1492">Fishing</option>
512
                                <option value="15273">Fitness, Running Yoga</option>
513
                                <option value="1513">Golf</option>
514
                                <option value="7301">Hunting</option>
515
                                <option value="36274">Indoor Games</option>
516
                                <option value="159043">Outdoor Sports</option>
517
                                <option value="159049">Team Sports</option>
518
                                <option value="159134">Tennis Racquet Sports</option>
519
                                <option value="159136">Water Sports</option>
520
                                <option value="36259">Winter Sports</option>
521
                                <option value="310">Other Sporting Goods</option>
522
                                <option value="40146">Wholesale Lots</option>
523
                            </optgroup>
524
                            <optgroup label="Sports Mem, Cards Fan Shop">
525
                                <option value="51">Autographs-Original</option>
526
                                <option value="50115">Autographs-Reprints</option>
527
                                <option value="24409">Fan Apparel Souvenirs</option>
528
                                <option value="50116">Game Used Memorabilia</option>
529
                                <option value="50123">Vintage Sports Memorabilia</option>
530
                                <option value="56080">Wholesale Lots</option>
531
                                <option value="141755">Sports Stickers, Sets Albums</option>
532
                                <option value="212">Sports Trading Cards</option>
533
                            </optgroup>
534
                            <optgroup label="Stamps">
535
                                <option value="261">United States</option>
536
                                <option value="3478">Canada</option>
537
                                <option value="3499">Great Britain</option>
538
                                <option value="181423">Africa</option>
539
                                <option value="181416">Asia</option>
540
                                <option value="181424">Australia Oceania</option>
541
                                <option value="65174">British Colonies Territories</option>
542
                                <option value="179377">Caribbean</option>
543
                                <option value="4742">Europe</option>
544
                                <option value="181417">Latin America</option>
545
                                <option value="181422">Middle East</option>
546
                                <option value="181420">Worldwide</option>
547
                                <option value="4752">Topical Stamps</option>
548
                                <option value="7898">Specialty Philately</option>
549
                                <option value="181421">Publications Supplies</option>
550
                                <option value="170137">Other Stamps</option>
551
                            </optgroup>
552
                            <optgroup label="Tickets Experiences">
553
                                <option value="173633">Sports Tickets</option>
554
                                <option value="173634">Concert Tickets</option>
555
                                <option value="173635">Theater Tickets</option>
556
                                <option value="170594">Theme Park Club Passes</option>
557
                                <option value="178892">Parking Passes</option>
558
                                <option value="170591">Special Experiences</option>
559
                                <option value="1306">Other Tickets Experiences</option>
560
                            </optgroup>
561
                            <optgroup label="Toys Hobbies">
562
                                <option value="246">Action Figures</option>
563
                                <option value="49019">Beanbag Plush</option>
564
                                <option value="183446">Building Toys</option>
565
                                <option value="19016">Classic Toys</option>
566
                                <option value="2536">Collectible Card Games</option>
567
                                <option value="222">Diecast Toy Vehicles</option>
568
                                <option value="11731">Educational</option>
569
                                <option value="19071">Electronic, Battery Wind-Up</option>
570
                                <option value="19077">Fast Food Cereal Premiums</option>
571
                                <option value="233">Games</option>
572
                                <option value="58799">Marbles</option>
573
                                <option value="180250">Model Railroads Trains</option>
574
                                <option value="1188">Models Kits</option>
575
                                <option value="11743">Outdoor Toys Structures</option>
576
                                <option value="19169">Preschool Toys Pretend Play</option>
577
                                <option value="2613">Puzzles</option>
578
                                <option value="m2562">Radio Control Control Line</option>
579
                                <option value="19192">Robots, Monsters Space Toys</option>
580
                                <option value="2616">Slot Cars</option>
581
                                <option value="436">Stuffed Animals</option>
582
                                <option value="2631">Toy Soldiers</option>
583
                                <option value="2624">TV, Movie Character Toys</option>
584
                                <option value="717">Vintage Antique Toys</option>
585
                                <option value="40149">Wholesale Lots</option>
586
                            </optgroup>
587
                            <optgroup label="Travel">
588
                                <option value="3253">Airline</option>
589
                                <option value="164802">Campground RV Parks</option>
590
                                <option value="147399">Car Rental</option>
591
                                <option value="16078">Cruises</option>
592
                                <option value="16123">Lodging</option>
593
                                <option value="16080">Luggage</option>
594
                                <option value="173520">Luggage Accessories</option>
595
                                <option value="164803">Maps</option>
596
                                <option value="98982">Rail</option>
597
                                <option value="93838">Travel Accessories</option>
598
                                <option value="29578">Vacation Packages</option>
599
                                <option value="183477">Vintage Luggage Travel Accs</option>
600
                                <option value="1310">Other Travel</option>
601
                            </optgroup>
602
                            <optgroup label="Video Games Consoles">
603
                                <option value="139973">Video Games</option>
604
                                <option value="139971">Video Game Consoles</option>
605
                                <option value="54968">Video Game Accessories</option>
606
                                <option value="182174">Manuals, Inserts Box Art</option>
607
                                <option value="182175">Original Game Cases Boxes</option>
608
                                <option value="156597">Prepaid Gaming Cards</option>
609
                                <option value="171833">Replacement Parts Tools</option>
610
                                <option value="156595">Strategy Guides Cheats</option>
611
                                <option value="38583">Video Game Merchandise</option>
612
                                <option value="187">Other Video Games Consoles</option>
613
                                <option value="48749">Wholesale Lots</option>
614
                            </optgroup>
615
                            <optgroup label="Everything Else">
616
                                <option value="319">Adult Only</option>
617
                                <option value="3143">Career Development Education</option>
618
                                <option value="177600">eBay Special Offers</option>
619
                                <option value="20924">eBay User Tools</option>
620
                                <option value="88739">Funeral Cemetery</option>
621
                                <option value="20925">Genealogy</option>
622
                                <option value="102480">Information Products</option>
623
                                <option value="19266">Metaphysical</option>
624
                                <option value="102329">Personal Development</option>
625
                                <option value="102535">Personal Security</option>
626
                                <option value="102545">Religious Products Supplies</option>
627
                                <option value="102553">Reward Points Incentives</option>
628
                                <option value="1466">Weird Stuff</option>
629
                            </optgroup>
630
                            <optgroup label="Hunting">
631
                                <option value="177909">Blinds Treestands</option>
632
                                <option value="7304">Books Video</option>
633
                                <option value="159037">Bow</option>
634
                                <option value="36239">Clothing, Shoes Accessories</option>
635
                                <option value="36249">Decoys</option>
636
                                <option value="36252">Game Calls</option>
637
                                <option value="52505">Game Trail Cameras</option>
638
                                <option value="73943">Gun Parts</option>
639
                                <option value="177880">Gun Smithing Maintenance</option>
640
                                <option value="73937">Gun Storage</option>
641
                                <option value="73963">Holsters, Belts Pouches</option>
642
                                <option value="52502">Accessories</option>
643
                                <option value="71110">Dog Supplies</option>
644
                                <option value="14110">Trips Leases</option>
645
                                <option value="42574">Knives Tools</option>
646
                                <option value="31823">Reloading Equipment</option>
647
                                <option value="177904">Range Shooting Accessories</option>
648
                                <option value="31710">Scopes, Optics Lasers</option>
649
                                <option value="177890">Tactical Duty Gear</option>
650
                                <option value="36271">Taxidermy</option>
651
                                <option value="71131">Vintage Hunting</option>
652
                                <option value="383">Other</option>
653
                            </optgroup>
654
                            <optgroup label="Outdoor Sports">
655
                                <option value="20835">Archery</option>
656
                            </optgroup>
657
                            <optgroup label="Sports Trading Cards">
658
                                <option value="666">Auto Racing Cards</option>
659
                                <option value="213">Baseball Cards</option>
660
                                <option value="214">Basketball Cards</option>
661
                                <option value="133072">College Cards</option>
662
                                <option value="215">Football Cards</option>
663
                                <option value="4240">Golf Cards</option>
664
                                <option value="216">Ice Hockey Cards</option>
665
                                <option value="183444">Soccer Cards</option>
666
                            </optgroup>
667
                        </select>
7 - 668
                        <div>
669
                            <h4>Duplicate Checking</h4>
670
                            <p>
671
                                <input id="duplicateCheck" name="duplicateCheck" value="Duplicate" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
672
                                <label for="duplicateCheck">Show Duplicates</label>
673
                            </p>
674
                        </div>
2 - 675
                    </div>
676
 
7 - 677
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 678
                        <h4>Price</h4>
679
 
680
                        <label for="minPrice" class="w3-small">Minimum</label>
681
                        <input id="minPrice" name="minPrice" class="w3-input w3-border-0" style="height:3em">
682
                        <label for="maxPrice" class="w3-small">Maximum</label>
683
                        <input id="maxPrice" name="maxPrice" class="w3-input w3-border-0" style="height:3em">
684
                    </div>
685
 
7 - 686
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 687
                        <h4>Bids</h4>
688
 
689
                        <label for="minBids" class="w3-small">Minimum</label>
690
                        <input id="minBids" name="minBids" class="w3-input w3-border-0" type="number" style="height:3em">
691
                        <label for="maxBids" class="w3-small">Maximum</label>
692
                        <input id="maxBids" name="maxBids" class="w3-input w3-border-0" type="number" style="height:3em">
693
                    </div>
694
 
7 - 695
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 696
                        <h4>Feedback</h4>
697
 
698
                        <label for="minFeedback" class="w3-small">Minimum</label>
699
                        <input id="minFeedback" name="minFeedback" class="w3-input w3-border-0" type="number" style="height:3em">
700
                        <label for="maxFeedback" class="w3-small">Maximum</label>
701
                        <input id="maxFeedback" name="maxFeedback" class="w3-input w3-border-0" type="number" style="height:3em">
702
                    </div>
703
 
7 - 704
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 705
                        <h4>Quantity</h4>
706
 
707
                        <label for="minQuantity" class="w3-small">Minimum</label>
708
                        <input id="minQuantity" name="minQuantity" class="w3-input w3-border-0" type="number" style="height:3em">
709
                        <label for="maxQuantity" class="w3-small">Maximum</label>
710
                        <input id="maxQuantity" name="maxQuantity" class="w3-input w3-border-0" type="number" style="height:3em">
711
                    </div>
712
 
7 - 713
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 714
                        <h4>Start Date</h4>
715
                        <label for="minStartDate" class="w3-small">On or After <img src="images2/cal.gif" alt="Calendar Picker" onclick="javascript:NewCssCal('minStartDate','yyyyMMdd','arrow',false,'24',false,'past')" style="cursor:pointer" /></label>
716
                        <input id="minStartDate" name="minStartDate" class="w3-input w3-border-0" style="height:3em" type="text">
717
                        <label for="maxStartDate" class="w3-small">On or Before <img src="images2/cal.gif" alt="Calendar Picker" onclick="javascript:NewCssCal('maxStartDate','yyyyMMdd','arrow',false,'24',false,'past')" style="cursor:pointer" /></label>
718
                        <input id="maxStartDate" name="maxStartDate" class="w3-input w3-border-0" style="height:3em" type="text">
719
                    </div>
7 - 720
 
721
                    <div class="w3-container w3-card-2 s6 l1 w3-cell w3-mobile">
2 - 722
                        <h4>End Date</h4>
723
                        <label for="minEndDate" class="w3-small">On or After <img src="images2/cal.gif" alt="Calendar Picker" onclick="javascript:NewCssCal('minEndDate','yyyyMMdd','arrow',false,'24')" style="cursor:pointer" /></label>
724
                        <input id="minEndDate" name="minEndDate" class="w3-input w3-border-0" style="height:3em" type="text">
725
                        <label for="maxEndDate" class="w3-small">On or Before <img src="images2/cal.gif" alt="Calendar Picker" onclick="javascript:NewCssCal('maxEndDate','yyyyMMdd','arrow',false,'24')" style="cursor:pointer" /></label>
726
                        <input id="maxEndDate" name="maxEndDate" class="w3-input w3-border-0" style="height:3em" type="text">
727
                    </div>
728
                </div>
729
 
730
                <div id="keywordHelp" class="w3-container w3-card-2 w3-padding w3-hide">
731
                    <a href="javascript:void(0)" class="w3-right w3-xlarge w3-ripple" style="text-decoration:none;" onclick="hideKeywordHelp()">Close &#10006;</a>
732
                    <h3>Advanced Keyword Search Operators</h3>
733
                    <p>The value specified in the keywords field can contain one or more keywords. The words "and" and "or" are treated like any other word. Only use "and," "or," or "the" if you are searching for listings containing these words. You can
734
                        use AND or OR logic by including certain modifiers. Be careful when using spaces before or after modifiers, such as plus signs ("+") or minus signs ("-").</p>
735
                    <p>The following table shows the operators and character punctuation that can be used in keyword queries, and the effects they have.</p>
736
                    <table class="w3-table-all">
737
                        <tr>
738
                            <th>Operator</th>
739
                            <th>Description</th>
740
                            <th>Example</th>
741
                            <th>Returns</th>
742
                        </tr>
743
                        <tr>
744
                            <td>Space between words</td>
745
                            <td>Applies AND logic to multiple keywords.</td>
746
                            <td>baseball card</td>
747
                            <td>Items with both the words "baseball" and "card".
748
                                <br/>Note: Keyword queries consisting of keywords separated by spaces only are subject to automatic keyword expansions.</td>
749
                        </tr>
750
                        <tr>
751
                            <td>Comma (,) between words, with no parentheses or spaces</td>
752
                            <td>Requires an exact sequence of words.</td>
753
                            <td>baseball,card</td>
754
                            <td>Items with the exact phrase "baseball card" in the title. This is equivalent to specifying the keywords, separated by spaces, in order within quotation marks (e.g., "baseball card").</td>
755
                        </tr>
756
                        <tr>
757
                            <td>Comma between words in parentheses with no spaces</td>
758
                            <td>Applies OR logic to multiple keywords.</td>
759
                            <td>(baseball,card)</td>
760
                            <td>Items with either the word "baseball" or the word "card" in the title.</td>
761
                        </tr>
762
                        <tr>
763
                            <td>Quoted (" ") words</td>
764
                            <td>Requires an exact sequence of words.</td>
765
                            <td>"baseball card"</td>
766
                            <td>Items with the exact phrase "baseball card" in the title.</td>
767
                        </tr>
768
                        <tr>
769
                            <td>Minus ("-") sign before a word</td>
770
                            <td>Applies NOT logic to a single word. Specified word cannot be present.</td>
771
                            <td>baseball -autograph</td>
772
                            <td>Items that have the word "baseball" but not "autograph".
773
                                <br/>Note: A keyword query cannot consist of excluded words only. You must include one or more search terms in order to use the NOT operator ("-"). For example, "-autograph" is not a valid keywords value on its own, but
774
                                "baseball -autograph" (i.e., &lt;keywords&gt;baseball -autograph&lt;/keywords&gt;) will work.
775
                                <br/>When excluding words, you must have a space before the minus sign and no space between the minus sign and the word you are excluding.</td>
776
                        </tr>
777
                        <tr>
778
                            <td>Minus ("-") sign before a group of words in parentheses</td>
779
                            <td>Applies NOT logic to a group of words. Specified words cannot be present.</td>
780
                            <td>baseball -(autograph,card,star)</td>
781
                            <td>Items with the word "baseball" but not "autograph," "card," or "star".</td>
782
                        </tr>
783
                        <tr>
784
                            <td>At sign ("@")</td>
785
                            <td>Search must find two of three words from a list.</td>
786
                            <td>@1 baseball autograph card</td>
787
                            <td>Items with two of the three words "baseball," "autograph," and "card". For a "3 out of 4" search, use @2 and a list of four words.</td>
788
                        </tr>
789
                        <tr>
790
                            <td>Plus sign ("+")</td>
791
                            <td>Concatenates a query string using AND logic with another keyword.</td>
792
                            <td>@1 baseball autograph card +star</td>
793
                            <td>Items with any two of the three words "baseball," "autograph," or "card" in the title plus the word "star".</td>
794
                        </tr>
795
                    </table>
796
                    <p>With the exception of the advanced search operators, punctuation marks, such as hyphens (-), commas followed by spaces (, ), exclamation points (!), question marks (?), slashes (/), and forward slashes (\) are excluded from matching.
797
                        For example, a search for "3/4 sleeve" (i.e., &lt;keywords&gt;"3/4 sleeve"&lt;/keywords&gt;) will match "3-4 sleeve", "3\4 sleeve", "3/4-sleeve", etc.</p>
798
                    <h3>Automatic Keyword Expansions</h3>
799
                    <p>Keyword queries always search item titles for words or phrases that match exactly the keywords you specified. In some cases, eBay automatically expands keyword queries to increase the number of relevant results in the response. Keyword
800
                        searches can be expanded by expanding the query and/or expanding the places in which to search for matching terms. This is why search results may contain items with titles that do not have all the keywords you specified in your
801
                        query.
802
                    </p>
803
                    <p>Using advanced search operators (e.g., " ", ( ), -, +, *, or @) in your keyword query disables automatic keyword expansions. For example, an exact phrase search, such as &lt;keywords&gt;"baseball card"&lt;/keywords&gt; will limit the
804
                        search results to items with the exact phrase in the title only.</p>
805
                    <table class="w3-table-all">
806
                        <tr>
807
                            <th>Expansion Type</th>
808
                            <th>Description</th>
809
                        </tr>
810
                        <tr>
811
                            <td>Keyword to keyword</td>
812
                            <td>Modifies your keyword query to search for either your original keywords, or a synonymous keyword from eBay's dictionary, such as a root word or a plural form.</td>
813
                        </tr>
814
                        <tr>
815
                            <td>Keyword to category</td>
816
                            <td>Modifies your query to search for items that have a specific keyword in the title or for items listed in a specific related category.</td>
817
                        </tr>
818
                        <tr>
819
                            <td>Keyword to structured item data</td>
820
                            <td>Modifies your query to search for items that have the keywords from the original query in the title or in the item's structured data, such as item specifics or parts compatibility information.</td>
821
                        </tr>
822
                    </table>
823
                </div>
824
 
7 - 825
                <div class="w3-cell-row">
826
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 827
                        <h4>Listing Type</h4>
828
                        <p>
829
                            <input id="ltAll" name="listingType" value="All" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox" checked="checked">
830
                            <label for="ltAll">All</label>
831
                        </p>
832
                        <p>
833
                            <input id="ltAuction" name="listingType" value="Auction" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
834
                            <label for="ltAuction">Auction</label>
835
                        </p>
836
                        <p>
837
                            <input id="ltAuctionWithBIN" name="listingType" value="AuctionWithBIN" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
838
                            <label for="ltAuctionWithBIN">Auction with BIN</label>
839
                        </p>
840
                        <p>
841
                            <input id="ltClassified" name="listingType" value="Classified" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
842
                            <label for="ltClassified">Classified</label>
843
                        </p>
844
                        <p>
845
                            <input id="ltFixedPrice" name="listingType" value="FixedPrice" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
846
                            <label for="ltFixedPrice">Fixed Price</label>
847
                        </p>
848
                        <p>
849
                            <input id="ltStoreInventory" name="listingType" value="StoreInventory" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
850
                            <label for="ltStoreInventory">Store Inventory</label>
851
                        </p>
852
                        <br/>
853
                        <h4>Seller</h4>
854
                        <p>
855
                            <input id="sellerName" name="sellerName" class="w3-input w3-border-0" style="height:3em;" type="text">
856
                            <label for="sellerName">Seller Name</label>
857
                        </p>
858
 
859
                    </div>
7 - 860
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 861
                        <h4>Condition</h4>
862
                        <p>
863
                            <input id="condNew" name="condition" value="New" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
864
                            <label for="condNew">New</label>
865
                        </p>
866
                        <p>
867
                            <input id="condUsed" name="condition" value="Used" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
868
                            <label for="condUsed">Used</label>
869
                        </p>
870
                        <p>
871
                            <input id="condUnspecified" name="condition" value="Unspecified" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
872
                            <label for="condUnspecified">Unspecified</label>
873
                        </p>
874
                        <br/>
875
                        <h4>Located</h4>
876
                        <select id="locatedIn" class="w3-select" style="height:3em" name="locatedIn">
877
                            <option value="North%20America" selected="selected">North America</option>
878
                            <option value="WorldWide">World Wide</option>
879
                        </select>
880
                        <br/><br/>
881
                        <p>
882
                            <input id="localSearchOnly" name="localSearchOnly" class="w3-check" type="checkbox" style="height:1em;vertical-align:super;">
883
                            <label for="localSearchOnly">Local Search Only</label>
884
                        </p>
885
                        <p>
886
                            <input id="maxDistance" name="maxDistance" class="w3-input w3-border-0" type="number" style="height:3em">
887
                            <label for="maxDistance" class="w3-small">Maximum Distance (Miles)</label>
888
                        </p>
889
                    </div>
7 - 890
 
891
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 892
                        <h4>Detail Condition</h4>
893
                        <p>
894
                            <input id="cond1000" name="conditionDetail" value="1000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
895
                            <label for="cond1000">1000 - New</label>
896
                        </p>
897
                        <p>
898
                            <input id="cond1500" name="conditionDetail" value="1500" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
899
                            <label for="cond1500">1500 - New other (see details)</label>
900
                        </p>
901
                        <p>
902
                            <input id="cond1750" name="conditionDetail" value="1750" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
903
                            <label for="cond1750">1750 - New with defects</label>
904
                        </p>
905
                        <p>
906
                            <input id="cond2000" name="conditionDetail" value="2000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
907
                            <label for="cond2000">2000 - Manufacturer refurbished</label>
908
                        </p>
909
                        <p>
910
                            <input id="cond2500" name="conditionDetail" value="2500" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
911
                            <label for="cond2500">2500 - Seller refurbished</label>
912
                        </p>
913
                        <p>
914
                            <input id="cond2750" name="conditionDetail" value="2750" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
915
                            <label for="cond2750">2750 - Like New</label>
916
                        </p>
917
                        <p>
918
                            <input id="cond3000" name="conditionDetail" value="3000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
919
                            <label for="cond3000">3000 - Used / Pre-owned</label>
920
                        </p>
921
                        <p>
922
                            <input id="cond4000" name="conditionDetail" value="4000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
923
                            <label for="cond4000">4000 - Very Good</label>
924
                        </p>
925
                        <p>
926
                            <input id="cond5000" name="conditionDetail" value="5000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
927
                            <label for="cond5000">5000 - Good</label>
928
                        </p>
929
                        <p>
930
                            <input id="cond6000" name="conditionDetail" value="6000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
931
                            <label for="cond6000">6000 - Acceptable</label>
932
                        </p>
933
                        <p>
934
                            <input id="cond7000" name="conditionDetail" value="7000" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
935
                            <label for="cond7000">7000 - For parts or not working</label>
936
                        </p>
937
                    </div>
7 - 938
 
939
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 940
                        <h4>Miscellaneous</h4>
941
                        <p>
942
                            <input id="freeShippingOnly" name="freeShippingOnly" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
943
                            <label for="freeShippingOnly">Free Shipping Only</label>
944
                        </p>
945
 
946
                        <p>
947
                            <input id="bestOfferOnly" name="bestOfferOnly" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
948
                            <label for="bestOfferOnly">Best Offer Only</label>
949
                        </p>
950
 
951
                        <p>
952
                            <input id="lotsOnly" name="lotsOnly" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
953
                            <label for="lotsOnly">Lots Only</label>
954
                        </p>
955
 
956
                        <p>
957
                            <input id="hideDuplicateItems" name="hideDuplicateItems" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox" checked="checked">
958
                            <label for="hideDuplicateItems">Hide Duplicate Items</label>
959
                        </p>
960
 
961
                        <p>
962
                            <input id="outletSellerOnly" name="outletSellerOnly" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
963
                            <label for="outletSellerOnly">Outlet Seller Only</label>
964
                        </p>
965
                        <p>
966
                            <input id="completedItemsOnly" name="completedItemsOnly" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
967
                            <label for="completedItemsOnly">Completed Items</label>
968
                        </p>
969
                        <p>
970
                            <input id="searchDescription" name="searchDescription" class="w3-check" style="height:1em;vertical-align:super;" type="checkbox">
971
                            <label for="searchDescription">Search Description</label>
972
                        </p>
973
                        <p>
974
                            <input id="soldOnly" name="soldOnly" class="w3-check" type="checkbox" style="height:1em;vertical-align:super;" disabled="disabled">
975
                            <label for="soldOnly">Sold Items Only</label>
976
                        </p>
977
                        <p>
978
                            <input id="localPickupOnly" name="localPickupOnly" class="w3-check" type="checkbox" style="height:1em;vertical-align:super;">
979
                            <label for="localPickupOnly">Local Pickup Only</label>
980
                        </p>
981
                    </div>
7 - 982
 
983
                    <div class="w3-container w3-card-2 w3-cell w3-mobile">
2 - 984
                        <h4>Sort Order</h4>
985
                        <p>
986
                            <input id="soBestMatch" name="sortOrder" value="BestMatch" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
987
                            <label for="soBestMatch">Best Match</label>
988
                        </p>
989
                        <p>
990
                            <input id="soBidCountFewest" name="sortOrder" value="BidCountFewest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
991
                            <label for="soBidCountFewest">Bid Count Fewest (Auctions Only)</label>
992
                        </p>
993
                        <p>
994
                            <input id="soBidCountMost" name="sortOrder" value="BidCountMost" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
995
                            <label for="soBidCountMost">Bid Count Most (Auctions Only)</label>
996
                        </p>
997
                        <p>
998
                            <input id="soCurrentPriceHighest" name="sortOrder" value="CurrentPriceHighest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
999
                            <label for="soCurrentPriceHighest">Current Price Highest</label>
1000
                        </p>
1001
                        <p>
1002
                            <input id="soEndTimeSoonest" name="sortOrder" value="EndTimeSoonest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
1003
                            <label for="soEndTimeSoonest">End Time Soonest</label>
1004
                        </p>
1005
                        <p>
1006
                            <input id="soPricePlusShippingHighest" name="sortOrder" value="PricePlusShippingHighest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
1007
                            <label for="soPricePlusShippingHighest">Price Plus Shipping Highest</label>
1008
                        </p>
1009
                        <p>
1010
                            <input id="soPricePlusShippingLowest" name="sortOrder" value="PricePlusShippingLowest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio" checked="checked">
1011
                            <label for="soPricePlusShippingLowest">Price Plus Shipping Lowest</label>
1012
                        </p>
1013
                        <p>
1014
                            <input id="soStartTimeNewest" name="sortOrder" value="StartTimeNewest" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
1015
                            <label for="soStartTimeNewest">Start Time Newest</label>
1016
                        </p>
1017
                        <p>
1018
                            <input id="soWatchCountDecreaseSort" name="sortOrder" value="WatchCountDecreaseSort" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
1019
                            <label for="soWatchCountDecreaseSort">Watch Count Decrease Sort</label>
1020
                        </p>
1021
                        <p>
1022
                            <input id="soDistance" name="sortOrder" value="Distance" class="w3-radio" style="height:1em;vertical-align:super;" type="radio">
1023
                            <label for="soDistance">Distance</label>
1024
                        </p>
1025
                    </div>
1026
                </div>
1027
 
1028
                <input type="submit" class="w3-btn w3-black w3-margin w3-round-large w3-ripple" value="Search" />
1029
                <input type="button" class="w3-btn w3-black w3-margin w3-round-large w3-ripple" onclick="resetForm()" value="Reset form">
1030
                <a href="javascript:void(0)" id="pricing" class="w3-btn w3-black w3-margin w3-right w3-round-large w3-hide w3-ripple" onclick="getPricing()">Pricing</a>
1031
                <a href="javascript:void(0)" id="download" class="w3-btn w3-black w3-margin w3-right w3-round-large w3-hide w3-ripple" onclick="downloadAsCSV()">Download</a>
1032
            </form>
1033
        </div>
1034
 
1035
        <div id="warnings" class="w3-container w3-padding w3-margin w3-card-4 w3-red w3-hide"></div>
1036
        <div id="progressBarDiv" class="w3-container w3-padding w3-margin w3-card-4 w3-hide">
1037
          	<h2 id="progressBarHeader"></h2>
1038
            <div class="w3-light-grey">
1039
                <div id="progressBar" class="w3-container w3-green w3-center" style="width:0%">0%</div>
1040
            </div>
1041
        </div>
7 - 1042
        <div id="duplicates" class="w3-container w3-padding w3-margin w3-card-4 w3-hide">
1043
            <h2>Duplicates</h2>
1044
            <p id="duplicatesText"></p>
1045
        </div>
2 - 1046
        <div id="prices" class="w3-container w3-padding w3-margin w3-card-4 w3-hide"></div>
1047
        <div id="results" class="w3-container w3-padding w3-margin w3-card-4 w3-hide"></div>
1048
        <div id="query" class="w3-container w3-padding w3-margin w3-card-4 w3-hide"></div>
1049
        <div id="csv" class="w3-container w3-padding w3-margin w3-card-4 w3-hide"></div>
1050
        <div id="parameter" class="w3-container w3-padding w3-margin w3-card-4 w3-hide"></div>
1051
 
1052
        <footer class="w3-container w3-center w3-border-top w3-margin">
1053
            Copyright &#169; 2018 MUNA Trading. All rights reserved.
1054
        </footer>
1055
 
1056
    </div>
1057
 
1058
    <script>
1059
 
1060
// Globals
1061
var pagenumber = 1;
1062
var totalEntries = 0;
1063
var asyncFlag = false;
1064
var maxPages = 0;
1065
var currentPage = 0;
1066
var valueStartMin;
1067
var valueStartMax;
1068
var valueEndMin;
1069
var valueEndMax;
1070
var getShippingCostsDone = false;
1071
var ship_str = "";
1072
var ship_str_cost = "";
1073
var ship_str_tax = "";
1074
var maxPricingPages = [-1, -1];
1075
var totalPricingEntries = [0, 0];
1076
 
1077
 
1078
function paginationNav(strCurrentPage, strMaxPage) {
1079
	var str = "";
1080
 
1081
	var currentPage = parseInt(strCurrentPage);
1082
	var maxPage = parseInt(strMaxPage);
1083
 
1084
	if (maxPage == 1) {
1085
		return str;
1086
	}
1087
 
1088
	if (currentPage > 1) {
1089
		str += '<a href="javascript:void(0)" class="w3-button" onclick="prevPage()">&laquo;</a>';
1090
	} else {
1091
		str += '<a href="javascript:void(0)" class="w3-button w3-disabled" onclick="#">&laquo;</a>';
1092
	}
1093
 
1094
	if (currentPage < 100 && currentPage < maxPage) {
1095
		str += '<a href="javascript:void(0)" class="w3-button" onclick="nextPage()">&raquo;</a>';
1096
	} else {
1097
		str += '<a href="javascript:void(0)" class="w3-button w3-disabled" onclick="#">&raquo;</a>';
1098
	}
1099
 
1100
	return str;
1101
}
1102
 
1103
function prevPage() {
1104
	pagenumber--;
1105
	eBaySearch(pagenumber);
1106
}
1107
 
1108
function nextPage() {
1109
	pagenumber++;
1110
	eBaySearch(pagenumber);
1111
}
1112
 
1113
// Parse the response and build an HTML table to display search results
1114
function _cb_findItemsAdvanced(root) {
1115
	var response;
1116
 
1117
	// Error Handling
1118
	if (root.findItemsAdvancedResponse !== undefined) {
1119
		response = root.findItemsAdvancedResponse[0];
1120
	} else if (root.findItemsByProductResponse !== undefined) {
1121
		response = root.findItemsByProductResponse[0];
1122
	} else {
1123
		return;
1124
	}
1125
 
1126
	var ack = response.ack;
1127
	if (ack != 'Success') {
1128
		printeBayAPIError(response);
1129
 
1130
		if (ack == 'Failure' || ack == 'PartialFailure') {
1131
			return;
1132
		}
1133
	}
1134
 
1135
	var i;
1136
	var items = response.searchResult[0].item || [];
1137
	var html = [];
1138
	var distance;
1139
	var distanceUnit;
1140
 
1141
	totalEntries = Number(response.paginationOutput[0].totalEntries);
1142
	html.push('<p class="w3-center">Page ' + response.paginationOutput[0].pageNumber + ' of ' + response.paginationOutput[0].totalPages + ' ' + paginationNav(response.paginationOutput[0].pageNumber, response.paginationOutput[0].totalPages) + ' | Total Entries: ' + response.paginationOutput[0].totalEntries + '</p>');
1143
	html.push('<table class="w3-table-all w3-hoverable">');
1144
	html.push('<tr><th>Picture</th><th>Description</th><th>Price</th><th>Duration</th><th>Style</th><th>Seller</th><th>Shipping</th></tr><tbody>');
1145
 
1146
	for (i = 0; i < items.length; ++i) {
1147
		var item = items[i];
1148
		var title = item.title;
1149
		var pic = '';
1150
		if (item.galleryURL !== undefined) {
1151
			pic = item.galleryURL[0].replace('http:', 'https:');
1152
		}
1153
		var viewitem = item.viewItemURL;
1154
		var price = Number(item.sellingStatus[0].convertedCurrentPrice[0].__value__);
1155
		var shPrice = 0;
1156
		if (item.shippingInfo[0].shippingServiceCost) {
1157
			shPrice = Number(item.shippingInfo[0].shippingServiceCost[0].__value__);
1158
		}
1159
		var timeleftStr = formatTimeleft(moment.duration(item.sellingStatus[0].timeLeft).asSeconds());
1160
		var startTime = moment(item.listingInfo[0].startTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA");
1161
		var endTime = moment(item.listingInfo[0].endTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA");
1162
		var condition = item.condition ? item.condition[0].conditionDisplayName : "Unknown";
1163
		var bidCount = item.sellingStatus[0].bidCount;
1164
		var sellingState = item.sellingStatus[0].sellingState;
1165
		var listingType = item.listingInfo[0].listingType;
1166
		var BO = item.listingInfo[0].bestOfferEnabled;
1167
		var location = item.location;
1168
		var shippingType = item.shippingInfo[0].shippingType;
1169
		var shippingLocation = item.shippingInfo[0].shipToLocations;
1170
		var sellerUserName = item.sellerInfo[0].sellerUserName;
1171
		var feedbackScore = item.sellerInfo[0].feedbackScore;
1172
		var positiveFeedbackPercent = item.sellerInfo[0].positiveFeedbackPercent;
1173
		var convertedBuyItNowPrice = item.listingInfo[0].convertedBuyItNowPrice;
1174
		if (item.distance) {
1175
			distance = item.distance[0].__value__;
1176
			distanceUnit = item.distance[0]["@unit"];
1177
		}
1178
		var watchCount = item.listingInfo[0].watchCount ? item.listingInfo[0].watchCount : 0;
1179
 
1180
		if (title && viewitem) {
1181
			var str = '<tr><td> (' + (i + 1) + ') ' + '<a href="javascript:void(0)" onclick="findSingleItem(' + item.itemId + ')"><img src="' + pic + '" alt="Gallery Image"></a></td>' + '<td><a href="javascript:void(0)" onclick="findSingleItem(' + item.itemId + ')">' + title + '</a>';
1182
			if (item.subtitle) {
1183
				str += '<br/>' + item.subtitle;
1184
			}
1185
			str += '<br/>';
1186
			str += '<a href="' + viewitem + '" target="_blank">' + item.itemId + '</a>';
1187
			str += '<a href="' + window.location.protocol + "//" + window.location.hostname + window.location.pathname + '?keyword=' + String(title).replace(/ /g, "+").replace(/\"/g, "").replace(/#/g, "") + '&listingType=All&hideDuplicateItems=on&completedItemsOnly=on&locatedIn=North+America&sortOrder=BestMatch" class="w3-btn w3-black w3-margin w3-round-large w3-ripple w3-left" style="font-size:8px!important" target="_blank">Search Completed</a>';
1188
			str += '</td><td>$' + price.toFixed(2);
1189
			if (convertedBuyItNowPrice) {
1190
				str += '<br/>BIN $' + Number(convertedBuyItNowPrice[0].__value__).toFixed(2);
1191
			}
1192
			if (item.shippingInfo[0].shippingServiceCost && shPrice) {
1193
				str += '<br/>S&H $' + shPrice.toFixed(2);
1194
			}
1195
			str += "<br/>" + condition;
1196
			if (item.sellingStatus[0].bidCount) {
1197
				str += '<br/>' + bidCount + ' Bid(s)';
1198
			}
1199
 
1200
			str += '</td><td>' + timeleftStr + '<br/>' + startTime + '<br/>' + endTime;
1201
			if (item.listingInfo[0].watchCount) {
1202
				str += '<br/>' + watchCount + ' Watcher(s)';
1203
			}
1204
			str += '</td>';
1205
			str += '<td>' + sellingState + '<br/>' + listingType;
1206
			if (BO == 'true') {
1207
				str += '<br/>Best Offer';
1208
			}
1209
			str += '</td><td>' + sellerUserName + '<br/>' + feedbackScore + '<br/>' + positiveFeedbackPercent + '%</td>';
1210
			str += '<td>' + location;
1211
			if (item.distance) {
1212
				str += ' (' + distance + ' ' + distanceUnit + ')';
1213
			}
1214
			str += '<br/>' + shippingType + '<br/>' + shippingLocation + '</td>';
1215
			str += '</tr>';
1216
 
1217
			html.push(str);
1218
		}
1219
	}
1220
	html.push('</tbody></table>');
1221
	html.push('<p class="w3-center">Page ' + response.paginationOutput[0].pageNumber + ' of ' + response.paginationOutput[0].totalPages + ' ' + paginationNav(response.paginationOutput[0].pageNumber, response.paginationOutput[0].totalPages) + ' | Total Entries: ' + response.paginationOutput[0].totalEntries + '</p>');
1222
 
1223
	var x = document.getElementById("results");
1224
	x.innerHTML = html.join("");
1225
	if (x.className.indexOf("w3-show") == -1) {
1226
		x.className += " w3-show";
1227
	}
1228
	x.scrollIntoView(true);
1229
 
1230
	if (Number(response.paginationOutput[0].totalEntries) > 0) {
1231
		x = document.getElementById("download");
1232
		if (x.className.indexOf("w3-show") == -1) {
1233
			x.className += " w3-show";
1234
		}
1235
 
1236
		x = document.getElementById("pricing");
1237
		if (x.className.indexOf("w3-show") == -1) {
1238
			x.className += " w3-show";
1239
		}
1240
	}
1241
} // End _cb_findItemsAdvanced() function
1242
 
1243
// Parse the response and build an HTML table to display search results
1244
function _cb_findCompletedItems(root) {
1245
	// Error Handling
1246
	var i;
1247
	var response = root.findCompletedItemsResponse[0];
1248
	var ack = response.ack;
1249
	if (ack != 'Success') {
1250
		printeBayAPIError(response);
1251
 
1252
		if (ack == 'Failure' || ack == 'PartialFailure') {
1253
			return;
1254
		}
1255
	}
1256
 
1257
	var items = root.findCompletedItemsResponse[0].searchResult[0].item || [];
1258
	var html = [];
1259
	var distance;
1260
	var distanceUnit;
1261
 
1262
	totalEntries = Number(response.paginationOutput[0].totalEntries);
1263
	html.push('<p class="w3-center">Page ' + response.paginationOutput[0].pageNumber + ' of ' + response.paginationOutput[0].totalPages + ' ' + paginationNav(response.paginationOutput[0].pageNumber, response.paginationOutput[0].totalPages) + ' | Total Entries: ' + response.paginationOutput[0].totalEntries + '</p>');
1264
	html.push('<table class="w3-table-all w3-hoverable">');
1265
	html.push('<tr><th>Picture</th><th>Description</th><th>Price</th><th>Duration</th><th>Style</th><th>Seller</th><th>Shipping</th></tr><tbody>');
1266
 
1267
	for (i = 0; i < items.length; ++i) {
1268
		var item = items[i];
1269
		var title = item.title;
1270
		var pic = item.galleryURL[0].replace('http:', 'https:');
1271
		var viewitem = item.viewItemURL;
1272
		var price = Number(item.sellingStatus[0].convertedCurrentPrice[0].__value__);
1273
		var shPrice = 0;
1274
		if (item.shippingInfo[0].shippingServiceCost) {
1275
			shPrice = Number(item.shippingInfo[0].shippingServiceCost[0].__value__);
1276
		}
1277
		var startTime = moment(item.listingInfo[0].startTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA");
1278
		var endTime = moment(item.listingInfo[0].endTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA");
1279
		var condition = item.condition ? item.condition[0].conditionDisplayName : "Unknown";
1280
		var bidCount = item.sellingStatus[0].bidCount;
1281
		var sellingState = item.sellingStatus[0].sellingState;
1282
		var sold = (sellingState == "EndedWithSales");
1283
		var listingType = item.listingInfo[0].listingType;
1284
		var BO = item.listingInfo[0].bestOfferEnabled;
1285
		var location = item.location;
1286
		var shippingType = item.shippingInfo[0].shippingType;
1287
		var shippingLocation = item.shippingInfo[0].shipToLocations;
1288
		var sellerUserName = item.sellerInfo[0].sellerUserName;
1289
		var feedbackScore = item.sellerInfo[0].feedbackScore;
1290
		var positiveFeedbackPercent = item.sellerInfo[0].positiveFeedbackPercent;
1291
		var convertedBuyItNowPrice = item.listingInfo[0].convertedBuyItNowPrice;
1292
		if (item.distance) {
1293
			distance = item.distance[0].__value__;
1294
			distanceUnit = item.distance[0]["@unit"];
1295
		}
1296
		var watchCount = item.listingInfo[0].watchCount ? item.listingInfo[0].watchCount : 0;
1297
 
1298
		if (title && viewitem) {
1299
			var str = '<tr><td>(' + (i + 1) + ') ' + '<a href="javascript:void(0)" onclick="findSingleItem(' + item.itemId + ')"><img src="' + pic + '" alt="Gallery Image"></a></td><td><a href="javascript:void(0)" onclick="findSingleItem(' + item.itemId + ')">' + title + '</a><br/>';
1300
			str += '<a href="' + viewitem + '" target="_blank">' + item.itemId + '</a>';
1301
			str += '</td><td style="color:';
1302
			if (sold) {
1303
				str += 'green';
1304
			} else {
1305
				str += 'red';
1306
			}
1307
 
1308
			str += '">$' + price.toFixed(2);
1309
			if (convertedBuyItNowPrice) {
1310
				str += '<br/>BIN $' + Number(convertedBuyItNowPrice[0].__value__).toFixed(2);
1311
			}
1312
			if (item.shippingInfo[0].shippingServiceCost && shPrice) {
1313
				str += '<br/>S&H $' + shPrice.toFixed(2);
1314
			}
1315
			str += "<br/>" + condition;
1316
			if (item.sellingStatus[0].bidCount) {
1317
				str += '<br/>' + bidCount + ' Bid(s)';
1318
			}
1319
			str += '</td><td>' + startTime + '<br/>' + endTime + '<br/>';
1320
			str += listingType;
1321
			if (BO == 'true') {
1322
				str += '<br/>Best Offer';
1323
			}
1324
			if (item.listingInfo[0].watchCount) {
1325
				str += '<br/>' + watchCount + ' Watcher(s)';
1326
			}
1327
			str += '</td><td>' + sellerUserName + '<br/>' + feedbackScore + '<br/>' + positiveFeedbackPercent + '%</td>';
1328
			str += '<td>' + location;
1329
			if (item.distance) {
1330
				str += ' (' + distance + ' ' + distanceUnit + ')';
1331
			}
1332
			str += '<br/>' + shippingType + '<br/>' + shippingLocation + '</td>';
1333
			str += '</tr>';
1334
 
1335
			html.push(str);
1336
		}
1337
	}
1338
	html.push('</tbody></table>');
1339
	html.push('<p class="w3-center">Page ' + response.paginationOutput[0].pageNumber + ' of ' + response.paginationOutput[0].totalPages + ' ' + paginationNav(response.paginationOutput[0].pageNumber, response.paginationOutput[0].totalPages) + ' | Total Entries: ' + response.paginationOutput[0].totalEntries + '</p>');
1340
 
1341
 
1342
	var x = document.getElementById("results");
1343
	x.innerHTML = html.join("");
1344
	if (x.className.indexOf("w3-show") == -1) {
1345
		x.className += " w3-show";
1346
	}
1347
	x.scrollIntoView(true);
1348
 
1349
	if (Number(response.paginationOutput[0].totalEntries) > 0) {
1350
		x = document.getElementById("download");
1351
		if (x.className.indexOf("w3-show") == -1) {
1352
			x.className += " w3-show";
1353
		}
1354
 
1355
		x = document.getElementById("pricing");
1356
		if (x.className.indexOf("w3-show") == -1) {
1357
			x.className += " w3-show";
1358
		}
1359
	}
1360
} // End _cb_findCompletedItems() function
1361
 
1362
var ebayRecommendedKeywords = "";
1363
 
1364
// Parse the response and build an HTML table to display search results
1365
function _cb_getKeywordRecommendations(root) {
1366
	// Error Handling
1367
	var response = root.getSearchKeywordsRecommendationResponse[0];
1368
	var ack = response.ack;
1369
	var x;
1370
	if (ack == 'Success') {
1371
		x = document.getElementById("recommendation");
1372
		x.innerHTML = 'Keyword Recommendation:<br/><a href="javascript:void(0)" onclick="copyKeywordRecommendations()">' + response.keywords + '</a>';
1373
		ebayRecommendedKeywords = response.keywords;
1374
	} else if (ack == 'Warning' && response.errorMessage[0].error[0].errorId == 59) {
1375
		x = document.getElementById("recommendation");
1376
		x.innerHTML = "No Keyword Recommendations";
1377
	} else {
1378
		printeBayAPIError(response);
1379
 
1380
		if (ack == 'Failure' || ack == 'PartialFailure') {
1381
			return;
1382
		}
1383
	}
1384
} // End _cb_getKeywordRecommendations() function
1385
 
1386
function copyKeywordRecommendations() {
1387
	document.getElementById("keyword").value = ebayRecommendedKeywords;
1388
	document.getElementById("recommendation").innerHTML = "";
1389
}
1390
 
1391
function printeBayAPIError(root) {
1392
	var x = document.getElementById("warnings");
1393
	x.innerHTML = "<h2>eBay API Error<h2>";
1394
	x.innerHTML += "<p>Id: " + root.errorMessage[0].error[0].errorId + "<br/>";
1395
	x.innerHTML += "<p>Domain: " + root.errorMessage[0].error[0].domain + "<br/>";
1396
	x.innerHTML += "<p>Severity: " + root.errorMessage[0].error[0].severity + "<br/>";
1397
	x.innerHTML += "<p>Category: " + root.errorMessage[0].error[0].category + "<br/>";
1398
	x.innerHTML += "<p>Message: " + root.errorMessage[0].error[0].message + "<br/>";
1399
	x.innerHTML += "<p>Subdomain: " + root.errorMessage[0].error[0].subdomain + "<br/>";
1400
	x.innerHTML += "<p>Parameter: " + root.errorMessage[0].error[0].parameter + "</p>";
1401
	x.innerHTML += "<p>URL: " + "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>" + "</p>";
1402
 
1403
	if (x.className.indexOf("w3-show") == -1) {
1404
		x.className += " w3-show";
1405
	}
1406
 
1407
	if (root.ack == 'Failure' || root.ack == 'PartialFailure') {
1408
		x.scrollIntoView(true);
1409
	}
1410
}
1411
 
1412
// item filters for request
1413
var filterarray = [];
1414
 
1415
// Fill the array of item filters from input form
1416
function fillFilterArray() {
1417
	var value = "";
1418
	var listingType = [];
1419
	var conditions = [];
1420
	var obj = [{
1421
		"name": "",
1422
		"value": "",
1423
		"paramName": "",
1424
		"paramValue": ""
1425
	}];
1426
 
1427
	filterarray = [{
1428
		"name": "AvailableTo",
1429
		"value": "US",
1430
		"paramName": "",
1431
		"paramValue": ""
1432
	}];
1433
 
1434
	value = document.getElementById('sellerName').value;
1435
	if (value) {
1436
		obj = {
1437
			"name": "Seller",
1438
			"value": value,
1439
			"paramName": "",
1440
			"paramValue": ""
1441
		};
1442
		filterarray.push(obj);
1443
	}
1444
 
1445
	value = document.getElementById('minPrice').value;
1446
	if (value > 0) {
1447
		obj = {
1448
			"name": "MinPrice",
1449
			"value": Number(value).toFixed(2),
1450
			"paramName": "Currency",
1451
			"paramValue": "USD"
1452
		};
1453
		filterarray.push(obj);
1454
	}
1455
 
1456
	value = document.getElementById('maxPrice').value;
1457
	if (value > 0) {
1458
		obj = {
1459
			"name": "MaxPrice",
1460
			"value": Number(value).toFixed(2),
1461
			"paramName": "Currency",
1462
			"paramValue": "USD"
1463
		};
1464
		filterarray.push(obj);
1465
	}
1466
 
1467
	value = document.getElementById('minBids').value;
1468
	if (value > 0) {
1469
		obj = {
1470
			"name": "MinBids",
1471
			"value": Number(value).toFixed(0),
1472
			"paramName": "",
1473
			"paramValue": ""
1474
		};
1475
		filterarray.push(obj);
1476
	}
1477
 
1478
	value = document.getElementById('maxBids').value;
1479
	if (value && value >= 0) {
1480
		obj = {
1481
			"name": "MaxBids",
1482
			"value": Number(value).toFixed(0),
1483
			"paramName": "",
1484
			"paramValue": ""
1485
		};
1486
		filterarray.push(obj);
1487
	}
1488
 
1489
	value = document.getElementById('minFeedback').value;
1490
	if (value > 0) {
1491
		obj = {
1492
			"name": "FeedbackScoreMin",
1493
			"value": Number(value).toFixed(0),
1494
			"paramName": "",
1495
			"paramValue": ""
1496
		};
1497
		filterarray.push(obj);
1498
	}
1499
 
1500
	value = document.getElementById('maxFeedback').value;
1501
	if (value && value >= 0) {
1502
		obj = {
1503
			"name": "FeedbackScoreMax",
1504
			"value": Number(value).toFixed(0),
1505
			"paramName": "",
1506
			"paramValue": ""
1507
		};
1508
		filterarray.push(obj);
1509
	}
1510
 
1511
	value = document.getElementById('minQuantity').value;
1512
	if (value > 0) {
1513
		obj = {
1514
			"name": "MinQuantity",
1515
			"value": Number(value).toFixed(0),
1516
			"paramName": "",
1517
			"paramValue": ""
1518
		};
1519
		filterarray.push(obj);
1520
	}
1521
 
1522
	value = document.getElementById('maxQuantity').value;
1523
	if (value && value >= 0) {
1524
		obj = {
1525
			"name": "MaxQuantity",
1526
			"value": Number(value).toFixed(0),
1527
			"paramName": "",
1528
			"paramValue": ""
1529
		};
1530
		filterarray.push(obj);
1531
	}
1532
 
1533
	if (document.getElementById('freeShippingOnly').checked) {
1534
		obj = {
1535
			"name": "FreeShippingOnly",
1536
			"value": "true",
1537
			"paramName": "",
1538
			"paramValue": ""
1539
		};
1540
		filterarray.push(obj);
1541
	}
1542
 
1543
	if (document.getElementById('bestOfferOnly').checked) {
1544
		obj = {
1545
			"name": "BestOfferOnly",
1546
			"value": "true",
1547
			"paramName": "",
1548
			"paramValue": ""
1549
		};
1550
		filterarray.push(obj);
1551
	}
1552
 
1553
	if (document.getElementById('lotsOnly').checked) {
1554
		obj = {
1555
			"name": "LotsOnly",
1556
			"value": "true",
1557
			"paramName": "",
1558
			"paramValue": ""
1559
		};
1560
		filterarray.push(obj);
1561
	}
1562
 
1563
	if (document.getElementById('hideDuplicateItems').checked) {
1564
		obj = {
1565
			"name": "HideDuplicateItems",
1566
			"value": "true",
1567
			"paramName": "",
1568
			"paramValue": ""
1569
		};
1570
		filterarray.push(obj);
1571
	}
1572
 
1573
	if (document.getElementById('outletSellerOnly').checked) {
1574
		obj = {
1575
			"name": "OutletSellerOnly",
1576
			"value": "true",
1577
			"paramName": "",
1578
			"paramValue": ""
1579
		};
1580
		filterarray.push(obj);
1581
	}
1582
 
1583
	if (document.getElementById('soldOnly').checked) {
1584
		obj = {
1585
			"name": "SoldOnly",
1586
			"value": "true",
1587
			"paramName": "",
1588
			"paramValue": ""
1589
		};
1590
		filterarray.push(obj);
1591
	}
1592
 
1593
	if (document.getElementById('localPickupOnly').checked) {
1594
		obj = {
1595
			"name": "LocalPickupOnly",
1596
			"value": "true",
1597
			"paramName": "",
1598
			"paramValue": ""
1599
		};
1600
		filterarray.push(obj);
1601
	}
1602
 
1603
	if (document.getElementById('localSearchOnly').checked) {
1604
		obj = {
1605
			"name": "LocalSearchOnly",
1606
			"value": "true",
1607
			"paramName": "",
1608
			"paramValue": ""
1609
		};
1610
		filterarray.push(obj);
1611
 
1612
		value = document.getElementById('maxDistance').value;
1613
		if (value && value >= 0) {
1614
			obj = {
1615
				"name": "MaxDistance",
1616
				"value": Number(value).toFixed(0),
1617
				"paramName": "",
1618
				"paramValue": ""
1619
			};
1620
			filterarray.push(obj);
1621
		}
1622
	}
1623
 
1624
	if (document.getElementById('ltAll').checked) {
1625
		listingType.push("All");
1626
	}
1627
 
1628
	if (document.getElementById('ltAuction').checked) {
1629
		listingType.push("Auction");
1630
	}
1631
 
1632
	if (document.getElementById('ltAuctionWithBIN').checked) {
1633
		listingType.push("AuctionWithBIN");
1634
	}
1635
 
1636
	if (document.getElementById('ltClassified').checked) {
1637
		listingType.push("Classified");
1638
	}
1639
 
1640
	if (document.getElementById('ltFixedPrice').checked) {
1641
		listingType.push("FixedPrice");
1642
	}
1643
 
1644
	if (document.getElementById('ltStoreInventory').checked) {
1645
		listingType.push("StoreInventory");
1646
	}
1647
 
1648
	if (listingType.length) {
1649
		obj = {
1650
			"name": "ListingType",
1651
			"value": listingType,
1652
			"paramName": "",
1653
			"paramValue": ""
1654
		};
1655
		filterarray.push(obj);
1656
	}
1657
 
1658
	if (document.getElementById('condNew').checked) {
1659
		conditions.push("New");
1660
	}
1661
 
1662
	if (document.getElementById('condUsed').checked) {
1663
		conditions.push("Used");
1664
	}
1665
 
1666
	if (document.getElementById('condUnspecified').checked) {
1667
		conditions.push("Unspecified");
1668
	}
1669
 
1670
	if (document.getElementById('cond1000').checked) {
1671
		conditions.push("1000");
1672
	}
1673
 
1674
	if (document.getElementById('cond1500').checked) {
1675
		conditions.push("1500");
1676
	}
1677
 
1678
	if (document.getElementById('cond1750').checked) {
1679
		conditions.push("1750");
1680
	}
1681
 
1682
	if (document.getElementById('cond2000').checked) {
1683
		conditions.push("2000");
1684
	}
1685
 
1686
	if (document.getElementById('cond2500').checked) {
1687
		conditions.push("2500");
1688
	}
1689
 
1690
	if (document.getElementById('cond2750').checked) {
1691
		conditions.push("2750");
1692
	}
1693
 
1694
	if (document.getElementById('cond3000').checked) {
1695
		conditions.push("3000");
1696
	}
1697
 
1698
	if (document.getElementById('cond4000').checked) {
1699
		conditions.push("4000");
1700
	}
1701
 
1702
	if (document.getElementById('cond5000').checked) {
1703
		conditions.push("5000");
1704
	}
1705
 
1706
	if (document.getElementById('cond6000').checked) {
1707
		conditions.push("6000");
1708
	}
1709
 
1710
	if (document.getElementById('cond7000').checked) {
1711
		conditions.push("7000");
1712
	}
1713
 
1714
	if (conditions.length) {
1715
		obj = {
1716
			"name": "Condition",
1717
			"value": conditions,
1718
			"paramName": "",
1719
			"paramValue": ""
1720
		};
1721
		filterarray.push(obj);
1722
	}
1723
 
1724
	if (document.getElementById('locatedIn').options[0].selected) {
1725
		obj = {
1726
			"name": "LocatedIn",
1727
			"value": document.getElementById('locatedIn').options[0].value,
1728
			"paramName": "",
1729
			"paramValue": ""
1730
		};
1731
		filterarray.push(obj);
1732
	} else {
1733
		obj = {
1734
			"name": "LocatedIn",
1735
			"value": document.getElementById('locatedIn').options[1].value,
1736
			"paramName": "",
1737
			"paramValue": ""
1738
		};
1739
		filterarray.push(obj);
1740
	}
1741
 
1742
	if (valueStartMin) {
1743
		obj = {
1744
			"name": "StartTimeFrom",
1745
			"value": valueStartMin,
1746
			"paramName": "",
1747
			"paramValue": ""
1748
		};
1749
		filterarray.push(obj);
1750
	}
1751
 
1752
	if (valueStartMax) {
1753
		obj = {
1754
			"name": "StartTimeTo",
1755
			"value": valueStartMax,
1756
			"paramName": "",
1757
			"paramValue": ""
1758
		};
1759
		filterarray.push(obj);
1760
	}
1761
 
1762
	if (valueEndMin) {
1763
		obj = {
1764
			"name": "EndTimeFrom",
1765
			"value": valueEndMin,
1766
			"paramName": "",
1767
			"paramValue": ""
1768
		};
1769
		filterarray.push(obj);
1770
	}
1771
 
1772
	if (valueEndMax) {
1773
		obj = {
1774
			"name": "EndTimeTo",
1775
			"value": valueEndMax,
1776
			"paramName": "",
1777
			"paramValue": ""
1778
		};
1779
		filterarray.push(obj);
1780
	}
1781
}
1782
 
1783
// Check the item filter parameters from input form
1784
function checkFilterArray() {
1785
	var x = document.getElementById("warnings");
1786
	var warnings = 0;
1787
	var value = "";
1788
	var value2 = "";
1789
	var valueMin = 0;
1790
	var valueMax = 0;
1791
	var html = [];
1792
	var categoryCounter = 0;
1793
 
1794
	x.innerHTML = "";
1795
 
1796
	value = document.getElementById('keyword').value;
1797
	value2 = document.getElementById('sellerName').value;
1798
	for (var categoryIndex = 1; categoryIndex < document.getElementById('category').options.length; categoryIndex++) {
1799
		if (document.getElementById('category').options[categoryIndex].selected) {
1800
			categoryCounter++;
1801
		}
1802
	}
1803
 
1804
	if (!value && !value2 && !categoryCounter) {
1805
		warnings++;
1806
		html.push("<p>No Keyword, Category or Seller Name specified</p>");
1807
	}
1808
 
1809
	if (categoryCounter > 3) {
1810
		warnings++;
1811
		html.push("<p>Only up to 3 categories allowed</p>");
1812
	}
1813
 
1814
	valueMin = document.getElementById('minPrice').value;
1815
	valueMax = document.getElementById('maxPrice').value;
1816
 
1817
	if (valueMin && valueMin < 0) {
1818
		warnings++;
1819
		html.push("<p>Minimum Price under $0</p>");
1820
	}
1821
 
1822
	if (valueMax && valueMax <= 0) {
1823
		warnings++;
1824
		html.push("<p>Maximum Price at or under $0</p>");
1825
	}
1826
 
1827
	if (valueMin && valueMax) {
1828
		if (Number(valueMin) > Number(valueMax)) {
1829
			warnings++;
1830
			html.push("<p>Minimum Price " + Number(valueMin).toFixed(0) + " greater than Maximum Price " + Number(valueMax).toFixed(0) + "</p>");
1831
		}
1832
	}
1833
 
1834
	valueMin = document.getElementById('minBids').value;
1835
	valueMax = document.getElementById('maxBids').value;
1836
 
1837
	if (valueMin && valueMin < 0) {
1838
		warnings++;
1839
		html.push("<p>Minimum Bids under 0</p>");
1840
	}
1841
 
1842
	if (valueMax && valueMax < 0) {
1843
		warnings++;
1844
		html.push("<p>Maximum Bids under 0</p>");
1845
	}
1846
 
1847
	if (valueMin && valueMax) {
1848
		if (Number(valueMin) > Number(valueMax)) {
1849
			warnings++;
1850
			html.push("<p>Minimum Bids greater than Maximum Bids</p>");
1851
		}
1852
	}
1853
 
1854
	valueMin = document.getElementById('minFeedback').value;
1855
	valueMax = document.getElementById('maxFeedback').value;
1856
 
1857
	if (valueMin && valueMin < 0) {
1858
		warnings++;
1859
		html.push("<p>Minimum Feedback under 0</p>");
1860
	}
1861
 
1862
	if (valueMax && valueMax < 0) {
1863
		warnings++;
1864
		html.push("<p>Maximum Feedback under 0</p>");
1865
	}
1866
 
1867
	if (valueMin && valueMax) {
1868
		if (Number(valueMin) > Number(valueMax)) {
1869
			warnings++;
1870
			html.push("<p>Minimum Feedback greater than Maximum Feedback</p>");
1871
		}
1872
	}
1873
 
1874
	valueMin = document.getElementById('minQuantity').value;
1875
	valueMax = document.getElementById('maxQuantity').value;
1876
 
1877
	if (valueMin && valueMin <= 0) {
1878
		warnings++;
1879
		html.push("<p>Minimum Quantity at or under 0</p>");
1880
	}
1881
 
1882
	if (valueMax && valueMax <= 0) {
1883
		warnings++;
1884
		html.push("<p>Maximum Quantity at or under 0</p>");
1885
	}
1886
 
1887
	if (valueMin && valueMax) {
1888
		if (Number(valueMin) > Number(valueMax)) {
1889
			warnings++;
1890
			html.push("<p>Minimum Quantity greater than Maximum Quantity</p>");
1891
		}
1892
	}
1893
 
1894
	if (document.getElementById('ltAll').checked &&
1895
		(document.getElementById('ltAuction').checked ||
1896
			document.getElementById('ltAuctionWithBIN').checked ||
1897
			document.getElementById('ltClassified').checked ||
1898
			document.getElementById('ltFixedPrice').checked ||
1899
			document.getElementById('ltStoreInventory').checked)) {
1900
		warnings++;
1901
		html.push("<p>Listing Type All Combined with other Type(s)</p>");
1902
	}
1903
 
1904
	if (document.getElementById('completedItemsOnly').checked &&
1905
		document.getElementById('searchDescription').checked) {
1906
		warnings++;
1907
		html.push("<p>Completeted Items does work together with Search Description</p>");
1908
	}
1909
 
1910
	valueStartMin = document.getElementById('minStartDate').value;
1911
 
1912
	if (valueStartMin) {
1913
		if (isNaN(valueStartMin)) {
1914
			valueStartMin = moment(valueStartMin).format('YYYY-MM-DD');
1915
			if (!moment(valueStartMin).isValid) {
1916
				warnings++;
1917
				html.push("<p>Invalid Minimum Start Date</p>");
1918
			} else if (moment(valueStartMin).isAfter()) {
1919
				warnings++;
1920
				html.push("<p>Minimum Start Date in future</p>");
1921
			}
1922
		} else {
1923
			var valueStartMinNumber = Number(valueStartMin);
1924
			if (valueStartMinNumber > 0) {
1925
				warnings++;
1926
				html.push("<p>Minimum Start Date in future</p>");
1927
			} else {
1928
				valueStartMin = moment().add(valueStartMinNumber, "days").format('YYYY-MM-DD');
1929
			}
1930
		}
1931
	}
1932
 
1933
	valueStartMax = document.getElementById('maxStartDate').value;
1934
 
1935
	if (valueStartMax) {
1936
		if (isNaN(valueStartMax)) {
1937
			valueStartMax = moment(valueStartMax).format('YYYY-MM-DD');
1938
			if (!moment(valueStartMax).isValid) {
1939
				warnings++;
1940
				html.push("<p>Invalid Maximum Start Date</p>");
1941
			} else if (moment(valueStartMax).isAfter()) {
1942
				warnings++;
1943
				html.push("<p>Maximum Start Date in future</p>");
1944
			}
1945
		} else {
1946
			var valueStartMaxNumber = Number(valueStartMax);
1947
			if (valueStartMaxNumber > 0) {
1948
				warnings++;
1949
				html.push("<p>Maximum Start Date in future</p>");
1950
			} else {
1951
				valueStartMax = moment().add(valueStartMaxNumber, "days").format('YYYY-MM-DD');
1952
			}
1953
		}
1954
	}
1955
 
1956
	valueEndMin = document.getElementById('minEndDate').value;
1957
 
1958
	if (valueEndMin) {
1959
		if (isNaN(valueEndMin)) {
1960
			valueEndMin = moment(valueEndMin).format('YYYY-MM-DD');
1961
			if (!moment(valueEndMin).isValid) {
1962
				warnings++;
1963
				html.push("<p>Invalid Minimum End Date</p>");
1964
			} else if (!document.getElementById('completedItemsOnly').checked && moment(valueEndMin).isBefore()) {
1965
				warnings++;
1966
				html.push("<p>Minimum End Date in past");
1967
			}
1968
		} else {
1969
			var valueEndMinNumber = Number(valueEndMin);
1970
			if (!document.getElementById('completedItemsOnly').checked && valueEndMinNumber < 0) {
1971
				warnings++;
1972
				html.push("<p>Minimum End Date in past</p>");
1973
			} else {
1974
				valueEndMin = moment().add(valueEndMinNumber, "days").format('YYYY-MM-DD');
1975
			}
1976
		}
1977
	}
1978
 
1979
	valueEndMax = document.getElementById('maxEndDate').value;
1980
 
1981
	if (valueEndMax) {
1982
		if (isNaN(valueEndMax)) {
1983
			valueEndMax = moment(valueEndMax).format('YYYY-MM-DD');
1984
			if (!moment(valueEndMax).isValid) {
1985
				warnings++;
1986
				html.push("<p>Invalid Maximum End Date</p>");
1987
			} else if (!document.getElementById('completedItemsOnly').checked && moment(valueEndMax).isBefore()) {
1988
				warnings++;
1989
				html.push("<p>Maximum End Date in past");
1990
			}
1991
		} else {
1992
			var valueEndMaxNumber = Number(valueEndMax);
1993
			if (!document.getElementById('completedItemsOnly').checked && valueEndMaxNumber < 0) {
1994
				warnings++;
1995
				html.push("<p>Maximum End Date in past</p>");
1996
			} else {
1997
				valueEndMax = moment().add(valueEndMaxNumber, "days").format('YYYY-MM-DD');
1998
			}
1999
		}
2000
	}
2001
 
2002
	if (valueStartMin && valueStartMax && valueStartMin > valueStartMax) {
2003
		warnings++;
2004
		html.push("<p>Maximum Start Date less than Minimum Start Date</p>");
2005
	}
2006
 
2007
	if (valueEndMin && valueEndMax && valueEndMin > valueEndMax) {
2008
		warnings++;
2009
		html.push("<p>Maximum End Date less than Minimum End Date</p>");
2010
	}
2011
 
2012
	if (valueStartMin && valueEndMin && valueStartMin > valueEndMin) {
2013
		warnings++;
2014
		html.push("<p>Minimum End Date less than Minimum Start Date</p>");
2015
	}
2016
 
2017
	if (valueStartMin && valueEndMax && valueStartMin > valueEndMax) {
2018
		warnings++;
2019
		html.push("<p>Maximum End Date less than Minimum Start Date</p>");
2020
	}
2021
 
2022
	if (valueStartMax && valueEndMin && valueStartMax > valueEndMin) {
2023
		warnings++;
2024
		html.push("<p>Minimum End Date less than Maximum Start Date</p>");
2025
	}
2026
 
2027
	if (valueStartMax && valueEndMax && valueStartMax > valueEndMax) {
2028
		warnings++;
2029
		html.push("<p>Maximum End Date less than Maximum Start Date</p>");
2030
	}
2031
 
2032
	// Generate ISO dates
2033
	if (valueStartMin) {
2034
		valueStartMin = moment(valueStartMin + " 00:00:00", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2035
	}
2036
 
2037
	if (valueStartMax) {
2038
		if (moment().isBefore(valueStartMax + "T23:59:59.999Z")) {
2039
			valueStartMax = moment().tz("UTC").toISOString();
2040
		} else {
2041
			valueStartMax = moment(valueStartMax + " 23:59:59", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2042
		}
2043
	}
2044
 
2045
	if (document.getElementById('completedItemsOnly').checked) {
2046
		if (valueEndMin) {
2047
			valueEndMin = moment(valueEndMin + " 00:00:00", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2048
		}
2049
 
2050
		if (valueEndMax) {
2051
			if (moment().isBefore(valueEndMax + "T23:59:59.999Z")) {
2052
				valueEndMax = moment().subtract(1, 'minute').tz("UTC").toISOString();
2053
			} else {
2054
				valueEndMax = moment(valueEndMax + " 23:59:59", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2055
			}
2056
		}
2057
	} else {
2058
		if (valueEndMin) {
2059
			if (moment().isAfter(valueEndMin + "T00:00:00.000Z")) {
2060
				var valueEndMinMoment = new moment().add(1, 'minute');
2061
				valueEndMin = valueEndMinMoment.tz("UTC").toISOString();
2062
			} else {
2063
				valueEndMin = moment(valueEndMin + " 00:00:00", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2064
			}
2065
		}
2066
 
2067
		if (valueEndMax) {
2068
			valueEndMax = moment(valueEndMax + " 23:59:59", "YYYY-MM-DD HH:mm:ss").tz("UTC").toISOString();
2069
		}
2070
	}
2071
 
2072
	if (document.getElementById('localSearchOnly').checked) {
2073
		value = document.getElementById('maxDistance').value;
2074
		if (value === undefined || value <= 0) {
2075
			warnings++;
2076
			html.push("<p>Local Search Only requires Maximum Distance</p>");
2077
		}
2078
	}
2079
 
2080
	// Print warnings
2081
	if (warnings) {
2082
		x.innerHTML = html.join("");
2083
		if (x.className.indexOf("w3-show") == -1) {
2084
			x.className += " w3-show";
2085
		}
2086
		x.scrollIntoView();
2087
	} else {
2088
		x.className = x.className.replace(" w3-show", "");
2089
	}
2090
 
2091
	return warnings;
2092
}
2093
 
2094
// Define global variable for the URL filter
2095
var urlfilter = "";
2096
 
2097
// Generates an indexed URL snippet from the array of item filters
2098
function buildURLArray() {
2099
	urlfilter = "";
2100
	// Iterate through each filter in the array
2101
	for (var i = 0; i < filterarray.length; i++) {
2102
		//Index each item filter in filterarray
2103
		var itemfilter = filterarray[i];
2104
		// Iterate through each parameter in each item filter
2105
		for (var index in itemfilter) {
2106
			// Check to see if the paramter has a value (some don't)
2107
			if (itemfilter[index] !== "") {
2108
				if (itemfilter[index] instanceof Array) {
2109
					for (var r = 0; r < itemfilter[index].length; r++) {
2110
						var value = itemfilter[index][r];
2111
						urlfilter += "&itemFilter\(" + i + "\)." + index + "\(" + r + "\)=" + value;
2112
					}
2113
				} else {
2114
					urlfilter += "&itemFilter\(" + i + "\)." + index + "=" + itemfilter[index];
2115
				}
2116
			}
2117
		}
2118
	}
2119
} // End buildURLArray() function
2120
 
2121
var url = "";
2122
var searchUrl = "";
2123
 
2124
function eBaySearch(paramPage) {
2125
	pagenumber = paramPage;
2126
 
2127
	// Clear results outputs and download button
2128
	var x = document.getElementById("results");
2129
	x.innerHTML = "";
2130
	x.className = x.className.replace(" w3-show", "");
2131
	x.scrollIntoView(true);
2132
 
2133
	x = document.getElementById("download");
2134
	x.className = x.className.replace(" w3-show", "");
2135
 
2136
	x = document.getElementById("pricing");
2137
	x.className = x.className.replace(" w3-show", "");
2138
 
2139
	x = document.getElementById("prices");
2140
	x.className = x.className.replace(" w3-show", "");
2141
 
7 - 2142
	x = document.getElementById("duplicates");
2143
	x.className = x.className.replace(" w3-show", "");
2144
    document.getElementById("duplicatesText").innerHTML = "";
2145
 
2 - 2146
	endProgressBar();
2147
 
2148
	x = document.getElementById("recommendation");
2149
	x.innerHTML = "";
2150
 
7 - 2151
	if (document.getElementById("duplicateCheck").checked) {
2152
		findDuplicateListing();
2153
		findPotentialDuplicateListing();
2154
		findShopifyDuplicateListing();
2155
	}
2156
 
2 - 2157
	// Print serialized search parameters
2158
	if (pagenumber == 1) {
2159
		x = document.getElementById("parameter");
2160
		if (x.className.indexOf("w3-show") == -1) {
2161
			x.className += " w3-show";
2162
		}
2163
		searchUrl = window.location.protocol + "//" + window.location.hostname + window.location.pathname + '?' + $("form").serialize();
2164
		x.innerHTML = "<a href=\"" + searchUrl + "\" target=\"_blank\" title=\"eBay Search\">" + searchUrl + "</a>";
2165
	}
2166
 
2167
	// Check Parameters
2168
	if (checkFilterArray()) {
2169
		return false;
2170
	}
2171
 
2172
	// Fill the filter array from form input
2173
	fillFilterArray();
2174
	// Execute the function to build the URL filter
2175
	buildURLArray(filterarray);
2176
 
2177
	var keyword = document.getElementById('keyword').value;
2178
 
2179
	// Construct the request
2180
	url = configeBayFinding + "?";
2181
	if (document.getElementById('completedItemsOnly').checked) {
2182
		url += "OPERATION-NAME=findCompletedItems";
2183
	} else if (keyword.includes("ReferenceID:")) {
2184
		url += "OPERATION-NAME=findItemsByProduct";
2185
	} else {
2186
		url += "OPERATION-NAME=findItemsAdvanced";
2187
	}
2188
    url += "&SERVICE-VERSION=" + configeBayFindingVersion;
2189
	url += "&SECURITY-APPNAME=" + configAppid;
2190
	url += "&GLOBAL-ID=EBAY-US";
2191
	url += "&RESPONSE-DATA-FORMAT=JSON";
2192
	url += "&REST-PAYLOAD";
2193
	if (keyword.length > 0) {
2194
		if (keyword.includes("ReferenceID:")) {
2195
			url += "&productId.@type=ReferenceID";
2196
			url += "&productId=";
2197
			url += keyword.substr(12);
2198
		} else {
2199
			url += "&keywords=";
2200
			url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
2201
		}
2202
	}
2203
 
2204
	var catNo = 0;
2205
	for (var index = 1; index < document.getElementById('category').options.length; index++) {
2206
		if (document.getElementById('category').options[index].selected) {
2207
			url += "&categoryId(" + catNo + ")=";
2208
			url += document.getElementById('category').options[index].value;
2209
			++catNo;
2210
		}
2211
	}
2212
 
7 - 2213
	url += "&paginationInput.entriesPerPage=100";
2 - 2214
	url += "&paginationInput.pageNumber=";
2215
	if (pagenumber === undefined) {
2216
		pagenumber = 1;
2217
	}
2218
	url += pagenumber;
2219
	url += "&sortOrder=";
2220
	url += getSortOrder();
2221
	url += "&buyerPostalCode=";
2222
	url += configZip;
2223
	url += "&outputSelector=SellerInfo";
2224
	if (document.getElementById('searchDescription').checked) {
2225
		url += "&descriptionSearch=true";
2226
	}
2227
	url += urlfilter;
2228
 
2229
	var xhttp = new XMLHttpRequest();
2230
 
2231
	xhttp.onreadystatechange = function() {
2232
    	if (this.readyState == 4) {
2233
			if (document.getElementById('completedItemsOnly').checked) {
2234
				_cb_findCompletedItems(JSON.parse(this.responseText));
2235
			} else {
2236
				_cb_findItemsAdvanced(JSON.parse(this.responseText));
2237
			}
2238
        }
2239
    };
2240
 
2241
	xhttp.open("GET", configProxyUrl, true);
2242
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2243
   	xhttp.send();
2244
 
2245
	return false;
2246
}
2247
 
2248
function getKeywordRecommendations() {
2249
	if (!document.getElementById("keyword").value) {
2250
		return false;
2251
	}
2252
 
2253
	// Clear results outputs and download button
2254
	var x = document.getElementById("results");
2255
	x.innerHTML = "";
2256
	x.className = x.className.replace(" w3-show", "");
2257
 
2258
	x = document.getElementById("download");
2259
	x.className = x.className.replace(" w3-show", "");
2260
 
2261
	x = document.getElementById("pricing");
2262
	x.className = x.className.replace(" w3-show", "");
2263
 
2264
	x = document.getElementById("prices");
2265
	x.className = x.className.replace(" w3-show", "");
2266
 
2267
	endProgressBar();
2268
 
2269
	// Construct the request
2270
	url = configeBayFinding + "?";
2271
	url += "OPERATION-NAME=getSearchKeywordsRecommendation";
2272
	url += "&SERVICE-VERSION=" + configeBayFindingVersion;
2273
	url += "&SECURITY-APPNAME=" + configAppid;
2274
	url += "&RESPONSE-DATA-FORMAT=JSON";
2275
	url += "&REST-PAYLOAD";
2276
	url += "&keywords=";
2277
	url += encodeURIComponent(document.getElementById('keyword').value.trim().replace(/ /g, "+"));
2278
 
2279
	// Submit the request
2280
	var xhttp = new XMLHttpRequest();
2281
 
2282
	xhttp.onreadystatechange = function() {
2283
    	if (this.readyState == 4) {
2284
    		_cb_getKeywordRecommendations(JSON.parse(this.responseText));
2285
        }
2286
    };
2287
 
2288
	xhttp.open("GET", configProxyUrl, true);
2289
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2290
   	xhttp.send();
2291
 
2292
	return false;
2293
}
2294
 
2295
function formatTimeleft(timeleft) {
2296
	var timeleftDays = Math.floor(timeleft / 86400);
2297
	timeleft = timeleft % 86400;
2298
	var timeleftHours = Math.floor(timeleft / 3600);
2299
	timeleft = timeleft % 3600;
2300
	var timeleftMinutes = Math.floor(timeleft / 60);
2301
	return timeleftDays + ' days ' + timeleftHours + ' hours ' + timeleftMinutes + ' minutes';
2302
}
2303
 
2304
function getSortOrder() {
2305
	if (document.getElementById("soBestMatch").checked) {
2306
		return "BestMatch";
2307
	} else if (document.getElementById("soCurrentPriceHighest").checked) {
2308
		return "CurrentPriceHighest";
2309
	} else if (document.getElementById("soEndTimeSoonest").checked) {
2310
		return "EndTimeSoonest";
2311
	} else if (document.getElementById("soPricePlusShippingHighest").checked) {
2312
		return "PricePlusShippingHighest";
2313
	} else if (document.getElementById("soPricePlusShippingLowest").checked) {
2314
		return "PricePlusShippingLowest";
2315
	} else if (document.getElementById("soStartTimeNewest").checked) {
2316
		return "StartTimeNewest";
2317
	} else if (document.getElementById("soWatchCountDecreaseSort").checked) {
2318
		return "WatchCountDecreaseSort";
2319
	} else if (document.getElementById("soDistance").checked) {
2320
		return "DistanceNearest";
2321
	}
2322
	// Auctions Only!
2323
	else if (document.getElementById("soBidCountFewest").checked) {
2324
		return "BidCountFewest";
2325
	}
2326
	// Auctions Only!
2327
	else if (document.getElementById("soBidCountMost").checked) {
2328
		return "BidCountMost";
2329
	}
2330
 
2331
	return "BestMatch";
2332
}
2333
 
2334
function downloadAsCSV() {
2335
	var categoryIndex = 0;
2336
	asyncFlag = false;
2337
 
2338
	initProgressBar('Creating CSV Download File');
2339
 
2340
	var x = document.getElementById("csv");
2341
	x.innerHTML = ConvertToCSVHeader();
2342
 
2343
	maxPages = (totalEntries / 100) > 100 ? 100 : Math.trunc(totalEntries / 100.0) + 1;
2344
	currentPage = 0;
2345
 
2346
	var keyword = document.getElementById('keyword').value;
2347
 
2348
	for (var index = 0; index < maxPages; ++index) {
2349
		// Construct the request
2350
		var url = configeBayFinding + "?";
2351
		if (document.getElementById('completedItemsOnly').checked) {
2352
			url += "OPERATION-NAME=findCompletedItems";
2353
		} else if (keyword.includes("ReferenceID:")) {
2354
			url += "OPERATION-NAME=findItemsByProduct";
2355
		} else {
2356
			url += "OPERATION-NAME=findItemsAdvanced";
2357
		}
2358
		url += "&SECURITY-APPNAME=" + configAppid;
2359
		url += "&GLOBAL-ID=EBAY-US";
2360
		url += "&RESPONSE-DATA-FORMAT=JSON";
2361
		url += "&SERVICE-VERSION=" + configeBayFindingVersion;
2362
		url += "&REST-PAYLOAD";
2363
		if (keyword.length > 0) {
2364
			if (keyword.includes("ReferenceID:")) {
2365
				url += "&productId.@type=ReferenceID";
2366
				url += "&productId=";
2367
				url += keyword.substr(12);
2368
			} else {
2369
				url += "&keywords=";
2370
				url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
2371
			}
2372
		}
2373
 
2374
		var catNo = 0;
2375
		for (categoryIndex = 1; categoryIndex < document.getElementById('category').options.length; categoryIndex++) {
2376
			if (document.getElementById('category').options[categoryIndex].selected) {
2377
				url += "&categoryId(" + catNo + ")=";
2378
				url += document.getElementById('category').options[categoryIndex].value;
2379
				++catNo;
2380
			}
2381
		}
2382
 
2383
		url += "&paginationInput.entriesPerPage=100";
2384
		url += "&paginationInput.pageNumber=";
2385
		url += (index + 1);
2386
		url += "&sortOrder=";
2387
		url += getSortOrder();
2388
		url += "&buyerPostalCode=";
2389
		url += configZip;
2390
		url += "&outputSelector(0)=SellerInfo&outputSelector(1)=StoreInfo";
2391
		if (document.getElementById('searchDescription').checked) {
2392
			url += "&descriptionSearch=true";
2393
		}
2394
 
2395
		url += urlfilter;
2396
 
2397
		var xhttp = new XMLHttpRequest();
2398
 
2399
		xhttp.onreadystatechange = function() {
2400
	    	if (this.readyState == 4) {
2401
				if (document.getElementById('completedItemsOnly').checked) {
2402
					_cb_ConvertToCSVfindCompletedItems(JSON.parse(this.responseText));
2403
				} else {
2404
					_cb_ConvertToCSVfindItemsAdvanced(JSON.parse(this.responseText));
2405
				}
2406
	        }
2407
	    };
2408
 
2409
		xhttp.open("GET", configProxyUrl, true);
2410
		xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2411
	   	xhttp.send();
2412
   	}
2413
 
2414
	function checkAsyncFlag() {
2415
		if (asyncFlag === false) {
2416
			window.setTimeout(checkAsyncFlag, 100); // wait 100 milliseconds
2417
		} else {
2418
			var textToSaveAsBlob = new Blob([String(document.getElementById("csv").innerHTML)], {
2419
				type: "text/csv"
2420
			});
2421
			var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
2422
			var fileNameToSaveAs = "eBaySearch.csv";
2423
 
2424
			var downloadLink = document.createElement("a");
2425
			downloadLink.download = fileNameToSaveAs;
2426
			downloadLink.innerHTML = "Download File";
2427
			downloadLink.href = textToSaveAsURL;
2428
			downloadLink.onclick = destroyClickedElement;
2429
			downloadLink.style.display = "none";
2430
			document.body.appendChild(downloadLink);
2431
 
2432
			endProgressBar();
2433
			downloadLink.click();
2434
		}
2435
	}
2436
 
2437
	checkAsyncFlag();
2438
}
2439
 
2440
function destroyClickedElement(event) {
2441
	document.body.removeChild(event.target);
2442
}
2443
 
2444
function _cb_ConvertToCSVfindItemsAdvanced(objArray) {
2445
	var array;
2446
 
2447
	if (objArray.findItemsAdvancedResponse !== undefined) {
2448
		array = typeof objArray.findItemsAdvancedResponse[0] != 'object' ? JSON.parse(objArray.findItemsAdvancedResponse[0]) : objArray.findItemsAdvancedResponse[0].searchResult[0].item;
2449
	} else if (objArray.findItemsByProductResponse !== undefined) {
2450
		array = typeof objArray.findItemsByProductResponse[0] != 'object' ? JSON.parse(objArray.findItemsByProductResponse[0]) : objArray.findItemsByProductResponse[0].searchResult[0].item;
2451
	} else {
2452
		return;
2453
	}
2454
 
2455
	ConvertToCSV(array);
2456
}
2457
 
2458
function _cb_ConvertToCSVfindCompletedItems(objArray) {
2459
	var array = typeof objArray.findCompletedItemsResponse[0] != 'object' ? JSON.parse(objArray.findCompletedItemsResponse[0]) : objArray.findCompletedItemsResponse[0].searchResult[0].item;
2460
	ConvertToCSV(array);
2461
}
2462
 
2463
function findSingleItem(itemId) {
2464
	// Construct the getShippingCosts request
2465
	getShippingCostsDone = false;
2466
 
2467
	url = configeBayShopping + "?";
2468
	url += "callname=GetShippingCosts";
2469
	url += "&responseencoding=JSON";
2470
	url += "&appid=" + configAppid;
2471
	url += "&version=" + configeBayShoppingVersion;
2472
	url += "&DestinationCountryCode=US";
2473
	url += "&DestinationPostalCode=";
2474
	url += configZip;
2475
	url += "&IncludeDetails=true";
2476
	url += "&QuantitySold=1";
2477
	url += "&ItemID=";
2478
	url += itemId;
2479
 
2480
	var xhttp = new XMLHttpRequest();
2481
 
2482
	xhttp.onreadystatechange = function() {
2483
    	if (this.readyState == 4) {
2484
    		_cb_GetShippingCosts(JSON.parse(this.responseText));
2485
        }
2486
    };
2487
 
2488
	xhttp.open("GET", configProxyUrl, true);
2489
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2490
   	xhttp.send();
2491
 
2492
	function checkAsyncFlag() {
2493
		if (getShippingCostsDone !== true) {
2494
			window.setTimeout(function() {
2495
				checkAsyncFlag();
2496
			}, 100); // wait 100 milliseconds
2497
		} else {
2498
			// Construct the getSingleItem request
2499
			url = configeBayShopping + "?";
2500
			url += "callname=GetSingleItem";
2501
			url += "&responseencoding=JSON";
2502
			url += "&appid=" + configAppid;
2503
			url += "&version=" + configeBayShoppingVersion;
2504
			url += "&IncludeSelector=Details,Description,ItemSpecifics";
2505
			url += "&ItemID=";
2506
			url += itemId;
2507
 
2508
			var xhttp = new XMLHttpRequest();
2509
 
2510
			xhttp.onreadystatechange = function() {
2511
		    	if (this.readyState == 4) {
2512
		    		_cb_GetSingleItem(JSON.parse(this.responseText));
2513
		        }
2514
		    };
2515
 
2516
			xhttp.open("GET", configProxyUrl, true);
2517
			xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2518
		   	xhttp.send();
2519
		}
2520
	}
2521
 
2522
	checkAsyncFlag();
2523
}
2524
 
2525
// Create new page for single item
2526
function _cb_GetSingleItem(root) {
2527
	var ack = root.Ack;
2528
	if (ack != 'Success') {
2529
		var x = document.getElementById("warnings");
2530
		x.innerHTML = "<h2>eBay API Error<h2>";
2531
		x.innerHTML += "<p>Id: " + root.Errors[0].ErrorCode + "<br/>";
2532
		x.innerHTML += "<p>Domain: " + root.Errors[0].ErrorClassification + "<br/>";
2533
		x.innerHTML += "<p>Severity: " + root.Errors[0].SeverityCode + "<br/>";
2534
		x.innerHTML += "<p>Category: " + root.Errors[0].category + "<br/>";
2535
		x.innerHTML += "<p>Short Message: " + root.Errors[0].ShortMessage + "<br/>";
2536
		x.innerHTML += "<p>Long Message: " + root.Errors[0].LongMessage + "<br/>";
2537
		x.innerHTML += "<p>Build/Version: " + root.Build + '/' + root.Version + "</p>";
2538
		x.innerHTML += "<p>URL: " + "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>" + "</p>";
2539
 
2540
		if (x.className.indexOf("w3-show") == -1) {
2541
			x.className += " w3-show";
2542
		}
2543
 
2544
		if (ack == 'Failure' || ack == 'PartialFailure') {
2545
			x.scrollIntoView(true);
2546
			return;
2547
		}
2548
	}
2549
 
2550
	var str = "";
2551
	var i = 0;
2552
	var JsonObj = typeof root.Item != 'object' ? JSON.parse(root.Item) : root.Item;
2553
 
2554
	var autoPay = JsonObj.autoPay;
2555
	var BestOfferEnabled = JsonObj.BestOfferEnabled;
2556
	var BidCount = JsonObj.BidCount;
2557
	var BusinessSellerDetails = JsonObj.BusinessSellerDetails;
2558
	if (BusinessSellerDetails) { // not yet
2559
	}
2560
	var BuyItNowAvailable = JsonObj.BuyItNowAvailable;
2561
	var BuyItNowPrice = JsonObj.BuyItNowPrice;
2562
	var BuyItNowPriceValue = BuyItNowPrice === undefined ? 0.00 : BuyItNowPrice.Value;
2563
	var BuyItNowPriceCurrencyID = BuyItNowPrice === undefined ? "" : BuyItNowPrice.CurrencyID;
2564
	var Charity = JsonObj.Charity;
2565
	if (Charity) { // not yet
2566
	}
2567
	var ConditionDescription = JsonObj.ConditionDescription;
2568
	var ConditionDisplayName = JsonObj.ConditionDisplayName;
2569
	var ConditionID = JsonObj.ConditionID;
2570
	var ConvertedBuyItNowPrice = JsonObj.ConvertedBuyItNowPrice;
2571
	var ConvertedBuyItNowPriceValue = ConvertedBuyItNowPrice === undefined ? 0.00 : ConvertedBuyItNowPrice.Value;
2572
	var ConvertedBuyItNowPriceCurrencyID = ConvertedBuyItNowPrice === undefined ? "" : ConvertedBuyItNowPrice.CurrencyID;
2573
	var ConvertedCurrentPrice = JsonObj.ConvertedCurrentPrice;
2574
	var ConvertedCurrentPriceValue = ConvertedCurrentPrice === undefined ? 0.00 : ConvertedCurrentPrice.Value;
2575
	var ConvertedCurrentPriceCurrencyID = ConvertedCurrentPrice === undefined ? "" : ConvertedCurrentPrice.CurrencyID;
2576
	var Country = JsonObj.Country;
2577
	var CurrentPrice = JsonObj.CurrentPrice;
2578
	var CurrentPriceValue = CurrentPrice === undefined ? 0.00 : CurrentPrice.Value;
2579
	var CurrentPriceCurrencyID = CurrentPrice === undefined ? "" : CurrentPrice.CurrencyID;
2580
	var Description = JsonObj.Description;
2581
	var DiscountPriceInfo = JsonObj.DiscountPriceInfo;
2582
	if (DiscountPriceInfo) { // not yet
2583
	}
2584
	var EndTime = JsonObj.EndTime;
2585
	var GalleryURL = JsonObj.GalleryURL;
2586
	var HandlingTime = JsonObj.HandlingTime;
2587
	var HighBidder = JsonObj.HighBidder;
2588
	var HighBidderFeedbackPrivate = HighBidder === undefined ? "" : HighBidder.FeedbackPrivate;
2589
	var HighBidderFeedbackScore = HighBidder === undefined ? "" : HighBidder.FeedbackScore;
2590
	var HighBidderUserAnonymized = HighBidder === undefined ? "" : HighBidder.UserAnonymized;
2591
	var HighBidderUserID = HighBidder === undefined ? "" : HighBidder.UserID;
2592
	var HitCount = JsonObj.HitCount;
2593
	var IgnoreQuantity = JsonObj.IgnoreQuantity;
2594
	var IntegratedMerchantCreditCardEnabled = JsonObj.IntegratedMerchantCreditCardEnabled;
2595
	var ItemID = JsonObj.ItemID;
2596
	var ItemSpecifics = JsonObj.ItemSpecifics;
2597
	var ListingStatus = JsonObj.ListingStatus;
2598
	var ListingType = JsonObj.ListingType;
2599
	var Location = JsonObj.Location;
2600
	var LotSize = JsonObj.LotSize;
2601
	var MinimumToBid = JsonObj.MinimumToBid;
2602
	var MinimumToBidCurrencyID = MinimumToBid === undefined ? "" : MinimumToBid.CurrencyID;
2603
	var MinimumToBidValue = MinimumToBid === undefined ? 0.00 : MinimumToBid.Value;
2604
	var PaymentAllowedSite = JsonObj.PaymentAllowedSite;
2605
	if (PaymentAllowedSite) { // not yet
2606
	}
2607
	var PaymentMethods = JsonObj.PaymentMethods;
2608
	var PictureURL = JsonObj.PictureURL;
2609
	var PostalCode = JsonObj.PostalCode;
2610
	var PrimaryCategoryID = JsonObj.PrimaryCategoryID;
2611
	var PrimaryCategoryIDPath = JsonObj.PrimaryCategoryIDPath;
2612
	var PrimaryCategoryName = JsonObj.PrimaryCategoryName;
2613
	var ProductIDValue = JsonObj.ProductID ? JsonObj.ProductID.Value : undefined;
2614
	var ProductIDType = JsonObj.ProductID ? JsonObj.ProductID.Type : undefined;
2615
	var Quantity = JsonObj.Quantity;
2616
	var QuantitySold = JsonObj.QuantitySold;
2617
	var QuantitySoldByPickupInStore = JsonObj.QuantitySoldByPickupInStore;
2618
	var ReserveMet = JsonObj.ReserveMet;
2619
	var ReturnPolicy = JsonObj.ReturnPolicy;
2620
	var ReturnPolicyRefund = ReturnPolicy === undefined ? "" : ReturnPolicy.Refund;
2621
	var ReturnPolicyReturnsWithin = ReturnPolicy === undefined ? "" : ReturnPolicy.ReturnsWithin;
2622
	var ReturnPolicyReturnsAccepted = ReturnPolicy === undefined ? "" : ReturnPolicy.ReturnsAccepted;
2623
	var ReturnPolicyDescription = ReturnPolicy === undefined ? "" : ReturnPolicy.Description;
2624
	var ReturnPolicyShippingCostPaidBy = ReturnPolicy === undefined ? "" : ReturnPolicy.ShippingCostPaidBy;
2625
	var ReturnPolicyRestockingFeeValue = ReturnPolicy === undefined ? "" : ReturnPolicy.RestockingFeeValue;
2626
	var ReturnPolicyRestockingFeeValueOption = ReturnPolicy === undefined ? "" : ReturnPolicy.RestockingFeeValueOption;
2627
	var ReturnPolicyWarrantyDuration = ReturnPolicy === undefined ? "" : ReturnPolicy.WarrantyDuration;
2628
	var ReturnPolicyWarrantyOffered = ReturnPolicy === undefined ? "" : ReturnPolicy.WarrantyOffered;
2629
	var ReturnPolicyWarrantyType = ReturnPolicy === undefined ? "" : ReturnPolicy.WarrantyType;
2630
	var SecondaryCategoryID = JsonObj.SecondaryCategoryID;
2631
	var SecondaryCategoryIDPath = JsonObj.SecondaryCategoryIDPath;
2632
	var SecondaryCategoryName = JsonObj.SecondaryCategoryName;
2633
	var Seller = JsonObj.Seller;
2634
	var SellerFeedbackScore = Seller === undefined ? 0 : Seller.FeedbackScore;
2635
	var SellerPositiveFeedbackPercent = Seller === undefined ? 0.00 : Seller.PositiveFeedbackPercent;
2636
	var SellerTopRatedSeller = Seller === undefined ? "" : Seller.TopRatedSeller;
2637
	var SellerUserID = Seller === undefined ? "" : Seller.UserID;
2638
	var Site = JsonObj.Site;
2639
	var SKU = JsonObj.SKU;
2640
	var StartTime = JsonObj.StartTime;
2641
	var Storefront = JsonObj.Storefront;
2642
	var StorefrontStoreName = Storefront === undefined ? "" : Storefront.StoreName;
2643
	var StorefrontStoreURL = Storefront === undefined ? "" : Storefront.StoreURL;
2644
	var Subtitle = JsonObj.Subtitle;
2645
	var TimeLeft = JsonObj.TimeLeft;
2646
	var Title = JsonObj.Title;
2647
	var TopRatedListing = JsonObj.TopRatedListing;
2648
	var UnitInfo = JsonObj.UnitInfo;
2649
	var UnitInfoUnitQuantity = UnitInfo === undefined ? 0 : UnitInfo.UnitQuantity;
2650
	var UnitInfoUnitType = UnitInfo === undefined ? 0 : UnitInfo.UnitType;
2651
	var ViewItemURLForNaturalSearch = JsonObj.ViewItemURLForNaturalSearch; // contains UPC
2652
 
2653
	str = '<!DOCTYPE html>';
2654
	str += '<html lang="en">';
2655
	str += '<head>';
2656
	str += '<title>' + ItemID + ' - ' + Title + '</title>';
2657
	str += '<meta charset="UTF-8">';
2658
	str += '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
2659
	str += '<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">';
2660
	str += '<link rel="icon" href="favicon.ico" type="image/x-icon">';
2661
	str += '<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">';
2662
	str += '<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">';
2663
	str += '<link rel="stylesheet" href="css/style.css">';
2664
	str += '<style>.w3-table td,.w3-table th{padding: 0 10px 0 10px;display:table-cell;text-align:left;vertical-align:top}</style>';
2665
	str += '<script src="js/jquery.js"><\/script>';
2666
	str += '<script src="js/muna-tools.js"><\/script>';
2667
	str += '<script src="js/ebayProduct.js"><\/script>';
2668
	str += '</head>';
2669
	str += '<body>';
2670
	str += '<div class="w3-main">';
2671
	str += '<div class="w3-container w3-padding w3-margin w3-card-4">';
2672
	str += '<img class="w3-image w3-right" src="images/MUNA%20-%20Logo%20100x100.png" alt="MUNA Trading Logo" style="height:100px">';
2673
	str += '<p class="w3-xlarge">' + Title + ' (EBAY-' + Site + '<a href="' + ViewItemURLForNaturalSearch + '" target="_blank">' + ' #' + ItemID + '</a>' + ')</p>';
2674
 
2675
	if (Subtitle) {
2676
		str += '<p class="w3-large">' + Subtitle + '</p>';
2677
	}
2678
	if (PrimaryCategoryID) {
2679
		str += '<p>' + PrimaryCategoryName + ' (' + PrimaryCategoryIDPath + ')</p>';
2680
	}
2681
	if (SecondaryCategoryID) {
2682
		str += '<p>' + SecondaryCategoryName + ' (' + SecondaryCategoryIDPath + ')</p>';
2683
	}
2684
	str += '</div>';
2685
 
2686
	str += '<div class="w3-container w3-padding w3-margin w3-card-4">';
2687
	str += '<div class="w3-cell-row">';
2688
	str += '<div class="w3-container w3-card-2 w3-cell w3-padding w3-third">';
2689
	if (GalleryURL) {
2690
		str += '<img class="w3-image w3-right w3-margin" src="' + GalleryURL + '" alt="Gallery Image" style="max-height:100px;max-width:100px;">';
2691
	} else if (PictureURL) {
2692
		str += '<img class="w3-image w3-right w3-margin" src="' + PictureURL[0].replace('http:', 'https:') + '" alt="Gallery Image" style="max-height:100px;max-width:100px;">';
2693
	}
2694
	str += '<h2>Item</h2>';
2695
	str += '<table class="w3-table w3-bordered">';
2696
 
2697
	if (ConditionID) {
2698
		str += '<tr><td>' + ConditionDisplayName + ' (' + ConditionID + ')</td><td></td></tr>';
2699
	}
2700
	str += '<tr><td>Condition</td><td>' + (ConditionDescription ? ConditionDescription : 'None entered') + '</td></tr>';
2701
 
2702
	if (ProductIDValue) {
2703
		str += '<tr><td>ProductID</td><td><a href="javascript:void(0)" onclick="findProductInfo(' + ProductIDValue + ')">' + ProductIDValue + ' (' + ProductIDType + ')</a></td></tr>';
2704
	}
2705
 
2706
	if (SKU) {
2707
		str += '<tr><td>SKU</td><td>' + SKU + '</td></tr>';
2708
	}
2709
 
2710
	if (ItemSpecifics) {
2711
		for (i = 0; i < ItemSpecifics.NameValueList.length; i++) {
2712
			str += '<tr><td>' + ItemSpecifics.NameValueList[i].Name + '</td><td>' + ItemSpecifics.NameValueList[i].Value + '</td></tr>';
2713
		}
2714
	}
2715
 
2716
	str += '</table>';
2717
 
2718
	if (Seller) {
2719
		str += '<h2>Seller</h2>';
2720
		str += '<table class="w3-table w3-bordered">';
2721
		str += '<tr><td>' + SellerUserID + feebackStarImage(SellerFeedbackScore);
2722
		str += ' (' + SellerFeedbackScore + ' / ' + SellerPositiveFeedbackPercent + '%)</td><td></td></tr>';
2723
		if (SellerTopRatedSeller) {
2724
			str += '<tr><td>Top Rated Seller</td><td></td></tr>';
2725
		}
2726
		str += '<tr><td>' + Location + ' ' + (PostalCode ? PostalCode + ' ' : '') + Country + '</td><td></td></tr>';
2727
		if (Storefront) {
2728
			str += '<tr><td>Store: <a href="' + StorefrontStoreURL + '" target="_blank">' + StorefrontStoreName + '</a></td><td></td></tr>';
2729
		}
2730
		str += '</table>';
2731
 
2732
		str += '<div id="map" style="width:100%;height:300px;"></div>';
2733
		str += '<script>';
2734
		str += '  function initMap() {';
2735
		str += '    var address = \'' + Location + ' ' + (PostalCode ? PostalCode + ' ' : '') + Country + '\';';
2736
		str += '	var geocoder = new google.maps.Geocoder;';
2737
		str += '    geocoder.geocode({"address": address}, function(results, status) {';
2738
		str += '    if (status === "OK") {';
2739
		str += '        if (results[0]) {';
2740
		str += '			var infowindow = new google.maps.InfoWindow;';
2741
		str += '	        var map = new google.maps.Map(document.getElementById("map"), {';
2742
		str += '	          zoom: 10,';
2743
		str += '	          center: {lat: 40.72, lng: -73.96}';
2744
		str += '	        });';
2745
		str += '            map.setCenter(results[0].geometry.location);';
2746
		str += '            var marker = new google.maps.Marker({';
2747
		str += '              map: map,';
2748
		str += '              position: results[0].geometry.location';
2749
		str += '            });';
2750
		str += '            infowindow.setContent(results[0].formatted_address);';
2751
		str += '            infowindow.open(map, marker);';
2752
		str += '        } else {';
2753
		str += '            document.getElementById("map").style.display = "none";';
2754
		str += '        }';
2755
		str += '    } else {';
2756
		str += '        document.getElementById("map").style.display = "none";';
2757
		str += '    }';
2758
		str += '  });';
2759
		str += '  }';
2760
		str += '<\/script>';
2761
	}
2762
 
2763
	str += '</div>';
2764
 
2765
	str += '<div class="w3-container w3-card-2 w3-cell w3-padding w3-third">';
2766
	str += '<h2>Payment</h2>';
2767
	str += '<table class="w3-table w3-bordered">';
2768
	if (autoPay && autoPay == 'true' && BidCount && BidCount === 0) {
2769
		str += '<tr><td>Requires Immediate Payment</td><td></td></tr>';
2770
	}
2771
	if (IntegratedMerchantCreditCardEnabled && IntegratedMerchantCreditCardEnabled == 'true') {
2772
		str += '<tr><td>Merchant Credit Cards enabled</td><td></td></tr>';
2773
	}
2774
 
2775
	str += '<tr><td>Payment Methods</td><td>';
2776
	var paymentsArray = String(PaymentMethods).split(',');
2777
	for (i = 0; i < PaymentMethods.length; i++) {
2778
		str += (i > 0 ? ', ' : '') + paymentsArray[i];
2779
	}
2780
	str += '</td></tr>';
2781
 
2782
	str += '</table>';
2783
 
2784
	if (HandlingTime !== undefined) {
2785
		str += '<h2>Shipping/Handling:</h2>';
2786
		str += '<table class="w3-table w3-bordered" style="width:100%;">';
2787
		str += '<colgroup><col span="1" style="width:35%;"><col span="1" style="width:65%;"></colgroup>';
2788
		str += '<tr><td>Handling Time</td><td>' + HandlingTime + ' ' + (HandlingTime == 1 ? 'day' : 'days') + '</td></tr>';
2789
		str += ship_str;
2790
		str += '</table>';
2791
	}
2792
 
2793
	if (ReturnPolicy) {
2794
		str += '<h2>Return Policy</h2><p>';
2795
		str += '<table class="w3-table w3-bordered">';
2796
		str += '<tr><td>' + (ReturnPolicyReturnsAccepted ? 'Return Accepted' : 'No Return') + '</td><td></td></tr>';
2797
		str += ReturnPolicyDescription ? '<tr><td>Return Policy Description</td><td>' + ReturnPolicyDescription + '</td></tr>' : '';
2798
		str += ReturnPolicyReturnsWithin ? '<tr><td>Returns Within</td><td>' + ReturnPolicyReturnsWithin + '</td></tr>' : '';
2799
		str += ReturnPolicyRefund ? '<tr><td>Refund</td><td>' + ReturnPolicyRefund + '</td></tr>' : '';
2800
		str += ReturnPolicyShippingCostPaidBy ? '<tr><td>Shipping Cost Paid By</td><td>' + ReturnPolicyShippingCostPaidBy + '</td></tr>' : '';
2801
		str += ReturnPolicyRestockingFeeValueOption ? '<tr><td>Restocking Fee Value Option</td><td>' + ReturnPolicyRestockingFeeValueOption + '</td></tr>' : '';
2802
		str += ReturnPolicyRestockingFeeValue ? '<tr><td>Restocking Fee Value</td><td>' + ReturnPolicyRestockingFeeValue + '</td></tr>' : '';
2803
		str += ReturnPolicyWarrantyOffered ? '<tr><td>Warranty Offered</td><td>' + ReturnPolicyWarrantyOffered + '</td></tr>' : '<tr><td>No Warranty</td><td></td></tr>';
2804
		str += ReturnPolicyWarrantyType ? '<tr><td>Warranty Type</td><td>' + ReturnPolicyWarrantyType + '</td></tr>' : '';
2805
		str += ReturnPolicyWarrantyDuration ? '<tr><td>Warranty Duration</td><td>' + ReturnPolicyWarrantyType + '</td></tr>' : '';
2806
	}
2807
	str += '</table>';
2808
	str += '</div>';
2809
 
2810
	str += '<div class="w3-container w3-card-2 w3-cell w3-padding w3-third">';
2811
	str += '<h2>Listing</h2>';
2812
	str += '<table class="w3-table w3-bordered">';
2813
	str += '<tr><td>Status</td><td>' + ListingStatus + '</td></tr>';
2814
	if (TopRatedListing === true) {
2815
		str += '<tr><td>Top Rated Listing</td><td></td></tr>';
2816
	}
2817
	str += '<tr><td>Listing Type</td><td>' + ListingType + '</td></tr>';
2818
	str += '<tr><td>Current Price</td><td>' + (CurrentPriceCurrencyID == 'USD' ? '$' : CurrentPriceCurrencyID + ' ') + CurrentPriceValue.toFixed(2) + '</td></tr>';
2819
	if (CurrentPriceCurrencyID != ConvertedCurrentPriceCurrencyID || CurrentPriceValue != ConvertedCurrentPriceValue) {
2820
		str += '<tr><td>Converted Current Price</td><td>' + (ConvertedCurrentPriceCurrencyID = 'USD' ? '$' : ConvertedCurrentPriceCurrencyID + ' ') + ConvertedCurrentPriceValue.toFixed(2) + '</td></tr>';
2821
	}
2822
	str += ship_str_cost;
2823
	str += ship_str_tax;
2824
	if (BuyItNowAvailable === true) {
2825
		str += '<tr><td>Buy It Now Price</td><td>' + (BuyItNowPriceCurrencyID == 'USD' ? '$' : BuyItNowPriceCurrencyID + ' ') + BuyItNowPriceValue.toFixed(2) + '</td></tr>';
2826
		if (BuyItNowPriceCurrencyID != ConvertedBuyItNowPriceCurrencyID || BuyItNowPriceValue != ConvertedBuyItNowPriceValue) {
2827
			str += '<tr><td>Converted Buy It Now Price</td><td>' + (ConvertedBuyItNowPriceCurrencyID = 'USD' ? '$' : ConvertedBuyItNowPriceCurrencyID + ' ') + ConvertedBuyItNowPriceValue.toFixed(2) + '</td></tr>';
2828
		}
2829
	}
2830
	if (LotSize) {
2831
		str += '<tr><td>LotSize</td><td>' + LotSize + '</td></tr>';
2832
	}
2833
 
2834
	if (IgnoreQuantity === undefined) {
2835
		str += '<tr><td>Quantity</td><td>' + Quantity + '</td></tr>';
2836
		str += '<tr><td>Quantity Sold</td><td>' + QuantitySold + '</td></tr>';
2837
		str += '<tr><td>Quantity Sold Store Pickup</td><td>' + QuantitySoldByPickupInStore + '</td></tr>';
2838
	}
2839
 
2840
	if (UnitInfo) {
2841
		str += '<tr><td>Unit Info: ' + UnitInfoUnitQuantity + ' ' + UnitInfoUnitType + '</td></tr>';
2842
	}
2843
 
2844
	str += '<tr><td>Start</td><td>' + moment(StartTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA") + '</td></tr>';
2845
	str += '<tr><td>End</td><td>' + moment(EndTime, moment.ISO_8601).format("YYYY-MM-DD hh:MMA") + '</td></tr>';
2846
	str += '<tr><td>Time Left</td><td>' + formatTimeleft(moment.duration(TimeLeft).asSeconds()) + '</td></tr>';
2847
	if (BestOfferEnabled === true) {
2848
		str += '<tr><td>Best Offer Enabled</td><td></td></tr>';
2849
	}
2850
 
2851
	if (ReserveMet === false) {
2852
		str += '<tr><td>Reserve not met</td><td></td></tr>';
2853
	}
2854
	if (HitCount) {
2855
		str += '<tr><td>Views</td><td>' + HitCount + '</td></tr>';
2856
	}
2857
	if (BidCount) {
2858
		str += '<tr><td>Bids</td><td>' + BidCount + '</td></tr>';
2859
	}
2860
	if (MinimumToBid) {
2861
		str += '<tr><td>Minimum to Bid</td><td>' + (MinimumToBidCurrencyID == 'USD' ? '$' : MinimumToBidCurrencyID + ' ') + MinimumToBidValue.toFixed(2) + '</td></tr>';
2862
	}
2863
	if (HighBidder) {
2864
		str += '<tr><td>High Bidder</td><td>' + HighBidderUserID;
2865
		if (HighBidderFeedbackPrivate === false) {
2866
			str += feebackStarImage(HighBidderFeedbackScore) + ' (' + HighBidderFeedbackScore + ')';
2867
		}
2868
		str += '</td></tr>';
2869
		if (HighBidderUserAnonymized === true) {
2870
			str += '<tr><td>High Bidder User Anonymized</td><td></td></tr>';
2871
		}
2872
	}
2873
	str += '</table>';
2874
 
2875
	str += '</div>';
2876
	str += '</div>';
2877
	str += '</div>';
2878
 
2879
	if (PictureURL.length > 1) {
2880
		str += '<div class="w3-container w3-padding w3-margin w3-card-4">';
2881
		str += '<h2>Pictures</h2>';
2882
		for (i = 0; i < PictureURL.length; i++) {
2883
			str += '<img class="w3-image" src="' + PictureURL[i].replace('http:', 'https:') + '" alt="Item Image ' + (i + 1) + '">';
2884
		}
2885
		str += '</div>';
2886
	}
2887
 
2888
	if (Description) {
2889
		str += '<div class="w3-container w3-padding w3-margin w3-card-4"><h2>Description</h2>' + Description + '</div>';
2890
	}
2891
 
2892
	str += '<div id="warnings" class="w3-container w3-padding w3-margin w3-card-4 w3-red w3-hide"></div>';
2893
	str += '<footer class="w3-container w3-center w3-border-top w3-margin">';
2894
	str += 'Copyright &#169; ' + new Date().getFullYear() + ' MUNA Trading. All rights reserved.';
2895
	str += '</footer>';
2896
	str += '<script async defer src="https://maps.googleapis.com/maps/api/js?key=' + configGoogleMapsKey + '&callback=initMap"><\/script>';
2897
	str += '</div>';
2898
	str += '</body>';
2899
	str += '</html>';
2900
 
2901
	var newWin = window.open("", ItemID + ' ' + Title);
2902
	if (newWin) {
2903
		newWin.document.open().write(str);
2904
		newWin.document.close();
2905
	}
2906
}
2907
 
2908
function _cb_GetShippingCosts(root) {
2909
	var ack = root.Ack;
2910
	var i;
2911
	var j;
2912
	var taxTableEntries = 0;
2913
	ship_str = "";
2914
 
2915
	if (ack != 'Success') {
2916
		var x = document.getElementById("warnings");
2917
		x.innerHTML = '<a href="javascript:void(0)" class="w3-right w3-xlarge w3-ripple" style="text-decoration:none;" onclick="hideErrorBox()">Close &#10006;</a>';
2918
		x.innerHTML += "<h2>eBay API Error<h2>";
2919
		x.innerHTML += "<p>Id: " + root.Errors[0].ErrorCode + "<br/>";
2920
		x.innerHTML += "<p>Domain: " + root.Errors[0].ErrorClassification + "<br/>";
2921
		x.innerHTML += "<p>Severity: " + root.Errors[0].SeverityCode + "<br/>";
2922
		x.innerHTML += "<p>Short Message: " + root.Errors[0].ShortMessage + "<br/>";
2923
		x.innerHTML += "<p>Long Message: " + root.Errors[0].LongMessage + "<br/>";
2924
		x.innerHTML += "<p>Build/Version: " + root.Build + '/' + root.Version + "</p>";
2925
		x.innerHTML += "<p>URL: " + "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>" + "</p>";
2926
 
2927
		if (x.className.indexOf("w3-show") == -1) {
2928
			x.className += " w3-show";
2929
		}
2930
 
2931
		if (ack == 'Failure' || ack == 'PartialFailure') {
2932
			x.scrollIntoView(true);
2933
			getShippingCostsDone = true;
2934
			return;
2935
		}
2936
	}
2937
 
2938
	ship_str += '<tr><td><strong>Shipping Cost Summary</strong></td><td></td></tr>';
2939
	ship_str_cost = "";
2940
	if (root.ShippingCostSummary.ShippingServiceCost) {
2941
		if (root.ShippingCostSummary.ShippingServiceCost.Value === 0) {
2942
			ship_str += '<tr><td>Shipping Service Cost</td><td>Free</td></tr>';
2943
			ship_str_cost = '<tr><td>Shipping</td><td>Free (' + root.ShippingCostSummary.ShippingServiceName + ')</td></tr>';
2944
		} else {
2945
			ship_str += '<tr><td>Shipping Service Cost</td><td>' + (root.ShippingCostSummary.ShippingServiceCost.CurrencyID == 'USD' ? '$' : root.ShippingCostSummary.ShippingServiceCost.CurrencyID + ' ') + root.ShippingCostSummary.ShippingServiceCost.Value.toFixed(2) + '</td></tr>';
2946
			ship_str_cost = '<tr><td>Shipping</td><td>' + (root.ShippingCostSummary.ShippingServiceCost.CurrencyID == 'USD' ? '$' : root.ShippingCostSummary.ShippingServiceCost.CurrencyID + ' ') + root.ShippingCostSummary.ShippingServiceCost.Value.toFixed(2) + ' (' + root.ShippingCostSummary.ShippingServiceName + ')</td></tr>';
2947
		}
2948
	}
2949
 
2950
	if (root.ShippingCostSummary.ShippingServiceName) {
2951
		ship_str += '<tr><td>Shipping Service Name</td><td>' + root.ShippingCostSummary.ShippingServiceName + '</td></tr>';
2952
	}
2953
 
2954
	if (root.ShippingCostSummary.ShippingType) {
2955
		ship_str += '<tr><td>Shipping Type</td><td>' + root.ShippingCostSummary.ShippingType + '</td></tr>';
2956
	}
2957
 
2958
	if (root.ShippingCostSummary.ImportCharge) {
2959
		ship_str += '<tr><td>Import Charge</td><td>' + (root.ShippingCostSummary.ImportCharge.CurrencyID == 'USD' ? '$' : root.ShippingCostSummary.ImportCharge.CurrencyID + ' ') + root.ShippingCostSummary.ImportCharge.Value.toFixed(2) + '</td></tr>';
2960
	}
2961
 
2962
	if (root.ShippingCostSummary.InsuranceCost) {
2963
		ship_str += '<tr><td>Insurance Cost</td><td>' + (root.ShippingCostSummary.InsuranceCost.CurrencyID == 'USD' ? '$' : root.ShippingCostSummary.InsuranceCost.CurrencyID + ' ') + root.ShippingCostSummary.InsuranceCost.Value.toFixed(2) + '</td></tr>';
2964
	}
2965
 
2966
	if (root.ShippingCostSummary.InsuranceOption) {
2967
		ship_str += '<tr><td>Insurance Option</td><td>' + root.ShippingCostSummary.InsuranceOption + '</td></tr>';
2968
	}
2969
 
2970
	if (root.ShippingCostSummary.InternationalInsuranceCost) {
2971
		ship_str += '<tr><td>International Insurance Cost</td><td>' + (root.ShippingCostSummary.InternationalInsuranceCost.CurrencyID == 'USD' ? '$' : root.ShippingCostSummary.InternationalInsuranceCost.CurrencyID + ' ') + root.ShippingCostSummary.InternationalInsuranceCost.Value.toFixed(2) + '</td></tr>';
2972
	}
2973
 
2974
	if (root.ShippingCostSummary.InternationalInsuranceOption) {
2975
		ship_str += '<tr><td>International Insurance Option</td><td>' + root.ShippingCostSummary.InternationalInsuranceOption + '</td></tr>';
2976
	}
2977
 
2978
	if (root.ShippingDetails.ExcludeShipToLocation) {
2979
		var excludeArray = String(root.ShippingDetails.ExcludeShipToLocation).split(',');
2980
		ship_str += '<tr><td>Exclude Ship to Location</td><td>';
2981
		for (i = 0; i < excludeArray.length; i++) {
2982
			ship_str += (i > 0 ? ', ' : '') + mapCountryCode(excludeArray[i]);
2983
		}
2984
		ship_str += '</td></tr>';
2985
	}
2986
 
2987
	if (root.ShippingDetails.SalesTax) {
2988
		if (root.ShippingDetails.SalesTax.SalesTaxAmount) {
2989
			ship_str += '<tr><td>Sales Tax Amount</td><td>' + (root.ShippingDetails.SalesTax.SalesTaxAmount.CurrencyID == 'USD' ? '$' : root.ShippingDetails.SalesTax.SalesTaxAmount.CurrencyID + ' ') + root.ShippingDetails.SalesTax.SalesTaxAmount.Value.toFixed(2) + '</td></tr>';
2990
		}
2991
		if (root.ShippingDetails.SalesTax.SalesTaxPercent) {
2992
			ship_str += '<tr><td>Sales Tax Percentage</td><td>' + root.ShippingDetails.SalesTax.SalesTaxPercent.toFixed(3) + '%</td></tr>';
2993
		}
2994
		if (root.ShippingDetails.SalesTax.SalesTaxState) {
2995
			ship_str += '<tr><td>Sales Tax State</td><td>' + root.ShippingDetails.SalesTax.SalesTaxState + '</td></tr>';
2996
		}
2997
		if (root.ShippingDetails.SalesTax.ShippingIncludedInTax === true) {
2998
			ship_str += '<tr><td>Shipping Included In Tax</td><td></td></tr>';
2999
		}
3000
	}
3001
 
3002
	ship_str_tax = "";
3003
	if (root.ShippingDetails.TaxTable && root.ShippingDetails.TaxTable.TaxJurisdiction.length > 0) {
3004
		for (i = 0; i < root.ShippingDetails.TaxTable.TaxJurisdiction.length; i++) {
3005
			if (root.ShippingDetails.TaxTable.TaxJurisdiction[i].JurisdictionID !== undefined) {
3006
				taxTableEntries++;
3007
			}
3008
		}
3009
	}
3010
 
3011
	if (taxTableEntries) {
3012
		ship_str += '<tr><td><strong>Tax Table</strong></td><td></td></tr>';
3013
		for (i = 0; i < root.ShippingDetails.TaxTable.TaxJurisdiction.length; i++) {
3014
			if (root.ShippingDetails.TaxTable.TaxJurisdiction[i].JurisdictionID !== undefined) {
3015
				if (root.ShippingDetails.TaxTable.TaxJurisdiction[i].JurisdictionID == configTaxStateId) {
3016
					ship_str_tax += '<tr><td>Tax</td><td>' + root.ShippingDetails.TaxTable.TaxJurisdiction[i].JurisdictionID + ' ' + root.ShippingDetails.TaxTable.TaxJurisdiction[i].SalesTaxPercent.toFixed(3) + '%';
3017
					if (root.ShippingDetails.TaxTable.TaxJurisdiction[i].ShippingIncludedInTax && root.ShippingDetails.TaxTable.TaxJurisdiction[i].ShippingIncludedInTax === true) {
3018
						ship_str_tax += '<br/>Shipping included in Tax';
3019
					}
3020
					ship_str_tax += '</td></tr>';
3021
				}
3022
				ship_str += '<tr><td>' + root.ShippingDetails.TaxTable.TaxJurisdiction[i].JurisdictionID + '</td><td>' + root.ShippingDetails.TaxTable.TaxJurisdiction[i].SalesTaxPercent.toFixed(3) + '%';
3023
				if (root.ShippingDetails.TaxTable.TaxJurisdiction[i].ShippingIncludedInTax && root.ShippingDetails.TaxTable.TaxJurisdiction[i].ShippingIncludedInTax === true) {
3024
					ship_str += '<br/>Shipping included in Tax';
3025
				}
3026
				ship_str += '</td></tr>';
3027
			}
3028
		}
3029
	}
3030
 
3031
	for (i = 0; root.ShippingDetails.ShippingServiceOption && i < root.ShippingDetails.ShippingServiceOption.length; i++) {
3032
		ship_str += '<tr><td><strong>Shipping Option ' + root.ShippingDetails.ShippingServiceOption[i].ShippingServicePriority + '</strong></td><td></td></tr>';
3033
 
3034
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCost) {
3035
			if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCost.Value === 0) {
3036
				ship_str += '<tr><td>Shipping Service Cost</td><td>Free</td></tr>';
3037
			} else {
3038
				ship_str += '<tr><td>Shipping Service Cost</td><td>' + (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCost.CurrencyID + ' ') + root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCost.Value.toFixed(2) + '</td></tr>';
3039
			}
3040
		}
3041
 
3042
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingInsuranceCost) {
3043
			ship_str += '<tr><td>Shipping Insurance Cost</td><td>' + (root.ShippingDetails.ShippingServiceOption[i].ShippingInsuranceCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.ShippingServiceOption[i].ShippingInsuranceCost.CurrencyID + ' ') + root.ShippingDetails.ShippingServiceOption[i].ShippingInsuranceCost.Value.toFixed(2) + '</td></tr>';
3044
		}
3045
 
3046
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceAdditionalCost) {
3047
			ship_str += '<tr><td>Shipping Additional Item Cost</td><td>' + (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceAdditionalCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.ShippingServiceOption[i].ShippingServiceAdditionalCost.CurrencyID + ' ') + root.ShippingDetails.ShippingServiceOption[i].ShippingServiceAdditionalCost.Value.toFixed(2) + '</td></tr>';
3048
		}
3049
 
3050
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingSurcharge) {
3051
			ship_str += '<tr><td>Shipping Surcharge</td><td>' + (root.ShippingDetails.ShippingServiceOption[i].ShippingSurcharge.CurrencyID == 'USD' ? '$' : root.ShippingDetails.ShippingServiceOption[i].ShippingSurcharge.CurrencyID + ' ') + root.ShippingDetails.ShippingServiceOption[i].ShippingSurcharge.Value.toFixed(2) + '</td></tr>';
3052
		}
3053
 
3054
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceName) {
3055
			ship_str += '<tr><td>Shipping Service Name</td><td>' + root.ShippingDetails.ShippingServiceOption[i].ShippingServiceName + '</td></tr>';
3056
		}
3057
 
3058
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceOptionType) {
3059
			ship_str += '<tr><td>Shipping Type</td><td>' + root.ShippingDetails.ShippingServiceOption[i].ShippingServiceOptionType + '</td></tr>';
3060
		}
3061
 
3062
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMin && root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMax) {
3063
			ship_str += '<tr><td>Delivery Time</td><td>';
3064
			if (root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMin != root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMax) {
3065
				ship_str += 'Between ' + root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMin + ' and ';
3066
			}
3067
			ship_str += root.ShippingDetails.ShippingServiceOption[i].ShippingTimeMax + ' days</td></tr>';
3068
		}
3069
 
3070
		if (root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCutOffTime) {
3071
			ship_str += '<tr><td>Shipping Type</td><td>' + root.ShippingDetails.ShippingServiceOption[i].ShippingServiceCutOffTime + '</td></tr>';
3072
		}
3073
 
3074
		if (root.ShippingDetails.ShippingServiceOption[i].ExpeditedService && root.ShippingDetails.ShippingServiceOption[i].ExpeditedService === true) {
3075
			ship_str += '<tr><td>Expedited Service</td><td></td></tr>';
3076
		}
3077
 
3078
		if (root.ShippingDetails.ShippingServiceOption[i].FastAndFree && root.ShippingDetails.ShippingServiceOption[i].FastAndFree === true) {
3079
			ship_str += '<tr><td>Fast and Free</td><td></td></tr>';
3080
		}
3081
 
3082
		if (root.ShippingDetails.ShippingServiceOption[i].ShipsTo) {
3083
			var includeArray = String(root.ShippingDetails.ShippingServiceOption[i].ShipsTo).split(',');
3084
			ship_str += '<tr><td>Ship to Location</td><td>';
3085
			for (j = 0; j < includeArray.length; j++) {
3086
				ship_str += (j > 0 ? ', ' : '') + includeArray[j];
3087
			}
3088
			ship_str += '</td></tr>';
3089
		}
3090
		ship_str += '<tr><td>' + '</td><td>' + '</td></tr>';
3091
	}
3092
 
3093
	for (i = 0; root.ShippingDetails.InternationalShippingServiceOption && i < root.ShippingDetails.InternationalShippingServiceOption.length; i++) {
3094
		ship_str += '<tr><td><strong>International Shipping Option ' + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServicePriority + '</strong></td><td></td></tr>';
3095
 
3096
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCost) {
3097
			if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCost.Value === 0) {
3098
				ship_str += '<tr><td>Shipping Service Cost</td><td>Free</td></tr>';
3099
			} else {
3100
				ship_str += '<tr><td>Shipping Service Cost</td><td>' + (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCost.CurrencyID + ' ') + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCost.Value.toFixed(2) + '</td></tr>';
3101
			}
3102
		}
3103
 
3104
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingInsuranceCost) {
3105
			ship_str += '<tr><td>Shipping Insurance Cost</td><td>' + (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingInsuranceCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.InternationalShippingServiceOption[i].ShippingInsuranceCost.CurrencyID + ' ') + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingInsuranceCost.Value.toFixed(2) + '</td></tr>';
3106
		}
3107
 
3108
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceAdditionalCost) {
3109
			ship_str += '<tr><td>Shipping Additional Item Cost</td><td>' + (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceAdditionalCost.CurrencyID == 'USD' ? '$' : root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceAdditionalCost.CurrencyID + ' ') + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceAdditionalCost.Value.toFixed(2) + '</td></tr>';
3110
		}
3111
 
3112
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ImportCharge) {
3113
			ship_str += '<tr><td>Import Charge</td><td>' + (root.ShippingDetails.InternationalShippingServiceOption[i].ImportCharge.CurrencyID == 'USD' ? '$' : root.ShippingDetails.InternationalShippingServiceOption[i].ImportCharge.CurrencyID + ' ') + root.ShippingDetails.InternationalShippingServiceOption[i].ImportCharge.Value.toFixed(2) + '</td></tr>';
3114
		}
3115
 
3116
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceName) {
3117
			ship_str += '<tr><td>Shipping Service Name</td><td>' + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceName + '</td></tr>';
3118
		}
3119
 
3120
		if (root.ShippingDetails.InternationalShippingServiceOption[i].InternationalShippingServiceOptionType) {
3121
			ship_str += '<tr><td>Shipping Type</td><td>' + root.ShippingDetails.InternationalShippingServiceOption[i].InternationalShippingServiceOptionType + '</td></tr>';
3122
		}
3123
 
3124
		if (root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMinTime && root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMaxTime) {
3125
			ship_str += '<tr><td>Delivery Time</td><td>';
3126
			if (root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMinTime != root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMaxTime) {
3127
				ship_str += 'Between ' + moment(root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMinTime, moment.ISO_8601).format("YYYY-MM-DD") + ' and ';
3128
			}
3129
			ship_str += moment(root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMinTime, moment.ISO_8601).format("YYYY-MM-DD");
3130
			ship_str += (moment(root.ShippingDetails.InternationalShippingServiceOption[i].EstimatedDeliveryMaxTime).isValid() ? '' : ' days') + '</td></tr>';
3131
		}
3132
 
3133
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCutOffTime) {
3134
			ship_str += '<tr><td>Shipping Type</td><td>' + root.ShippingDetails.InternationalShippingServiceOption[i].ShippingServiceCutOffTime + '</td></tr>';
3135
		}
3136
 
3137
		if (root.ShippingDetails.InternationalShippingServiceOption[i].ShipsTo) {
3138
			var includeInternationalArray = String(root.ShippingDetails.InternationalShippingServiceOption[i].ShipsTo).split(',');
3139
			ship_str += '<tr><td>Ship to Location</td><td>';
3140
			for (j = 0; j < includeInternationalArray.length; j++) {
3141
				ship_str += (j > 0 ? ', ' : '') + includeInternationalArray[j];
3142
			}
3143
			ship_str += '</td></tr>';
3144
		}
3145
		ship_str += '<tr><td>' + '</td><td>' + '</td></tr>';
3146
	}
3147
 
3148
	getShippingCostsDone = true;
3149
}
3150
 
3151
function ConvertToCSVHeader() {
3152
	var header = "";
3153
 
3154
	header += "itemId,";
3155
	header += "title,";
3156
	header += "subtitle,";
3157
	header += "globalId,";
3158
	header += "primaryCategory.categoryId,";
3159
	header += "primaryCategory.categoryName,";
3160
	header += "galleryURL,";
3161
	header += "viewItemURL,";
3162
	header += "paymentMethod,";
3163
	header += "autoPay,";
3164
	header += "location,";
3165
	header += "country,";
3166
	header += "sellerUserName,";
3167
	header += "feedbackScore,";
3168
	header += "positiveFeedbackPercent,";
3169
	header += "feedbackRatingStar,";
3170
	header += "topRatedSeller,";
3171
	header += "storeName,";
3172
	header += "storeURL,";
3173
	header += "shippingInfo.shippingServiceCost.currencyId,";
3174
	header += "shippingInfo.shippingServiceCost.value,";
3175
	header += "shippingInfo.shippingType,";
3176
	header += "shippingInfo.shipToLocations,";
3177
	header += "shippingInfo.expeditedShipping,";
3178
	header += "shippingInfo.oneDayShippingAvailable,";
3179
	header += "shippingInfo.handlingTime,";
3180
	header += "sellingStatus.currentPrice.currencyId,";
3181
	header += "sellingStatus.currentPrice.value,";
3182
	header += "sellingStatus.convertedCurrentPrice.currencyId,";
3183
	header += "sellingStatus.convertedCurrentPrice.value,";
3184
	header += "sellingStatus.bidCount,";
3185
	header += "sellingStatus.sellingState,";
3186
	header += "sellingStatus.timeLeft,";
3187
	header += "listingInfo.bestOfferEnabled,";
3188
	header += "listingInfo.buyItNowAvailable,";
3189
	header += "listingInfo.convertedBuyItNowPrice.currencyId,";
3190
	header += "listingInfo.convertedBuyItNowPrice.value,";
3191
	header += "listingInfo.startTime,";
3192
	header += "listingInfo.endTime,";
3193
	header += "listingInfo.listingType,";
3194
	header += "listingInfo.gift,";
3195
	header += "listingInfo.watchCount,";
3196
	header += "returnsAccepted,";
3197
	header += "galleryPlusPictureURL,";
3198
	header += "condition.conditionId,";
3199
	header += "condition.conditionDisplayName,";
3200
	header += "isMultiVariationListing,";
3201
	header += "topRatedListing,";
3202
	header += "distance,";
3203
	header += "distance unit";
3204
	header += "\r\n";
3205
 
3206
	return header;
3207
}
3208
 
3209
function readParameters() {
3210
	if (window.location.search[0] == '?') {
3211
		var str = window.location.search.split('?')[1];
3212
		$('form').deserialize(str);
3213
		$(document.getElementById("category")).trigger("chosen:updated");
3214
		eBaySearch(1);
3215
	}
3216
}
3217
 
3218
jQuery.fn.deserialize = function(data) {
3219
	var f = this,
3220
		map = {},
3221
		find = function(selector) {
3222
			return f.is("form") ? f.find(selector) : f.filter(selector);
3223
		};
3224
	// Get map of values
3225
	data = data.replace(/\+/g, " ");
3226
	jQuery.each(data.split("&"), function() {
3227
		var nv = this.split("="),
3228
			n = decodeURIComponent(nv[0]),
3229
			v = nv.length > 1 ? decodeURIComponent(nv[1]) : null;
3230
		if (!(n in map)) {
3231
			map[n] = [];
3232
		}
3233
		map[n].push(v);
3234
	});
3235
	// Set values for all form elements in the data
3236
	jQuery.each(map, function(n, v) {
3237
		find("[name='" + n + "']").val(v);
3238
	});
3239
	// Clear all form elements not in form data
3240
	find("input:text,select,textarea").each(function() {
3241
		if (!(jQuery(this).attr("name") in map)) {
3242
			jQuery(this).val("");
3243
		}
3244
	});
3245
	find("input:checkbox:checked,input:radio:checked").each(function() {
3246
		if (!(jQuery(this).attr("name") in map)) {
3247
			this.checked = false;
3248
		}
3249
	});
3250
	return this;
3251
};
3252
 
3253
// Function to convert eBay JSON item to CSV format.
3254
function ConvertToCSV(array) {
3255
	var str = "";
3256
 
3257
	++currentPage;
3258
	updateProgressBar(maxPages, currentPage);
3259
 
3260
	for (var i = 0; i < array.length; i++) {
3261
		var line = "";
3262
 
3263
		var JsonObj = array[i];
3264
		line += "'" + JsonObj.itemId + ",";
3265
 
3266
		var title = String(JsonObj.title).replace(/\"/g, "");
3267
		line += "\"" + title + "\",";
3268
 
3269
		if (JsonObj.subtitle) {
3270
			var subtitle = String(JsonObj.subtitle).replace(/\"/g, "");
3271
			line += "\"" + subtitle + "\",";
3272
		} else {
3273
			line += ",";
3274
		}
3275
 
3276
		line += JsonObj.globalId + ",";
3277
 
3278
		var primaryCategory = JsonObj.primaryCategory;
3279
		line += primaryCategory[0].categoryId + ",";
3280
		var categoryName = String(primaryCategory[0].categoryName).replace(/\"/g, "");
3281
		line += "\"" + categoryName + "\",";
3282
 
3283
		line += JsonObj.galleryURL + ",";
3284
		line += "\"" + JsonObj.viewItemURL + "\",";
3285
		line += "\"" + JsonObj.paymentMethod + "\",";
3286
		line += JsonObj.autoPay + ",";
3287
		line += "\"" + JsonObj.location + "\",";
3288
		line += JsonObj.country + ",";
3289
 
3290
		var sellerInfo = JsonObj.sellerInfo;
3291
		line += sellerInfo[0].sellerUserName + ",";
3292
		line += sellerInfo[0].feedbackScore + ",";
3293
		line += sellerInfo[0].positiveFeedbackPercent + ",";
3294
		line += sellerInfo[0].feedbackRatingStar + ",";
3295
		line += sellerInfo[0].topRatedSeller + ",";
3296
 
3297
		var storeInfo = JsonObj.storeInfo;
3298
		if (storeInfo) {
3299
			var storeName = String(storeInfo[0].storeName).replace(/\"/g, "");
3300
			line += "\"" + storeName + "\",";
3301
			line += storeInfo[0].storeURL + ",";
3302
		} else {
3303
			line += ",";
3304
			line += ",";
3305
		}
3306
		var shippingInfo = JsonObj.shippingInfo;
3307
		var shippingServiceCost = shippingInfo[0].shippingServiceCost;
3308
		if (shippingServiceCost) {
3309
			line += shippingServiceCost[0]["@currencyId"] + ",";
3310
			line += shippingServiceCost[0].__value__ + ",";
3311
		} else {
3312
			line += ",";
3313
			line += ",";
3314
		}
3315
		line += shippingInfo[0].shippingType + ",";
3316
		line += shippingInfo[0].shipToLocations + ",";
3317
		line += shippingInfo[0].expeditedShipping + ",";
3318
		line += shippingInfo[0].oneDayShippingAvailable + ",";
3319
		line += shippingInfo[0].handlingTime + ",";
3320
 
3321
		var sellingStatus = JsonObj.sellingStatus;
3322
		var currentPrice = sellingStatus[0].currentPrice;
3323
		var convertedCurrentPrice = sellingStatus[0].convertedCurrentPrice;
3324
		line += currentPrice[0]["@currencyId"] + ",";
3325
		line += currentPrice[0].__value__ + ",";
3326
		line += convertedCurrentPrice[0]["@currencyId"] + ",";
3327
		line += convertedCurrentPrice[0].__value__ + ",";
3328
		if (sellingStatus[0].bidCount) {
3329
			line += sellingStatus[0].bidCount + ",";
3330
		} else {
3331
			line += ",";
3332
		}
3333
		line += sellingStatus[0].sellingState + ",";
3334
		line += formatTimeleft(moment.duration(sellingStatus[0].timeLeft).asSeconds()) + ",";
3335
 
3336
		var listingInfo = JsonObj.listingInfo;
3337
		line += listingInfo[0].bestOfferEnabled + ",";
3338
		line += listingInfo[0].buyItNowAvailable + ",";
3339
 
3340
		var convertedBuyItNowPrice = listingInfo[0].convertedBuyItNowPrice;
3341
		if (convertedBuyItNowPrice) {
3342
			line += convertedBuyItNowPrice[0]["@currencyId"] + ",";
3343
			line += convertedBuyItNowPrice[0].__value__ + ",";
3344
		} else {
3345
			line += ",";
3346
			line += ",";
3347
		}
3348
		line += listingInfo[0].startTime + ",";
3349
		line += listingInfo[0].endTime + ",";
3350
		line += listingInfo[0].listingType + ",";
3351
		line += listingInfo[0].gift + ",";
3352
		if (listingInfo[0].watchCount) {
3353
			line += listingInfo[0].watchCount + ",";
3354
		} else {
3355
			line += ",";
3356
		}
3357
 
3358
		line += JsonObj.returnsAccepted + ",";
3359
		if (JsonObj.galleryPlusPictureURL) {
3360
			line += JsonObj.galleryPlusPictureURL + ",";
3361
		} else {
3362
			line += ",";
3363
		}
3364
 
3365
		var condition = JsonObj.condition;
3366
		if (condition) {
3367
			line += condition[0].conditionId + ",";
3368
			line += condition[0].conditionDisplayName + ",";
3369
			line += JsonObj.isMultiVariationListing + ",";
3370
			line += JsonObj.topRatedListing + ",";
3371
		} else {
3372
			line += ",";
3373
			line += ",";
3374
			line += ",";
3375
			line += ",";
3376
		}
3377
 
3378
		if (JsonObj.distance !== undefined) {
3379
			line += JsonObj.distance[0].__value__ + ",";
3380
			line += JsonObj.distance[0]["@unit"] + ",";
3381
		} else {
3382
			line += ",";
3383
			line += ",";
3384
		}
3385
 
3386
		line += '\r\n';
3387
 
3388
		str += line;
3389
	}
3390
 
3391
	var x = document.getElementById("csv");
3392
	x.innerHTML += str;
3393
 
3394
	if (currentPage >= maxPages) {
3395
		asyncFlag = true;
3396
	}
3397
}
3398
 
3399
function resetForm() {
3400
	document.getElementById("searchForm").reset();
3401
	$(document.getElementById("category")).trigger("chosen:updated");
3402
}
3403
 
3404
function showKeywordHelp() {
3405
	var x = document.getElementById("keywordHelp");
3406
	if (x.className.indexOf("w3-show") == -1) {
3407
		x.className += " w3-show";
3408
	}
3409
}
3410
 
3411
function hideKeywordHelp() {
3412
	var x = document.getElementById("keywordHelp");
3413
	x.className = x.className.replace(" w3-show", "");
3414
}
3415
 
3416
function hideErrorBox() {
3417
	var x = document.getElementById("warnings");
3418
	x.className = x.className.replace(" w3-show", "");
3419
}
3420
 
3421
function mapCountryCode(code) {
3422
	var mappedCode = code;
3423
	var countryCodes = {};
3424
 
3425
	countryCodes.AA = "APO/FPO";
3426
	countryCodes.AD = "Andorra";
3427
	countryCodes.AE = "United Arab Emirates";
3428
	countryCodes.AF = "Afghanistan";
3429
	countryCodes.AG = "Antigua and Barbuda";
3430
	countryCodes.AI = "Anguilla";
3431
	countryCodes.AL = "Albania";
3432
	countryCodes.AM = "Armenia";
3433
	countryCodes.AN = "Netherlands Antilles";
3434
	countryCodes.AO = "Angola";
3435
	countryCodes.AQ = "Antarctica";
3436
	countryCodes.AR = "Argentina";
3437
	countryCodes.AS = "American Samoa";
3438
	countryCodes.AT = "Austria";
3439
	countryCodes.AU = "Australia";
3440
	countryCodes.AW = "Aruba";
3441
	countryCodes.AZ = "Azerbaijan";
3442
	countryCodes.BA = "Bosnia and Herzegovina";
3443
	countryCodes.BB = "Barbados";
3444
	countryCodes.BD = "Bangladesh";
3445
	countryCodes.BE = "Belgium";
3446
	countryCodes.BF = "Burkina Faso";
3447
	countryCodes.BG = "Bulgaria";
3448
	countryCodes.BH = "Bahrain";
3449
	countryCodes.BI = "Burundi";
3450
	countryCodes.BJ = "Benin";
3451
	countryCodes.BM = "Bermuda";
3452
	countryCodes.BN = "Brunei Darussalam";
3453
	countryCodes.BO = "Bolivia";
3454
	countryCodes.BR = "Brazil";
3455
	countryCodes.BS = "Bahamas";
3456
	countryCodes.BT = "Bhutan";
3457
	countryCodes.BV = "Bouvet Island";
3458
	countryCodes.BW = "Botswana";
3459
	countryCodes.BY = "Belarus";
3460
	countryCodes.BZ = "Belize";
3461
	countryCodes.CA = "Canada";
3462
	countryCodes.CC = "Cocos (Keeling) Islands";
3463
	countryCodes.CD = "The Democratic Republic of the Congo";
3464
	countryCodes.CF = "Central African Republic";
3465
	countryCodes.CG = "Congo";
3466
	countryCodes.CH = "Switzerland";
3467
	countryCodes.CI = "Cote d'Ivoire";
3468
	countryCodes.CK = "Cook Islands";
3469
	countryCodes.CL = "Chile";
3470
	countryCodes.CM = "Cameroon";
3471
	countryCodes.CN = "China";
3472
	countryCodes.CO = "Colombia";
3473
	countryCodes.CR = "Costa Rica";
3474
	countryCodes.CU = "Cuba";
3475
	countryCodes.CV = "Cape Verde";
3476
	countryCodes.CX = "Christmas Island";
3477
	countryCodes.CY = "Cyprus";
3478
	countryCodes.CZ = "Czech Republic";
3479
	countryCodes.DE = "Germany";
3480
	countryCodes.DJ = "Djibouti";
3481
	countryCodes.DK = "Denmark";
3482
	countryCodes.DM = "Dominica";
3483
	countryCodes.DO = "Dominican Republic";
3484
	countryCodes.DZ = "Algeria";
3485
	countryCodes.EC = "Ecuador";
3486
	countryCodes.EE = "Estonia";
3487
	countryCodes.EG = "Egypt";
3488
	countryCodes.EH = "Western Sahara";
3489
	countryCodes.ER = "Eritrea";
3490
	countryCodes.ES = "Spain";
3491
	countryCodes.ET = "Ethiopia";
3492
	countryCodes.FI = "Finland";
3493
	countryCodes.FJ = "Fiji";
3494
	countryCodes.FK = "Falkland Islands (Malvinas)";
3495
	countryCodes.FM = "Federated States of Micronesia";
3496
	countryCodes.FO = "Faroe Islands";
3497
	countryCodes.FR = "France";
3498
	countryCodes.GA = "Gabon";
3499
	countryCodes.GB = "United Kingdom";
3500
	countryCodes.GD = "Grenada";
3501
	countryCodes.GE = "Georgia";
3502
	countryCodes.GF = "French Guiana";
3503
	countryCodes.GG = "Guernsey";
3504
	countryCodes.GH = "Ghana";
3505
	countryCodes.GI = "Gibraltar";
3506
	countryCodes.GL = "Greenland";
3507
	countryCodes.GM = "Gambia";
3508
	countryCodes.GN = "Guinea";
3509
	countryCodes.GP = "Guadeloupe";
3510
	countryCodes.GQ = "Equatorial Guinea";
3511
	countryCodes.GR = "Greece";
3512
	countryCodes.GS = "South Georgia and the South Sandwich Islands";
3513
	countryCodes.GT = "Guatemala";
3514
	countryCodes.GU = "Guam";
3515
	countryCodes.GW = "Guinea-Bissau";
3516
	countryCodes.GY = "Guyana";
3517
	countryCodes.HK = "Hong Kong";
3518
	countryCodes.HM = "Heard Island and McDonald Islands";
3519
	countryCodes.HN = "Honduras";
3520
	countryCodes.HR = "Croatia";
3521
	countryCodes.HT = "Haiti";
3522
	countryCodes.HU = "Hungary";
3523
	countryCodes.ID = "Indonesia";
3524
	countryCodes.IE = "Ireland";
3525
	countryCodes.IL = "Israel";
3526
	countryCodes.IN = "India";
3527
	countryCodes.IO = "British Indian Ocean Territory";
3528
	countryCodes.IQ = "Iraq";
3529
	countryCodes.IR = "Islamic Republic of Iran";
3530
	countryCodes.IS = "Iceland";
3531
	countryCodes.IT = "Italy";
3532
	countryCodes.JE = "Jersey";
3533
	countryCodes.JM = "Jamaica";
3534
	countryCodes.JO = "Jordan";
3535
	countryCodes.JP = "Japan";
3536
	countryCodes.KE = "Kenya";
3537
	countryCodes.KG = "Kyrgyzstan";
3538
	countryCodes.KH = "Cambodia";
3539
	countryCodes.KI = "Kiribati";
3540
	countryCodes.KM = "Comoros";
3541
	countryCodes.KN = "Saint Kitts and Nevis";
3542
	countryCodes.KP = "Democratic People's Republic of Korea";
3543
	countryCodes.KR = "Republic of Korea";
3544
	countryCodes.KW = "Kuwait";
3545
	countryCodes.KY = "Cayman Islands";
3546
	countryCodes.KZ = "Kazakhstan";
3547
	countryCodes.LA = "Lao People's Democratic Republic";
3548
	countryCodes.LB = "Lebanon";
3549
	countryCodes.LC = "Saint Lucia";
3550
	countryCodes.LI = "Liechtenstein";
3551
	countryCodes.LK = "Sri Lanka";
3552
	countryCodes.LR = "Liberia";
3553
	countryCodes.LS = "Lesotho";
3554
	countryCodes.LT = "Lithuania";
3555
	countryCodes.LU = "Luxembourg";
3556
	countryCodes.LV = "Latvia";
3557
	countryCodes.LY = "Libyan Arab Jamahiriya";
3558
	countryCodes.MA = "Morocco";
3559
	countryCodes.MC = "Monaco";
3560
	countryCodes.MD = "Republic of Moldova";
3561
	countryCodes.ME = "Montenegro";
3562
	countryCodes.MG = "Madagascar";
3563
	countryCodes.MH = "Marshall Islands";
3564
	countryCodes.MK = "The Former Yugoslav Republic of Macedonia";
3565
	countryCodes.ML = "Mali";
3566
	countryCodes.MM = "Myanmar";
3567
	countryCodes.MN = "Mongolia";
3568
	countryCodes.MO = "Macao";
3569
	countryCodes.MP = "Northern Mariana Islands";
3570
	countryCodes.MQ = "Martinique";
3571
	countryCodes.MR = "Mauritania";
3572
	countryCodes.MS = "Montserrat";
3573
	countryCodes.MT = "Malta";
3574
	countryCodes.MU = "Mauritius";
3575
	countryCodes.MV = "Maldives";
3576
	countryCodes.MW = "Malawi";
3577
	countryCodes.MX = "Mexico";
3578
	countryCodes.MY = "Malaysia";
3579
	countryCodes.MZ = "Mozambique";
3580
	countryCodes.NA = "Namibia";
3581
	countryCodes.NC = "New Caledonia";
3582
	countryCodes.NE = "Niger";
3583
	countryCodes.NF = "Norfolk Island";
3584
	countryCodes.NG = "Nigeria";
3585
	countryCodes.NI = "Nicaragua";
3586
	countryCodes.NL = "Netherlands";
3587
	countryCodes.NO = "Norway";
3588
	countryCodes.NP = "Nepal";
3589
	countryCodes.NR = "Nauru";
3590
	countryCodes.NU = "Niue";
3591
	countryCodes.NZ = "New Zealand";
3592
	countryCodes.OM = "Oman";
3593
	countryCodes.PA = "Panama";
3594
	countryCodes.PE = "Peru";
3595
	countryCodes.PF = "French Polynesia Includes Tahiti";
3596
	countryCodes.PG = "Papua New Guinea";
3597
	countryCodes.PH = "Philippines";
3598
	countryCodes.PK = "Pakistan";
3599
	countryCodes.PL = "Poland";
3600
	countryCodes.PM = "Saint Pierre and Miquelon";
3601
	countryCodes.PN = "Pitcairn";
3602
	countryCodes.PR = "Puerto Rico";
3603
	countryCodes.PS = "Palestinian territory, Occupied";
3604
	countryCodes.PT = "Portugal";
3605
	countryCodes.PW = "Palau";
3606
	countryCodes.PY = "Paraguay";
3607
	countryCodes.QA = "Qatar";
3608
	countryCodes.QM = "Guernsey";
3609
	countryCodes.QN = "Jan Mayen";
3610
	countryCodes.QO = "Jersey";
3611
	countryCodes.RE = "Reunion";
3612
	countryCodes.RO = "Romania";
3613
	countryCodes.RS = "Serbia";
3614
	countryCodes.RU = "Russian Federation";
3615
	countryCodes.RW = "Rwanda";
3616
	countryCodes.SA = "Saudi Arabia";
3617
	countryCodes.SB = "Solomon Islands";
3618
	countryCodes.SC = "Seychelles";
3619
	countryCodes.SD = "Sudan";
3620
	countryCodes.SE = "Sweden";
3621
	countryCodes.SG = "Singapore";
3622
	countryCodes.SH = "Saint Helena";
3623
	countryCodes.SI = "Slovenia";
3624
	countryCodes.SJ = "Svalbard and Jan Mayen";
3625
	countryCodes.SK = "Slovakia";
3626
	countryCodes.SL = "Sierra Leone";
3627
	countryCodes.SM = "San Marino";
3628
	countryCodes.SN = "Senegal";
3629
	countryCodes.SO = "Somalia";
3630
	countryCodes.SR = "Suriname";
3631
	countryCodes.ST = "Sao Tome and Principe";
3632
	countryCodes.SV = "El Salvador";
3633
	countryCodes.SY = "Syrian Arab Republic";
3634
	countryCodes.SZ = "Swaziland";
3635
	countryCodes.TA = "Tristan da Cunha";
3636
	countryCodes.TC = "Turks and Caicos Islands";
3637
	countryCodes.TD = "Chad";
3638
	countryCodes.TF = "French Southern Territories";
3639
	countryCodes.TG = "Togo";
3640
	countryCodes.TH = "Thailand";
3641
	countryCodes.TJ = "Tajikistan";
3642
	countryCodes.TK = "Tokelau";
3643
	countryCodes.TM = "Turkmenistan";
3644
	countryCodes.TN = "Tunisia";
3645
	countryCodes.TO = "Tonga";
3646
	countryCodes.TR = "Turkey";
3647
	countryCodes.TT = "Trinidad and Tobago";
3648
	countryCodes.TV = "Tuvalu";
3649
	countryCodes.TW = "Taiwan, Province of China";
3650
	countryCodes.TZ = "Tanzania, United Republic of";
3651
	countryCodes.UA = "Ukraine";
3652
	countryCodes.UG = "Uganda";
3653
	countryCodes.UM = "United States Minor Outlying Islands";
3654
	countryCodes.US = "United States";
3655
	countryCodes.UY = "Uruguay";
3656
	countryCodes.UZ = "Uzbekistan";
3657
	countryCodes.VA = "Holy See (Vatican City state)";
3658
	countryCodes.VC = "Saint Vincent and the Grenadines";
3659
	countryCodes.VE = "Venezuela";
3660
	countryCodes.VG = "Virgin Islands, British";
3661
	countryCodes.VI = "Virgin Islands, US";
3662
	countryCodes.VN = "Vietnam";
3663
	countryCodes.VU = "Vanuatu";
3664
	countryCodes.WF = "Wallis and Futuna";
3665
	countryCodes.WS = "Samoa";
3666
	countryCodes.YE = "Yemen";
3667
	countryCodes.YT = "Mayotte";
3668
	countryCodes.ZA = "South Africa";
3669
	countryCodes.ZM = "Zambia";
3670
	countryCodes.ZW = "Zimbabwe";
3671
 
3672
	if (countryCodes[code] !== undefined) {
3673
		mappedCode = countryCodes[code];
3674
	}
3675
 
3676
	return mappedCode;
3677
}
3678
 
3679
var minActive = [0.0, 0.0, 0.0];
3680
var maxActive = [0.0, 0.0, 0.0];
3681
var avgActive = [0.0, 0.0, 0.0];
3682
var noActive = [0, 0, 0];
3683
var minSold = [0.0, 0.0, 0.0];
3684
var maxSold = [0.0, 0.0, 0.0];
3685
var avgSold = [0.0, 0.0, 0.0];
3686
var noSold = [0, 0, 0];
3687
var minUnsold = [0.0, 0.0, 0.0];
3688
var maxUnsold = [0.0, 0.0, 0.0];
3689
var avgUnsold = [0.0, 0.0, 0.0];
3690
var noUnsold = [0, 0, 0];
3691
var newActiveBreakdown = [];
3692
var usedActiveBreakdown = [];
3693
var newSoldBreakdown = [];
3694
var usedSoldBreakdown = [];
3695
var duplicateCheckFlag;
3696
var duplicateCheckText;
3697
 
3698
function getPricing() {
3699
	minActive = [0.0, 0.0, 0.0];
3700
	maxActive = [0.0, 0.0, 0.0];
3701
	avgActive = [0.0, 0.0, 0.0];
3702
	noActive = [0, 0, 0];
3703
	minSold = [0.0, 0.0, 0.0];
3704
	maxSold = [0.0, 0.0, 0.0];
3705
	avgSold = [0.0, 0.0, 0.0];
3706
	noSold = [0, 0, 0];
3707
	minUnsold = [0.0, 0.0, 0.0];
3708
	maxUnsold = [0.0, 0.0, 0.0];
3709
	avgUnsold = [0.0, 0.0, 0.0];
3710
	noUnsold = [0, 0, 0];
3711
	maxPricingPages = [-1, -1];
3712
	totalPricingEntries = [0, 0];
3713
	newActiveBreakdown = [];
3714
	usedActiveBreakdown = [];
3715
	newSoldBreakdown = [];
3716
	usedSoldBreakdown = [];
3717
	duplicateCheckFlag = false;
3718
	duplicateCheckText = '';
3719
 
3720
	getPricingData(0);
3721
	getPricingData(1);
3722
}
3723
 
3724
function getPricingData(searchIndex) {
3725
	var index = 0;
3726
	var keyword = document.getElementById('keyword').value;
3727
 
3728
	// Construct the request
3729
	var url = configeBayFinding + "?";
3730
	if (searchIndex === 0) {
3731
		if (keyword.includes("ReferenceID:")) {
3732
			url += "OPERATION-NAME=findItemsByProduct";
3733
		} else {
3734
			url += "OPERATION-NAME=findItemsAdvanced";
3735
		}
3736
	} else {
3737
		url += "OPERATION-NAME=findCompletedItems";
3738
	}
3739
	url += "&SECURITY-APPNAME=" + configAppid;
3740
	url += "&GLOBAL-ID=EBAY-US";
3741
	url += "&RESPONSE-DATA-FORMAT=JSON";
3742
	url += "&SERVICE-VERSION=" + configeBayFindingVersion;
3743
	url += "&REST-PAYLOAD";
3744
	if (keyword.length > 0) {
3745
		if (keyword.includes("ReferenceID:")) {
3746
			url += "&productId.@type=ReferenceID";
3747
			url += "&productId=";
3748
			url += keyword.substr(12);
3749
		} else {
3750
			url += "&keywords=";
3751
			url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
3752
		}
3753
	}
3754
 
3755
	var catNo = 0;
3756
	for (var categoryIndex = 1; categoryIndex < document.getElementById('category').options.length; categoryIndex++) {
3757
		if (document.getElementById('category').options[categoryIndex].selected) {
3758
			url += "&categoryId(" + catNo + ")=";
3759
			url += document.getElementById('category').options[categoryIndex].value;
3760
			++catNo;
3761
		}
3762
	}
3763
 
3764
	url += "&paginationInput.entriesPerPage=100";
3765
	url += "&paginationInput.pageNumber=";
3766
	url += (index + 1);
3767
	url += "&sortOrder=";
3768
	url += getSortOrder();
3769
	url += "&buyerPostalCode=";
3770
	url += configZip;
3771
	url += "&outputSelector(0)=SellerInfo&outputSelector(1)=StoreInfo";
3772
	if (document.getElementById('searchDescription').checked) {
3773
		url += "&descriptionSearch=true";
3774
	}
3775
 
3776
	url += urlfilter;
3777
 
3778
	var xhttp = new XMLHttpRequest();
3779
 
3780
	xhttp.onreadystatechange = function() {
3781
    	if (this.readyState == 4) {
3782
			if (searchIndex === 0) {
3783
				_cb_PriceActiveItems(JSON.parse(this.responseText));
3784
			} else {
3785
				_cb_PriceCompletedItems(JSON.parse(this.responseText));
3786
			}
3787
        }
3788
    };
3789
 
3790
	xhttp.open("GET", configProxyUrl, true);
3791
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3792
   	xhttp.send();
3793
 
3794
	function waitForMaxPricingPages(i) {
3795
		if (maxPricingPages[i] < 0) {
3796
			window.setTimeout(waitForMaxPricingPages, 500, i); // wait 500 milliseconds
3797
		} else {
3798
			for (index = 1; index < maxPricingPages[searchIndex]; index++) {
3799
				// Construct the request
3800
				var url = configeBayFinding + "?";
3801
				if (searchIndex === 0) {
3802
					if (keyword.includes("ReferenceID:")) {
3803
						url += "OPERATION-NAME=findItemsByProduct";
3804
					} else {
3805
						url += "OPERATION-NAME=findItemsAdvanced";
3806
					}
3807
				} else {
3808
					url += "OPERATION-NAME=findCompletedItems";
3809
				}
3810
				url += "&SECURITY-APPNAME=" + configAppid;
3811
				url += "&GLOBAL-ID=EBAY-US";
3812
				url += "&RESPONSE-DATA-FORMAT=JSON";
3813
				url += "&SERVICE-VERSION=" + configeBayFindingVersion;
3814
				url += "&REST-PAYLOAD";
3815
				keyword = document.getElementById('keyword').value;
3816
				if (keyword.length > 0) {
3817
					if (keyword.includes("ReferenceID:")) {
3818
						url += "&productId.@type=ReferenceID";
3819
						url += "&productId=";
3820
						url += keyword.substr(12);
3821
					} else {
3822
						url += "&keywords=";
3823
						url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
3824
					}
3825
				}
3826
 
3827
				var catNo = 0;
3828
				for (var categoryIndex = 1; categoryIndex < document.getElementById('category').options.length; categoryIndex++) {
3829
					if (document.getElementById('category').options[categoryIndex].selected) {
3830
						url += "&categoryId(" + catNo + ")=";
3831
						url += document.getElementById('category').options[categoryIndex].value;
3832
						++catNo;
3833
					}
3834
				}
3835
 
3836
				url += "&paginationInput.entriesPerPage=100";
3837
				url += "&paginationInput.pageNumber=";
3838
				url += (index + 1);
3839
				url += "&sortOrder=";
3840
				url += getSortOrder();
3841
				url += "&buyerPostalCode=";
3842
				url += configZip;
3843
				url += "&outputSelector(0)=SellerInfo&outputSelector(1)=StoreInfo";
3844
				if (document.getElementById('searchDescription').checked) {
3845
					url += "&descriptionSearch=true";
3846
				}
3847
 
3848
				url += urlfilter;
3849
 
3850
				var xhttp = new XMLHttpRequest();
3851
 
3852
				xhttp.onreadystatechange = function() {
3853
			    	if (this.readyState == 4) {
3854
						if (searchIndex === 0) {
3855
							_cb_PriceActiveItems(JSON.parse(this.responseText));
3856
						} else {
3857
							_cb_PriceCompletedItems(JSON.parse(this.responseText));
3858
						}
3859
			        }
3860
			    };
3861
 
3862
				xhttp.open("GET", configProxyUrl, true);
3863
				xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3864
			   	xhttp.send();			}
3865
		}
3866
	}
3867
 
3868
	waitForMaxPricingPages(searchIndex);
3869
}
3870
 
3871
function _cb_PriceActiveItems(objArray) {
3872
	var array;
3873
 
3874
	if (objArray.findItemsAdvancedResponse !== undefined) {
3875
		array = typeof objArray.findItemsAdvancedResponse[0] != 'object' ? JSON.parse(objArray.findItemsAdvancedResponse[0]) : objArray.findItemsAdvancedResponse[0].searchResult[0].item;
3876
		totalPricingEntries[0] = Number(objArray.findItemsAdvancedResponse[0].paginationOutput[0].totalEntries);
3877
	} else if (objArray.findItemsByProductResponse !== undefined) {
3878
		array = typeof objArray.findItemsByProductResponse[0] != 'object' ? JSON.parse(objArray.findItemsByProductResponse[0]) : objArray.findItemsByProductResponse[0].searchResult[0].item;
3879
		totalPricingEntries[0] = Number(objArray.findItemsByProductResponse[0].paginationOutput[0].totalEntries);
3880
	} else {
3881
		return;
3882
	}
3883
	//	var array = typeof objArray.findItemsAdvancedResponse[0] != 'object' ? JSON.parse(objArray.findItemsAdvancedResponse[0]) : objArray.findItemsAdvancedResponse[0].searchResult[0].item;
3884
	if (totalPricingEntries[0] > 0) {
3885
		priceItem(array, 0);
3886
	}
3887
}
3888
 
3889
function _cb_PriceCompletedItems(objArray) {
3890
	var array = typeof objArray.findCompletedItemsResponse[0] != 'object' ? JSON.parse(objArray.findCompletedItemsResponse[0]) : objArray.findCompletedItemsResponse[0].searchResult[0].item;
3891
	totalPricingEntries[1] = Number(objArray.findCompletedItemsResponse[0].paginationOutput[0].totalEntries);
3892
	if (totalPricingEntries[1] > 0) {
3893
		priceItem(array, 1);
3894
	}
3895
}
3896
 
3897
function priceItem(array, index) {
3898
	var shippingCost = 0.0;
3899
	var itemCost = 0.0;
3900
	var totalCost = 0.0;
3901
	var totalCostInt = 0;
3902
	var sellingStatus;
3903
	var sellingState;
3904
	var bidCount;
3905
	var condInd;
3906
	var conditionId;
3907
 
3908
	if (totalPricingEntries[index] < 1) {
3909
		maxPricingPages[index] = 0;
3910
	} else {
3911
		maxPricingPages[index] = (totalPricingEntries[index] / 100) > 100 ? 100 : Math.trunc(totalPricingEntries[index] / 100.0) + 1;
3912
	}
3913
 
3914
	for (var i = 0; i < array.length; i++) {
3915
		var JsonObj = array[i];
3916
 
3917
		var shippingInfo = JsonObj.shippingInfo;
3918
		var shippingServiceCost = shippingInfo[0].shippingServiceCost;
3919
		if (shippingServiceCost) {
3920
			shippingCost = Number(shippingServiceCost[0].__value__);
3921
		} else {
3922
			shippingCost = 0.0;
3923
		}
3924
 
3925
		sellingStatus = JsonObj.sellingStatus;
3926
		sellingState = sellingStatus[0].sellingState;
3927
		bidCount = sellingStatus[0].bidCount;
3928
		var convertedCurrentPrice = sellingStatus[0].convertedCurrentPrice;
3929
		itemCost = Number(convertedCurrentPrice[0].__value__);
3930
 
3931
		var listingInfo = JsonObj.listingInfo;
3932
		var convertedBuyItNowPrice = listingInfo[0].convertedBuyItNowPrice;
3933
		if (bidCount === 0 && convertedBuyItNowPrice) {
3934
			itemCost = Number(convertedBuyItNowPrice[0].__value__);
3935
		}
3936
 
3937
		var condition = JsonObj.condition;
3938
		if (condition) {
3939
			conditionId = condition[0].conditionId;
3940
			if (conditionId == 1000 || conditionId == 1500 || conditionId == 2750) {
3941
				condInd = 1;
3942
			} else {
3943
				condInd = 2;
3944
			}
3945
		} else {
3946
			condInd = 2;
3947
		}
3948
 
3949
		totalCost = itemCost + shippingCost;
3950
		totalCostInt = Math.ceil(totalCost);
3951
 
3952
		if (sellingState == "Active") {
3953
			if (totalCost < minActive[0] || !minActive[0]) {
3954
				minActive[0] = totalCost;
3955
			}
3956
			if (totalCost > maxActive[0]) {
3957
				maxActive[0] = totalCost;
3958
			}
3959
			avgActive[0] += totalCost;
3960
			++noActive[0];
3961
 
3962
			if (totalCost < minActive[condInd] || !minActive[condInd]) {
3963
				minActive[condInd] = totalCost;
3964
			}
3965
			if (totalCost > maxActive[condInd]) {
3966
				maxActive[condInd] = totalCost;
3967
			}
3968
			avgActive[condInd] += totalCost;
3969
			++noActive[condInd];
3970
 
3971
			if (condInd == 1) {
3972
				if (newActiveBreakdown[totalCostInt] === undefined) {
3973
					newActiveBreakdown[totalCostInt] = 0;
3974
				}
3975
				++newActiveBreakdown[totalCostInt];
3976
			} else {
3977
				if (usedActiveBreakdown[totalCostInt] === undefined) {
3978
					usedActiveBreakdown[totalCostInt] = 0;
3979
				}
3980
				++usedActiveBreakdown[totalCostInt];
3981
			}
3982
		} else if (sellingState == "EndedWithSales") {
3983
			if (totalCost < minSold[0] || !minSold[0]) {
3984
				minSold[0] = totalCost;
3985
			}
3986
			if (totalCost > maxSold[0]) {
3987
				maxSold[0] = totalCost;
3988
			}
3989
			avgSold[0] += totalCost;
3990
			++noSold[0];
3991
 
3992
			if (totalCost < minSold[condInd] || !minSold[condInd]) {
3993
				minSold[condInd] = totalCost;
3994
			}
3995
			if (totalCost > maxSold[condInd]) {
3996
				maxSold[condInd] = totalCost;
3997
			}
3998
			avgSold[condInd] += totalCost;
3999
			++noSold[condInd];
4000
 
4001
			if (condInd == 1) {
4002
				if (newSoldBreakdown[totalCostInt] === undefined) {
4003
					newSoldBreakdown[totalCostInt] = 0;
4004
				}
4005
				++newSoldBreakdown[totalCostInt];
4006
			} else {
4007
				if (usedSoldBreakdown[totalCostInt] === undefined) {
4008
					usedSoldBreakdown[totalCostInt] = 0;
4009
				}
4010
				++usedSoldBreakdown[totalCostInt];
4011
			}
4012
		} else {
4013
			if (totalCost < minUnsold[0] || !minUnsold[0]) {
4014
				minUnsold[0] = totalCost;
4015
			}
4016
			if (totalCost > maxUnsold[0]) {
4017
				maxUnsold[0] = totalCost;
4018
			}
4019
			avgUnsold[0] += totalCost;
4020
			++noUnsold[0];
4021
 
4022
			if (totalCost < minUnsold[condInd] || !minUnsold[condInd]) {
4023
				minUnsold[condInd] = totalCost;
4024
			}
4025
			if (totalCost > maxUnsold[condInd]) {
4026
				maxUnsold[condInd] = totalCost;
4027
			}
4028
			avgUnsold[condInd] += totalCost;
4029
			++noUnsold[condInd];
4030
		}
4031
	}
4032
 
4033
	var x = document.getElementById("prices");
4034
	if (x.className.indexOf("w3-show") == -1) {
4035
		x.className += " w3-show";
4036
	}
4037
 
4038
	var str = '<h2>Pricing Information (Shipping included)</h2>';
4039
	str += '<div id="duplicates">' + duplicateCheckText + '</div>';
4040
	str += '<table class="w3-table-all">';
4041
	str += '	<tr>';
4042
	str += '		<th></th>';
4043
	str += '		<th>Number</th>';
4044
	str += '        <th>Minimum</th>';
4045
	str += '        <th>Maximum</th>';
4046
	str += '        <th>Average</th>';
4047
	str += '	</tr>';
4048
	str += '	<tr>';
4049
	str += '		<td>Active</td>';
4050
	str += '		<td>' + noActive[0] + '<br/>' + noActive[1] + ' / ' + noActive[2] + '</td>';
4051
	str += '		<td>$' + Number(minActive[0]).toFixed(2) + '<br/>$' + Number(minActive[1]).toFixed(2) + ' / $' + Number(minActive[2]).toFixed(2) + '</td>';
4052
	str += '		<td>$' + Number(maxActive[0]).toFixed(2) + '<br/>$' + Number(maxActive[1]).toFixed(2) + ' / $' + Number(maxActive[2]).toFixed(2) + '</td>';
4053
	str += '		<td>';
4054
	if (noActive[0]) {
4055
		str += '$' + Number(avgActive[0] / noActive[0]).toFixed(2);
4056
		str += '<br/>$' + (noActive[1] > 0 ? Number(avgActive[1] / noActive[1]).toFixed(2) : 0.00);
4057
		str += ' / $' + (noActive[2] > 0 ? Number(avgActive[2] / noActive[2]).toFixed(2) : 0.00);
4058
	}
4059
	str += '</td>';
4060
	str += '	</tr>';
4061
 
4062
	str += '<tr><td colspan="5">';
4063
	str += '<canvas id="activeChart"></canvas>';
4064
	str += '</td></tr>';
4065
 
4066
	str += '	<tr>';
4067
	str += '		<td>Sold</td>';
4068
	str += '		<td>' + noSold[0] + '<br/>' + noSold[1] + ' / ' + noSold[2] + '</td>';
4069
	str += '		<td>$' + Number(minSold[0]).toFixed(2) + '<br/>$' + Number(minSold[1]).toFixed(2) + ' / $' + Number(minSold[2]).toFixed(2) + '</td>';
4070
	str += '		<td>$' + Number(maxSold[0]).toFixed(2) + '<br/>$' + Number(maxSold[1]).toFixed(2) + ' / $' + Number(maxSold[2]).toFixed(2) + '</td>';
4071
	str += '		<td>';
4072
	if (noSold[0]) {
4073
		str += '$' + Number(avgSold[0] / noSold[0]).toFixed(2);
4074
		str += '<br/>$' + (noSold[1] > 0 ? Number(avgSold[1] / noSold[1]).toFixed(2) : 0.00);
4075
		str += ' / $' + (noSold[2] > 0 ? Number(avgSold[2] / noSold[2]).toFixed(2) : 0.00);
4076
	}
4077
	str += '</td>';
4078
	str += '	</tr>';
4079
 
4080
	str += '<tr><td colspan="5">';
4081
	str += '<canvas id="soldChart"></canvas>';
4082
	str += '</td></tr>';
4083
 
4084
	str += '	<tr>';
4085
	str += '		<td>Unsold</td>';
4086
	str += '		<td>' + noUnsold[0] + '<br/>' + noUnsold[1] + ' / ' + noUnsold[2] + '</td>';
4087
	str += '		<td>$' + Number(minUnsold[0]).toFixed(2) + '<br/>$' + Number(minUnsold[1]).toFixed(2) + ' / $' + Number(minUnsold[2]).toFixed(2) + '</td>';
4088
	str += '		<td>$' + Number(maxUnsold[0]).toFixed(2) + '<br/>$' + Number(maxUnsold[1]).toFixed(2) + ' / $' + Number(maxUnsold[2]).toFixed(2) + '</td>';
4089
	str += '		<td>';
4090
	if (noUnsold[0]) {
4091
		str += '$' + Number(avgUnsold[0] / noUnsold[0]).toFixed(2);
4092
		str += '<br/>$' + (noUnsold[1] > 0 ? Number(avgUnsold[1] / noUnsold[1]).toFixed(2) : 0.00);
4093
		str += ' / $' + (noUnsold[2] > 0 ? Number(avgUnsold[2] / noUnsold[2]).toFixed(2) : 0.00);
4094
	}
4095
	str += '</td>';
4096
	str += '	</tr>';
4097
	str += '</table>';
4098
 
4099
	x.innerHTML = str;
4100
 
4101
	pricingGraphs(0, usedActiveBreakdown, newActiveBreakdown);
4102
	pricingGraphs(1, usedSoldBreakdown, newSoldBreakdown);
4103
}
4104
 
4105
function pricingGraphs(index, usedBreakdown, newBreakdown) {
4106
	var i;
4107
	var newData = [];
4108
	var usedData = [];
4109
	var labelData = [];
4110
	var ctx = document.getElementById(index === 0 ? 'activeChart' : 'soldChart').getContext('2d');
4111
	var min = findMin(usedBreakdown, newBreakdown);
4112
	var max = findMax(usedBreakdown, newBreakdown);
4113
 
4114
	for (i = min; i < max; i++) {
4115
		labelData.push('<$' + i);
4116
 
4117
		if (usedBreakdown[i] === undefined) {
4118
			usedData.push(0);
4119
		} else {
4120
			usedData.push(usedBreakdown[i]);
4121
		}
4122
 
4123
		if (newBreakdown[i] === undefined) {
4124
			newData.push(0);
4125
		} else {
4126
			newData.push(newBreakdown[i]);
4127
		}
4128
	}
4129
 
4130
	var myChart = new Chart(ctx, {
4131
	  type: 'bar',
4132
	  options: {
4133
	    scales: {
4134
	        yAxes: [{
4135
	            ticks: {
4136
	                fixedStepSize: 1
4137
	            }
4138
	        }],
4139
	    },
4140
	  },
4141
	  data: {
4142
    	labels: labelData,
4143
	    datasets: [{
4144
    	  label: 'Used',
4145
		  data: usedData,
4146
    	  backgroundColor: "rgba(0,102,0,1)"
4147
	    }, {
4148
    	  label: 'New',
4149
	      data: newData,
4150
    	  backgroundColor: "rgba(204,0,0,1)"
4151
	    }]
4152
	  }
4153
	});
4154
}
4155
 
4156
function findMin(Used, New) {
4157
	var i;
4158
	var minUsed = 0, minNew = 0;
4159
	var min = 0;
4160
 
4161
	for (i = 0; i < Used.length; i++) {
4162
		if (Used[i] !== undefined) {
4163
			minUsed = i;
4164
			break;
4165
		}
4166
	}
4167
 
4168
	for (i = 0; i < New.length; i++) {
4169
		if (New[i] !== undefined) {
4170
			minNew = i;
4171
			break;
4172
		}
4173
	}
4174
 
4175
	if (minUsed > 0 && minUsed <= minNew) {
4176
		min = minUsed;
4177
	} else if (minNew > 0 && minNew <= minUsed) {
4178
		min = minNew;
4179
	}
4180
 
4181
	return min;
4182
}
4183
 
4184
function findMax(Used, New) {
4185
	var max = 0;
4186
 
4187
	if (Used.length >= New.length) {
4188
		max = Used.length;
4189
	} else if (New.length >= Used.length) {
4190
		max = New.length;
4191
	}
4192
 
4193
	return max;
4194
}
4195
 
4196
function _cb_findDuplicateListing(root) {
4197
	var x;
4198
	var txt;
4199
	var response = root.findItemsAdvancedResponse[0];
4200
	var ack = response.ack;
4201
	if (ack != 'Success') {
4202
		if (ack == 'Failure' || ack == 'PartialFailure') {
4203
			return;
4204
		}
4205
	}
4206
 
4207
	var items = response.searchResult[0].item || [];
4208
 
4209
	if (Number(response.paginationOutput[0].totalEntries) > 0) {
4210
		var txt = '<p class="w3-red"><strong>Duplicate, see Item Id <a href="https://www.ebay.com/itm/' + items[0].itemId + '" target="_blank">' + items[0].itemId + '</a></strong></p>';
7 - 4211
		document.getElementById("duplicatesText").innerHTML += txt;
4212
		x = document.getElementById("duplicates");
4213
		if (x.className.indexOf("w3-show") == -1) {
4214
			x.className += " w3-show";
4215
		}
2 - 4216
	}
4217
}
4218
 
4219
function findDuplicateListing() {
4220
	var keywordURL;
4221
	var keyword = document.getElementById('keyword').value;
4222
 
4223
	// Construct the request
4224
	url = configeBayFinding + "?";
4225
	url += "OPERATION-NAME=findItemsAdvanced";
4226
	url += "&SERVICE-VERSION=" + configeBayFindingVersion;
4227
	url += "&SECURITY-APPNAME=" + configAppid;
4228
	url += "&GLOBAL-ID=EBAY-US";
4229
	url += "&RESPONSE-DATA-FORMAT=JSON";
4230
	url += "&REST-PAYLOAD";
4231
 
4232
	if (keyword.length > 0) {
4233
		if (keyword.includes("ReferenceID:")) {
4234
			url += "&productId.@type=ReferenceID";
4235
			url += "&productId=";
4236
			url += keyword.substr(12);
4237
		} else {
4238
			url += "&keywords=";
4239
			url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
4240
		}
4241
	}
4242
 
4243
	url += "&paginationInput.entriesPerPage=1";
4244
	url += "&paginationInput.pageNumber=1";
4245
	url += "&itemFilter(0).name=Seller";
4246
	url += "&itemFilter(0).value=";
4247
	url += configeBaySellerName;
4248
	url += "&outputSelector=SellerInfo";
4249
 
4250
	// Submit the request
4251
	var xhttp = new XMLHttpRequest();
4252
 
4253
	xhttp.onreadystatechange = function() {
4254
    	if (this.readyState == 4) {
4255
    		_cb_findDuplicateListing(JSON.parse(this.responseText));
4256
        }
4257
    };
4258
 
4259
	xhttp.open("GET", configProxyUrl, true);
4260
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
4261
   	xhttp.send();
4262
 
4263
	return false;
4264
}
4265
 
4266
function _cb_findPotentialDuplicateListing(root) {
4267
	var x;
4268
	var response = root.findCompletedItemsResponse[0];
4269
	var ack = response.ack;
4270
	if (ack != 'Success') {
4271
		if (ack == 'Failure' || ack == 'PartialFailure') {
4272
			return;
4273
		}
4274
	}
4275
 
4276
	var items = response.searchResult[0].item || [];
4277
 
4278
	if (Number(response.paginationOutput[0].totalEntries) > 0) {
4279
		var txt = '<p class="w3-orange"><strong>Potential Duplicate, see Item Id <a href="https://www.ebay.com/itm/' + items[0].itemId + '" target="_blank">' + items[0].itemId + '</a></strong></p>';
7 - 4280
		document.getElementById("duplicatesText").innerHTML += txt;
4281
		x = document.getElementById("duplicates");
4282
		if (x.className.indexOf("w3-show") == -1) {
4283
			x.className += " w3-show";
4284
		}
2 - 4285
	}
4286
}
4287
 
4288
function findPotentialDuplicateListing() {
4289
	var keywordURL;
4290
	var keyword = document.getElementById('keyword').value;
4291
 
4292
	// Construct the request
4293
	url = configeBayFinding + "?";
4294
	url += "OPERATION-NAME=findCompletedItems";
4295
	url += "&SERVICE-VERSION=" + configeBayFindingVersion;
4296
	url += "&SECURITY-APPNAME=" + configAppid;
4297
	url += "&GLOBAL-ID=EBAY-US";
4298
	url += "&RESPONSE-DATA-FORMAT=JSON";
4299
	url += "&REST-PAYLOAD";
4300
	url += "&keywords=";
4301
	url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
4302
	url += "&paginationInput.entriesPerPage=1";
4303
	url += "&paginationInput.pageNumber=1";
4304
	url += "&itemFilter(0).name=Seller";
4305
	url += "&itemFilter(0).value=";
4306
	url += configeBaySellerName;
4307
	url += "&outputSelector=SellerInfo";
4308
 
4309
	var xhttp = new XMLHttpRequest();
4310
 
4311
	xhttp.onreadystatechange = function() {
4312
    	if (this.readyState == 4) {
4313
    		_cb_findPotentialDuplicateListing(JSON.parse(this.responseText));
4314
        }
4315
    };
4316
 
4317
	xhttp.open("GET", configProxyUrl, true);
4318
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
4319
   	xhttp.send();
4320
	return false;
4321
}
4322
 
7 - 4323
function findShopifyDuplicateListing() { // Barcode Search Only
2 - 4324
	var handle;
4325
	var xhttp = new XMLHttpRequest();
4326
	xhttp.onreadystatechange = function() {
4327
		if (this.readyState == 4 && this.status == 200) {
4328
			//window.alert(this.responseText);
4329
			var json = JSON.parse(this.responseText);
4330
			if (json.products[0] !== undefined) {
7 - 4331
			    var sku = getJsonValue(json.products[0].variants[0].sku);
4332
				var txt = '<p class="w3-orange"><strong>Potential Duplicate, see Shopify Item Id <a href="https://munatrading.com/products/b' + handle + '" target="_blank">' + handle + '</a> (SKU=' + sku + ')</strong></p>';
4333
				document.getElementById("duplicatesText").innerHTML += txt;
4334
        		x = document.getElementById("duplicates");
4335
		        if (x.className.indexOf("w3-show") == -1) {
4336
        			x.className += " w3-show";
4337
		        }
2 - 4338
			}
4339
		}
4340
	};
4341
 
4342
	handle = parseInt(document.getElementById('keyword').value, 10);
4343
 
4344
	xhttp.open("GET", configProxyUrl, true);
7 - 4345
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(configShopifyUrl + configShopifyProductsUrl + '?handle=b' + handle + '&fields=id,variants'));
2 - 4346
	xhttp.send();
4347
}
4348
 
6 - 4349
function checkUPC() {
4350
    if (isValidUpcCode(document.getElementById("keyword").value)) {
4351
        document.getElementById("recommendation").innerHTML = 'Valid UPC Code';
4352
    } else {
7 - 4353
        var res = calculateUpcRes(document.getElementById("keyword").value);
4354
        if (res > -1) {
4355
            document.getElementById("keyword").value += res;
4356
            document.getElementById("recommendation").innerHTML = 'Finalized UPC Code';
4357
        } else {
4358
            document.getElementById("recommendation").innerHTML = 'Invalid UPC Code';
4359
        }
6 - 4360
    }
4361
}
4362
 
4363
function calcUPC() {
7 - 4364
 
6 - 4365
}
4366
 
2 - 4367
    </script>
4368
 
4369
    <script src="js/chosen.jquery.min.js"></script>
4370
    <script src="js/chosen.init.js"></script>
4371
 
4372
</body>
4373
</html>