/*
| -------------------------------------------------------
| Author	: Feng Wu, http://come.to/feng, feng@ustc.edu
| -------------------------------------------------------
| Created	: 5/14/02
| Last Mod. : 2/12/04
| -------------------------------------------------------
| Copyright © Feng Wu, 2002 - 2004
| -------------------------------------------------------
*/


// used in the html files, not here
v1 = new Array;
v2 = new Array;
v3 = new Array;

// colors for different categories
var ClrCat = new Array;
ClrCat[1] = new Array;
ClrCat[2] = new Array;
ClrCat[3] = new Array;
ClrCat[4] = new Array;
ClrCat[5] = new Array;
ClrCat[6] = new Array;
ClrCat[7] = new Array;
ClrCat[8] = new Array;
ClrCat[1][1] = "#FF66FF";	ClrCat[1][2] = "#FFCCFF";	ClrCat[1][3] = "#000000";
ClrCat[2][1] = "#FFBB00";	ClrCat[2][2] = "#FFEE44";	ClrCat[2][3] = "#000000";
ClrCat[3][1] = "#66CC66";	ClrCat[3][2] = "#88FF88";	ClrCat[3][3] = "#000000";
ClrCat[4][1] = "#AAAAFF";	ClrCat[4][2] = "#DDDDFF";	ClrCat[4][3] = "#000000";
ClrCat[5][1] = "#6666FF";	ClrCat[5][2] = "#9999FF";	ClrCat[5][3] = "#FFFFFF";
ClrCat[6][1] = "#BBBBBB";	ClrCat[6][2] = "#DDDDDD";	ClrCat[6][3] = "#000000";
ClrCat[7][1] = "#888888";	ClrCat[7][2] = "#AAAAAA";	ClrCat[7][3] = "#FFFFFF";
ClrCat[8][1] = "#222222";	ClrCat[8][2] = "#888888";	ClrCat[8][3] = "#FFFFFF";


function getClrCat(nCat, nSub)
{
	return ClrCat[nCat][nSub];
}


function WF_Category(nId, bSubCat, sTitle)
{
	var clrBg	= getClrCat(nId, 1),
		clrBg2	= getClrCat(nId, 2),
		clrFont = getClrCat(nId, 3);

	if (bSubCat)
		document.writeln("<tr><td bgcolor=" + clrBg + " height=1></td></tr>");

	document.writeln("<tr bgcolor=" + clrBg2 + "><td>&nbsp;<font color=" + clrFont + ">"
		+ sTitle + "</font></td></tr>");
}


function WF_WriteBasic(nId, sUrl, sTitle)
{
	if ( sTitle != "" )
	{
		document.writeln("<img src=0.gif name=arrow_" + nId
			+ " width=9 height=9 border=0>");
		document.writeln("<a href=" + sUrl + " onMouseOver='WF_MOver(" + nId
			+ "); return true;' onMouseOut='WF_MOut(" + nId + ");'>" + sTitle + "</a>");
	}
	else
	{
		document.write("");
	}
}


function WF_GroupTr(sTitle, nId)
{
	var sColor = getClrCat(nId, 1);

	document.writeln("<tr bgcolor=#FFFFFF><td colspan=3 height=5></td></tr>");
	document.writeln("<tr><td colspan=3><font color=" + sColor + ">" + sTitle + "</font></td></tr>");
}


function WF_Tr()
{
	var sColor = "#F6F6F6";

	document.writeln("<tr bgcolor=#FFFFFF><td colspan=3 height=5></td></tr>");
	document.writeln("<tr valign=top bgcolor=" + sColor + ">");
}


function WF_TrEnd()
{
	document.writeln("</tr>");
}


function WF_TblEnd()
{
	document.writeln("</table>");

	document.writeln("<br><br>");
}


function WF_Lnks(nId, sUrl, sTitle, bIsFirstRow)
{
	var sTd = ( bIsFirstRow ) ? "<td width=33%>" : "<td>";

	document.writeln(sTd);

	WF_WriteBasic(nId, sUrl, sTitle);

	document.writeln("</td>");
}


function WF_LnkAry
	(nId, sUrl, sTitle, nArrayLinks, bArrayIsRed, sArrayTitle, sArrayDate)
{
	document.writeln("<tr bgcolor=#F8F8F8>");
	document.writeln(" <td>");
	WF_WriteBasic(nId, sUrl, sTitle);
	document.writeln(" </td>");
	document.writeln("</tr>");

	document.writeln("<tr bgcolor=#FFFFFF>");
	document.writeln(" <td><ul>");

	for (i = 0; i < nArrayLinks; i ++)
	{
		document.write("<li>");
		// title
		if (bArrayIsRed[i])
			document.write("<font color=red>");
		document.write(sArrayTitle[i]);
		if (bArrayIsRed[i])
			document.write("</font>");

		// date
		if (sArrayDate[i].length)
			document.write(" <font size=1>[" + sArrayDate[i] + "]</font>");

		document.write("\n");
	}

	document.writeln("  </ul>");
	document.writeln(" </td>");
	document.writeln("</tr>");
}


