// Get variables
var prodPrice = <%= product.price %>;
var prodCat = "<%= product.category[1].name %>";
// Run script for filtered categories
if(prodCat == "Digital Cameras" || prodCat == "Lenses - SLR & Compact System") {
// Parse all entries
for (var x of warranty3List) {
if(x[0] > prodPrice) {
my3Warranty(x[1][0], x[1][1]);
break;
}
}
for (var x of warranty5List) {
if(x[0] > prodPrice) {
my5Warranty(x[1][0], x[1][1]);
break;
}
}
}
// Update info in widget
function my3Warranty(link, price) {
document.getElementById("warranty3LinkBox").href = link;
document.getElementById("war3Price").innerHTML = price;
document.getElementById("warranty3LinkBox").style.display = 'block';
document.getElementById("warrantyLinkBox").style.display = 'block';
}
function my5Warranty(link, price) {
document.getElementById("warranty5LinkBox").href = link;
document.getElementById("war5Price").innerHTML = price;
document.getElementById("warranty5LinkBox").style.display = 'block';
}