Subversion Repositories munaweb

Rev

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

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