﻿//additional properties for jQuery object
$(document).ready(function(){
    //align element in the middle of the screen
    $.fn.alignCenter = function() {
    //get margin left
    var marginLeft = parseInt($(window).width()/2 - $(this).width()/2) + 'px';
    //get margin top
    var marginTop = parseInt($(window).height()/2 - $(this).height()/2) + 'px';
    //return updated element
    return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop});
    };
});

//open pop-up
function showPopup(divId)
{
    //when IE - fade immediately
    if($.browser.msie)
    {
        $('#opaco').height($(document).height()).toggleClass('hidden');
    }
    else
    //in all the rest browsers - fade slowly
    {
        $('#opaco').height($(document).height()).toggleClass('hidden').fadeTo('slow', 0.7);
    }

    $('#popup')
        .html($('#' + divId).html())
        .alignCenter()
        .toggleClass('hidden');

    $("#divAdsRotator").hide();

    return false;
}

//close pop-up box
function closePopup()
{
    $('#opaco').toggleClass('hidden').removeAttr('style');
    $('#popup').toggleClass('hidden');
    
    $("#divAdsRotator").show();
    
    return false;
}
