﻿var ext_sub_id = null,ext_sub_id_active = null,ext_sub_timer = null,timerpopupalert = null;
function activePager(i){$("div.pages").find("a").each(function(){if($(this).html()==i)$(this).addClass("pageractive");else $(this).removeClass("pageractive");});}
function viewNavigator(id,tag){if(tag==1){if(ext_sub_timer!=null){ clearTimeout(ext_sub_timer);ext_sub_timer=null;}$(id).show();}else if(tag==2){$(id).hide();}else if(tag==0){ext_sub_timer = setTimeout('viewNavigator("'+id+'",2)',200);}else{if(ext_sub_timer!=null){ clearTimeout(ext_sub_timer);ext_sub_timer=null;}}}
function GetBody() {return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;}
function InitPopupAlert() {var objPopup = document.getElementById('divPopupMsg').style;var objTmp = document.getElementById('bgTran');if (objPopup == null || objTmp == null)setTimeout('InitPopupAlert()', 100);document.getElementById('lpopupmsg').innerHTML = msgtext;var scrlltop = '';if (document.documentElement && document.documentElement.scrollTop) {scrlltop = document.documentElement.scrollTop;}else if (document.body) {scrlltop = document.body.scrollTop;}objTmp.style.top = (parseInt((GetBody().clientHeight - 155) / 2) + GetBody().scrollTop) + 'px';objTmp.style.display = '';objPopup.left = (objTmp.offsetWidth - 450) / 2 + 'px';objPopup.top = (objTmp.offsetTop + 20) + 'px';objPopup.display = '';if (timerpopupalert != null)clearTimeout(timerpopupalert);TimerPopupAlert(9);}
function ClosePopupAlert() {document.getElementById('divPopupMsg').style.display = 'none';document.getElementById('bgTran').style.display = 'none';clearTimeout(timerpopupalert);}
function TimerPopupAlert(second) {if (second < 1) {ClosePopupAlert();return;}document.getElementById('stimer').innerHTML = second;second--;timerpopupalert = setTimeout('TimerPopupAlert(' + second + ');', 1000);}
function InitPopupContent(alert, close) {document.writeln('<div id=\"bgTran\" style=\"height: 155px; width: 100%; position: absolute; left: 0px;top: 300px; background-color: #bdf0a1; opacity: 0.5; filter: alpha(opacity = 50);z-index: 999; display:none;\">&nbsp;</div>');document.writeln('<div style=\"border: solid 1px #9fe302; position: absolute; top: 0px; left: 0px; background-color: #e5fbcc; width: 450px; height: 110px; display: none; z-index: 1000; color:#000000\" id=\"divPopupMsg\"><div style=\"padding: 5px; height: 20px; background-color: #9fe302;\"><div style=\"float:left; width:325px; font-weight:bold;\">' + alert + '</div><div style=\"float:left; width:55px;\"><span id=\"stimer\">3</span>...</div><div style=\"float:right; width:60px;text-align:right\">[<a href=\"javascript:ClosePopupAlert();\">' + close + '</a>]</div><br style=\"clear:both\" /></div><div id=\"lpopupmsg\" style=\"height:70px; padding:10px;\"></div></div>');}
function viewSub(id,t){if(id==undefined){clearTimeout(ext_sub_timer);ext_sub_timer=null;}else if(t==1){if(ext_sub_timer!=null){ clearTimeout(ext_sub_timer);ext_sub_timer=null;}if($("#d_sub_"+id).is(":empty")==false){$("#d_sub_"+id).slideDown(500,function(){$("div#w_tab").find(".sub-menu:visible").each(function(){if($(this).attr("id")!="d_sub_"+id){$(this).hide().prev().removeClass("mnpro-text-hover");} });}).prev().addClass("mnpro-text-hover");}}else if(t==0){if(ext_sub_id != null){if(ext_sub_timer==null){ext_sub_timer = setTimeout('viewSub("'+id+'",'+t+')',2000);}else{clearTimeout(ext_sub_timer);ext_sub_timer=null;$("#d_sub_"+id).hide().prev().removeClass("mnpro-text-hover");$("#d_sub_"+ext_sub_id).show();}}}}
function displayInfo(info)
{
	if (info == 'weather')
		showWindow('http://www3.tuoitre.com.vn/Transweb/Weather.aspx', 550, 550, 0, 0);
	if (info == 'forex')	
	    showWindow('http://www.tuoitre.com.vn/tianyon/transweb/TyGia.htm', 800, 550, 0, 0);
	if (info == 'gold')
		showWindow('http://www3.tuoitre.com.vn/transweb/giavang.htm', 500, 300, 0, 0);
}
function showWindow(url, width, height, top, left)
{
	top = (screen.height - height) / 2;
	left = (screen.width - width) / 2;
	open(url, '_blank','width=' + width + ',' + 'height=' + height + ',' + 'top=' + top + ',' + 'left=' + left);
}