﻿var highlightbehavior="TR"

var ns6=document.getElementById&&!document.all
var ie=document.all
	

function changeto(e,highlightcolor){
	source=ie? event.srcElement : e.target
	if (source.tagName=="TABLE")
	return
	while(source.tagName!=highlightbehavior && source.tagName!="HTML")
	source=ns6? source.parentNode : source.parentElement
		
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore"){
		source.style.backgroundColor=highlightcolor;
	}
}


function changeback(e,originalcolor){
	if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
	return
	else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
	return
	if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
	source.style.backgroundColor=originalcolor;
}
function m_bank_datetime(){
//	serverdate();clock1();clock2();clock3();clock4();clock5();clock6();fn47();	
	m_myclock();
}

/**********************************************************************/
function displayobj(objName){
	var obj = document.getElementById(objName);
	if(obj != null){
		if(obj.style.display == 'none'){
			obj.style.display = 'block';
		}
		else{
			obj.style.display = 'none';
		}
	}
}
/**********************************************************************/
/**********************************************************************/
function doViewByDate(){
	var obj = document.frmExh;
	var vDay = obj.vDay.value;
	var vMonth = obj.vMonth.value;
	var vYear = obj.vYear.value;
	vDate = vMonth + '/' + vDay + '/' + vYear;
	getExchRateByDate(vDate);
	obj = null;
}
/**********************************************************************/
function getExchRateByDate(curDate){
	
	var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	var szURL = "XML_GetExchangeRateByDate.asp";
	var szRequest = curDate;
	var szHttpMethod = "POST";
	objHTTP.Open(szHttpMethod, szURL, false);
	objHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	objHTTP.Send(szRequest);
	var szReply = objHTTP.ResponseText;
	if (szReply != 'false'){
		var splitpos = szReply.search(String.fromCharCode(27));
		strExchRate = szReply.substring(0, splitpos);
		strDate = szReply.substring(splitpos + 1, szReply.length);
		div_Exch.innerHTML = strExchRate;				
		
	}
	objHTTP = null;	
}
/**********************************************************************/
function changeto(obj,strClass){
	if(strClass!=""){
		obj.className = strClass;
	}
}
function runto(obj,strClass){
	if(strClass!=""){
		obj.className = strClass;
	}
	document.bgcolor='#088E10';
}
function dropCategory(obj){
	if(obj.className == "on"){
		obj.className = "off";
		document.frmLeft.objdrop.value = "";	
	}
	else{
		obj.className = "on";
		if(document.frmLeft.objdrop.value != ""){
			identity=document.getElementById(document.frmLeft.objdrop.value);
			identity.className = "off";
		}
		document.frmLeft.objdrop.value = obj.id;
	}
}
function checkSearch(frm){
	var objValue = frm.txtSearch.value;
	if(objValue==''){
		alert('Bạn hãy nhập nội dung tìm kiếm');
		frm.txtSearch.focus();
		return false;
	}
	if(objValue.length<3){
		alert('Nội dung tìm kiếm phải hơn 3 ký tự');
		frm.txtSearch.focus();
		return false;
	}
	
	return true;
}
function checkButtonSearchClick(frm){
	var objValue = frm.txtSearch.value;
	if(objValue==''){
		alert('Bạn hãy nhập nội dung tìm kiếm');
		frm.txtSearch.focus();
		return false;
	}
	if(objValue.length<3){
		alert('Nội dung tìm kiếm phải hơn 3 ký tự');
		frm.txtSearch.focus();
		return false;
	}
	frm.submit();
	return true;
}
function bieuquyet(QuestionId){
	var AnswerId = '';
	var height=300;
	var width=600;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	for (i = 0; i < document.QuestionAndAnswer.rdAnswer.length; i++){
		if (document.QuestionAndAnswer.rdAnswer[i].checked){
			AnswerId=document.QuestionAndAnswer.rdAnswer[i].value;
		}
	}
	if (AnswerId==''){
		alert("Bạn hãy chọn một phương án");
		return false;
	}
	else
	{
		url="BieuQuyet.asp?AnswerId="+AnswerId+"&QuestionId="+QuestionId;
		window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
		
	}
}
function xembieuquyet(QuestionId){
	var height=300;
	var width=600;
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
		url="XemBieuQuyet.asp?QuestionId="+QuestionId;
		window.open(url,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, left=" + left + ", top=" + top + ", width=" + width + ", height=" + height)
		
	return true;	
}
function movePage(page){
	if(!isNaN(page)){
		document.frmMovePage.Page.value = page;
		document.frmMovePage.submit();
	}
}
function modalDialog(URL,title,width,height){
	var top=(screen.height - height)/2;
	var left=(screen.width - width)/2;
	
	window.showModalDialog(URL, title, "dialogHeight: " + height + "px; dialogWidth: " + width + "px; dialogTop: " + top + "px; dialogLeft: " + left + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No; scrollbar: No");
//	window.open(URL,"","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=" + width + ", height=" + height)
//	if(strAlert != null && strAlert != ""){
//		alert(strAlert);
//	}
}
function checkSearchDate(frm){
	var day = frm.SDay.value;
	var month = frm.SMonth.value;
	var year = frm.SYear.value;
	
	if(day == ""&&month == ""&&year == ""){
		alert("Bạn phải nhập ngày hoặc tháng hoặc năm");
		return false;
	}
	return true;
}
//////////////////////////////////////////////////////////////////////
var zone;
var szone = 0;

function wrMyClock(m_city_name,m_hours,m_minutes,m_seconds){
	var dispTime = '';
	var amOrPm = "";

	if(m_seconds>=59){
		m_seconds = 0;
		m_minutes+=1;
	}
	else{
		m_seconds+=1;
	}
	if(m_minutes>=59){
		m_minutes = 0;
		m_hours+=1;
	}
	
	if(m_hours>=59){
		m_hours = 0;
		m_days+=1;
	}
//Format-----------------------------------------------------------------
	if (m_hours > 24) 		m_hours = m_hours-24;
	if (m_hours < 0) 		m_hours = m_hours+24;
	if (m_hours == 0) 		m_hours = 12;	
	if (m_hours >= 12)		amOrPm	= "PM";
	else					amOrPm	= "AM";
	if (m_hours > 12)		m_hours	= m_hours-12;	
	
	if (m_minutes <= 9) 	m_minutes = "0" + m_minutes;
	if (m_seconds <= 9) 	m_seconds = "0" + m_seconds;
	if (m_hours <= 9) 		m_hours = "0" + m_hours;

	dispTime = m_hours + ":" + m_minutes + ":" + m_seconds + " " + amOrPm ;
	dispTime="<p style='font-family:verdana,arial;font-size:7pt;color:#FFFFFF;margin:0;padding:5 0 0 0;'><b>" + m_city_name + ": </b>" + dispTime + "</p>";

	return dispTime;
}

function m_myclock() {
	var digital = new Date();
	var ofst_h;
	var ofst_m;
	var hours;
	var minutes;
	var seconds;
	var strTime;
//HaNoi-----------------------------------------------------------------
	zone = 7;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('HaNoi',hours,minutes,seconds);
	document.getElementById("pendule3").innerHTML=strTime;
//Sydney-----------------------------------------------------------------
	zone = 10;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('Sydney',hours,minutes,seconds);
	document.getElementById("pendule1").innerHTML=strTime;
//Tokyo-----------------------------------------------------------------
	zone = 9;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('Tokyo',hours,minutes,seconds);
	document.getElementById("pendule2").innerHTML=strTime;
//FrankFurt-----------------------------------------------------------------
	zone = 1;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('Frankfurt',hours,minutes,seconds);
	document.getElementById("pendule4").innerHTML=strTime;
//London-----------------------------------------------------------------
	zone = 0;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('London',hours,minutes,seconds);
	document.getElementById("pendule5").innerHTML=strTime;
//NewYork-----------------------------------------------------------------
	zone = -5;
	ofst_h	= digital.getTimezoneOffset()/60;
	ofst_m	= digital.getTimezoneOffset()%60;
	hours 	= digital.getHours() + parseInt(ofst_h) + parseInt(zone) + parseInt(szone);
	minutes = digital.getMinutes() + parseInt(ofst_m);
	seconds = digital.getSeconds();
	
	strTime = wrMyClock('NewYork',hours,minutes,seconds);
	document.getElementById("pendule6").innerHTML=strTime;
	
	setTimeout("m_myclock()",1000);
}
//////////////////////////////////////////////////////////////////////
var PageHost = '';
var RefDRight = new Array();
var RefDRight = new Array(
		new Array('/Images/icon_back.gif', '#', '1, 1, 1, 1, 1, 0, 1, 1, 600, 800, 0, 0, 2531', 115, 242, 1, 0)
		);
function ShowDivLogoRight()
{
	if (RefDRight.length==0) return;
	
	document.writeln('<table cellspacing=0 cellpadding=0 border=0>');
	for (i=0; i < RefDRight.length; i++)
	{
		document.writeln('<tr><td><a href="', RefDRight[i][1], '" onClick="return openMeExt(this, ', RefDRight[i][2], ', 1)"><img name="LeftDivLogo', RefDRight[i][5],'" src="', PageHost.concat(RefDRight[i][0]), '" width=115 border=0></a></td></tr>');							
		document.writeln('<tr><td height=2></td></tr>');							
	}	
	document.writeln('</table>');	
}
function openMeExt(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vHeight, vWidth, vTop, vLeft, vID, vCounter)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	winDef = '';
	winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
	winDef = winDef.concat('height=').concat(vHeight-140).concat(',');
	winDef = winDef.concat('width=').concat(vWidth).concat(',');

	if (vCentered)
	{
		winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
		winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	}
	else
	{
		winDef = winDef.concat('top=').concat(vTop).concat(',');
		winDef = winDef.concat('left=').concat(vLeft);
	}

	if (typeof(vCounter) == 'undefined')
	{
		vCounter = 0;
	}

	if (typeof(vID) == 'undefined')
	{
		vID = 0;
	}
	
	if (vCounter)
	{
		sLink = 'http://srv.vnexpress.net/Counter/?n='.concat(vID).concat('&u=').concat(escape(sLink)).concat('&r=').concat(Math.random());
	}

	open(sLink, '_blank', winDef);

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
var menuTopMargin = -550; //
var menuSpeed = 15;
var timerSpeed = 200;
var timer;
var heightLimit = 0;

function checkMenu() {
	if(document.body.offsetHeight > heightLimit) {
		var reTimer = timerSpeed;
		var startPoint = parseInt(document.all.sMenu.style.top,10);
		var endPoint = document.body.scrollTop;
		endPoint = (menuTopMargin <= endPoint ) ? endPoint - menuTopMargin : 0;
		if(startPoint != endPoint) {
			moveAmount = Math.ceil(Math.abs(endPoint - startPoint) / 15);
			document.all.sMenu.style.top = parseInt(document.all.sMenu.style.top,10) + ((endPoint<startPoint) ? -moveAmount : moveAmount);
			reTimer = menuSpeed;
		}
	} else document.all.sMenu.style.top = 0;
	timer = setTimeout("checkMenu();",reTimer);
}

function initMenu() {
	if(document.body.offsetHeight > heightLimit) document.all.sMenu.style.top = document.body.scrollTop;
	checkMenu();
}
function displayStatus(strStatus){
		window.status = strStatus;
}
var isIE = (document.getElementById && document.all);
function openImage(vLink, vHeight, vWidth)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;
	if (sLink == '')
	{
		return false;
	}
	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<title>Xem ảnh</title>');
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', (isIE) ? '' : '', '" border=0 title=\'Đóng lại\'></a>');
	newwin.document.writeln('</body>');
	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}
function openwindow(url,width,height)
{
	var sLink = (typeof(url.href) == 'undefined') ? url : url.href;
	if (sLink == '')
	{
		return false;
	}
	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(width).concat(',').concat('width=').concat(height).concat(',');
	winDef = winDef.concat('top=').concat((screen.width - width)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.height - height)/2);
	newwin = open('', '_blank', winDef);
	newwin.document.writeln('<title>Xem ảnh</title>');
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', (isIE) ? '' : '', '" border=0 title=\'Đóng lại\'></a>');
	newwin.document.writeln('</body>');
	if (typeof(url.href) != 'undefined')
	{
		return false;
	}
}
function showPLayerz(link)
{
	link = dd(link);

	var height = 60;
	var e = link.split('.'); e = e[e.length-1];

	if( e == 'wmv' ) height =300;

	var WMP7;
	try
	{
		if ( navigator.appName != "Netscape" )
		{
			WMP7 = new ActiveXObject('WMPlayer.OCX');
		}
	}
	catch (error)
	{
		;
	}
	var HTML = '';

	// Windows Media Player 7 Code
	if ( WMP7 )
	{
	HTML +=  ('<OBJECT height="'+height+'" width="100%" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>');
	HTML +=  ('<PARAM NAME="URL" VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="rate" VALUE="1">');
	HTML +=  ('<PARAM NAME="balance" VALUE="0">');
	HTML +=  ('<PARAM NAME="currentPosition" VALUE="0">');
	HTML +=  ('<PARAM NAME="defaultFrame" VALUE="">');
	HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
	HTML +=  ('<PARAM NAME="autoStart" VALUE="1">');
	HTML +=  ('<PARAM NAME="currentMarker" VALUE="0">');
	HTML +=  ('<PARAM NAME="invokeURLs" VALUE="-1">');
	HTML +=  ('<PARAM NAME="baseURL" VALUE="">');
	HTML +=  ('<PARAM NAME="mute" VALUE="0">');
	HTML +=  ('<PARAM NAME="uiMode" VALUE="full">');
	HTML +=  ('<PARAM NAME="stretchToFit" VALUE="0">');
	HTML +=  ('<PARAM NAME="windowlessVideo" VALUE="0">');
	HTML +=  ('<PARAM NAME="enabled" VALUE="-1">');
	HTML +=  ('<PARAM NAME="enableContextMenu" VALUE="0">');
	HTML +=  ('<PARAM NAME="fullScreen" VALUE="0">');
	HTML +=  ('<PARAM NAME="SAMIStyle" VALUE="">');
	HTML +=  ('<PARAM NAME="SAMILang" VALUE="">');
	HTML +=  ('<PARAM NAME="SAMIFilename" VALUE="">');
	HTML +=  ('<PARAM NAME="captioningID" VALUE="">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="100">');
	HTML +=  ('</OBJECT>');
	}
	// Windows Media Player 6.4 Code
	else
	{
	HTML +=  ('<OBJECT classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
	HTML +=  ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
	HTML +=  ('width="100%" height="'+height+'"');
	HTML +=  ('standby="Loading Microsoft Windows Media Player components..." ');
	HTML +=  ('type="application/x-oleobject" VIEWASTEXT> ');
	HTML +=  ('<PARAM NAME="FileName"           VALUE="'+link+'">');
	HTML +=  ('<PARAM NAME="TransparentAtStart" Value="false">');
	HTML +=  ('<PARAM NAME="AutoStart"          Value="true">');
	HTML +=  ('<PARAM NAME="AnimationatStart"   Value="false">');
	HTML +=  ('<PARAM NAME="ShowControls"       Value="false">');
	HTML +=  ('<PARAM NAME="ShowDisplay"	 value ="false">');
	HTML +=  ('<PARAM NAME="playCount" VALUE="999">');
	HTML +=  ('<PARAM NAME="displaySize" 	 Value="0">');
	HTML +=  ('<PARAM NAME="Volume" VALUE="100">');
	HTML +=  ('<Embed type="application/x-mplayer2" ');
	HTML +=  ('pluginspage= ');
	HTML +=  ('"http://www.microsoft.com/Windows/MediaPlayer/" ');
	HTML +=  ('src="'+link+'" ');
	HTML +=  ('Name=MediaPlayer ');
	HTML +=  ('transparentAtStart=0 ');
	HTML +=  ('autostart=1 ');
	HTML +=  ('playcount=999 ');
	HTML +=  ('volume=100');
	HTML +=  ('animationAtStart=0 ');
	HTML +=  ('width="100%" height="'+height+'"');
	HTML +=  ('displaySize=0></embed> ');
	HTML +=  ('</OBJECT> ');
	}

	var rn=Math.floor(Math.random()*2)
	if(rn==0)
		return '<div style="background: #fff; border: 4px solid #000" align="center"><a target="_blank" href="/Music/only/"><img src="/Images/ads/qc_cctns.gif" border="0"></a><a target="_blank" href="/Music/tuyentap/"><img src="/Images/ads/qc_tuyentap.gif" border="0"></a><a target="_blank" href="/Music/xuan2006/"><img src="/Images/ads/qc_nhacxuan.gif" border="0"></a>' + HTML + '</div>';	
	else
	{
		return '<div style="background: #000; border: 2px solid #000" align="center"><a target="_blank" href="/Music/Album/2006/02/05F6031D/?playAlbum=1"><img src="/Images/ads/DanTruong.jpg" border="0"></a><a target="_blank" href="/Music/Album/2006/02/05F60350/?playAlbum=1"><img src="/Images/ads/CamLy.jpg" border="0"></a><a target="_blank" href="/Music/Album/2006/02/05F6037C/?playAlbum=1"><img src="/Images/ads/PhuQuang.jpg" border="0"></a><a target="_blank" href="/Music/Album/2006/02/05F6027B/?playAlbum=1"><img src="/Images/ads/HoQuynhHuong.jpg" border="0"></a>' + HTML + '</div>';	
 	}

}
