/** (c) 2012-2017 Malte Köhrer / AuctionWidgets.Com */ function addStyles(css){ var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.setAttribute('type', 'text/css'); if (style.styleSheet) { /* IE */ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); }; function addEvent(el, eventType, handler) { if (el.addEventListener) { /* DOM Level 2 browsers */ el.addEventListener(eventType, handler, false); } else if (el.attachEvent) { /* IE <= 8 */ el.attachEvent('on' + eventType, handler); } else { /* ancient browsers */ el['on' + eventType] = handler; } }; function AwPagination(tableId, prevText, nextText){ this.prevText=prevText; this.nextText=nextText; this.tableId=tableId; this.table = document.getElementById(tableId); this.rowRefs = []; this.rowLimit = 10; var rowCount = this.table.rows.length; var hasHeader = (this.table.rows[0].firstElementChild.tagName === "TH"); var i,ii,j = (hasHeader)?1:0; this.th = (hasHeader?this.table.rows[(0)].outerHTML:""); this.pageCount = Math.ceil((rowCount-1) / this.rowLimit); if (this.pageCount > 1) { for (i = j,ii = 0; i < rowCount; i++, ii++){ this.rowRefs[ii] = this.table.rows[i].outerHTML; } this.sort(1); } } AwPagination.prototype.sort=function(page) { var rows = this.th, start = ((this.rowLimit * page)-this.rowLimit), i; for (i = start; i < (start+this.rowLimit) && i < this.rowRefs.length; i++) rows += this.rowRefs[i]; this.table.innerHTML = rows; document.getElementById(this.tableId+"-pagination").innerHTML = this.pageButtons(this.pageCount,page); document.getElementById(this.tableId+"id"+page).setAttribute("class",this.tableId+"-active"); } AwPagination.prototype.pageButtons=function (pageCount,page) { var backDisabled = (page == 1)?"disabled":"", nextDisabled = (page == pageCount)?"disabled":"", buttons = "", i; for (i=1; i<=pageCount;i++){ buttons += ""; } buttons += ""; return buttons; } addEvent(window, 'load', function() { if(location.host.indexOf('paypal')!=-1||location.host.indexOf('ebay')!=-1||location.host.indexOf('half.com')!=-1){ alert('Sorry, eBay TOS do not allow to run this widget on domains that contain "ebay", "paypal" or "half.com" as part of the domain name.'); return false; } var html="