function WF_LnkLst(nId, sUrl, sTitle)
{
	document.writeln("<li>");

	WF_WriteBasic(nId, sUrl, sTitle);
}


function WF_GroupTbl(nId, sTitle, sWidth, bBigFont)
{
	var sColor = getClrCat(nId, 1);

	document.writeln("<table id='tblMenu" + nId
		+ "' cellspacing=0 cellpadding=2 bgcolor=#FFFFFF style='font: 10pt verdana' width=98% border=0>");
	document.writeln("<tr><td bgcolor=" + sColor + " align=center width=" + sWidth + ">");

	if (bBigFont)
		document.writeln("  <font face=arial color=#FFFFFF size=3 style='font: 12pt'><b>"
			+ sTitle + "</b></font>");
	else
		document.writeln("  <font face=arial color=#FFFFFF size=2 style='font: 10pt'><b>"
			+ sTitle + "</b></font>");
	document.writeln(" </td>");
	document.writeln(" <td width=5><br></td>");
	document.writeln(" <td><ilayer id='Desc_" + nId + "1'><layer id='Desc_" + nId
		+ "2'><div id='Desc_" + nId + "'></div></layer></ilayer></td>");
	document.writeln("</tr>");
	document.writeln("<tr><td valign=top bgcolor="
		+ sColor + " colspan=3 height=1></td></tr>");
	document.writeln("</table>");

	document.writeln("<table id='tbl" + nId
		+ "' cellspacing=0 cellpadding=0 bgcolor=#FFFFFF style='font: 10pt verdana' width=98% border=0>");


	// write something different for "Software.html"
	if (sWidth == "25%")
	{
		document.writeln("<tr valign=top>");
		document.writeln(" <td bgcolor=" + sColor + " width=1><br></td>");

		document.writeln(" <td width=49%>");
		document.writeln(" <table id=Left_" + nId
			+ " cellpadding=0 cellspacing=0 width=100% border=0 style='font: 10pt verdana'>");
	}
}


function WF_RightCell(nId)
{
	var sColor = getClrCat(nId, 1);

	document.writeln("</table>");
	document.writeln("</td>");

	document.writeln("<td bgcolor=" + sColor + " width=1><br></td>");

	document.writeln("<td width=350>");
	document.writeln("<table id=Right_" + nId
		+ " cellpadding=0 cellspacing=0 width=100% border=0 style='font: 10pt verdana'>");
}


function WF_GroupTblEnd(nId)
{
	var sColor = getClrCat(nId, 1);

	document.writeln(" </table>");
	document.writeln(" </td>");

	document.writeln(" <td bgcolor=" + sColor + " width=1><br></td>");
	document.writeln("</tr>");
	document.writeln("</table>");

	document.writeln("<br><br>");
}


// -- used in Working.html
var vUrls   = new Array,
	vTitles = new Array;


function WF_EmptyTr(nSpan)
{
	var nHeight = 10;

	document.writeln("\t<tr><td colspan=" + nSpan + " height=" + nHeight + "></td></tr>");
}


function WF_LinkTr(nId, sURL, sTitle, bIsNotCategory)
{
	if (bIsNotCategory == 0)
	{
		document.writeln("\t<tr bgcolor=#EEEEEE><td colspan=2>&nbsp;" + sTitle + "</td></tr>");
	}
	else
	{
		document.writeln("\t<tr><td><img src=Pic/Arrow/Arrow_" + nId
			+ ".gif width=9 height=9 border=0></td>");
		document.writeln("\t\t<td><a href=" + sURL + ">" + sTitle + "</a></td>");
		document.writeln("\t</tr>");
	}
}


function WF_LinkGroup(nIdGroup, nn)
{
	var nId = parseInt(nIdGroup / 10);

	for (i = 0; i < nn; i ++)
	{
		j = nIdGroup * 10 + i;
		WF_LinkTr(nId, vUrls[j], vTitles[j], i);
	}

	WF_EmptyTr(1);
}


function WF_LinkBest(nId, sName, sUrl, sExtra, sDesc)
{
	var sColor = getClrCat(nId, 1);

	document.writeln("<tr valign=middle>")
	document.writeln("	<td><br></td>")
	document.writeln("	<td align=right><a href=" + sUrl + " onMouseOver=\"WF_Status('" + sDesc + "'); return true;\" onMouseOut=\"WF_Status('')\"><font color=" + sColor + ">" + sName + "</font></a></td>")
	document.writeln("	<td align=center>" + sExtra + "</td>")
	document.writeln("	<td><br></td>")
	document.writeln("	<td><font color=" + sColor + ">" + sDesc + "</td>")
	document.writeln("</tr>")
}

// -- [ End ] ---