﻿// JScript File code by blackyaa

var var1 = '<tr><td align="left" style="background-color:#F9FAFB;font-size:11px;line-height:16px;padding:0px 5px 0px 5px; width: 70px">';//background-color:#99CCCC;color:#006699;
var var2 = '</td><td nowrap align="right" style="background-color:#F9FAFB;font-size:11px;line-height:16px;color:#006699;padding:0px 5px 0px 5px; width: 70px;">';
var var3 = '</td><td align="right" style="background-color:#F9FAFB;font-size:11px;color:#006699;padding:0px 5px 0px 5px; width: 70px;">';

var title1 = '<TABLE cellSpacing="0" cellPadding="6" width="100%" border="0"><TR><TD class="VoteTitle" vAlign="middle" align="center">Giá vàng 9999</TD></TR></TABLE>';//background-color:#99CCCC;color:#006699;
var title2 = '<TABLE cellSpacing="0" cellPadding="6" width="100%" border="0"><TR><TD class="VoteTitle" vAlign="middle" align="center">Thời tiết</TD></TR></TABLE>';//background-color:#99CCCC;color:#006699;


var _forex_price='Giá ngoại tệ';
var _gold_price='Giá vàng 9999';
var _weather='Thời tiết';
var _sell='Bán';
var _buy='Mua';

function AddFooter()
{
    document.writeln('</table>');
}

function AddHeader(h)
{
    document.writeln('<table border="0" cellpadding="5" cellspacing="1" bgcolor="#ffffff" style="border-collapse:collapse; width: 100%;">');
}

function ShowForexRate()
{
	function AddCurrencyRate(Currency, Rate)
	{
		document.writeln(var1, Currency, var2, Rate, '</td></tr>');
	}
    
    AddHeader(_forex_price + "");
    
   
   if (typeof(vForex1) !='undefined' && typeof(vCost1) !='undefined') AddCurrencyRate(vForex1, vCost1);
	if (typeof(vForex2) !='undefined' && typeof(vCost2) !='undefined') AddCurrencyRate(vForex2, vCost2);
	if (typeof(vForex10)!='undefined' && typeof(vCost10)!='undefined') AddCurrencyRate(vForex10, vCost10);
    if (typeof(vForex7) !='undefined' && typeof(vCost7) !='undefined') AddCurrencyRate(vForex7, vCost7);    
    if (typeof(vForex4) !='undefined' && typeof(vCost4) !='undefined') AddCurrencyRate(vForex4, vCost4);
    if (typeof(vForex6) !='undefined' && typeof(vCost6) !='undefined') AddCurrencyRate(vForex6, vCost6);
    if (typeof(vForex8) !='undefined' && typeof(vCost8) !='undefined') AddCurrencyRate(vForex8, vCost8);
	AddFooter();
}

function ShowGoldPrice()
{
    AddHeader(_gold_price + "");

	function AddGoldPrice(Currency, Rate)
	{
		document.writeln(var1, Currency, var2, Rate, ' đ</td></tr>');
	}
	
	if (typeof(vGoldBuy) !='undefined') AddGoldPrice(_sell + "", vGoldSell);
	if (typeof(vGoldSell)!='undefined') AddGoldPrice(_buy + "", vGoldBuy);
	
	AddFooter();
}

function ShowWeather()
{
    AddHeader(_weather + "");

	function AddCityWeather(City, Degree)
	{
		document.writeln(var1, City, var3, Degree, ' <sup>o</sup>C</td></tr>');
	}
	
	if (typeof(vHanoi)!='undefined'     && typeof(dHanoi)    !='undefined') AddCityWeather(vHanoi, dHanoi);
	if (typeof(vHaiPhong)!='undefined'       && typeof(dHaiPhong)      !='undefined') AddCityWeather(vHaiPhong, dHaiPhong);
	if (typeof(vDaNang)!='undefined'    && typeof(dDaNang)   !='undefined') AddCityWeather(vDaNang, dDaNang);
	if (typeof(vHoChiMinh)!='undefined' && typeof(dHoChiMinh)!='undefined') AddCityWeather(vHoChiMinh, dHoChiMinh);
	
	AddFooter();
}

function AddTitleHeader(Title)
{
	document.writeln(Title);
}

//ShowForexRate();
//AddTitleHeader(title1)
//ShowGoldPrice();
AddTitleHeader(title2)
ShowWeather();