
var strTabPath = "/jsp_cm/funds/fdata/perfchart/";


var astrImagePathnames = new Array();

var aImages = new Array();


function addImage(strPathname)
{
	var ix = astrImagePathnames.length;

	astrImagePathnames[ix] = strPathname;
	
	return ix;
}

function loadImages()
{
	var imgTabOn = new Image();
	imgTabOn.src = strTabPath + "on.gif"

	var ix = 0;
	while (ix < astrImagePathnames.length)
	{
		aImages[ix] = new Image();
		aImages[ix].src = astrImagePathnames[ix];

		++ ix;
	}
}


function setImage(strName,ix)
{
	if (eval("document." + strName + ".src") == astrImagePathnames[ix])
	{
		return;
	}
	
	eval("document." + strName + ".src=astrImagePathnames["+ ix + "]");
}


function addTab(strTitle, strDescription, ixImage, bHilited)
{
	var nWidth = 50;
	var nHeight = 25;

	//plain vanilla link to set the chart image, to support Netscape 4.7 due to no tab onMouseOver event in Netscape 4.7
	var strLink = '<a class="tablink" href="javascript:setImage(' + "'chart'," + ixImage + ')">' + strTitle + '<' + '/a>';

	//on mouse over: change the tab, and swap the performance chart
	var strMouseOverCode = "setTab(" + ixImage + "); setImage('chart'," + ixImage + ");";

	var strID = "tab" + ixImage;
	
	document.write('<td');
	document.write(' align="right"');				//horizontal alignment
	document.write(' valign="top"');				//vertical alignment
	document.write(' class="inactivetab"');				//class
	document.write(' id="' + strID + '"');				//ID
	document.write(' background="' + strTabPath + 'off.gif"');	//default background image for a tab
	document.write(' background-repeat="no-repeat"');		//do not repeat background image
	document.write(' font-size: 8px;');				//font size
	document.write(' height=' + nHeight);				//height
	document.write(' width=' + nWidth);				//width
	document.write(' title="' + strDescription + '"');		//title
	document.write(' onmouseover="' + strMouseOverCode + '"');	//onmouseover
	document.write('>' + strLink + '<' + '/td>');			//plain vanilla link

	document.write('<td width="3">' + '<' + '/td>');
	
	if (bHilited)
	{
		setTab(ixImage);
	}
}


function setTab(ixImage)
{
	var ix = 0;
	
	while (ix < astrImagePathnames.length)
	{
		var strID = "tab" + ix;
		
		var obj = null;

		// NN7 and IE5 support getElementByID

		if (document.getElementById)
		{
			obj = document.getElementById("tab" + ix);
		}
		else
		{
			// IE4 supports document.all

			if (document.all)
			{
				obj = document.all(strID);
			}
		}

		if (obj)
		{
			if (ix == ixImage)
			{
				obj.className = "activetab";
			}
			else
			{
				obj.className = "inactivetab";
			}
		}
		
		++ ix;
	}
}


// Load the images as soon as the page loads

window.onload = "loadImages();";


