/*=======================================================================================*\
|| ######################################################################################||
|| # vBstatistic 1.0.0 Professional Version © by PcFreak                         		#||
|| # Copyright (C) 2006 by Andree Haupt (PcFreak), All rights reserved.          		#||
|| # Email: info@vbstatistic.com														#||
|| # Demo: http://vbstatistic.com														#||
|| #																					#||
|| # For use with vBulletin Version 3.6.0												#||
|| #                                                                                    #||
|| # vBstatistic 1.0.0 Professional Version is to be used in conjunction with VBULLETIN #||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html                   #||
|| ######################################################################################||
\*=======================================================================================*/


// =============================================================================
// easy tooltip

function updateVBSTTT(obj) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : obj.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : obj.pageY;

	if (vbsttt != null) {
		vbsttt.style.left = (x);
		vbsttt.style.top  = (y + 12) + "px";
	}
}

function showVBSTTT(id) {
	vbsttt = null;
	document.onmousemove = updateVBSTTT;
	vbsttt = document.getElementById(id);
	vbsttt.style.display = "block"
}

function hideVBSTTT() {
	vbsttt.style.display = "none";
}

// =============================================================================
// 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('vbstatistic.php', 'do=vbstatistic_layer_userinfo&userid=" + userid + "');";

	setTimeout(sendstring, 300);

	document.getElementById('vbstatistic_userinfo_layer').innerHTML = '';
	document.getElementById('vbstatistic_userinfo_layer').style.visibility = 'visible';

	obj.onmouseout = function() {
		clearTimeout();
		document.getElementById('vbstatistic_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('vbstatistic_userinfo_layer').innerHTML = xml.handler.responseText;
	}
}

// =============================================================================
// infoprocess
// Layer userinfo

function kill_panel_userinfo()
{
	document.getElementById('vbstatistic_userinfo_layer').style.visibility = 'hidden';
}