//
// Pop Quote/Chart Tooltip for a Ticker Symbol as on Stocks on the Move Page
//
// $Id: popquote.js,v 1.2 2007/09/28 18:06:52 ghoffman Exp $
// $Source: /bbsrc/web/jscommon/popquote.js,v $
//
// Note: wz_tooltip.js has to be included AFTER popquote() calls,
// eg in the end of HTML BODY.
//

function popchart( obj, tkr )
{
  return "<img style='margin-bottom:5px' " +
    "src='StockInfo.asp?stockCode=" + tkr + "'>"
}

function popquote( obj, tkr )
{
	var list = new Array();
	list = tkr.split('|');
	var currentKL = list[0];
	var currentNo = 1;
	var groupNo = 1;
	var returnValue = "overflow:auto'><table class='qttyDetail' cellspacing=0 cellpadding=3><tr><td align='right'>Khối lượng</td><td align='right'>Số lệnh</td></tr>";

	var i;
	for (i=1;i<list.length;i++)
	{
		if (list[i] == currentKL) 
		{
			currentNo++;
		}
		else 
		{
			returnValue = returnValue + "<tr><td align='right'>" + currentKL + "</td><td align='right'>" + currentNo + "</td></tr>"; 
			currentKL = list[i];
			currentNo = 1;
			groupNo = groupNo + 1;
		}		
	}
	returnValue = returnValue + "<tr><td align='right'>" + currentKL + "</td><td align='right'>" + currentNo + "</td></tr>"; 
	if (groupNo > 6)
		returnValue = "<div style='height: 147px; " + returnValue + "</table></div>";
	else 
		returnValue = "<div style='" + returnValue + "</table></div>";
        return 	returnValue
}