var num=8 //该值记录标签的个数
function chgChannelBg(oChannel,curChannel,sStyle1,sStyle2)
{
	 if(curChannel.className=sStyle2);
	 if(oChannel.className!=sStyle1)
	 {
		 oChannel.className=sStyle1;
	 }
	
}
//头部频道页移出鼠标后恢复当前频道样式
function recoverCurChannelBg(curChannel,sStyle)
{
	curChannel.className=sStyle;
}
//鼠标移动到头部频道链接，改变频道链接样式
function doMouseOverOnChannel(oChannel,curChannelName)
{
	chgChannelBg(oChannel,document.getElementById(curChannelName),'top_bt1','top_bt2');
}
////鼠标移出到头部频道链接，改变频道链接样式
function doMouseOutOnChannel(oChannel,curChannelName)
{
	chgChannelBg(oChannel,document.getElementById(curChannelName),'top_bt2','top_bt2');recoverCurChannelBg(document.getElementById(curChannelName),'top_bt1');
}

//获取对应ID或Name的元素对象
function GetObj(objName){
 if(document.getElementById){
  return eval('document.getElementById("' + objName + '")');
 }else if(document.layers){
  return eval("document.layers['" + objName +"']");
 }else{
  return eval('document.all.' + objName);
 }
}
//index:当前控制元素序号；ctrledPrefix:被控制ID前缀；ctrlPrefix:控制ID前缀；ctrlClass1:控制元素初始样式；ctrlClass2:控制元素第二样式
function tabSwift(index,ctrlPrefix,ctrledPrefix,ctrlClass1,ctrlClass2)
{
  
	
   for(var i=1;i<=num;i++){/* 最多支持8个标签 */
   
    if(GetObj(ctrlPrefix+i)&&GetObj(ctrledPrefix+i)){
	
     GetObj(ctrledPrefix+i).style.display = 'none';
	
	 if (ctrlClass1!=null)
	 {
        GetObj(ctrlPrefix+i).className =ctrlClass1;
	 }
    
    }
   }
  if(GetObj(ctrlPrefix+index)&&GetObj(ctrledPrefix+index)){
    GetObj(ctrledPrefix+index).style.display = 'block';
	if (ctrlClass2!=null)
	{
         GetObj(ctrlPrefix+index).className=ctrlClass2;
	}
   
 }
}

//添加收藏夹的函数
function addCookie()
{
 if (document.all)
    {
       window.external.addFavorite('http://www.tradekey21.com','tradekey21.com');
    }
    else if (window.sidebar)
    {
       window.sidebar.addPanel('tradekey21.com', 'http://www.tradekey21.com', "");
 }
}

//设为首页
function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
       document.body.setHomePage('http://www.tradekey21.com');
 
    }
    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','http://www.tradekey21.com');
 }
}

