var count,size,hd;
        
function widgetOnInit()
{
  tm.interval = parseInt(GetSetting( "refreshsec" )) * 1000;
  tm.enabled = true; 
  tmOnTimer(); 
  if(count>0)
    bg.Src = "images\\" + GetSetting( "bg" ) + "f.png"
  else
    bg.Src = "images\\" + GetSetting( "bg" ) + ".png";
  
  txt.fontName = GetSetting( "txtfn" );   
  txt.fontSize = parseInt(GetSetting( "txtsize" ));   
}

function tmOnTimer()
{
  count =  recycleItemCount;
  size =  recycleSize;
  txt.caption = count + "项 " + (size/1024/1024).toFixed(1) + "M";
  if(count>0)
    bg.Src = "images\\" + GetSetting( "bg" ) + "f.png"
  else
    bg.Src = "images\\" + GetSetting( "bg" ) + ".png";
  
}

function nMenu1OnClick()
{
  tmOnTimer();
}

function OnAllSettingsSaved()
{
  widgetOnInit();
}

function widgetOnDBClick()
{
  Run("::{645FF040-5081-101B-9F08-00AA002F954E}");
  tmOnTimer(); 
}

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

function nMenu2OnClick()
{
  emptyRecycleBin;
  tmOnTimer();
  
   
}

function refreshrc()
{
  clearTimeout(hd);
  tmOnTimer();
  Print( "refreshrc" );
}

function widgetOnDropFile(fileNameList)
{
  deleteToRecycleBin( fileNameList );
}