﻿// JavaScript Document
// 2/7/2011 - DES
//  -- initial for specific use on default.aspx

$(document).ready(function() {

    //Fade in the Popup and add close button
    $('#popup_name').fadeIn().css({ 'width': 350 })//.prepend('<a href="#" class="close"><img src="images/icons/delete.png" class="btn_close" title="Close Window" alt="Close" /></a>');

    //Define margin for center alignment (vertical + horizontal) - we add 80 to the height/width to accomodate for the padding + border width defined in the css
    var popMargTop = ($('#popup_name').height() + 80) / 2;
    var popMargLeft = ($('#popup_name').width() + 80) / 2;

    //Apply Margin to Popup
    $('#popup_name').css({
        'margin-top': -popMargTop,
        'margin-left': -popMargLeft
    });

    $('#fade').css({ 'filter': 'alpha(opacity=50)' }).fadeIn(); //Fade in the fade layer


    //Close Popups and Fade Layer
    $('a.close').live('click', function() { //When clicking on the close or fade layer...
    $('#fade ,#popup_name ,.popup_block').fadeOut(function() {
            $('#fade, a.close, #bragpostroot').remove();  //fade them both out
        });
        return false;
    });


});

