//promo start/end date
var startDate = isDateBeforeToday(new Date("Fri Aug 16 2024"));
var endDate = isDateAfterToday(new Date("Thu Sep 26 2024"));
//get url to check language
var url = location.href;
var id = '<%= product.mpn %>';
var repo = document.getElementById("repo").getAttribute("flag");
//mpn cashback $250
var prod0 = "3987C002";
var prod1 = "4514C002";
var prod2 = "4318C002";
var prod3 = "5776C002";
var prod4 = "3792C002";
var prod5 = "4112C002";
var prod6 = "3380C002";
var prod7 = "3380C132";
function isDateBeforeToday(date) {
return new Date(date.toDateString()) < new Date(new Date().toDateString());
}
function isDateAfterToday(date) {
return new Date(date.toDateString()) > new Date(new Date().toDateString());
}
if (startDate && endDate) {
if (repo == "on") {
if (id == prod0 || id == prod1 || id == prod2 || id == prod3) {
canonCashback250();
}
else if (id == prod4 || id == prod5 || id == prod6 || id == prod7) {
canonCashback250();
}
}
}
//create image element
function canonCashback250 () {
var elem = document.createElement("img");
if (url.toString().includes("magasin")) {
elem.setAttribute("src", "https://cdn.prod.website-files.com/5cdb2c0ad519d739e4dedf1e/66c48e95fe49b376ad54007f_canonCashback250.jpg");
}
else {
elem.setAttribute("src", "https://cdn.prod.website-files.com/5cdb2c0ad519d739e4dedf1e/66c48e95fe49b376ad54007f_canonCashback250.jpg");
}
elem.setAttribute("height", "150");
elem.setAttribute("width", "150");
elem.setAttribute("alt", "Canon Promo Badge");
elem.setAttribute("class", "canonPromoBadge");
document.getElementsByClassName("dakis-product-images")[0].appendChild(elem);
document.getElementById("demo").setAttribute("repo", "off");
}