﻿
function IndexHotChange(obj,parentObjId,showObjId,selectedValue)
{


if(obj.className!="Selected"){

parentObj=document.getElementById(parentObjId);
showObj=document.getElementById(showObjId);

var parentObjList=parentObj.getElementsByTagName("li");
var showObjList=showObj.getElementsByTagName("ul");

for(var i=0;i<parentObjList.length;i++){
parentObjList[i].className="";
showObjList[i].style.display="none";
}
obj.className="Selected";
showObjList[selectedValue].style.display="";

}
}


function ArtChangeBg(name, id, num)
{
	for(var i=1; i<=4; i++)
	{
		if( document.getElementById(name+i) != null )
		{
			if( i == num )
			{
			    
			        document.getElementById(name+"_"+i).style.display='';
			        document.getElementById(name+i).style.fontWeight='bold';
			    
			    if(i==1){
			      document.getElementById(name+i).style.backgroundImage='url(/images/bg1_1.jpg)'
			    }
			    else{
			    document.getElementById(name+i).style.backgroundImage='url(/images/bg3_1.jpg)'
			    }
		
			
			}
			else
			{
			     if(i==1){
			      document.getElementById(name+i).style.backgroundImage='url(/images/bg1_2.jpg)'
			    }
			    else{
			    document.getElementById(name+i).style.backgroundImage='url(/images/bg3_2.jpg)'
			    }
		         
	            document.getElementById(name+"_"+i).style.display='none';
			    document.getElementById(name+i).style.fontWeight='normal';
			}
			
		}
	}
	

}


//公告
var rollText_k=6; //菜单总数
var rollText_i=1; //菜单默认值            //setFocus1(0);
rollText_tt=setInterval("rollText(1)",8000);
function rollText(a){
clearInterval(rollText_tt);
rollText_tt=setInterval("rollText(1)",8000);
rollText_i+=a;
if (rollText_i>rollText_k){rollText_i=1;}
if (rollText_i==0){rollText_i=rollText_k;}
//alert(i)
for (var j=1; j<=rollText_k; j++){
document.getElementById("rollTextMenu"+j).style.display="none";
}
document.getElementById("rollTextMenu"+rollText_i).style.display="block";
document.getElementById("pageShow").innerHTML = rollText_i+"/"+rollText_k;
}

/*滚动广告*/
var marqueeInterval=new Array();  //定义一些常用而且要经常用到的变量
var marqueeId=0;
var marqueeDelay=2000;
var marqueeHeight=15;
function initMarquee() {


 var str=marqueeContent[0];
document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
 marqueeId++;
 marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);

 }
function startMarquee()
 {
 var str=marqueeContent[marqueeId];
  marqueeId++;
 if(marqueeId>=marqueeContent.length) marqueeId=0;
 if(marqueeBox.childNodes.length==1) {
  var nextLine=document.createElement('DIV');
  nextLine.innerHTML=str;
  marqueeBox.appendChild(nextLine);
  }
 else {
  marqueeBox.childNodes[0].innerHTML=str;
  marqueeBox.appendChild(marqueeBox.childNodes[0]);
  marqueeBox.scrollTop=0;
  }
 clearInterval(marqueeInterval[1]);
 marqueeInterval[1]=setInterval("scrollMarquee()",10);
 }
 
function scrollMarquee() {
 marqueeBox.scrollTop++;
 if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){
  clearInterval(marqueeInterval[1]);
  }
 }
	


// tab切换
function tabswitch(c, config){
	this.config = config ? config : {start_delay:3000, delay:1500};
	this.container = $i(c);
	this.pause = false;
	this.nexttb = 1;
	this.tabs = this.container.getElementsByTagName('dt');
	var _this = this;
	if(this.tabs.length<1)this.tabs = this.container.getElementsByTagName('li');
	for(var i = 0; i < this.tabs.length; i++){
		var _ec = this.tabs[i].getElementsByTagName('span');
		if(_ec.length<1)_ec = this.tabs[i].getElementsByTagName('a');
		if(_ec.length<1){
			_ec = this.tabs[i]
		}else{
			_ec = _ec[0];
		}
		_ec.onmouseover = function(e) {
			_this.pause = true;
			var ev = !e ? window.event : e;
			_this.start(ev, false, null);
		};
		
		_ec.onmouseout = function() {
			_this.pause = false;
		};
		
		try{
			$i(this.tabs[i].id + '_show').onmouseover = function(){
				_this.pause = true;
			};
			
			$i(this.tabs[i].id + '_show').onmouseout = function(){
				_this.pause = false;
			};
		}catch(e){}
	}

	if ($i(c + '_sts')) {
		var _sts = $i(c + '_sts');
		var _step = _sts.getElementsByTagName('li');
		if(_step.length<1)_step = _sts.getElementsByTagName('div');
		_step[0].onclick = function() {
			if (_this.tabs[_this.tabs.length-1].className.indexOf('current') > -1) {
				_this.nexttb = _this.tabs.length + 1;
			};
			_this.nexttb = _this.nexttb - 2 < 1 ? _this.tabs.length : _this.nexttb - 2;
			//alert(_this.nexttb);
			_this.start(null, null, _this.nexttb);
		};
		
		_step[1].onclick = function() {
			_this.nexttb = _this.nexttb < 1 ? 1 : _this.nexttb;
			_this.start(null, null, _this.nexttb);
		};
	};
	
	this.start = function(e, r, n){
		if(_this.pause && !e)return;
		if(r){
			curr_tab = $i(_this.container.id + '_' + rand(4));
		}else{
			if(n){
				//alert(_this.container.id + '_' + _this.nexttb);
				curr_tab = $i(_this.container.id + '_' + _this.nexttb);
			}else{
				curr_tab = _jsc.evt.gTar(e);
				if(curr_tab.id=="")curr_tab = curr_tab.parentNode;
			}
		}
		
		var tb = curr_tab.id.split("_");
		for(var i = 0; i < _this.tabs.length; i++){
			if(_this.tabs[i]==curr_tab){
				_this.tabs[i].className="hot Selected current";
				try{
					//alert(_this.tabs[i].id);
					$i(_this.tabs[i].id + '_show').style.display = "block";
				}catch(e){}
			}else{
				_this.tabs[i].className="";
				try{
					$i(_this.tabs[i].id + '_show').style.display = "none";
				}catch(e){}
			}
		}
		_this.nexttb = parseInt(tb[tb.length-1]) >= _this.tabs.length ? 1 : parseInt(tb[tb.length-1]) + 1;
	};
}


var  super_rec;
_jsc.util.addEvent(window, 'load', function() {
		
		
		if ($i('super_rec')) {	
			super_rec = new tabswitch('super_rec', {});
			setInterval("super_rec.start(null, null, 3);", 3000);
		}

});



function SetTopYuding(dateType){
AjaxHelper.Updater('index/Panel_TopYuding','topYuding','dateType='+dateType,function(){});


}

function SetClassAdCateId(cateId){
AjaxHelper.Updater('index/Panel_ClassAd','classAd_index','cateId='+cateId,function(){});

}

function SetEprintPage(page){
AjaxHelper.Updater('index/Panel_Eprint','yhj_index','page='+page,function(){});

}

function SetNewsCateId(panelName,cateId){
AjaxHelper.Updater('index/Panel_News',panelName,'idList='+$F(panelName+'_value')+'&panelName='+panelName+'&cateId='+cateId);


}