/*************************************************************************************************************************
Copyright - Stephen D. Miller, TexasTailchaser.com 

The content on the TexasTailchaser.com and all web pages therin, including without limitation, the text, software, scripts, 
graphics, photos, sounds, videos, interactive features and the like ("Content") and the trademarks, service marks and logos 
contained therein ("Marks"), are owned by or licensed to TexasTailchaser.com, subject to copyright and other 
intellectual property rights under United States and foreign laws and international conventions. Content on the Website is provided 
to you AS IS for your information and personal use only and may not be used, copied, reproduced, distributed, transmitted, broadcast, 
displayed, sold, licensed, or otherwise exploited for any other purposes whatsoever without the prior written consent of Stephen D.Miller, TexasTailchaser.com. 
TexasTailchaser.com reserves all rights not expressly granted in and to the Website and the Content. 

Any violations are not protected, recognized, permissable, classified, or permitted under "Fair Use" and "Public Domain" claims. 

In plain english, you are not allowed to copy or download ANY of the underlying code (HTML, CSS, Javascript, AJAX, etc) for ANY use whatsoever. 
Go write your own code!
***************************************************************************************************************************/
// be sure to add <script src="../js/swfobject.js"></script> in the html page calling this javascript module

var player;


swfobject.addLoadEvent(initializePlayer);

function initializePlayer() { 
	player = swfobject.getObjectById("streamer");
}

function checkPlayerStatus() {
	//TODO - need to see if this actually works with a disconnected stream...or if we need to check STATE.
	playerStatusMessage(player.IsPlaying());		
}

var colorCode;

function changePlayerMessage(status_msg) {
	var txt = "No chase planned today. No streaming video expected.";
	colorCode = status_msg;
	
	if(colorCode == "green")
		txt = "Chase Planned Today! No video stream yet.";
		
	if(colorCode == "yellow")
		txt = "On road to target area! Video stream is pending.";
		
	if(colorCode == "orange")
		txt = "APPROACHING A STORM! Video stream is LIVE!";
		
	if(colorCode == "red")
		txt = "STORM INTERCEPTION IN PROGRESS! VIDEO STREAM IS ACTIVE AND LIVE!" ; 
		
	if(colorCode == "white")
		txt = "Chase ended for the day. No more video." ; 
	
	document.getElementById("statusMsg").innerHTML = txt;
	
}

function playerStatusMessage(state_msg) { 
	if(colorCode == "white" || colorCode == "gray")
		txt = "Video feed is disabled.";
	if(colorCode == "green" || colorCode == "yellow")
		txt = "Video feed is pending.";
	if(colorCode == "orange" || colorCode == "red") {
		if(state_msg == true)
			txt = "VIDEO FEED IS ACTIVE!!";
		else
			txt = "TEMPORARILY LOST VIDEO FEED. IT WILL RESUME SHORTLY.";
	}
			
	document.getElementById("playerStateMsg").innerHTML = txt;
	
}
