var flashvars = { 
	type: 'video', 

	// the still image
	//image: 'tyler_vidcap.jpg', 
	
	// the video
	file: 'http://vid2.cupuacuvital.com/D480_Tyler4.flv', 

	// the skin for the player
	skin:'modieus_green.swf', 

	autostart: 'true', // this needs to be false allow the delayed start and view of the jpg -- true for this one
	icons: 'none',
	stretching: 'exactfit', 
	bufferlength:'0', 
	quality:'high' 
};

var params = { allowfullscreen: 'true', wmode: 'opaque', allowscriptaccess: 'always' };
var attributes = { id: 'myContent', name: 'myContent' };
swfobject.embedSWF('player-licensed.swf', 'myContent', '466', '392', '9.0.0','expressInstall.swf', flashvars, params, attributes);

var player		= null;
var playlist	= null;
var currentItem	= null;

var playing		= false;

function playerReady(obj) { player = gid(obj.id); addListeners(); }
function gid(name) { return document.getElementById(name); };

// the listener lets us check to see when the video has ended 
function addListeners() {	
	playlist = player.getPlaylist();
	if((playlist !== null) && (playlist !== undefined)) {
		 player.addModelListener('STATE', 'stateMonitor');
		 // this is the delay in ms before the video starts, showing the image
		 // setTimeout('video_start();',1200); // no delayed start for this
	} else { 
		 setTimeout("addListeners();", 100);
	}
}


// this specifies the function to be executed for end of the video
function stateMonitor(obj) { 
	if(obj.newstate == 'COMPLETED') { video_end(); }  
	if(obj.newstate == 'PLAYING')	{ playing = true; }  
}

// when the video ends, it resets to the beginning and stops to wait for the user to press start
function video_end() {	
	player.sendEvent('LOAD',{image:'tyler_vidcap.jpg', file:'http://vid2.cupuacuvital.com/D480_Tyler4.flv'});
	player.sendEvent('STOP');
}

// this is the function that gets called by the delay
function video_start() { if (!playing) player.sendEvent('PLAY'); }
