$(document).ready(function() {
  $f("player", {src: configuration.flowplayer_url, wmode: 'opaque'}, {
    buffering: false,
    play: {
      opacity: 0
    },

    canvas: {
      backgroundColor: 'transparent',
      borderRadius: 30
    },

    screen: {
      width: '100%',
      top: 0
    },

    plugins: {
      controls: null
    },

    clip: {
      autoBuffering: true,
      autoPlay: true,
      duration: 5,
      linkWindow: '_self',
      onStart: function(clip) {
        $('#link_for_flash').attr("href", clip.linkUrl);
        $('#promo_title').html(clip.title);
        if (clip.icon) {
          $('#shadow_with_bg').addClass('shadow_bg');
          $('#promo_icon').html(clip.icon);
        }
        $('#promo_abstract').html(clip.abstract);
        $('#promo_overlay').fadeIn('slow');
      },
      onFinish: function(clip) {
        $('#link_for_flash').attr("href", "");
        $('#promo_overlay').hide();
        $('#promo_title').html('');
        $('#shadow_with_bg').removeClass('shadow_bg');
        $('#promo_icon').html('');
        $('#promo_abstract').html('');
      },
      onBeforeFinish: function () {
        if (this.getClip().index == this.getPlaylist().length - 1) {
          return false;
        }
      }
    }
  });
});

$(document).ready(function() {
  $(".channelfinder_overlay_link").fancybox({
    'titlePosition'   : 'inside',
    'transitionOut'   : 'none',
    'transitionIn'    : 'fade',
    'overlayOpacity'  : '0.8',
    'overlayColor'    : '#000',
    'centerOnScroll'  : true,
    'onComplete': function() {
        jQuery('#fancybox-outer').width(jQuery('#fancybox-inner .col3_content').width() + 55);
        jQuery('#fancybox-inner').width(jQuery('#fancybox-inner .col3_content').width() + 35);
    }
  });
});