VideoPlaylistManager = function(cnt_video, cnt_lista_video){
  this.cnt_video = $('#' + cnt_video);
  this.cnt_lista_video = $('#' + cnt_lista_video);
}

VideoPlaylistManager.prototype.CaricaPlaylist = function(width, height){
  if(this.cnt_video.length > 0){
    thisc = this;
    var id_youtube = "";
    $('li', thisc.cnt_lista_video).each(function(){
      id_youtube = $('input[type="hidden"]', this).val();
    });
    
    if($('#youtube-player', this.cnt_video).length == 0){
      var iframecode = '<iframe id="youtube-player" width="' + width + '" height="' + height + '" src="" frameborder="0" allowfullscreen></iframe>';
      $(this.cnt_video).html(iframecode);
    }

    var autopl = "&amp;autoplay=0";
    if(typeof autoplay != "undefined"){
      autopl = "&amp;autoplay=" + autoplay;
    }
    var src_iframe = 'http://www.youtube.com/embed/videoseries?list=' + id_youtube + '&amp;autohide=1&amp;rel=0&amp;version=3&amp;feature&amp;fs=1&amp;border=0&amp;loop=0' + autopl;
    //src_iframe = 'http://www.youtube.com/embed/videoseries?list=PL6317F21C33F59CED&hl=en_US';

    $('#youtube-player').attr('src',src_iframe);
    $('#youtube-player', this.cnt_video).attr('width', width);
    $('#youtube-player', this.cnt_video).attr('height', height);
    this.id_youtube_corrente = id_youtube;
  }
}
