
function btSrhOnClick()
{
  if( edtKey.text=="" )
    return;	
  
  var opentp = parseInt( GetSetting("open") );
  if(!opentp)
  { 
    widgetHeight = 290;    
    bgFlyOut.Visible = true;
    //HtmlPanelUrl = "http://www.baidu.com/baidu?tn=cfish828_pg&word=" + edtKey.Text;

    var tp = GetSetting("type");
    Print( tp); 
    if( tp=="web" )
      HtmlPanelUrl = "http://pda.baidu.com/baidu?tn=baidupda&cl=3&ie=gb2312&rn=5&word=" + edtKey.Text
    else if( tp=="dict" )  
      HtmlPanelUrl = "http://pda.baidu.com/s?tn=pda_dict&ct=1048576&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="train_plane" )  
      HtmlPanelUrl = "http://pda.baidu.com/s?tn=pda_train_plane&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="stock" )  
      HtmlPanelUrl = "http://pda.baidu.com/s?tn=pda_stock&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="zd" )
      HtmlPanelUrl = "http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=" + edtKey.Text  
    else if( tp=="news" )
      HtmlPanelUrl = "http://news.baidu.com/ns?cl=2&rn=20&tn=news&t=51&word=" + edtKey.Text  
    else if( tp=="image" )
      HtmlPanelUrl = "http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&pv=&z=0&word=" + edtKey.Text  
    else if( tp=="video" )
      HtmlPanelUrl = "http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=0&word=" + edtKey.Text  
      
      
    ;
        
    HtmlPanelVisible = true;
  }
  else
  {
    var tp = GetSetting("type");
    var url = 'http://www.baidu.com/index.php?tn=cfish828_pg';
    if( tp=="web" )
      url = "http://www.baidu.com/s?tn=cfish828_pg&wd=" + edtKey.Text
    else if( tp=="dict" )  
      url = "http://pda.baidu.com/s?tn=pda_dict&ct=1048576&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="train_plane" )  
      url = "http://pda.baidu.com/s?tn=pda_train_plane&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="stock" )  
      url = "http://pda.baidu.com/s?tn=pda_stock&ie=gb2312&wd=" + edtKey.Text
    else if( tp=="zd" )
      url = "http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=" + edtKey.Text  
    else if( tp=="news" )
      url = "http://news.baidu.com/ns?cl=2&rn=20&tn=news&t=51&word=" + edtKey.Text  
    else if( tp=="image" )
      url = "http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&pv=&z=0&word=" + edtKey.Text  
    else if( tp=="video" )
      url = "http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=0&word=" + edtKey.Text  
    ;
    OpenLink( url );
  
  }
}

function widgetOnDeActive()
{
  HtmlPanelVisible = false;  
  bgFlyOut.Visible = false;
  widgetHeight = 50;  
}

function edtKeyOnKeyDownReturn()
{
  btSrhOnClick();
}

function widgetOnDock()
{
  if(!bgFlyOut.Visible)
    widgetHeight = 50;
}

function widgetOnUnDock()
{
  widgetHeight = 290;  
}