var curItems = new Array();

//切换显示项目
//grp ： 以 ID 分类成一组，如 SDM1，SDM2
//inx ： 分组最后的数字索引
//tarGrp ： 要控制的 ID 前半部分
//oldClass ： 恢复原有的样式
//newClass ： 应用新的样式
//needClose：是否需要关闭
function SwitchItem(grp,tarGrp,inx,oldClass,newClass,needClose)
{
    needClose = (needClose == null)? false : needClose;
    if(curItems[grp] != null)
    {
        if(oldClass != null){ curItems[grp].className = oldClass;}
    }
    var id = grp + ''+ inx + '';
    var tid = tarGrp + ''+ inx + '';
    var obj = document.getElementById(id);
    var tobj = document.getElementById(tid);
    if(obj!=null && newClass != null){ obj.className = newClass;}
    
    if(tobj!= null)//需要关闭
    {
        tobj.style.display = (needClose && tobj.style.display=="") ? "none" : "";
    }
    if(curItems[tarGrp] != null && curItems[tarGrp] != tobj)
    {
        curItems[tarGrp].style.display = "none";
    }
    
    curItems[grp] = obj;
    curItems[tarGrp] = tobj;
    
}

//字体闪烁
function BlinkFont(id)
{
    var obj = document.getElementById(id);
    if(obj == null){return;}
    
    var val = obj.getAttribute("oldColor");
    if(val == null || val=="")
    {        //变红色
        obj.setAttribute("oldColor",obj.style.color);
        obj.style.color = "red";
    }
    else
    {   //还原
        obj.style.color = val;
        obj.setAttribute("oldColor","");              
    } 
    
    val = obj.getAttribute("oldfontWeight");
    if(val == null || val=="")
    { //变粗
        obj.setAttribute("oldfontWeight",obj.style.fontWeight);
        obj.style.fontWeight = "bold";
    }
    else
    {   //还原
        obj.style.fontWeight = val;
        obj.setAttribute("oldfontWeight","");              
    }    
    
    val = obj.getAttribute("oldfontSize");
    if(val == null || val=="")
    {   //变成 16px
        obj.setAttribute("oldfontSize",obj.style.fontSize);
        obj.style.fontSize = "16px";
    }
    else
    {   //还原
        obj.style.fontSize = val;
        obj.setAttribute("oldfontSize","");              
    }
    //obj.runtimeStyle.color = (obj.runtimeStyle.color != "red") ? "red" :obj.style.color;;
   
    //obj.runtimeStyle.fontWeight = (obj.runtimeStyle.fontWeight != "bold") ? "bold" : obj.style.fontWeight;
    
    //obj.runtimeStyle.fontSize =(obj.runtimeStyle.fontSize !="16px")? "16px" : obj.style.fontSize;
}


//展开与合上内容
function ExpandItem(spId,tgId)
{
	var sp = document.getElementById(spId);
	var tg = document.getElementById(tgId);
	if(sp.innerHTML == "-")
	{
		sp.innerHTML = "+";
		tg.style.display ="none";
	}
	else
	{
		sp.innerHTML = "-";
		tg.style.display ="";
	}
}