// sound
function ssplay(b)
{
	window.location.href="sound:" + b;
}
// tts
function TTSo(tid)
{
	var tObj = document.getElementById(tid);
	if(tObj)
	{
		TTSt(tObj.innerText);
	}
}
function TTSt(text)
{
	if(text && text!="")
		window.location.href="tts:" + text;
}
// table
function tab_clickitem(obj,id)
{
	chgFocus(obj);
	var childs = obj.parentNode.parentNode.childNodes;
	for(var i=0,j=childs.length;i<j;i++){
		if(childs[i].tagName.toUpperCase() == 'DIV'){
			if(childs[i].id == id){
				childs[i].className = 'card_current';
			}else{
				childs[i].className = 'card_uncurrent';
			}
		}
	}
}
function chgFocus(obj){
	var childs = obj.parentNode.childNodes;
	for(var i=0,j=childs.length;i<j;i++){
		if(childs[i] == obj){
			childs[i].className = 'tab_current';
		}else{
			childs[i].className = 'tab_uncurrent';
		}
	}
}

// welcome
function VCenter(id)
{
	var middleDiv = document.getElementById(id);
	var divHeight = middleDiv.offsetHeight;
	var bodyHeight = document.body.offsetHeight ;
	if(bodyHeight > divHeight)
	{
		middleDiv.style.marginTop = (bodyHeight - divHeight)/2 + "px";
	}
	else
	{
		middleDiv.style.marginTop=0;
		middleDiv.style.top=0;
	}
}
function LayerSwap(tid, iid, s, h)
{
	var tobj = document.getElementById(tid);
	var iobj = document.getElementById(iid);
	if(tobj && iobj)
	{
		if(tobj.style.display=="none")
		{
			tobj.style.display="block";
			iobj.style.backgroundPositionY=s+"px";
		}
		else
		{
			tobj.style.display="none";
			iobj.style.backgroundPositionY=h+"px";
		}
	}
}
function LayerSwap2(objt, tid, iid, s, h)
{
	var tobj = document.getElementById(tid);
	var iobj = document.getElementById(iid);
	if(tobj && iobj)
	{
		if(tobj.style.display=="none")
		{
			tobj.style.display="block";
			iobj.style.backgroundPositionY=s+"px";
			objt.childNodes[1].innerHTML="<a name='xx' onmouseover='this.style.textDecoration=\"underline\"' onmouseout='this.style.textDecoration=\"none\"'>{collapse}</a>";
		}
		else
		{
			tobj.style.display="none";
			iobj.style.backgroundPositionY=h+"px";
			objt.childNodes[1].innerHTML="<a name='xx' onmouseover='this.style.textDecoration=\"underline\"' onmouseout='this.style.textDecoration=\"none\"'>{expand}</a>";
		}
	}
}

function SetAddSCBStatus(localpath, title, msg)
{
   var scbobj = document.getElementById("addscb");
   if ( scbobj )
   {
        var html = "<IMG TITLE=\"";
		html += title;
		html += "\" SRC=\"file:///";
		html += localpath;
		html += "htmlres/images/addok.png\" CLASS=\"addscb\">";
		html += msg;
		html += "</IMG>";
		scbobj.innerHTML = html;
		return true;
   }
   return false;
}