$(document).ready(function() {
  if ($('.video-player').length > 0) {
    // Embed flash video player into .videoPlayer divs
    $('.video-player').each(function(index, playerBlock){
      player = $(playerBlock).children('img');
      if (player) {
        img = $(player).attr('src');
        clip = img.substr(0, img.length - 4) + '.flv';
        w = $(player).attr('width');
        h = $(player).attr('height');
    
        $(playerBlock).flash({
          swf: '/js/player.swf',
          width: w,
          height: h,
          quality: 'high',
          allowfullscreen: 'true',
          wmode: 'transparent',
          flashvars: {
            plugins: 'gapro-1',
            'gapro.accountid': 'UA-25477729-1',
            image: img,
            file: clip
          }
        });
      }
    });
  }
});

