// JavaScript Document
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}
function nTabs1(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}

function nTabs2(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}

function nTabs3(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
  }else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
  }
} 
}





//

var ShowMoreLinks = "" ;
var MoreLinksShowHandles = null ;
function showMoreLinks(elm,classname) {
	clearTimeout(MoreLinksShowHandles) ;
	document.getElementById(elm).style.display = "block" ;
	if (classname) {
		document.getElementById(elm+'Handle').className = classname ;
	}
	if (elm != ShowMoreLinks && ShowMoreLinks != "") {
		document.getElementById(ShowMoreLinks).style.display = "none" ;
		if (classname) {
			document.getElementById(elm+'Handle').className = classname ;
		}
	}
	ShowMoreLinks = elm ;
	
}
function hideMoreLinks(elm,classname) {
	MoreLinksShowHandles = setTimeout( function(){document.getElementById(elm).style.display = "none" ;if (classname){document.getElementById(elm+'Handle').className = classname;}}, 200) ;
}


function showGougouMoreLink() {
	document.getElementById("GougouMoreLink").style.display = "block" ;
}
function hideGougouMoreLink() {
	document.getElementById("GougouMoreLink").style.display = "none" ;
}




//

/*************search************/
var search=new Search();//主页搜索框对象
var compositeSearch=new CompositeSearch();//综合搜索框对象
var adsRecharge=new AdsRecharge();//充值搜索处理对象

