﻿// Hieu ung mouse over
var oldClr;
var oldFontColor;
function overchangclr(obj,bgcolor,FontColor)
{	//openPage('http://www.vnn.vn')
	oldClr=obj.style.backgroundColor;
	oldFontColor=obj.style.color;
	obj.style.backgroundColor=bgcolor;	
	obj.style.color=FontColor;
	obj.style.cursor='hand';
	return true;	
}
function outchangclr(obj)
{
	obj.style.backgroundColor=oldClr;
	obj.style.color=oldFontColor;
	return true;	
}
//Mở một web page
function openPage(url,vtarget)
{
var sFeature="width=" + screen.width + ", height=" + screen.height + ", resizable=no, location=no, status=no, scrollbars=yes, top=0, left=0, menubar=no";
window.open(url,vtarget,sFeature);
return true;
}
function openPageExt(url,vheight,vwidth,vtarget,vscroll)
{
var sFeature="width=" + vwidth + ", height=" + vheight + ", top=" + (screen.height-vheight)/2 + ", left=" + (screen.width-vwidth)/2 +  ", resizable=no, location=no, status=no, scrollbars=" + vscroll + ",menubar=no";
//alert(sFeature);
window.open(url,vtarget,sFeature);
return true;
}
//Mở một web dialog page
function openDialog(url,agmSend,closewindow)
{
var sFeature="dialogHeight: 630px; dialogWidth: 760px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;";
window.showModalDialog(url,agmSend,sFeature);
if (closewindow)
	{
		window.close();
		}
return true;
}
function openDialogExt(url,agmSend,height,width)
{
var sFeature="dialogHeight: " + height +  "px; dialogWidth: " + width +  "px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;";
window.showModalDialog(url,agmSend,sFeature);
return true;
}
//--------------------------------
//Đóng một cửa sổ S_alert là thông báo đóng cửa sổ, direcClose là đóng trực tiếp hay đóng gián tiếp(có hỏi xem có đóng thật không)
function CloseWindow(S_alert,direcClose)
{
if (direcClose)
{
alert(S_alert);
window.close();
return true;
}
if (S_alert.length!='')
{
	var bConfirm=window.confirm(S_alert);	
	if (bConfirm)
	   {
		window.close();
		}		
}
else
	{
	window.close();
	}
return true;
}
//-------------------------------------
// Dong ho dien tu
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;

function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = "" + ((hours >12) ? hours -12 :hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        timeValue += (hours >= 12) ? " PM" : " AM"
        document.clock.face.value =timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}
//------------------------------------ dong ho dien tu


