/* Avoid other library conflict */
var rr = jQuery.noConflict();

function js_only_styles(){
  var el = rr('body');
  el.removeClass('no-js');
  el.addClass('js');
}

rr(document).ready(function() {
  
  js_only_styles();
  
  // ------------------
  // Barousel + Thslide
  // ------------------
  function startBarousel(){
    // Starts with the boilerplate slide,
    // ..fade out boiler plate slide,
    // ..then Barousel + Thslide begins play
    
    rr('.boilerplate_slide').fadeOut(600, function(){
    
      // Barousel carousel plugin
      rr('#barousel_thslide').barousel({
        navWrapper: '#thslide_barousel_nav .thslide_list',
        //manualCarousel: 1, // do not start automatically, doesn't gel with thslide
        navType: 3, // custom nav option - using thslide plugin (thumbnail slide)
        contentResize: 0 // do not resize height of content div
      });
      
      // Thslide - thumbanil slider plugin
      rr('#thslide_barousel_nav').thslide({
        itemOffset: 165, // width of thumbnail
        infiniteScroll: 1, // loop through thumbnails
        //scrollOver: 1, // enable scrolling on mouse hover
        itemVisible: 0
      });
      
      rr('.thslide_list li:first a').addClass("current"); // put active style on first thumbnail
    })
  }
  setTimeout(function(){startBarousel()}, 5000); // time to wait for Barousel to begin
  
});
