var ppSistemaTPV4bWins = {};

openSistemaTPV4bCheckoutWindow = function(winName,opened)
{
	try
	{
		var winH = screen.availHeight*0.8;
		var winW = screen.availWidth*0.8;
		var posTop = (screen.availHeight - winH)/2;
		var posLeft = (screen.availWidth - winW)/2;
		var winSpec = 'top=' + posTop + ', left=' + posLeft + ', ' +
						'width=' + winW + ', height=' + winH + ', ' +
						'toolbar=yes, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes';
		
		var swf = getMovie("previsualizador");
		ppSistemaTPV4bWins[0] = {};
		ppSistemaTPV4bWins[0].swf = swf;
		
		ppSistemaTPV4bWins[0].win = window.open("" , winName, winSpec);
		ppSistemaTPV4bWins[0].win.onload = function()
		{
			ppSistemaTPV4bWins[0].swf.onPPWinReadySistemaTPV4b();
		};
		if(opened == "0")
		{
			if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1 && winName == 'paymentWindowSistemaTPV4b')
			{
				ppSistemaTPV4bWins[0].swf.popUpNotOpenSistemaTPV4b();
			}
			else
			{
				ppSistemaTPV4bWins[0].swf.popUpOpenSistemaTPV4b();
			}
		}

		window.setTimeout("ppWinCloseMonitorSistemaTPV4b('" + 0 + "')", 500);
	}
	catch(err)
	{

		var swf = getMovie("previsualizador");
		ppSistemaTPV4bWins[0] = {};
		ppSistemaTPV4bWins[0].swf = swf;

		ppSistemaTPV4bWins[0].swf.popUpNotOpenSistemaTPV4bError();

	}
}

ppWinCloseMonitorSistemaTPV4b = function()
{
	
	if(ppSistemaTPV4bWins[0].win.closed)
	{
		ppSistemaTPV4bWins[0].swf.onPPWinCloseSistemaTPV4b();
		delete ppSistemaTPV4bWins[0];
	}
	else
	{
		
		window.setTimeout("ppWinCloseMonitorSistemaTPV4b('" + 0 + "')", 500);
	}
}


setFocusToSistemaTPV4bWin = function(jsToken)
{
	if(ppSistemaTPV4bWins[0] && ppSistemaTPV4bWins[0].win)
	{
		ppSistemaTPV4bWins[0].win.focus();
	}
}
