Subversion Repositories munaweb

Rev

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