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

	// 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; 
			if (Math.round(pr1) > 160 && !alwaysShow) {
				_hideVideo();
				playerTimeout = setTimeout('startFLV()', 24000);
			}
		}
		else if(typ == "volume") { currentVolume = pr1; }
		else if(typ == "item") { currentItem = pr1; }//setTimeout("getItemData(currentItem)",100); }
		//var id = document.getElementById(typ);
		//id.innerHTML = typ+ ": "+;
		//pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
		if(pid != "null") {
			//document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
		}
		
		
	};

	// 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);
	}
	
	var s2 = new SWFObject("/swf/flvplayer.swf","mpl","533","300","7");
	s2.addParam("allowfullscreen","true");
	//s2.addVariable("file","/swf/iorp.flv");
	s2.addVariable("file","rtmp://dqty4990z3e.rtmphost.com/habnet");
	s2.addVariable("id","islands of rockportUH_WIDESCREEN_HIGH");
	s2.addVariable("displayheight","300");
	s2.addVariable("autostart","false");
	s2.addVariable("repeat","false");
	s2.addVariable("enablejs","true");
	s2.addVariable("javascriptid","mpl");
	s2.addVariable("volume", "60");
	//s2.write("page_video");
	//document.getElementById('page_video').style.visibility = 'hidden';
	//sendEvent('playpause');
	
	