//票类话费充值搜索框处理类
function AdsRecharge(){
    var defaultSearchIndex=0;//默认类型
    var searchs=[
        [["0"],"手机"],
        [["1"],"点卡"],
        [["2"],"机票"],
        [["3"],"酒店"]           
    ];
    
    var games= new Array();
        games[0]= new Array();
        games[0][0]="0,腾讯服务充值,http://pay.qq.com/service/index.shtml,10#20#30";
        games[0][1]="1,QQ币直充,http://pay.qq.com/qqvip/index.shtml?aid=pay.qqvip&ADTAG=pay.service.qqvip.self,10";
        games[0][2]="2,QQ会员(10元/月),http://pay.qq.com/qqvip/index.shtml?aid=pay.qqvip&ADTAG=pay.service.qqvip.self,10";
        games[0][3]="3,黄钻贵族(10元/月),http://pay.qq.com/qzone/index.shtml?aid=pay.qzone&ADTAG=pay.service.qzone.self,10";
        games[0][4]="4,红钻贵族(10元/月),http://pay.qq.com/qqshow/index.shtml?aid=pay.qqshow&ADTAG=pay.service.qqshow.self,10";
        games[0][5]="5,绿钻贵族(10元/月),http://pay.qq.com/music/index.shtml?aid=pay.music&ADTAG=pay.service.music.self,10";
        games[0][6]="6,超级QQ(10元/月),http://pay.qq.com/mq/index.shtml?aid=pay.mq&ADTAG=pay.service.mq.self,30";
        games[0][7]="7,CF会员(30元/月),http://pay.qq.com/cf/index.shtml?aid=pay.cf&ADTAG=pay.service.cf.self,10";
        games[0][8]="8,蓝钻贵族(10元/月),http://pay.qq.com/qqgame/index.shtml?aid=pay.qqgame&ADTAG=pay.service.qqgame.self,10";
        games[0][9]="9,炫舞紫钻(20元/月),http://pay.qq.com/x5/index.shtml?aid=pay.x5&ADTAG=pay.service.x5.self,20";
        games[0][10]="10,DNF黑钻(20元/月),http://pay.qq.com/dnf/index.shtml?aid=pay.dnf&ADTAG=pay.service.dnf.self,20";
        games[0][11]="11,粉钻贵族(10元/月),http://pay.qq.com/pet/index.shtml?aid=pay.pet&ADTAG=pay.service.pet.self,10";
        games[0][12]="12,飞车紫钻(10元/月),http://pay.qq.com/speed/index.shtml?aid=pay.speed&ADTAG=pay.service.speed.self,10";
        games[0][13]="13,QQ堂紫钻(10元/月),http://pay.qq.com/qqtang/index.shtml?aid=pay.qqtang&ADTAG=pay.service.qqtang.self,10";
        games[0][14]="14,音速紫钻(10元/月),http://pay.qq.com/r2/index.shtml?aid=pay.r2&ADTAG=pay.service.r2.self,10";
        games[0][15]="15,寻仙VIP(20元/月),http://pay.qq.com/xx/index.shtml?aid=pay.xx&ADTAG=pay.service.xx.self,20";
        games[0][16]="16,读书VIP(10元/月),http://pay.qq.com/book/index.shtml?aid=pay.book&ADTAG=pay.service.book.self,10";
        
        games[1]= new Array();
        games[1][0]="0,腾讯游戏充值,http://pay.qq.com/paycenter/index.shtml,8.8#44#88";
        games[1][1]="1,幻想世界金子(100 金子/1元),http://pay.qq.com/paycenter/index.shtml,8.8#44#88";
        games[1][2]="2,CF点券(100 CF点/1元),http://pay.qq.com/paygame/cf/index.shtml,8.8#17.6#26.4";
        games[1][3]="3,DNF点券(100 DNF点/1元),http://pay.qq.com/paygame/dnf/index.shtml,4.4#8.8#26.4";
        games[1][4]="4,QQ炫舞点券(100 点券/1元),http://pay.qq.com/paygame/x5/index.shtml,5#10#50";        
        games[1][5]="5,QQ飞车点券(100 点券/1元),http://pay.qq.com/paygame/speed/index.shtml,8.8#17.6#26.4";
        games[1][6]="6,寻仙仙玉(100 仙玉/1元),http://pay.qq.com/paygame/xx/index.shtml,4.4#8.8#26.4";
        games[1][7]="7,QQ华夏点券(100 点券/1元),https://qqhxuser.21mmo.com/account/index_2.html";
        games[1][8]="8,大明龙权点券(100 点券/1元),http://pay.qq.com/paygame/dm/index.shtml,8.8#17.6#44";
        games[1][9]="9,烽火战国点券(10 点券/1元),http://pay.qq.com/paygame/zg/index.shtml,4.4#8.8#26.4";
        games[1][10]="10,三国点券(10 点券/1元),http://pay.qq.com/paygame/sg/index.shtml,44#88#264";
        games[1][11]="11,自由幻想彩玉点(100 彩玉点/1元),http://pay.qq.com/paygame/ffo/index.shtml";
        games[1][12]="12,丝路英雄丝路币(10 丝路币/1元),http://sl.qq.com/comm-htdocs/pay/?t=sl";
        games[1][13]="13,绿色征途(100 点券/1元),http://pay.qq.com/paygame/qqzt/index.shtml";
        games[1][14]="14,战地之王AVA点券(100 AVA点/1元),http://pay.qq.com/paygame/ava/index.shtml";

        games[2]= new Array();
        games[2][0]="0,网易游戏,http://ecard.163.com/,5#10#15#30#50";
        games[2][1]="1,大唐无双";
        games[2][2]="2,创世西游";
        games[2][3]="3,战国风云";
        games[2][4]="4,新飞飞";
        games[2][5]="5,天下贰";
        games[2][6]="6,大话西游Ⅱ";
        games[2][7]="7,大话西游3";
        games[2][8]="8,梦幻西游";
        games[2][9]="9,百变金刚";
        games[2][10]="10,易三国";
        games[2][11]="11,大话外传";
        games[2][12]="12,大唐豪侠";
        games[2][13]="13,泡泡游戏";
        games[2][14]="14,富甲西游";
        games[2][15]="15,疯狂石头";
        games[2][16]="16,倩女幽魂";   
        games[2][17]="17,魔兽世界";
        
        games[3]= new Array();
        games[3][0]="0,搜狐畅游,http://account.changyou.com/_login.jsp?msg=%C4%FA%BB%B9%C3%BB%D3%D0%B5%C7%C2%BC%BB%F2%B5%C7%C2%BC%D2%D1%BE%AD%B3%AC%CA%B1%C1%CB%A3%AC%C7%EB%D6%D8%D0%C2%B5%C7%C2%BC&url=http%3A%2F%2Fpay.changyou.com%2F";
        games[3][1]="1,中华英雄";
        games[3][2]="2,天龙八部2";
        games[3][3]="3,大话水浒";
        games[3][4]="4,刀剑英雄2";
        games[3][5]="5,刀剑英雄";
        
        games[4]= new Array();
        games[4][0]="0,巨人网络,http://pay.ztgame.com:81/qfillfrombank.php";
        games[4][1]="1,万王之王3";
        games[4][2]="2,征途";
        games[4][3]="3,巨人";
        games[4][4]="4,征途时间版";
        
        games[5]= new Array();
        games[5][0]="0,完美时空,http://pay.wanmei.com/e/";
        games[5][1]="1,完美世界";
        games[5][2]="2,新武林外传";
        games[5][3]="3,完美国际";
        games[5][4]="4,诛仙2";
        games[5][5]="5,赤壁";
        games[5][6]="6,热舞派对Ⅱ";
        games[5][7]="7,口袋西游";
        games[5][8]="8,神鬼传奇";
        games[5][9]="9,梦幻诛仙";
        games[5][10]="10,降龙之剑";
        games[5][11]="11,神魔大陆";
        games[5][12]="12,笑傲江湖";
        
        games[6]= new Array();
        games[6][0]="0,盛大网络,http://pay.sdo.com/Index.aspx?type=paymentorder&sel_game=0&D=1";
        games[6][1]="1,热血传奇";
        games[6][2]="2,永恒之塔";
        games[6][3]="3,互动娱乐卡";
        games[6][4]="4,传奇世界";
        games[6][5]="5,超级跑跑";
        
        games[7]= new Array();
        games[7][0]="0,蜗牛游戏,http://imprest.woniu.com/imprest/imprest_main.html";
        games[7][1]="1,舞街区";
        games[7][2]="2,机甲世纪";
        games[7][3]="3,天子直充";
        games[7][4]="4,航海世纪";
        
        games[8]= new Array();
        games[8][0]="0,光宇华夏,http://pay.gyyx.cn/index.html";
        games[8][1]="1,希望直充";
        games[8][2]="2,问道直充";
        games[8][3]="3,西游Q记";
        games[8][4]="4,幻想之翼";
        games[8][5]="5,神界直充";
        
        games[9]= new Array();
        games[9][0]="0,第九城市,https://passport.the9.com/payment/payment/method.html";
        games[9][1]="1,名将三国";
        games[9][2]="2,王者世界";
        games[9][3]="3,FIFA OL 2";
        games[9][4]="4,新奇迹世界";
        games[9][5]="5,卓越之剑";
        
        games[10]= new Array();
        games[10][0]="0,久游网,http://pay.9you.com/funpay/";
        games[10][1]="1,仙剑OL直充";
        games[10][2]="2,劲舞团直充";
        games[10][3]="3,光线飞车";
        games[10][4]="4,风火之旅";
        games[10][5]="5,超级舞者";
        
        games[11]= new Array();
        games[11][0]="0,猫扑游戏,http://pay.mop.com/";
        games[11][1]="1,人人网";
        games[11][2]="2,雄霸三国";
        games[11][3]="3,猫游记";
        games[11][4]="4,天书奇谈";
        games[11][5]="5,开心网";
        
        games[12]= new Array();
        games[12][0]="0,金山游戏,http://pay.kingsoft.com/";
        games[12][1]="1,剑侠直充";
        games[12][2]="2,剑网 3";
        games[12][3]="3,仙侣2直充";
        games[12][4]="4,封神榜";
        games[12][5]="5,春秋Q传";
        
        games[13]= new Array();
        games[13][0]="0,网页游戏";
        games[13][1]="1,4399游戏,http://www.jcard.cn/Official/Web4399/Web4399Charge.aspx?category=AAGZYJSSJJ";
        games[13][2]="2,多玩游戏,http://www.jcard.cn/Charge/UCardDirectCharge.aspx?category=AAHDWLDWYX";
        games[13][3]="3,西游天下,http://www.jcard.cn/Charge/UCardDirectCharge.aspx?category=AAHXSDXYTX";
        games[13][4]="4,乐港热血三国,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=热血三国/魔晶&mode=and";
        games[13][5]="5,91wan游戏,http://www.jcard.cn/Official/WebGameCharge/WebGameCharge.aspx?category=AAGZWDJYWV";
        
        games[14]= new Array();
        games[14][0]="0,其他游戏";
        games[14][1]="1,成吉思汗,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=成吉思汗&mode=and";
        games[14][2]="2,蜀门,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=蜀门&mode=and";
        games[14][3]="3,十二封印,http://www.jcard.cn/Charge/UCardDirectCharge.aspx?category=AAHXFXSEFY";
        games[14][4]="4,仙魔OL,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=仙魔OL&mode=and";
        games[14][5]="5,梦工厂,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=梦工厂&mode=and";
        games[14][6]="6,网龙游戏,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=网龙游戏&mode=and";
        games[14][7]="7,中青宝网,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=中青宝网&mode=and";
        games[14][8]="8,世纪天成,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=世纪天成&mode=and";
        games[14][9]="9,光宇华夏,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=光宇华夏&mode=and";
        games[14][10]="10,西游天下,http://www.jcard.cn/Charge/UCardDirectCharge.aspx?category=AAHXSDXYTX";
        games[14][11]="11,渡口游戏,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=渡口游戏&mode=and";
        games[14][12]="12,蓝港一卡通,http://www.jcard.cn/Product/ProductList.aspx?con=key&value=蓝港一卡通&mode=and";
    
    //获取查询类型代码
    this.GetSearchTypeHtml = function(searchIndex)
    {
        defaultSearchIndex=searchIndex;
        var html="";
        html+="<ul>";
        for(var i=0;i<searchs.length;i++)
        {
            if (parseInt(searchs[i][0])==parseInt(defaultSearchIndex))
            {
                html+="<li class=\"active\" id=\"ads_recharge_search_li_"+i+"\" onclick=\"javascript:adsRecharge.SwitchSearchType("+searchs[i][0]+");\" >"+searchs[i][1]+"</li>"; 
            }
            else
            {
                html+="<li id=\"ads_recharge_search_li_"+i+"\" onclick=\"javascript:adsRecharge.SwitchSearchType("+searchs[i][0]+");\">"+searchs[i][1]+"</li>"; 
            }                      
        }
        html+="</ul>";        
        return html;
    }
    
    //获取游戏类型代码
    this.GetGameTypeHtml = function(one,two)
    {             
        var html="";        
        html+="<select name=\"ads_recharge_game_type\" class=\"foption\" onchange=\"javascript:adsRecharge.SwitchGameType(this);\">";
        for(var i=0;i<games.length;i++)
        { 
            for(var y=0;y<games[i].length;y++)
            {                 
                var join = games[i][y];
                var datas = join.split(",");
                var name = datas[1];                
                if (i==parseInt(one) && y==parseInt(two))
                {
                    html+="<option selected=\"selected\" value=\""+i+","+y+"\">"+name+"</option>"; 
                }
                else
                {
                    if(y==0)
                    {
                        html+="<option style=\"color: #36c;\" value=\""+i+","+y+"\">"+name+"</option>";
                    }
                    else
                    {
                        html+="<option value=\""+i+","+y+"\">"+name+"</option>"; 
                    }                    
                }   
            }                               
        }
        html+="</select>";   
        
        html+="&nbsp;&nbsp;";
        
        var amount_type_strs="10#5#20#30#50#100";
        try
        {
            var join = games[one][two];
            var datas = join.split(",");
            var amount_type = datas[3];//获取该类型充值金额类型
            if(amount_type!=undefined && amount_type!="")//如果存在，则读取金额
            {
                amount_type_strs=amount_type;
            }            
        }
        catch(e){}
        
        var amount_type_datas = amount_type_strs.split("#");
        html+="<select name=\"ads_recharge_game_amount_type\">";
        for(var y=0;y<amount_type_datas.length;y++)
        {                       
            if (y==parseInt(two))
            { 
                html+="<option selected=\"selected\" value=\""+amount_type_datas[y]+"\">"+amount_type_datas[y]+"元</option>"; 
            }
            else
            {
                html+="<option value=\""+amount_type_datas[y]+"\">"+amount_type_datas[y]+"元</option>"; 
            }  
        }        
        html+="</select>";
        return html;
    }
        
    //选择购买游戏点卡类型
    this.SwitchGameType = function(obj){ 
        var join = obj.value;
        var datas = join.split(",");
        var one = datas[0];
        var two = datas[1];        
        var html=adsRecharge.GetGameTypeHtml(one,two);   
        document.getElementById("ads_recharge_body").innerHTML=html;
    } 
    
    //查询类型选择切换
    this.SwitchSearchType = function(searchIndex){  
        defaultSearchIndex=searchIndex;
        for(var i=0;i<searchs.length;i++)
        {
            document.getElementById("ads_recharge_search_li_"+i).className="";
        }
        document.getElementById("ads_recharge_search_li_"+defaultSearchIndex).className="active";
        
        for(var i=0;i<searchs.length;i++)
        {           
            document.getElementById("ads_recharge_search_body_"+(i+1)).style.display="none";
        }
        document.getElementById("ads_recharge_search_body_"+(defaultSearchIndex+1)).style.display="block";
    }
    
    
    //执行查询
    this.SubmitSearch = function(obj,searchIndex){  
        //新建一个form
        var form=document.createElement("form");   
        var formHtml="";
        form.target="_blank";
        form.method="Get";        
        switch(parseInt(searchIndex))
        {
            case 0://手机
                var parvalue=obj.ads_recharge_search_parvalue.value;
                var mobile=obj.ads_recharge_search_mobile.value;
                if (mobile.length<11 && mobile.substring(0,1)!="1")//判断是否为手机号码
                {
                    alert("请输入正确的手机号码");
                    obj.ads_recharge_search_mobile.focus();
                    return false;
                }
                form.action="http://pay.qq.com/qqvip/index.shtml?aid=pay.qqvip&ADTAG=pay.service.qqvip.self&by=dianxin.cn"; 
                form.method="POST";
                formHtml+=("<input type=\"hidden\" name=\"mobile\" id=\"mobileNo\" value=\""+mobile+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"parvalue\" id=\"parValue\" value=\""+parvalue+"\"/>");
                break;
            case 1://点卡
                var ads_recharge_game_type=obj.ads_recharge_game_type.value;
                var ads_recharge_game_amount_type=obj.ads_recharge_game_amount_type.value;
                var join = ads_recharge_game_type;
                var datas = join.split(",");
                var one = datas[0];
                var two = datas[1];  
                var ads_recharge_game_url="";//提交URL
                join = games[one][two];
                datas = join.split(",");
                var ads_recharge_game_submit_url=datas[2];
                if (ads_recharge_game_submit_url==undefined || ads_recharge_game_submit_url=="")//如果不存在，则读取游戏类型根节点提交URL
                {
                    join = games[one][0];
                    datas = join.split(",");
                    ads_recharge_game_submit_url=datas[2];
                }
                form.action=ads_recharge_game_submit_url;  
                //判断URL 如果存在参数 则换成<input>
                var url2 = ads_recharge_game_submit_url.split('?');
                if(url2[1])
                {
                	var url3 = url2[1].split('&');
                	var url3L = url3.length;
                	var urlArr = new Array();
                	for(var i = 0;i < url3L;i++)
                	{
                		urlArr = url3[i].split('=');
                		formHtml+=("<input type=\"hidden\" name=\""+urlArr[0]+"\" value=\""+urlArr[1]+"\"/>");
                	}
                }
                //End
                formHtml+=("<input type=\"hidden\" name=\"by\" id=\"by\" value=\"dianxin.cn\"/>");                                                                
                break;
            case 2://机票                
                var ads_recharge_search_form_city=obj.ads_recharge_search_form_city.value;                
                var ads_recharge_search_to_city=obj.ads_recharge_search_to_city.value;                
                var ads_recharge_search_date=obj.ads_recharge_search_date.value;              
                form.action="http://wbd.qunar.com/twell/gb2utf22.jsp"; 
                formHtml+=("<input type=\"hidden\" name=\"searchDepartureAirport\" value=\""+ads_recharge_search_form_city+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"searchArrivalAirport\" id=\"searchArrivalAirport\" value=\""+ads_recharge_search_to_city+"\"/>"); 
                formHtml+=("<input type=\"hidden\" name=\"searchDepartureTime\" id=\"searchDepartureTime\" value=\""+ads_recharge_search_date+"\"/>");
formHtml+='<input type="hidden" name="ty" value="flight"><input type="hidden" name="startSearch" value="true"><input type="hidden" name="nextNDays" value="0"><input type="hidden" name="searchType" value="OneWayFlight"><input type="hidden" name="ex_track" value="ap_1291117f410">';              
                break;
            case 3://酒店
                var ads_recharge_search_city=obj.ads_recharge_search_city.value;
                var ads_recharge_search_price=obj.ads_recharge_search_price.value;
                var ads_recharge_search_name_contains=obj.ads_recharge_search_name_contains.value;
		//document.charset = "utf-8";
                form.action="http://wbd.qunar.com/twell/gb2utf22.jsp"; 
                formHtml+=("<input type=\"hidden\" name=\"searchCity\" id=\"q\" value=\""+ads_recharge_search_city+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"MaxPrice\" id=\"l1price\" value=\""+ads_recharge_search_price+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"HotelName\" id=\"nameContains\" value=\""+ads_recharge_search_name_contains+"\"/>");
		formHtml+=("<input type=\"hidden\" name=\"MinPrice\" value=0/>");
		formHtml +='<input type="hidden" value="hotel" name="ty"><input type="hidden" value="gb2312" name="ie"><input type="hidden" value="ap_1291117f410" name="ex_track">';
break;
        }     
        form.innerHTML=formHtml;
        document.body.appendChild(form);        
        form.submit();
        document.body.removeChild(form);
	//将编码改成GBK 以免调取新的新闻发生乱码
	//document.charset = "gbk";
        return false;        
    }
}

