﻿//============Thoi Tiet
var strDomain = 'http://hmweb.com.vn/';
var strwebname='hmweb';
function ShowWeather()
{
	function AddCityWeather(City, Degree)
	{
		document.writeln('<tr><td class=TDbanner  bgcolor="#FFFFFF" align=left>&nbsp;&nbsp;', Trim(City) , '</td><td class=TDbanner bgcolor="#FFFFFF" align=left>&nbsp;&nbsp;', Trim(Degree), '</td></tr>');

	}

	if (!AddHeader('Weather', 'Th&#7901;i ti&#7871;t', 3, PageHost.concat(strDomain+'Images/cloud.gif')))
	return;

	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 XemGiaVang()
{
    
    if (!AddHeader('GiaVang', 'Gi&aacute; v&agrave;ng', 3, PageHost.concat(strDomain+'Images/GiaVang.gif')))
	return;
	try
	{
	    if (typeof vGoldSjcBuy != "undefined")
	    	document.writeln('<tr><td class=TDbanner  bgcolor="#FFFFFF" align=left>&nbsp;&nbsp;Mua</td><td class=TDbanner  bgcolor="#FFFFFF" align=left>&nbsp;' + vGoldSjcBuy + '</td></tr>');
	    if (typeof vGoldSjcSell != "undefined")
	    	document.writeln('<tr><td class=TDbanner  bgcolor="#FFFFFF" align=left>&nbsp;&nbsp;Bán</td><td class=TDbanner  bgcolor="#FFFFFF" align=left>&nbsp;' + vGoldSjcSell + '</td></tr>');
	}
	catch (error)
	{
	    document.writeln('<tr><td colspan="2" class=TDbanner  bgcolor="#FFFFFF" align=left><a href='+strDomain+'>'+strDomain+'</a></td></tr>');
	}
	document.write('<tr><td colspan="2" class=TDbanner  bgcolor="#FFFFFF" align=left><i>(Nguồn: Cty SJC Hà Nội)</i></td></tr>');
	AddFooter();
}
function XemTyGiaNgoaiTe()
{
   if (!AddHeader('TyGiaNgoaiTe', 'T&#7927; gi&aacute;', 3, PageHost.concat(strDomain+'Images/tygia.gif')))
	return;
	try
	{
		for(i in vForexs){
			if (typeof vForexs[i] != "undefined")
		    	document.write('<tr><td  class=TDbanner  bgcolor="#FFFFFF" align=center>' + vForexs[i] + '</td><td class=TDbanner  bgcolor="#FFFFFF" align=right>' + vCosts[i] + '&nbsp;&nbsp;</td></tr>');
	    }
	}
	catch (error)
	{
	    document.write('<tr><td colspan="2" class=TDbanner  bgcolor="#FFFFFF" align=left><a href='+strDomain+'>'+strDomain+'</a></td></tr>');
	    
	}
	document.write('<tr><td colspan="2" class=TDbanner  bgcolor="#FFFFFF" align=left><i>(Nguồn: Ngân hàng Ngoại thương VN)</i></td></tr>');
 	AddFooter();
}
 
 

function AddForexHeader(Name, Header, Buttons, Symbol, AddChildTable)
{
	document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="#1E5C99"><tr><td>');

	if (Header!='')
	{
		document.writeln('<table width="100%" border=0 cellspacing=0 cellpadding=0>');
		document.writeln('<tr>');

		if (typeof(Symbol)!='undefined')
		{
			document.writeln('<td ><img src="', Symbol, '" border=0></td>');
		}

		document.writeln('<td  width="100%" align=center >&nbsp;', Header, '</td>');

		if ((Buttons & 1) && fDSp)
		{
			document.write('<td align=right>');
			document.write('<a href="JavaScript:ItemMinimize(\x27', Name, '\x27)">');
			document.write('<img src="images/min.gif" name="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>');
	if (typeof(AddChildTable)=='undefined')
	{
		document.writeln('<div style="position:related; overflow-y: scroll;height:82;width:100%;">');
		document.writeln('<table align=center width="100%" cellspacing=0 cellpadding=0 border=1>');
		LastChild = 1;
	}
	else
	{
		LastChild = 0;
	}
	return true;
}

function AddForexFooter()
{
	document.writeln('</table>');
	document.writeln('</div>');
	document.writeln('</td></tr>');
	document.writeln('<tr bgcolor="#ffffff"><td colspan=1 class=thongtin_ align=center><i>(Ngu&#7891;n: Ng&#226;n h&#224;ng<br> Ngo&#7841;i th&#432;&#417;ng VN)</td></tr>');
	document.writeln('</table>');
	document.writeln('</td></tr></table>');
	document.writeln('</td></tr></table>');
}


function OpenWindow(URL,name,width,height) 
 {
    params = '';
    popCenterWin = window.open(URL, name, params + 'width=' + width + ', height=' + height + ', location=0,status=0,scrollbars=1;resizable: Yes');
    popCenterWin.focus();
    //return false;

 }
 
 function OpenWindowStatus(URL,name,width,height) 
 {
    params = '';
    popCenterWin = window.open(URL, name, params + 'width=' + width + ', height=' + height + ', location=0,status=1,scrollbars=1;resizable: Yes');
    popCenterWin.focus();
    //return false;

 }
 
 
 
 function switchActive(i){
    if(i == 0){
        document.getElementById('cHoSTC').className = 'cActive';
        document.getElementById('cHaSTC').className = 'cNoActive';
        document.getElementById('aHoSTC').className = 'Active';
        document.getElementById('aHaSTC').className = 'NoActive';
    }
    else{
        document.getElementById('cHoSTC').className = 'cNoActive';
        document.getElementById('cHaSTC').className = 'cActive';
        document.getElementById('aHoSTC').className = 'NoActive';
        document.getElementById('aHaSTC').className = 'Active';
    }
}
function LoadNoneDisplayTitle()
{
    switch(suburl(window.location.pathname))
    {
        case "sitemap.aspx":
          document.getElementById('ctl00_lblFormTitle').innerHTML="<a href='http://"+window.location.host+window.location.pathname+"'>Sơ đồ trang</a>";
          break;
        case "lienhe.aspx":
          document.getElementById('ctl00_lblFormTitle').innerHTML="<a href='http://"+window.location.host+window.location.pathname+"'>Liên hệ</a>";
          break;
        case "gioithieu.aspx":
          document.getElementById('ctl00_lblFormTitle').innerHTML="<a href='http://"+window.location.host+window.location.pathname+"'>Giới thiệu</a>";
          SetTitle(strwebname+' - Tin tức | Học tập | Lập trình | Giải trí | Thư viện website');
          break;
        case "danhbaw.aspx":
          document.getElementById('ctl00_lblFormTitle').innerHTML="<a href='http://"+window.location.host+window.location.pathname+"'>Danh bạ Website</a>";
          SetTitle(strwebname+' - Danh bạ Webstie | Tra cứu website | Thư viện website');
          break;
          
        default:
            document.getElementById('divFormTitle').style.display ="none";//.innerHTML="<a href='http://"+window.location.host+window.location.pathname+"'>Trang chủ</a>";
            SetTitle(strwebname+' :: Chia sẻ là niềm vui -  Học tập | Lập trình | Giải trí ');
            break;
    }
 }
function suburl(val){            
var arrIDs = val.split('/');    
    val='';           
//                for(var i=0;i<arrIDs.length-1;i++)     
//                {      
//                    val+=arrIDs[i]+'/';
//                }     
    val+=arrIDs[arrIDs.length-1];             
    return val;
}
//           function GetHostName()
//            {   
//            alert('http://'+window.location.host+window.location.pathname);
//           }
function SetTitle(titlevalue)
{
    document.title=titlevalue;
}



function printDocument()
{
            
        //myMask.style.display = 'block'; 
        //document.all[obj].style.visibility = 'hidden';
            var OLECMDID = 7;
        /* OLECMDID values:
            * 6 - print
            * 7 - print preview
            * 1 - open window
            * 4 - Save As
        */
        var PROMPT = 2; // 2 DONTPROMPTUSER 
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
        WebBrowser1.ExecWB(OLECMDID, PROMPT);
        WebBrowser1.outerHTML = "";
 
 }
 
 
function MoToanManHinh(URL)
 {
	popCenterWin = window.open(URL,"","fullscreen, scrollbars");
	popCenterWin.focus();
}

