jQuery(document).ready(function ($) {

  /**
  * Header & Footer
  */
  $('body').on('click', '#accordion-section-cww_header_section,#accordion-section-cww_footer_section', function(event) {
         var section_id = $(this).attr('id');
         headerScrollToSection( section_id );
  });

  function headerScrollToSection( section_id ){
     var preview_section_id = "masthead";

     var $contents = jQuery('#customize-preview iframe').contents();

     switch ( section_id ) {

         case 'accordion-section-cww_header_section':
         preview_section_id = "masthead";
         break;

          case 'accordion-section-cww_footer_section':
         preview_section_id = "colophon";
         break;
                     
     }

     if( $contents.find('#'+preview_section_id).length > 0 ){
         $contents.find("html, body").animate({
         scrollTop: $contents.find( "#" + preview_section_id ).offset().top - 82
         }, 500);
     }
  }


  $('.cww-custom-menu-color').wpColorPicker();
  
 
});//Main document ending