﻿// JScript File
// Init parameters for datetime
//var Days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var Days = new Array("Ch&#7911; nh&#7853;t","Th&#7913; hai","Th&#7913; ba","Th&#7913;  t&#432;","Th&#7913;  n&#259;m","Th&#7913; s&aacute;u","Th&#7913; b&#7843;y");
var sign = "/";
var signdigit = ":";
var signchar = ",";
var space=	" ";
var tickTime;
function startTime()
{
	var DateTime = "";	
	var TheDate = new Date();
	var TheDay = Days[TheDate.getDay()];
		
	var TheMonth = TheDate.getMonth()+1;
	if (TheMonth < 10) TheMonth = "0" + TheMonth;
	
	var TheMonthDay = TheDate.getDate();
	if (TheMonthDay < 10) TheMonthDay = "0" + TheMonthDay;

	var TheYear = TheDate.getYear();
	if (TheYear < 1000) TheYear += 1900;
	
	var timeType = "";
	//timeType = "GMT +7";
	
	var Digital=new Date()
	var hours=Digital.getHours()
	if (hours<=9) hours="0"+hours
	var minutes=Digital.getMinutes()
	if (minutes<=9) minutes="0"+minutes
	var seconds=Digital.getSeconds()
	if (seconds<=9) seconds="0"+seconds				
	
	DateTime +=space+TheDay+signchar+space+TheMonthDay+sign+TheMonth+sign+TheYear+space+space+hours+signdigit+minutes+signdigit+seconds;
	document.getElementById("Timer").innerHTML = DateTime;
	tickTime=setTimeout("startTime()",1000);   
}

function PageLoad()
{
	startTime();
}

function PageUnload()
{	
 	clearTimeout(tickTime);
}

function pressesEnter(e)    //e is event object passed from function invocation
{ 
	var theForm = document.frm;	
	var characterCode; //literal character code will be stored in this variable	
	//if which property of event object is supported (NN4)
	if(e && e.which)
	{ 
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
	} else
	{
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}	
	if(characterCode == 13) //if generated character code is equal to ascii 13 (if enter key)
	{ 
        document.aspnetForm.submit();
	} 
}

document.write('<script language="JavaScript"> \n');
document.write('window.onerror=function(){clickURL=document.location.href;return true;} \n');
document.write('if(!self.clickURL) clickURL=parent.location.href; \n');
document.write('<\/script> \n');

var popWin="width=630,height=500,resizable=1,scrollbars=1";
/*Functions*/

function autologin (id) {
	window.open('auto_login.aspx?mid='+id,'click',popWin);
	return false;
}


function ST (cid, id) {
	window.open('NewsToolSave.aspx?cid='+cid+'&id='+id,'click',popWin);
	return false;
}

function STMouseOver () {
	window.status='Luu bai viet';
	return true;
}

function STMouseOut () {
	window.status='';
	return true;
}

function KT (id) {
	window.open('KnowledgeToolEmail.aspx?id='+id,'click',popWin);
	return false;
}

function ET (cid, id) {
	window.open('NewsToolEmail.aspx?cid='+cid+'&id='+id,'click',popWin);
	return false;
}

function ETMouseOver () {
	window.status='Gui bai viet qua email';
	return true;
}

function ETMouseOut () {
	window.status='';
	return true;
}

function PT (cid, id) {
	window.open('NewsToolPrint.aspx?cid='+cid+'&id='+id,'click',popWin);
	return false;
}

function PTMouseOver () {
	window.status='Ban in bai viet';
	return true;
}

function PTMouseOut () {
	window.status='';
	return true;
}

function printArticle() {
	if (window.print) {
		setTimeout('window.print();', 333);
	}
}

function hidePrint() {
	if (document.all) {
		document.all.hideTop.innerHTML = "";
		document.all.hideBottom.innerHTML = "";
	}
}

function showPrint() {
	document.getElementById("divPrintTop").style.display = 'none';
	document.getElementById("divPrintBottom").style.display = 'none';
}
