﻿try {
    document.domain = "sharpusa.com";
} catch (err) { }

function bvShowTab(application, displayCode, subjectId, deepLinkId) {
    if (application == 'PRR') {
        // TODO: insert code here to open the tab that R&R content lives in
        //       if there is no such tab (content is visible by default), this
        //       block may be removed.
        var bvReviewsContainer = document.getElementById("BVReviewsContainer");
        if (!bvReviewsContainer) {
            var tabText;
            var viewParam = "reviews";
            jQuery.noConflict(); // hack since bv is using jquery too
            jQuery('li', '#productinformation ul.tabs').removeClass('selected');
            jQuery('li', '#productinformation ul.tabs').each(function() {
                tabText = jQuery(this).children('a').text().toLowerCase().replace(/[&\s]*/g, '');
                if (tabText.indexOf(viewParam) > -1) {
                    jQuery(this).addClass('selected');
                }
            });

            __doPostBack('middle_0$ProductInfoTabs$ReviewsLink', '');
        }
    }
}

function ratingsDisplayed(totalReviewsCount, avgRating, ratingsOnlyReviewCount, recommendPercentage, productID) {
    if (totalReviewsCount == 0) {
        var bvRevCntr = document.getElementById("BVReviewsContainer");
        var bvSVPLink = document.getElementById("BVSVPLinkContainer");

        // hide the reviews tab if there are no reviews
        var viewParam = "reviews";
        jQuery.noConflict(); // hack since bv is using jquery too
        jQuery('li', '#productinformation ul.tabs').each(function() {
            tabText = jQuery(this).children('a').text().toLowerCase().replace(/[&\s]*/g, '');
            if (tabText.indexOf(viewParam) > -1) {
                jQuery(this).addClass('hidden');
            }
        });

        if (bvRevCntr) { bvRevCntr.style.display = "none"; }
        if (bvSVPLink) { bvSVPLink.style.display = "none"; }
    }
}
function pageChanged(pageName, pageStatus) {
    // TODO: place web analytics tagging code here to track submission process  
}  
    