﻿/* This is a javascript clock.
It will update the following span.
<span id="clock">&nbsp;</span>

(if you add the following to the body tag)
onload="updateClock(); setInterval('updateClock()', 1000 )"

*/


function updateClock() {
    var currentTime = new Date();

    var currentHours = currentTime.getHours();
    var currentMinutes = currentTime.getMinutes();
    var currentSeconds = currentTime.getSeconds();

    // Pad the minutes and seconds with leading zeros, if required
    currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
    currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;

    // Choose either "AM" or "PM" as appropriate
    var timeOfDay = (currentHours < 12) ? "AM" : "PM";

    // Convert the hours component to 12-hour format if needed
    currentHours = (currentHours > 12) ? currentHours - 12 : currentHours;

    // Convert an hours component of "0" to "12"
    currentHours = (currentHours == 0) ? 12 : currentHours;

    // Compose the string for display
    var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

    // Update the time display
    document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
function adjustFloatingImages() {
    // Change container for imgs to work on another app.
    var imgs = $('.PanelContent').find('img');

    for (var i = 0; i < imgs.length; i++) {

        var img = imgs.eq(i);
        var img_style = img.attr('style');


        if (img_style.indexOf('float: left') != -1) {
            img.css('margin-right', '10px');
            img.css('margin-bottom', '10px');

        }
        if (img_style.indexOf('float: right') != -1) {
            img.css('margin-left', '10px');
            img.css('margin-bottom', '10px');
        }
    }
}
function toggleDetail(sender) {
    var s = $(sender).attr('href');
    var dtl = $(s);
    dtl.slideToggle(750);
    var toggler_text = $(sender).text();
    if (toggler_text == '(more)') {
        $(sender).text('(less)');
    } else {
        $(sender).text('(more)');
    }
    return false;
}
function showWin(win_index) {

    //Shows the specified window.

    var main_pop = ASPxClientPopupControl.Cast('c_popup');
    main_pop.ShowWindow(main_pop.GetWindow(win_index));

    return false;
}
