jQuery(function($) {

  $('#video-player').each(function() {

    var
    params = {
      video_sd: $('a[rel=video-sd]', this).attr('href'),
      thumbnail: '/static/img/blank.gif',
      blogCode: null,
      link: null,
      lang: null,
      subtitles: null,
      subsUrl: null,
      popupDisabled:'on',
      streaming: null,
      video: {
          'width': 320,
          'height': 240,
          'poster': '/static/img/blank.gif',
          'src': $('a[rel=video-sd]', this).attr('href'),
          'id': 'iVideo',
          'controls': 'controls',
          'type': 'video/mp4'
      }
    },
    video_hd = $('a[rel=video-hd]', this).attr('href');

    if (video_hd) {
      params.video_hd = video_hd;
    }
    if ($('img', this).length){
       params.thumbnail=$('img', this).attr('src');
       params.video.poster=$('img', this).attr('src');
    }
    embedswf({
      ver: '10.0.0',
      el: 'video-player',
      url: _js_cfg.video_player,
      width: 320,
      height: 240,
      params: params
    });

  });

});

function expand_video_player(){
  $('.hide-on-video').addClass('hide');
  $('#div-header-inrubrica').attr('style', 'margin-top: 0px !important');
  $('#video-player').attr('width', 640);
  $('#video-player').attr('height', 400);
}

function shrink_video_player(){
  $('#video-player').attr('width', 320);
  $('#video-player').attr('height', 240);
  $('#div-header-inrubrica').attr('style', '');
  $('.hide-on-video').removeClass('hide');
}

