//	Celebrity
	var gallery = [];
//	override BC player
	var buildCelebrityBrightcovePlayer = function(videoID) {
		var config = [];
			config["videoId"] = videoID;
			config["videoRef"] = null;
			config["lineupId"] = null;
			config["playerTag"] = null;
			config["autoStart"] = false;
			config["preloadBackColor"] = "#FFFFFF";
			config["width"] = 466;
			config["height"] = 402;
			config["playerId"] = 1648674218;
		createExperience(config, 8);
	}
//	initialize Partner Recirc feeds for bottom of page
	var initializeBottomRecirc = function() {
		if (!$('#bottomrecirc').length) {return;}
		var recircArray = {
			'recircs' : [ 
				{
					'id'		: 'bottomrecirc',
					'feed' 		: [
						{
							'name'		: 'InStyle.com',
							'json' 		: 'http://img2-short.timeinc.net/people/static/json/instyle_whatsrightnow/feed.js',
							'site' 		: 'http://www.instyle.com',
							'image' 	: 'http://img2.timeinc.net/people/static/i/photos/logoInstyle.gif'
						},{
							'name'  	: 'EW.com',
							'json' 		: 'http://img2-short.timeinc.net/people/static/json/ew/feed.js',
							'site' 		: 'http://www.ew.com',
							'image' 	: 'http://img2.timeinc.net/people/static/i/news/logoEW.gif'
						}
					]
				}
			]
		};
		pushToMasterArray(recircArray);
	};
	initializeBottomRecirc();
	
	
// Writes a Brightcove HTML5 Player with playlist for Celeb DB main pages.

	function getplayer(json){
		if (typeof celebdbvideos === 'undefined'){return;}
		$.ajax({
			async: false,
			url: 'http://api.brightcove.com/services/library?command=find_video_by_reference_id&reference_id=' + celebdbvideos[0].videoid + '&video_fields=name,id,length,publisheddate,referenceid&token=z82mZPLs0IuL3IOHflrej0z20nir2iTbXFQOcgWNKfE.',
			dataType: 'jsonp',
			success: function(result){
				appendplayer(result);
			},
			error: function(){
				$('#player').innerHTML = 'We\'re sorry, but there seems to have been an error...';
			}
		});
	}
	
	$(getplayer);
	
	var playlistfragment = '';
	
	function appendplayer(json){
		firstvidfragment = '<div id="bcPlayer' + json.id + '" class="videobox">';
		firstvidfragment += '<object id="myExperience' + json.id + '" class="BrightcoveExperience">';
		firstvidfragment += '<param name="bgcolor" value="#FFFFFF" />';
		firstvidfragment += '<param name="width" value="466" />';
		firstvidfragment += '<param name="height" value="402" />';
		firstvidfragment += '<param name="playerID" value="69701137001" />';
		firstvidfragment += '<param name="publisherID" value="416418724"/>';
		firstvidfragment += '<param name="isVid" value="true" />';
		firstvidfragment += '<param name="wmode" value="transparent" />';
		firstvidfragment += '<param name="isUI" value="true" />';
		firstvidfragment += '<param name="optimizedContentLoad" value="true" />';
		firstvidfragment += '<param name="@videoPlayer" value="' + json.id + '"/>';
		firstvidfragment += '</object>';
		firstvidfragment += '</div>';
			
		$('#player').html(firstvidfragment);

		var videopubdate = celebdbvideos[0].pubdate; // get the Publish Date from CT
		var videotitle = celebdbvideos[0].title; // get the Video Title from CT
		var videodeck = celebdbvideos[0].deck;
		var videolength = celebdbvideos[0].duration;
		var videourl = celebdbvideos[0].url;

		// Begin: playlist fragment
		// start list item
		playlistfragment += '<p class="pubdate">' + videopubdate + '</p>';
		playlistfragment += '<p class="headline">' + videotitle + '</p>';
		playlistfragment += '<p class="deck">' + videodeck + '</p>';	
		playlistfragment += '<p class="timestamp">' + videolength + '</p></a></span>';
		playlistfragment += '<p class="more"><a href="' + videourl + '">More Videos</a></p>';
		
		// Begin: Write playlist code to page
		$('#playlist').append(playlistfragment);
		brightcove.createExperiences();
		// End: Write playlist code to page
	}
	

// Fix floating display issues with Google Ads & Photo Credits
$(document).ready(function() {
	$('#leftColumn').append('<div class="clear"></div>');
});
