// Hook for Internet Explorer. 
// This writes the "moviename_DoFScommand" function to VB script in order to receive fscommand calls from flash. 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('sub player_FSCommand(ByVal command, ByVal args)\n');
	document.write(' call player_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

// This javascript function acts as a handler for all fscommands
// called by the flash app. The prefix of the function name must 
// match the id given to the embedded flash object.
// The command passed to this function should be a complete string
// of the javascript call. i.e. command = functionName( 'arg 1', arg2, "arg3" ); 
function player_DoFSCommand( command )
{
	eval( command );
}

// Fix for Safari 3: SWFAddress seems to want to reload the entire page when first
// setting the # location. This forces the URL to contain the # if its left off, fixing the problem. 
var agent = navigator.userAgent;
var isSafari = ( agent.indexOf( 'Safari' ) != -1 );

var version=asual.util.Browser.version

if ( isSafari )
{
	var theRef = window.location.href;
	if ( theRef.indexOf( "?#") == -1 && version >= 500)
	{
		window.location = '?#';
	}
}


function getBase(){
	var base;
	
	base=document.location.href;
	
	base=base.split('/');
	base.pop();
	base=base.join('/');

	return(base+'/');
}

function addUrlVariables( swfObject )
{
	var url = document.location.href;
	var values = url.substring( url.indexOf( "?" )+1, url.length ).split( "&" );
	
	for( var i=0; i < values.length; i++ )
	{
		var valuePair = values[ i ];
		var varName = valuePair.substring( 0, valuePair.indexOf( "=" ));
		var varValue = valuePair.substring( valuePair.indexOf( "=" )+1, valuePair.length );
		swfObject.addVariable( varName, varValue );
	}
}

function dataprotection()
{
	var url = FlashInterface.languages[lang][4];
	window.open(url, "");
/*	popWin( url, "", width, height )*/
}

function legal()
{
	var url = FlashInterface.languages[lang][5];
	window.open(url, "");
/*	popWin( url, "", width, height )*/
}