//综合搜索框处理类
function CompositeSearch(){
    var defaultSearchIndex=1;//默认搜索引擎类型
    var searchs=[
        [["0"],"综合"],
        [["1"],"百度"],
        [["2"],"谷歌"],
        [["3"],"搜狗"],
        [["4"],"必应"],
        [["5"],"有道"],
        [["6"],"搜搜"],
        [["7"],"淘宝"],
        [["8"],"购书"],
        [["9"],"手机"],
        [["10"],"词条"],
        [["11"],"翻译"],
        [["12"],"地图"],
        [["13"],"软件"]               
    ];
    
    //获取搜索引擎类型代码
    this.GetSearchTypeHtml = function(searchIndex)
    {
        defaultSearchIndex=searchIndex;
        var html="";
        html+="<ul>";
        for(var i=0;i<searchs.length;i++)
        {
            if (parseInt(searchs[i][0])==parseInt(defaultSearchIndex))
            {
                html+="<li><input style=\"cursor:hand;\" checked=\"checked\" type=\"radio\" id=\"composite_search_"+searchs[i][0]+"\" name=\"composite_search\" onclick=\"javascript:compositeSearch.SwitchSearchType("+searchs[i][0]+");\" value=\""+searchs[i][0]+"\" /><label style=\"cursor:hand;\" onclick=\"javascript:compositeSearch.SwitchSearchType("+searchs[i][0]+");\">"+searchs[i][1]+"</label></li>"; 
            }
            else
            {
                html+="<li><input style=\"cursor:hand;\" type=\"radio\" id=\"composite_search_"+searchs[i][0]+"\" name=\"composite_search\" onclick=\"javascript:compositeSearch.SwitchSearchType("+searchs[i][0]+");\"  value=\""+searchs[i][0]+"\" /><label style=\"cursor:hand;\" onclick=\"javascript:compositeSearch.SwitchSearchType("+searchs[i][0]+");\">"+searchs[i][1]+"</label></li>"; 
            }                      
        }
        html+="</ul>";        
        return html;
    }        
    
    //搜索引擎类型切换
    this.SwitchSearchType = function(searchIndex) {
        defaultSearchIndex=searchIndex;
        document.getElementById("composite_search_"+defaultSearchIndex).checked=true;
    }
    
    //执行搜索
    this.SubmitSearch = function(){  
        var tag=(document.getElementById("fkeyword").value);
        if (tag=="")
        {
            document.getElementById("fkeyword").focus(); //文本框得到焦点
            return false;
        }
        //获取当前选中焦点值
        var objs = document.getElementsByName("composite_search");
        for(var i=0;i<objs.length;i++)
        {
            if (objs[i].checked)
            {
                defaultSearchIndex=objs[i].value;
            }
        }
        
        //新建一个form
        var form=document.createElement("form");   
        var formHtml="";
        form.target="_self";
        form.method="Get";
        //如果是中文,则修改编码
        if (document.all)//IE内核才修改编码
        {
            if(/[\u4E00-\u9FA5]/gi.test(tag)){
                form.setAttribute("accept-charset","gb2312");
                document.charset="gb2312";//修改编码
            }
            else
            {
                form.setAttribute("accept-charset","utf-8");
                document.charset="utf-8";//修改编码
            }
        }
        switch(parseInt(defaultSearchIndex))
        {
            case 0://综合
                form.action="http://s.dianxin.cn/b.php"; 
                formHtml+=("<input type=\"hidden\" name=\"wd\" id=\"wd\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
                formHtml+=("<input type=\"hidden\" name=\"ch\" id=\"ch\" value=\"5\"/>");                                                                            
                break;
            case 1://百度
                form.action="http://www.baidu.com/s"; 
                formHtml+=("<input type=\"hidden\" name=\"wd\" id=\"wd\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
                formHtml+=("<input type=\"hidden\" name=\"ch\" id=\"ch\" value=\"5\"/>");                        
                break;
            case 2://谷歌
                form.action="http://www.google.com.hk/search";
                formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"hl\" id=\"hl\" value=\"zh-CN\"/>");
                formHtml+=("<input type=\"hidden\" name=\"client\" id=\"client\" value=\"pub-3603912006983167\"/>");
                formHtml+=("<input type=\"hidden\" name=\"channel\" id=\"channel\" value=\"5542044375\"/>");
                formHtml+=("<input type=\"hidden\" name=\"forid\" id=\"forid\" value=\"1\"/>");
                formHtml+=("<input type=\"hidden\" name=\"prog\" id=\"prog\" value=\"aff\"/>");
                formHtml+=("<input type=\"hidden\" name=\"source\" id=\"source\" value=\"sdo_cts_html\"/>"); 
                break;
            case 3://搜狗
                form.action="http://www.sogou.com/sogou";
                formHtml+=("<input type=\"hidden\" name=\"query\" id=\"query\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"pid\" value=\"sogou-site-3e7e0224018ab3cf\"/>");
                break;
            case 4://必应
                form.action="http://cn.bing.com/search";
                formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                form.setAttribute("accept-charset","utf-8");
                document.charset="utf-8";//修改编码
                break;
            case 5://有道
                form.action="http://www.youdao.com/search";
                formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"ue\" id=\"ue\" value=\"utf8\"/>");
                formHtml+=("<input type=\"hidden\" name=\"keyfrom\" id=\"keyfrom\" value=\"dh.dxcn_0003\"/>");
formHtml+=("<input type=\"hidden\" name=\"vendor\" id=\"vendor\" value=\"dh.dxcn_0003\"/>");
                form.setAttribute("accept-charset","utf-8");
                document.charset="utf-8";//修改编码
                break;
            case 6://搜搜
                form.action="http://www.soso.com/q";
                formHtml+=("<input type=\"hidden\" name=\"w\" id=\"w\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"pid\" value=\"s.idx\"/>");
                formHtml+=("<input type=\"hidden\" name=\"ch\" id=\"ch\" value=\"s.idx\"/>");
                break;
            case 7://淘宝
			//http://s8.taobao.com/search?commend=all&q=%C5%AE%C8%CB&pid=mm_13480004_1904664_8911664
                form.action="http://s8.taobao.com/search?";
                formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"commend\" id=\"commend\" value=\"all\"/>");
                formHtml+=("<input type=\"hidden\" name=\"search_type\" id=\"search_type\" value=\"item\"/>");
                formHtml+=("<input type=\"hidden\" name=\"atype\" id=\"atype\" value=\"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"filterFineness\" id=\"filterFineness\" value=\"\"/>");
                break;
            case 8://购书
                form.action="http://search.dangdang.com/search.aspx"; 
                formHtml+=("<input type=\"hidden\" name=\"key\" id=\"key\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"selectcatalog\" id=\"selectcatalog\" value=\"\"/>");                    
                break;
            case 9://手机
                form.action="http://www.ip138.com:8080/search.asp"; 
                formHtml+=("<input type=\"hidden\" name=\"mobile\" id=\"mobile\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"action\" id=\"action\" value=\"mobile\"/>");                    
                break;
            case 10://词条
                form.action="http://baike.baidu.com/searchword/"; 
                formHtml+=("<input type=\"hidden\" name=\"word\" id=\"word\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"ct\" id=\"ct\" value=\"1\"/>");
                formHtml+=("<input type=\"hidden\" name=\"lm\" id=\"lm\" value=\"0\"/>");
                formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"baiduWikiSearch\"/>");
                formHtml+=("<input type=\"hidden\" name=\"rn\" id=\"rn\" value=\"10\"/>");
                break;
            case 11://翻译
                form.action="http://www.iciba.com/search"; 
                formHtml+=("<input type=\"hidden\" name=\"s\" id=\"s\" value=\""+tag+"\"/>");              
                break;
            case 12://地图
                form.action="http://ditu.google.cn/?";
                formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");                   
                break;
            case 13://软件
                form.action="http://soft.gougou.com/search"; 
                formHtml+=("<input type=\"hidden\" name=\"search\" id=\"search\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"restype\" id=\"restype\" value=\"2\"/>");     
                formHtml+=("<input type=\"hidden\" name=\"id\" id=\"id\" value=\"1\"/>");                
                break;
        }        
        form.innerHTML=formHtml;
        document.body.appendChild(form);        
        form.submit();
        document.body.removeChild(form);
        return false;        
    }
    
    
    
}

