$id = function(id)
{
	if (typeof(id) == "string")
	{
		return document.getElementById(id);	
	}
}

var g_browserVer;
var g_tips_timer = null;
var g_tips_j = 3;

function getPos(obj)
{
	var pos = [];
	pos[0] = obj.offsetLeft; 
	pos[1] = obj.offsetTop-20; 
   
	while (obj = obj.offsetParent)
	{
		pos[0] += obj.offsetLeft;
		pos[1] += obj.offsetTop;
	}

	return pos;
}

function newShowTips(obj,way,img,imgHeight)
{
	var quickviewtips = $id("quickviewtips");
	var pos = getPos(obj);
	$id("quickviewtipsImg").src = img;
	quickviewtips.style.left = pos[0] + "px";
	if (way == "down")
	{
		g_tips_timer = setInterval(function(){tipsAnimateDown()},50);
	}
	else
	{
		g_tips_timer = setInterval(function(){tipsAnimateUp(imgHeight)},50);
	}
	function tipsAnimateDown()
	{
		if (g_tips_j == 3)
		{
			quickviewtips.style.display = "block";
		}
		if (g_tips_j >= 0)
		{
			quickviewtips.style.top = (pos[1] + 20 + g_tips_j * 15) + "px";
			setOpacity();
			g_tips_j--;
		}
		else
		{
			clearInterval(g_tips_timer);
			g_tips_timer = null;
			g_tips_j = 3;
		}
	}
	function tipsAnimateUp(imgHeight)
	{
		if (g_tips_j == 3)
		{
			quickviewtips.style.display = "block";
		}
		if (g_tips_j >= 0)
		{
			quickviewtips.style.top = (pos[1] - imgHeight - 10 - g_tips_j * 15) + "px";
			setOpacity();
			g_tips_j--;
		}
		else
		{
			clearInterval(g_tips_timer);
			g_tips_timer = null;
			g_tips_j = 3;
		}
	}
	function setOpacity()
	{
		if (g_browserVer == 1)
		{
			quickviewtips.filters.alpha.opacity = 100 - g_tips_j * 25;
		}
		else
		{
			quickviewtips.style.opacity = 1 - g_tips_j * 0.25;
		}
	}
}

function newHideTips(obj)
{
	$id("quickviewtips").style.display = "none";
	clearInterval(g_tips_timer);
	g_tips_timer = null;
	g_tips_j = 3;
	$id("quickviewtipsImg").src = "";
}
