//============================================================
// Variaveis do Sistema
//============================================================
        var OLD_onload;
        var OLD_onunload;
        var DinamicStartupCmd='';
		var SystemLoadOK=false;

//============================================================
// Funções do Sistema
//============================================================
function StartAllWindows()
{
//======================================================
// NEW LIBRARY VER 3.5
//======================================================
//        for (t=1;t<WINDOWS_COUNT+1;t++)
//        {
//                Janela_Frame=window.top.frames['JanelaForm'+t];
//                if (Janela_Frame)
//                {
//                        if (Janela_Frame.InitWindow)
//                        {
//                                Janela_Frame.InitWindow();
//                        }
//                }
//        }
}
function StartSystem()
{
        StartAllWindows();
				window.top.SystemLoadOK=true;
}
function FinishSystem()
{
//        CloseWindows();
}
function Executar(comando)
{
/*
        if (ns)
        {
                window.top.frames['ExecutarForm'].location.replace(comando);
        }
        else if (ie)
        {
                window.top.frames['ExecutarForm'].location.replace(comando);
        }
*/
				//alert(comando);
				if (SCIWinExec)
				{
        		SCIWinExec.openpage('Executando',comando);
        }
}
//============================================================
// Funções Multimídia
//============================================================

function MM_controlSound(x, _sndObj, sndFile)
{ //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null)
  {
    if (navigator.appName == 'Netscape')
            method = "play";
    else
    {
            if (window.MM_WMP == null)
            {
                window.MM_WMP = false;
                for(i in sndObj)
                        if (i == "ActiveMovie")
                        {
                                  window.MM_WMP = true; break;
                              }
              }
              if (window.MM_WMP)
                      method = "play";
              else if (sndObj.FileName)
                      method = "run";
          }
  }
  if (method)
                  eval(_sndObj+"."+method+"()");
}
function PlayBeep(n)
{
        return; // erro sem placa de som
        if (ns) return;
        if (n==1)
        {
                if (document.CS999138173970)
                {
                        if (typeof(document.CS999138173970)!=undefined)
                        {
                                MM_controlSound('play','document.CS999138173970','/sistema/library/wav/beep.wav');
                        }
                }
        }
        else if (n==2)
        {
                if (document.CS999138173971)
                {
                        if (typeof(document.CS999138173971)!=undefined)
                        {
                                MM_controlSound('play','document.CS999138173971','/sistema/library/wav/popup.wav');
                        }
                }

        }
}
//============================================================
// Eventos do Sistema
//============================================================
function ResizeLista()
{
		//======================================================
		// NEW LIBRARY VER 3.5
		//======================================================
         Arq=FIXPATH+'base/system/system_resize.php?resize=true&cx='+SCIWins.FrameZeroDivObj.offsetWidth+'&cy='+SCIWins.FrameZeroDivObj.offsetHeight;
//$A="Executar('library/base/system/system_resize.php?cx='+SCIWins.FrameZeroDivObj.offsetWidth+'&cy='+SCIWins.FrameZeroDivObj.offsetHeight+'&scx='+screen.width+'&scy='+screen.height);";
		//======================================================
		// Apaguei linha anterior recuperar beckup se necessário
		//======================================================
        Executar(Arq);
}
function OnLoadFun()
{
		//======================================================
		// NEW LIBRARY VER 3.5
		//======================================================
		SCISysStart();
		//======================================================
        StartSystem();
//        Arq=FIXPATH+'base/system/system_resize.php?resize=true&cx='+SCIWins.FrameZeroDivObj.offsetWidth+'&cy='+SCIWins.FrameZeroDivObj.offsetHeight+'&statup=true';
//        Executar(Arq);
				A=FIXPATH+'base/system/system_startup.php';
        SCIWinStartUp.openpage('Startup',A);
        if (window.OLD_onload!=null)
        {
                window.OLD_onload();
        }
}
function OnunLoadFun()
{
        //Executar(FIXPATH+'base/system/system_shutdown.php');
				A=FIXPATH+'base/system/system_shutdown.php';
        SCIWinStartUp.openpage('Startup',A);
        FinishSystem();
        if (window.OLD_onunload!=null)
        {
                window.OLD_onunload();
        }
}
function ShowLogo()
{
//======================================================
// NEW LIBRARY VER 3.5
//======================================================
//        Manta=document.getElementById('framezero_div');
//        if (Manta)
//        {
//                Manta.style.visibility='hidden';
//        }
//        Manta=document.getElementById('Abertura');
//        if (Manta)
//        {
//                Manta.style.visibility='visible';
//        }
}
function HideLogo()
{
//======================================================
// NEW LIBRARY VER 3.5
//======================================================
//        Manta=document.getElementById('Abertura');
//        if (Manta)
//        {
//                Manta.style.visibility='hidden';
//        }
//        Manta=document.getElementById('framezero_div');
//        if (Manta)
//        {
//                Manta.style.visibility='visible';
//        }
}
//============================================================
// Inicialização do sistema
//============================================================

        window.top.onresize=ResizeLista;
        window.OLD_onload=window.onload;
        window.OLD_onunload=window.onunload;
        window.onload=OnLoadFun;
        window.onunload=OnunLoadFun;