Subversion Repositories munaweb

Rev

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

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