// display current time at author location
// =======================================
// copyright Stephen Chapman, Felgall Pty Ltd, 11 July 2001, 25th November 2004
// http://www.felgall.com/ and http://javascript.about.com/
// permission is given to use this script
// provided that all comment lines in the script are retained

function myTime() {
var dst = 0;       // set to 1 for daylight savings time
                   // update this as you go on and off daylight saving time

//var loc = 'Sydney, Australia'; // set to your location
var loc = 'Halong, Vietnam'; // set to your location
var mtz = 7;      // set to your local timezone (hours ahead of UTC, negative if behind)
var stdz = 'AEST'; // standard time indicator
var dayz = 'ADST'; // daylight saving time indicator (blank if you dont have daylight saving)

// do not alter anything below this line
document.writeln('<span id="time">' + setDsp(mtz,dst,stdz,dayz) + '<\/span>');
if (DOMsupported) setTimeout('updDsp('+mtz+','+dst+',"'+stdz+'","'+dayz+'")',5000);
}

var DOMsupported = 0;var standardDOMsupported = 0;var ieDOMsupported = 0;
if (document.getElementById) {standardDOMsupported = 1; DOMsupported = 1;}
else { if (document.all) {ieDOMsupported = 1; DOMsupported = 1;}
}
function findDOM(objectId) {
if (standardDOMsupported) {return (document.getElementById(objectId));}
if (ieDOMsupported) {return (document.all[objectId]);}
}

function updDsp(mtz,dst,stdz,dayz) {
var obj = findDOM('time');
obj.innerHTML = setDsp(mtz,dst,stdz,dayz);
setTimeout('updDsp('+mtz+','+dst+',"'+stdz+'","'+dayz+'")',5000);
}
function setDsp(mtz,dst,stdz,dayz) {
var dayname = new Array ('Sun','Mon','Tue','Wed','Thu','Fri','Sat','Sun');
var monthArr = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var now = new Date;
now.setUTCHours(now.getUTCHours() + mtz + dst);
var dow = now.getUTCDay();
var minute = now.getUTCMinutes();
var hour = now.getUTCHours();
var date= now.getUTCDate();
var month = now.getUTCMonth();
var year = now.getFullYear();
if (hour > 11) {ampm = 'pm'; hour -= 12;} else {ampm = 'am'}
if (hour == 0) {hour = 12;} if (minute < 10) {pad = ':0';} else {pad = ':';}
var txt =dayname[dow] + ', ' + monthArr[month] + ' ' + date + ' ' + year   ;
 
txt += ' | ' +  hour + pad + minute + ' ' + ampm  ;
txt += ' (GMT+7)';
return (txt);
}

