
	// some variables to save
	var currentPosition;
	var currentVolume;
	var currentItem;
	var currentState; // 0 - not playing, 1 - loading, 2 Playing
	var thisTime
	var canScrub=true




	// these functions are caught by the JavascriptView object of the player.
	function sendEvent(typ,prm) {thisMovie("mpl").sendEvent(typ,prm); };
	
	function getUpdate(typ,pr1,pr2,pid) {
		if(typ == "time") { currentPosition = pr1; }
		else if(typ == "volume") { currentVolume = pr1; }
		else if(typ == "item") { currentItem = pr1; }
		else if(typ == "state") { currentState = pr1;}
	};

	// These functions are caught by the feeder object of the player.
	function loadFile(obj) { thisMovie("mpl").loadFile(obj); };
	function addItem(obj,idx) { thisMovie("mpl").addItem(obj,idx); }
	function removeItem(idx) { thisMovie("mpl").removeItem(idx); }
	function getItemData(idx) {
		var obj = thisMovie("mpl").itemData(idx);
		//var nodes = "";
		////for(var i in obj) { 
		//	nodes += "<li>"+i+": "+obj[i]+"</li>"; 
		//}
		//document.getElementById("data").innerHTML = nodes;
	};

	// This is a javascript handler for the player and is always needed.
	function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};

function handleClick(typ)
	{

	if((typ == "play")&&(currentState==0)){sendEvent('playpause')}
	else if((typ == "pause")&&(currentState !=0)){ sendEvent('playpause')}

	}
function nextClip()
		{
// returns the number of seconds to scrub to the next clip/section. Returns 0 if do nothing, -1 if stop the player
	var nextClip = 0
	
		for (var i = 0; i < g_Clips.length  ; i++)
		{
		nextClip = i
		// Time is less than "i" stop time
		if((currentPosition < g_Clips[i][1]))
			{
		// Is it greater than the start time
			if(currentPosition >= g_Clips[i][0])
				{
			// In the zone	
				return 0
				}
				else
					{
					// Time to scrub to that starting point
					return g_Clips[i][0]	
					}	
			}

		}
// beyond clips stop times
	return -1
	}
	
function do_time()
	{

			var msg

	
			if(g_Do_Splits)
				{
				if(canScrub)
					{
					var intScrub= 0
					try
						{
						intScrub = nextClip()
						}
						catch(e) {}

					switch(intScrub)
						{
						case 0:
 						// running in the zone
  						break;    
						case -1:
							//msg ="<font face='Arial' size='2'><b>This is the end of controlled playback. Reposition and click Play.</b></font>"
  							handleClick("pause")
  						break;
						default:



								//sendEvent('scrub', intScrub)
								//msg ="<font face='Arial' size='2'><b>Standby: Controlled positioning to " + hms(intScrub) + " of the web cast.</b></font>"

								if(currentState==2)
									{
									sendEvent('scrub', intScrub)
									}
								return

						
						}

					}
				}

					

	}
// Table of Contents functions
	var highColor="#C0C0C0"
	var backColor=''
	var playColor="#275D81"//"#FFFF00"//"#7A7E8D"//"#C0C0C0"
	var currRow='tocid0'
	var currTOC=''


	
function jumpTo(id,frame)
	{
	if(g_Do_Splits.toUpperCase() == "TRUE")
		{
		var answer = confirm("This web cast is pre-controlled for the sections to view.\nDo you want to take control?")
			if (answer)
				{
				g_Do_Splits = "False"
				}
				else
					{
					return
					}
		}
		var offset = parseInt(frame)
		if (offset==0)
			{
			offset=1
			}
			sendEvent('scrub',offset)

		document.all[id].bgColor=playColor
	try
		{
		if(id!=currRow)
			{
			document.all[currRow].bgColor= backColor
			}
		}
		catch(e){}
	
	currRow=id
	}	
function outColor(id)
	{
	if(id!=currRow)
		{
		document.all[id].bgColor=backColor
		}
		else
			{
			}
			

	}	
function inColor(id)
	{
	if(id!=currRow)
		{
		document.all[id].bgColor=highColor
		}
		else
			{
			}
			

	}
	
