// bazaar voice code starts    
function ratingsDisplayed(totalReviewsCount, avgRating, ratingsOnlyReviewCount, recommendPercentage, productID) {
  if (window.location.href == "http://www.triabeauty.com/tria-laser-hair-removal-system") {
        jQuery('#BVReviewsContainer #BVRRCustomHelpTextLabelID').css('display','block');
    }
    if (totalReviewsCount == 0) {
        var bvRevCntr = document.getElementById("BVReviewsContainer");
        var bvRLPLink = document.getElementById("BVRLPLinkContainer");
        var bvSecondaryRatings = document.getElementById("BVSecondaryCustomerRatings");
        
        if (bvRevCntr) { bvRevCntr.style.display = "none"; }
        if (bvRLPLink) { bvRLPLink.style.display = "none"; }
        if (bvSecondaryRatings) { bvSecondaryRatings.style.display = "block"; }
    }
}

// bazaar active profile submission form starts    
function BVAnalytics(json) {

  // Profiles
  if(json.bvProduct == "Profiles") {
      // Injection
      if(json.eventSource == "Display") {        
          // Submission
          if(json.eType == "Write" || json.eType == "Support") {
              // TODO: place web analytics tagging code here to track submission process
              //       use json.pageType to determine submission state (edit, preview, thank you)
              //       see appendix for more details
          }               
      }
      // Click actions
      else if(json.eventSource == "Action") {
          // TODO: place web analytics tagging code here to track clicks
      }
  }    
}
// bazaar active profile submission form ends

// bazaar voice submission form starts --->
function BVAnalytics(json) {
   
    // Ratings & Reviews
    if(json.bvProduct == "RatingsAndReviews") {
        // Injection
        if(json.eventSource == "Display") {
            // Submission
            if(json.eType == "Write" || json.eType == "Support") {
                // TODO: place web analytics tagging code here to track submission process
                //       use json.pageType to determine submission state (edit, preview, thank you)
                //       see appendix for more details
            }            
        }
        else if(json.eventSource == "Action") {
            // TODO: place web analytics tagging code here to track clicks
        }
    }
    
  // Ask & Answers
  if(json.bvProduct == "AskAndAnswer") {  
         // Injection  
         if(json.eventSource == "Display") {          
             // Display  
             if(json.eType == "Read") {  
                 // Hide ALP link container if there are zero questions  
                 if (json.attributes.numQuestions == 0) {  
                     var bvALPLink = document.getElementById("BVALPLinkContainer");  
                     if (bvALPLink) { bvALPLink.style.display = "none"; }   
                 }     
             }   
             // Submission  
             else if(json.eType == "Write" || json.eType == "Support") {  
                 // TODO: place web analytics tagging code here to track submission process  
                 //       use json.pageType to determine submission state (edit, preview, thank you)  
                 //       see appendix for more details  
             }                 
         }  
         // Click actions  
         else if(json.eventSource == "Action") {  
             // TODO: place web analytics tagging code here to track clicks  
         }  
    } 
 
    // Profiles
    if(json.bvProduct == "Profiles") {
        // Injection
        if(json.eventSource == "Display") {        
            // Display
            if(json.eType == "Read") {
                // TODO: place web analytics tagging code here to track items on page-load
            }      
        }
        // Click actions
        else if(json.eventSource == "Action") {
            // TODO: place web analytics tagging code here to track clicks
        }
    }  
}
// submission ends
