Subversion Repositories munaweb

Rev

Details | Last modification | View Log | RSS feed

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