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 Quick Listing</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
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
12
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
13
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
14
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
15
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.2/css/bootstrap-select.min.css">
16
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
17
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.2/js/bootstrap-select.js"></script>
18
    <script src="js/XMLWriter.js"></script>
19
    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>
20
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
21
    <link rel="stylesheet" href="css/styleBS.css">
22
    <script src="js/muna-tools.js"></script>
12 - 23
    <style>
24
        .btn-group-sm > .btn, .btn-sm {font-size:small!important}
25
    </style>
10 - 26
</head>
27
 
28
<body style="font-size:80%!important;" onload="return initConfig();" onbeforeunload="return confirmUnload();">
22 - 29
    <div>
30
        <div>
10 - 31
            <div class="container-fluid bg-secondary">
32
                <div class="clearfix">
33
                    <img class="img-fluid float-right" src="images/MUNA%20-%20Logo%20100x100.png" alt="MUNA Trading Logo" />
34
                    <h1 id="connected">eBay Quick Listing
35
                    <input id="login" type="button" class="btn bg-success mb-2 w3-hide" onclick="eBayLogin();" value="Login" /></h1>
36
                </div>
37
            </div>
38
 
39
            <div class="container-fluid bg-light">
12 - 40
                <div class="row">
41
                    <div class="container-fluid border col-6">
42
                        <div class="container-fluid border bg-primary">
43
                            <div class="form-group">
44
                                <form id="searchForm" onsubmit="findOneBay();return false;">
45
                                    <select id="keyword" title="Select Item ..." class="selectpicker mx-2 mt-2 btn-sm" data-style="btn-sm" data-width="fit" data-live-search="true" autofocus="autofocus" onchange="findOneBay();">
46
                                    </select>
47
                                </form>
10 - 48
                            </div>
12 - 49
                        </div>
10 - 50
 
12 - 51
                        <div class="container-fluid border">
52
                            <form id="listForm">
53
                                <div class="mt-2">
54
                                    <label for="category" class="mr-sm-2">Category:</label>
55
                                    <select id="category" name="category" data-placeholder="Select Category..." class="selectpicker mb-2 mr-sm-2" data-style="btn-outline-dark btn-sm" onchange="return categoryValues();" onload="return categoryValues();">
56
                                        <option class="small" value="29792">Audiobooks</option>
57
                                        <option class="small" value="29223">Books Antiquarian &amp; Collectible</option>
58
                                        <option class="small" value="182882">Books Children Young Adults</option>
59
                                        <option class="small" value="171228">Books Fiction Literature</option>
60
                                        <option class="small" value="171243">Books Nonfiction</option>
61
                                        <option class="small" value="268">Books Other</option>
62
                                        <option class="small" value="2228">Books Textbooks, Education</option>
63
                                        <option class="small" selected="selected" value="176984">CDs</option>
64
                                        <option class="small" value="617">DVDs Blu-ray Discs</option>
65
                                        <!--option value="666">Trading Cards Auto Racing</option-->
66
                                        <option class="small" value="213">Trading Cards Baseball</option>
67
                                        <option class="small" value="214">Trading Cards Basketball</option>
68
                                        <!--option value="133072">Trading Cards College</option-->
69
                                        <option class="small" value="215">Trading Cards Football</option>
70
                                        <!--option value="4240">Trading Cards Golf</option-->
71
                                        <option class="small" value="216">Trading Cards Ice Hockey</option>
72
                                        <!--option value="183444">Trading Cards Soccer</option-->
10 - 73
                                    </select>
12 - 74
                                    <label for="format" class="mr-sm-2">Format:</label>
75
                                    <select id="format" name="format" data-placeholder="Select Format..." class="selectpicker mb-2 mr-sm-2" data-style="btn-outline-dark btn-sm" onchange="return categoryValues();" onload="return categoryValues();">
76
                                        <option class="small" value="Chinese">Auction</option>
15 - 77
                                        <option class="small" value="FixedPriceItem" selected>Fixed Price</option>
10 - 78
                                    </select>
79
                                </div>
80
 
12 - 81
                                <div class="mt-2">
82
                                    <div class="clearfix">
83
                                        <a id="image1anchor" href="#" target="_blank"><img id="image1" src="images/default-image.png" alt="(Front Image Missing)" style="max-height:80px;" onload="return pictureLoad(true);" onerror="return pictureLoad(false);" crossorigin="anonymous" /></a>
84
                                        <a id="image2anchor" href="#" target="_blank"><img id="image2" src="images/default-image.png" alt="(Back Image Missing)" style="max-height:80px;" onload="return pictureLoad(true);" onerror="return pictureLoad(false);" crossorigin="anonymous" /></a>
85
                                        <img id="descriptionImage" src="images/default-image.png" alt="(Front/Back Image Missing)" style="max-height:50px;display:inline-block;" onload="return pictureLoad(true);" onerror="return pictureLoad(false); " crossorigin="anonymous" />
86
                                        <a id="image3anchor" class=" invisible" href="#" target="_blank"><img id="image3" src="images/default-image.png" alt="(Optional Image 3)" style="max-height:80px;" crossorigin="anonymous" /></a>
87
                                        <a id="image4anchor" class=" invisible" href="#" target="_blank"><img id="image4" src="images/default-image.png" alt="(Optional Image 4)" style="max-height:80px;" crossorigin="anonymous" /></a>
88
                                        <a id="image5anchor" class=" invisible" href="#" target="_blank"><img id="image5" src="images/default-image.png" alt="(Optional Image 5)" style="max-height:80px;" crossorigin="anonymous" /></a>
89
                                        <a id="image6anchor" class=" invisible" href="#" target="_blank"><img id="image6" src="images/default-image.png" alt="(Optional Image 6)" style="max-height:80px;" crossorigin="anonymous" /></a>
90
                                        <a id="image7anchor" class=" invisible" href="#" target="_blank"><img id="image7" src="images/default-image.png" alt="(Optional Image 7)" style="max-height:80px;" crossorigin="anonymous" /></a>
91
                                        <a id="image8anchor" class=" invisible" href="#" target="_blank"><img id="image8" src="images/default-image.png" alt="(Optional Image 8)" style="max-height:80px;" crossorigin="anonymous" /></a>
92
                                        <a id="image9anchor" class=" invisible" href="#" target="_blank"><img id="image9" src="images/default-image.png" alt="(Optional Image 9)" style="max-height:80px;" crossorigin="anonymous" /></a>
93
                                        <a id="image10anchor" class=" invisible" href="#" target="_blank"><img id="image10" src="images/default-image.png" alt="(Optional Image 10)" style="max-height:80px;" crossorigin="anonymous" /></a>
94
                                    </div>
10 - 95
                                </div>
12 - 96
 
97
                                <div class="mt-2">
98
                                    <label for="title" class="keepTogether mr-sm-2">Title:</label>
99
                                    <input id="title" name="title" type="text" maxlength="80" style="width:90%" onblur="return extractFromTitle();" onKeyPress="printTitleLength()" onKeyUp="printTitleLength()" required>
100
                                    <span id="titleLength" class="small">(0)</span>
10 - 101
                                </div>
12 - 102
 
103
                                <div class="mt-2">
104
                                    <label for="price" class="keepTogether mr-sm-2">Price:</label>
105
                                    <input id="price" name="price" style="width:8%" type="text" required>
106
                                    <label for="bestoffer" class="mr-sm-2">Best Offer:</label>
107
                                    <input id="bestoffer" name="bestoffer" class="checkbox" type="checkbox">
108
                                    <label for="quantity" class="keepTogether mr-sm-2">Quantity:</label>
109
                                    <input id="quantity" name="quantity" style="width:8%" type="text" value="1" maxlength="4" required>
110
                                    <label for="sku" class="keepTogether mr-sm-2">SKU:</label>
111
                                    <input id="sku" name="sku" style="width:12%" type="text" value="Batch X" maxlength="20" required>
112
                                    <label for="conditionId" class="keepTogether mr-sm-2">Condition:</label>
113
                                    <select id="conditionId" name="conditionId" data-placeholder="Select Condition..." class="selectpicker" data-style="btn-outline-dark btn-sm">
114
                                        <option class="small" value="1000">New</option>
115
                                        <option class="small" value="1500">New other (see details)</option>
116
                                        <option class="small" value="1750">New with defects</option>
117
                                        <option class="small" value="2000">Manufacturer refurbished</option>
118
                                        <option class="small" value="2500">Seller refurbished</option>
119
                                        <option class="small" value="2750">Like New</option>
120
                                        <option class="small" value="3000">Used / Pre-owned</option>
121
                                        <option class="small" value="4000">Very Good</option>
122
                                        <option class="small" value="5000">Good</option>
123
                                        <option class="small" value="6000">Acceptable</option>
124
                                        <option class="small" value="7000">For parts or not working</option>
125
                                    </select>
10 - 126
                                </div>
12 - 127
                                <div class="form-group">
128
                                    <label for="condition">Condition Description:</label>
22 - 129
                                    <input id="CdConditionDescriptionSingular" type="button" class="btn btn-dark btn-xs border rounded-circle mx-2 w3-hide" onclick="return setCdConditionDescription('S');" value="S" />
130
                                    <input id="CdConditionDescriptionPlural" type="button" class="btn btn-dark btn-xs border rounded-circle mx-2 w3-hide" onclick="return setCdConditionDescription('P');" value="P" />
131
                                    <input id="CdConditionDescriptionDigipak" type="button" class="btn btn-dark btn-xs border rounded-circle mx-2 w3-hide" onclick="return setCdConditionDescription('D');" value="D" />
132
                                    <input id="CdConditionDescriptionNewCase" type="button" class="btn btn-dark btn-xs border rounded-circle mx-2 w3-hide" onclick="return setCdConditionDescription('N');" value="N" />
12 - 133
                                    <textarea id="condition" name="condition" class="form-control" style="font-size:95%!important" rows="2" maxlength="1000" required></textarea>
10 - 134
                                </div>
135
                            </form>
12 - 136
                            <div id="bookDetails" class="container-fluid  ">
137
                                <form id="bookForm" class="form-fluid">
138
                                    <div>
139
                                        <label for="bookISBN" class="keepTogether mr-sm-2">ISBN:</label>
140
                                        <input id="bookISBN" name="bookISBN" style="width:13%" type="text" disabled>
141
                                        <label for="bookFormat" class="keepTogether mr-sm-2">Format:</label>
142
                                        <select id="bookFormat" name="bookFormat" data-placeholder="Select Format..." class="selectpicker" data-style="btn-outline-dark btn-sm">
143
                                            <option class="small" value="Hardcover">Hardcover</option>
144
                                            <option class="small" value="Paperback">Paperback</option>
145
                                            <option class="small" value="CD-ROM (Non-Audio)">CD-ROM (Non-Audio)</option>
146
                                            <option class="small" value="Mixed Lot">Mixed Lot</option>
147
                                            <option class="small" value="Board Book">Board Book</option>
148
                                            <option class="small" value="Loose-Leaf">Loose-Leaf</option>
149
                                            <option class="small" value="Postcard Book">Postcard Book</option>
150
                                            <option class="small" value="Shrink-Wrapped Pack">Shrink-Wrapped Pack</option>
151
                                        </select>
152
                                        <label for="bookAuthor" class="keepTogether mr-sm-2">Author:</label>
153
                                        <input id="bookAuthor" name="bookAuthor" style="width:29%" type="text" maxlength="40">
154
                                        <label for="bookPublicationYear" class="keepTogether mr-sm-2">Year:</label>
155
                                        <input id="bookPublicationYear" name="bookPublicationYear" style="width:8%" type="text" maxlength="4">
156
                                    </div>
157
                                    <div>
158
                                        <label for="bookSubject" class="keepTogether mr-sm-2">Subject:</label>
159
                                        <select id="bookSubject" name="bookSubject" data-placeholder="Select Subject..." class="selectpicker" data-style="btn-outline-dark btn-sm">
160
                                            <option class="small" value="Activity &amp; Coloring Books">Activity & Coloring Books</option>
161
                                            <option class="small" value="Architecture &amp; Design">Architecture & Design</option>
162
                                            <option class="small" value="Art &amp; Photography">Art & Photography</option>
163
                                            <option class="small" value="Biography &amp; Autobiography">Biography & Autobiography</option>
164
                                            <option class="small" value="Books on Collecting">Books on Collecting</option>
165
                                            <option class="small" value="Business &amp; Economics">Business & Economics</option>
166
                                            <option class="small" value="Computers &amp; Internet">Computers & Internet</option>
167
                                            <option class="small" value="Cooking, Food &amp; Wine">Cooking, Food & Wine</option>
168
                                            <option class="small" value="Erotica">Erotica</option>
169
                                            <option class="small" value="Family &amp; Relationships">Family & Relationships</option>
170
                                            <option class="small" value="Games &amp; Puzzles">Games & Puzzles</option>
171
                                            <option class="small" value="Health &amp; Fitness">Health & Fitness</option>
172
                                            <option class="small" value="History">History</option>
173
                                            <option class="small" value="Hobbies &amp; Crafts">Hobbies & Crafts</option>
174
                                            <option class="small" value="Home &amp; Garden">Home & Garden</option>
175
                                            <option class="small" value="Humor">Humor</option>
176
                                            <option class="small" value="Law &amp; Government">Law & Government</option>
177
                                            <option class="small" value="Library &amp; Information Science">Library & Information Science</option>
178
                                            <option class="small" value="Literary Criticism">Literary Criticism</option>
179
                                            <option class="small" value="Literature">Literature</option>
180
                                            <option class="small" value="Medical">Medical</option>
181
                                            <option class="small" value="Military &amp; War">Military & War</option>
182
                                            <option class="small" value="Novel">Novel</option>
183
                                            <option class="small" value="Outdoor &amp; Nature">Outdoor & Nature</option>
184
                                            <option class="small" value="Paranormal &amp; Metaphysical">Paranormal & Metaphysical</option>
185
                                            <option class="small" value="Performing Arts">Performing Arts</option>
186
                                            <option class="small" value="Pets &amp; Animal Care">Pets & Animal Care</option>
187
                                            <option class="small" value="Philosophy">Philosophy</option>
188
                                            <option class="small" value="Psychology">Psychology</option>
189
                                            <option class="small" value="Reference">Reference</option>
190
                                            <option class="small" value="Religion &amp; Spirituality">Religion & Spirituality</option>
191
                                            <option class="small" value="Science &amp; Technology">Science & Technology</option>
192
                                            <option class="small" value="Self-Help">Self-Help</option>
193
                                            <option class="small" value="Sexuality">Sexuality</option>
194
                                            <option class="small" value="Social Sciences">Social Sciences</option>
195
                                            <option class="small" value="Sports &amp; Recreation">Sports & Recreation</option>
196
                                            <option class="small" value="Teaching &amp; Education">Teaching & Education</option>
197
                                            <option class="small" value="Transportation">Transportation</option>
198
                                            <option class="small" value="Travel, Geography &amp; Exploration">Travel, Geography & Exploration</option>
199
                                            <option class="small" value="True Crime">True Crime</option>
200
                                            <option class="small" value="Vintage Paperbacks">Vintage Paperbacks</option>
201
                                        </select>
202
                                        <label for="bookLanguage" class="keepTogether mr-sm-2">Language:</label>
203
                                        <input id="bookLanguage" name="bookLanguage" style="width:20%" type="text">
204
                                        <label for="bookCountry" class="keepTogether mr-sm-2">Country:</label>
205
                                        <input id="bookCountry" name="bookCountry" style="width:25%" type="text" maxlength="65">
206
                                    </div>
10 - 207
 
17 - 208
                                    <div class="border">
12 - 209
                                        <div class="form-check-inline">
210
                                            <label class="form-check-label">Special Attributes:</label>
211
                                        </div>
212
                                        <div class="form-check-inline">
213
                                            <label class="form-check-label" for="bookDustJacket">
214
                                                <input id="bookDustJacket" name="bookDustJacket" class="form-check-input" type="checkbox">Dust Jacket
215
                                            </label>
216
                                        </div>
217
                                        <div class="form-check-inline">
218
                                            <label class="form-check-label" for="bookIllustrated">
219
                                                <input id="bookIllustrated" name="bookIllustrated" class="form-check-input" type="checkbox">Illustrated
220
                                            </label>
221
                                        </div>
222
                                        <div class="form-check-inline">
223
                                            <label class="form-check-label" for="bookLargePrint">
224
                                                <input id="bookLargePrint" name="bookLargePrint" class="form-check-input" type="checkbox">Large Print
225
                                            </label>
226
                                        </div>
227
                                        <div class="form-check-inline">
228
                                            <label class="form-check-label" for="bookSigned">
229
                                                <input id="bookSigned" name="bookSigned" class="form-check-input" type="checkbox">Signed
230
                                            </label>
231
                                        </div>
232
                                    </div>
233
                                </form>
10 - 234
                            </div>
12 - 235
                            <div id="cdDetails" class="container-fluid  ">
236
                                <form id="cdForm" class="form-fluid">
237
                                    <div>
238
                                        <label for="cdUPC" class="keepTogether w3-hide">UPC:</label>
239
                                        <input id="cdUPC" name="cdUPC" class="w3-hide" type="text" disabled>
240
                                        <label for="cdArtist" class="keepTogether mr-sm-2">Artist:</label>
241
                                        <input id="cdArtist" name="cdArtist" style="width:30%" type="text" maxlength="40">
242
                                        <label for="cdTitle" class="keepTogether mr-sm-2">Title:</label>
243
                                        <input id="cdTitle" name="cdTitle" style="width:30%" type="text" maxlength="65">
244
                                        <label for="cdRecordLabel" class="keepTogether mr-sm-2">Label:</label>
245
                                        <input id="cdRecordLabel" name="cdRecordLabel" style="width:20%" type="text" maxlength="40">
246
                                    </div>
247
                                    <div>
248
                                        <label for="cdReleaseYear" class="keepTogether mr-sm-2">Year:</label>
249
                                        <input id="cdReleaseYear" name="cdReleaseYear" type="text" style="width:6%" maxlength="4">
250
                                        <label for="cdDuration" class="keepTogether mr-sm-2">Duration:</label>
251
                                        <select id="cdDuration" name="cdDuration" data-placeholder="Select Duration..." class="selectpicker" data-width="auto" data-style="btn-outline-dark btn-sm">
252
                                            <option class="small" value="Album" selected>Album</option>
253
                                            <option class="small" value="Mini Album">Mini Album</option>
254
                                            <option class="small" value="Box Set">Box Set</option>
255
                                            <option class="small" value="EP">EP</option>
256
                                            <option class="small" value="Single">Single</option>
257
                                            <option class="small" value="Maxi-Single">Maxi-Single</option>
258
                                        </select>
259
                                        <label for="cdGenre" class="keepTogether mr-sm-2">Genre:</label>
260
                                        <select id="cdGenre" name="cdGenre" data-placeholder="Select Genre..." class="selectpicker" data-width="auto" data-style="btn-outline-dark btn-sm">
261
                                            <option class="small" value="Blues">Blues</option>
262
                                            <option class="small" value="Children&apos;s">Children's</option>
263
                                            <option class="small" value="Classical">Classical</option>
264
                                            <option class="small" value="Comedy &amp; Spoken Word">Comedy & Spoken Word</option>
265
                                            <option class="small" value="Country">Country</option>
266
                                            <option class="small" value="Dance &amp; Electronica">Dance & Electronica</option>
267
                                            <option class="small" value="Folk">Folk</option>
268
                                            <option class="small" value="Holiday">Holiday</option>
269
                                            <option class="small" value="Jazz">Jazz</option>
270
                                            <option class="small" value="Latin">Latin</option>
271
                                            <option class="small" value="Metal">Metal</option>
272
                                            <option class="small" value="Military">Military</option>
273
                                            <option class="small" value="New Age &amp; Easy Listening">New Age & Easy Listening</option>
274
                                            <option class="small" value="Pop">Pop</option>
275
                                            <option class="small" value="R&amp;B &amp; Soul">R&B & Soul</option>
276
                                            <option class="small" value="Rap &amp; Hip-Hop">Rap & Hip-Hop</option>
277
                                            <option class="small" value="Reggae, Ska &amp; Dub">Reggae, Ska & Dub</option>
278
                                            <option class="small" value="Religious &amp; Devotional">Religious & Devotional</option>
279
                                            <option class="small" value="Rock">Rock</option>
280
                                            <option class="small" value="Soundtracks &amp; Musicals">Soundtracks & Musicals</option>
281
                                            <option class="small" value="Sound Effects &amp; Nature">Sound Effects & Nature</option>
282
                                            <option class="small" value="World Music">World Music</option>
283
                                        </select>
284
                                        <label for="cdCountry" class="keepTogether mr-sm-2">Country:</label>
285
                                        <input id="cdCountry" name="cdCountry" type="text" style="width:16%" maxlength="65">
286
                                    </div>
10 - 287
 
17 - 288
                                    <div class="border">
12 - 289
                                        <span>Special Attributes:<br/></span>
290
                                        <div class="form-check-inline">
291
                                            <label class="form-check-label" for="cdCompilation">
292
                                                <input id="cdCompilation" name="cdCompilation" class="form-check-input" type="checkbox">Compilation
293
                                            </label>
10 - 294
                                        </div>
12 - 295
                                        <div class="form-check-inline">
296
                                            <label class="form-check-label" for="cdDigipak">
297
                                                <input id="cdDigipak" name="cdDigipak" class="form-check-input" type="checkbox">Digipak
298
                                            </label>
299
                                        </div>
300
                                        <div class="form-check-inline">
301
                                            <label class="form-check-label" for="cdDualDisc">
302
                                                <input id="cdDualDisc" name="cdDualDisc" class="form-check-input" type="checkbox">DualDisc
303
                                            </label>
304
                                        </div>
305
                                        <div class="form-check-inline">
306
                                            <label class="form-check-label" for="cdEnhanced">
307
                                                <input id="cdEnhanced" name="cdEnhanced" class="form-check-input" type="checkbox">Enhanced
308
                                            </label>
309
                                        </div>
310
                                        <div class="form-check-inline">
311
                                            <label class="form-check-label" for="cdLiveRecording">
312
                                                <input id="cdLiveRecording" name="cdLiveRecording" class="form-check-input" type="checkbox">Live
313
                                            </label>
314
                                        </div>
315
                                        <div class="form-check-inline">
316
                                            <label class="form-check-label" for="cdPromo">
317
                                                <input id="cdPromo" name="cdPromo" class="form-check-input" type="checkbox">Promo
318
                                            </label>
319
                                        </div>
320
                                        <div class="form-check-inline">
321
                                            <label class="form-check-label" for="cdReissue">
322
                                                <input id="cdReissue" name="cdReissue" class="form-check-input" type="checkbox">Reissue
323
                                            </label>
324
                                        </div>
325
                                        <div class="form-check-inline">
326
                                            <label class="form-check-label" for="cdRemastered">
327
                                                <input id="cdRemastered" name="cdRemastered" class="form-check-input" type="checkbox">Remastered
328
                                            </label>
329
                                        </div>
330
                                        <div class="form-check-inline">
331
                                            <label class="form-check-label" for="cdHDCD">
332
                                                <input id="cdHDCD" name="cdHDCD" class="form-check-input" type="checkbox">HDCD
333
                                            </label>
334
                                        </div>
335
                                        <div class="form-check-inline">
336
                                            <label class="form-check-label" for="cdGreatestHits">
337
                                                <input id="cdGreatestHits" name="cdGreatestHits" class="form-check-input" type="checkbox">Greatest Hits
338
                                            </label>
339
                                        </div>
340
                                    </div>
341
 
342
                                    <div>
343
                                        <div class="container-fluid row">
344
                                            <div class="container-fluid col-6">
345
                                                <label for="cdTracksFormat" class="mb-2 mr-sm-2">Track List (optional):</label>
346
                                                <input id="cdTracksFormat" type="button" class="btn btn-dark btn-xs border rounded-circle mb-2 mr-sm-2" onclick="return formatTrackList();" value="Format" />
347
                                                <input id="cdUnorderedTrackList" name="cdUnorderedTrackList" class="mb-2" type="checkbox" onchange="return updateTracklistPreview();">
348
                                                <label for="cdUnorderedTrackList" class="mb-2 mr-sm-2">Unordered</label>
349
                                                <textarea id="cdTracks" name="cdTracks" class="form-control" style="font-size:95%!important" rows="12"></textarea>
10 - 350
                                            </div>
12 - 351
                                            <div class="container-fluid col-6">
352
                                                <p>Preview:</p>
353
                                                <div class="border">
354
                                                    <p id="tracklistPreview"></p>
355
                                                </div>
356
                                            </div>
10 - 357
                                        </div>
358
                                    </div>
12 - 359
                                </form>
360
                            </div>
361
                            <div id="dvdDetails" class="container-fluid  ">
362
                                <form id="dvdForm" class="form-fluid">
363
                                    <div>
364
                                        <label for="dvdUPC" class="keepTogether mr-sm-2">UPC:</label>
365
                                        <input id="dvdUPC" name="dvdUPC" style="width:13%" type="text" disabled>
366
                                        <label for="dvdFormat" class="keepTogether mr-sm-2">Format:</label>
367
                                        <select id="dvdFormat" name="dvdFormat" data-placeholder="Select Format..." class="selectpicker" data-style="btn-outline-dark btn-sm">
368
                                            <option class="small" value="Blu-ray Disc">Blu-ray Disc</option>
369
                                            <option class="small" value="DVD" selected>DVD</option>
370
                                            <option class="small" value="HD DVD">HD DVD</option>
371
                                            <option class="small" value="UltraViolet Code">UltraViolet Code</option>
372
                                        </select>
373
                                        <label for="dvdTitle" class="keepTogether mr-sm-2">Title:</label>
374
                                        <input id="dvdTitle" name="dvdTitle" style="width:44%" type="text" maxlength="65">
375
                                    </div>
376
                                    <div>
377
                                        <label for="dvdActor" class="keepTogether mr-sm-2">Actor:</label>
378
                                        <input id="dvdActor" name="dvdActor" style="width:30%" type="text" maxlength="65">
379
                                        <label for="dvdLeadingRole" class="keepTogether mr-sm-2">Lead:</label>
380
                                        <input id="dvdLeadingRole" name="dvdLeadingRole" style="width:30%" type="text" maxlength="65">
381
                                        <label for="dvdDirector" class="keepTogether mr-sm-2">Director:</label>
382
                                        <input id="dvdDirector" name="dvdDirector" style="width:20%" type="text" maxlength="65">
383
                                    </div>
384
                                    <div>
385
                                        <label for="dvdReleaseYear" class="keepTogether mr-sm-2">Movie Year:</label>
386
                                        <input id="dvdReleaseYear" name="dvdReleaseYear" style="width:8%" type="text" maxlength="4">
387
                                        <label for="dvdDVDEditionYear" class="keepTogether mr-sm-2">DVD Year:</label>
