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