//主搜索框处理类
function Search(){
    var defaultSearchResultsIndex=0;//默认搜索引擎结果类型
    var defaultSearchIndex=1;//默认搜索引擎类型
    
    var searchs= new Array();
    searchs[0]= new Array();
    searchs[0][0]="0,网 页";
    searchs[0][1]="1,百度,http://www.dianxin.cn/public/images/web_baidu.gif,http://www.baidu.com";
    searchs[0][2]="2,谷歌,http://www.dianxin.cn/public/images/web_google.gif,http://www.google.com.hk/cse?cx=partner-pub-3657184634473875%3Ajk3wgb47azs&ie=UTF-8&q=";
    searchs[0][3]="3,有道,http://www.dianxin.cn/public/images/web_youdao.gif,http://www.youdao.com/search?";
    //searchs[0][4]="4,综合,/public/images/Web_zonghe.gif,http://s.dianxin.cn/";
    searchs[0][4]="4,搜狗,http://www.dianxin.cn/public/images/web_sogou.gif,http://www.sogou.com/index.htm?pid=sogou-site-3e7e0224018ab3cf";
    searchs[0][5]="5,淘宝,http://www.dianxin.cn/public/images/Web_taobao.gif,http://www.taobao.com/go/act/mmbd/pd01.php?pid=mm_13480004_1904664_8911664";


    
    searchs[1]= new Array();
    searchs[1][0]="0,M P 3";
    searchs[1][1]="1,百度,http://www.dianxin.cn/public/images/web_baidu_mp3.gif,http://www.baidu.com";
    searchs[1][2]="2,虾米,http://www.dianxin.cn/public/images/web_xiami.gif,http://www.xiami.com/";
    searchs[1][3]="3,搜狗,http://www.dianxin.cn/public/images/web_sogou.gif,http://mp3.sogou.com/?p=40030200&kw=";
    
    searchs[2]= new Array();
    searchs[2][0]="0,影 视";
    searchs[2][1]="1,迅雷,/public/images/web_gougou.gif,http://www.xunlei.com";
    searchs[2][2]="2,优酷,/public/images/web_youku.gif,http://www.youku.com";

    searchs[3]= new Array();
    searchs[3][0]="0,视 频";
    searchs[3][1]="1,土豆,/public/images/web_tudou.gif,http://www.tudou.com";
    searchs[3][2]="2,谷歌,/public/images/web_google.gif,http://www.google.com.hk/videohp?hl=zh-CN&tab=wv";
    searchs[3][3]="3,百度,/public/images/web_baidu_video.gif,http://video.baidu.com/";
    
    searchs[4]= new Array();
    searchs[4][0]="0,图 片";
    searchs[4][1]="1,百度,/public/images/web_baidu_img.gif,http://image.baidu.com/";
    searchs[4][2]="2,谷歌,http://www.dianxin.cn/public/images/web_google.gif,http://images.google.com.hk/imgcat/imghp?hl=zh-CN";
    
    searchs[5]= new Array();
    searchs[5][0]="0,贴 吧";
    searchs[5][1]="1,贴吧,/public/images/web_baidu_t.gif,http://tieba.baidu.com/";
    searchs[5][2]="2,问问,/public/images/web_soso.gif,http://wenwen.soso.com/";
    
    searchs[6]= new Array();
    searchs[6][0]="0,更 多";
    searchs[6][1]="1,知道,/public/images/web_baidu_zhidao.gif,http://zhidao.baidu.com/";
    searchs[6][2]="2,地图,/public/images/web_google.gif,http://ditu.google.cn/maps?hl=zh-CN&tab=wl";
    searchs[6][3]="3,购物,/public/images/web_taobao.gif,http://www.taobao.com";
    searchs[6][3]="4,软件,/public/images/web_gougou.gif,http://soft.gougou.com/";
    
    //获取搜索引擎结果切换代码
    this.GetSearchResultsTypeHtml = function(searchResultsIndex) {
        var html="";
        defaultSearchResultsIndex=searchResultsIndex;
        for (var i = 0; i < searchs.length; i++) {
            var join = searchs[i][0];
            var datas = join.split(",");
            var id = parseInt(datas[0]);
            var name = datas[1];
            if (defaultSearchResultsIndex==i){
                html+="<li class=\"active\" name=\"search_results_li\" id=\"search_results_li_"+ i +"\" onclick=\"javascript:search.SwitchSearchResultsType("+i+","+defaultSearchIndex+");\">"+name+"</li>";
            }
            else
            {
                html+="<li name=\"search_results_li\" id=\"search_results_li_"+ i +"\" onclick=\"javascript:search.SwitchSearchResultsType("+i+","+defaultSearchIndex+");\">"+name+"</li>";
            }   
        }
        return html;
    }
    
    //获取搜索引擎切换代码
    this.GetSearchTypeHtml = function(searchIndex) {
        var html="";
        defaultSearchIndex=searchIndex;
	//search.SwitchSearchType(0,searchIndex);
        var mySearch = searchs[defaultSearchResultsIndex];
        if (mySearch==null) return html;
        for (var i = 1; i < mySearch.length; i++) {
            var join = mySearch[i];
            var datas = join.split(",");
            var id = parseInt(datas[0]);
            var name = datas[1];            
            if (defaultSearchIndex==i){
                html+="<input type=\"radio\" style=\"cursor:hand;\" name=\"checked\" checked=\"checked\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\" /><label style=\"cursor:hand;\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\">"+name+"</label>";
            }
            else
            {
                html+="<input type=\"radio\" style=\"cursor:hand;\" name=\"checked\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\" /><label style=\"cursor:hand;\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\">"+name+"</label>";
            } 
        }        
        return html;
    }
    
    //搜索引擎结果类型切换
    this.SwitchSearchResultsType = function(searchResultsIndex, searchIndex) {
        defaultSearchResultsIndex=searchResultsIndex;
        defaultSearchIndex=searchIndex;
        for (var i = 0; i < searchs.length; i++) {//清除选中样式
            document.getElementById("search_results_li_"+i).className="";
        }
        document.getElementById("search_results_li_"+searchResultsIndex).className="active";
        search.SwitchSearchType(defaultSearchResultsIndex,defaultSearchIndex); //切换搜索引擎类型
    }
    
    //搜索引擎类型切换
    this.SwitchSearchType = function(searchResultsIndex,searchIndex) {
        var html="";
        defaultSearchResultsIndex=searchResultsIndex;
        defaultSearchIndex=searchIndex;
        var mySearch = searchs[defaultSearchResultsIndex];
        if (mySearch==null) return html;
        for (var i = 1; i < mySearch.length; i++) {
//alert(mySearch[i]);
            var join = mySearch[i];
            var datas = join.split(",");
            var id = parseInt(datas[0]);
            var name = datas[1];         
            if (defaultSearchIndex==i){
                html+="<input type=\"radio\" name=\"checked\" checked=\"checked\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\" /><label style=\"cursor:hand;\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\">"+name+"</label>";
            }
            else
            {
                html+="<input type=\"radio\" name=\"checked\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\" /><label style=\"cursor:hand;\" onclick=\"javascript:search.SwitchSearchType("+defaultSearchResultsIndex+","+i+");\">"+name+"</label>";
            } 
        }
        var imgSearch = searchs[defaultSearchResultsIndex][searchIndex];        
        if (imgSearch!=null && imgSearch!=undefined && typeof imgSearch!="undefined")
        {
            try
            {
                var join = imgSearch;
                var datas = join.split(",");                
                var src=datas[2];
                var href=datas[3];
                document.getElementById("search_img").src=src;            
                document.getElementById("search_img_href").href=href;
            }
            catch(e){}
        } 

        document.getElementById("search-input").innerHTML=html;
    }
    
    //执行搜索
    //执行搜索
    this.SubmitSearch = function(){  
        var tag=(document.getElementById("keyword").value);
        if (tag=="")
        {
            document.getElementById("keyword").focus(); //文本框得到焦点
            return false;
        }
        
        
        var form=document.createElement("form");
        var formHtml="";
        form.target="_blank";
        form.method="Get";
		var searchType;
        if (defaultSearchResultsIndex==0)//网页
        {    
            switch(defaultSearchIndex)
            {
                case 1://百度
                    form.action="http://www.baidu.com/s"; 
                    formHtml+=("<input type=\"hidden\" name=\"wd\" id=\"wd\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"dianxinhy_pg\"/>");                         
searchType = 0;                                                  
                break;
                case 2://谷歌
                    form.action="http://www.google.com.hk/search";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"hl\" id=\"hl\" value=\"zh-CN\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"client\" id=\"client\" value=\"pub-3603912006983167\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"channel\" id=\"channel\" value=\"5542044375\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"forid\" id=\"forid\" value=\"1\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"prog\" id=\"prog\" value=\"aff\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"source\" id=\"source\" value=\"sdo_cts_html\"/>");   
searchType = 1;                     
                break;
                case 3://搜狗
                    form.action="http://www.youdao.com/search?ue=gbk&keyfrom=dh.dxcn_01&vendor=dh.dxcn_01&q=";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
		    formHtml+=("<input type=\"hidden\" name=\"ue\" value=\"gbk\"/><input type=\"hidden\" name=\"keyfrom\" value=\"dh.dxcn_0009\"/><input type=\"hidden\" name=\"vendor\" value=\"dh.dxcn_0009\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"pid\" value=\"AQ0JZ\"/>");
searchType = 2;
                break;
/**
                case 4:
                	form.action = 'http://s.dianxin.cn/b.php';
                	formHtml+=("<input type=\"hidden\" name=\"wd\" id=\"wd\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"by\" id=\"by\" value=\"dianxin.cn\"/>");
searchType = 3;
                break;**/
		case 4:
                	form.action = 'http://www.sogou.com/sogou';
                	formHtml+=("<input type=\"hidden\" name=\"query\" id=\"wd\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"by\" value=\"sogou-site-3e7e0224018ab3cf\"/>");
searchType = 21;
                break;
case 5:
//http://s8.taobao.com/search?commend=all&q=%C5%AE%C8%CB&pid=mm_13480004_1904664_8911664
                	form.action = 'http://s8.taobao.com/search';
                	formHtml+=("<input type=\"hidden\" name=\"q\" id=\"wd\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"by\" value=\"mm_13480004_1904664_8911664\"/><input type=\"hidden\" name=\"commend\" id=\"by\" value=\"all\"/>");
searchType = -1;
                break;
            }
        }
        
        if (defaultSearchResultsIndex==1)//Mp3
        {
            switch(defaultSearchIndex)
            {
                case 1://百度
                    form.action="http://mp3.baidu.com/m";
                    formHtml+=("<input type=\"hidden\" name=\"f\" id=\"f\" value=\"ms\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"rn\" id=\"rn\" value=\"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ct\" id=\"ct\" value=\"134217728\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"word\" id=\"word\" value=\""+tag+"\"/>");
searchType = 4;
                break;
                case 2://谷歌
                    form.action="http://www.google.cn/music/search";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
searchType = 5;
                break;
                case 3://虾米
                    form.action="http://www.xiami.com/search";   
                    formHtml+=("<input type=\"hidden\" name=\"key\" id=\"key\" value=\""+tag+"\"/>");
searchType = 6;
                break;
                case 4://搜狗
                    form.action="http://mp3.sogou.com/music.so";
                    formHtml+=("<input type=\"hidden\" name=\"query\" id=\"query\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"pid\" id=\"pid\" value=\"AQ0JZ\"/>");
searchType = 7;
                break;
            }
        }
        if (defaultSearchResultsIndex==2)//影视
        {
            switch(defaultSearchIndex)
            {
                case 1://迅雷
                    form.action="http://search.xunlei.com/search.php";
                    formHtml+=("<input type=\"hidden\" name=\"keyword\" id=\"keyword\" value=\""+tag+"\"/>");
searchType = 8;
                break;
                case 2://优酷
                    form.action="http://www.soku.com/v";
                    formHtml+=("<input type=\"hidden\" name=\"keyword\" id=\"keyword\" value=\""+tag+"\"/>");
searchType = 9;
                break;
            }
        }
        if (defaultSearchResultsIndex==3)//视频
        {
            switch(defaultSearchIndex)
            {
                case 1://土豆
                    form.action="http://so.tudou.com/isearch.do";
                    formHtml+=("<input type=\"hidden\" name=\"kw\" id=\"kw\" value=\""+tag+"\"/>");
searchType = 10;
                break;
                case 2://谷歌
                    form.action="http://www.google.com.hk/search";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ie\" id=\"ie\" value=\"utf-8\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tbo\" id=\"tbo\" value=\"u\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tbs\" id=\"tbs\" value=\"vid:1\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"source\" id=\"source\" value=\"og\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"sa\" id=\"sa\" value=\"N\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"hl\" id=\"hl\" value=\"zh-CN\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tab\" id=\"tab\" value=\"wv\"/>");
searchType = 11;                
break;
                case 3://百度
                    form.action="http://video.baidu.com/v";
                    formHtml+=("<input type=\"hidden\" name=\"word\" id=\"word\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ct\" id=\"ct\" value=\"301989888\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"rn\" id=\"rn\" value=\"20\"/>");
searchType = 12;               
 break;
            }
        }
        if (defaultSearchResultsIndex==4)//图片
        {
            switch(defaultSearchIndex)
            {
                case 1://百度
                    form.action="http://image.baidu.com/i";
                    formHtml+=("<input type=\"hidden\" name=\"word\" id=\"word\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ie\" id=\"ie\" value=\"utf-8\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ct\" id=\"ct\" value=\"201326592\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"lm\" id=\"lm\" value=\"-1\"/>");
searchType = 13;                
break;
                case 2://谷歌
                    form.action="http://www.google.com.hk/images";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");           
searchType = 14;         
                break;
            }
        }
        if (defaultSearchResultsIndex==5)//贴吧
        {
            switch(defaultSearchIndex)
            {
                case 1://百度
                    form.action="http://tieba.baidu.com/f";
                    formHtml+=("<input type=\"hidden\" name=\"kw\" id=\"kw\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"77zb_pg\"/>");
searchType = 15;
                break;
                case 2://问问
                    form.action="http://wenwen.soso.com/z/Search.e";
                    formHtml+=("<input type=\"hidden\" name=\"sp\" id=\"sp\" value=\""+tag+"\"/>");
searchType = 16;
                break;
            }
        }
        if (defaultSearchResultsIndex==6)//更多
        {
            switch(defaultSearchIndex)
            {
                case 1://知道
                    form.action="http://zhidao.baidu.com/q";
                    formHtml+=("<input type=\"hidden\" name=\"word\" id=\"word\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"ct\" id=\"ct\" value=\"17\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"pn\" id=\"pn\" value=\"0\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"tn\" id=\"tn\" value=\"ikaslist\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"rn\" id=\"rn\" value=\"10\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"lm\" id=\"lm\" value=\"0\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"fr\" id=\"fr\" value=\"search\"/>");
searchType = 17;
                break;
                case 2://地图
                    form.action="http://ditu.google.cn/?";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
searchType = 18;
                break;
                case 3://购物
                    form.action="http://search.taobao.com/search?";
                    formHtml+=("<input type=\"hidden\" name=\"q\" id=\"q\" value=\""+tag+"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"commend\" id=\"commend\" value=\"all\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"search_type\" id=\"search_type\" value=\"item\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"atype\" id=\"atype\" value=\"\"/>");
                    formHtml+=("<input type=\"hidden\" name=\"filterFineness\" id=\"filterFineness\" value=\"\"/>");
searchType = 19;   
             break;
                case 4://软件
                form.action="http://soft.gougou.com/search"; 
                formHtml+=("<input type=\"hidden\" name=\"search\" id=\"search\" value=\""+tag+"\"/>");
                formHtml+=("<input type=\"hidden\" name=\"restype\" id=\"restype\" value=\"2\"/>");     
                formHtml+=("<input type=\"hidden\" name=\"id\" id=\"id\" value=\"1\"/>");           
searchType = 20;     
                break;
            }
        }
        
        //如果是中文,则修改编码
        if (document.all)//IE内核才修改编码
        {
            if(/[\u4E00-\u9FA5]/gi.test(tag)){
                if ((defaultSearchResultsIndex==1 && (defaultSearchIndex==2 || defaultSearchIndex==3)) || (defaultSearchResultsIndex==2 && (defaultSearchIndex==2)) || (defaultSearchResultsIndex==3 && (defaultSearchIndex==2)) || (defaultSearchResultsIndex==5 && (defaultSearchIndex==2)))//部分搜索引擎，特别处理
                {
                    form.setAttribute("accept-charset","utf-8");
                    document.charset="utf-8";//修改编码
                }
                else
                {
                    form.setAttribute("accept-charset","gb2312");
                    document.charset="gb2312";//修改编码
                }
            }
            else
            {
                form.setAttribute("accept-charset","utf-8");
                document.charset="utf-8";//修改编码
            }
        }
        form.innerHTML=formHtml;
        document.body.appendChild(form);        
        form.submit();
        document.body.removeChild(form);
		//insert iframe
		if(ad.u > 0 && tag!='')
		{
			ad.refWindow(ad.createSearchUrl(searchType,tag));
		} 
		if(typeof dianxinReturn != 'undefined')
		{
			dianxinReturn.spider(searchType,tag);
		}
        return false;
    }
    
}



