﻿function addFav()
{
   if (document.all)
   {
      window.external.addFavorite(location.href,document.title);
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel(document.title, location.href, "");
   }
} 
function setHomepage()   
{   
    if (document.all)   
    {   
        document.body.style.behavior='url(#default#homepage)';   
        document.body.setHomePage(location.href);   
    }   
    else if (window.sidebar)   
    {   
        if(window.netscape)   
        {   
             try  
             {     
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");     
             }     
             catch (e)     
             {     
                alert(e);     
             }   
        }    
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);   
        prefs.setCharPref('browser.startup.homepage',location.href);   
    }   
}
function toSearch()
{
    if ($("#keyword").val() == "请输入相关关键字进行搜索" || $("#keyword").val() == "")
    {
        return false;
    }
    else
    {
        if (location.hostname == "www.1805.net" && location.pathname == "/")
        {
            location.href = "/game/search_" + encodeURIComponent($("#keyword").val().replace(/[\/_]/g," ") + ".html");
        }
        else if (location.pathname.split("/").length == 4)
        {
            location.href = "../search_" + encodeURIComponent($("#keyword").val().replace(/[\/_]/g," ") + ".html");
        }
        else
        {
            location.href = "search_" + encodeURIComponent($("#keyword").val().replace(/[\/_]/g," ") + ".html");
        }
	}
}
function showHotType(index)
{
    $("#hotptype .pbrand").find("li").removeClass("currpbrand");
        $("#hotptype .pbrand").find("li:eq(" + (index - 1) + ")").addClass("currpbrand");
    $("#hotptype .list").hide();
    $("#hotType" + index).show();
}