Subversion Repositories munaweb

Rev

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