/*
 * Path information
 */
var SinewPath = document.location.pathname;
var RootURL = document.URL.substr(0, document.URL.lastIndexOf(SinewPath));
var FullRoot = RootURL + SinewPath;

/*
 * Message Billboard
 */
$(window).ready(function () {
    $('#MessageBillboardPlaceholder').click(function () {
        $('#MessageBillboardPlaceholder').fadeOut();
        $('#MessageBillboardPlaceholder').html('');
    });
});

function DisplayNotificationMessage(MessageToShow) {
    $('#MessageBillboardPlaceholder').removeClass();
    $('#MessageBillboardPlaceholder').addClass('MessageHolder');
    $('#MessageBillboardPlaceholder').addClass('NotificationMessage');
    $('#MessageBillboardPlaceholder').html(MessageToShow);
    $('#MessageBillboardPlaceholder').show("slow", function () {
        setTimeout(function() { $('#MessageBillboardPlaceholder').fadeOut(); }, 5000);
    });
}

function DisplayErrorMessage(MessageToShow) {
    $('#MessageBillboardPlaceholder').removeClass();
    $('#MessageBillboardPlaceholder').addClass('MessageHolder');
    $('#MessageBillboardPlaceholder').addClass('ErrorMessage');
    $('#MessageBillboardPlaceholder').html(MessageToShow);
    $('#MessageBillboardPlaceholder').show("slow", function () {
        setTimeout(function() { $('#MessageBillboardPlaceholder').fadeOut(); }, 5000);
    });
}

// This function is used to replace the HTML content of a container object with
// HTML content from a URL.  This function will always call the page using the
// post method.
function DisplayAjaxPage_Post(URL, Placeholder) {
    $.post(URL, function(data) {
        $(Placeholder).html(data);
        $(Placeholder).removeClass('HideElement');
    });
}

// This function will resize a window to the given dimensions and center it
// within the browser window.
function ResizeAndCenter(Element, ElementWidth, ElementHeight) {
    var PageWidth = $(window).width();
    var PageHeight = $(window).height();

    var StartLeft = (PageWidth - ElementWidth) / 2;
    var StartTop = (PageHeight - ElementHeight) / 2;

    $(Element).width(ElementWidth);
    $(Element).height(ElementHeight);
    $(Element).css({left: StartLeft + 'px', top: StartTop + 'px'});
}