﻿function addCookie()
{
    weburlpath=arguments[0];
    webkeywords=arguments[1];
    if(weburlpath==undefined || weburlpath=="")
    {
        weburlpath="http://www.baoru.com/";
    }
    if(webkeywords==undefined || webkeywords=="")
    {
        webkeywords="宝如行珠宝有限公司";
    }
     if (document.all)
        {
           window.external.addFavorite(weburlpath,webkeywords);
        }
        else if (window.sidebar)
        {
           window.sidebar.addPanel(webkeywords,weburlpath, "");
     }
}

function setHomepage()
{
    weburlpath=arguments[0];
    if(weburlpath==undefined || weburlpath=="")
    {
        weburlpath="http://www.baoru.com/";
    }
     if (document.all)
        {
            document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage(weburlpath);
     
        }
        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',weburlpath);
     }
}

//设为首页&加入收藏
var t_isIE=(document.all&&document.getElementById&&!window.opera)?true:false; 
var t_isMozilla=(!document.all&&document.getElementById&&!window.opera)?true:false; 
var t_isOpera=(window.opera)?true:false;
var t_seturl='url(#default#homepage)';
var t_weburl=window.location.href;
var t_webname=document.title;

function addfavorite()
{
	if(t_isMozilla){
		if (document.all){ window.external.addFavorite(t_weburl,t_webname);}
		else if (window.sidebar){ window.sidebar.addPanel(t_webname, t_weburl,"");}
	}
	if(t_isIE){window.external.AddFavorite(t_weburl, t_webname);}	
}