388
                                        <input id="dvdDVDEditionYear" name="dvdDVDEditionYear" style="width:8%" type="text" maxlength="4">
389
                                        <label for="dvdGenre" class="keepTogether mr-sm-2">Genre:</label>
390
                                        <select id="dvdGenre" name="dvdGenre" data-placeholder="Select Genre..." class="selectpicker" data-style="btn-outline-dark btn-sm">
391
                                            <option class="small" value="Action &amp; Adventure">Action & Adventure</option>
392
                                            <option class="small" value="Animation &amp; Anime">Animation & Anime</option>
393
                                            <option class="small" value="Children&apos;s &amp; Family">Children's & Family</option>
394
                                            <option class="small" value="Comedy">Comedy</option>
395
                                            <option class="small" value="Documentary">Documentary</option>
396
                                            <option class="small" value="Drama">Drama</option>
397
                                            <option class="small" value="Educational">Educational</option>
398
                                            <option class="small" value="Exercise &amp; Fitness">Exercise & Fitness</option>
399
                                            <option class="small" value="Foreign Language">Foreign Language</option>
400
                                            <option class="small" value="Horror">Horror</option>
401
                                            <option class="small" value="Music &amp; Concerts">Music & Concerts</option>
402
                                            <option class="small" value="Musicals &amp; Broadway">Musicals & Broadway</option>
403
                                            <option class="small" value="Romance">Romance</option>
404
                                            <option class="small" value="Sci-Fi &amp; Fantasy">Sci-Fi & Fantasy</option>
405
                                            <option class="small" value="Sports">Sports</option>
406
                                            <option class="small" value="Thriller &amp; Mystery">Thriller & Mystery</option>
407
                                            <option class="small" value="TV Shows">TV Shows</option>
408
                                            <option class="small" value="Westerns">Westerns</option>
409
                                        </select>
410
                                        <label for="dvdRating" class="keepTogether mr-sm-2">Rating:</label>
411
                                        <select id="dvdRating" name="dvdRating" data-placeholder="Select Rating..." class="selectpicker" data-style="btn-outline-dark btn-sm">
412
                                            <option class="small" value="G">G</option>
413
                                            <option class="small" value="PG">PG</option>
414
                                            <option class="small" value="PG-13">PG-13</option>
415
                                            <option class="small" value="R">R</option>
416
                                            <option class="small" value="NR">NR</option>
417
                                            <option class="small" value="NC-17">NC-17</option>
418
                                            <option class="small" value="TV-Y">TV-Y</option>
419
                                            <option class="small" value="TV-Y7">TV-Y7</option>
420
                                            <option class="small" value="TV-G">TV-G</option>
421
                                            <option class="small" value="TV-PG">TV-PG</option>
422
                                            <option class="small" value="TV-14">TV-14</option>
423
                                            <option class="small" value="TV-MA">TV-MA</option>
424
                                        </select>
425
                                    </div>
426
                                    <div>
427
                                        <label for="dvdRegionCode" class="keepTogether mr-sm-2">Region:</label>
428
                                        <select id="dvdRegionCode" name="dvdRegionCode" data-placeholder="Select Region..." class="selectpicker" data-width="auto" data-style="btn-outline-dark btn-sm">
429
                                            <option class="small" value="Blu-ray: Region Free">Blu-ray: Region Free</option>
430
                                            <option class="small" value="Blu-ray: A (Americas, Southeast Asia...)">Blu-ray: A</option>
431
                                            <option class="small" value="Blu-ray: B (Europe, AU, NZ, Africa...)">Blu-ray: B</option>
432
                                            <option class="small" value="Blu-ray: C (China, Russia, India...)">Blu-ray: C</option>
433
                                            <option class="small" value="DVD: 0/All (Region Free/Worldwide)">DVD: 0/All</option>
434
                                            <option class="small" value="DVD: 1 (US, Canada...)" selected>DVD: 1</option>
435
                                            <option class="small" value="DVD: 2 (Europe, Japan, Middle East...)">DVD: 2</option>
436
                                            <option class="small" value="DVD: 3 (Southeast Asia, Taiwan, HK...)">DVD: 3</option>
437
                                            <option class="small" value="DVD: 4 (AU, NZ, Latin America...)">DVD: 4</option>
438
                                            <option class="small" value="DVD: 5 (Russia, India, Africa...)">DVD: 5</option>
439
                                            <option class="small" value="DVD: 6 (China)">DVD: 6 (China)</option>
440
                                        </select>
441
                                        <label for="dvdRental" class="keepTogether mr-sm-2">Rental:</label>
442
                                        <select id="dvdRental" name="dvdRental" class="selectpicker" data-width="fit" data-style="btn-outline-dark btn-sm">
443
                                            <option class="small" value="No" selected>No</option>
444
                                            <option class="small" value="Yes">Yes</option>
445
                                        </select>
446
                                        <label for="dvdSeason" class="keepTogether mr-sm-2">Season:</label>
447
                                        <select id="dvdSeason" name="dvdSeason" data-placeholder="Select Season..." class="selectpicker" data-width="auto" data-style="btn-outline-dark btn-sm">
22 - 448
                                            <option class="small" value="" selected></option>
12 - 449
                                            <option class="small" value="Complete Series Box Set">Complete Series Box Set</option>
450
                                            <option class="small" value="1">1</option>
451
                                            <option class="small" value="2">2</option>
452
                                            <option class="small" value="3">3</option>
453
                                            <option class="small" value="4">4</option>
454
                                            <option class="small" value="5">5</option>
455
                                            <option class="small" value="6">6</option>
456
                                            <option class="small" value="7">7</option>
457
                                            <option class="small" value="8">8</option>
458
                                            <option class="small" value="9">9</option>
459
                                            <option class="small" value="10">10</option>
460
                                            <option class="small" value="11">11</option>
461
                                            <option class="small" value="12">12</option>
462
                                            <option class="small" value="13">13</option>
463
                                            <option class="small" value="14">14</option>
464
                                            <option class="small" value="15">15</option>
465
                                            <option class="small" value="16">16</option>
466
                                            <option class="small" value="17">17</option>
467
                                            <option class="small" value="18">18</option>
468
                                            <option class="small" value="19">19</option>
469
                                            <option class="small" value="20">20</option>
470
                                            <option class="small" value="21">21</option>
471
                                            <option class="small" value="22">22</option>
472
                                            <option class="small" value="23">23</option>
473
                                            <option class="small" value="24">24</option>
474
                                        </select>
475
                                        <label for="dvdCountry" class="keepTogether mr-sm-2">Country:</label>
476
                                        <input id="dvdCountry" name="dvdCountry" style="width:14%" type="text" maxlength="65">
477
                                    </div>
478
 
17 - 479
                                    <div class="border">
12 - 480
                                        <div class="form-check-inline">
481
                                            <label class="form-check-label">Special Attributes:</label>
482
                                        </div>
483
                                        <div class="form-check-inline">
484
                                            <label class="form-check-label" for="dvd3D">
485
                                                <input id="dvd3D" name="dvd3D" class="form-check-input" type="checkbox">3D
486
                                            </label>
487
                                        </div>
488
                                        <div class="form-check-inline">
489
                                            <label class="form-check-label" for="dvdAnniversaryEdition">
490
                                                <input id="dvdAnniversaryEdition" name="dvdAnniversaryEdition" class="form-check-input" type="checkbox">Anniversary Edition
491
                                            </label>
492
                                        </div>
493
                                        <div class="form-check-inline">
494
                                            <label class="form-check-label" for="dvdBoxSet">
495
                                                <input id="dvdBoxSet" name="dvdBoxSet" class="form-check-input" type="checkbox">Box Set
496
                                            </label>
497
                                        </div>
498
                                        <div class="form-check-inline">
499
                                            <label class="form-check-label" for="dvdCollectorsEdition">
500
                                                <input id="dvdCollectorsEdition" name="dvdCollectorsEdition" class="form-check-input" type="checkbox">Collector's Edition
501
                                            </label>
502
                                        </div>
503
                                        <div class="form-check-inline">
504
                                            <label class="form-check-label" for="dvdDeluxeEdition">
505
                                                <input id="dvdDeluxeEdition" name="dvdDeluxeEdition" class="form-check-input" type="checkbox">Deluxe Edition
506
                                            </label>
507
                                        </div>
508
                                        <div class="form-check-inline">
509
                                            <label class="form-check-label" for="dvdDirectorsCut">
510
                                                <input id="dvdDirectorsCut" name="dvdDirectorsCut" class="form-check-input" type="checkbox">Director's Cut
511
                                            </label>
512
                                        </div>
513
                                        <div class="form-check-inline">
514
                                            <label class="form-check-label" for="dvdExtendedEdition">
515
                                                <input id="dvdExtendedEdition" name="dvdExtendedEdition" class="form-check-input" type="checkbox">Extended Edition
516
                                            </label>
517
                                        </div>
518
                                        <div class="form-check-inline">
519
                                            <label class="form-check-label" for="dvdFullScreen">
520
                                                <input id="dvdFullScreen" name="dvdFullScreen" class="form-check-input" type="checkbox">Full Screen
521
                                            </label>
522
                                        </div>
523
                                        <div class="form-check-inline">
524
                                            <label class="form-check-label" for="dvdLimitedEdition">
525
                                                <input id="dvdLimitedEdition" name="dvdLimitedEdition" class="form-check-input" type="checkbox">Limited Edition
526
                                            </label>
527
                                        </div>
528
                                        <div class="form-check-inline">
529
                                            <label class="form-check-label" for="dvdPromo">
530
                                                <input id="dvdPromo" name="dvdPromo" class="form-check-input" type="checkbox">Promo
531
                                            </label>
532
                                        </div>
533
                                        <div class="form-check-inline">
534
                                            <label class="form-check-label" for="dvdSignatureCollection">
535
                                                <input id="dvdSignatureCollection" name="dvdSignatureCollection" class="form-check-input" type="checkbox">Signature Collection
536
                                            </label>
537
                                        </div>
538
                                        <div class="form-check-inline">
539
                                            <label class="form-check-label" for="dvdSpecialEdition">
540
                                                <input id="dvdSpecialEdition" name="dvdSpecialEdition" class="form-check-input" type="checkbox">Special Edition
541
                                            </label>
542
                                        </div>
543
                                        <div class="form-check-inline">
544
                                            <label class="form-check-label" for="dvdSteelbook">Steelbook
545
                                                <input id="dvdSteelbook" name="dvdSteelbook" class="form-check-input" type="checkbox">
546
                                            </label>
547
                                        </div>
548
                                        <div class="form-check-inline">
549
                                            <label class="form-check-label" for="dvdUnratedEdition">
550
                                                <input id="dvdUnratedEdition" name="dvdUnratedEdition" class="form-check-input" type="checkbox">Unrated Edition
551
                                            </label>
552
                                        </div>
553
                                        <div class="form-check-inline">
554
                                            <label class="form-check-label" for="dvdWidescreen">
555
                                                <input id="dvdWidescreen" name="dvdWidescreen" class="form-check-input" type="checkbox">Widescreen
556
                                            </label>
557
                                        </div>
558
                                    </div>
559
                                </form>
560
                            </div>
561
                            <div id="tradingCardDetails" class="container-fluid   w3-hide">
562
                                <form id="tradingCardForm" class="form-fluid">
563
                                    <div>
564
                                        <label for="tcPlayer" class="keepTogether mr-sm-2">Player:</label>
565
                                        <input id="tcPlayer" name="tcPlayer" style="width:29%" type="text">
566
                                        <label for="tcPosition" class="keepTogether mr-sm-2">Position:</label>
567
                                        <input id="tcPosition" name="tcPosition" style="width:8%" type="text">
568
                                        <label for="tcTeam" class="keepTogether mr-sm-2">Team:</label>
569
                                        <input id="tcTeam" name="tcTeam" style="width:29%" type="text">
570
                                        <label for="tcSeason" class="keepTogether mr-sm-2">Season:</label>
571
                                        <input id="tcSeason" name="tcSeason" style="width:8%" type="text">
572
                                    </div>
573
                                    <div>
574
                                        <label for="tcManufacturer" class="keepTogether mr-sm-2">Manufacturer:</label>
575
                                        <input id="tcManufacturer" name="tcManufacturer" style="width:30%" type="text">
576
                                        <label for="tcNumber" class="keepTogether mr-sm-2">Number:</label>
577
                                        <input id="tcNumber" name="tcNumber" style="width:8%" type="text">
578
                                        <label for="tcSeries" class="keepTogether mr-sm-2">Series:</label>
579
                                        <input id="tcSeries" name="tcSeries" style="width:30%" type="text">
580
                                    </div>
581
                                    <div>
582
                                        <div class="form-check-inline">
583
                                            <label class="form-check-label" for="tcPoA">
584
                                                <input id="tcPoA" name="tcPoA" class="form-check-input" type="checkbox">Piece of Authentic
585
                                            </label>
586
                                        </div>
587
                                        <div class="form-check-inline">
588
                                            <label class="form-check-label" for="tcRookie">
589
                                                <input id="tcRookie" name="tcRookie" class="form-check-input" type="checkbox">Rookie
590
                                            </label>
591
                                        </div>
592
                                        <div class="form-check-inline">
593
                                            <label class="form-check-label" for="tcSerial">
594
                                                <input id="tcSerial" name="tcSerial" class="form-check-input" type="checkbox">Serialized
595
                                            </label>
596
                                        </div>
597
                                    </div>
598
                                </form>
599
                            </div>
19 - 600
                            <div id="results" class="container-fluid w3-hide"></div>
10 - 601
                        </div>
602
 
12 - 603
                        <div class="clearfix">
604
                            <input id="verify" type="submit" class="btn btn-danger" onclick="verifyListingImage();" value="Verify" />
22 - 605
                            <input id="list" type="button" class="btn btn-danger mx-3" onclick="submitListing(0);" value="List" />
606
                            <input id="savexml" type="button" class="btn btn-danger mx-2" onclick="submitListing(1);" value="XML" />
12 - 607
                            <input type="button" class="btn btn-dark float-right" onclick="resetForm()" value="Reset form" />
10 - 608
                        </div>
12 - 609
 
10 - 610
                    </div>
611
 
12 - 612
                    <div class="container-fluid col-6">
17 - 613
                        <div class="container border bg-light">
614
                            <div id="productinfo"></div>
615
                            <div id="productinfoSearch"></div>
616
                            <div id="productinfoDuplicate"></div>
617
                        </div>
12 - 618
                        <div id="discogsReleases" class="container border w3-hide"></div>
619
                        <div id="prices" class="container border w3-hide"></div>
10 - 620
                    </div>
621
                </div>
622
            </div>
623
 
624
        </div>
625
 
626
        <footer class="container-fluid text-center border border-bottom-0 border-left-0 border-right-0">
17 - 627
            <div w3-include-html="php/footer.php"></div>
10 - 628
        </footer>
629
 
630
    </div>
12 - 631
 
10 - 632
    <script>
633
 
634
// Globals
635
var picturesAreLoaded = false;
636
var xml = '';
637
var category = '';
638
var catalogTitle = '';
639
var catalogActorNames = '';
640
var listItems = [];
641
var additionalPictures = [];
642
var isManualMode = false;
643
var isDuplicate = false;
644
var eBayProductId = '';
645
 
646
var CC = -1; /* 0=Book, 1=CD, 2=DVD, 3=Trading Card */
647
var ShippingProfileIdList = ['146987753023', '146987646023', '146987753023', '125181485023'];
648
var ShippingProfileNameList = ['Free Economy Shipping', 'Free Standard Shipping', 'Free Economy Shipping', 'Trading Card without Tracking Number'];
649
var MinPriceList = ['5.98', '5.48', '5.48', '0.99'];
650
var ProductListingDetailsNameList = ['ISBN', 'UPC', 'UPC', 'UPC'];
651
var StoreCategoryList = ['30460217018', '30432075018', '30606323018', '1'];
652
var movieFormats = ["DVD", "Blu-ray Disc", "HD DVD"];
653
var auctionFormat = ['FixedPriceItem', 'FixedPriceItem', 'FixedPriceItem', 'Chinese'];
654
var discogsQty = 0;
655
 
656
var ConditionIdList = ['2750', '4000', '4000', '4000'];
657
var ConditionDescriptionList = ['The book is in mint condition and shows only slight cover wear due to shelf storage. The cover and binding are undamaged and the pages have no markings or writing. Please view all images of the actual book.',
22 - 658
    'The disc is in near mint/mint condition and has been tested by us. The jewel case is in great shape, the inside tray is intact. Please view all actual images.',
10 - 659
    'The case is in good shape, the disc in near mint/mint condition. Please view all actual images.',
660
    'The card is in near mint/mint condition and will be mailed out in a sleeve within 1 business day after payment cleared. Expedited service with tracking number and top loader is available at an extra charge.'
661
];
662
 
22 - 663
var ConditionDescriptionCdPlural = 'The discs are in near mint/mint condition and have been tested by us. The jewel case is in great shape, the inside trays are intact. Please view all actual images.';
10 - 664
var ConditionDescriptionCdNewCase = 'The disc is in near mint/mint condition and comes in a new jewel case. Please view all actual images.';
665
var ConditionDescriptionCdDigipak = 'The disc is in near mint/mint condition and has been tested by us. The digipak is in good shape, the inside tray intact. Please view all actual images.';
666
 
12 - 667
var Description1 = '<meta name="viewport" content="width=device-width, initial-scale=1.0"><style>.w3-ol{list-style-type:1}.w3-ol li{padding:8px 16px;border-bottom:1px solid #ddd}.w3-ol li:last-child{border-bottom:none} img {max-width:100%}.tabs {max-width:90%;float:none;list-style: none;margin: 0 auto;}.tabs:after {content:"";display:table;clear: both;}.tabs input[type=radio] {display:none;}.tabs label {opacity:0.5;display:block;font-size:30px;font-weight:normal;text-decoration:none;text-align:center;line-height:2;cursor:pointer;-webkit-transition:all 0.5s;transition:all 0.5s;}.tabs label span {display:inline-block;float:left;}.tabs label:hover {opacity:1;}.tab-content {display:none;width:100%;float:left;padding:8px 16px;box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);border-radius:8px;background-color:#ffffff;}.tab-content * {-webkit-animation:scale 0.7s ease-in-out;-moz-animation:scale 0.7s ease-in-out;animation:scale 0.7s ease-in-out;}@keyframes scale {0% {transform:scale(0.9);opacity:0;}50% {transform:scale(1.01);opacity:0.5;}100% {transform:scale(1);opacity:1;}}.tabs [id^="tab"]:checked + label { opacity:1; }#tab1:checked ~ #tab-content1, #tab2:checked ~ #tab-content2, #tab3:checked ~ #tab-content3 {display:block;}.header-logo { max-height:100px!important; }.header-company-name { font-size:64px!important; }.header-button-1, .header-button-2, .header-button-3, .header-button-4, .header-button-5 {	}.header-icon-text { font-size:30px!important; }.header-icon { width:50px!important; height:50px!important;}.paypal-logo { max-height:100px!important; }.tab-alternate-header {	display:none!important; }@media only screen and (max-width:780px) {.header-logo { max-height:80px!important; }.header-company-name { font-size:48px!important; }.header-button-2, .header-button-3, .header-button-5 { display:none!important; }.header-icon-text { font-size:24px!important; }.header-icon { width:45px!important; height:45px!important;}.paypal-logo { max-height:80px!important; }.tabs {max-width:100%!important;}.tab-button { display:none!important; }.tab-alternate-header { display:block!important; }#tab-content1, #tab-content2, #tab-content3 { display:block!important; }}@media only screen and (max-width:500px) {.header-logo { max-height:60px!important; }.header-company-name { font-size:32px!important; }.header-button-2, .header-button-3, .header-button-4, .header-button-5 { display:none!important; }.header-icon-text { font-size:20px!important; }.header-icon { width:40px!important; height:40px!important;}.paypal-logo { max-height:60px!important; }.tabs {max-width:100%!important;}.tab-button { display:none!important; }.tab-alternate-header {	display:block!important; }#tab-content1, #tab-content2, #tab-content3 { display:block!important; }}</style><link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"><div class="w3-main"><div class="w3-container  w3-light-grey w3-text-black  w3-round-large" style="background-color:hsla(200, 100%, 25%, .8);"><div class="w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><h2 class="header-icon-text"><img class="header-icon" alt="Clipboard" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_clipboard_1055091.png"> Product Description</h2></div><div class="row "><!-- *************** Place description here ****************** --><div class="w3-container  w3-twothird">';
668
var Description2 = '</div><div class="w3-container  w3-third"><img class="w3-image w3-border w3-right" alt="';
10 - 669
var Description2a = '" src="';
670
var DescImage;
12 - 671
var Description3 = '"></div><!-- *************** Place description here ****************** --></div></div><div class="w3-container  w3-light-grey w3-text-black  w3-round-large" style="background-color:hsla(200, 100%, 25%, .8);"><div class="tabs "><!-- Radio button and label for #tab-content1 --><input name="tabs" id="tab1" checked="" type="radio"><label for="tab1"><span class="tab-button header-icon-text  w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><img class="header-icon" alt="Credit Card" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_creditcard_1055079.png"> Payments</span></label><!-- Radio button and label for #tab-content2 --><input class="tab-button" name="tabs" id="tab2" type="radio"><label for="tab2"><span class="tab-button header-icon-text  w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><img class="header-icon" alt="Dolly" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_dolly_1055070.png"> Shipping</span></label><!-- Radio button and label for #tab-content3 --><input class="tab-button" name="tabs" id="tab3" type="radio"><label for="tab3"><span class="tab-button header-icon-text  w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><img class="header-icon" alt="Delivery Truck" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_truck_1054949.png"> Return</span> </label><div id="tab-content1" class="tab-content"><div class="tab-alternate-header w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><h2 class="header-icon-text"><img class="header-icon" alt="Credit Card" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_creditcard_1055079.png"> Payments</h2></div><img class="paypal-logo w3-image w3-right " alt="PayPal Seal" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/paypal-verified.png"><p>We accept PayPal and all major credit cards through secure payment processor PayPal.</p><ul><li>We charge 6% sales tax for items shipped to the state of Virginia.</li><li>Payment must be received in full within 3 days from the date of purchase.</li><li>We leave positive eBay feedback as soon as the payment clears.</li></ul></div><!-- #tab-content1 --><div id="tab-content2" class="tab-content"><div class="tab-alternate-header w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><h2 class="header-icon-text"><img class="header-icon" alt="Dolly" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_dolly_1055070.png"> Shipping</h2></div>';
10 - 672
var DescriptionFreeShipping = '<p>We offer free USPS Economy or Media Mail, expedited service is available at an additional cost.</p>';
673
var DescriptionTradingCardShipping = '<p>Standard USPS shipping without Tracking Number. Expedited service with tracking number and top loader available at an extra cost.</p>';
12 - 674
var Description4 = '<ul><li>All items will be shipped from the United States.</li><li>We will only ship to the confirmed PayPal address. Please make sure it matches your shipping address.</li><li>Shipping Monday through Saturday, excluding federal holidays, within 24 hours after payment is received.</li><li>If a tracking number is provided by the shipping carrier, we will update your order with the tracking information.</li><li>Shipping Outside of the United States incurs additional shipping charges.</li></ul></div><!-- #tab-content2 --><div id="tab-content3" class="tab-content"><div class="tab-alternate-header w3-center w3-text-white w3-round-large w3-border-white w3-topbar w3-bottombar w3-rightbar w3-leftbar " style="background-color:hsla(200, 100%, 25%, .8);"><h2 class="header-icon-text"><img class="header-icon" alt="Delivery Truck" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_truck_1054949.png"> Return</h2></div><p>Please <a href="https://contact.ebay.com/ws/eBayISAPI.dll?ContactUserNextGen&amp;recipient=muna_trading" target="_blank">contact us</a> before returning an item or leaving negative feedback. We will get back to you immediately and work with you to make your purchase right. </p></div><!-- #tab-content3 --></div></div><footer class="w3-container w3-center"><div class="w3-container w3-center "><a class="header-button-1 w3-button w3-round-xlarge w3-border w3-border-black w3-white" href="https://stores.ebay.com/munatrading" target="_blank"><img alt="Sales Tag" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_shop_1054978.png" width="35px" height="35px"> Other Items</a><a class="header-button-2 w3-button w3-round-xlarge w3-border w3-border-black w3-white" href="https://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&amp;userid=muna_trading&amp;ftab=AllFeedback" target="_blank"><img alt="Paper and pencil" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_compose_1055085.png" width="35px" height="35px"> Feedbacks</a><a class="header-button-3 w3-button w3-round-xlarge w3-border w3-border-black w3-white" href="https://www.ebay.com/usr/muna_trading" target="_blank"><img alt="Contacts" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_contacts_1055082.png" width="35px" height="35px"> About Us</a><a class="header-button-4 w3-button w3-round-xlarge w3-border w3-border-black w3-white" href="https://contact.ebay.com/ws/eBayISAPI.dll?ContactUserNextGen&amp;recipient=muna_trading" target="_blank"><img alt="Envelope" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_mail_1055030.png" width="35px" height="35px"> Contact Us</a><a class="header-button-5 w3-button w3-round-xlarge w3-border w3-border-black w3-white" href="https://my.ebay.com/ws/eBayISAPI.dll?AcceptSavedSeller&amp;mode=0&amp;preference=0&amp;ssPageName=STRK:MEFS:ADDMP&amp;sellerid=muna_trading" target="_blank"><img alt="Heart" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/if_heart_1055045.png" width="35px" height="35px"> Add To Favorites</a></div><div class="w3-container w3-center "><img class="header-logo w3-image" src="https://cdn.shopify.com/s/files/1/0018/0273/1609/files/MUNA_-_Logo_100x100.png" alt="MUNA Logo"></div><p>Thanks so much for looking at our auction and please do not hesitate to <a href="https://contact.ebay.com/ws/eBayISAPI.dll?ContactUserNextGen&amp;recipient=muna_trading" target="_blank">contact us</a> should you have any questions!</p></footer></div>';
10 - 675
var DescCore = '';
676
var ImageURLs = [];
12 - 677
var maxAdditionalImages = 8;
10 - 678
var imagesToUpload = 0;
679
var imageUploadError = false;
680
var titlesToRead = 0;
681
var upc = '';
682
 
683
 
