﻿function ShowForexRate()
{
	function AddCurrencyRate(Currency, Rate)
	{
		document.writeln('<tr bgcolor="#ffffff"><td class=BoxItem>&nbsp;', Currency, '</td><td class=BoxItem align=right>', Rate, '&nbsp;</td></tr>');
	}
	if (!AddForexHeader('Forex', 'Thu đổi ngoại tệ', 3, PageHost.concat('/Service/thitruong.jpg')))
		return;
		
	function AddCurrencyRate_Header(Currency, Rate)
	{
	    //khuongpq khao Header
		//document.writeln('<tr bgcolor="#397df3" style="height:20px;"><td style="color:#fff;font-weight:bold;font-size:8pt;font-family:arial; text-align:center;">', Currency, '</td><td style="color:#fff;font-weight:bold;font-size:8pt;font-family:arial; text-align:center;">', Rate, '</td></tr>');
		document.writeln('<tr bgcolor="#ffffff" style="height:2px;"><td style="color:#fff;font-weight:bold;font-size:8pt;font-family:arial; text-align:center;">', Currency, '</td><td style="color:#fff;font-weight:bold;font-size:8pt;font-family:arial; text-align:center;">', Rate, '</td></tr>');
	}
		
	//AddCurrencyRate_Header("Mã", "Thu đổi");
	AddCurrencyRate_Header("", "");
	for(var i=0;i<vForexs.length;i++){
		if (typeof(vForexs[i]) !='undefined' && typeof(vCosts[i]) !='undefined'){
		    AddCurrencyRate(vForexs[i], vCosts[i]);
		}
	}
	AddForexFooter();
}
ShowForexRate();

function AddForexHeader(Name, Header, Buttons, Symbol, AddChildTable)
{
	document.writeln('<table width="99%" border=1 cellspacing=0 cellpadding=1 bgcolor="#397df3"><tr><td>');

	if (Header!='')
	{
		document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0 style="border:#d9d8cf solid 0px; height:20px;">');
		document.writeln('<tr >');

		if (typeof(Symbol)!='undefined')
		{
			document.writeln('<td height="16px" class=BoxHeader><img src="', Symbol, '" border=0></td>');
		}

		document.writeln('<td height="16px" width="100%" align=left class=BoxHeader style="color:white;">&nbsp;', Header, '</td>');

		if ((Buttons & 1) && fDSp)
		{
			document.write('<td width="15px" align=right>');
			document.write('<a href="JavaScript:ItemMinimize(\x27', Name, '\x27)">');
			document.write('<img src="/Service/min.gif" id="IDI_', Name, '" border=0 alt="Minimize | Maximize">');
			document.write('</a></td>');
		}

		document.writeln('</tr></table>');
	}

	//document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0 id="tIDM_', Name, '"><tr><td><div class=BreakLine id="IDM_', Name, '">');
	document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0 ><tr><td id="IDM_', Name, '">');
	document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0 ><tr><td style="background-color:#ffffff;">');
	if (typeof(AddChildTable)=='undefined')
	{
		//document.writeln('<marquee onmouseover=this.stop() onmouseout=this.start() scrollAmount=1 scrollDelay=100 height=65 direction=up>');
		document.writeln('<div style="position:related; width:100%;background-color:#ffffff;">');
		document.writeln('<table align=center width="100%" cellspacing=0 cellpadding=0 class="Box">');
		LastChild = 1;
	}
	else
	{
		LastChild = 0;
	}
	return true;
}

function AddForexFooter()
{
	document.writeln('</table>');
	document.writeln('</div>');	
	document.writeln('</td></tr>');
	document.writeln('<tr bgcolor="#397df3"><td colspan=1 class=BoxItem align=center><font color="white"><i>(Ngu&#7891;n: EximBank)</i></font></td></tr>');
	document.writeln('</table>');
	document.writeln('</td></tr></table>');
	document.writeln('</td></tr></table>');
}
