// This file carries out all site-wide javascript header code
// and more specifically - all jQuery $(document).ready(); scripts
$(document).ready(function(){
  
  // Update the Search Box Label
  $("#search_string").inputLabel();
  
  // Update all images with "blur" states
  $("img[data-blur]").each(function(){
    // Add a data-hover to the image
    $(this).attr('data-hover', $(this).attr('src'));
    $(this).attr('src',$(this).attr('data-blur'));
    // Add a hover event to the image
    $(this).hover(
      function(){
        $(this).attr('src',$(this).attr('data-hover'));
        },
      function(){
        $(this).attr('src',$(this).attr('data-blur'));
        }
      );
    });
    
  // Hide all inactive menu options
  $("#sideSubBoxTop li.sub-submenu").addClass('hidden');
  // Create click events for all the parents
  $("#sideSubBoxTop li.sub-mainmenu[data-haschildren=true]").toggle(
    function(e){
      e.preventDefault();
      var parent_id = $(this).attr('data-pageid');
      $("#sideSubBoxTop li.sub-submenu[data-parent="+parent_id+"]").removeClass('hidden');
      },
    function(e){
      e.preventDefault();
      var parent_id = $(this).attr('data-pageid');
      $("#sideSubBoxTop li.sub-submenu[data-parent="+parent_id+"]").addClass('hidden');
      }
    );
  // Trigger a click for the active menu option to have it auto-expand
  $("#sideSubBoxTop li.sub-mainmenu[class*=active]").trigger('click');
  
});

function activate_flow_player()
{
  flowplayer("flash_player", "http://www.consumercontact.com/flash/flowplayer-3.1.2.swf",
      {
      clip:{
        autoPlay: false,
        autoBuffering: true
        },
      canvas:{
        backgroundColor: "#FFFFFF"
        },
      plugins:{
       controls:{
          buttonColor: '#5F747C',
          durationColor: '#ffffff',
          volumeSliderGradient: 'none',
          tooltipColor: '#5F747C',
          tooltipTextColor: '#ffffff',
          progressGradient: 'medium',
          progressColor: '#112233',
          volumeSliderColor: '#000000',
          sliderGradient: 'none',
          backgroundColor: '#9ec4d1',
          bufferColor: '#445566',
          buttonOverColor: '#728B94',
          backgroundGradient: 'medium',
          timeBgColor: '#555555',
          timeColor: '#01DAFF',
          borderRadius: '15',
          bufferGradient: 'none',
          sliderColor: '#000000',
          height: 24,
          opacity: 1.0
          }
        }
      }
    );
}