684
// Initialize Configuration Variables
685
function initConfig() {
686
    var i;
687
    var j;
688
 
689
    eBayAuthToken = readCookie();
690
    if (eBayAuthToken.length > 0) {
691
        connected();
692
    }
693
 
694
    if (eBayAuthTokenFlag === false) {
695
        var x = document.getElementById("login");
696
        if (x.className.indexOf("w3-show") == -1) {
697
            x.className += " w3-show";
698
        }
699
    }
700
 
701
    categoryValues();
702
    requireNewVerify();
703
 
704
    $('#listForm').on('change input cut paste',requireNewVerify);
705
    $('#bookForm').on('change input cut paste',requireNewVerify);
706
    $('#cdForm').on('change input cut paste',requireNewVerify);
707
    $('#dvdForm').on('change input cut paste',requireNewVerify);
708
    $('#tradingCardForm').on('change input cut paste',requireNewVerify);
15 - 709
 
10 - 710
    var xhttp = new XMLHttpRequest();
711
    xhttp.onreadystatechange = function() {
712
        if (this.readyState == 4 && this.status == 200) {
713
            //window.alert(this.responseText);
714
 
715
            var parser = new DOMParser();
716
            var htmlDoc = parser.parseFromString(this.responseText, "text/html");
717
            var x = htmlDoc.getElementsByTagName("a");
718
 
719
            listItems = [];
720
            additionalPictures = [];
721
            titlesToRead = 0;
722
 
723
            for (i = 0, j = 0; i < x.length; i++) {
724
                if (htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(configImage1Extension)) {
725
                    var n = htmlDoc.getElementsByTagName("a")[i].innerHTML.lastIndexOf(configImage1Extension);
726
                    listItems[j] = htmlDoc.getElementsByTagName("a")[i].innerHTML.substr(0, n);
727
                    ++titlesToRead;
728
                    getTitleFromeBay(listItems[j], j);
729
                    j++;
730
                }
731
            }
732
 
733
            for (i = 0; i < x.length; i++) {
734
                if (htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(configImage1Extension) ||
735
                    htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(configImage2Extension) ||
736
                    htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(configdescriptionImageExtension)) {
737
                    continue;
738
                }
739
 
740
                if (htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(".jpg")) {
741
                    for (j = 0; j < listItems.length; j++) {
742
                        if (htmlDoc.getElementsByTagName("a")[i].innerHTML.startsWith(listItems[j]) && !htmlDoc.getElementsByTagName("a")[i].innerHTML.endsWith(" - small.jpg")) {
743
                            if (additionalPictures[j] === undefined) {
744
                                additionalPictures[j] = [];
745
                            }
746
                            additionalPictures[j].push(htmlDoc.getElementsByTagName("a")[i].innerHTML);
747
                        }
748
                    }
749
                }
750
            }
751
 
752
            function checkTitlesToRead() {
753
                if (titlesToRead > 0) {
754
                    window.setTimeout(checkTitlesToRead, 100); // wait 100 milliseconds
755
                } else {
756
                    sortList(document.getElementById("keyword"));
757
                    $("#keyword").selectpicker('refresh');
758
                    document.getElementById("bookDetails").className += " w3-hide";
759
                    document.getElementById("cdDetails").className += " w3-hide";
760
                    document.getElementById("dvdDetails").className += " w3-hide";
761
                }
762
            }
763
 
764
            checkTitlesToRead();
765
 
766
        }
767
    };
768
    xhttp.open("GET", configListingUrl + '?t=' + Math.random(), true);
769
    xhttp.send();
770
 
771
}
772
 
773
function sortList(lb) {
774
    var arrTexts = [];
775
    var res;
776
    var i;
777
    var lbCopy = $.extend(true, {}, lb);
778
 
779
    for (i = 0; i < lb.length; i++) {
780
        arrTexts[i] = lb.options[i].style.color + '|' + lb.options[i].id + '|' + lb.options[i].text + '|' + i;
781
    }
782
 
783
    arrTexts.sort();
784
 
785
    for (i = 0; i < arrTexts.length; i++) {
786
        res = arrTexts[i].split('|');
787
        lb[i] =  lbCopy[res[3]];
788
    }
789
}
790
 
791
function getTitleFromeBay(identifier, index) {
792
    // Construct the request
793
    url = configeBayShopping + "?";
794
    url += "callname=FindProducts";
795
    url += "&version=" + configeBayShoppingVersion;
796
    url += "&appid=" + configAppid;
797
    url += "&responseencoding=JSON";
798
    url += "&siteid=0";
799
    url += "&AvailableItemsOnly=true";
800
    url += "&MaxEntries=1";
801
    url += "&MessageID=";
802
    url += index;
803
    url += "&QueryKeywords=";
804
    url += encodeURIComponent(identifier.trim().replace(/ /g, "+"));
805
 
806
    var xhttp = new XMLHttpRequest();
807
 
808
    xhttp.onreadystatechange = function() {
809
        if (this.readyState == 4) {
810
            _cb_getTitleFromeBay(JSON.parse(this.responseText));
811
        }
812
    };
813
 
814
    xhttp.open("GET", configProxyUrl, true);
815
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
816
    xhttp.send();
817
 
818
    return false;
819
}
820
 
821
// Create new page for single item
822
function _cb_getTitleFromeBay(root) {
823
    var optionsAsString;
824
    var JsonObj;
825
    var color;
826
 
827
    if (root.Ack != 'Success') {
828
        color = 'purple';
829
        if (isNumeric((listItems[root.CorrelationID]))) {
830
            if (listItems[root.CorrelationID].substr(0, 3) == '978' || listItems[root.CorrelationID].substr(0, 3) == '979') {
831
                if (!isValidISBNCode(listItems[root.CorrelationID])) {
832
                    color = 'red';
833
                }
834
            } else {
835
                if (!isValidUpcOrEanCode(listItems[root.CorrelationID])) {
836
                    color = 'red';
837
                }
838
            }
839
        }
840
 
12 - 841
        optionsAsString = "<option class='small' id='" + escapeHtml(listItems[root.CorrelationID]) + "' " + "value='" + escapeHtml(listItems[root.CorrelationID]) + "'>" + listItems[root.CorrelationID] + "</option>";
10 - 842
        document.getElementById("keyword").innerHTML += optionsAsString;
843
        document.getElementById(listItems[root.CorrelationID]).style.color = color;
844
    } else {
845
        JsonObj = typeof root.Product[0] != 'object' ? JSON.parse(root.Product[0]) : root.Product[0];
12 - 846
        optionsAsString = "<option class='small'' id='" + escapeHtml(listItems[root.CorrelationID]) + "' " + "value='" + escapeHtml(listItems[root.CorrelationID]) + "'>" + listItems[root.CorrelationID] + " - " + JsonObj.Title + "</option>";
10 - 847
        document.getElementById("keyword").innerHTML += optionsAsString;
848
    }
849
 
850
    --titlesToRead;
851
}
852
 
853
// Create new page for single item
854
function _cb_FindProducts(root) {
855
    var j;
856
    var x;
857
    var ack = root.Ack;
858
    var MoreResults = root.MoreResults;
859
 
860
    if (ack != 'Success' || MoreResults) { // xxxxx allow to look at all results
861
        x = document.getElementById("productinfo");
17 - 862
        y = document.getElementById("productinfoSearch");
10 - 863
        if (root.Errors !== undefined && root.Errors[0].ShortMessage != 'No match found.') {
864
            x.innerHTML = "<h2>eBay API Error<h2>";
865
            x.innerHTML += "<p>Id: " + root.Errors[0].ErrorCode + "<br/>";
866
            x.innerHTML += "Domain: " + root.Errors[0].ErrorClassification + "<br/>";
867
            x.innerHTML += "Severity: " + root.Errors[0].SeverityCode + "<br/>";
868
            x.innerHTML += "Category: " + root.Errors[0].category + "<br/>";
869
            x.innerHTML += "Short Message: " + root.Errors[0].ShortMessage + "<br/>";
870
            x.innerHTML += "Long Message: " + root.Errors[0].LongMessage + "<br/>";
871
            x.innerHTML += "Build/Version: " + root.Build + '/' + root.Version + "</p>";
872
            x.innerHTML += "<p>URL: " + "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>" + "</p>";
873
        } else {
874
            x.innerHTML = '<h2 class="bg-danger">Manual Mode</h3>';
875
            x.innerHTML += "<h3>" + document.getElementById("keyword").value + "</h3>";
876
            catalogTitle = document.getElementById("keyword").value.trim();
877
            if (isNumeric(catalogTitle)) {
878
                if (catalogTitle.startsWith('978') || catalogTitle.startsWith('979')) {
22 - 879
                    y.innerHTML += '<a href="https://isbnsearch.org/isbn/' + catalogTitle + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> ISBN Search</button></a>';
880
                    y.innerHTML += '<a href="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dpopular&field-keywords=' + catalogTitle + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> Amazon</button></a>';
881
                    y.innerHTML += '<a href="https://ujsoftware.linkpc.net/ebay/searchBS.html?keyword=' + encodeURIComponent(catalogTitle.trim()) + '&listingType=All&hideDuplicateItems=on&locatedIn=WorldWide&sortOrder=PricePlusShippingLowest&results=100" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> eBay</button></a>';
10 - 882
                } else {
22 - 883
                    y.innerHTML += '<a href="https://dvdlist.kazart.com/queryDVDList.php3?search=' + catalogTitle + '&select=UPC&Submit=Search&since=All&genre=All&date=All&status=All&sort1=title&sort1by=ASC&sort2=year&sort2by=ASC&sort3=genre&sort3by=ASC" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> Kazart</button></a>';
884
                    y.innerHTML += '<a href="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dpopular&field-keywords=' + catalogTitle + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> Amazon</button></a>';
885
                    y.innerHTML += '<a href="https://ujsoftware.linkpc.net/ebay/searchBS.html?keyword=' + encodeURIComponent(catalogTitle.trim()) + '&listingType=All&hideDuplicateItems=on&locatedIn=WorldWide&sortOrder=PricePlusShippingLowest&results=100" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> eBay</button></a>';
10 - 886
                }
887
            } else {
888
                catalogTitle = document.getElementById("keyword").value.trim();
889
                splitTradingCardElements();
890
                fillForm();
891
 
22 - 892
                y.innerHTML += '<a href="https://ujsoftware.linkpc.net/ebay/searchBS.html?keyword=' + encodeURIComponent(catalogTitle.trim()) + '&listingType=All&hideDuplicateItems=on&locatedIn=WorldWide&sortOrder=PricePlusShippingLowest&results=100" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> eBay</button></a>';
10 - 893
            }
894
 
895
            printManualButtons();
896
        }
897
 
898
        unsetAdditionalImages();
899
 
900
        for (i = 0; i < additionalPictures.length; i++) {
901
            if (additionalPictures[i] !== undefined && additionalPictures[i][0].startsWith(document.getElementById("keyword").value.trim())) {
902
                if (additionalPictures[i].length > maxAdditionalImages) {
903
                    document.getElementById("productinfo").innerHTML += '<p class="bg-danger"><strong>Too many additional images.</a></strong></p>';
904
                } else {
905
                    for (j = 0; j < additionalPictures[i].length; j++) {
906
                        setAdditionalImage(j + 3, additionalPictures[i][j]);
907
                    }
908
                }
909
            }
910
        }
911
 
912
        document.getElementById("image1").src = configListingUrl + document.getElementById("keyword").value.trim() + configImage1Extension;
913
        document.getElementById("image2").src = configListingUrl + document.getElementById("keyword").value.trim() + configImage2Extension;
914
        document.getElementById("descriptionImage").src = configListingUrl + document.getElementById("keyword").value.trim() + configdescriptionImageExtension;
915
        document.getElementById("image1anchor").href = document.getElementById("image1").src;
916
        document.getElementById("image2anchor").href = document.getElementById("image2").src;
917
 
918
        isManualMode = true;
919
        catalogActorNames = '';
920
 
921
        isDuplicate = false;
922
        findDuplicateListing();
923
        findPotentialDuplicateListing();
924
        findShopifyDuplicateListing();
925
 
926
        upc = catalogTitle;
927
 
928
        return;
929
    }
930
 
931
    isManualMode = false;
932
 
933
    var str = "";
17 - 934
    var str2 = "";
10 - 935
    var i = 0;
936
    var JsonObj = typeof root.Product[0] != 'object' ? JSON.parse(root.Product[0]) : root.Product[0];
937
 
938
    var DetailsURL = JsonObj.DetailsURL;
939
    var ItemSpecifics = JsonObj.ItemSpecifics;
940
    var StockPhotoURL = JsonObj.StockPhotoURL;
941
    var ProductID = JsonObj.ProductID;
942
    var TotalProducts = Number(root.TotalProducts);
943
    var searchStr = '';
944
    var munaSearchStr = '';
945
 
946
    catalogTitle = JsonObj.Title;
947
    catalogActorNames = '';
948
 
949
    str = '';
950
    DescCore = '';
951
 
952
    if (StockPhotoURL && StockPhotoURL.length > 1) {
953
        if (DetailsURL && DetailsURL.length > 1) {
954
            str += '<a href="' + DetailsURL + '" target="_blank">';
955
        }
956
        str += '<img class="img-fluid float-right " src="' + StockPhotoURL + '" alt="Gallery Image" style="max-height:100px;max-width:100px;">';
957
        if (DetailsURL && DetailsURL.length > 1) {
958
            str += '</a>';
959
        }
960
    }
961
 
962
    str += '<h3>' + catalogTitle + '</h3>';
963
 
17 - 964
    str += '<table class="table-bordered"><tbody>';
10 - 965
 
966
    eBayProductId = '';
967
    upc = catalogTitle;
968
    if (ProductID) {
969
        for (i = 0; i < ProductID.length; i++) {
970
            if (ProductID[i].Type == 'Reference') {
17 - 971
                str += '<tr><td>' + ProductID[i].Type + '</td><td>' + ProductID[i].Value + '</td></tr>';
10 - 972
                munaSearchStr = 'ReferenceID%3A' + ProductID[i].Value;
973
                eBayProductId = ProductID[i].Value;
974
            } else {
17 - 975
                str += '<tr><td>' + ProductID[i].Type + '</td><td>' + ProductID[i].Value + '</td></tr>';
10 - 976
                searchStr = ProductID[i].Value;
977
                if (ProductID[i].Type == 'UPC') {
978
                    upc = ProductID[i].Value;
979
                }
980
            }
981
        }
982
    }
983
 
984
    if (ItemSpecifics) {
985
        for (i = 0; i < ItemSpecifics.NameValueList.length; i++) {
17 - 986
            str += '<tr><td>' + ItemSpecifics.NameValueList[i].Name + '</td><td>' + ItemSpecifics.NameValueList[i].Value + '</td></tr>';
10 - 987
 
988
            if (ItemSpecifics.NameValueList[i].Name == 'Leading Role') {
989
                catalogActorNames = ItemSpecifics.NameValueList[i].Value;
990
            }
991
        }
992
    }
993
 
17 - 994
    str += '</tbody></table>';
10 - 995
 
996
    if (MoreResults) {
997
        str += '<p class="float-right bg-danger">' + TotalProducts + ' Products found</p>';
998
    }
999
 
1000
    if (catalogTitle.includes(movieFormats[0]) || catalogTitle.includes(movieFormats[1]) || catalogTitle.includes(movieFormats[2])) {
22 - 1001
        str2 += '<a href="https://dvdlist.kazart.com/queryDVDList.php3?search=' + searchStr + '&select=UPC&Submit=Search&since=All&genre=All&date=All&status=All&sort1=title&sort1by=ASC&sort2=year&sort2by=ASC&sort3=genre&sort3by=ASC" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> Kazart</button></a>';
10 - 1002
    } else if (catalogTitle.includes('Paperback') || catalogTitle.includes('Hardcover')) {
22 - 1003
        str2 += '<a href="https://isbnsearch.org/isbn/' + searchStr + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> ISBN Search</button></a>';
10 - 1004
    }
1005
 
22 - 1006
    str2 += '<a href="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=' + searchStr + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> Amazon</button></a>';
1007
    str2 += '<a href="https://ujsoftware.linkpc.net/ebay/searchBS.html?keyword=' + (munaSearchStr.length > 0 ? munaSearchStr : encodeURIComponent(searchStr.trim())) + '&listingType=All&hideDuplicateItems=on&locatedIn=WorldWide&sortOrder=PricePlusShippingLowest&results=100" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> eBay</button></a>';
10 - 1008
 
1009
    x = document.getElementById("productinfo");
1010
    x.innerHTML = str;
17 - 1011
    x = document.getElementById("productinfoSearch");
1012
    x.innerHTML = str2;
10 - 1013
 
1014
 
1015
    isDuplicate = false;
1016
    findDuplicateListing();
1017
    findPotentialDuplicateListing();
1018
    findShopifyDuplicateListing();
1019
 
1020
    fillForm(ItemSpecifics);
1021
}
1022
 
1023
function printManualButtons() {
1024
    var x = document.getElementById("productinfo");
1025
    if (!x.innerHTML.includes('fillManualForm0')) {
1026
        x.innerHTML += '<p><br/></p>';
22 - 1027
        x.innerHTML += '<a href="javascript:void(0)" id="fillManualForm0" class="btn btn-dark btn-xs mx-2 border" onclick="fillManualForm(0)">Book Form</a>';
1028
        x.innerHTML += '<a href="javascript:void(0)" id="fillManualForm1" class="btn btn-dark btn-xs mx-2 border" onclick="fillManualForm(1)">CD Form</a>';
1029
        x.innerHTML += '<a href="javascript:void(0)" id="fillManualForm2" class="btn btn-dark btn-xs mx-2 border" onclick="fillManualForm(2)">DVD Form</a>';
1030
        x.innerHTML += '<a href="javascript:void(0)" id="fillManualForm3" class="btn btn-dark btn-xs mx-2 border" onclick="fillManualForm(3)">Trading Card Form</a>';
17 - 1031
        x.innerHTML += '<p><br/></p>';
10 - 1032
    }
1033
}
1034
 
1035
function setAdditionalImage(imageNumber, imageName) {
1036
    if (imageName !== undefined) {
1037
        document.getElementById("image" + imageNumber).src = configListingUrl + imageName.trim();
12 - 1038
        document.getElementById("image" + imageNumber + "anchor").className = document.getElementById("image" + imageNumber + "anchor").className.replace(" invisible", " visible");
10 - 1039
        document.getElementById("image" + imageNumber + "anchor").href = document.getElementById("image" + imageNumber).src;
1040
    }
1041
}
1042
 
1043
function unsetAdditionalImages() {
12 - 1044
    for (var i = 0; i < maxAdditionalImages; i++) {
1045
        document.getElementById("image" + (i+3)).src = 'images/default-image.png';
1046
        document.getElementById("image" + (i+3) + "anchor").className = document.getElementById("image" + (i+3) + "anchor").className.replace(" visible", " invisible");
1047
        document.getElementById("image" + (i+3) + "anchor").href = '#';
10 - 1048
    }
1049
}
1050
 
1051
function requireNewVerify() {
1052
    listButtonHot(false);
1053
}
1054
 
1055
function requireNewLogin() {
1056
    // dummy
1057
}
1058
 
1059
function hideDetailWindows() {
1060
    var x, y;
1061
 
1062
    x = document.getElementById("bookDetails");
1063
    x.className = x.className.replace(" w3-show", "");
1064
    document.getElementById("bookForm").reset();
1065
    x = document.getElementById("cdDetails");
1066
    x.className = x.className.replace(" w3-show", "");
1067
    document.getElementById("cdForm").reset();
1068
    x = document.getElementById("dvdDetails");
1069
    x.className = x.className.replace(" w3-show", "");
1070
    document.getElementById("dvdForm").reset();
1071
    x = document.getElementById("tradingCardDetails");
1072
    x.className = x.className.replace(" w3-show", "");
1073
    document.getElementById("tradingCardForm").reset();
1074
    document.getElementById("cdTracks").innerHTML = "";
1075
    document.getElementById("cdUnorderedTrackList").checked = false;
1076
    updateTracklistPreview();
1077
 
1078
    for (var imageNumber = 0; imageNumber < maxAdditionalImages; imageNumber++) {
1079
        x = document.getElementById("image" + (imageNumber + 3) + "anchor");
1080
        y = document.getElementById("image" + (imageNumber + 3));
1081
 
12 - 1082
        x.className = x.className.replace(" visible", " invisible");
1083
        x.href = '#';
1084
        y.src = 'images/default-image.png';
10 - 1085
    }
1086
}
1087
 
1088
var url = "";
1089
 
1090
function findOneBay() {
1091
    var n;
1092
    var keyword;
1093
 
1094
    if (document.getElementById("list").className.includes("btn-success")) {
1095
        alert("Listing verified but not yet submitted");
1096
        return;
1097
    }
1098
 
1099
    requireNewVerify();
1100
 
1101
    hideDetailWindows();
1102
 
1103
    ImageURLs = [];
1104
 
1105
    if (!document.getElementById("keyword").value) {
1106
        return false;
1107
    }
1108
 
1109
    if (document.getElementById("keyword").value.endsWith(" Front")) {
1110
        n = document.getElementById("keyword").value.lastIndexOf(" Front");
1111
        document.getElementById("keyword").value = document.getElementById("keyword").value.substr(0, n);
1112
    } else if (document.getElementById("keyword").value.endsWith(" Rear")) {
1113
        n = document.getElementById("keyword").value.lastIndexOf(" Rear");
1114
        document.getElementById("keyword").value = document.getElementById("keyword").value.substr(0, n);
1115
    }
1116
 
1117
    keyword = document.getElementById('keyword').value;
1118
 
1119
    // Clear results outputs button
1120
    clearStatusWindows();
17 - 1121
    document.getElementById("productinfoSearch").innerHTML = "";
1122
    document.getElementById("productinfoDuplicate").innerHTML = "";
10 - 1123
 
1124
    discogsQty = 1;
1125
 
1126
    // Construct the request
1127
    url = configeBayShopping + "?";
1128
    url += "callname=FindProducts";
1129
    url += "&version=" + configeBayShoppingVersion;
1130
    url += "&appid=" + configAppid;
1131
    url += "&responseencoding=JSON";
1132
    url += "&siteid=0";
1133
    url += "&AvailableItemsOnly=true";
1134
    url += "&MaxEntries=1";
1135
    url += "&QueryKeywords=";
22 - 1136
    url += encodeURIComponent(keyword.trim().replace(/ /g, "+")).substr(0, 98);
10 - 1137
 
1138
    var xhttp = new XMLHttpRequest();
1139
 
1140
    xhttp.onreadystatechange = function() {
1141
        if (this.readyState == 4) {
1142
            _cb_FindProducts(JSON.parse(this.responseText));
1143
        }
1144
    };
1145
 
1146
    xhttp.open("GET", configProxyUrl, true);
1147
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
1148
    xhttp.send();
1149
 
1150
    getPricing();
1151
 
1152
    return false;
1153
}
1154
 
