﻿// Written:     10-OCT-2009  Chris Doan
// Last Update: 02-DEC-2009          CD
var sBrowser;

function load() {
    var nBrowserWidth = 960, nBrowserHeight = 800;

    sBrowser = navigator.appName;

    ShowDateTime();

    try {
        GetScreenSize();
        var nBrowserLeft = (screen.width - nBrowserWidth) / 2;
        var nBrowserTop = (screen.height - nBrowserHeight) / 2;
        //window.moveTo(nBrowserLeft, nBrowserTop);
        window.resizeTo(nBrowserWidth, nBrowserHeight);
    }
    catch (e) {
    }
}

// Written:     22-OCT-2009  Chris Doan
// Last Update: 26-NOV-2009          CD
var nBrowserWidth = 0; nBrowserHeight = 0;
function GetScreenSize() {
    var s = sBrowser.toLowerCase();
    var n = s.indexOf("explorer");
    bIE = n > 0 ? true : false;
    if (bIE) {
        nBrowserWidth = document.body.offsetWidth;
        nBrowserHeight = document.body.offsetHeight;
    }
    else {
        nBrowserWidth = window.innerWidth;
        nBrowserHeight = window.innerHeight;
        mwidth = Math.round(.061 * nBrowserWidth);
    }
}

// Written:     13-OCT-2009  Chris Doan
// Last Update: 22-OCT-2009          CD
function ShowDateTime() {
    if (!document.all && !document.getElementById)
        return;

    thelement = document.getElementById("datetime");
    var Digital = new Date();
    var year = Digital.getFullYear();
    var date = Digital.getDate();
    var hours = Digital.getHours();
    var minutes = Digital.getMinutes();
    var seconds = Digital.getSeconds();
    var dn = "PM";
    if (hours < 12)
        dn = "AM";
    if (hours > 12)
        hours = hours - 12;
    if (hours == 0)
        hours = 12
    if (minutes <= 9)
        minutes = "0" + minutes
    if (seconds <= 9)
        seconds = "0" + seconds;
    var ctime = hours + ":" + minutes + ":" + seconds + " " + dn;

    var month = new Array(12);
    month[0] = "January";
    month[1] = "February";
    month[2] = "March";
    month[3] = "April";
    month[4] = "May";
    month[5] = "June";
    month[6] = "July";
    month[7] = "August";
    month[8] = "September";
    month[9] = "October";
    month[10] = "November";
    month[11] = "December";
    m = month[Digital.getMonth()];

    var weekday = new Array(7);
    weekday[0] = "Sunday";
    weekday[1] = "Monday";
    weekday[2] = "Tuesday";
    weekday[3] = "Wednesday";
    weekday[4] = "Thursday";
    weekday[5] = "Friday";
    weekday[6] = "Saturday";
    wd = weekday[Digital.getDay()];

    thelement.innerHTML = "<span style = 'font-size:14;color:navy;position:absolute;right:20px'>" + ctime + " on " + wd + ", " + m + " " + date + ", " + year + "</span>";
    setTimeout("ShowDateTime()", 1000);
}
