/*=======================================================================================*\
|| ######################################################################################||
|| # Userlayer 1.0.0 Version © by PcFreak				                         		#||
|| # Copyright (C) 2007 by Andree Haupt (PcFreak), All rights reserved.          		#||
|| # Email: info@vbstatistic.com														#||
|| # Demo: http://vbstatistic.com														#||
|| #																					#||
|| # For use with vBulletin Version 3.6.x												#||
|| #                                                                                    #||
|| # Userlayer 1.0.0 Version is to be used in conjunction with VBULLETIN 				#||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html                   #||
|| ######################################################################################||
\*=======================================================================================*/
// =============================================================================
// 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';
}