Subversion Repositories munaweb

Rev

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

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