﻿/*** Channel Intelligence ********************************/
if (BBE.product.recommendable === true) {
    var CI_PageType = 'PRODUCT',
        CI_ItemID = BBE.product.id,
        CI_ItemName = BBE.product.name,
        CI_CatID = BBE.product.categoryID,
        CI_CatName = BBE.product.category,
        CI_ItemPrice = BBE.product.price,
        CI_ItemMfr = BBE.product.attributes["Brand"];
}

/*** Rich Relevance **************************************/
var R3_COMMON = new r3_common();

R3_COMMON.setApiKey('54d6306c87f07bb8');
R3_COMMON.setUserId(BBE.sid);
R3_COMMON.setSessionId(BBE.sid);

// for each set of recommendations to be displayed on the page
R3_COMMON.addPlacementType('item_page.content');
R3_COMMON.addPlacementType('item_page.content');

var R3_ITEM = new r3_item();
var bbeLink = window.location.pathname + window.location.search;

R3_ITEM.setId(BBE.product.id);
if (BBE.product.recommendable === true) {
    R3_ITEM.addCategory(BBE.product.category, BBE.product.category);
    R3_ITEM.setName(BBE.product.name);
    R3_ITEM.setCents(BBE.product.price.replace(/\./,""));
    R3_ITEM.setLinkId(bbeLink.substr(1)); 
    R3_ITEM.setImageId(BBE.product.image); 
    R3_ITEM.setBrand(BBE.product.brand);

    // Attributes 
    for (var name in BBE.product.attributes) {
        R3_ITEM.addAttribute(name, BBE.product.attributes[name]);
    }
} else {
    R3_ITEM.setRecommendable(false);
}
r3();