﻿//加入收藏 可选参数 v{"url":"","title":""}
function addFavorites(v){
	var title,url;
	if(v){
		url=v.url;
		title=v.title;
	}else{
		 url=window.location.href;
		 title=document.title;
	}
    if (document.all){
       window.external.addFavorite(url,title);
    }
    else if (window.sidebar){
       window.sidebar.addPanel(title,url);
    }
    return false;
}
//设为首页
function setHomepages(obj){
    var t_url=window.location.href;
    if (document.all){
        obj.style.behavior='url(#default#homepage)';
        obj.setHomePage(t_url);
    }else if (window.sidebar){
       if(window.netscape){
             try{
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
             }  
             catch (e){  
                alert( "该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );  
             }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage',t_url);
    }
    return false;
}
//搜索
function SearchPageInit(stitle) {
    with ($("#txtkeyword")) {
        focus(function() { this.style.color = "#000"; if (this.value == "请输入产品关键词") this.value = ""; });
        blur(function() { if (this.value == "") { this.value = "请输入产品关键词"; this.style.color = "#999"; } });
    }
    if (stitle != "") {
       $("#txtkeyword").val(stitle);
       $("#txtkeyword").attr("color","#00");
    }
    $("#btnSearch").click(function(){
    if ($("#txtkeyword").val() != "请输入产品关键词" && $("#txtkeyword").val() != "") {
        window.location.href = "/SearchList.aspx?title=" + encodeURIComponent($("#txtkeyword").val());
        } else {
        alert("请输入产品关键词！");
        }
    });
}
$(function(){
    $("a.menu span").hover(function(){
        if($(this).attr("class").indexOf("over")>0)return;
        $(this).stop().animate({
            opacity:1
        },"slow");
    },function(){
        if($(this).attr("class").indexOf("over")>0)return;
        $(this).stop().animate({
            opacity:0
        },"slow");
    });
});
