// Voice hint bar v0.1

function getObjPos(elem)
{
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
    var l = 0;
    var t = 0;
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }
    return {"left":l, "top":t, "width": w, "height":h};
}

function showVoiceHint(width,height,obj,xoffset,yoffset,xvoice,text)
{
	if(typeof obj != "object" && obj) obj=document.getElementById(obj);
	if(obj) var coord=getObjPos(obj);
	else var coord = {"left":0, "top":0};
	var mainObj=document.getElementById('voicehintpanel');
	var contObj=document.getElementById('voicehintcont');
	var nonIEcssRecovery = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) ? 0 : 10;
		
	mainObj.style.left=coord.left+xoffset;
	mainObj.style.top=coord.top+yoffset-height;
	mainObj.style.width=width;
	mainObj.style.height=height;		

	contObj.style.width=width-16-nonIEcssRecovery;
	contObj.style.height=height-20-nonIEcssRecovery;		

	var voicePos=Math.round((width-46)*(xvoice/100));
	if(voicePos<1 || voicePos>(width-46)) voicePos=1;
	
	document.getElementById('voiceh_top').width=width-16;
	document.getElementById('voiceh_left').height=height-20;
	document.getElementById('voiceh_right').height=height-20;
	document.getElementById('voiceh_btleft').width=voicePos;
	document.getElementById('voiceh_btright').width=width-voicePos-46;

	contObj.innerHTML=text;

	mainObj.style.display='block';
}

function hideVoiceHint()
{                            
	document.getElementById('voicehintpanel').style.display='none';
}
