

function tmOnTimer()
{
  LockRefresh
  
  txtfr.caption =  Math.round( ramAvailPhys/1024/1024 ) + " MB";
  txtCPU.caption = pbCPU.percent + "%";
  txtRAM.caption = pbRAM.percent + "%";
  
  UnLockRefresh;
  
}


function Run(objPath) 
{
    try 
    {
        var objShell = new ActiveXObject('wscript.shell');
        objShell.Run(objPath);
        objShell = null;
    }
    catch (e)
    {
    alert('找不到指定文件'+objPath+'(或它的组件之一)，请确定文件或路径是否正确，并确定更改了你的IE安全级别：工具--Internet 选项 -- 安全 -- 自定义级别 -- 没有标记为安全的 ActiveX 控件进行初始化和脚本运行\n设置为“启用”或 “提示”');
    }
}

function widgetOnDBClick()
{
  Run("taskmgr");
}

function btChangeBgOnClick()
{
  var bgnum = parseInt(GetSetting( "bg" ));
  if(bgnum + 1>46 )
    bgnum = 1
  else
    bgnum ++;
    
  bg.Src = "images\\bg" + bgnum + ".png"; 

  SetSetting( "bg" ,bgnum );
  SaveSetting("bg");
  
}

function widgetOnInit()
{
  bg.Src = "images\\bg" + GetSetting( "bg" ) + ".png";
  
  pbCPU.style =  parseInt(  GetSetting('chartstyle') );
  pbCPU.penColor = GetSetting('pencl');
  pbCPU.fillColor = GetSetting('fillcl');
  pbCPU.gradientColor = GetSetting('grcl');
   
}

function OnAllSettingsSaved()
{
  widgetOnInit();
}