/* -- Private Functions WHS */

function WH_openBrWindow(URL,winName,features) {
         window.open(URL,winName,features);
         }


/* -- Global Functions */
function CSCloseWindow() {
if (self.parent.frames.length != 0) {
        self.parent.close()
        } else {
        window.close()
        }
}

function CSOpenWindow(action) {
        var wf = "";
        wf = wf + "width=" + action[3];
        wf = wf + ",height=" + action[4];
        wf = wf + ",resizable=" + (action[5] ? "yes" : "no");
        wf = wf + ",scrollbars=" + (action[6] ? "yes" : "no");
        wf = wf + ",menubar=" + (action[7] ? "yes" : "no");
        wf = wf + ",toolbar=" + (action[8] ? "yes" : "no");
        wf = wf + ",directories=" + (action[9] ? "yes" : "no");
        wf = wf + ",location=" + (action[10] ? "yes" : "no");
        wf = wf + ",status=" + (action[11] ? "yes" : "no");
        window.open(action[1],action[2],wf);
}

function CSClickReturn () {
        var bAgent = window.navigator.userAgent;
        var bAppName = window.navigator.appName;
        if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
                return true; /* dont follow link */
        else return false; /* dont follow link */
}
function CSButtonReturn () { return !CSClickReturn(); }

function CSBrowserSwitch(action) {
        var bAgent        = window.navigator.userAgent;
        var bAppName        = window.navigator.appName;
        var isNS                = (bAppName.indexOf("Netscape") >= 0);
        var isIE                = (bAppName.indexOf("Explorer") >= 0);
        var isWin                = (bAgent.indexOf("Win") >= 0);
        var isMac                = (bAgent.indexOf("Mac") >= 0);
        var vers                = 0;
        var versIdx        = (bAgent.indexOf("Mozilla/"));
        if(versIdx >= 0)
                {
                var sstr        = bAgent.substring(versIdx + 8, versIdx + 9);
                vers                = parseInt(sstr) - 2;
                }
        var url                = action[1];
        var platform        = action[2];
        var versVec;
        if(platform)
                {
                if(isNS && isMac) versVec = action[3];
                if(isIE && isMac) versVec = action[5];
                if(isNS && isWin) versVec = action[4];
                if(isIE && isWin) versVec = action[6];
                }
        else
                {
                if(isNS) versVec = action[3];
                if(isIE) versVec = action[4];
                }
        if(vers > (versVec.length-1))
                vers = versVec.length-1;
        if(versVec[vers] == 0)
                {
                location                        = url;
                CSStopExecution        = true;
                }
}

function CSshowtimedateID(action) {
        (action[2] != "") ? (updateobject = action[2]) : (updateobject = action[1])
        showtime = action[3]
        usemilitary = action[4]
        showdate = action[5]
        dateformat = action[6]
        showday = action[7]
        leadin = action[8]
        opentag = action[9]
        closetag = action[10]
        theTimer = setTimeout("theClockDate()",10);
}
function theClockDate() {
        now = new Date()
        theMonth = now.getMonth() + 1
        theDate = now.getDate()
        theYear = now.getFullYear()
        theDay = now.getDay()
        hours = now.getHours()
        if(navigator.appVersion.indexOf("MSIE 5.0; Macintosh") != -1) {
        if (theMonth <= 11 && theMonth >= 4) { hours = hours + 1}
        }
        ampm = ((hours >= 12) ? "PM" : "AM");
        hours = ((hours > 12 && usemilitary == false) ? hours -12 : hours);
        if (hours == 0) hours = 12;
        if (hours >= 1 && hours <=9) hours = "0" + hours;
        minutes = now.getMinutes()
        if (minutes < 10) minutes = "0" + minutes;
        time = "";
        (showtime == true) ? (time = " " + hours + ":" + minutes) : (time = "",ampm="");
        (usemilitary == true) ? (ampm="") : (ampm=ampm);
        days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
        today = days[theDay];
        if (showdate == true) {
                if (dateformat == 0) todisplay = theMonth + "/" + theDate + "/" + theYear;
                if (dateformat == 1) todisplay = theDate + "/" + theMonth + "/" + theYear;
                if (dateformat == 2) todisplay = theYear + "/" + theMonth + "/" + theDate;
                if (dateformat == 3) todisplay = theYear + "/" + theDate + "/" + theMonth;
                } else {todisplay = "" }
        if (showday == true) todisplay =  today + ", " + todisplay;
        if (document.all) { document.all(updateobject).innerHTML = opentag + leadin + todisplay + time + " " + ampm + closetag; }
        else {
                if (document.getElementById) { document.getElementById(updateobject).innerHTML = opentag + leadin + todisplay + time + " " + ampm + closetag; }
}
theTimer = setTimeout("theClockDate()",2000);
}



function theClock() {
clearTimeout(theTimer);
var now = new Date();
var correct = now.toGMTString();
time_string = correct.split(' ');
hm = time_string[4];
hm_string = hm.split(':');
var hours = hm_string[0] - 0;
var suffix = " A.M."
if (dst == true) dstoffset = 1
hours = hours + offset + dst;
        if (hours < 0) hours +=24
        if (hours > 11 && hours < 24)  suffix = " P.M."
        if (hours > 12 && military == false) hours -=12;

var minutes = now.getMinutes();
var timeValue12 = "" + ((hours > 12) ? hours -12 : hours)
if (timeValue12 == 0) timeValue12 = 12
var timeValue24 = "" + ((hours > 23) ? hours -24 : hours)
timeValue12 += ((minutes < 10) ? ":0" : ":") + minutes
timeValue12 += suffix
timeValue24 += ((minutes < 10) ? ":0" : ":") + minutes
        if(military == false)  {
        WorldTime = message + timeValue12;
        } else {
        WorldTime = message + timeValue24
        }
        if(statuscheck == true)  window.status = WorldTime
        if(formcheck == true)  document.forms[form].elements[elem].value  = WorldTime
theTimer = setTimeout("theClock()",5000);
}
/* EOF */