$(document).ready(function () {
    var openTileEstimation = '#open-tile-estimation',
        infoTileEstimation = $('#info-tile-estimation'),
        tileEstimationContent = $('#tile-estimation-content'),
        infoTileCalculation = $('#info-tile-calculation'),
        tileCalculationContent = $('#tile-calculation-content'),
        accordionCollapsedStr = 'accordion_collapsed',
        accordionHeaderStr = '.accordion__header';

    // listener which scrolls & opens Tile Calculator on PDP
    $(openTileEstimation).on('click', function () {
        infoTileEstimation.removeClass(accordionCollapsedStr);
        tileEstimationContent.show();

        infoTileCalculation.addClass(accordionCollapsedStr);
        tileCalculationContent.hide();

        $(this).blur();
    });

    infoTileEstimation.find(accordionHeaderStr).on('click', function () {
        infoTileEstimation.removeClass(accordionCollapsedStr);
        tileEstimationContent.show();

        infoTileCalculation.addClass(accordionCollapsedStr);
        tileCalculationContent.hide();

        $(this).blur();
    });

    infoTileCalculation.find(accordionHeaderStr).on('click', function () {
        infoTileCalculation.removeClass(accordionCollapsedStr);
        tileCalculationContent.show();

        $(infoTileEstimation).addClass(accordionCollapsedStr);
        tileEstimationContent.hide();

        $(this).blur();
    });

    // listener which scrolls & opens reviews section on PDP
    $('#open-review').on('click', function () {
        $('#info-review').removeClass('accordion_collapsed');
        $('#review-content').css('display', 'block');
    });
});
