var isInDiv = false ;
/**
 * Retruns the x position of the given object in the window / screen.
 */
function findPosX(obj) {
	var curleft = 0;
	if (document.getElementById || document.all) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} 
	else if (document.layers) {
		curleft += obj.x;
	}
	return curleft;
}

/**
 * Retruns the x position of the given object in the window / screen.
 */
function findPosY(obj) {
	var curtop = 0;
	if (document.getElementById || document.all) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (document.layers) {
		curtop += obj.y;
	}
	return curtop;
}

function showTooltip(id, ele, type)
{
	var tooltipdiv = document.getElementById(id) ;
	tooltipdiv.style.display = 'block' ;
	var divwidth = tooltipdiv.offsetWidth;
	if(type != 2)
	{
		tooltipdiv.style.left = findPosX(ele)-divwidth+"px";
		tooltipdiv.style.top =  findPosY(ele)+"px";
	}
	else
	{
		tooltipdiv.style.left = findPosX(ele)+ele.offsetWidth-0+"px";
		tooltipdiv.style.top =  findPosY(ele)-0+"px";
	}
}
function test(id, stat, ele)
{
	var divobj = document.getElementById(id);
	divobj.style.display = 'block';
	divobj.style.left = findPosX(ele)+ele.offsetWidth-0+"px";
	divobj.style.top =  findPosY(ele)-0+"px";
}

function hideTooltip(id)
{
	if (!isInDiv )
	{
		var divobj = document.getElementById(id);
		divobj.style.display = 'none';
	}
}

function toggleSwitchTo(eve, disp, divid) 
{
	document.getElementById(divid).style.display = disp;
	if (eve.type == 'mouseover')
	{
		isInDiv = true;
	}

	if ( eve.type == 'mouseout' )
	{
		isInDiv = false;
	}
}