1155
function fillForm(ItemSpecifics) {
1156
    var eBayTitle;
1157
    var fieldName;
1158
    var field;
1159
    var n;
1160
    var i;
1161
    var j;
1162
    var x;
1163
    var movieIndex = 0;
1164
    var titleField = document.getElementById("title");
1165
 
1166
    eBayTitle = catalogTitle;
1167
    if (catalogActorNames.length > 0) {
1168
        eBayTitle += ' ' + catalogActorNames.join(', ');
1169
    }
1170
 
1171
    document.getElementById("title").value = eBayTitle;
1172
    printTitleLength();
1173
 
1174
    if (catalogTitle.includes("(CD")) {
1175
        findDiscogsReleases(document.getElementById("keyword").value);
1176
 
1177
        x = document.getElementById("cdDetails");
1178
        if (x.className.indexOf("w3-show") == -1) {
1179
            x.className += " w3-show";
1180
        }
1181
 
1182
        if (!isManualMode) {
1183
            titleField.value = reformatCdTitle(catalogTitle);
1184
            printTitleLength();
1185
        }
1186
 
1187
        if (titleField.value.endsWith(' (Label))')) {
1188
            titleField.value = titleField.value.substr(0, titleField.value.indexOf(' (Label))')) + ')';
1189
            printTitleLength();
1190
        }
1191
 
1192
        if (titleField.value.endsWith(' (USA))')) {
1193
            titleField.value = titleField.value.substr(0, titleField.value.indexOf(' (USA))')) + ')';
1194
            printTitleLength();
1195
        }
1196
 
1197
        document.getElementById("cdCountry").value = configDefaultCountry;
1198
 
1199
        if (ItemSpecifics) {
1200
            for (i = 0; i < ItemSpecifics.NameValueList.length; i++) {
1201
                fieldName = 'cd' + ItemSpecifics.NameValueList[i].Name.replace(/ /g, '');
1202
                field = document.getElementById(fieldName);
1203
                if (field) {
1204
                    field.value = ItemSpecifics.NameValueList[i].Value;
1205
                }
1206
            }
1207
        }
1208
        $('#cdGenre').prop('disabled', false).selectpicker('refresh');
1209
 
1210
        if (titleField.value.indexOf('[EP]') > 0) {
1211
            document.getElementById("cdDuration").value = 'EP';
1212
        } else if (titleField.value.indexOf('[Maxi-Single]') > 0 || titleField.value.indexOf('[Maxi Single]') > 0) {
1213
            document.getElementById("cdDuration").value = 'Maxi-Single';
1214
        } else if (titleField.value.indexOf('[Single]') > 0) {
1215
            document.getElementById("cdDuration").value = 'Single';
1216
        }
1217
        $('#cdDuration').prop('disabled', false).selectpicker('refresh');
1218
 
1219
        if (titleField.value.indexOf('[Digipak]') > 0) {
1220
            document.getElementById("cdDigipak").checked = true;
1221
        }
1222
 
1223
        if (document.getElementById("cdArtist").value.length < 1) {
1224
            if (titleField.value.substr(0, titleField.value.includes('Various Artists'))) {
1225
                document.getElementById("cdArtist").value = 'Various';
1226
            } else {
1227
                document.getElementById("cdArtist").value = titleField.value.substr(0, titleField.value.indexOf(' - '));
1228
            }
1229
        }
1230
 
1231
        if (document.getElementById("cdRecordLabel").value.length < 1) {
1232
            n = titleField.value.indexOf('(CD');
1233
            document.getElementById("cdRecordLabel").value = titleField.value.substr(n).substr(titleField.value.substr(n).lastIndexOf(',') + 2);
1234
            document.getElementById("cdRecordLabel").value = document.getElementById("cdRecordLabel").value.substr(0, document.getElementById("cdRecordLabel").value.lastIndexOf(')'));
1235
        }
1236
 
1237
        if (document.getElementById("cdReleaseYear").value.length < 1) {
1238
            n = titleField.value.indexOf('(CD');
1239
            document.getElementById("cdReleaseYear").value = getYear(titleField.value.substr(n));
1240
        }
1241
 
12 - 1242
        $('#category').selectpicker('val', "176984");
1243
        $('#category').selectpicker('refresh');
10 - 1244
        categoryValues();
1245
 
1246
        $('#cdTracks').on('change input cut paste',updateTracklistPreview);
1247
    } else if (catalogTitle.includes(movieFormats[0]) || catalogTitle.includes(movieFormats[1]) || catalogTitle.includes(movieFormats[2])) {
1248
        x = document.getElementById("dvdDetails");
1249
        if (x.className.indexOf("w3-show") == -1) {
1250
            x.className += " w3-show";
1251
        }
1252
 
1253
        document.getElementById("dvdCountry").value = configDefaultCountry;
1254
 
1255
        if (ItemSpecifics) {
1256
            for (i = 0; i < ItemSpecifics.NameValueList.length; i++) {
1257
                fieldName = 'dvd' + ItemSpecifics.NameValueList[i].Name.replace(/ /g, '');
1258
                field = document.getElementById(fieldName);
1259
                if (field) {
1260
                    field.value = ItemSpecifics.NameValueList[i].Value;
1261
                }
1262
            }
1263
        }
1264
        $('#dvdGenre').prop('disabled', false).selectpicker('refresh');
1265
        $('#dvdRating').prop('disabled', false).selectpicker('refresh');
1266
        $('#dvdRegionCode').prop('disabled', false).selectpicker('refresh');
1267
        $('#dvdRental').prop('disabled', false).selectpicker('refresh');
1268
        $('#dvdSeason').prop('disabled', false).selectpicker('refresh');
1269
 
1270
        for (i = 0; i < movieFormats.length; i++) {
1271
            if (catalogTitle.includes('(' + movieFormats[i])) {
12 - 1272
                $('#dvdFormat').selectpicker('val', movieFormats[i]);
10 - 1273
                movieIndex = i;
1274
            } else if (catalogTitle.includes('(HD-DVD')) {
12 - 1275
                $('#dvdFormat').selectpicker('val', 'HD DVD');
10 - 1276
                movieIndex = i;
1277
            }
1278
        }
1279
        $('#dvdFormat').prop('disabled', false).selectpicker('refresh');
1280
 
1281
        if (document.getElementById("dvdReleaseYear").value.length < 1) {
1282
            n = titleField.value.indexOf('(' + movieFormats[movieIndex]);
1283
            document.getElementById("dvdReleaseYear").value = getYear(titleField.value.substr(n));
1284
        }
1285
 
1286
        if (document.getElementById("dvdDVDEditionYear").value.length < 1) {
1287
            n = titleField.value.indexOf('(' + movieFormats[movieIndex]);
1288
            document.getElementById("dvdDVDEditionYear").value = getYear(titleField.value.substr(n));
1289
        }
1290
 
1291
        if (document.getElementById("dvdTitle").value.length < 1) {
1292
            n = titleField.value.lastIndexOf('(' + movieFormats[movieIndex]);
1293
            document.getElementById("dvdTitle").value = titleField.value.substr(0, n);
1294
        }
1295
 
1296
        if (titleField.value.indexOf("3D") > 0) {
1297
            document.getElementById("dvd3D").checked = true;
1298
        }
1299
 
1300
        if (titleField.value.indexOf("Anniversary") > 0) {
1301
            document.getElementById("dvdAnniversaryEdition").checked = true;
1302
        }
1303
 
1304
        if (titleField.value.indexOf("Collector") > 0) {
1305
            document.getElementById("dvdCollectorsEdition").checked = true;
1306
        }
1307
 
1308
        if (titleField.value.indexOf("Deluxe") > 0) {
1309
            document.getElementById("dvdDeluxeEdition").checked = true;
1310
        }
1311
 
1312
        if (titleField.value.indexOf("Director") > 0) {
1313
            document.getElementById("dvdDirectorsCut").checked = true;
1314
        }
1315
 
1316
        if (titleField.value.indexOf("Extended") > 0) {
1317
            document.getElementById("dvdExtendedEdition").checked = true;
1318
        }
1319
 
1320
        if (titleField.value.indexOf("Full Screen") > 0 || titleField.value.indexOf("Fullscreen") > 0 ||
1321
            titleField.value.indexOf("Full Frame") > 0 || titleField.value.indexOf("Fullframe") > 0) {
1322
            document.getElementById("dvdFullScreen").checked = true;
1323
        }
1324
 
1325
        if (titleField.value.indexOf("Limited") > 0) {
1326
            document.getElementById("dvdLimitedEdition").checked = true;
1327
        }
1328
 
1329
        if (titleField.value.indexOf("Promo") > 0) {
1330
            document.getElementById("dvdPromo").checked = true;
1331
        }
1332
 
1333
        if (titleField.value.indexOf("Signature") > 0) {
1334
            document.getElementById("dvdSignatureCollection").checked = true;
1335
        }
1336
 
1337
        if (titleField.value.indexOf("Special") > 0) {
1338
            document.getElementById("dvdSpecialEdition").checked = true;
1339
        }
1340
 
1341
        if (titleField.value.indexOf("Steelbook") > 0) {
1342
            document.getElementById("dvdSteelbook").checked = true;
1343
        }
1344
 
1345
        if (titleField.value.indexOf("Unrated") > 0) {
1346
            document.getElementById("dvdUnratedEdition").checked = true;
1347
        }
1348
 
1349
        if (titleField.value.indexOf("Wide Screen") > 0 || titleField.value.indexOf("Widescreen") > 0) {
1350
            document.getElementById("dvdWidescreen").checked = true;
1351
        }
1352
 
12 - 1353
        $('#category').selectpicker('val', "617");
1354
        $('#category').selectpicker('refresh');
10 - 1355
        categoryValues();
1356
    } else if (catalogTitle.includes("Paperback") || catalogTitle.includes("Hardcover")) {
1357
        x = document.getElementById("bookDetails");
1358
        if (x.className.indexOf("w3-show") == -1) {
1359
            x.className += " w3-show";
1360
        }
1361
 
1362
        document.getElementById("bookLanguage").value = configDefaultLanguage;
1363
        document.getElementById("bookCountry").value = configDefaultCountry;
1364
        document.getElementById("bookSubject").value = "";
1365
 
1366
        if (ItemSpecifics) {
1367
            for (i = 0; i < ItemSpecifics.NameValueList.length; i++) {
1368
                fieldName = 'book' + ItemSpecifics.NameValueList[i].Name.replace(/ /g, '');
1369
                field = document.getElementById(fieldName);
1370
                if (field) {
1371
                    field.value = ItemSpecifics.NameValueList[i].Value;
1372
                }
1373
            }
1374
        }
1375
 
1376
        $('#bookFormat').prop('disabled', false).selectpicker('refresh');
1377
        $('#bookSubject').prop('disabled', false).selectpicker('refresh');
1378
 
12 - 1379
        $('#category').selectpicker('val', "171243");
1380
        $('#category').selectpicker('refresh');
10 - 1381
        categoryValues();
1382
    } else {
1383
        printManualButtons();
1384
    }
1385
 
1386
    function toDataURL(url) {
1387
        var xhr = new XMLHttpRequest();
1388
        xhr.onload = function() {
1389
            var reader = new FileReader();
1390
            reader.onloadend = function() {
1391
                DescImage = reader.result;
1392
            };
1393
            reader.readAsDataURL(xhr.response);
1394
        };
1395
        xhr.open('GET', url);
1396
        xhr.responseType = 'blob';
1397
        xhr.send();
1398
    }
1399
 
1400
    toDataURL(configListingUrl + document.getElementById("keyword").value.trim() + configdescriptionImageExtension);
1401
    document.getElementById("image1").src = configListingUrl + document.getElementById("keyword").value.trim() + configImage1Extension;
1402
    document.getElementById("image2").src = configListingUrl + document.getElementById("keyword").value.trim() + configImage2Extension;
1403
    document.getElementById("descriptionImage").src = configListingUrl + document.getElementById("keyword").value.trim() + configdescriptionImageExtension;
1404
    document.getElementById("image1anchor").href = document.getElementById("image1").src;
1405
    document.getElementById("image2anchor").href = document.getElementById("image2").src;
1406
    unsetAdditionalImages();
1407
 
1408
    for (i = 0; i < additionalPictures.length; i++) {
1409
        if (additionalPictures[i] !== undefined && additionalPictures[i][0].startsWith(document.getElementById("keyword").value.trim())) {
1410
            if (additionalPictures[i].length > maxAdditionalImages) {
1411
                document.getElementById("productinfo").innerHTML += '<p class="bg-danger"><strong>Too many additional images.</a></strong></p>';
1412
            } else {
1413
                for (j = 0; j < additionalPictures[i].length + 4; j++) {
1414
                    setAdditionalImage(j + 3, additionalPictures[i][j]);
1415
                }
1416
            }
1417
        }
1418
    }
1419
}
1420
 
1421
function getYear(str) {
1422
    return str.match(/[12][0-9][0-9][0-9]/);
1423
}
1424
 
1425
function fillManualForm(type) {
1426
    var n;
1427
    var x;
1428
 
1429
    hideDetailWindows();
1430
 
1431
    if (document.getElementById("format").value.length <= 1) {
12 - 1432
        $('#format').selectpicker('val', auctionFormat[type]);
1433
        $('#format').selectpicker('refresh');
10 - 1434
    }
1435
 
1436
    if (type === 0) {
12 - 1437
        $('#category').selectpicker('val', "171243");
1438
        $('#category').selectpicker('refresh');
10 - 1439
        if (isNumeric(catalogTitle)) {
1440
            document.getElementById("bookISBN").value = catalogTitle;
1441
        } else {
1442
            document.getElementById("bookISBN").value = configDoesNotApply;
1443
        }
1444
        document.getElementById("bookLanguage").value = configDefaultLanguage;
1445
        document.getElementById("bookCountry").value = configDefaultCountry;
1446
        categoryValues();
1447
        x = document.getElementById("bookDetails");
1448
        if (x.className.indexOf("w3-show") == -1) {
1449
            x.className += " w3-show";
1450
        }
1451
 
12 - 1452
        $('#bookFormat').selectpicker('val', "");
10 - 1453
        $('#bookFormat').prop('disabled', false).selectpicker('refresh');
12 - 1454
        $('#bookSubject').selectpicker('val', "");
10 - 1455
        $('#bookSubject').prop('disabled', false).selectpicker('refresh');
1456
    } else if (type == 1) {
1457
        document.getElementById("category").value = "176984";
12 - 1458
        $('#category').selectpicker('val', "176984");
1459
        $('#category').selectpicker('refresh');
10 - 1460
        if (isNumeric(catalogTitle)) {
1461
            document.getElementById("cdUPC").value = catalogTitle;
1462
        } else {
1463
            document.getElementById("cdUPC").value = configDoesNotApply;
1464
            if ((n = catalogTitle.indexOf(" - ")) > 0) {
1465
                document.getElementById("cdArtist").value = catalogTitle.substr(0, n);
1466
            }
1467
        }
1468
        document.getElementById("cdCountry").value = configDefaultCountry;
1469
        categoryValues();
1470
 
12 - 1471
        document.getElementById("cdDuration").selectedIndex = 0;
10 - 1472
        $('#cdDuration').prop('disabled', false).selectpicker('refresh');
12 - 1473
        $('#cdGenre').selectpicker('val', "");
10 - 1474
        $('#cdGenre').prop('disabled', false).selectpicker('refresh');
1475
 
1476
        x = document.getElementById("cdDetails");
1477
        if (x.className.indexOf("w3-show") == -1) {
1478
            x.className += " w3-show";
1479
        }
1480
 
1481
        findDiscogsReleases(document.getElementById("keyword").value);
1482
        $('#cdTracks').on('change input cut paste',updateTracklistPreview);
1483
    } else if (type == 2) {
12 - 1484
        $('#category').selectpicker('val', "617");
1485
        $('#category').selectpicker('refresh');
10 - 1486
        if (isNumeric(catalogTitle)) {
1487
            document.getElementById("dvdUPC").value = catalogTitle;
1488
        } else {
1489
            document.getElementById("dvdUPC").value = configDoesNotApply;
1490
        }
1491
        document.getElementById("dvdCountry").value = configDefaultCountry;
1492
        categoryValues();
1493
        x = document.getElementById("dvdDetails");
1494
        if (x.className.indexOf("w3-show") == -1) {
1495
            x.className += " w3-show";
1496
        }
1497
 
12 - 1498
        $('#dvdFormat').selectpicker('val', 'DVD');
1499
        $('#dvdGenre').selectpicker('val', "");
1500
        $('#dvdRating').selectpicker('val', "");
1501
        $('#dvdRegionCode').selectpicker('val', 'DVD: 1 (US, Canada...)');
1502
        $('#dvdRental').selectpicker('val', 'No');
1503
        $('#dvdSeason').selectpicker('val', "");
10 - 1504
        $('#dvdFormat').prop('disabled', false).selectpicker('refresh');
1505
        $('#dvdGenre').prop('disabled', false).selectpicker('refresh');
1506
        $('#dvdRating').prop('disabled', false).selectpicker('refresh');
1507
        $('#dvdRegionCode').prop('disabled', false).selectpicker('refresh');
1508
        $('#dvdRental').prop('disabled', false).selectpicker('refresh');
1509
        $('#dvdSeason').prop('disabled', false).selectpicker('refresh');
1510
    } else if (type == 3) {
1511
        catalogTitle = document.getElementById("keyword").value.trim();
1512
        splitTradingCardElements();
1513
    }
1514
 
1515
    fillForm();
1516
}
1517
 
1518
function resetForm() {
1519
    var i;
1520
 
1521
    document.getElementById("searchForm").reset();
1522
    document.getElementById("listForm").reset();
1523
    document.getElementById("productinfo").innerHTML = "<p>Product Info</p>";
1524
    initConfig();
1525
    clearStatusWindows();
1526
    for (i = 1; i <= 7; i++) {
1527
        document.getElementById("image" + i).src = "";
1528
    }
1529
    document.getElementById("descriptionImage").src = "";
1530
    hideDetailWindows();
1531
}
1532
 
1533
function verifyListingImage() {
1534
    if (eBayAuthTokenFlag === false) {
1535
        return;
1536
    }
1537
    if (isDuplicate) {
1538
        window.alert("This is a duplicate.");
1539
        return;
1540
    }
1541
 
1542
    var x = document.getElementById("results");
1543
    x.innerHTML = '';
1544
    if (x.className.indexOf("w3-show") == -1) {
1545
        x.className += " w3-show";
1546
    }
1547
 
1548
    if (ImageURLs.length === 0) {
1549
        uploadSiteHostedPictures();
1550
    } else {
1551
        verifyListing();
1552
    }
1553
}
1554
 
1555
function verifyListing() {
1556
    var i;
1557
    var authErrorFlag = false;
1558
 
1559
    var xw = new XMLWriter('UTF-8', '1.0');
1560
    var xhr = new XMLHttpRequest();
1561
 
1562
    if (!createAddXML(xw, xhr, 'VerifyAddItemRequest', 'VerifyAddItem', false)) {
1563
        return;
1564
    }
1565
 
1566
    xml = xw.flush();
1567
    xw.close();
1568
 
1569
    xhr.onload = function() {
1570
        var jsonObj = XMLparse(xhr.responseXML, false);
1571
        var obj = jsonObj.VerifyAddItemResponse;
1572
        var returnCode = obj.Ack;
1573
        var x = document.getElementById("results");
1574
        var str = "";
1575
 
1576
        if (returnCode == 'Success' ||
1577
            (returnCode == 'Warning' && (obj.Errors.ErrorCode == '21917108' || obj.Errors.ErrorCode == '21920205' || obj.Errors.ErrorCode == '21917164'))) {
1578
            listButtonHot(true);
1579
 
1580
            str += '<div class="alert ' + (returnCode == 'Success' ? "alert-success" : "alert-warning" ) + ' alert-dismissible">';
1581
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1582
            str += '<p><strong>' + returnCode + ':</strong></p>';
1583
 
1584
            if (returnCode == 'Warning') {
1585
                str += "<p>" + obj.Errors.SeverityCode + " (" + obj.Errors.ErrorCode + "): " + escapeHtml(obj.Errors.LongMessage) + "</p>";
1586
            }
1587
            var fees = getJsonArray(obj.Fees.Fee);
1588
            str += "<ul>";
1589
            for (i = 0; i < fees.length; i++) {
1590
                if (fees[i].Fee.text !== "0.0") {
1591
                    str += '<li>' + fees[i].Name + ": $" + Number(fees[i].Fee.text).toFixed(2) + "</li>";
1592
                }
1593
            }
1594
 
1595
            if (obj.DiscountReason) {
1596
                str += "<li>Discount Reason: " + obj.DiscountReason + "</li>";
1597
            }
1598
 
1599
            str += "</ul>";
1600
            str += '</div>';
1601
 
1602
            var recommendations = getJsonArray(obj.ListingRecommendations.Recommendation);
1603
            for (i = 0; i < recommendations.length; i++) {
1604
                str += '<div class="alert alert-info alert-dismissible">';
1605
                str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1606
                str += decode(recommendations[i]);
1607
                str += '</div>';
1608
            }
1609
 
1610
            x.innerHTML += str;
1611
        } else {
1612
            requireNewVerify();
1613
 
1614
            str += '<div class="alert alert-danger alert-dismissible">';
1615
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1616
            str += '<p><strong>' + returnCode + ':</strong></p>';
1617
 
1618
            var errors = getJsonArray(obj.Errors);
1619
            str += "<ul>";
1620
            for (i = 0; i < errors.length; i++) {
1621
                str += '<li>' + errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "</li>";
1622
                if (errors[i].LongMessage.includes('Auth')) {
1623
                    authErrorFlag = true;
1624
                }
1625
            }
1626
            str += "</ul>";
1627
 
1628
            if (obj.DuplicateInvocationDetails) {
1629
                str += '<p>Duplicate Invocation Id ' + obj.DuplicateInvocationDetails.DuplicateInvocationID + ' Tracking Id' + obj.DuplicateInvocationDetails.InvocationTrackingID + ' Status ' + obj.DuplicateInvocationDetails.Status + '</p>';
1630
            }
1631
 
1632
            str += "</div>";
1633
            x.innerHTML += str;
1634
 
1635
            if (authErrorFlag === true) {
1636
                eBayAuthTokenFlag = false;
1637
                x = document.getElementById("login");
1638
                if (x.className.indexOf("w3-show") == -1) {
1639
                    x.className += " w3-show";
1640
                }
1641
            }
1642
        }
1643
 
1644
        if (obj.Message) {
1645
            str += '<div class="alert alert-info alert-dismissible">';
1646
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1647
            str += '<p>' + obj.Message + '</p>';
1648
            str += '</div>';
1649
            x.innerHTML += str;
1650
        }
1651
    };
1652
 
1653
    xhr.send(xml);
1654
}
1655
 
1656
function decode(recommendation) {
1657
    var str = "<p>";
1658
    var i;
1659
 
1660
    str += recommendation.Code + " (" + recommendation.Type + "/" + recommendation.Group + ") for '" + recommendation.FieldName;
1661
    if (recommendation.Value) {
1662
        str += "': " + recommendation.Value;
1663
    }
1664
 
1665
    if (recommendation.Message) {
1666
        str += "<br/>" + recommendation.Message;
1667
    }
1668
 
1669
    var metadata = recommendation.Metadata;
1670
    if (metadata) {
1671
        if (metadata.length > 0) {
1672
            for (i = 0; i < metadata.length; i++) {
1673
                if (metadata[i].Name != "correlationId" &&
1674
                    metadata[i].Name != "currency" &&
1675
                    metadata[i].Name != "similarItems") {
1676
                    str += "<br/>" + metadata[i].Name + " = " + metadata[i].Value;
1677
                }
1678
            }
1679
        } else {
1680
            if (metadata.Name != "correlationId" &&
1681
                metadata.Name != "currency" &&
1682
                metadata.Name != "similarItems") {
1683
                str += "<br/>" + metadata.Name + " = " + metadata.Value;
1684
            }
1685
        }
1686
    }
1687
 
1688
    str += "</p>";
1689
 
1690
    return str;
1691
}
1692
 
1693
function submitListing(saveFlag) {
1694
    var i;
1695
    var authErrorFlag = false;
1696
 
1697
    if (document.getElementById("list").className.indexOf("btn-success") == -1) {
1698
        return;
1699
    }
1700
 
1701
    var xw = new XMLWriter('UTF-8', '1.0');
1702
    var xhr = new XMLHttpRequest();
1703
 
1704
    createAddXML(xw, xhr, 'AddItemRequest', 'AddItem', saveFlag);
1705
 
1706
    xml = xw.flush();
1707
    xw.close();
1708
 
1709
    xhr.onload = function() {
1710
        var jsonObj = XMLparse(xhr.responseXML, false);
1711
        var obj = jsonObj.AddItemResponse;
1712
        var str = '';
1713
        var returnCode = obj.Ack;
1714
 
1715
        var x = document.getElementById("results");
1716
        if (x.className.indexOf("w3-show") == -1) {
1717
            x.className += " w3-show";
1718
        }
1719
 
1720
        if (returnCode == 'Success' ||
1721
            (returnCode == 'Warning' && (obj.Errors.ErrorCode == '21917108' || obj.Errors.ErrorCode == '21920205' || obj.Errors.ErrorCode == '21917164'))) {
1722
            listButtonHot(false);
1723
            moveImages();
1724
            ImageURLs = [];
1725
            document.getElementById("title").value = "";
1726
            printTitleLength();
1727
            deleteSubmittedEntry();
1728
 
1729
 
1730
            str += '<div class="alert ' + (returnCode == 'Success' ? "alert-success" : "alert-warning" ) + ' alert-dismissible">';
1731
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1732
            str += '<p><strong>' + returnCode + '</strong>, Item Id <a href="https://www.ebay.com/itm/' + obj.ItemID + '" target="_blank">' + obj.ItemID + '</a></p>';
1733
 
1734
            if (returnCode == 'Warning') {
1735
                str += "<p>" + obj.Errors.SeverityCode + " (" + obj.Errors.ErrorCode + "): " + escapeHtml(obj.Errors.LongMessage) + "</p>";
1736
            }
1737
            var fees = getJsonArray(obj.Fees.Fee);
1738
            str += "<ul>";
1739
            for (i = 0; i < fees.length; i++) {
1740
                if (fees[i].Fee.text !== "0.0") {
1741
                    str += '<li>' + fees[i].Name + ": $" + Number(fees[i].Fee.text).toFixed(2) + "</li>";
1742
                }
1743
            }
1744
 
1745
            if (obj.DiscountReason) {
1746
                str += "<li>Discount Reason: " + obj.DiscountReason + "</li>";
1747
            }
1748
 
1749
            str += '</ul>';
1750
            str += '</div>';
1751
 
12 - 1752
            x.innerHTML = str;
10 - 1753
        } else {
1754
            requireNewVerify();
1755
            str += '<div class="alert alert-danger alert-dismissible">';
1756
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1757
            str += '<p><strong>' + returnCode + ':</strong></p>';
1758
 
1759
            var errors = getJsonArray(obj.Errors);
1760
            str += "<ul>";
1761
            for (i = 0; i < errors.length; i++) {
1762
                str += '<li>' + errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "</li>";
1763
                if (errors[i].LongMessage.includes('Auth')) {
1764
                    authErrorFlag = true;
1765
                }
1766
            }
1767
            str += "</ul>";
1768
 
1769
            if (obj.DuplicateInvocationDetails) {
1770
                str += '<p>Duplicate Invocation Id ' + obj.DuplicateInvocationDetails.DuplicateInvocationID + ' Tracking Id' + obj.DuplicateInvocationDetails.InvocationTrackingID + ' Status ' + obj.DuplicateInvocationDetails.Status + '</p>';
1771
            }
1772
 
1773
            str += "</div>";
12 - 1774
            x.innerHTML = str;
10 - 1775
 
1776
            if (authErrorFlag === true) {
1777
                eBayAuthTokenFlag = false;
1778
                x = document.getElementById("login");
1779
                if (x.className.indexOf("w3-show") == -1) {
1780
                    x.className += " w3-show";
1781
                }
1782
            }
1783
        }
1784
 
1785
        unsetAdditionalImages();
1786
    };
1787
 
1788
    if (saveFlag) {
1789
        var sPos = xml.indexOf('<Item>');
1790
        var ePos = xml.indexOf('</Item>');
1791
        var textToSave = xml.substr(sPos, ePos - sPos + 7);
1792
        var textToSaveAsBlob = new Blob([String(textToSave)], {
1793
            type: "text/xml"
1794
        });
1795
        var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
1796
        var fileNameToSaveAs = document.getElementById('keyword').value + ".xml";
1797
        var str = '';
1798
 
1799
        var downloadLink = document.createElement("a");
1800
        downloadLink.download = fileNameToSaveAs;
1801
        downloadLink.innerHTML = "Download File";
1802
        downloadLink.href = textToSaveAsURL;
1803
        downloadLink.onclick = destroyClickedElement;
1804
        downloadLink.style.display = "none";
1805
        document.body.appendChild(downloadLink);
1806
 
1807
        str += '<div class="alert alert-success alert-dismissible">';
1808
        str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1809
        str += '<p><strong>XML Saved</strong>, Filename ' + fileNameToSaveAs;
1810
        str += '</div>';
1811
        document.getElementById("results").innerHTML = str;
1812
 
1813
        downloadLink.click();
1814
        listButtonHot(false);
1815
        moveImages();
1816
        ImageURLs = [];
1817
        unsetAdditionalImages();
1818
        deleteSubmittedEntry();
1819
    } else {
1820
        xhr.send(xml);
1821
    }
1822
}
1823
 
1824
function moveImages() {
1825
    var i, j;
1826
    var item = document.getElementById("keyword").value.trim();
1827
    var images = [];
1828
 
1829
    images.push(item + configImage1Extension);
1830
    images.push(item + configImage2Extension);
1831
    images.push(item + configdescriptionImageExtension);
1832
 
1833
    for (i = 0; i < additionalPictures.length; i++) {
1834
        if (additionalPictures[i] !== undefined && additionalPictures[i][0].startsWith(item)) {
1835
            for (j = 0; j < additionalPictures[i].length; j++) {
1836
                images.push(additionalPictures[i][j]);
1837
            }
1838
        }
1839
    }
1840
 
1841
    for (i=0; i < images.length; i++) {
1842
        var xhttp = new XMLHttpRequest();
1843
        xhttp.onreadystatechange = function() {
1844
            if (this.readyState == 4 && this.status == 200) {
1845
            } else if (this.readyState == 4 && this.status == 400) {
1846
            }
1847
        };
1848
 
1849
        xhttp.open("GET", "moveImage.php?filename=" + images[i], true);
1850
        xhttp.send();
1851
    }
1852
}
1853
 
1854
function destroyClickedElement(event) {
1855
    document.body.removeChild(event.target);
1856
}
1857
 
1858
function deleteSubmittedEntry() {
1859
    var x = document.getElementById("keyword");
1860
    x.remove(x.selectedIndex);
1861
    x.selectedIndex = -1;
1862
    $("#keyword").selectpicker('refresh');
1863
}
1864
 
