$(document).ready(function(){
  
  // Activate the flowplayer once the page has finished loading
  activate_flow_player_home();
  
  // Add click-actions for all the video thumbnails
  $("#videoMiniBoxThumb a.video_link_button").click(function(e){
    var button = $(this);
    button.css('cursor','wait');
    button.css('opacity','0.5').css('filter','alpha(opacity=50)');
    var video_id = $(this).attr('id');
    $.ajax({
      url:"scripts/get_video_info.php?video_id="+video_id+"&request=html",
      cache: false,
      success: function(html){
        $("#active_video").html(html);
        activate_flow_player_home();
        button.css('cursor','default');
        button.css('opacity','').css('filter','');
        }
      });
    e.preventDefault();
    });
    
});

function activate_flow_player_home()
{
  flowplayer("flash_player", "http://www.consumercontact.com/flash/flowplayer-3.1.2.swf",
      {
      clip:{
        autoPlay: false,
        autoBuffering: true
        },
      canvas:{
        background: '#D5EAEB url(http://www.consumercontact.com/images/home-video-bg.jpg) repeat-y top center'
        },
      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
          }
        }
      }
    );
}