	YL_MenuBar={
		menuid:"",
		menus:null,
		menusLength:0,
		menuSmalls:null,
		defaultIndex:0,
		defaultIndexSmall:0,
		curcss:"cur",
		nobr:"nobr",
		$:function(menuid)
		{
			return document.getElementById(menuid);
		},
		setMenu:function(menuid,curindex,bigrq,smallrq,curcss,nobrcss)
		{
			var tempObj,tcurb,tcurs;
			tcurb=0;
			tcurs=0;
			//拆分处理当前链接索引
			if (curindex.toString().indexOf(".")>-1) //当存在“.”时表示有子分类选定
			{
				var curAry=	curindex.split(".");
				tcurb=parseInt(curAry[0]);
				if (curAry.length>1 && curAry[1]!="")
				{
					tcurs=parseInt(curAry[1]);
				}
				
			}else
			{
				tcurb=parseInt(curindex);
			}
			
			this.defaultIndex=tcurb;
			this.defaultIndexSmall=tcurs;
			this.curcss=curcss?curcss:this.curcss;
			this.nobr=nobrcss?nobrcss:this.nobr;
			this.menus=this.$(menuid).getElementsByTagName(bigrq);
			this.menusLength=this.menus.length;
			this.menuSmalls=new Array();
			for(i=0;i<this.menusLength;i++)
			{
				tempObj=this.menus[i].getElementsByTagName(smallrq)[0];
				if (tempObj)
				{
					tempObj.style.display="none";
				}
				//if (tempObj!="undefined")
				//{
				//	tempObj.thisIndex=i;
				//	tempObj.onmouseover=function(){YL_MenuBar.overMenu(this.thisIndex)};
				//	tempObj.onmouseout=function(){YL_MenuBar.outMenu()};
				//}
				this.menuSmalls[i]=!tempObj?null:tempObj;
				//加入事件，和索引属性
				this.menus[i].thisIndex=i+1;
				this.menus[i].onmouseover=function(){YL_MenuBar.overMenu(this.thisIndex)};
				this.menus[i].onmouseout=function(){YL_MenuBar.outMenu()};
			}
			this.overMenu(this.defaultIndex);
			if (this.defaultIndex>0 && this.menus[this.defaultIndex-1])
			{
				var curliObjs = this.menus[this.defaultIndex-1].getElementsByTagName("li");
				
				if (curliObjs && curliObjs.length>=this.defaultIndexSmall && this.defaultIndexSmall>0)
				{
					curliObjs[this.defaultIndexSmall-1].className="cur";
				}
			}
		},
		overMenu:function(index)
		{
			
			for(i=0;i<this.menusLength;i++)
			{
				if (this.menuSmalls[i])
				{
					this.menuSmalls[i].style.display="none";
				}
				this.menus[i].className="";
			}
			index--;
			if (index>-1)
			{
				this.menus[index].className=this.curcss;
				if (this.menuSmalls[index])
				{
					this.menuSmalls[index].style.display="block";
				}
				if (index<this.menusLength-1)
				{
					this.menus[index+1].className=this.nobr;
				}
				if (index!=0)
				{
					this.menus[0].className=this.nobr;
				}
			}
		},
		outMenu:function()
		{
			this.overMenu(this.defaultIndex);
			if (this.menuSmalls[this.defaultIndex-1]) this.menuSmalls[this.defaultIndex-1].style.display="none"; //为了回弹时不显示子菜单
		}
	}

var curindex=0;
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        }
                        catch (e) {
                                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}

