// JavaScript Document for Webtv



<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->


<!--- Flash to javascript communictaion to send url param to player --->

<!--
function send_URL(url, inpoint, movieguid){
//var os=navigator.platform;
//document.write(os);
//call the logging function
logFile(movieguid);
var os=navigator.platform; 
	
if (os=="Win32")
{ 
	//alert(movieguid);
	document.idPlayer1.URL = 'http://www.easystream.no/easystream/webtv/presentation/asx/' + movieguid + '.asx';
	//document.idPlayer1.controls.currentPosition = inpoint;
	var iframe = window.frames.IDIframeMovieNotes; 
	iframe.location = 'default.cfm?page=2&movieguid=' + movieguid;
 
}
else 
{ 
 if (os=="MacPPC")
 {
	
	// Create variable is_input to see if there is a contactguid in the url
	var is_guid = document.URL.indexOf('&contactguid=');
	
	// Check the position of the contactguid in the url
	if (is_guid != -1)
	{ 
		// Create variable from contactguid in the url to the end of the contactguid
		guid = document.URL.substring(86,122);
		
	}

	// If there is no contactguid in the url state no values found
	else
	{
		document.write("No values detected");
	}

	//document.write(guid);
	window.top.location.href = 'http://www.easystream.no/easystream/webtv/presentation/default.cfm?page=1&contactguid=' + guid + '&fileName=http://www.easystream.no/easystream/webtv/presentation/asx/' + movieguid + '.asx';
	
 
 }
 else
  {
	document.write("Unknown error. Please see the help file.");
   }
}

}

function playFile(movieguid) {

//call the logging function	
	



var os=navigator.platform;
var browser=navigator.userAgent;

if (os=="Win32")
{ 
	//If Opera browser
	if (browser.indexOf("Opera")==0)
	{
		
			// Create variable is_input to see if there is a contactguid in the url
		var is_guid = document.URL.indexOf('&contactguid=');
		
		// Check the position of the contactguid in the url
		if (is_guid != -1)
		{ 
			// Create variable from contactguid in the url to the end of the contactguid
			guid = document.URL.substring(86,122);
			
		}
	
		// If there is no contactguid in the url state no values found
		else
		{
			document.write("No values detected");
		}
	
		
		window.top.location.href = 'http://www.easystream.no/easystream/webtv/presentation/default.cfm?page=1&contactguid=' + guid + '&fileName=http://www.easystream.no/easystream/webtv/presentation/asx/' + movieguid + '.asx';
	}

	//IE, Firefox
	else
	{
		//alert(movieguid);
		document.idPlayer1.URL = 'http://www.easystream.no/easystream/webtv/presentation/asx/' + movieguid + '.asx';	
	}
	
 
}
else 
{ 
 if (os=="MacPPC" || os=="MacIntel")
 {

	// Create variable is_input to see if there is a contactguid in the url
	var is_guid = document.URL.indexOf('&contactguid=');
	
	// Check the position of the contactguid in the url
	if (is_guid != -1)
	{ 
		// Create variable from contactguid in the url to the end of the contactguid
		guid = document.URL.substring(86,122);
		
	}

	// If there is no contactguid in the url state no values found
	else
	{
		document.write("No values detected");
	}

	window.top.location.href = 'http://www.easystream.no/easystream/webtv/presentation/default.cfm?page=1&contactguid=' + guid + '&fileName=http://www.easystream.no/easystream/webtv/presentation/asx/' + movieguid + '.asx';
	
 
 }
 else
  {
    document.write("Unknown error. Please see the help file.");
   }
}

	
	
	
	
	//alert('jalla');
	
	
	
	//idPlayer1.URL = url;
	logFile(movieguid);	

}

function fullScr(){

if (document.idPlayer1.playState == 3) 
	
       document.idPlayer1.fullScreen = 'true'; 
}


function openHelp() {

	window.open('help/help.html');

}

function checkactivex() 
{
	var player; 
	var plugin; 
	var hasActiveX=false;
	
	try
	{
		if(window.ActiveXObject)
		{
			hasActiveX = true;
			player = new ActiveXObject("WMPlayer.OCX.7");
		}
		else if (window.GeckoActiveXObject)
		{
			 hasActiveX = true;    
			 player = new GeckoActiveXObject("WMPlayer.OCX.7");
		}
	} 
	catch(oError) {}
	
	
	try
	{
		if(navigator.mimeTypes)
		{
			plugin = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin; 
		} 
	}
	catch (oError) {}
	

	//Displays message only if the ax is not installed	
	if (!hasActiveX)
	{
		var message = "Your browser does not support ActiveX. \n";
		
		message +=  "The WMP ActiveX control is not installed. See the help file. \nJust press the button with the  ?  symbol within the interface.\n";
			
		message += "The WMP Plugin is not installed. \n";
			
		alert(message);     
	}
}

//Logging of the usage of the movies
function logFile(movieguid) {
	//alert(movieguid);
	var iframe = window.frames.frmLog; 
	iframe.location = '../logging/log.cfm?movieguid=' + movieguid;
	
	}
