// Parámetros de Configuración de Ventana WebPlayer

var _top     = 0;
var _left    = 0;
var _width   = 800;
var _height  = 600;

var _winWBT  = null;
var _intID   = null;
var _firstSetFocus = false;
var _myFrame0 = null;
var _myFrame1 = null;

function launchWBTPlayer(urlWBT2,notReloadFrames,cSystem)
{	
	try
	{
		_myFrame0 = window.parent.frames[0];
		_myFrame1 = window.parent.frames[1];
	}
	catch(e) 
	{
		_myFrame0 = null;
		_myFrame1 = null;
		launchWBTPlayer2(urlWBT2,notReloadFrames,cSystem);
		return;
	}

	if (top!=window)
	{
		try
		{
			top._myFrame0 = window.parent.frames[0]
			top._myFrame1 = window.parent.frames[1]
	
			if (top.launchWBTPlayer2)
				top.launchWBTPlayer2(urlWBT2,notReloadFrames,cSystem);
			else
				launchWBTPlayer2(urlWBT2,notReloadFrames,cSystem);
		}
		catch(e) 
		{
			_myFrame0 = null;
			_myFrame1 = null;
			launchWBTPlayer2(urlWBT2,notReloadFrames,cSystem);
			return;
		}
			
	}
	else
	{		
		launchWBTPlayer2(urlWBT2,notReloadFrames,cSystem);
	}
	
}		

function launchWBTPlayer2(urlWBT,notReloadFrames,cSystem)
{
	
	// CET 04/10/2006
	// Añadido solo para que en UCA desde el WEBVPN funcione el lanzamiento de cursos.
	
	try
	{	
		if (top.webvpn_mangle_url)
		{
			urlWBT = top.webvpn_mangle_url(urlWBT);
		}
	}
	catch(e) { }

	// END CET 04/10/2006
	
	if (!cSystem) 
		cSystem = '';
	else
		cSystem = String(cSystem).toUpperCase()

	winParams= 'top=' + _top;
	winParams += ',left=' + _left;
	winParams += ',width=' + _width;
	winParams += ',height=' + _height;
	winParams += ',menubar=no';
	winParams += ',scrollbars=no';
	winParams += ',locationbar=no';		
	
	if (cSystem=='3ITWPF' || cSystem=='BDNWPF' || cSystem=='3ITWPF_10' || cSystem=='3ITWPF_11')
		winParams += ',resizable=yes';
	else
		winParams += ',resizable=no';		
	winParams += ',statusbar=no';
	winParams += ',status=no';
	winParams += ',toolbar=no';
	
	if (_winWBT && !_winWBT.closed)
	{
		
	}
	else
	{			
		if (_myFrame0)
			_winWBT = _myFrame0.open(urlWBT,'3itrainingcampus',winParams);
		else
			_winWBT = window.open(urlWBT,'3itrainingcampus',winParams);
		
		wbtSetFocus();
		//_winWBT.location.href=urlWBT;
		
		if (!notReloadFrames)
			_intID = window.setInterval('isWBTPlayerClosed()',1000);
	}	
	
	if (document.getElementById)
	{		 	
		window.setTimeout('wbtSetFocus()',1000);
	}	
		
}

function isWBTPlayerClosed()
{	
	if (!_winWBT || _winWBT.closed)
	{
		_winWBT = null;
		window.clearInterval(_intID);
		
		if (window.parent && document.getElementById)
		{		 	
			
			// Desactivamos los errores JavaScript
			
			window.onerror = new function(){return true};
			
			if (_myFrame0)
				if (_myFrame0.location)					
					_myFrame0.location.reload(true);
			if (_myFrame1)
				if (_myFrame0.location)					
					_myFrame1.location.reload(true);
			
			// Activamos los errores JavaScript
			
			window.onerror = null;
			
		}

	}
}

function wbtSetFocus()
{		
	if (_winWBT)
	{
		window.focus();
		_winWBT.focus();
	}
}

