jq(document).ready(function(){

  // Home page video
  jq(function () {
      flowplayer('.homeVideo', { src:"http://74.203.223.196:8114/BBBarns/++resource++collective.flowplayer/flowplayer.swf", bgcolor:"#e6e6e6", wmode:"transparent"}, {
            canvas: {
                // remove default canvas gradient
                backgroundGradient: 'none',
                backgroundColor: "#AFC45F"
            },
            bufferLength:1,
            play:{opacity:0},
            clip: {
                autoPlay: true,
                autoBuffering: true,
                // Loop
                onBeforeFinish: function() { return false; }
            },
                                          
            plugins: {
            controls: null
            }
       });
  });

  // Videos embedded with TinyMCE to show in a colorbox overlay
  jq(".voverlay a").colorbox({
          scrolling:false,
          width:762,
          height:475,
          html:function(){
                  return $('<a/>',{id: 'player', href: $(this).attr('href')});
          },
          onComplete:function(){
                  var flvp = "http://74.203.223.196:8114/BBBarns/++resource++collective.flowplayer/flowplayer.swf";
                  var flpc = "http://74.203.223.196:8114/BBBarns/%2B%2Bresource%2B%2Bcollective.flowplayer/flowplayer.controls.swf";
          flowplayer('player', flvp,  {
                  clip: {
                          autoPlay: true,
                          autoBuffering: false
                  },
                  plugins: {
                      controls: {
                          url: flpc
                      }
                  }
          });
      }
  });

  // Display tagged embedded images as full-size overlays 
  jq(".lightbox a").colorbox();


});

