﻿Volvo.CWP.ProductBar = function(id) {
    this.container = document.getElementById(id);
    this.init();
};

Volvo.CWP.ProductBar.prototype.init = function() {
    this.hoverBoxes = new Array();
    var popups = $('div.rollover-popup');
    popups.appendTo('div.product-bar');

    for (var i = 0; i < popups.size(); i++) {
        var popup = this.setupItem(popups[i], i);
        this.hoverBoxes.push(popup);
    }
};

Volvo.CWP.ProductBar.prototype.setupItem = function(item, index) {
    var image = $('img.rollover-image').get(index);
    var container = $('div.product-bar').get(0);
    var box = new Volvo.CWP.HoverBox(item, image, { xcontainer: container, ycontainer: container });
    return box;
};