Subversion Repositories munaweb

Rev

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

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