﻿//$Author: jengland $

//$LastChangedDate: 2010-02-23 18:53:08 -0600 (Tue, 23 Feb 2010) $

//$Rev: 6905 $

//$HeadURL:$

var $j = jQuery.noConflict();

jQuery.fn.center = function() {
    // Always return each...
    return this.each(function() {
        var w = jQuery(window).width();
        var ow = jQuery(this).outerWidth();
        var sl = jQuery(window).scrollLeft();
        var h = jQuery(window).height();
        var oh = jQuery(this).outerHeight();
        var st = jQuery(window).scrollTop();
        var leftPos = (w - ow) / 2 + sl,
            topPos = (h - oh) / 2 + st;

        // Make sure element is not out of bounds
        leftPos = (leftPos < 0) ? 0 : leftPos;
        topPos = (topPos < 0) ? 10 : topPos;

        jQuery(this).css({ left: leftPos + 'px', top: topPos + 'px', zIndex: '1000' });
    });
};

function setParentClass() {
    var parentOf = $j('span.AspNet-TreeView-ClickableNonLink').parent();
    parentOf.addClass('noHover');
};

function pageLoad(sender, args)
{
    var container = $j('body');
    var modalBackground = $j('.ModalBackground');
    var popupServer = $j('.popupServer');

    modalBackground.css('height', container.attr('clientHeight'));
    popupServer.center();

    setParentClass();
};


