var lan = "en"; 
var vacn ;


//获取中文的星期 
function getWeek(lan,week){
   var x;
   if(lan=="en")
   { 
     var x = new Array("Sunday", "Monday", "Tuesday");
     var x = x.concat("Wednesday","Thursday", "Friday");
     var x = x.concat("Saturday");

   }
   else
   {
     var x = new Array("星期日", "星期一", "星期二");
     var x = x.concat("星期三","星期四", "星期五");
     var x = x.concat("星期六");
   }
   return(x[week]);
}

function timer0OnTimer()
{
  var dt = new Date();
  var d = dt.getDate();
  var y = dt.getYear();
  var m = dt.getMonth() + 1;
  var w = dt.getDay();
  
  if(txtd.caption == d) return; 
  txtd.caption = d;
  txtw.caption = getWeek(lan,w);
  if(vacn)
    txtcn.caption = cnYearSky(y,m,d)+cnYearAnimal(y,m,d) +"年 "+ cnMonth(y,m,d) + cnDay(y,m,d);

  
  Print( d );
    
}

function widgetOnInit()
{
  bg.Src = GetSetting("bg"); 
  lan = GetSetting("lan");
  txtd.caption = ""; 
  
  vacn = GetSetting("cnday");
  
  txtcn.Visible = vacn;
  
  timer0OnTimer();
}

function OnAllSettingsSaved()
{
  widgetOnInit();
}

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("RunDLL32.exe Shell32.dll,Control_RunDLL TimeDate.cpl");
}