//if (document.getElementById('oly-nav-video-container')){
	jQuery.getJSON("/_common/_includes/_sports/_olympics/video-vancouver-general.ssi", buildVideos);
//}
function buildVideos(data, textStatus) {
	var html = "<h3>Latest Olympics videos</h3>";

	jQuery.each(data.videos, function(i,video){
		if (i >= 3) return;
		if (i == 0) {
			html += "<div class=\"video-thumb no-margin\">";
		} 
		else {
			html += "<div class=\"video-thumb\">";
		}
		var name = video.name;
		var desc = video.shortDescription;
		if (video.customFields && video.customFields.usatodayshortname != null) name = video.customFields.usatodayshortname;
		if (video.customFields && video.customFields.usatodayshortdesc != null) desc = video.customFields.usatodayshortdesc;
		html += "<div class=\"video-frame\">";
		html += "<a href=\"http://www.usatoday.com/video/index.htm?bctid="+video.id+"\" class=\"video-opacity\">";
		html += "<img src=\""+video.thumbnailURL+"\" alt=\"\" width=\"100\" height=\"75\" border=\"0\" class=\"video-thumb2\"/>";
		html += "<img src=\"http://i.usatoday.net/_common/_images/black.gif\" class=\"video-dark\" alt=\"Play Video\"/>";
		html += "<div class=\"video-play\">";
		html += "<img src=\"http://i.usatoday.net/_fronts/_shared/_i/videoplay.gif\" alt=\"Play Video\"/>";
		html += "</div>";
		html += "</a>";
		html += "</div>";
		html += "<div class=\"headline\">";
		html += "<a href=\"http://www.usatoday.com/video/index.htm?bctid="+video.id+"\" class=\"video-opacity\">"+name+"</a>";
		html += "</div>";
		html += "<div class=\"chatter\">"+desc+"</div>";
		if (i==2){
			html += "<a class=\"more\" href=\"http://www.usatoday.com/video/index.htm\">More: Video</a>";
		}
		html += "</div>";
	});
	
	jQuery(html).appendTo("#oly-nav-video-container");
}

