// JavaScript Document
	// some variables to save
	var currentVolume = 80; 
	
	var alwaysShow=false;
	var alwaysHide=false;
	var playerTimeout;
	
	var currentPosition;
	var currentItem;
	var currentState;
	var timerID=null;

	
	// 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(pid != "null") {
		if((typ == "state")&&(pr1 != undefined)) { 
			currentState = pr1; 
			if(currentState=="3") {
				if (timerID) { clearTimeout(timerID); }
				_hideVideo()
				timerID = setTimeout("startFLV()", 24000)
			}
		}
	}
}
	// 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); }
	

	// 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];
		}
	}
	
	
	
	
	var saveVolume = -1;
	function showVideo() {
		alwaysHide = false;
		alwaysShow = true;
		clearTimeout(playerTimeout);
		//alert("Save Volume: " + saveVolume);
		startFLV();
	}
	
	function hideVideo() {
		alwaysShow = false;
		alwaysHide = true;
		_hideVideo();
	}
	
	function _hideVideo() {
		sendEvent('stop');
		saveVolume = currentVolume;
		clearTimeout(playerTimeout);
		document.getElementById('page_slides').style.display = 'inline';
		document.getElementById('page_video').style.visibility = 'hidden';
	}

	
	function startFLV() {
		document.getElementById('page_slides').style.display = 'none';
		document.getElementById('page_video').style.visibility = 'visible';
		//s2.write("page_video");
		//setTimeout("sendEvent('playpause')", 100);
		setTimeout("sendEvent('playitem',0)", 100);
		if (saveVolume!=-1) {
			setTimeout("sendEvent('volume',saveVolume)", 150);
		} else {
			setTimeout("sendEvent('volume',70)", 150);
			//sendEvent('volume',70);
		}
		//setTimeout("_hideVideo()", 105000);
	}




	
	