function getPlayer() {
	var ie = navigator.appName.indexOf("Microsoft") != -1;
	flashVideoPlayer = (ie) ? window['myContent'] : document['myContent'];
}
//----------------------------- called by flash object

function updateState(message) {
 //var controls = document.getElementById('controls').rows[0].cells;
 //controls[1].innerHTML=message;
}

function updateSource(message) {
 //var controls = document.getElementById('controls').rows[4].cells;
 //controls//[1].innerHTML=message;
}

function updateTimer(message) {
 //var controls = document.getElementById('controls').rows[1].cells;
 //controls[1].innerHTML=message;
}

function updateDimensions(message) {
 // gotcha: getting metadata only works after the metadata is loaded. here flash checks it, but js can just as easily ask flash to check it
 //var controls = document.getElementById('controls').rows[2].cells;
 //controls[1].innerHTML=message;
}

//------------------------------- called by js

function callFlashPlayPauseVideo() {
	flashVideoPlayer.pauseResume();
}

function playAtTime() {
	time = document.getElementById('time').value;
	flashVideoPlayer.playAtTime(time);
	return false;
}

function playVideo(nVideoID)
{
	$('#videoTitle').empty().html(oVideos[nVideoID]['title']);
	$('#videoSubTitle').empty().html(oVideos[nVideoID]['subtitle']);
	$('#videoBlurb').empty().html(oVideos[nVideoID]['blurb']);
	getPlayer();
	flashVideoPlayer.playVideo(oVideos[nVideoID]['video_file']);
	$('.videoThumb').css('border-color','#FFFFFF');
	$('#img' + nVideoID).css('border-color','#8DAECC');
	currentlyPlaying = nVideoID;
}

function html5Video(nVideoID)
{
	$('#videoTitle').empty().html(oVideos[nVideoID]['title']);
	$('#videoSubTitle').empty().html(oVideos[nVideoID]['subtitle']);
	$('#videoBlurb').empty().html(oVideos[nVideoID]['blurb']);
	$('.videoThumb').css('border-color','#FFFFFF');
	$('#img' + nVideoID).css('border-color','#8DAECC');
	$("#playerScreen").html(function(){
	var playerContent = "<video id='movie' poster='"+oVideos[nVideoID]['tinythumb']+"'\n\
			 controls='controls' preload='preload'>\n\
		  <source id='movie-mp4' src='"+oVideos[nVideoID]['video_mp4']+"'>\n\
		</video>";
	return playerContent;
	});
}

function highLightThis(nVideoID)
{
	document.body.style.cursor = 'pointer';
	$('#img' + nVideoID).css('border-color','#8DAECC');
	$('#span_cap' + nVideoID).css('text-decoration', 'underline');
	$('#span_play' + nVideoID).css('text-decoration', 'underline');
}

function resetThis(nVideoID)
{
	document.body.style.cursor = 'default';
	if(nVideoID != currentlyPlaying) { $('#img' + nVideoID).css('border-color','#FFFFFF'); }
	$('#span_cap' + nVideoID).css('text-decoration', 'none');
	$('#span_play' + nVideoID).css('text-decoration', 'none');
}
