// Natural Synthetic Video Player (Version 1.0)
// Copyright © 2009 Natural Synthetic Design Studios - http://www.naturalsynthetic.com
// Any unauthorized use or duplication of this script is strictly prohibited.
// Liscensed for use on the official Sevendust website - http://www.sevendust.com

function requestAccess (client, access_key) {
  naturalsyntheticaccess.embedAccessKey(client + access_key + (access?1:0), 'client', 'key1', 'key2', 'key3', false, false, {getAccess: 'true'});
}

function loadVideo(playerUrl, autoplay) {
  swfobject.embedSWF(
      playerUrl + '&rel=1&border=0&fs=1&autoplay=' + 
      (autoplay?1:0), 'player', '465', '344', '9.0.0', false, 
      false, {allowfullscreen: 'true'});
}

function showMyVideos2(data) {
  var feed = data.feed;
  var entries = feed.entry || [];
  var html = ['<ul class="videos">'];
  for (var i = 0; i < entries.length; i++) {
	var entry = entries[i];
    var title = entry.title.$t.substr(0, 50);
	var alt = entry.title.$t.substr(0, 500);
	var postday = entry.published.$t.substr(8, 2);
	var postmonth = entry.published.$t.substr(5, 2);
	var postyear = entry.published.$t.substr(0, 4);
	var content = entries[i].media$group.media$description.$t.substr(0, 500);
    var thumbnailUrl = entries[i].media$group.media$thumbnail[0].url;
    var playerUrl = entries[i].media$group.media$content[0].url;
	var video = entries[i].media$group.media$thumbnail[0].url.substr(22, 11);
    html.push('<table width=100% cellpadding=1><tr><td width=1 bgcolor=#3d4452><span class=regulartext><a href=http://www.sevendust.com/video.php?watch=', video, ' rel="lyteframe[video]" title="', alt, '" rev="width: 640px; height: 385px; scrolling: no;"><img src="', thumbnailUrl, '" alt="', alt, '" width="140" height="104" border="0"/></a></span></td><td></span><span class="regulartext"><span class="maincattext">Sevendust Studio Update</span><br><span class="menutext">Posted: ',postmonth,'-',postday,'-',postyear,'</span><br>', alt, '</span></td><td width=60><a href=http://www.sevendust.com/video.php?watch=', video, ' rel="lyteframe[video]" title="', alt, '" rev="width: 640px; height: 385px; scrolling: no;"><img src="http://www.sevendust.com/images/play.png" alt="Play" width="60" height="60" border="0" style="opacity:0.8;filter:alpha(opacity=80)" onMouseOver="this.style.opacity=1;this.filters.alpha.opacity=100" onMouseOut="this.style.opacity=0.8;this.filters.alpha.opacity=80"></a></td></tr></table><hr class="dashed">');
  }
  html.push('</ul>');
  document.getElementById('videos2').innerHTML = html.join('');
  if (entries.length > 0) {
    loadVideo(entries[0].media$group.media$content[0].url, false);
  }
}