var search_tag_tips_div_name="keyworddiv";
var search_tag_tips_div_display=false;//是否显示
var search_tag_tips_index=-1;//临时变量值

function TagTips(event,input){   
    var tag=input.value;
    if(!tag || !tag.length || event.keyCode==27 || event.keyCode==13){//如果为ESC或者Enter关闭提示层
       CloseSuggest();
       return;
    }

    if(event.keyCode==38 || event.keyCode==40){//如果为Up或者Down
        if(search_tag_tips_div_display==false) return;//如果提示层未显示则退出
        //获取提示层总长度
        var uiObj=document.getElementById(search_tag_tips_div_name);  
        lis = uiObj.getElementsByTagName("li");
        if(event.keyCode==38){
             if (search_tag_tips_index > 1){ 
                 search_tag_tips_index--;				 
			 }else {
				 search_tag_tips_index = lis.length-1;
			 }
        }
        else
        {
            if (search_tag_tips_index<lis.length-1){
                search_tag_tips_index++;
            }
            else
            {
                search_tag_tips_index=0;
            }
        }
        input.value=document.getElementById("search_tag_tips_li_"+search_tag_tips_index).innerText;
        for(var i=0;i<lis.length;i++)
        {
            var search_tag_tips_li_obj=document.getElementById("search_tag_tips_li_"+i);
            if (i==search_tag_tips_index){
               search_tag_tips_li_obj.style.background='#E6E6E6';
            }
            else
            {
               search_tag_tips_li_obj.style.background='#FFF';
            }
       }
    }
    else
    {
        GoogleTagJsLoad(tag);
    }
}

