// JavaScript Document
function getElementsByClassName(oElm, strTagName, strClassName) {
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");	
	var oElement;	
	for(var i=0; i<arrElements.length; i++){	
		oElement = arrElements[i];	
		if(oRegExp.test(oElement.className)){	
			arrReturnElements.push(oElement);	
			}	
	}
	return (arrReturnElements)
}


function secBoard(elementID) {
	var opCaption = document.getElementById(elementID+"_caption").getElementsByTagName("li");
	var opContects = document.getElementById(elementID+"_content")
	var opContect = getElementsByClassName(opContects, "div", "normal");
	var len = opCaption.length;   //len=3
	var flag = 0;
	opCaption[flag].className = "current";
	opContect[flag].className = "current";
	for (var i=0; i<len; i++) {
		opCaption[i].value = i;	//opCation[0]=0
		opCaption[i].onmouseover= function() {
			for(var j=0; j<len; j++) {
				if(opCaption[j].value == this.value) {
					opCaption[j].className = "current";
					opContect[j].className = "current";
				} else {
					opCaption[j].className = "normal";
					opContect[j].className = "normal";
				}
			}
		}
	}	
}
window.onload = function() {secBoard("hotnews");
}
/*
重要提示:
在将作用的层中加上id=elementID
标题id为elementID_caption
内容id为elementID_content,
并给作用的节点分别选用normal / current两个显示隐藏样式
*/

