/*

*.*.* TTVN - mang thong tin tri tue Vietnam - music news - JS file. Not for remaking*.*.*
Scripts'reboken@dynamicdrive

*/

function navBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
//This defines rollover color
				tableCellRef.style.backgroundColor = '#6AC1E5';
				break;
			default:
//tableCellRef.style.backgroundColor = '#ccc';
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#0C7998';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
//This defines return color
				tableCellRef.style.backgroundColor = '#0C7998';
				break;
			default:
//tableCellRef.style.backgroundColor = '#ddd';
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#0C7998';
				}
		}
	}
}

function TopNavBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
//This defines rollover color
				tableCellRef.style.backgroundColor = '#0000AF';
				break;
			default:
//tableCellRef.style.backgroundColor = '#ccc';
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#0000AF';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
//This defines return color
				tableCellRef.style.backgroundColor = '#5454E5';
				break;
			default:
//tableCellRef.style.backgroundColor = '#ddd';
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#5454E5';
				}
		}
	}
}

// This script is broken by Kyo @ CoffeeStation. For TTVN.net only. Do not distribute.
var img=new Array()
img[0]='<img src="../home_files/images/toplinkimg1.jpg" height="188" width="160" hspace="5">'
img[1]='<img src="../home_files/images/toplinkimg2.jpg" height="188" width="160" hspace="5">'
img[2]='<img src="../home_files/images/toplinkimg3.jpg" height="188" width="160" hspace="5">'
img[3]='<img src="../home_files/images/toplinkimg4.jpg" height="188" width="160" hspace="5">'
img[4]='<img src="../home_files/images/toplinkimg5.jpg" height="188" width="160" hspace="5">'

function gen(){
window.location.reload()
}
function gen2(){
if (document.layers){
appear()
setTimeout("window.onresize=gen",450)
}
}

function changeimg(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById? document.getElementById("descriptions"):document.all.descriptions
cross_el.innerHTML=''+whichcontent+''
}
else if (document.layers){
document.d1.document.d2.document.write(''+whichcontent+'')
document.d1.document.d2.document.close()
}

}

function appear(){
document.d1.visibility='show'
}
window.onload=gen2;

//Kyo's comment: Rolling func.
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=75
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=25
else if (window.highlighting)
clearInterval(highlighting)
}

// Topnavigation_rollvereffects
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		over_db_topnav_2 = newImage(/*URL*/'../images/db_topnav_up_01.gif');
		over_db_topnav_3 = newImage(/*URL*/'../images/db_topnav_up_02.gif');
		over_db_topnav_4 = newImage(/*URL*/'../images/db_topnav_up_03.gif');
		over_db_topnav_5 = newImage(/*URL*/'../images/db_topnav_up_04.gif');
		over_db_topnav_6 = newImage(/*URL*/'../images/db_topnav_up_05.gif');
		over_db_topnav_7 = newImage(/*URL*/'../images/db_topnav_up_06.gif');
		over_db_topnav_8 = newImage(/*URL*/'../images/db_topnav_up_07.gif');
		over_db_topnav_9 = newImage(/*URL*/'../images/db_topnav_up_08.gif');
		preloadFlag = true;
	}
}

// End of topnavigation effects bar.

function displayInfo(info)
{
	if (info == 'weather')
		showDialog('http://www3.tuoitre.com.vn/Transweb/Weather.aspx', 550, 565);
	if (info == 'forex')	
	    showDialog('http://www.tuoitre.com.vn/tianyon/transweb/TyGia.htm', 305, 415);
	    //showDialog('http://www.eximbank.com.vn/vietnam/exchange.aspx', 460, 432);
		//showDialog('http://www3.tuoitre.com.vn/transweb/tygia.htm', 460, 432);
	if (info == 'gold')
		showDialog('http://www3.tuoitre.com.vn/transweb/giavang.htm', 450, 220);
	if (info == 'tvguide')
		showWindow('http://www3.tuoitre.com.vn/transweb/truyenhinh.htm', false, false, true, false, false, false, true, true, 450, 354, 0, 0);
	if (info == 'lottery')
	    showWindow('http://kqxs.vn/index.htm', false, false, true, false, false, false, true, true, 810, 800, 0, 0);	
	    //showDialog('http://www.tuoitre.com.vn/tianyon/transweb/xoso.htm', 400, 665);
	    //showWindow('http://www.xosobinhduong.com.vn/Forms/xemkq_tt.aspx', false, false, true, false, false, false, true, true, 450, 600, 0, 0);
		//showWindow('http://www3.tuoitre.com.vn/Transweb/XoSo.html', false, false, true, false, false, false, true, true, 450, 600, 0, 0);
		//showDialog('http://www3.tuoitre.com.vn/transweb/xoso.htm', 600, 346);
		//showDialog('http://www.xsktcantho.com.vn/xsktcantho.asp', 1024, 1350);
	if (info == 'stock_ho')
		showWindow('http://www3.tuoitre.com.vn/transweb/chungkhoan_ho.htm', false, false, true, false, false, false, true, true, 770, 770);
	if (info == 'stock_ha')
		showWindow('http://www3.tuoitre.com.vn/transweb/chungkhoan_ha.htm', false, false, true, false, false, false, true, true, 770, 770);	
}

function showDialog(url, width, height)
{
	return showWindow(url, false, false, false, false, false, false, true, true, width, height, 0, 0);
}

function showWindow(url, isStatus, isResizeable, isScrollbars, isToolbar, isLocation, isFullscreen, isTitlebar, isCentered, width, height, top, left)
{
	if (isCentered)
	{
		top = (screen.height - height) / 2;
		left = (screen.width - width) / 2;
	}

	open(url, '_blank', 'status=' + (isStatus ? 'yes' : 'no') + ','
	+ 'resizable=' + (isResizeable ? 'yes' : 'no') + ','
	+ 'scrollbars=' + (isScrollbars ? 'yes' : 'no') + ','
	+ 'toolbar=' + (isToolbar ? 'yes' : 'no') + ','
	+ 'location=' + (isLocation ? 'yes' : 'no') + ','
	+ 'fullscreen=' + (isFullscreen ? 'yes' : 'no') + ','
	+ 'titlebar=' + (isTitlebar ? 'yes' : 'no') + ','
	+ 'height=' + height + ',' + 'width=' + width + ','
	+ 'top=' + top + ',' + 'left=' + left);
}