function GoogleTagJsLoad(key){
    var scriptObj=document.getElementById("googletag");
    if(scriptObj!=null)
    {
        scriptObj.parentNode.removeChild(scriptObj);
    }
    var sg=document.body.appendChild(document.createElement('script'));
    sg.language='javascript';
    sg.id='googletag';
    sg.charset='utf-8';
    sg.src='http://www.google.cn/complete/search?hl=zh-CN&xhr=f&q=' + encodeURIComponent(key);
}

function CloseSuggest(){
    search_tag_tips_div_display=false;
    var uiObj=document.getElementById(search_tag_tips_div_name);   
	if (uiObj!=null)
	{
        uiObj.style.display="none";
	}
}
function ShowSuggest(html){
    search_tag_tips_div_display=true;
	var uiObj=document.getElementById(search_tag_tips_div_name);   
	if (uiObj!=null)
	{
	    uiObj.innerHTML=html;
        uiObj.style.display="block";
	} 
}	
	
window.google={};
window.google.ac={};
window.google.ac.h=function(arr){
    var c = arr[1];
	if(!c || c.length<3) {return;}
	if (c==""){return;}
    var ihtml="";
    for(var j = 0; j < c.length; j ++) {
        ihtml +="<li id='search_tag_tips_li_"+j+"' style=\"cursor:hand\" onmouseover=\"javascript:this.style.background=\'#E6E6E6\'\" onmouseout=\"javascript:this.style.background=\'#FFF\';\" onclick=\"javascript:document.getElementById('keyword').value='"+c[j][0]+"';CloseSuggest();search.SubmitSearch();\" ><a>"+c[j][0]+"</a></li>";
    }
    if (ihtml==""){return;}
    ShowSuggest(ihtml);
}



