/************************************************/
/*            FUNCTIONS FOR MENU                */
/************************************************/

function setIndexSelectedMenu(nSelectedMenu)
{
	var nCountMenu = m_pMenu.length;
	m_nSelectedMenu = nSelectedMenu;
	if (m_nSelectedMenu  < 0 || m_nSelectedMenu > nCountMenu - 1)
		m_nSelectedMenu = 0;
}

function writeSelectedMenu(nIndex)
{
	document.writeln('<tr>');
	document.writeln('<td align="center" valign="top">');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
	
	if (nIndex > 0) {
		document.writeln('<tr>');
		document.writeln('<td background="images/border/l_line.gif" width="6" align="left">');
		document.writeln('<img border="0" src="images/border/lt_r.gif" width="6" height="6"></td>');
		document.writeln('<td background="images/border/lt_l.gif" colspan="2" align="center" width="184" valign="top">');
		document.writeln('<img border="0" src="images/border/lt_l.gif" width="1" height="6"></td>');
		document.writeln('</tr>');
	}
	
	document.writeln('<tr>');
	document.writeln('<td background="images/border/l_line.gif" width="6" align="left">');
	document.writeln('<img border="0" src="images/border/l_line.gif" width="6" height="1"></td>');
	document.writeln('<td background="images/BG/white.gif" colspan="2" align="center">');
	document.writeln('<div align="center">');
	document.writeln('<center>');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
	document.writeln('<tr>');
	document.writeln('<td width="100%" align="center"><font class="TextSelectedMenu">' + m_pMenu[nIndex][0] + '</font></td>');
	document.writeln('</tr>');
	document.writeln('</table>');
	document.writeln('</center>');
	document.writeln('</div>');
	document.writeln('</td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('<td width="6" align="left" valign="top">');
	document.writeln('<img border="0" src="images/border/lb_rg.gif" width="6" height="9"></td>');
	document.writeln('<td background="images/border/lb_lg.gif" valign="top" width="100%">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
	document.writeln('<td width="1" valign="top"><img border="0" src="images/border/lb_lg.gif" width="1" height="9"></td>');
	document.writeln('</tr>');
	document.writeln('</table>');
    document.writeln('</td>');
	document.writeln('</tr>');
}

function writeIndexMenu(nIndex)
{
	document.writeln('<tr>');
	document.writeln('<td align="center" valign="top">');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
	document.writeln('<tr>');
	document.writeln('<td width="20"><img border="0" src="images/10x10.gif" width="20" height="10"></td>');
	document.writeln('<td align="center" valign="top">');
	document.writeln('<div align="center">');
	document.writeln('<center>');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
	
	if (nIndex > 0) {
		document.writeln('<tr>');
		document.writeln('<td width="6" valign="top"><img border="0" src="images/border/Disable/lt_r.gif" width="6" height="6"></td>');
		document.writeln('<td background="images/border/Disable/lt_l.gif" valign="top">');
		document.writeln('<img border="0" src="images/border/Disable/lt_l.gif" width="1" height="6"></td> ');
		document.writeln('</tr>');
	}
	
	document.writeln('<tr>');
	document.writeln('<td background="images/border/Disable/l_line.gif" width="6">');
	document.writeln('<img border="0" src="images/border/Disable/l_line.gif" width="6" height="1"></td>');
	document.writeln('<td background="images/Bg/D4E5E5.gif" align="center">');
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
	document.writeln('<tr>');
	document.writeln('<td width="100%" align="center">');
  	document.writeln('<a target="' + m_pMenu[nIndex][1] + '" href="' + m_pMenu[nIndex][2] + '"');
  	document.writeln(' onMouseOver="setWindowStatus(\'' + m_pMenu[nIndex][3] + '\'); return (true);"');
  	document.writeln(' onMouseOut="setWindowStatus(\'\');" class="menu">' + m_pMenu[nIndex][0] + '</a></td>');
  	document.writeln('</tr>');
  	document.writeln('</table>');
  	document.writeln('</td>');
  	document.writeln('</tr>');
  	document.writeln('<tr>');
  	document.writeln('<td background="images/border/Disable/lb_r.gif" width="6" valign="top">');
  	document.writeln('<img border="0" src="images/border/Disable/lb_r.gif" width="6" height="6"></td>');
  	document.writeln('<td background="images/border/Disable/lb_l.gif" valign="top">');
  	document.writeln('<img border="0" src="images/border/Disable/lb_l.gif" width="1" height="6"></td>');
  	document.writeln('</tr>');
  	document.writeln('</table>');
  	document.writeln('</center>');
  	document.writeln('</div>');
  	document.writeln('</td>');
  	document.writeln('</tr>');
	document.writeln('</table>');
    document.writeln('</td>');
	document.writeln('</tr>');
	document.writeln('</tr>');
}

function writeTableMenu()
{
	var i = 0;
	var nCountMenu = m_pMenu.length;
	
	document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="190">');
	for (i=0; i<nCountMenu; i++) {
		if (i == m_nSelectedMenu)
			writeSelectedMenu(i);
		else {
			writeIndexMenu(i);
			if (i != nCountMenu - 1) {
				document.writeln('<tr>');
				document.writeln('<td align="center" valign="top"><img border="0" src="images/1x1.gif" width="1" height="1"></td>');
				document.writeln('</tr>');
			}
		}
	}
	document.writeln('</table>');
}

function writeSelectedHeightMenu(nIndex)
{
	if (nIndex > 0) {
		document.writeln('<tr>');
		document.writeln('<td align="left" width="1" valign="top">');
		document.writeln('<img border="0" src="images/border/lt_l.gif" width="1" height="6"></td>');
		document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
		document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
		document.writeln('</tr>');
	}
	
	document.writeln('<tr>');
	document.writeln('<td background="images/BG/white.gif" align="left" width="1" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
	document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
	document.writeln('<font class="TextHeightMenu">' + m_pHeightMenu[nIndex] + '</font></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('<td align="left" width="1" valign="top">');
	document.writeln('<img border="0" src="images/border/Select/lb_l1.gif" width="1" height="9"></td>');
	document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
	document.writeln('</tr>');
}

function writeIndexHeightMenu(nIndex)
{
	if (nIndex > 0) {
		document.writeln('<tr>');
		document.writeln('<td align="left" width="1" valign="top">');
		document.writeln('<img border="0" src="images/1x1.gif" width="1" height="6"></td>');
		document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
		document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
		document.writeln('</tr>');
	}

	document.writeln('<tr>');
	document.writeln('<td background="images/BG/black.gif" align="left" width="1" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
	document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
	document.writeln('<font class="TextHeightMenu">' + m_pHeightMenu[nIndex] + '</font></td>');
	document.writeln('</tr>');
	document.writeln('<tr>');
	document.writeln('<td align="left" width="1" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="6"></td>');
	document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
	document.writeln('</tr>');
}

function writeTableHeightMenu()
{
	var i = 0;
	var nCountMenu = m_pHeightMenu.length;
	for (i=0; i<nCountMenu; i++) {
		if (i == m_nSelectedMenu)
			writeSelectedHeightMenu(i);
		else {
			writeIndexHeightMenu(i);
			
			document.writeln('<tr>');
			document.writeln('<td align="left" width="1" valign="top">');
			document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
			document.writeln('<td background="images/BG/white.gif" align="center" width="20" valign="top">');
			document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
			document.writeln('</tr>');
		}
	}	
}

function writeTablePrintVersion()
{
	if (m_pMenu[m_nSelectedMenu][5].length > 0) {
		document.writeln('<td width="35%" align="left" valign="top">');
		document.writeln('<table border="0" cellpadding="0" cellspacing="0"width="100%">');
		document.writeln('<tr>');
		document.writeln('<td width="100%" colspan="5"><img border="0" src="images/20x20.gif" width="20" height="20"></td>');
		document.writeln('</tr>');
		document.writeln('<tr>');
		document.writeln('<td width="50%" rowspan="2"><img border="0" src="images/10x10.gif" width="10" height="10"></td>');
		document.writeln('<td width="29" rowspan="2"><img border="0" src="images/border/l_45.gif" width="29" height="29"></td>');
		document.writeln('<td background="images/border/lt_l.gif" width="156">');
		document.writeln('<img border="0" src="images/1x1.gif" width="156" height="1"></td>');
		document.writeln('<td width="9"><img border="0" src="images/border/rt_rg.gif" width="9" height="6"></td>');
		document.writeln('<td width="20" rowspan="2"><img border="0" src="images/1x1.gif" width="20" height="1"></td>');
		document.writeln('</tr>');
		document.writeln('<tr>');
		document.writeln('<td width="156">');
		document.writeln('<div align="center">');
		document.writeln('<center>');
		document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
		document.writeln('<tr>');
		document.writeln('<td width="30%" align="right">');
		
		var szTarget = '';
		if (m_pMenu[m_nSelectedMenu][4].length > 0)
			szTarget = ' target="' + m_pMenu[m_nSelectedMenu][4] + '"';
			
		document.writeln('<a' + szTarget + ' href="' + m_pMenu[m_nSelectedMenu][5] + '"');
		document.writeln(' onMouseOver="setWindowStatus(\' Print version of document...\'); return (true);"');
		document.writeln(' onMouseOut="setWindowStatus(\'\');"><img border="0" src="images/pv2.gif" width="16" height="14"></a></td>');
		document.writeln('<td width="3"><img border="0" src="images/3x3.gif" width="10" height="17"></td>');
		document.writeln('<td width="69%">');
		document.writeln('<a target="' + m_pMenu[m_nSelectedMenu][4] + '" href="' + m_pMenu[m_nSelectedMenu][5] + '"');
		document.writeln(' onMouseOver="setWindowStatus(\' Print version of document...\'); return (true);"');
		document.writeln(' onMouseOut="setWindowStatus(\'\');" class="printversion">Print version...</a></td>');
		document.writeln('</tr>');
		document.writeln('<tr>');
		document.writeln('<td width="99%" align="right" colspan="3">');
		document.writeln('<img border="0" src="images/3x3.gif" width="3" height="3"></td>');
		document.writeln('</tr>');
		document.writeln('</table>');
		document.writeln('</center>');
		document.writeln('</div>');
		document.writeln('</td>');
		document.writeln('<td background="images/border/r_line.gif" width="9">');
		document.writeln('<img border="0" src="images/1x1.gif" width="9" height="23"></td>');
		document.writeln('</tr>');
		document.writeln('</table>');
		document.writeln('</td>');
	}
	else
		document.writeln('<td width="35%">&nbsp;</td>');
}

function writeTopBorderMenu()
{
	if (m_nSelectedMenu == 0) {
		document.writeln('<td width="6" valign="top"><img border="0" src="images/border/lt_r.gif" width="6" height="6"></td>');
		document.writeln('<td background="images/border/lt_l.gif" align="left" width="184" valign="top">');
		document.writeln('<img border="0" src="images/border/lt_l.gif" width="1" height="6"></td>');
	}
	else {
		document.writeln('<td align="center" width="20"><img border="0" src="images/1x1.gif" width="20" height="1"></td>');
		document.writeln('<td width="6" valign="top">');
		document.writeln('<img border="0" src="images/border/Disable/lt_r.gif" width="6" height="6"></td>');
		document.writeln('<td background="images/border/Disable/lt_l.gif" width="164" valign="top">');
		document.writeln('<img border="0" src="images/border/Disable/lt_l.gif" width="1" height="6"></td>');
	}
}

function writeTopBorderInfTable()
{	
	document.writeln('<td background="images/Bg/black.gif" width="1" align="left" valign="top">');
	if (m_nSelectedMenu == 0)
		document.writeln('<img border="0" src="images/border/lt_l.gif" width="1" height="6"></td>');
	else
		document.writeln('<img border="0" src="images/1x1.gif" width="1" height="1"></td>');
                              
	document.writeln('<td background="images/border/lt_l.gif" align="center" valign="top">');
	document.writeln('<img border="0" src="images/border/lt_l.gif" width="1" height="6"></td>');
                              
	var szBgPV = ' background="images/border/lt_l.gif"';
	var szImgRight = 'rt_rg';
	if (m_pMenu[m_nSelectedMenu][5].length > 0) {
		szBgPV = ' background="images/Bg/white.gif"';
		szImgRight = 'r_line';
	}
	document.writeln('<td'+ szBgPV + ' width="185" align="center" valign="top">');
	document.writeln('<img border="0" src="images/1x1.gif" width="185" height="6"></td>');
                              
	document.writeln('<td background="images/border/' + szImgRight + '.gif" width="9" align="right" valign="top">');
	document.writeln('<img border="0" src="images/border/' + szImgRight + '" width="9" height="1"></td>');
}
