/*=======================================================================================*\
|| ######################################################################################||
|| # VBTT USER LAYER (Based of a Mod by PC Freak) Mod by Juleika 4 VBTT               	#||
|| #																					#||
|| # For use with vBulletin Version 3.8.x												#||
|| ######################################################################################||
\*=======================================================================================*/
// =============================================================================
// set positiions x axis

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

// =============================================================================
// set positiions  y axis

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


// =============================================================================
// layer for userinfo

function show_layer_userinfo(obj, link, userid)
{
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	var x = new fetch_object(link);
	x.style.top = newY + 20 + 'px';
	x.style.left = newX + 'px';

	xml = new vB_AJAX_Handler(true);
	xml.onreadystatechange(infoprocess_userinfo);

	sendstring = "xml.send('userlayer.php', 'userid=" + userid + "');";

	setTimeout(sendstring, 300);

	document.getElementById('userinfo_layer').innerHTML = '';
	document.getElementById('userinfo_layer').style.visibility = 'visible';

	obj.onmouseout = function() {
		clearTimeout();
		document.getElementById('userinfo_layer').style.visibility = 'hidden';
	}
}
// =============================================================================
// Hide Layers
// Layer userinfo

function infoprocess_userinfo()
{
	if (xml.handler.readyState == 4 && xml.handler.status == 200 && xml.handler.responseText)
	{
	document.getElementById('userinfo_layer').innerHTML = xml.handler.responseText;
	}
}

// =============================================================================
// infoprocess
// Layer userinfo

function kill_panel_userinfo()
{
	document.getElementById('userinfo_layer').style.visibility = 'hidden';
}