var DmdNTWSettings_722ab84abcf2484881abb32045b52042 = { pageItems : [[],[]], dates : ["Wednesday, October 24, 2018","Wednesday, October 17, 2018"], numOfColumns : 4, primaryColor : '#000000', secondaryColor : '#ffffff', bgColor : '#92d0bb', itemWidthPer : 100 / 4, numPrevWeeks : 1, nextWeeksDate : '', curWeekDate : 'Wednesday, October 24, 2018', rowsPerPage: 0, curPage: 0, currentIndex: 0 }; function DmdNTW_722ab84abcf2484881abb32045b52042() { var settings = DmdNTWSettings_722ab84abcf2484881abb32045b52042; document.write('
'); for (var i = 0; i < settings.dates.length; i++) { if (settings.dates[i] == settings.curWeekDate) { DmdNTW_ChangeDate_722ab84abcf2484881abb32045b52042(i); settings.currentIndex = i; } } } function DmdNTW_ChangeDate_722ab84abcf2484881abb32045b52042(index) { var settings = DmdNTWSettings_722ab84abcf2484881abb32045b52042; settings.currentIndex = index; settings.curPage = 0; document.getElementById("dmdNewReleasesWidget_722ab84abcf2484881abb32045b52042").innerHTML = DmdNTW_SetDisplayMarkup_722ab84abcf2484881abb32045b52042(settings.pageItems[index], settings.dates[index]); } function DmdNTW_NextPage_722ab84abcf2484881abb32045b52042() { var settings = DmdNTWSettings_722ab84abcf2484881abb32045b52042; settings.curPage += 1; document.getElementById("dmdNewReleasesWidget_722ab84abcf2484881abb32045b52042").innerHTML = DmdNTW_SetDisplayMarkup_722ab84abcf2484881abb32045b52042(settings.pageItems[settings.currentIndex], settings.dates[settings.currentIndex]); } function DmdNTW_PrevPage_722ab84abcf2484881abb32045b52042() { var settings = DmdNTWSettings_722ab84abcf2484881abb32045b52042; settings.curPage -= 1; document.getElementById("dmdNewReleasesWidget_722ab84abcf2484881abb32045b52042").innerHTML = DmdNTW_SetDisplayMarkup_722ab84abcf2484881abb32045b52042(settings.pageItems[settings.currentIndex], settings.dates[settings.currentIndex]); } function DmdNTW_SetDisplayMarkup_722ab84abcf2484881abb32045b52042(collection, displayDate) { var settings = DmdNTWSettings_722ab84abcf2484881abb32045b52042; var markup = ''; markup += '

New Releases - ' + displayDate + '

'; markup += '
'; var curWeekIndex = 0; markup += '
'; markup += 'Upcoming Releases'; if (settings.dates.length > 1) { markup += ' - '; for(var j = 0; j < settings.dates.length; j++) { var dateText = '' if (settings.dates[j] == settings.curWeekDate) { dateText = "This Week"; curWeekIndex = j; } else if (settings.dates[j] == settings.nextWeeksDate) { dateText = "Next Week"; } else { if (j - curWeekIndex == 1) { dateText = "Last Week"; } else { dateText = (j - curWeekIndex) + " Weeks Previous"; } } markup += '' + dateText + ''; if (j != settings.dates.length -1) { markup += ' - '; } } } markup += '
'; var startingIndex = settings.curPage * (settings.rowsPerPage) * settings.numOfColumns; var endingIndex = (settings.curPage + 1) * (settings.rowsPerPage) * settings.numOfColumns; var hasMore = true; var isFirstPage = settings.curPage == 0; if (endingIndex >= collection.length || settings.rowsPerPage == 0) { endingIndex = collection.length; hasMore = false; } if (settings.rowsPerPage != 0) { markup += '
'; if (!isFirstPage) { markup += '<< PREV PAGE'; } if (!isFirstPage && hasMore) { markup += ' '; } if (hasMore) { markup += 'NEXT PAGE >>'; } markup += '
'; } for(var i = startingIndex; i < endingIndex; i++) { markup += '
'; markup += ''; markup += '
' + collection[i].Title + '
'; markup += '
' + collection[i].Publisher + '
'; markup += '
'; } if (settings.rowsPerPage != 0) { markup += '
'; markup += '
'; if (!isFirstPage) { markup += '<< PREV PAGE'; } if (!isFirstPage && hasMore) { markup += ' '; } if (hasMore) { markup += 'NEXT PAGE >>'; } markup += '
'; } markup += '
'; return markup; } DmdNTW_722ab84abcf2484881abb32045b52042();