Subversion Repositories munaweb

Rev

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