var tip_close_wait = 3000;
var tip_width = 250;
var tip_cache_enabled = true;
var tip_events = new Array();
var tip_cotents = new Array();

function pb_tip(id, tip, width, timeout)
{
	var cotent = tip;
	if (width) tip_width = tip_width;
	if (timeout) tip_close_wait = timeout;
	if(!tip_cotents[id])
	{
		tip_cotents[id] = cotent;
		cotent = '';
	}
	tip_events[id] = 1;
	tip_show(id);
	setTimeout(function(){tip_remove(id)}, tip_close_wait);
}
function tip_remove(id)
{
	tip_events[id] = 0;
	$('#pb_tip').remove();
}
function tip_show(id)
{
	if(tip_events[id] == 0) return;
	var obj = $("#"+id);
	var cotent = tip_cotents[id];
	$("#pb_tip").remove();
	var left = tip_getLeft(id);
	var top = tip_getTop(id) + tip_getHeight(id) + 12;
	$("body").append("<div id='pb_tip' class='pb_tip_shadow' style='top:"+top+"px; left:"+left+"px;'><div id='pb_tip_main' style='width:"+tip_width+"px;'><div id='pb_tip_content'></div></div></div>");
	$('#pb_tip_content').html(cotent);
	$('#pb_tip').show('2000');
}
function tip_getHeight(id)
{
	return $('#'+id)[0].offsetHeight;
}
function tip_getLeft(id)
{
	var obj = $('#'+id)[0];
	var left = obj.offsetLeft;
	var parent = obj.offsetParent;
	while(parent) {
		left += parent.offsetLeft;
		parent = parent.offsetParent;
	}
	return left
}
function tip_getTop(id) {
	var obj = $('#'+id)[0];
	var top = obj.offsetTop;
	var parent = obj.offsetParent;
	while(parent) {
		top += parent.offsetTop;
		parent = parent.offsetParent;
	}
	return top;
}