1865
function createAddXML(xw, xhr, xmlrequest, callname, saveFlag) {
1866
    var errorText = "";
1867
    var ShippingProfileName;
1868
    var ShippingProfileId;
1869
    var si, opt;
1870
    var weightInOz;
1871
 
1872
    if (picturesAreLoaded === false) {
1873
        errorText += "<li>Images not yet uploaded!</li>";
1874
    }
1875
 
1876
    if (document.getElementById("format").value <= 1) {
1877
        errorText += "<li>Select Auction Format!</li>";
1878
    }
1879
 
1880
    if (document.getElementById("sku").value == 'Batch X') {
1881
        errorText += "<li>Wrong Batch Number!</li>";
1882
    }
1883
 
1884
    if (document.getElementById("category").value == '0') {
1885
        errorText += "<li>Wrong Category!</li>";
1886
    }
1887
 
1888
    if (document.getElementById("sku").value.length < 1) {
1889
        errorText += "<li>Batch Number Empty!</li>";
1890
    }
1891
 
1892
    if (document.getElementById("condition").value === "") {
1893
        errorText += "<li>Condition Description Empty!</li>";
1894
    }
1895
 
1896
    if (document.getElementById("quantity").value === "") {
1897
        errorText += "<li>Quantity Empty!</li>";
1898
    }
1899
 
1900
    if (document.getElementById("price").value === "") {
1901
        errorText += "<li>Price Empty!</li>";
1902
    }
1903
 
1904
    if (document.getElementById("title").value === "") {
1905
        errorText += "<li>Title Empty!</li>";
1906
    }
1907
 
1908
    if (errorText.length > 0) {
1909
        var str = '';
1910
        var x = document.getElementById("results");
1911
        str += '<div class="alert alert-danger alert-dismissible">';
1912
        str += '<button type="button" class="close" data-dismiss="alert">×</button>';
1913
        str += '<h2>Form Errors</h2><ul>' + errorText + '</ul>';
1914
        str += '</div>';
1915
        x.innerHTML += str;
1916
        if (x.className.indexOf("w3-show") == -1) {
1917
            x.className += " w3-show";
1918
        }
1919
 
1920
        return;
1921
    }
1922
 
1923
    xw.writeStartDocument();
1924
    xw.writeStartElement(xmlrequest);
1925
    xw.writeAttributeString('xmlns', 'urn:ebay:apis:eBLBaseComponents');
1926
 
1927
    xw.writeStartElement('RequesterCredentials');
1928
    xw.writeElementString('eBayAuthToken', eBayAuthToken);
1929
    xw.writeEndElement(); /* RequesterCredentials */
1930
 
1931
    xw.writeStartElement('Item');
1932
 
1933
    if (CC == 3 || saveFlag) {
1934
        xw.writeElementString('UUID', document.getElementById('keyword').value.hashCode().pad(32));
1935
    }
1936
 
1937
    xw.writeElementString('Site', 'US');
1938
    xw.writeElementString('Country', 'US');
1939
    xw.writeElementString('PostalCode', configZip);
1940
    xw.writeElementString('Currency', 'USD');
1941
    xw.writeElementString('HitCounter', 'HiddenStyle');
1942
 
1943
    var format = document.getElementById('format').value;
1944
    xw.writeElementString('ListingType', format);
1945
    if (format == 'Chinese') {
1946
        xw.writeElementString('ListingDuration', 'Days_7');
1947
    } else if (format == 'FixedPriceItem') {
1948
        xw.writeElementString('ListingDuration', 'Days_30');
1949
    }
1950
 
1951
    xw.writeStartElement('PrimaryCategory');
1952
    xw.writeElementString('CategoryID', category);
1953
    xw.writeEndElement(); /* PrimaryCategory */
1954
 
1955
    if (document.getElementById("category").value != '29223') {
1956
        xw.writeElementString('ConditionID', document.getElementById('conditionId').value);
1957
    }
1958
    if (document.getElementById('conditionId').value != '1000') {
1959
        xw.writeElementString('ConditionDescription', escapeXml(document.getElementById('condition').value));
1960
    }
1961
 
1962
    xw.writeStartElement('StartPrice');
1963
    xw.writeAttributeString('currencyID', 'USD');
1964
    xw.writeString(document.getElementById('price').value);
1965
    xw.writeEndElement(); /* StartPrice */
1966
 
1967
    xw.writeElementString('PayPalEmailAddress', configLinkedPayPal);
1968
    xw.writeElementString('PaymentMethods', 'PayPal');
1969
    xw.writeElementString('Quantity', document.getElementById('quantity').value);
1970
    xw.writeElementString('Title', escapeXml(document.getElementById('title').value));
1971
    if (!isManualMode) {
1972
        xw.writeElementString('SKU', escapeXml(document.getElementById('sku').value));
1973
    } else {
1974
        if (isNumeric(document.getElementById('keyword').value.trim())) {
1975
            xw.writeElementString('SKU', escapeXml(document.getElementById('sku').value + ' - ' + ProductListingDetailsNameList[CC] + ' ' + document.getElementById('keyword').value.trim()));
1976
        } else {
1977
            xw.writeElementString('SKU', escapeXml(document.getElementById('sku').value));
1978
        }
1979
    }
1980
 
1981
    xw.writeStartElement('SellerProfiles');
1982
    xw.writeStartElement('SellerPaymentProfile');
1983
    xw.writeElementString('PaymentProfileID', '116958658023');
1984
    xw.writeElementString('PaymentProfileName', 'PayPal');
1985
    xw.writeEndElement(); /* SellerPaymentProfile */
1986
    xw.writeStartElement('SellerReturnProfile');
1987
    xw.writeElementString('ReturnProfileID', '123043332023');
1988
    xw.writeElementString('ReturnProfileName', 'Returns Accepted,Buyer,30 Days,Money Back');
1989
    xw.writeEndElement(); /* SellerReturnProfile */
1990
 
1991
    xw.writeStartElement('SellerShippingProfile');
1992
    ShippingProfileId = ShippingProfileIdList[CC];
1993
    ShippingProfileName = ShippingProfileNameList[CC];
1994
    if (CC == 1) {
1995
        if (document.getElementById('title').value.includes('Discs') || discogsQty > 1) {
1996
            ShippingProfileId = ShippingProfileIdList[2];
1997
            ShippingProfileName = ShippingProfileNameList[2];
1998
        }
1999
    }
2000
    xw.writeElementString('ShippingProfileID', ShippingProfileId);
2001
    xw.writeElementString('ShippingProfileName', ShippingProfileName);
2002
    xw.writeEndElement(); /* SellerShippingProfile */
2003
 
2004
    xw.writeEndElement(); /* SellerProfiles */
2005
 
2006
    if (CC == 1) {
2007
        weightInOz = 4;
2008
 
2009
        if (discogsQty > 0) {
2010
            weightInOz = discogsQty * 4;
2011
        }
2012
 
2013
        if (document.getElementById('title').value.includes('Discs')) {
2014
            var pos = document.getElementById('title').value.indexOf('Discs');
2015
            var discNo = Number(document.getElementById('title').value.substr(pos - 2, 1));
2016
            if (discNo > 1) {
2017
                weightInOz = discNo * 4;
2018
            }
2019
        }
2020
 
2021
        xw.writeStartElement('ShippingPackageDetails');
2022
        xw.writeElementString('ShippingPackage', 'PackageThickEnvelope');
2023
        xw.writeElementString('ShippingIrregular', 'false');
2024
        xw.writeElementString('MeasurementUnit', 'English');
2025
        xw.writeElementString('WeightMajor', '0');
2026
        xw.writeElementString('WeightMinor', weightInOz.toString());
2027
        xw.writeEndElement(); /* ShippingPackageDetails> */
2028
    } else if (CC == 2) {
2029
        xw.writeStartElement('ShippingPackageDetails');
2030
        xw.writeElementString('ShippingPackage', 'PackageThickEnvelope');
2031
        xw.writeElementString('ShippingIrregular', 'false');
2032
        xw.writeElementString('MeasurementUnit', 'English');
2033
        xw.writeElementString('WeightMajor', '0');
2034
        xw.writeElementString('WeightMinor', '6');
2035
        xw.writeEndElement(); /* ShippingPackageDetails> */
2036
    } else if (CC == 3) {
2037
        xw.writeStartElement('ShippingPackageDetails');
2038
        xw.writeElementString('ShippingPackage', 'Letter');
2039
        xw.writeElementString('ShippingIrregular', 'false');
2040
        xw.writeElementString('MeasurementUnit', 'English');
2041
        xw.writeElementString('WeightMajor', '0');
2042
        xw.writeElementString('WeightMinor', '1');
2043
        xw.writeEndElement(); /* ShippingPackageDetails> */
2044
    }
2045
 
2046
    xw.writeStartElement('ProductListingDetails');
2047
    if (CC == 3) {
2048
        xw.writeElementString(ProductListingDetailsNameList[CC], configDoesNotApply);
2049
    } else {
2050
        si = document.getElementById("keyword").selectedIndex;
2051
        opt = document.getElementById("keyword").options;
2052
        if (!isManualMode) {
2053
            if (eBayProductId.length > 0) {
2054
                xw.writeElementString('ProductReferenceID', eBayProductId);
2055
            } else {
2056
                if (isNumeric(document.getElementById('keyword').value.trim())) {
2057
                    if (opt[si].style.color != 'red') {
2058
                        xw.writeElementString(ProductListingDetailsNameList[CC], document.getElementById('keyword').value.trim());
2059
                    } else {
2060
                        xw.writeElementString(ProductListingDetailsNameList[CC], configDoesNotApply);
2061
                    }
2062
                } else {
2063
                    xw.writeElementString(ProductListingDetailsNameList[CC], configDoesNotApply);
2064
                }
2065
            }
2066
        } else {
2067
            if (opt[si].style.color == 'red') {
2068
                xw.writeElementString(ProductListingDetailsNameList[CC], configDoesNotApply);
2069
            } else if (CC === 0) {
2070
                xw.writeElementString(ProductListingDetailsNameList[CC], document.getElementById('bookISBN').value.trim());
2071
            } else if (CC == 1) {
2072
                xw.writeElementString(ProductListingDetailsNameList[CC], document.getElementById('cdUPC').value.trim());
2073
            } else if (CC == 2) {
2074
                xw.writeElementString(ProductListingDetailsNameList[CC], document.getElementById('dvdUPC').value.trim());
2075
            }
2076
        }
2077
    }
2078
    xw.writeEndElement(); /* ProductListingDetails */
2079
 
2080
    xw.writeStartElement('Storefront');
2081
    if (CC != 3) {
2082
        xw.writeElementString('StoreCategoryID', StoreCategoryList[CC]);
2083
    } else {
2084
        if (category == "666") {
2085
            xw.writeElementString('StoreCategoryID', "30431905018");
2086
        } else if (category == "213") {
2087
            xw.writeElementString('StoreCategoryID', "30431901018");
2088
        } else if (category == "214") {
2089
            xw.writeElementString('StoreCategoryID', "30431902018");
2090
        } else if (category == "215") {
2091
            xw.writeElementString('StoreCategoryID', "30431903018");
2092
        } else if (category == "216") {
2093
            xw.writeElementString('StoreCategoryID', "30431904018");
2094
        } else {
2095
            xw.writeElementString('StoreCategoryID', "");
2096
        }
2097
    }
2098
    xw.writeEndElement(); /* Storefront */
2099
 
2100
    xw.writeStartElement('PictureDetails');
2101
    for (var imageNumber = 0; imageNumber < ImageURLs.length; imageNumber++) {
2102
        xw.writeElementString('PictureURL', ImageURLs[imageNumber]);
2103
    }
2104
    xw.writeEndElement(); /* PictureDetails */
2105
 
2106
    // Use Tax Table
2107
    //	xw.writeStartElement('ShippingDetails');
2108
    //	xw.writeStartElement('SalesTax');
2109
    //	xw.writeElementString('SalesTaxPercent', configTaxRate);
2110
    //	xw.writeElementString('SalesTaxState', configTaxStateId);
2111
    //	xw.writeElementString('ShippingIncludedInTax', 'false');
2112
    //	xw.writeEndElement(); /* SalesTax */
2113
    //	xw.writeEndElement(); /* ShippingDetails */
2114
    xw.writeElementString('UseTaxTable', 'true');
2115
 
2116
    if (document.getElementById('bestoffer').checked) {
2117
        var autoAcceptPrice = Number(document.getElementById('price').value) * configAutoAcceptPrice;
2118
        var minBestOfferPrice = Number(document.getElementById('price').value) * configMinBestOfferPrice;
2119
 
2120
        xw.writeStartElement('BestOfferDetails');
2121
        xw.writeElementString('BestOfferEnabled', 'true');
2122
        xw.writeEndElement(); /* BestOfferDetails */
2123
        xw.writeStartElement('ListingDetails');
2124
        xw.writeStartElement('BestOfferAutoAcceptPrice');
2125
        xw.writeAttributeString('currencyID', 'USD');
2126
        xw.writeString(autoAcceptPrice.toFixed(2));
2127
        xw.writeEndElement(); /* BestOfferAutoAcceptPrice */
2128
        xw.writeStartElement('MinimumBestOfferPrice');
2129
        xw.writeAttributeString('currencyID', 'USD');
2130
        xw.writeString(minBestOfferPrice.toFixed(2));
2131
        xw.writeEndElement(); /* MinimumBestOfferPrice */
2132
        xw.writeEndElement(); /* ListingDetails */
2133
    }
2134
 
2135
    var Desc = Description1;
2136
    Desc += '<h3>' + document.getElementById('title').value + '</h3>';
2137
    generateDescCore();
2138
    Desc += DescCore;
2139
    if (document.getElementById('conditionId').value != '1000') {
2140
        Desc += '<p>' + document.getElementById('condition').value + '</p>';
2141
    }
2142
    Desc += Description2;
2143
    Desc += document.getElementById('title').value.replace(/['"]+/g, '');
2144
    Desc += Description2a;
2145
    Desc += DescImage;
2146
    Desc += Description3;
2147
    if (CC !== 3) {
2148
        Desc += DescriptionFreeShipping;
2149
    } else {
2150
        Desc += DescriptionTradingCardShipping;
2151
    }
2152
    Desc += Description4;
2153
    xw.writeElementString('Description', escapeXml(Desc));
2154
 
2155
    if (callname.includes('Verify') && configGetRecommendations === true) {
2156
        xw.writeElementString('IncludeRecommendations', 'true');
2157
    }
2158
 
2159
    generateItemSpecifics(xw);
2160
 
2161
    xw.writeEndElement(); /* Item */
2162
 
2163
    xw.writeElementString('ErrorLanguage', 'en_US');
2164
    xw.writeElementString('Version', configeBayTradingVersion);
2165
    xw.writeElementString('WarningLevel', configWarningLevel);
2166
 
2167
    xw.writeEndElement(); /* xmlrequest */
2168
    xw.writeEndDocument();
2169
 
2170
    xhr.open('POST', configProxyUrl, true);
2171
    xhr.setRequestHeader('Content-Type', 'text/xml');
2172
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
2173
    xhr.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL', configeBayTradingVersion);
2174
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', callname);
2175
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
2176
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', '');
2177
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', '');
2178
    xhr.setRequestHeader('X-Proxy-URL', configServiceEndpoint);
2179
 
2180
    return true;
2181
}
2182
 
2183
function categoryValues() {
2184
    category = document.getElementById("category").value;
2185
 
2186
    if (category == 182882 || category == 171228 || category == 171243 || category == 2228 || category == 268) {
2187
        /* Books */
2188
        CC = 0;
2189
        conditionDescriptionButtons(0);
2190
    } else if (category == 176984 || category == 29792) {
2191
        /* CDs */
2192
        CC = 1;
2193
        conditionDescriptionButtons(1);
2194
    } else if (category == 617) {
2195
        /* DVDs */
2196
        CC = 2;
2197
        conditionDescriptionButtons(0);
2198
    } else if (category == 666 || category == 213 || category == 214 || category == 133072 || category == 215 || category == 4240 || category == 216 || category == 183444) {
2199
        /* Trading Cards */
2200
        CC = 3;
2201
        conditionDescriptionButtons(0);
2202
    } else {
2203
        conditionDescriptionButtons(0);
2204
        return;
2205
    }
2206
 
12 - 2207
    if (document.getElementById("format").value.length < 1) {
2208
        $('#format').selectpicker('val', auctionFormat[CC]);
2209
        $('#format').selectpicker('refresh');
10 - 2210
    }
2211
 
2212
    if (document.getElementById("price").value.length < 4) {
2213
        document.getElementById("price").value = MinPriceList[CC];
2214
    }
2215
 
2216
    document.getElementById("condition").value = ConditionDescriptionList[CC];
12 - 2217
    $('#conditionId').selectpicker('val', ConditionIdList[CC]);
2218
    $('#conditionId').selectpicker('refresh');
10 - 2219
    document.getElementById("quantity").value = 1;
2220
    document.getElementById("bestoffer").checked = false;
2221
}
2222
 
2223
function conditionDescriptionButtons(flag) {
2224
    var x = [];
2225
    x[0] = document.getElementById("CdConditionDescriptionSingular");
12 - 2226
    x[0].className = x[0].className.replace("btn-dark", "btn-info");
10 - 2227
    x[1] = document.getElementById("CdConditionDescriptionPlural");
12 - 2228
    x[1].className = x[1].className.replace("btn-info", "btn-dark");
10 - 2229
    x[2] = document.getElementById("CdConditionDescriptionDigipak");
12 - 2230
    x[2].className = x[2].className.replace("btn-info", "btn-dark");
10 - 2231
    x[3] = document.getElementById("CdConditionDescriptionNewCase");
12 - 2232
    x[3].className = x[3].className.replace("btn-info", "btn-dark");
10 - 2233
 
2234
    for (var i = 0; i < x.length; i++) {
2235
        if (flag) {
2236
            if (x[i].className.indexOf("w3-show-inline-block") == -1) {
2237
                x[i].className += " w3-show-inline-block";
2238
            }
2239
        } else {
2240
            x[i].className = x[i].className.replace(" w3-show-inline-block", "");
2241
        }
2242
    }
2243
}
2244
 
2245
function setCdConditionDescription(flag) {
12 - 2246
    var x = [];
2247
    x[0] = document.getElementById("CdConditionDescriptionSingular");
2248
    x[1] = document.getElementById("CdConditionDescriptionPlural");
2249
    x[2] = document.getElementById("CdConditionDescriptionDigipak");
2250
    x[3] = document.getElementById("CdConditionDescriptionNewCase");
2251
 
2252
    x[0].className = x[0].className.replace("btn-info", "btn-dark");
2253
    x[1].className = x[1].className.replace("btn-info", "btn-dark");
2254
    x[2].className = x[2].className.replace("btn-info", "btn-dark");
2255
    x[3].className = x[3].className.replace("btn-info", "btn-dark");
2256
 
10 - 2257
    if (flag == 'S') {
2258
        document.getElementById("condition").value = ConditionDescriptionList[1];
12 - 2259
        x[0].className = x[0].className.replace("btn-dark", "btn-info");
10 - 2260
    } else if (flag == 'P') {
2261
        document.getElementById("condition").value = ConditionDescriptionCdPlural;
12 - 2262
        x[1].className = x[1].className.replace("btn-dark", "btn-info");
10 - 2263
        discogsQty = 2;
2264
    } else if (flag == 'D') {
2265
        document.getElementById("condition").value = ConditionDescriptionCdDigipak;
2266
        document.getElementById("cdDigipak").checked = true;
12 - 2267
        x[2].className = x[2].className.replace("btn-dark", "btn-info");
10 - 2268
    } else if (flag == 'N') {
2269
        document.getElementById("condition").value = ConditionDescriptionCdNewCase;
12 - 2270
        x[3].className = x[3].className.replace("btn-dark", "btn-info");
10 - 2271
    }
2272
}
2273
 
2274
var minActive = [0.0, 0.0, 0.0];
2275
var maxActive = [0.0, 0.0, 0.0];
2276
var avgActive = [0.0, 0.0, 0.0];
2277
var noActive = [0, 0, 0];
2278
var minSold = [0.0, 0.0, 0.0];
2279
var maxSold = [0.0, 0.0, 0.0];
2280
var avgSold = [0.0, 0.0, 0.0];
2281
var noSold = [0, 0, 0];
2282
var minUnsold = [0.0, 0.0, 0.0];
2283
var maxUnsold = [0.0, 0.0, 0.0];
2284
var avgUnsold = [0.0, 0.0, 0.0];
2285
var noUnsold = [0, 0, 0];
2286
var maxPricingPages = [-1, -1];
2287
var totalPricingEntries = [0, 0];
2288
var newActiveBreakdown = [];
2289
var usedActiveBreakdown = [];
2290
var newSoldBreakdown = [];
2291
var usedSoldBreakdown = [];
2292
var maxPriceByNumber = [0.0, 0.0];
2293
var listingNumberPercentage = 0.25;
2294
 
2295
 
2296
function getPricing() {
2297
    minActive = [0.0, 0.0, 0.0];
2298
    maxActive = [0.0, 0.0, 0.0];
2299
    avgActive = [0.0, 0.0, 0.0];
2300
    noActive = [0, 0, 0];
2301
    minSold = [0.0, 0.0, 0.0];
2302
    maxSold = [0.0, 0.0, 0.0];
2303
    avgSold = [0.0, 0.0, 0.0];
2304
    noSold = [0, 0, 0];
2305
    minUnsold = [0.0, 0.0, 0.0];
2306
    maxUnsold = [0.0, 0.0, 0.0];
2307
    avgUnsold = [0.0, 0.0, 0.0];
2308
    noUnsold = [0, 0, 0];
2309
    maxPricingPages = [-1, -1];
2310
    totalPricingEntries = [0, 0];
2311
    newActiveBreakdown = [];
2312
    usedActiveBreakdown = [];
2313
    newSoldBreakdown = [];
2314
    usedSoldBreakdown = [];
2315
 
2316
    getPricingData(0);
2317
    getPricingData(1);
2318
}
2319
 
2320
function getPricingData(searchIndex) {
2321
    var index = 0;
2322
    var keyword;
2323
 
2324
    keyword = document.getElementById('keyword').value;
2325
 
2326
    // Construct the request
2327
    var url = configeBayFinding + "?";
2328
    if (searchIndex === 0) {
2329
        url += "OPERATION-NAME=findItemsAdvanced";
2330
    } else {
2331
        url += "OPERATION-NAME=findCompletedItems";
2332
    }
2333
    url += "&SECURITY-APPNAME=" + configAppid;
2334
    url += "&GLOBAL-ID=EBAY-US";
2335
    url += "&RESPONSE-DATA-FORMAT=JSON";
2336
    url += "&SERVICE-VERSION=" + configeBayFindingVersion;
2337
    url += "&REST-PAYLOAD";
2338
    url += "&keywords=";
2339
    url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
2340
 
2341
    url += "&paginationInput.entriesPerPage=100";
2342
    url += "&paginationInput.pageNumber=";
2343
    url += (index + 1);
2344
    url += "&buyerPostalCode=";
2345
    url += configZip;
2346
 
2347
    var xhttp = new XMLHttpRequest();
2348
 
2349
    xhttp.onreadystatechange = function() {
2350
        if (this.readyState == 4) {
2351
            if (searchIndex === 0) {
2352
                _cb_PriceActiveItems(JSON.parse(this.responseText));
2353
            } else {
2354
                _cb_PriceCompletedItems(JSON.parse(this.responseText));
2355
            }
2356
        }
2357
    };
2358
 
2359
    xhttp.open("GET", configProxyUrl, true);
2360
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2361
    xhttp.send();
2362
 
2363
    function waitForMaxPricingPages(i) {
2364
        if (maxPricingPages[i] < 0) {
2365
            window.setTimeout(waitForMaxPricingPages, 500, i); // wait 500 milliseconds
2366
        } else {
2367
            for (index = 1; index < maxPricingPages[searchIndex]; index++) {
2368
                // Construct the request
2369
                var url = configeBayFinding + "?";
2370
                if (searchIndex === 0) {
2371
                    url += "OPERATION-NAME=findItemsAdvanced";
2372
                } else {
2373
                    url += "OPERATION-NAME=findCompletedItems";
2374
                }
2375
                url += "&SECURITY-APPNAME=" + configAppid;
2376
                url += "&GLOBAL-ID=EBAY-US";
2377
                url += "&RESPONSE-DATA-FORMAT=JSON";
2378
                url += "&SERVICE-VERSION=" + configeBayFindingVersion;
2379
                url += "&REST-PAYLOAD";
2380
                url += "&keywords=";
2381
                url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
2382
 
2383
                url += "&paginationInput.entriesPerPage=100";
2384
                url += "&paginationInput.pageNumber=";
2385
                url += (index + 1);
2386
 
2387
                var xhttp = new XMLHttpRequest();
2388
 
2389
                xhttp.onreadystatechange = function() {
2390
                    if (this.readyState == 4) {
2391
                        if (searchIndex === 0) {
2392
                            _cb_PriceActiveItems(JSON.parse(this.responseText));
2393
                        } else {
2394
                            _cb_PriceCompletedItems(JSON.parse(this.responseText));
2395
                        }
2396
                    }
2397
                };
2398
 
2399
                xhttp.open("GET", configProxyUrl, true);
2400
                xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
2401
                xhttp.send();
2402
            }
2403
        }
2404
    }
2405
 
2406
    waitForMaxPricingPages(searchIndex);
2407
}
2408
 
2409
function _cb_PriceActiveItems(objArray) {
2410
    var array = typeof objArray.findItemsAdvancedResponse[0] != 'object' ? JSON.parse(objArray.findItemsAdvancedResponse[0]) : objArray.findItemsAdvancedResponse[0].searchResult[0].item;
2411
    totalPricingEntries[0] = Number(objArray.findItemsAdvancedResponse[0].paginationOutput[0].totalEntries);
2412
    if (totalPricingEntries[0] > 0) {
2413
        priceItem(array, 0);
2414
    }
2415
}
2416
 
2417
function _cb_PriceCompletedItems(objArray) {
2418
    var array = typeof objArray.findCompletedItemsResponse[0] != 'object' ? JSON.parse(objArray.findCompletedItemsResponse[0]) : objArray.findCompletedItemsResponse[0].searchResult[0].item;
2419
    totalPricingEntries[1] = Number(objArray.findCompletedItemsResponse[0].paginationOutput[0].totalEntries);
2420
    if (totalPricingEntries[1] > 0) {
2421
        priceItem(array, 1);
2422
    }
2423
}
2424
 
2425
function priceItem(array, index) {
2426
    var i;
2427
    var Title;
2428
    var shippingCost = 0.0;
2429
    var itemCost = 0.0;
2430
    var totalCost = 0.0;
2431
    var totalCostInt = 0;
2432
    var sellingStatus;
2433
    var sellingState;
2434
    var bidCount;
2435
    var condInd;
2436
    var condition;
2437
    var conditionId;
2438
    var shippingInfo;
2439
    var shippingServiceCost;
2440
    var convertedCurrentPrice;
2441
    var listingInfo;
2442
    var convertedBuyItNowPrice;
2443
    var JsonObj;
2444
 
2445
    if (array === undefined) {
2446
        return;
2447
    }
2448
 
2449
    if (totalPricingEntries[index] < 1) {
2450
        maxPricingPages[index] = 0;
2451
    } else {
2452
        maxPricingPages[index] = (totalPricingEntries[index] / 100) > 100 ? 100 : Math.trunc(totalPricingEntries[index] / 100.0) + 1;
2453
    }
2454
 
2455
    for (i = 0; i < array.length; i++) {
2456
        JsonObj = array[i];
2457
 
2458
        Title = JsonObj.title[0].toLowerCase();
2459
        if (Title.includes("disc only") > 0 ||
2460
            Title.includes("disk only") > 0 ||
2461
            Title.includes("only disc") > 0 ||
2462
            Title.includes("only disk") > 0 ||
2463
            Title.search(/dis[ck].*only/) > 0) {
2464
            continue; // exclude "disc only listing
2465
        }
2466
 
2467
        condition = JsonObj.condition;
2468
        if (condition) {
2469
            conditionId = condition[0].conditionId;
2470
            if (conditionId == 1000 || conditionId == 1500 || conditionId == 2750) {
2471
                condInd = 1;
2472
            } else if (conditionId <= 4000) {
2473
                condInd = 2;
2474
            } else {
2475
                continue; // Only 'Very Good' and better
2476
            }
2477
        } else {
2478
            condInd = 2;
2479
        }
2480
 
2481
        shippingInfo = JsonObj.shippingInfo;
2482
        shippingServiceCost = shippingInfo[0].shippingServiceCost;
2483
        if (shippingServiceCost) {
2484
            shippingCost = Number(shippingServiceCost[0].__value__);
2485
        } else {
2486
            shippingCost = 0.0;
2487
        }
2488
 
2489
        sellingStatus = JsonObj.sellingStatus;
2490
        sellingState = sellingStatus[0].sellingState;
2491
        bidCount = sellingStatus[0].bidCount;
2492
        convertedCurrentPrice = sellingStatus[0].convertedCurrentPrice;
2493
        itemCost = Number(convertedCurrentPrice[0].__value__);
2494
 
2495
        listingInfo = JsonObj.listingInfo;
2496
        convertedBuyItNowPrice = listingInfo[0].convertedBuyItNowPrice;
2497
        if (bidCount === 0 && convertedBuyItNowPrice) {
2498
            itemCost = Number(convertedBuyItNowPrice[0].__value__);
2499
        }
2500
 
2501
        if (condition) {
2502
            conditionId = condition[0].conditionId;
2503
            if (conditionId == 1000 || conditionId == 1500 || conditionId == 2750) {
2504
                condInd = 1;
2505
            } else {
2506
                condInd = 2;
2507
            }
2508
        } else {
2509
            condInd = 2;
2510
        }
2511
 
2512
        totalCost = itemCost + shippingCost;
2513
        totalCostInt = Math.ceil(totalCost);
2514
 
2515
        if (sellingState == "Active") {
2516
            if (totalCost < minActive[0] || !minActive[0]) {
2517
                minActive[0] = totalCost;
2518
            }
2519
            if (totalCost > maxActive[0]) {
2520
                maxActive[0] = totalCost;
2521
            }
2522
            avgActive[0] += totalCost;
2523
            ++noActive[0];
2524
 
2525
            if (totalCost < minActive[condInd] || !minActive[condInd]) {
2526
                minActive[condInd] = totalCost;
2527
            }
2528
            if (totalCost > maxActive[condInd]) {
2529
                maxActive[condInd] = totalCost;
2530
            }
2531
            avgActive[condInd] += totalCost;
2532
            ++noActive[condInd];
2533
 
2534
            if (condInd == 1) {
2535
                if (newActiveBreakdown[totalCostInt] === undefined) {
2536
                    newActiveBreakdown[totalCostInt] = 0;
2537
                }
2538
                ++newActiveBreakdown[totalCostInt];
2539
            } else {
2540
                if (usedActiveBreakdown[totalCostInt] === undefined) {
2541
                    usedActiveBreakdown[totalCostInt] = 0;
2542
                }
2543
                ++usedActiveBreakdown[totalCostInt];
2544
            }
2545
        } else if (sellingState == "EndedWithSales") {
2546
            if (totalCost < minSold[0] || !minSold[0]) {
2547
                minSold[0] = totalCost;
2548
            }
2549
            if (totalCost > maxSold[0]) {
2550
                maxSold[0] = totalCost;
2551
            }
2552
            avgSold[0] += totalCost;
2553
            ++noSold[0];
2554
 
2555
            if (totalCost < minSold[condInd] || !minSold[condInd]) {
2556
                minSold[condInd] = totalCost;
2557
            }
2558
            if (totalCost > maxSold[condInd]) {
2559
                maxSold[condInd] = totalCost;
2560
            }
2561
            avgSold[condInd] += totalCost;
2562
            ++noSold[condInd];
2563
 
2564
            if (condInd == 1) {
2565
                if (newSoldBreakdown[totalCostInt] === undefined) {
2566
                    newSoldBreakdown[totalCostInt] = 0;
2567
                }
2568
                ++newSoldBreakdown[totalCostInt];
2569
            } else {
2570
                if (usedSoldBreakdown[totalCostInt] === undefined) {
2571
                    usedSoldBreakdown[totalCostInt] = 0;
2572
                }
2573
                ++usedSoldBreakdown[totalCostInt];
2574
            }
2575
        } else /* Unsold */ {
2576
            if (totalCost < minUnsold[0] || !minUnsold[0]) {
2577
                minUnsold[0] = totalCost;
2578
            }
2579
            if (totalCost > maxUnsold[0]) {
2580
                maxUnsold[0] = totalCost;
2581
            }
2582
            avgUnsold[0] += totalCost;
2583
            ++noUnsold[0];
2584
 
2585
            if (totalCost < minUnsold[condInd] || !minUnsold[condInd]) {
2586
                minUnsold[condInd] = totalCost;
2587
            }
2588
            if (totalCost > maxUnsold[condInd]) {
2589
                maxUnsold[condInd] = totalCost;
2590
            }
2591
            avgUnsold[condInd] += totalCost;
2592
            ++noUnsold[condInd];
2593
        }
2594
    }
2595
 
2596
    var x = document.getElementById("prices");
2597
    if (x.className.indexOf("w3-show") == -1) {
2598
        x.className += " w3-show";
2599
    }
2600
 
2601
    var str = '<h3>Pricing Information (Shipping included)</h3>';
2602
    str += '<table class="table table-striped table-bordered table-hover">';
2603
    str += '	<thead class="thead-dark">';
2604
    str += '	<tr>';
2605
    str += '		<th></th>';
2606
    str += '		<th>Number</th>';
2607
    str += '        <th>Minimum</th>';
2608
    str += '        <th>Maximum</th>';
2609
    str += '        <th>Average</th>';
2610
    str += '	</tr>';
2611
    str += '	</thead>';
2612
    str += '	<tbody>';
2613
    str += '	<tr>';
2614
    str += '		<td>Active</td>';
2615
    str += '		<td>' + noActive[0] + '<br/>' + noActive[1] + ' / ' + noActive[2] + '</td>';
2616
    str += '		<td>$' + Number(minActive[0]).toFixed(2) + '<br/>$' + Number(minActive[1]).toFixed(2) + ' / $' + Number(minActive[2]).toFixed(2) + '</td>';
2617
    str += '		<td>$' + Number(maxActive[0]).toFixed(2) + '<br/>$' + Number(maxActive[1]).toFixed(2) + ' / $' + Number(maxActive[2]).toFixed(2) + '</td>';
2618
    str += '		<td>';
2619
    if (noActive[0]) {
2620
        str += '$' + Number(avgActive[0] / noActive[0]).toFixed(2);
2621
        str += '<br/>$' + (noActive[1] > 0 ? Number(avgActive[1] / noActive[1]).toFixed(2) : 0.00);
2622
        str += ' / $' + (noActive[2] > 0 ? Number(avgActive[2] / noActive[2]).toFixed(2) : 0.00);
2623
    }
2624
    str += '</td>';
2625
    str += '	</tr>';
2626
 
2627
    str += '<tr><td colspan="5">';
2628
    str += '<canvas id="activeChart" width="640" height="320" style="border:1px solid #000000;"></canvas>';
2629
    str += '</td></tr>';
2630
 
2631
    str += '	<tr>';
2632
    str += '		<td>Sold</td>';
2633
    str += '		<td>' + noSold[0] + '<br/>' + noSold[1] + ' / ' + noSold[2] + '</td>';
2634
    str += '		<td>$' + Number(minSold[0]).toFixed(2) + '<br/>$' + Number(minSold[1]).toFixed(2) + ' / $' + Number(minSold[2]).toFixed(2) + '</td>';
2635
    str += '		<td>$' + Number(maxSold[0]).toFixed(2) + '<br/>$' + Number(maxSold[1]).toFixed(2) + ' / $' + Number(maxSold[2]).toFixed(2) + '</td>';
2636
    str += '		<td>';
2637
    if (noSold[0]) {
2638
        str += '$' + Number(avgSold[0] / noSold[0]).toFixed(2);
2639
        str += '<br/>$' + (noSold[1] > 0 ? Number(avgSold[1] / noSold[1]).toFixed(2) : 0.00);
2640
        str += ' / $' + (noSold[2] > 0 ? Number(avgSold[2] / noSold[2]).toFixed(2) : 0.00);
2641
    }
2642
    str += '</td>';
2643
    str += '	</tr>';
2644
 
2645
    str += '<tr><td colspan="5">';
2646
    str += '<canvas id="soldChart" width="640" height="320" style="border:1px solid #000000;"></canvas>';
2647
    str += '</td></tr>';
2648
 
2649
    str += '	<tr>';
2650
    str += '		<td>Unsold</td>';
2651
    str += '		<td>' + noUnsold[0] + '<br/>' + noUnsold[1] + ' / ' + noUnsold[2] + '</td>';
2652
    str += '		<td>$' + Number(minUnsold[0]).toFixed(2) + '<br/>$' + Number(minUnsold[1]).toFixed(2) + ' / $' + Number(minUnsold[2]).toFixed(2) + '</td>';
2653
    str += '		<td>$' + Number(maxUnsold[0]).toFixed(2) + '<br/>$' + Number(maxUnsold[1]).toFixed(2) + ' / $' + Number(maxUnsold[2]).toFixed(2) + '</td>';
2654
    str += '		<td>';
2655
    if (noUnsold[0]) {
2656
        str += '$' + Number(avgUnsold[0] / noUnsold[0]).toFixed(2);
2657
        str += '<br/>$' + (noUnsold[1] > 0 ? Number(avgUnsold[1] / noUnsold[1]).toFixed(2) : 0.00);
2658
        str += ' / $' + (noUnsold[2] > 0 ? Number(avgUnsold[2] / noUnsold[2]).toFixed(2) : 0.00);
2659
    }
2660
    str += '</td>';
2661
    str += '	</tr>';
2662
    str += '	</tbody>';
2663
    str += '</table>';
2664
 
2665
    x.innerHTML = str;
2666
 
2667
    pricingGraphs(0, usedActiveBreakdown, newActiveBreakdown);
2668
    pricingGraphs(1, usedSoldBreakdown, newSoldBreakdown);
2669
}
2670
 
2671
function pricingGraphs(index, usedBreakdown, newBreakdown) {
2672
    var i;
2673
    var myChart;
2674
    var newData = [];
2675
    var usedData = [];
2676
    var labelData = [];
2677
    var ctx = document.getElementById(index === 0 ? 'activeChart' : 'soldChart').getContext('2d');
2678
    var min = findMin(usedBreakdown, newBreakdown);
2679
    var max = findMax(usedBreakdown, newBreakdown);
2680
 
2681
    for (i = min; i < max; i++) {
2682
        labelData.push('<$' + i);
2683
 
2684
        if (usedBreakdown[i] === undefined) {
2685
            usedData.push(0);
2686
        } else {
2687
            usedData.push(usedBreakdown[i]);
2688
        }
2689
 
2690
        if (newBreakdown[i] === undefined) {
2691
            newData.push(0);
2692
        } else {
2693
            newData.push(newBreakdown[i]);
2694
        }
2695
    }
2696
 
2697
    myChart = new Chart(ctx, {
2698
        type: 'bar',
2699
        options: {
2700
            responsive: false,
2701
            maintainAspectRatio: false,
2702
            scales: {
2703
                yAxes: [{
2704
                    ticks: {
2705
                        fixedStepSize: 1
2706
                    }
2707
                }],
2708
            },
2709
        },
2710
        data: {
2711
            labels: labelData,
2712
            datasets: [{
2713
                label: 'Used',
2714
                data: usedData,
2715
                backgroundColor: "rgba(0,102,0,1)"
2716
            }, {
2717
                label: 'New',
2718
                data: newData,
2719
                backgroundColor: "rgba(204,0,0,1)"
2720
            }]
2721
        }
2722
    });
2723
}
2724
 
2725
function findMin(Used, New) {
2726
    var i;
2727
    var minUsed = 0,
2728
        minNew = 0;
2729
    var min = 0;
2730
 
2731
    for (i = 0; i < Used.length; i++) {
2732
        if (Used[i] !== undefined) {
2733
            minUsed = i;
2734
            break;
2735
        }
2736
    }
2737
 
2738
    for (i = 0; i < New.length; i++) {
2739
        if (New[i] !== undefined) {
2740
            minNew = i;
2741
            break;
2742
        }
2743
    }
2744
 
2745
    if (minUsed > 0 && minNew > 0) {
2746
        min = Math.min(minUsed, minNew);
2747
    } else if (minUsed > 0) {
2748
        min = minUsed;
2749
    } else if (minNew > 0) {
2750
        min = minNew;
2751
    }
2752
 
2753
    return min;
2754
}
2755
 
2756
function findMax(Used, New) {
2757
    var max = 0;
2758
 
2759
    if (Used.length >= New.length) {
2760
        max = Used.length;
2761
    } else if (New.length >= Used.length) {
2762
        max = New.length;
2763
    }
2764
 
2765
    return max;
2766
}
2767
 
2768
function listButtonHot(flag) {
2769
    var i;
2770
    var x = [];
2771
 
2772
    x[0] = document.getElementById("list");
2773
    x[1] = document.getElementById("savexml");
2774
 
2775
    for (i = 0; i < 2; i++) {
2776
        if (flag === true) {
2777
            x[i].className = x[i].className.replace(" btn-danger", " btn-success");
2778
        } else {
2779
            x[i].className = x[i].className.replace(" btn-success", " btn-danger");
2780
        }
2781
    }
2782
}
2783
 
2784
function clearStatusWindows() {
2785
    var x = document.getElementById("results");
2786
    x.innerHTML = "";
2787
    x.className = x.className.replace(" w3-show", "");
2788
    x = document.getElementById("prices");
2789
    x.innerHTML = "";
2790
    x.className = x.className.replace(" w3-show", "");
2791
    x = document.getElementById("discogsReleases");
2792
    x.innerHTML = "";
2793
    x.className = x.className.replace(" w3-show", "");
2794
}
2795
 
2796
function pictureLoad(flag) {
2797
    picturesAreLoaded = flag;
2798
}
2799
 
2800
function reformatCdTitle(str) {
2801
    if (str.includes("Various Artists")) {
2802
        return str;
2803
    }
2804
 
2805
    var n = str.lastIndexOf(" by ");
2806
 
2807
    if (n > 0) {
2808
        var title = str.substr(0, n);
2809
        var rest = str.substr(n + 4);
2810
        n = rest.indexOf("(");
2811
        var artist = rest.substr(0, n).trim();
2812
        var info = rest.substr(n);
2813
        return (artist + " - " + title + " " + info);
2814
    }
2815
 
2816
    return str;
2817
}
2818
 
2819
function extractFromTitle() {
2820
    var titleField = document.getElementById("title");
2821
    var n;
2822
 
2823
    titleField.value = titleField.value.trim().replace(/[\u2012\u2013\u2014\u2015]/, '-').replace(/\u200E/, '').replace(/  +/g, ' ');
2824
    printTitleLength();
2825
 
2826
    if (CC == 1) {
2827
        if (titleField.value.indexOf(', EP,') > 0) {
12 - 2828
            $('#cdDuration').selectpicker('val', 'EP');
10 - 2829
        } else if (titleField.value.indexOf('[Maxi-Single]') > 0 || titleField.value.indexOf('[Maxi Single]') > 0) {
12 - 2830
            $('#cdDuration').selectpicker('val', 'Maxi-Single');
10 - 2831
        } else if (titleField.value.indexOf(', Single,') > 0) {
12 - 2832
            $('#cdDuration').selectpicker('val', 'Single');
10 - 2833
        }
2834
        $('#cdDuration').prop('disabled', false).selectpicker('refresh');
2835
 
2836
        if (titleField.value.indexOf(', Digipak,') > 0) {
2837
            document.getElementById("cdDigipak").checked = true;
2838
        } else {
2839
            document.getElementById("cdDigipak").checked = false;
2840
        }
2841
 
2842
        if (titleField.value.includes('Various Artists')) {
2843
            document.getElementById("cdArtist").value = 'Various';
2844
        } else {
2845
            document.getElementById("cdArtist").value = titleField.value.substr(0, titleField.value.indexOf(" - "));
2846
        }
2847
 
2848
        n = titleField.value.indexOf('(CD');
2849
        document.getElementById("cdRecordLabel").value = titleField.value.substr(n).substr(titleField.value.substr(n).lastIndexOf(',') + 2);
2850
        document.getElementById("cdRecordLabel").value = document.getElementById("cdRecordLabel").value.substr(0, document.getElementById("cdRecordLabel").value.lastIndexOf(')'));
2851
 
2852
        n = titleField.value.indexOf('(CD');
2853
        document.getElementById("cdReleaseYear").value = getYear(titleField.value.substr(n));
2854
    }
2855
}
2856
 
2857
function reformatPastedTitle(e) {
2858
    var clipboardData, pastedData;
2859
    var x = document.getElementById("title");
2860
 
2861
    // Stop data actually being pasted
2862
    e.stopPropagation();
2863
    e.preventDefault();
2864
 
2865
    // Get pasted data via clipboard API
2866
    clipboardData = e.clipboardData || window.clipboardData;
2867
    pastedData = clipboardData.getData('Text');
2868
 
2869
    x.value = pastedData.trim().replace(/[\u2012\u2013\u2014\u2015]/, '-').replace(/\u200E/, '');
2870
    printTitleLength();
2871
}
2872
 
2873
function formatTrackList() {
2874
    var i;
2875
    var lines = [];
2876
    var x = document.getElementById("cdTracks");
2877
 
2878
    if (x.value.length < 1) {
2879
        return;
2880
    }
2881
 
2882
    lines = x.value.split('\n');
2883
 
2884
    for (i = 0; i < lines.length; i++) {
2885
        lines[i] = lines[i].trim();
2886
        lines[i] = lines[i].replace(/^\d+ /, '');
2887
        lines[i] = lines[i].replace(/^\d+. /, '');
2888
        lines[i] = lines[i].replace(/^\t/g, '');
2889
        lines[i] = lines[i].replace(/\t(\d+[:.]\d{2})$/, "\[$1\]");
2890
        lines[i] = lines[i].replace(/^\u0096/, '');
2891
        lines[i] = lines[i].replace(/ \t/, ' - ');
2892
        lines[i] = lines[i].replace(/[\u2012\u2013\u2014\u2015]/, '');
2893
        lines[i] = lines[i].replace(/@/g, '*');
2894
        lines[i] = lines[i].replace(/\*/g, '');
2895
    }
2896
 
2897
    x.value = lines.join('\n');
2898
    updateTracklistPreview();
2899
}
2900
 
2901
function splitTradingCardElements() {
2902
    // [Year] [First Last], [Position] at [Club] - [Card Manufacturer] [Series] -P-[Card Number] [Rookie] [S####] [other]
2903
    var elem;
2904
    var stop1 = 0,
2905
        stop2 = 0,
2906
        stop3 = 0;
2907
    var str;
2908
    var title;
2909
    var cardYear = '';
2910
    var cardPlayer = '';
2911
    var cardPosition = '';
2912
    var cardTeam = '';
2913
    var cardManufacturer = '';
2914
    var cardSeries = '';
2915
    var cardNumber = '';
2916
    var isRookie = false;
2917
    var isSerialized = false;
2918
    var isPoA = false;
2919
 
2920
    title = document.getElementById('keyword').value.replace('-P-', '#');
2921
    catalogTitle = title;
2922
    var res = title.split(' ');
2923
    for (elem = 0; elem < res.length; elem++) {
2924
        if (res[elem].endsWith(',')) {
2925
            stop1 = elem;
2926
        }
2927
 
2928
        if (res[elem] == '-') {
2929
            stop2 = elem - 1;
2930
        }
2931
 
2932
        if (res[elem].startsWith('#')) {
2933
            stop3 = elem;
2934
        }
2935
    }
2936
 
2937
    if (!stop1 || !stop2 || !stop3) {
2938
        return;
2939
    }
2940
 
2941
    cardYear = res[0];
2942
    for (elem = 1; elem <= stop1; elem++) {
2943
        cardPlayer += res[elem] + ' ';
2944
    }
2945
    cardPlayer = cardPlayer.substr(0, cardPlayer.length - 2);
2946
 
2947
    cardPosition = res[elem];
2948
    elem += 2;
2949
 
2950
    for (; elem <= stop2; elem++) {
2951
        cardTeam += res[elem] + ' ';
2952
    }
2953
    cardTeam = cardTeam.trim();
2954
    elem++;
2955
 
2956
    cardManufacturer = res[elem];
2957
 
2958
    if (cardManufacturer == "UpperDeck") {
2959
        catalogTitle = catalogTitle.replace("UpperDeck", "Upper Deck");
2960
        cardManufacturer = "Upper Deck";
2961
    } else if (cardManufacturer == "AceAuthentic") {
2962
        catalogTitle = catalogTitle.replace("AceAuthentic", "Ace Authentic");
2963
        cardManufacturer = "Ace Authentic";
2964
    } else if (cardManufacturer == "BeAPlayer") {
2965
        catalogTitle = catalogTitle.replace("BeAPlayer", "Be A Player");
2966
        cardManufacturer = "Be A Player";
2967
    } else if (cardManufacturer == "CollectorsEdge") {
2968
        catalogTitle = catalogTitle.replace("CollectorsEdge", "Collector's Edge");
2969
        cardManufacturer = "Collector's Edge";
2970
    } else if (cardManufacturer == "GoalLine") {
2971
        catalogTitle = catalogTitle.replace("GoalLine", "Goal Line");
2972
        cardManufacturer = "Goal Line";
2973
    } else if (cardManufacturer == "InTheGame") {
2974
        catalogTitle = catalogTitle.replace("InTheGame", "In the Game");
2975
        cardManufacturer = "In the Game";
2976
    } else if (cardManufacturer == "OnyxAuthenticated") {
2977
        catalogTitle = catalogTitle.replace("OnyxAuthenticated", "Onyx Authenticated");
2978
        cardManufacturer = "Onyx Authenticated";
2979
    } else if (cardManufacturer == "PressPass") {
2980
        catalogTitle = catalogTitle.replace("PressPass", "Press Pass");
2981
        cardManufacturer = "Press Pass";
2982
    } else if (cardManufacturer == "ProSet") {
2983
        catalogTitle = catalogTitle.replace("ProSet", "Pro Set");
2984
        cardManufacturer = "Pro Set";
2985
    }
2986
    elem++;
2987
 
2988
    for (; elem < stop3; elem++) {
2989
        cardSeries += res[elem] + ' ';
2990
    }
2991
    cardSeries = cardSeries.trim();
2992
    cardNumber = res[elem];
2993
    elem++;
2994
 
2995
    for (; elem < res.length; elem++) {
2996
        if (res[elem] == "Gameworn") {
2997
            isPoA = true;
2998
        }
2999
 
3000
        if (res[elem] == "Rookie") {
3001
            isRookie = true;
3002
        }
3003
 
3004
        if (res[elem].startsWith("S") && isNumeric(res[elem].substr(1))) {
3005
            catalogTitle = catalogTitle.replace(res[elem], "/" + res[elem].substr(1));
3006
            isSerialized = true;
3007
        }
3008
    }
3009
 
3010
    str = '<h3>' + title + '</h3>';
3011
    str += '<p>';
3012
    str += 'Season: ' + cardYear + '<br/>';
3013
    str += 'Player: ' + cardPlayer + '<br/>';
3014
    str += 'Position: ' + cardPosition + '<br/>';
3015
    str += 'Team: ' + cardTeam + '<br/>';
3016
    str += 'Card Manufacturer: ' + cardManufacturer + '<br/>';
3017
    if (cardSeries.length > 0) {
3018
        str += 'Card Series: ' + cardSeries + '<br/>';
3019
    }
3020
    str += 'Card Number: ' + cardNumber + '<br/>';
3021
    if (isRookie) {
3022
        str += 'Rookie<br/>';
3023
    }
3024
    if (isSerialized) {
3025
        str += 'Serialized<br/>';
3026
    }
3027
    if (isPoA) {
3028
        str += 'Piece of Authentic<br/>';
3029
    }
3030
    str += '</p>';
3031
 
3032
    var x = document.getElementById("productinfo");
3033
    x.innerHTML = str;
3034
 
3035
    document.getElementById("tcPlayer").value = cardPlayer;
3036
    document.getElementById("tcPosition").value = cardPosition;
3037
    document.getElementById("tcTeam").value = cardTeam;
3038
    document.getElementById("tcSeason").value = cardYear;
3039
    document.getElementById("tcManufacturer").value = cardManufacturer;
3040
    document.getElementById("tcNumber").value = cardNumber;
3041
    document.getElementById("tcSeries").value = cardSeries;
3042
    document.getElementById("tcRookie").checked = false;
3043
    document.getElementById("tcPoA").checked = false;
3044
    document.getElementById("tcSerial").checked = false;
3045
 
3046
    if (isRookie) {
3047
        document.getElementById("tcRookie").checked = true;
3048
    }
3049
 
3050
    if (isPoA) {
3051
        document.getElementById("tcPoA").checked = true;
3052
    }
3053
 
3054
    if (isSerialized) {
3055
        document.getElementById("tcSerial").checked = true;
3056
    }
3057
 
3058
    var currentCategory = document.getElementById("category").value;
3059
    if (currentCategory != "213" && currentCategory != "214" && currentCategory != "215" && currentCategory != "216") {
12 - 3060
        $('#category').selectpicker('val', "");
3061
        $('#category').selectpicker('refresh');
10 - 3062
    }
3063
 
3064
    x = document.getElementById("tradingCardDetails");
3065
    if (x.className.indexOf("w3-show") == -1) {
3066
        x.className += " w3-show";
3067
    }
3068
}
3069
 
3070
function generateDescCore() {
3071
    DescCore = '';
3072
 
3073
    if (CC === 0) {
3074
        DescCore = '<p>';
3075
        DescCore += 'Format: ' + document.getElementById("bookFormat").value + '<br/>';
3076
        if (document.getElementById("bookAuthor").value.length > 0) {
3077
            DescCore += 'Author: ' + document.getElementById("bookAuthor").value.toString().replace(/,/g, ', ') + '<br/>';
3078
        }
3079
        if (document.getElementById("bookPublicationYear").value.length > 0) {
3080
            DescCore += 'Publication Year: ' + document.getElementById("bookPublicationYear").value + '<br/>';
3081
        }
3082
        if (document.getElementById("bookSubject").value.length > 0) {
3083
            DescCore += 'Subject: ' + document.getElementById("bookSubject").value + '<br/>';
3084
        }
3085
        if (document.getElementById("bookLanguage").value.length > 0) {
3086
            DescCore += 'Language: ' + document.getElementById("bookLanguage").value + '<br/>';
3087
        }
3088
        if (document.getElementById("bookCountry").value.length > 0) {
3089
            DescCore += 'Country: ' + document.getElementById("bookCountry").value + '<br/>';
3090
        }
3091
        if (document.getElementById("bookDustJacket").checked) {
3092
            DescCore += 'Dust Jacket<br/>';
3093
        }
3094
        if (document.getElementById("bookIllustrated").checked) {
3095
            DescCore += 'Illustrated<br/>';
3096
        }
3097
        if (document.getElementById("bookLargePrint").checked) {
3098
            DescCore += 'Large Print<br/>';
3099
        }
3100
        if (document.getElementById("bookSigned").checked) {
3101
            DescCore += 'Signed<br/>';
3102
        }
3103
        DescCore += '</p>';
3104
    } else if (CC == 1) {
3105
        DescCore = generateTracklist();
3106
    } else if (CC == 2) {
3107
        DescCore = '<p>';
3108
        DescCore += 'Format: ' + document.getElementById("dvdFormat").value + '<br/>';
3109
        if (document.getElementById("dvdActor").value.length > 0) {
3110
            DescCore += 'Actors: ' + document.getElementById("dvdActor").value.toString().replace(/,/g, ', ') + '<br/>';
3111
        }
3112
        if (document.getElementById("dvdLeadingRole").value.length > 0) {
3113
            DescCore += 'Leading Role: ' + document.getElementById("dvdLeadingRole").value.toString().replace(/,/g, ', ') + '<br/>';
3114
        }
3115
        if (document.getElementById("dvdDirector").value.length > 0) {
3116
            DescCore += 'Director: ' + document.getElementById("dvdDirector").value.toString().replace(/,/g, ', ') + '<br/>';
3117
        }
3118
        if (document.getElementById("dvdDVDEditionYear").value.length > 0) {
3119
            DescCore += 'DVD Edition Year: ' + document.getElementById("dvdDVDEditionYear").value + '<br/>';
3120
        }
3121
        if (document.getElementById("dvdReleaseYear").value.length > 0) {
3122
            DescCore += 'Movie Release Year: ' + document.getElementById("dvdReleaseYear").value + '<br/>';
3123
        }
3124
        if (document.getElementById("dvdGenre").value.length > 1) {
3125
            DescCore += 'Genre: ' + document.getElementById("dvdGenre").value + '<br/>';
3126
        }
3127
        if (document.getElementById("dvdRating").value.length > 1) {
3128
            DescCore += 'Rating: ' + document.getElementById("dvdRating").value + '<br/>';
3129
        }
3130
        if (document.getElementById("dvdRegionCode").value.length > 1) {
3131
            DescCore += 'Region Code: ' + document.getElementById("dvdRegionCode").value + '<br/>';
3132
        }
3133
        if (document.getElementById("dvdSeason").value.length > 0 && document.getElementById("dvdSeason").value != ' ') {
3134
            DescCore += 'Season: ' + document.getElementById("dvdSeason").value + '<br/>';
3135
        }
3136
        if (document.getElementById("dvdCountry").value.length > 0) {
3137
            DescCore += 'Country/Region of Manufacture: ' + document.getElementById("dvdCountry").value + '<br/>';
3138
        }
3139
        if (document.getElementById("dvd3D").checked) {
3140
            DescCore += '3D<br/>';
3141
        }
3142
        if (document.getElementById("dvdAnniversaryEdition").checked) {
3143
            DescCore += 'Anniversary Edition<br/>';
3144
        }
3145
        if (document.getElementById("dvdBoxSet").checked) {
3146
            DescCore += 'Box Set<br/>';
3147
        }
3148
        if (document.getElementById("dvdCollectorsEdition").checked) {
3149
            DescCore += 'Collector\'s Edition<br/>';
3150
        }
3151
        if (document.getElementById("dvdDeluxeEdition").checked) {
3152
            DescCore += 'Deluxe Edition<br/>';
3153
        }
3154
        if (document.getElementById("dvdDirectorsCut").checked) {
3155
            DescCore += 'Director\'s Cut<br/>';
3156
        }
3157
        if (document.getElementById("dvdExtendedEdition").checked) {
3158
            DescCore += 'Extended Edition<br/>';
3159
        }
3160
        if (document.getElementById("dvdFullScreen").checked) {
3161
            DescCore += 'Full Screen<br/>';
3162
        }
3163
        if (document.getElementById("dvdLimitedEdition").checked) {
3164
            DescCore += 'Limited Edition<br/>';
3165
        }
3166
        if (document.getElementById("dvdPromo").checked) {
3167
            DescCore += 'Promo<br/>';
3168
        }
3169
        if (document.getElementById("dvdSignatureCollection").checked) {
3170
            DescCore += 'Signature Collection<br/>';
3171
        }
3172
        if (document.getElementById("dvdSpecialEdition").checked) {
3173
            DescCore += 'Special Edition<br/>';
3174
        }
3175
        if (document.getElementById("dvdSteelbook").checked) {
3176
            DescCore += 'Steelbook<br/>';
3177
        }
3178
        if (document.getElementById("dvdUnratedEdition").checked) {
3179
            DescCore += 'Unrated Edition<br/>';
3180
        }
3181
        if (document.getElementById("dvdWidescreen").checked) {
3182
            DescCore += 'Widescreen<br/>';
3183
        }
3184
        DescCore += '</p>';
3185
    } else if (CC == 3) {
3186
        DescCore = '<p>';
3187
        DescCore += 'Season: ' + document.getElementById("tcSeason").value + '<br/>';
3188
        DescCore += 'Player: ' + document.getElementById("tcPlayer").value + '<br/>';
3189
        DescCore += 'Position: ' + document.getElementById("tcPosition").value + '<br/>';
3190
        DescCore += 'Team: ' + document.getElementById("tcTeam").value + '<br/>';
3191
        DescCore += 'Card Manufacturer: ' + document.getElementById("tcManufacturer").value + '<br/>';
3192
        if (document.getElementById("tcSeries").value.length > 0) {
3193
            DescCore += 'Card Series: ' + document.getElementById("tcSeries").value + '<br/>';
3194
        }
3195
        DescCore += 'Card Number: ' + document.getElementById("tcNumber").value + '<br/>';
3196
        if (document.getElementById("tcRookie").checked) {
3197
            DescCore += 'Rookie<br/>';
3198
        }
3199
        if (document.getElementById("tcSerial").checked) {
3200
            DescCore += 'Serialized<br/>';
3201
        }
3202
        if (document.getElementById("tcPoA").checked) {
3203
            DescCore += 'Piece of Authentic<br/>';
3204
        }
3205
        DescCore += '</p>';
3206
    }
3207
}
3208
 
3209
function generateTracklist() {
3210
    var str = '';
3211
    var listType = 'ol';
3212
 
3213
    if (document.getElementById("cdTracks").value.length > 0) {
3214
        if (document.getElementById("cdUnorderedTrackList").checked) {
3215
            listType = 'ul';
3216
        }
3217
 
3218
        str += '<p>Tracklist:</p><' + listType + ' class="w3-' + listType + '">';
3219
        var lines = document.getElementById("cdTracks").value.split('\n');
3220
        for (var i = 0; i < lines.length; i++) {
3221
            str += '<li>' + lines[i] + '</li>';
3222
        }
3223
        str += '</' + listType + '>';
3224
    }
3225
 
3226
    return (str);
3227
}
3228
 
3229
function updateTracklistPreview() {
3230
    document.getElementById("tracklistPreview").innerHTML = generateTracklist();
3231
}
3232
 
3233
function generateItemSpecifics(xw) {
3234
    xw.writeStartElement('ItemSpecifics');
3235
 
3236
    if (CC === 0) {
3237
        xw.writeStartElement('NameValueList');
3238
        xw.writeElementString('Name', 'Author');
3239
        xw.writeElementString('Value', escapeXml(document.getElementById("bookAuthor").value));
3240
        xw.writeEndElement(); /* NameValueList */
3241
        xw.writeStartElement('NameValueList');
3242
        xw.writeElementString('Name', 'Format');
3243
        xw.writeElementString('Value', escapeXml(document.getElementById("bookFormat").value));
3244
        xw.writeEndElement(); /* NameValueList */
3245
        xw.writeStartElement('NameValueList');
3246
        xw.writeElementString('Name', 'Publication Year');
3247
        xw.writeElementString('Value', escapeXml(document.getElementById("bookPublicationYear").value));
3248
        xw.writeEndElement(); /* NameValueList */
3249
        xw.writeStartElement('NameValueList');
3250
        xw.writeElementString('Name', 'Subject');
3251
        xw.writeElementString('Value', escapeXml(document.getElementById("bookSubject").value));
3252
        xw.writeEndElement(); /* NameValueList */
3253
        xw.writeStartElement('NameValueList');
3254
        xw.writeElementString('Name', 'Language');
3255
        xw.writeElementString('Value', escapeXml(document.getElementById("bookLanguage").value));
3256
        xw.writeEndElement(); /* NameValueList */
3257
        xw.writeStartElement('NameValueList');
3258
        xw.writeElementString('Name', 'Country/Region of Manufacture');
3259
        xw.writeElementString('Value', escapeXml(document.getElementById("bookCountry").value));
3260
        xw.writeEndElement(); /* NameValueList */
3261
 
3262
        if (document.getElementById("bookDustJacket").checked ||
3263
            document.getElementById("bookIllustrated").checked ||
3264
            document.getElementById("bookLargePrint").checked ||
3265
            document.getElementById("bookSigned").checked) {
3266
            xw.writeStartElement('NameValueList');
3267
            xw.writeElementString('Name', 'Special Attributes');
3268
            itemSpecificCheckbox(xw, "bookDustJacket", 'Dust Jacket');
3269
            itemSpecificCheckbox(xw, "bookIllustrated", 'Illustrated');
3270
            itemSpecificCheckbox(xw, "bookLargePrint", 'Large Print');
3271
            itemSpecificCheckbox(xw, "bookSigned", 'Signed');
3272
            xw.writeEndElement(); /* NameValueList */
3273
        }
3274
    } else if (CC == 1) {
3275
        xw.writeStartElement('NameValueList');
3276
        xw.writeElementString('Name', 'Genre');
3277
        xw.writeElementString('Value', escapeXml(document.getElementById("cdGenre").value));
3278
        xw.writeEndElement(); /* NameValueList */
3279
        xw.writeStartElement('NameValueList');
3280
        xw.writeElementString('Name', 'Duration');
3281
        xw.writeElementString('Value', escapeXml(document.getElementById("cdDuration").value));
3282
        xw.writeEndElement(); /* NameValueList */
3283
        xw.writeStartElement('NameValueList');
3284
        xw.writeElementString('Name', 'Record Label');
3285
        xw.writeElementString('Value', escapeXml(document.getElementById("cdRecordLabel").value));
3286
        xw.writeEndElement(); /* NameValueList */
3287
        xw.writeStartElement('NameValueList');
3288
        xw.writeElementString('Name', 'Release Year');
3289
        xw.writeElementString('Value', escapeXml(document.getElementById("cdReleaseYear").value));
3290
        xw.writeEndElement(); /* NameValueList */
3291
        xw.writeStartElement('NameValueList');
3292
        xw.writeElementString('Name', 'Artist');
3293
        xw.writeElementString('Value', escapeXml(document.getElementById("cdArtist").value));
3294
        xw.writeEndElement(); /* NameValueList */
3295
        xw.writeStartElement('NameValueList');
3296
        xw.writeElementString('Name', 'Title');
3297
        xw.writeElementString('Value', escapeXml(document.getElementById("cdTitle").value));
3298
        xw.writeEndElement(); /* NameValueList */
3299
        xw.writeStartElement('NameValueList');
3300
        xw.writeElementString('Name', 'Country/Region of Manufacture');
3301
        xw.writeElementString('Value', escapeXml(document.getElementById("cdCountry").value));
3302
        xw.writeEndElement(); /* NameValueList */
3303
 
3304
        if (document.getElementById("cdCompilation").checked ||
3305
            document.getElementById("cdDigipak").checked ||
3306
            document.getElementById("cdDualDisc").checked ||
3307
            document.getElementById("cdEnhanced").checked ||
3308
            document.getElementById("cdHDCD").checked) {
3309
            xw.writeStartElement('NameValueList');
3310
            xw.writeElementString('Name', 'Special Attributes');
3311
            itemSpecificCheckbox(xw, "cdCompilation", 'Compilation');
3312
            itemSpecificCheckbox(xw, "cdDigipak", 'Digipak');
3313
            itemSpecificCheckbox(xw, "cdDualDisc", 'DualDisc');
3314
            itemSpecificCheckbox(xw, "cdEnhanced", 'Enhanced');
3315
            itemSpecificCheckbox(xw, "cdHDCD", 'HDCD');
3316
            xw.writeEndElement(); /* NameValueList */
3317
        }
3318
 
3319
        if (document.getElementById("cdLiveRecording").checked ||
3320
            document.getElementById("cdPromo").checked ||
3321
            document.getElementById("cdReissue").checked ||
3322
            document.getElementById("cdRemastered").checked ||
3323
            document.getElementById("cdGreatestHits").checked) {
3324
            xw.writeStartElement('NameValueList');
3325
            xw.writeElementString('Name', 'Edition');
3326
            itemSpecificCheckbox(xw, "cdCompilation", 'Compilation');
3327
            itemSpecificCheckbox(xw, "cdDigipak", 'Digipak');
3328
            itemSpecificCheckbox(xw, "cdDualDisc", 'DualDisc');
3329
            itemSpecificCheckbox(xw, "cdEnhanced", 'Enhanced');
3330
            itemSpecificCheckbox(xw, "cdLiveRecording", 'Live Recording');
3331
            itemSpecificCheckbox(xw, "cdPromo", 'Promo');
3332
            itemSpecificCheckbox(xw, "cdReissue", 'Reissue');
3333
            itemSpecificCheckbox(xw, "cdRemastered", 'Remastered');
3334
            itemSpecificCheckbox(xw, "cdHDCD", 'HDCD');
3335
            itemSpecificCheckbox(xw, "cdGreatestHits", 'Greatest Hits');
3336
            xw.writeEndElement(); /* NameValueList */
3337
        }
3338
    } else if (CC == 2) {
3339
        xw.writeStartElement('NameValueList');
3340
        xw.writeElementString('Name', 'Format');
3341
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdFormat").value));
3342
        xw.writeEndElement(); /* NameValueList */
3343
        xw.writeStartElement('NameValueList');
3344
        xw.writeElementString('Name', 'Movie/TV Title');
3345
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdTitle").value));
3346
        xw.writeEndElement(); /* NameValueList */
3347
        xw.writeStartElement('NameValueList');
3348
        xw.writeElementString('Name', 'Actor');
3349
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdActor").value));
3350
        xw.writeEndElement(); /* NameValueList */
3351
        xw.writeStartElement('NameValueList');
3352
        xw.writeElementString('Name', 'Leading Role');
3353
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdLeadingRole").value));
3354
        xw.writeEndElement(); /* NameValueList */
3355
        xw.writeStartElement('NameValueList');
3356
        xw.writeElementString('Name', 'Release Year');
3357
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdReleaseYear").value));
3358
        xw.writeEndElement(); /* NameValueList */
3359
        xw.writeStartElement('NameValueList');
3360
        xw.writeElementString('Name', 'DVD Edition Year');
3361
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdDVDEditionYear").value));
3362
        xw.writeEndElement(); /* NameValueList */
3363
        xw.writeStartElement('NameValueList');
3364
        xw.writeElementString('Name', 'Director');
3365
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdDirector").value));
3366
        xw.writeEndElement(); /* NameValueList */
3367
        xw.writeStartElement('NameValueList');
3368
        xw.writeElementString('Name', 'Genre');
3369
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdGenre").value));
3370
        xw.writeEndElement(); /* NameValueList */
3371
        xw.writeStartElement('NameValueList');
3372
        xw.writeElementString('Name', 'Rating');
3373
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdRating").value));
3374
        xw.writeEndElement(); /* NameValueList */
3375
        xw.writeStartElement('NameValueList');
3376
        xw.writeElementString('Name', 'Region Code');
3377
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdRegionCode").value));
3378
        xw.writeEndElement(); /* NameValueList */
3379
 
3380
        if (document.getElementById("dvd3D").checked ||
3381
            document.getElementById("dvdAnniversaryEdition").checked ||
3382
            document.getElementById("dvdBoxSet").checked ||
3383
            document.getElementById("dvdCollectorsEdition").checked ||
3384
            document.getElementById("dvdDeluxeEdition").checked ||
3385
            document.getElementById("dvdDirectorsCut").checked ||
3386
            document.getElementById("dvdExtendedEdition").checked ||
3387
            document.getElementById("dvdFullScreen").checked ||
3388
            document.getElementById("dvdLimitedEdition").checked ||
3389
            document.getElementById("dvdPromo").checked ||
3390
            document.getElementById("dvdSignatureCollection").checked ||
3391
            document.getElementById("dvdSpecialEdition").checked ||
3392
            document.getElementById("dvdSteelbook").checked ||
3393
            document.getElementById("dvdUnratedEdition").checked ||
3394
            document.getElementById("dvdWidescreen").checked) {
3395
            xw.writeStartElement('NameValueList');
3396
            xw.writeElementString('Name', 'Edition');
3397
            itemSpecificCheckbox(xw, "dvd3D", '3D');
3398
            itemSpecificCheckbox(xw, "dvdAnniversaryEdition", 'Anniversary Edition');
3399
            itemSpecificCheckbox(xw, "dvdBoxSet", 'Box Set');
3400
            itemSpecificCheckbox(xw, "dvdCollectorsEdition", 'Collector&apos;s Edition');
3401
            itemSpecificCheckbox(xw, "dvdDeluxeEdition", 'Deluxe Edition');
3402
            itemSpecificCheckbox(xw, "dvdDirectorsCut", 'Director&apos;s Cut');
3403
            itemSpecificCheckbox(xw, "dvdExtendedEdition", 'Extended Edition');
3404
            itemSpecificCheckbox(xw, "dvdFullScreen", 'Full Screen');
3405
            itemSpecificCheckbox(xw, "dvdLimitedEdition", 'Limited Edition');
3406
            itemSpecificCheckbox(xw, "dvdPromo", 'Promo');
3407
            itemSpecificCheckbox(xw, "dvdSignatureCollection", 'Signature Collection');
3408
            itemSpecificCheckbox(xw, "dvdSpecialEdition", 'Special Edition');
3409
            itemSpecificCheckbox(xw, "dvdSteelbook", 'Steelbook');
3410
            itemSpecificCheckbox(xw, "dvdUnratedEdition", 'UnratedEdition');
3411
            itemSpecificCheckbox(xw, "dvdWidescreen", 'Widescreen');
3412
            xw.writeEndElement(); /* NameValueList */
3413
        }
3414
 
3415
        xw.writeStartElement('NameValueList');
3416
        xw.writeElementString('Name', 'Former Rental');
3417
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdRental").value));
3418
        xw.writeEndElement(); /* NameValueList */
3419
        xw.writeStartElement('NameValueList');
3420
        xw.writeElementString('Name', 'Season');
3421
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdSeason").value));
3422
        xw.writeEndElement(); /* NameValueList */
3423
        xw.writeStartElement('NameValueList');
3424
        xw.writeElementString('Name', 'Country/Region of Manufacture');
3425
        xw.writeElementString('Value', escapeXml(document.getElementById("dvdCountry").value));
3426
        xw.writeEndElement(); /* NameValueList */
3427
    } else if (CC == 3) {
3428
        xw.writeStartElement('NameValueList');
3429
        xw.writeElementString('Name', 'Card Manufacturer');
3430
        xw.writeElementString('Value', escapeXml(document.getElementById("tcManufacturer").value));
3431
        xw.writeEndElement(); /* NameValueList */
3432
 
3433
        if (document.getElementById("tcRookie").checked ||
3434
            document.getElementById("tcSerial").checked ||
3435
            document.getElementById("tcPoA").checked) {
3436
            xw.writeStartElement('NameValueList');
3437
            xw.writeElementString('Name', 'Card Attributes');
3438
            if (document.getElementById("tcRookie").checked) {
3439
                itemSpecificCheckbox(xw, "tcRookie", 'Rookie');
3440
            }
3441
            if (document.getElementById("tcSerial").checked) {
3442
                itemSpecificCheckbox(xw, "tcSerial", 'Serial Numbered');
3443
            }
3444
            if (document.getElementById("tcPoA").checked) {
3445
                itemSpecificCheckbox(xw, "tcPoA", 'Piece of Authentic');
3446
            }
3447
            xw.writeEndElement(); /* NameValueList */
3448
        }
3449
 
3450
        xw.writeStartElement('NameValueList');
3451
        xw.writeElementString('Name', 'Product');
3452
        xw.writeElementString('Value', 'Single');
3453
        xw.writeEndElement(); /* NameValueList */
3454
        xw.writeStartElement('NameValueList');
3455
        xw.writeElementString('Name', 'Professional Grader');
3456
        xw.writeElementString('Value', 'Not Professionally Graded');
3457
        xw.writeEndElement(); /* NameValueList */
3458
        xw.writeStartElement('NameValueList');
3459
        xw.writeElementString('Name', 'Grade');
3460
        xw.writeElementString('Value', 'Ungraded');
3461
        xw.writeEndElement(); /* NameValueList */
3462
        xw.writeStartElement('NameValueList');
3463
        xw.writeElementString('Name', 'Original/Reprint');
3464
        xw.writeElementString('Value', 'Original');
3465
        xw.writeEndElement(); /* NameValueList */
3466
        //		xw.writeStartElement('NameValueList');
3467
        //		xw.writeElementString('Name', 'Autograph Authentication');
3468
        //		xw.writeElementString('Value', 'Not Authenticated');
3469
        //		xw.writeEndElement(); /* NameValueList */
3470
        //		xw.writeStartElement('NameValueList');
3471
        //		xw.writeElementString('Name', 'Autograph Format');
3472
        //		xw.writeElementString('Value', 'Not Autographed');
3473
        //		xw.writeEndElement(); /* NameValueList */
3474
        xw.writeStartElement('NameValueList');
3475
        xw.writeElementString('Name', 'Modified Item');
3476
        xw.writeElementString('Value', 'No');
3477
        xw.writeEndElement(); /* NameValueList */
3478
        xw.writeStartElement('NameValueList');
3479
        xw.writeElementString('Name', 'Player');
3480
        xw.writeElementString('Value', escapeXml(document.getElementById("tcPlayer").value));
3481
        xw.writeEndElement(); /* NameValueList */
3482
        xw.writeStartElement('NameValueList');
3483
        xw.writeElementString('Name', 'Team');
3484
        xw.writeElementString('Value', escapeXml(document.getElementById("tcTeam").value));
3485
        xw.writeEndElement(); /* NameValueList */
3486
        xw.writeStartElement('NameValueList');
3487
        xw.writeElementString('Name', 'Season');
3488
        xw.writeElementString('Value', escapeXml(document.getElementById("tcSeason").value));
3489
        xw.writeEndElement(); /* NameValueList */
3490
        xw.writeStartElement('NameValueList');
3491
        xw.writeElementString('Name', 'Year');
3492
        xw.writeElementString('Value', escapeXml(document.getElementById("tcSeason").value));
3493
        xw.writeEndElement(); /* NameValueList */
3494
        xw.writeStartElement('NameValueList');
3495
        xw.writeElementString('Name', 'Era');
3496
        if (category == '213') {
3497
            xw.writeElementString('Value', 'Modern (1981-Now)');
3498
        } else {
3499
            xw.writeElementString('Value', 'Modern (1970-Now)');
3500
        }
3501
        xw.writeEndElement(); /* NameValueList */
3502
        xw.writeStartElement('NameValueList');
3503
        xw.writeElementString('Name', 'League');
3504
        if (category == "215") {
3505
            xw.writeElementString('Value', 'NFL');
3506
        } else if (category == "213") {
3507
            xw.writeElementString('Value', 'Major League');
3508
        } else if (category == "214") {
3509
            xw.writeElementString('Value', 'NBA');
3510
        } else if (category == "216") {
3511
            xw.writeElementString('Value', 'NHL');
3512
        } else {
3513
            xw.writeElementString('Value', '');
3514
        }
3515
        xw.writeEndElement(); /* NameValueList */
3516
        xw.writeStartElement('NameValueList');
3517
        xw.writeElementString('Name', 'Card Number');
3518
        xw.writeElementString('Value', escapeXml(document.getElementById("tcNumber").value));
3519
        xw.writeEndElement(); /* NameValueList */
3520
        xw.writeStartElement('NameValueList');
3521
        xw.writeElementString('Name', 'Series');
3522
        xw.writeElementString('Value', escapeXml(document.getElementById("tcSeries").value));
3523
        xw.writeEndElement(); /* NameValueList */
3524
        xw.writeStartElement('NameValueList');
3525
        xw.writeElementString('Name', 'Country/Region of Manufacture');
3526
        xw.writeElementString('Value', 'United States');
3527
        xw.writeEndElement(); /* NameValueList */
3528
    }
3529
 
3530
    xw.writeEndElement(); /* ItemSpecifics */
3531
}
3532
 
3533
function itemSpecificCheckbox(xw, id, val) {
3534
    if (document.getElementById(id).checked) {
3535
        xw.writeElementString('Value', val);
3536
    }
3537
}
3538
 
3539
function _cb_findDuplicateListing(root) {
3540
    var x;
3541
    var response = root.findItemsAdvancedResponse[0];
3542
    var ack = response.ack;
3543
    if (ack != 'Success') {
22 - 3544
        x = document.getElementById("productinfoDuplicate").innerHTML += '<span class="bg-danger"><strong>Duplicate Check Failed</strong></span>';
10 - 3545
 
3546
        if (ack == 'Failure' || ack == 'PartialFailure') {
3547
            return;
3548
        }
3549
    }
3550
 
3551
    var items = response.searchResult[0].item || [];
3552
 
3553
    if (Number(response.paginationOutput[0].totalEntries) > 0) {
17 - 3554
        document.getElementById("productinfoDuplicate").innerHTML += '<span 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></span>';
10 - 3555
        isDuplicate = true;
3556
    }
3557
}
3558
 
3559
function findDuplicateListing() {
3560
    var keyword = document.getElementById('keyword').value;
3561
 
3562
    // Construct the request
3563
    url = configeBayFinding + "?";
3564
    url += "OPERATION-NAME=findItemsAdvanced";
3565
    url += "&SERVICE-VERSION=" + configeBayFindingVersion;
3566
    url += "&SECURITY-APPNAME=" + configAppid;
3567
    url += "&GLOBAL-ID=EBAY-US";
3568
    url += "&RESPONSE-DATA-FORMAT=JSON";
3569
    url += "&REST-PAYLOAD";
3570
    url += "&keywords=";
3571
    url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
3572
    url += "&paginationInput.entriesPerPage=1";
3573
    url += "&paginationInput.pageNumber=1";
3574
    url += "&itemFilter(0).name=Seller";
3575
    url += "&itemFilter(0).value=";
3576
    url += configeBaySellerName;
3577
    url += "&outputSelector=SellerInfo";
3578
 
3579
    // Submit the request
3580
    var xhttp = new XMLHttpRequest();
3581
 
3582
    xhttp.onreadystatechange = function() {
3583
        if (this.readyState == 4) {
3584
            _cb_findDuplicateListing(JSON.parse(this.responseText));
3585
        }
3586
    };
3587
 
3588
    xhttp.open("GET", configProxyUrl, true);
3589
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3590
    xhttp.send();
3591
 
3592
    return false;
3593
}
3594
 
3595
function _cb_findPotentialDuplicateListing(root) {
3596
    var x;
3597
    var response = root.findCompletedItemsResponse[0];
3598
    var ack = response.ack;
3599
    if (ack != 'Success') {
17 - 3600
        x = document.getElementById("productinfoDuplicate").innerHTML += '<span class="bg-danger"><strong>Duplicate Check Failed</strong></span>';
10 - 3601
 
3602
        if (ack == 'Failure' || ack == 'PartialFailure') {
3603
            return;
3604
        }
3605
    }
3606
 
3607
    var items = response.searchResult[0].item || [];
3608
 
3609
    if (Number(response.paginationOutput[0].totalEntries) > 0) {
17 - 3610
        document.getElementById("productinfoDuplicate").innerHTML += '<span 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></span>';
10 - 3611
    }
3612
}
3613
 
3614
function findPotentialDuplicateListing() {
3615
    var keyword = document.getElementById('keyword').value;
3616
 
3617
    // Construct the request
3618
    url = configeBayFinding + "?";
3619
    url += "OPERATION-NAME=findCompletedItems";
3620
    url += "&SERVICE-VERSION=" + configeBayFindingVersion;
3621
    url += "&SECURITY-APPNAME=" + configAppid;
3622
    url += "&GLOBAL-ID=EBAY-US";
3623
    url += "&RESPONSE-DATA-FORMAT=JSON";
3624
    url += "&REST-PAYLOAD";
3625
    url += "&keywords=";
3626
    url += encodeURIComponent(keyword.trim().replace(/ /g, "+"));
3627
    url += "&paginationInput.entriesPerPage=1";
3628
    url += "&paginationInput.pageNumber=1";
3629
    url += "&itemFilter(0).name=Seller";
3630
    url += "&itemFilter(0).value=";
3631
    url += configeBaySellerName;
3632
    url += "&outputSelector=SellerInfo";
3633
 
3634
    var xhttp = new XMLHttpRequest();
3635
 
3636
    xhttp.onreadystatechange = function() {
3637
        if (this.readyState == 4) {
3638
            _cb_findPotentialDuplicateListing(JSON.parse(this.responseText));
3639
        }
3640
    };
3641
 
3642
    xhttp.open("GET", configProxyUrl, true);
3643
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3644
    xhttp.send();
3645
 
3646
    return false;
3647
}
3648
 
3649
function findShopifyDuplicateListing() { // Barcode Search
3650
    var handle;
3651
    var xhttp = new XMLHttpRequest();
3652
    xhttp.onreadystatechange = function() {
3653
        if (this.readyState == 4 && this.status == 200) {
3654
            //window.alert(this.responseText);
3655
            var json = JSON.parse(this.responseText);
3656
            if (json.products[0] !== undefined) {
3657
			    var sku = getJsonValue(json.products[0].variants[0].sku);
17 - 3658
                document.getElementById("productinfoDuplicate").innerHTML += '<span 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></span>';
10 - 3659
            }
3660
        }
3661
    };
3662
 
3663
    handle = parseInt(document.getElementById('keyword').value, 10);
3664
 
3665
    xhttp.open("GET", configProxyUrl, true);
3666
	xhttp.setRequestHeader("X-Proxy-Url", encodeURI(configShopifyUrl + configShopifyProductsUrl + '?handle=b' + handle + '&fields=id,variants'));
3667
    xhttp.send();
3668
}
3669
 
3670
function connected() {
3671
    var x;
3672
 
3673
    eBayAuthTokenFlag = true;
3674
    if (!document.getElementById("connected").innerHTML.endsWith("(Connected)")) {
3675
        document.getElementById("connected").innerHTML += " (Connected)";
3676
    }
3677
 
3678
    x = document.getElementById("verify");
3679
    x.className = x.className.replace(" btn-danger", " btn-success");
3680
 
3681
    x = document.getElementById("login");
3682
    x.className = x.className.replace(" w3-show", "");
3683
 
3684
    x = document.getElementById("results");
3685
    x.innerHTML = "";
3686
    x.className = x.className.replace(" w3-show", "");
3687
}
3688
 
3689
function confirmUnload() {
3690
    return "Do you really want to leave the quick listing tool?";
3691
}
3692
 
3693
function uploadSiteHostedPictures() {
3694
    imagesToUpload = 0;
3695
    imageUploadError = false;
3696
 
3697
    ++imagesToUpload;
3698
    uploadSiteHostedPicture('image1', 0);
3699
    ++imagesToUpload;
3700
    uploadSiteHostedPicture('image2', 1);
3701
    for (var imageNumber = 0; imageNumber < maxAdditionalImages; imageNumber++) {
12 - 3702
        if (document.getElementById("image" + (imageNumber + 3) + "anchor").className.includes(" visible")) {
10 - 3703
            ++imagesToUpload;
3704
            uploadSiteHostedPicture('image' + (imageNumber + 3), (imageNumber + 2));
3705
        }
3706
    }
3707
 
3708
    function checkImagesToUpload() {
3709
        if (imagesToUpload > 0) {
3710
            window.setTimeout(checkImagesToUpload, 100); // wait 100 milliseconds
3711
        } else {
3712
            if (!imageUploadError) {
3713
                verifyListing();
3714
            } else {
3715
                ImageURLs = [];
3716
                imagesToUpload = 0;
3717
            }
3718
        }
3719
    }
3720
 
3721
    checkImagesToUpload();
3722
}
3723
 
3724
function uploadSiteHostedPicture(imageId, index) {
3725
    var i;
3726
    var str = '';
3727
    var imageBasename = document.getElementById(imageId).src.substr(document.getElementById(imageId).src.lastIndexOf('/') + 1);
3728
 
3729
    str += '<?xml version="1.0" encoding="utf-8"?>';
3730
    str += '<UploadSiteHostedPicturesRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
3731
    str += '    <RequesterCredentials>';
3732
    str += '        <eBayAuthToken>' + eBayAuthToken + '</eBayAuthToken>';
3733
    str += '    </RequesterCredentials>';
3734
    str += '	<ExtensionInDays>' + 30 + '</ExtensionInDays>';
3735
    str += '    <PictureSet>Supersize</PictureSet>';
3736
    str += '	<PictureName>' + imageBasename + '</PictureName>';
3737
    str += '    <ExternalPictureURL>' + document.getElementById(imageId).src + '</ExternalPictureURL>';
3738
    str += '</UploadSiteHostedPicturesRequest>';
3739
 
3740
    var xhr = new XMLHttpRequest();
3741
    xhr.open("POST", configProxyUrl, true);
3742
    xhr.setRequestHeader('X-EBAY-API-APP-NAME', configAppid);
3743
    xhr.setRequestHeader('X-EBAY-API-DEV-NAME', configDevid);
3744
    xhr.setRequestHeader('X-EBAY-API-CERT-NAME', configCertid);
3745
    xhr.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL', configeBayTradingVersion);
3746
    xhr.setRequestHeader('X-EBAY-API-CALL-NAME', 'UploadSiteHostedPictures');
3747
    xhr.setRequestHeader('X-EBAY-API-SITEID', '0');
3748
    xhr.setRequestHeader('X-Proxy-URL', configServiceEndpoint);
3749
 
3750
    xhr.onload = function() {
3751
        var jsonObj = XMLparse(xhr.responseXML, false);
3752
        var obj = jsonObj.UploadSiteHostedPicturesResponse;
3753
        var str = '';
3754
        var returnCode = obj.Ack;
3755
        var x = document.getElementById("results");
3756
 
3757
        if (returnCode == 'Success') {
3758
            str += '<div class="alert alert-success alert-dismissible">';
3759
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
3760
            str += '<p>Image ' + (index + 1) + ' Upload: <strong>' + returnCode + '</strong></p>';
11 - 3761
            str += '</div>';
10 - 3762
            x.innerHTML += str;
3763
            ImageURLs[index] = obj.SiteHostedPictureDetails.FullURL;
3764
        } else {
3765
            ImageURLs = [];
3766
            imageUploadError = true;
3767
 
3768
            str += '<div class="alert alert-danger alert-dismissible">';
3769
            str += '<button type="button" class="close" data-dismiss="alert">×</button>';
3770
            str += '<p>Image ' + (index + 1) + ' Upload: <strong>' + returnCode + '</strong></p>';
3771
 
3772
            var errors = getJsonArray(obj.Errors);
3773
            str += "<ul>";
3774
            for (i = 0; i < errors.length; i++) {
3775
                str += '<li>' + errors[i].SeverityCode + " (" + errors[i].ErrorCode + "): " + escapeHtml(errors[i].LongMessage) + "</li>";
3776
            }
3777
            str += "</ul>";
11 - 3778
            str += '</div>';
10 - 3779
            x.innerHTML += str;
3780
        }
3781
 
3782
        --imagesToUpload;
3783
    };
3784
 
3785
    xhr.send(str);
3786
}
3787
 
3788
function findDiscogsReleases(str) {
3789
    if (str.length < 1) {
3790
        return;
3791
    }
3792
 
3793
    // Construct the request
3794
    url = configDiscogsApiUrl + "?";
3795
    url += "token=";
3796
    url += configDiscogsToken;
3797
    url += "&type=release";
3798
    url += "&format=CD";
3799
    if (isNumeric(str)) {
3800
        url += "&barcode=";
3801
    } else {
3802
        url += "&q=";
3803
    }
3804
    url += str;
3805
 
3806
    var xhttp = new XMLHttpRequest();
3807
 
3808
    xhttp.onreadystatechange = function() {
3809
        if (this.readyState == 4) {
3810
            var response = this.responseText;
3811
            if (this.status != 200) { // discogs returns HTML instead JSON
3812
                response = '{"pagination": {"per_page": 50, "items": 0, "page": 1, "urls": {}, "pages": 1}, "results": []}';
3813
            }
3814
            _cb_findDiscogsReleases(JSON.parse(response));
3815
        }
3816
    };
3817
 
3818
    xhttp.open("GET", configProxyUrl, true);
3819
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3820
    xhttp.send();
3821
}
3822
 
3823
function _cb_findDiscogsReleases(root) {
3824
    var tableStr = '';
3825
    var i, j;
3826
    var x;
3827
 
3828
    tableStr = '<h3>Discogs Releases</h3>';
3829
    tableStr += '<table id="discogsTable" class="table small table-hover">';
3830
    tableStr += '<thead class="thead-dark">';
3831
    tableStr += '<tr>';
3832
    tableStr += tableHeader('Title');
3833
    tableStr += tableHeader('Label');
3834
    tableStr += tableHeader('Catalog #');
3835
    tableStr += tableHeader('Format');
3836
    tableStr += tableHeader('Year');
3837
    tableStr += tableHeader('Country');
3838
    tableStr += tableHeader('Genre');
3839
    tableStr += tableHeader('');
3840
    tableStr += '</tr>';
3841
    tableStr += '</thead>';
3842
    tableStr += '<tbody>';
3843
 
3844
    for (i = 0; i < root.results.length; i++) {
3845
        tableStr += '<tr>';
3846
 
3847
        tableStr += tableCellLink(root.results[i].title, configDiscogsBaseUrl + root.results[i].uri);
3848
 
3849
        str = [];
3850
        for (j = 0; j < root.results[i].label.length && j < 2; j++) {
3851
            str.push(root.results[i].label[j]);
3852
        }
3853
        tableStr += tableCell(str.join(', '));
3854
 
3855
        tableStr += tableCell(root.results[i].catno);
3856
 
3857
        str = [];
3858
        for (j = 0; j < root.results[i].format.length; j++) {
3859
            str.push(root.results[i].format[j]);
3860
        }
3861
        tableStr += tableCell(str.join(', '));
3862
 
3863
        tableStr += tableCell(root.results[i].year);
3864
        tableStr += tableCell(root.results[i].country);
3865
 
3866
        tableStr += tableCell(root.results[i].genre.join(', '));
3867
 
3868
        tableStr += tableCellButton(root.results[i].resource_url);
3869
 
3870
        tableStr += '</tr>';
3871
    }
3872
 
3873
    tableStr += '</tbody>';
3874
    tableStr += '</table>';
3875
 
17 - 3876
    tableStr += '<div class="container-fluid">';
3877
    tableStr += '<form id="searchFormDiscogs" class="form-inline" onsubmit="specialDiscogsSearch();return false;">';
3878
    tableStr += '<div class="input-group">';
3879
    tableStr += '<label for="discogsRelease" class="keepTogether mr-sm-2">Release #:</label>';
3880
    tableStr += '<input id="discogsRelease" name="discogsRelease" class="form-control" style="width:30%;font-size:95%!important" type="text" maxlength="10">';
3881
    tableStr += '<div class="input-group-append">';
22 - 3882
    tableStr += '<button class="btn mx-2" onclick="specialDiscogsSearch();return false;"><i class="fa fa-search"></i></button>';
17 - 3883
    tableStr += '</div>';
3884
    tableStr += '</div>';
3885
    tableStr += '</form>';
3886
    tableStr += '</div>';
3887
 
3888
    if (!document.getElementById("productinfoSearch").innerHTML.includes("Discogs")) {
22 - 3889
        document.getElementById("productinfoSearch").innerHTML += '<a href="https://www.discogs.com/search/?q=&format_exact=CD&type=all" target="_blank"><button class="btn mx-2"><i class="fa fa-search"></i> Discogs</button></a>';
10 - 3890
    }
3891
 
3892
    x = document.getElementById("discogsReleases");
3893
    x.innerHTML = tableStr;
3894
    if (x.className.indexOf("w3-show") == -1) {
3895
        x.className += " w3-show";
3896
    }
3897
 
17 - 3898
    x = document.getElementById("productinfoSearch");
15 - 3899
    if (!x.innerHTML.includes("CD Price")) {
22 - 3900
        x.innerHTML += '<a href="https://www.getcdprices.com/upc/' + upc + '" target="blank"><button class="btn mx-2"><i class="fa fa-search"></i> CD Price</button></a>';
15 - 3901
    }
10 - 3902
}
3903
 
3904
function specialDiscogsSearch() {
3905
    if (document.getElementById("discogsRelease").value.length > 0) {
3906
        findDiscogsReleases("r" + document.getElementById("discogsRelease").value);
3907
    }
3908
}
3909
 
3910
function tableHeader(str) {
3911
    return ('<th>' + (str === undefined ? '' : str) + '</th>');
3912
}
3913
 
3914
function tableCell(str) {
3915
    return ('<td>' + (str === undefined ? '' : str) + '</td>');
3916
}
3917
 
3918
function tableCellLink(text, link) {
3919
    var str = "<a href=\"" + link + "\" target=\"_blank\">" + text + "</a>";
3920
    return ('<td>' + str + '</td>');
3921
}
3922
 
3923
function tableCellButton(link) {
12 - 3924
    var str = '<button type="button" class="btn btn-primary fa fa-arrow-left" onclick="getDiscogsRelease(&quot;' + link + '&quot;);"></button>';
10 - 3925
    return ('<td>' + str + '</td>');
3926
}
3927
 
3928
function getDiscogsRelease(url) {
3929
    var xhttp = new XMLHttpRequest();
3930
 
3931
    xhttp.onreadystatechange = function() {
3932
        if (this.readyState == 4) {
3933
            _cb_getDiscogsRelease(JSON.parse(this.responseText));
3934
        }
3935
    };
3936
 
3937
    xhttp.open("GET", configProxyUrl, true);
3938
    xhttp.setRequestHeader("X-Proxy-Url", encodeURI(url));
3939
    xhttp.send();
3940
}
3941
 
3942
function _cb_getDiscogsRelease(root) {
3943
    var str;
3944
    var titleStr = '';
3945
    var trackStr;
3946
    var artist;
3947
    var label;
3948
    var year;
3949
    var position;
3950
    var promo = '';
3951
    var digipak = '';
3952
    var duration = '';
3953
    var quantity = '';
3954
    var i, j;
3955
    var temp;
3956
 
3957
    // Tracklist
3958
    trackStr = [];
3959
    allNumbers = true;
3960
 
3961
    for (i = 0; i < root.tracklist.length; i++) {
3962
        str = '';
3963
        if (root.tracklist[i].position.length > 0) {
3964
            str += root.tracklist[i].position + '. ';
3965
 
3966
            position = Number(root.tracklist[i].position);
3967
            if (isNaN(position) || position != (i + 1)) {
3968
                allNumbers = false;
3969
            }
3970
        }
3971
 
3972
        if (root.tracklist[i].artists !== undefined) {
3973
            for (j = 0; j < root.tracklist[i].artists.length; j++) {
3974
                temp = root.tracklist[i].artists[j].name.replace(/\([0-9]+\)$/, "");
3975
                str += temp + " " + root.tracklist[i].artists[j].join + " ";
3976
            }
3977
            str += " - ";
3978
        }
3979
 
3980
        str += root.tracklist[i].title;
3981
 
3982
        if (root.tracklist[i].duration.length > 0) {
3983
            str += " [" + root.tracklist[i].duration + "]";
3984
        }
3985
 
3986
        trackStr.push(str);
3987
    }
3988
 
3989
    str = str.replace(/  +/g, ' ');
3990
    if (allNumbers) {
3991
        for (i = 0; i < trackStr.length; i++) {
3992
            trackStr[i] = trackStr[i].replace(/^\d+. /g, '');
3993
        }
3994
    } else {
3995
        document.getElementById("cdUnorderedTrackList").checked = true;
3996
    }
3997
 
3998
    $("#cdTracks").val(trackStr.join('\n'));
3999
    updateTracklistPreview();
4000
 
4001
    // Title
4002
    titleStr = '';
4003
    artist = '';
4004
    label = '';
4005
    year = '';
4006
    catno = '';
4007
    if (root.artists !== undefined) {
4008
        for (i = 0; i < root.artists.length; i++) {
4009
            temp = root.artists[i].name.replace(/\([0-9]+\)$/, "");
4010
            artist += temp + " " + root.artists[i].join + " ";
4011
        }
4012
    }
4013
 
4014
    artist = artist.trim();
4015
    if (artist != 'Various') {
4016
        titleStr += artist + " - " + root.title;
4017
    } else {
4018
        titleStr += root.title + " by Various Artists";
4019
    }
4020
    titleStr += " (CD";
4021
 
4022
    document.getElementById("cdTitle").value = root.title;
4023
 
4024
    // formats
4025
    promo = '';
4026
    duration = '';
4027
    quantity = '';
4028
    digipak = '';
4029
    for (i = 0; i < root.formats.length; i++) {
4030
        if (root.formats[i].name.startsWith("CD")) {
12 - 4031
            if (root.formats[i].descriptions !== undefined) {
4032
                for (j = 0; j < root.formats[i].descriptions.length; j++) {
4033
                    if (root.formats[i].descriptions[j] == "Enhanced") {
4034
                        document.getElementById("cdEnhanced").checked = true;
4035
                    } else if (root.formats[i].descriptions[j] == "Compilation") {
4036
                        document.getElementById("cdCompilation").checked = true;
4037
                    } else if (root.formats[i].descriptions[j] == "Digipak") {
4038
                        document.getElementById("cdDigipak").checked = true;
4039
                        digipak = root.formats[i].descriptions[j];
4040
                        setCdConditionDescription('D');
4041
                    } else if (root.formats[i].descriptions[j] == "Promo") {
4042
                        document.getElementById("cdPromo").checked = true;
4043
                        promo = 'PROMO';
4044
                    } else if (root.formats[i].descriptions[j] == "Reissue") {
4045
                        document.getElementById("cdReissue").checked = true;
4046
                    } else if (root.formats[i].descriptions[j] == "Remastered") {
4047
                        document.getElementById("cdRemastered").checked = true;
4048
                    } else if (root.formats[i].descriptions[j] == "HDCD") {
4049
                        document.getElementById("cdHDCD").checked = true;
4050
                    } else if (root.formats[i].descriptions[j] == "Album" ||
4051
                        root.formats[i].descriptions[j] == "Mini-Album" ||
4052
                        root.formats[i].descriptions[j] == "EP" ||
4053
                        root.formats[i].descriptions[j] == "Maxi-Single" ||
4054
                        root.formats[i].descriptions[j] == "Single") {
4055
                        $('#cdDuration').selectpicker('val', root.formats[i].descriptions[j]);
4056
                        $('#cdDuration').prop('disabled', false).selectpicker('refresh');
4057
                        if (!root.formats[i].descriptions[j].includes("Album")) {
4058
                            duration = root.formats[i].descriptions[j];
4059
                        }
10 - 4060
                    }
4061
                }
12 - 4062
            }
10 - 4063
 
12 - 4064
            discogsQty = Number(root.formats[i].qty);
4065
            if (discogsQty > 1) {
4066
                setCdConditionDescription('P');
4067
                quantity = Number(root.formats[i].qty) + ' Discs';
10 - 4068
            }
4069
        }
4070
    }
4071
 
4072
    // genres
4073
    if (document.getElementById("cdGenre").value.length <= 1) {
4074
        for (i = 0; i < root.genres.length; i++) {
4075
            if (isInSelectList("cdGenre", root.genres[i])) {
4076
                $('#cdGenre').prop('disabled', false).selectpicker('refresh');
4077
                break;
4078
            }
4079
        }
4080
    }
4081
 
4082
    // country
12 - 4083
    var country = getJsonValue(root.country);
4084
    if (country != 'undefined' && country != 'US' && !country.includes('Europe')) {
4085
        if (country == 'UK') {
10 - 4086
            document.getElementById("cdCountry").value = 'United Kingdom';
4087
        } else {
4088
            document.getElementById("cdCountry").value = root.country;
4089
        }
4090
    } else {
4091
        document.getElementById("cdCountry").value = "United States";
4092
    }
4093
 
4094
    // title remainder
4095
    if (duration.length > 0) {
4096
        titleStr += ", " + duration;
4097
    }
4098
 
4099
    if (digipak.length > 0) {
4100
        titleStr += ", " + digipak;
4101
    }
4102
 
4103
    if (quantity.length > 0) {
4104
        titleStr += ", " + quantity;
4105
    }
4106
 
4107
    if (root.released !== undefined) {
4108
        year = root.released.substr(0, 4);
4109
        titleStr += ", " + year;
4110
    }
4111
 
4112
    if (root.labels !== undefined) {
4113
        label = root.labels[0].name;
4114
        titleStr += ", " + label;
4115
    }
4116
 
4117
    titleStr += ")";
4118
 
4119
    if (promo.length > 0) {
4120
        titleStr += " " + promo + ' ' + root.labels[0].catno;
4121
    }
4122
 
4123
    titleStr = titleStr.trim();
4124
    titleStr = titleStr.replace(/  +/g, ' ');
4125
    titleStr = titleStr.replace('<br>', '');
4126
 
4127
    if (titleStr.includes('Greatest Hits')) {
4128
        document.getElementById("cdGreatestHits").checked = true;
4129
    }
4130
 
4131
    if (isNumeric(document.getElementById("title").value) || document.getElementById("title").value.length === 0) {
4132
        document.getElementById("title").value = titleStr;
4133
        printTitleLength();
4134
        document.getElementById("cdArtist").value = artist;
4135
        document.getElementById("cdRecordLabel").value = label;
4136
        document.getElementById("cdReleaseYear").value = year;
4137
    }
4138
}
4139
 
4140
function isInSelectList(list, value) {
4141
    var i;
4142
    var opts = document.getElementById(list).options;
4143
 
4144
    for (i = 0; i < opts.length; ++i)
4145
        if (opts[i].value.includes(value)) {
12 - 4146
            $('#' + list).selectpicker('val', opts[i].value);
10 - 4147
            return true;
4148
        }
4149
 
4150
    return false;
4151
}
4152
 
4153
function printTitleLength() {
4154
    var len = document.getElementById("title").value.length;
4155
 
4156
    color = (len > 80 ? 'red' : 'black');
4157
 
4158
    document.getElementById("titleLength").innerHTML = '(' + len + ')';
4159
    document.getElementById("titleLength").style.color = color;
4160
}
4161
 
4162
/**
4163
 * Creates a read/writable property which returns a function set for write/set (assignment)
4164
 * and read/get access on a variable
4165
 *
4166
 * @param {Any} value initial value of the property
4167
 */
4168
function createProperty(value) {
4169
    var _value = value;
4170
 
4171
    /**
4172
     * Overwrite getter.
4173
     *
4174
     * @returns {Any} The Value.
4175
     * @private
4176
     */
4177
    function _get() {
4178
        return _value;
4179
    }
4180
 
4181
    /**
4182
     * Overwrite setter.
4183
     *
4184
     * @param {Any} v   Sets the value.
4185
     * @private
4186
     */
4187
    function _set(v) {
4188
        _value = v;
4189
    }
4190
 
4191
    return {
4192
        "get": _get,
4193
        "set": _set
4194
    };
4195
}
4196
 
4197
    </script>
17 - 4198
    <script>includeHTML();</script>
10 - 4199
 
4200
</body>
4201
</html>