/**
*@function:页面初始化操作
*@author:
*@email:
*@copyright:
*@date:2008-12-15
**/
var openIndex = 0;// 设置初始打开的层序号
var openState = new Array();
var closeState = new Array();
var dH = 220;
function closeMe(Cid,Oid){
	var h = parseInt(Ds[Cid].style.height);
	//alert(h);
	if(h > 0){
		h = h - Math.ceil(h/3);
		Ds[Cid].style.height = h+"px";
	}else{
		openMe(Oid);
		clearTimeout(closeState[Cid]);
		return false;
	}
	closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")");
}

function openMe(Oid){
	var h = parseInt(Ds[Oid].style.height);
	//alert(h);
	if(h < dH){
		h = h + Math.ceil((dH-h)/3);
		Ds[Oid].style.height = h+"px";
	}else{
		clearTimeout(openState[Oid]);
		return false;
	}
	openState[Oid] = setTimeout("openMe("+Oid+")");
}

var Ts = $classTag("workaround_div","GroupMaster");
var Ds = $classTag("workaround_div","content");
if(Ds.length != Ts.length)
{
	alert("Page Error:标题和内容数目不相同！\nTitle and content are not the same as the number of!");
}
dH=(($("#workaround_div")[0]).clientHeight)-(Ts.length*36);
for(var i = 0 ; i < Ds.length ; i++){
	if(i==openIndex){
		Ds[i].style.height = dH+"px";
		Ts[i].className="title01";
		Ts[i].onmouseover=function(){
			this.className="title11";
		}
		Ts[i].onmouseout=function(){
			this.className="title01";
		}
	}else{
		Ds[i].style.height = "0px";
		Ts[i].className="title02";
		Ts[i].onmouseover=function(){
			this.className="title22";
		}
		Ts[i].onmouseout=function(){
			this.className="title02";
		}
	}
	Ts[i].value = i;
	Ts[i].onclick = function(){
		if(openIndex==this.value){
			return false;
		}			
	Ts[openIndex].className="title02";
	Ts[this.value].className="title01";
	for(var i = 0 ; i < openState.length ; i++){
		clearTimeout(openState[i]);
		clearTimeout(closeState[i]);
	}
	closeMe(openIndex,this.value);
	openIndex = this.value;
	//playAudio("Audio/folder.wav");//播放打开的声音
	}
}

//直接打开层函数
function showDiv(id){
	Ds[id].style.height=dH+"px";
	Ds[openIndex].style.height="0px";
	openIndex = id;
}