var lockmax = false;

function timer0OnTimer()
{
  LockRefresh;
  
  getNetSpeed;
  var nup = netUpSpeed/1024; 
  var ndown = netDownSpeed/1024;
  
  txtdownv.caption = ndown.toFixed(1)  + "k/s";
  txtupv.caption =  nup.toFixed(1)  + "k/s";
  txtIP.caption =  netIP;
  //===================
  var maxdown = parseInt(GetSetting( "maxdown" ));
  if((ndown>maxdown)&&!lockmax)
  {
    maxdown = Math.round(ndown);
    SetSetting( "maxdown" ,maxdown );
    SaveSetting( "maxdown" );
  }
    
  var maxup = parseInt(GetSetting( "maxup" ));
  if((nup>maxup)&&!lockmax)
  {
    maxup = Math.round(nup);
    SetSetting( "maxup" ,maxup );
    SaveSetting( "maxup" );
  }
  //===================

  chartDown.maxValue = maxdown;
  chartUp.maxValue = maxup;

  chartDown.addItem( ndown ); 
  chartUp.addItem( nup ); 
  
 
  UnLockRefresh;
  
}

function widgetOnInit()
{
  netAdaptIndex = GetSetting( "net" );
  
  chartDown.style = GetSetting('style');
  chartUp.style = GetSetting('style');

  chartDown.penColor = GetSetting('downcl');
  chartUp.penColor = GetSetting('upcl');
  
  chartDown.fillColor = GetSetting('downcl');
  chartUp.fillColor = GetSetting('upcl');
  
  
  tm.interval = parseInt( GetSetting('tm')  );
  
  lockmax = parseInt(  GetSetting('lockmax') );
    
  bg.Src = GetSetting( "bg" );  
}

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

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