﻿//新闻模式分类显示菜单
function NewsSpanBar(){
	this.f=1;
	this.event = "click"
	this.titleid = "";
	this.bodyid="";
	this.class_dis = "dis";
	this.class_undis = "undis";
	this.class_hiton = "tab_search_on";
	this.class_hitno = "tab_search";

	var Tags,TagsCnt,len,flag;
	var BClassName;
	this.load=function(){
		if (!document.getElementById(this.titleid)||!document.getElementById(this.bodyid))
		{
			return false;
		}
		flag = this.f;
		BClassName = [this.class_dis,this.class_undis,this.class_hiton,this.class_hitno];
		Tags=document.getElementById(this.titleid).getElementsByTagName('p'); 
		TagsCnt=document.getElementById(this.bodyid).getElementsByTagName('dl'); 
		len=Tags.length;
		for(var i=0;i<len;i++){
			Tags[i].value = i;
			if (this.event!='click'){
				Tags[i].onmouseover=function(){changeNav(this.value)};
			}else{
				Tags[i].onclick=function(){changeNav(this.value)};
			}
			TagsCnt[i].className=BClassName[1];
		}
		Tags[flag].className=BClassName[3];
		TagsCnt[flag].className=BClassName[0];
	}
	function changeNav(v){
		Tags[flag].className=BClassName[2];
		TagsCnt[flag].className=BClassName[1];
		flag=v;
		Tags[v].className=BClassName[3];
		TagsCnt[v].className=BClassName[0];
	}
}
//收缩功能
function collapse(img, objName)
{
	if ( typeof(document.getElementById(objName)) != 'undefined' )
	{
	var obj = document.getElementById(objName);
		 if(obj.style.display=='')
		{
			  obj.style.display='none';
			  if(img.src.indexOf('tab')!=-1){
				  img.title='展开版面';
				  img.src=imgpath+'tab_on.gif';
			  }
		}
		 else
		{
			 obj.style.display=''
			  if(img.src.indexOf('tab')!=-1){
				  img.title='隐藏版面';
				  img.src=imgpath+'tab.gif';
			  }
		}
		if(img.src.indexOf('list')!=-1){
			if(img.title.indexOf('简单模式显示版面')!=-1){
				  img.title='横向模式显示版面';
				  img.src=imgpath+'list_on.gif';
			 }else{
				  img.title='简单模式显示版面';
				  img.src=imgpath+'list.gif';
			 }
		}
	}
} 