Subversion Repositories munaweb

Rev

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

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