// display current date and time at author location
// =======================================
// copyright Stephen Chapman, Felgall Pty Ltd, 11 July 2001, 25th November 2004, 12th October 2006
// 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 = 1;       // set to 1 for daylight savings time
                   // update this as you go on and off 
var mtz = -5;      // set to your local timezone (hours ahead of UTC, negative if behind)
var stdz = ''; // standard time indicatordaylight saving time
var loc = 'Heure aux Îles : '; // set to your location
var dayz = ''; // daylight saving time indicator (blank if you dont have daylight saving)
var showDate = 1; // 0 = don't show, 1 = international format, 2 = US format

// do not alter anything below this line
var newP = document.createElement("span"); 
var txt = loc ; 
var newT = document.createTextNode(txt); newP.appendChild(newT); 
var newP2 = document.createElement("span"); newP2.id = 'time'; 
var txt2 = setDsp(mtz,dst,stdz,dayz,showDate); 
var newT2 = document.createTextNode(txt2); newP2.appendChild(newT2); 
var frag = document.createDocumentFragment(); frag.appendChild(newP); frag.appendChild(newP2); 
var d2 = document.getElementById('datetime'); d2.parentNode.replaceChild(frag,d2); setTimeout('updDsp('+mtz+',' +dst+',"' +stdz+'","' +dayz+'","'+showDate+'")', 1000);}
var pageLoaded = 0; window.onload = function() {pageLoaded = 1;}

function loaded(i,f) {if (document.getElementById && document.getElementById(i) != null) f(); else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}
function updDsp(mtz,dst,stdz,dayz,showDate) {var obj = document.getElementById('time'); obj.firstChild.data = setDsp(mtz,dst,stdz,dayz,showDate); setTimeout('updDsp('+mtz+ ','+dst+ ',"'+stdz+ '","'+dayz+ '","'+showDate+'")', 1000);
}
function setDsp(mtz,dst,stdz,dayz,showDate) {
var dayname = ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi']; 
var month = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']; 
var now = new Date; now.setUTCMinutes(now.getUTCMinutes() + (mtz + dst)*60); 
var dow = now.getUTCDay(); 
var seconds = now.getUTCSeconds();
var minute = now.getUTCMinutes(); 
var hour = now.getUTCHours(); 
if (hour > 24) {ampm = ''; hour -= 24;} else {ampm = ''}; if (hour == 0) {hour = 0;}
if (minute < 10) {pad = ':0';} else {pad = ':';} 
if (seconds < 10) {pads = ':0';} else {pads = ':';} 
var txt = hour + pad + minute + pads + seconds + ' ' + ampm + dayname[dow];
if (showDate == 1) txt += ' ' + now.getUTCDate() + ' '  + month[now.getUTCMonth()]  + ' ' + now.getUTCFullYear();
if (showDate == 2) txt += ' ' + month[now.getUTCMonth()] +' '  + now.getUTCDate() + ' ' + now.getUTCFullYear();
return (txt);

}

loaded('datetime',myTime);// JavaScript Document


