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-134+"px";
		tooltipdiv.style.top =  findPosY(ele)-5+"px";
	}
	else
	{
		tooltipdiv.style.left = findPosX(ele)+ele.offsetWidth-140+"px";
		tooltipdiv.style.top =  findPosY(ele)-4+"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;
	}
}

function getDocObj(id)
{
	return document.getElementById(id);
}
function showhideContent(imgdiv, postdiv)
{
	var imgObj = getDocObj(imgdiv);
	var postObj = getDocObj(postdiv);
	for(i = 1; i<=13; i++)
	{
		txtid = "post"+i
		if(postdiv != txtid)
		{
			document.getElementById(txtid).style.display = 'none';
			getDocObj("img"+i).src = 'images/plus.gif';
		}
	}
	if(postObj.style.display == 'none')
	{
		postObj.style.display = 'block';
		imgObj.src = 'images/minus.gif';
		return;
	}
	else
	{
		postObj.style.display = 'none';
		imgObj.src = 'images/plus.gif';
	}
}
