/* Draws forums on the right sidebar */
function writeForums() {

	//Get the list of five latest forum names...
	var frm = document.forms[0];
	var latest_forums_array = frm.ForumInfo.value.split( "$" );

	//if there are no forums, don't draw anything...
	if ( latest_forums_array != "" ) {
		
		//write the header to the forums part...
		document.write( '<TABLE width="161" border="0" cellspacing="0" cellpadding="0">' );
		document.write( '<TBODY>' );
		document.write( '<TR>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="5"><IMG src="../Files/px/$file/px.gif" width="5" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" height="17" class="text" width="145"><B>' + document.forms[0].term4.value + '</B></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="5"><IMG src="../Files/px/$file/px.gif" width="5" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '</TR>' );
		document.write( '<TR>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD width="145"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '</TR>' );
		document.write( '<TR>' );
		document.write( '<TD bgcolor="DDDDE5" width="1" height="14"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD width="5" height="14">&nbsp;</TD>' );
		document.write( '<TD width="145" height="14" align="right" class="red">' );
		document.write( '<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">' );
		document.write( '<TBODY>' );
		
		//write the forum topics table...
		var forum_parts;
		for ( var i = 0; i < latest_forums_array.length; i++ ) {
		
			//get the forum name and alias....
			forum_parts = latest_forums_array[ i ].split( "|" );
			forum_name = forum_parts[0];
			forum_link = forum_parts[1];
		
			document.write( '<TR align="left" valign="top">' );
			document.write( '<TD width="15"><IMG src="../Files/px/$file/px.gif" width="1" height="2"><BR>' );
			document.write( '<IMG src="../Files/happy/$file/happy.gif" width="9" height="9"></TD>' );
			document.write( '<TD class="fmenu"><A href="' + forum_link + '">' + forum_name + '</A></TD>' );
			document.write( '</TR>' );
			
			//if its not the last forum row, draw an empty ron in the middle...
			if ( i < ( latest_forums_array.length - 1 ) ) {
				document.write( '<TR align="left" valign="top">' );
				document.write( '<TD width="15">&nbsp;</TD>' );
				document.write( '<TD>&nbsp;</TD>' );
				document.write( '</TR>' );
			}
		
		}
		
		//get the link to the forums main page...
		forums_main_page_key = frm.ForumsPageKey.value;
		
		//write the reamining of the latest forums table...
		document.write( '</TBODY>' );
		document.write( '</TABLE>' );
		document.write( '<P><A href="' + forums_main_page_key + '"><IMG src="../Files/arrow/$file/arrow.jpg" width="4" height="7" border="0"></A> <A href="' + forums_main_page_key + '">' + document.forms[0].term5.value + '</A></P>' );
		document.write( '</TD>' );
		document.write( '<TD width="5" height="14">&nbsp;</TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="1" height="14"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '</TR>' );
		document.write( '<TR>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD width="145"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="5"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '</TR>' );
		document.write( '<TR>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="145"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="5"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '<TD bgcolor="DDDDE5" width="1"><IMG src="../Files/px/$file/px.gif" width="1" height="1"></TD>' );
		document.write( '</TR>' );
		document.write( '</TBODY>' );
		document.write( '</TABLE>' );
		document.write( '<IMG src="../Files/px/$file/px.gif" width="1" height="1">' );

	}
	
}