var players = [];
cvpFlashVars.player = 'main'+cvpPlayerTest;

//define player config
var cvpStory = {
	flashVars: {},
	embed: {
		containerSwf : cvpContainerSwf
	},
	
	onPlayerReady: function() {
		var storyAdSection = (tourFreeWheelBaseSiteSection != '')?tourFreeWheelBaseSiteSection : 'pgatour.com_pgatour_news';	//default to pgatour.com_pgatour_news if empty string
		
		if(this.getWidth() == '640') {	//hate this hack.  should check player instance, but it seems to always be 'inline' if there is a T1 and an inline in the page at the same time
			storyAdSection += '_t1';
		} else {
			storyAdSection += '_inpage';
		}
		
		this.setAdSection(storyAdSection);
	}
};

Event.observe(window, 'load', function() {
	var len = players.length;
	
	//loop over players and embed in page
	for (var i=0; i<=len-1; i++) {
		var pInstance = players[i].player;
		
		cvpStory.id = 'cvp_'+i;
		cvpFlashVars.contentId = players[i].playlist[0].url;
		cvpFlashVars.player = pInstance;
		
		cvpStory.flashVars = cvpFlashVars;
		
		$(players[i].divId+'Headline').update(players[i].playlist[0].headline);
		$(players[i].divId+'Desc').update(players[i].playlist[0].description);
		
		if(pInstance == 'main') {	//set player size based on player instance
			cvpStory.width = '640';
			cvpStory.height = '360';
		} else {
			cvpStory.width = '288';
			cvpStory.height = '162';
		}
		
		window['player_'+i] = new CVP(cvpStory);
		window['player_'+i].embedSWF(players[i].divId);
	}
});