/*<![CDATA[*/
$(document).ready(function(){
  // Get current navigation link and set active class for styling
  $("a[href*='/galleries']").parent().addClass("active");
  
  // Video Display
  //<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/APbO5D5WsDI&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/APbO5D5WsDI&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
  //swfobject.embedSWF('http://www.youtube.com/v/APbO5D5WsDI&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6', 'gallery-video-view', 425, 344, '6.0.0');
  
   // activate flyout gallery
  $('a', '.pictures-thumbs-container').flyout({
   loadingSrc:'/images/ajax-loader.gif',
   destElement: '#picture-viewer-1'
   //putAwayFinish: function(x){
   //  alert("putaway start");
   //}
  });

  $('.pictures-thumbs-container ul li:eq(6) a').click();
  
});

  function showMyVideos(data) {
    var feed = data.feed;
    var entries = feed.entry || [];
    var html = ['<ul>'];
    for (var i = 0; i < entries.length; i++) {
      var entry = entries[i];
      var title = entry.title.$t.substr(20, 45);
      var thumbnailUrl = entries[i].media$group.media$thumbnail[0].url;
      var playerUrl = entries[i].media$group.media$content[0].url;
      html.push('<li onclick="loadVideo(\'', playerUrl, '\', true)">',
                '<img src="', 
                thumbnailUrl, '" width="125" height="100"/>', '</span></li>');
    }
    html.push('</ul><br style="clear: left;"/>');
    document.getElementById('videos-thumbs-list-1').innerHTML = html.join('');
    //if (entries.length > 0) {
    //  loadVideo(entries[0].media$group.media$content[0].url, false);
    //}
  };
  

function loadVideo(playerUrl, autoplay) {
  $('.pictures-thumbs-container li a.shown').click();
  $('.pictures-thumbs-container').width(($('#content').width() - 445 - 50));
  $('#picture-viewer-1').width(445);
  $('#picture-viewer-1').height(365);
  //$('#picture-viewer-1').effect("size", { to: {width: 445,height: 365} }, 1000);
  swfobject.embedSWF(
      playerUrl + '&color1=0x26476b&color2=0x489cd6&rel=1&border=0&fs=1&autoplay=' + 
      (autoplay?1:0), 'gallery-video-view', '425', '344', '7.0.0', false, 
      false, {allowfullscreen: 'true'});
  
  $.scrollTo('body', 0, {axis:'y'});
}
/*]]>*/
